On second thoughts show to utf8 skippage message only
[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 Mon Jun  4 06:11:38 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 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 afsroot=''
277 alignbytes=''
278 ansi2knr=''
279 archlib=''
280 archlibexp=''
281 d_archlib=''
282 installarchlib=''
283 archname=''
284 myarchname=''
285 d_atolf=''
286 d_atoll=''
287 baserev=''
288 bin=''
289 binexp=''
290 installbin=''
291 bincompat5005=''
292 d_bincompat5005=''
293 byteorder=''
294 cc=''
295 ccflags=''
296 cppflags=''
297 ldflags=''
298 lkflags=''
299 locincpth=''
300 optimize=''
301 cf_email=''
302 cf_by=''
303 cf_time=''
304 charsize=''
305 contains=''
306 cpp_stuff=''
307 cpplast=''
308 cppminus=''
309 cpprun=''
310 cppstdin=''
311 crosscompile=''
312 d__fwalk=''
313 d_access=''
314 d_accessx=''
315 d_alarm=''
316 d_attribut=''
317 d_bcmp=''
318 d_bcopy=''
319 d_bzero=''
320 d_casti32=''
321 castflags=''
322 d_castneg=''
323 d_chown=''
324 d_chroot=''
325 d_chsize=''
326 d_closedir=''
327 d_void_closedir=''
328 d_cmsghdr_s=''
329 d_const=''
330 cryptlib=''
331 d_crypt=''
332 d_csh=''
333 full_csh=''
334 d_cuserid=''
335 d_dbl_dig=''
336 d_difftime=''
337 d_dlerror=''
338 d_dlopen=''
339 d_dlsymun=''
340 d_dosuid=''
341 d_suidsafe=''
342 d_drand48proto=''
343 d_dup2=''
344 d_eaccess=''
345 d_endgrent=''
346 d_endhent=''
347 d_endnent=''
348 d_endpent=''
349 d_endpwent=''
350 d_endsent=''
351 d_fchmod=''
352 d_fchown=''
353 d_fcntl=''
354 d_fcntl_can_lock=''
355 d_fd_macros=''
356 d_fd_set=''
357 d_fds_bits=''
358 d_fgetpos=''
359 d_flexfnam=''
360 d_flock=''
361 d_fork=''
362 d_fpos64_t=''
363 d_frexpl=''
364 d_fs_data_s=''
365 d_fseeko=''
366 d_fsetpos=''
367 d_fstatfs=''
368 d_fsync=''
369 d_ftello=''
370 d_ftime=''
371 d_gettimeod=''
372 d_Gconvert=''
373 d_getcwd=''
374 d_getespwnam=''
375 d_getfsstat=''
376 d_getgrent=''
377 d_getgrps=''
378 d_gethbyaddr=''
379 d_gethbyname=''
380 d_gethent=''
381 aphostname=''
382 d_gethname=''
383 d_phostname=''
384 d_uname=''
385 d_gethostprotos=''
386 d_getitimer=''
387 d_getlogin=''
388 d_getmnt=''
389 d_getmntent=''
390 d_getnbyaddr=''
391 d_getnbyname=''
392 d_getnent=''
393 d_getnetprotos=''
394 d_getpagsz=''
395 d_getpent=''
396 d_getpgid=''
397 d_getpgrp2=''
398 d_bsdgetpgrp=''
399 d_getpgrp=''
400 d_getppid=''
401 d_getprior=''
402 d_getpbyname=''
403 d_getpbynumber=''
404 d_getprotoprotos=''
405 d_getprpwnam=''
406 d_getpwent=''
407 d_getsent=''
408 d_getservprotos=''
409 d_getspnam=''
410 d_getsbyname=''
411 d_getsbyport=''
412 d_gnulibc=''
413 d_hasmntopt=''
414 d_htonl=''
415 d_iconv=''
416 d_inetaton=''
417 d_int64_t=''
418 d_isascii=''
419 d_isnan=''
420 d_isnanl=''
421 d_killpg=''
422 d_lchown=''
423 d_ldbl_dig=''
424 d_link=''
425 d_locconv=''
426 d_lockf=''
427 d_longdbl=''
428 longdblsize=''
429 d_longlong=''
430 longlongsize=''
431 d_lseekproto=''
432 d_lstat=''
433 d_madvise=''
434 d_mblen=''
435 d_mbstowcs=''
436 d_mbtowc=''
437 d_memchr=''
438 d_memcmp=''
439 d_memcpy=''
440 d_memmove=''
441 d_memset=''
442 d_mkdir=''
443 d_mkdtemp=''
444 d_mkfifo=''
445 d_mkstemp=''
446 d_mkstemps=''
447 d_mktime=''
448 d_mmap=''
449 mmaptype=''
450 d_modfl=''
451 d_mprotect=''
452 d_msg=''
453 d_msgctl=''
454 d_msgget=''
455 d_msghdr_s=''
456 d_msgrcv=''
457 d_msgsnd=''
458 d_msync=''
459 d_munmap=''
460 d_nice=''
461 d_off64_t=''
462 d_open3=''
463 d_fpathconf=''
464 d_pathconf=''
465 d_pause=''
466 d_pipe=''
467 d_poll=''
468 d_portable=''
469 d_old_pthread_create_joinable=''
470 old_pthread_create_joinable=''
471 d_pthread_yield=''
472 d_sched_yield=''
473 sched_yield=''
474 d_qgcvt=''
475 d_readdir=''
476 d_rewinddir=''
477 d_seekdir=''
478 d_telldir=''
479 d_readlink=''
480 d_readv=''
481 d_realpath=''
482 d_recvmsg=''
483 d_rename=''
484 d_rmdir=''
485 d_safebcpy=''
486 d_safemcpy=''
487 d_sanemcmp=''
488 d_sbrkproto=''
489 d_select=''
490 d_sem=''
491 d_semctl=''
492 d_semget=''
493 d_semop=''
494 d_sendmsg=''
495 d_setegid=''
496 d_seteuid=''
497 d_setgrent=''
498 d_setgrps=''
499 d_sethent=''
500 d_setitimer=''
501 d_setlinebuf=''
502 d_setlocale=''
503 d_setnent=''
504 d_setpent=''
505 d_setpgid=''
506 d_setpgrp2=''
507 d_bsdsetpgrp=''
508 d_setpgrp=''
509 d_setprior=''
510 d_setproctitle=''
511 d_setpwent=''
512 d_setregid=''
513 d_setresgid=''
514 d_setresuid=''
515 d_setreuid=''
516 d_setrgid=''
517 d_setruid=''
518 d_setsent=''
519 d_setsid=''
520 d_setvbuf=''
521 d_sfio=''
522 usesfio=''
523 d_shm=''
524 d_shmat=''
525 d_shmatprototype=''
526 shmattype=''
527 d_shmctl=''
528 d_shmdt=''
529 d_shmget=''
530 d_sigaction=''
531 d_sigprocmask=''
532 d_sigsetjmp=''
533 d_sockatmark=''
534 d_msg_ctrunc=''
535 d_msg_dontroute=''
536 d_msg_oob=''
537 d_msg_peek=''
538 d_msg_proxy=''
539 d_oldsock=''
540 d_scm_rights=''
541 d_socket=''
542 d_sockpair=''
543 sockethdr=''
544 socketlib=''
545 d_socklen_t=''
546 d_socks5_init=''
547 d_sqrtl=''
548 d_sresgproto=''
549 d_sresuproto=''
550 d_statblks=''
551 d_statfs_f_flags=''
552 d_statfs_s=''
553 d_fstatvfs=''
554 d_statvfs=''
555 d_stdio_cnt_lval=''
556 d_stdio_ptr_lval=''
557 d_stdio_ptr_lval_nochange_cnt=''
558 d_stdio_ptr_lval_sets_cnt=''
559 d_stdiobase=''
560 d_stdstdio=''
561 stdio_base=''
562 stdio_bufsiz=''
563 stdio_cnt=''
564 stdio_filbuf=''
565 stdio_ptr=''
566 d_index=''
567 d_strchr=''
568 d_strcoll=''
569 d_strctcpy=''
570 d_strerrm=''
571 d_strerror=''
572 d_sysernlst=''
573 d_syserrlst=''
574 d_strftime=''
575 d_strtod=''
576 d_strtol=''
577 d_strtold=''
578 d_strtoll=''
579 d_strtoq=''
580 d_strtoul=''
581 d_strtoull=''
582 d_strtouq=''
583 d_strxfrm=''
584 d_symlink=''
585 d_syscall=''
586 d_sysconf=''
587 d_system=''
588 d_tcgetpgrp=''
589 d_tcsetpgrp=''
590 d_telldirproto=''
591 d_time=''
592 timetype=''
593 clocktype=''
594 d_times=''
595 d_truncate=''
596 d_tzname=''
597 d_u32align=''
598 d_ualarm=''
599 d_umask=''
600 d_semctl_semid_ds=''
601 d_semctl_semun=''
602 d_union_semun=''
603 d_usleep=''
604 d_ustat=''
605 d_vfork=''
606 usevfork=''
607 d_voidsig=''
608 signal_t=''
609 d_volatile=''
610 d_charvspr=''
611 d_vprintf=''
612 d_wait4=''
613 d_waitpid=''
614 d_wcstombs=''
615 d_wctomb=''
616 d_writev=''
617 dlext=''
618 cccdlflags=''
619 ccdlflags=''
620 dlsrc=''
621 ld=''
622 lddlflags=''
623 usedl=''
624 doublesize=''
625 ebcdic=''
626 fflushNULL=''
627 fflushall=''
628 fpossize=''
629 fpostype=''
630 gccosandvers=''
631 gccversion=''
632 gidformat=''
633 gidsign=''
634 gidsize=''
635 gidtype=''
636 groupstype=''
637 h_fcntl=''
638 h_sysfile=''
639 i_arpainet=''
640 db_hashtype=''
641 db_prefixtype=''
642 db_version_major=''
643 db_version_minor=''
644 db_version_patch=''
645 i_db=''
646 i_dbm=''
647 i_rpcsvcdbm=''
648 d_dirnamlen=''
649 direntrytype=''
650 i_dirent=''
651 i_dld=''
652 i_dlfcn=''
653 i_fcntl=''
654 i_float=''
655 i_gdbm=''
656 d_grpasswd=''
657 i_grp=''
658 i_iconv=''
659 i_ieeefp=''
660 i_inttypes=''
661 i_libutil=''
662 i_limits=''
663 i_locale=''
664 i_machcthr=''
665 i_malloc=''
666 i_math=''
667 i_memory=''
668 i_mntent=''
669 i_ndbm=''
670 i_netdb=''
671 i_neterrno=''
672 i_netinettcp=''
673 i_niin=''
674 i_sysin=''
675 i_poll=''
676 i_prot=''
677 i_pthread=''
678 d_pwage=''
679 d_pwchange=''
680 d_pwclass=''
681 d_pwcomment=''
682 d_pwexpire=''
683 d_pwgecos=''
684 d_pwpasswd=''
685 d_pwquota=''
686 i_pwd=''
687 i_sfio=''
688 i_shadow=''
689 i_socks=''
690 i_stddef=''
691 i_stdlib=''
692 i_string=''
693 strings=''
694 i_sunmath=''
695 i_sysaccess=''
696 i_sysdir=''
697 i_sysfile=''
698 d_voidtty=''
699 i_bsdioctl=''
700 i_sysfilio=''
701 i_sysioctl=''
702 i_syssockio=''
703 i_syslog=''
704 i_sysmman=''
705 i_sysmode=''
706 i_sysmount=''
707 i_sysndir=''
708 i_sysparam=''
709 i_sysresrc=''
710 i_syssecrt=''
711 i_sysselct=''
712 i_sysstat=''
713 i_sysstatfs=''
714 i_sysstatvfs=''
715 i_systimes=''
716 i_systypes=''
717 i_sysuio=''
718 i_sysun=''
719 i_sysutsname=''
720 i_sysvfs=''
721 i_syswait=''
722 i_sgtty=''
723 i_termio=''
724 i_termios=''
725 i_systime=''
726 i_systimek=''
727 i_time=''
728 timeincl=''
729 i_unistd=''
730 i_ustat=''
731 i_utime=''
732 i_values=''
733 i_stdarg=''
734 i_varargs=''
735 i_varhdr=''
736 i_vfork=''
737 inc_version_list=''
738 inc_version_list_init=''
739 installprefix=''
740 installprefixexp=''
741 installstyle=''
742 installusrbinperl=''
743 intsize=''
744 longsize=''
745 shortsize=''
746 issymlink=''
747 libc=''
748 ldlibpthname=''
749 libperl=''
750 shrpenv=''
751 useshrplib=''
752 glibpth=''
753 libpth=''
754 loclibpth=''
755 plibpth=''
756 xlibpth=''
757 ignore_versioned_solibs=''
758 libs=''
759 libsdirs=''
760 libsfiles=''
761 libsfound=''
762 libspath=''
763 lns=''
764 d_PRIEUldbl=''
765 d_PRIFUldbl=''
766 d_PRIGUldbl=''
767 d_PRIeldbl=''
768 d_PRIfldbl=''
769 d_PRIgldbl=''
770 d_SCNfldbl=''
771 sPRIEUldbl=''
772 sPRIFUldbl=''
773 sPRIGUldbl=''
774 sPRIeldbl=''
775 sPRIfldbl=''
776 sPRIgldbl=''
777 sSCNfldbl=''
778 lseeksize=''
779 lseektype=''
780 make_set_make=''
781 d_mymalloc=''
782 freetype=''
783 mallocobj=''
784 mallocsrc=''
785 malloctype=''
786 usemymalloc=''
787 installman1dir=''
788 man1dir=''
789 man1direxp=''
790 man1ext=''
791 installman3dir=''
792 man3dir=''
793 man3direxp=''
794 man3ext=''
795 modetype=''
796 multiarch=''
797 mydomain=''
798 myhostname=''
799 phostname=''
800 c=''
801 n=''
802 d_eofnblk=''
803 eagain=''
804 o_nonblock=''
805 rd_nodata=''
806 need_va_copy=''
807 netdb_hlen_type=''
808 netdb_host_type=''
809 netdb_name_type=''
810 netdb_net_type=''
811 groupcat=''
812 hostcat=''
813 passcat=''
814 orderlib=''
815 ranlib=''
816 d_perl_otherlibdirs=''
817 otherlibdirs=''
818 package=''
819 spackage=''
820 pager=''
821 api_revision=''
822 api_subversion=''
823 api_version=''
824 api_versionstring=''
825 patchlevel=''
826 perl_patchlevel=''
827 revision=''
828 subversion=''
829 version=''
830 perl5=''
831 perladmin=''
832 perlpath=''
833 d_nv_preserves_uv=''
834 d_nv_preserves_uv_bits=''
835 i16size=''
836 i16type=''
837 i32size=''
838 i32type=''
839 i64size=''
840 i64type=''
841 i8size=''
842 i8type=''
843 ivsize=''
844 ivtype=''
845 nvsize=''
846 nvtype=''
847 u16size=''
848 u16type=''
849 u32size=''
850 u32type=''
851 u64size=''
852 u64type=''
853 u8size=''
854 u8type=''
855 uvsize=''
856 uvtype=''
857 ivdformat=''
858 nvEUformat=''
859 nvFUformat=''
860 nvGUformat=''
861 nveformat=''
862 nvfformat=''
863 nvgformat=''
864 uvXUformat=''
865 uvoformat=''
866 uvuformat=''
867 uvxformat=''
868 pidtype=''
869 prefix=''
870 prefixexp=''
871 installprivlib=''
872 privlib=''
873 privlibexp=''
874 prototype=''
875 ptrsize=''
876 d_PRIXU64=''
877 d_PRId64=''
878 d_PRIi64=''
879 d_PRIo64=''
880 d_PRIu64=''
881 d_PRIx64=''
882 sPRIXU64=''
883 sPRId64=''
884 sPRIi64=''
885 sPRIo64=''
886 sPRIu64=''
887 sPRIx64=''
888 d_quad=''
889 quadkind=''
890 quadtype=''
891 uquadtype=''
892 drand01=''
893 randbits=''
894 randfunc=''
895 randseedtype=''
896 seedfunc=''
897 installscript=''
898 scriptdir=''
899 scriptdirexp=''
900 selectminbits=''
901 selecttype=''
902 sh=''
903 sig_count=''
904 sig_name=''
905 sig_name_init=''
906 sig_num=''
907 sig_num_init=''
908 sig_size=''
909 installsitearch=''
910 sitearch=''
911 sitearchexp=''
912 installsitebin=''
913 sitebin=''
914 sitebinexp=''
915 installsitelib=''
916 sitelib=''
917 sitelib_stem=''
918 sitelibexp=''
919 siteprefix=''
920 siteprefixexp=''
921 sizesize=''
922 sizetype=''
923 so=''
924 socksizetype=''
925 sharpbang=''
926 shsharp=''
927 spitshell=''
928 src=''
929 ssizetype=''
930 startperl=''
931 startsh=''
932 stdchar=''
933 d_stdio_stream_array=''
934 stdio_stream_array=''
935 sysman=''
936 trnl=''
937 uidformat=''
938 uidsign=''
939 uidsize=''
940 uidtype=''
941 archname64=''
942 use64bitall=''
943 use64bitint=''
944 ccflags_uselargefiles=''
945 ldflags_uselargefiles=''
946 libswanted_uselargefiles=''
947 uselargefiles=''
948 uselongdouble=''
949 usemorebits=''
950 usemultiplicity=''
951 nm_opt=''
952 nm_so_opt=''
953 runnm=''
954 usenm=''
955 useperlio=''
956 usesocks=''
957 d_oldpthreads=''
958 use5005threads=''
959 useithreads=''
960 usethreads=''
961 incpath=''
962 mips_type=''
963 usrinc=''
964 d_vendorarch=''
965 installvendorarch=''
966 vendorarch=''
967 vendorarchexp=''
968 d_vendorbin=''
969 installvendorbin=''
970 vendorbin=''
971 vendorbinexp=''
972 d_vendorlib=''
973 installvendorlib=''
974 vendorlib=''
975 vendorlib_stem=''
976 vendorlibexp=''
977 usevendorprefix=''
978 vendorprefix=''
979 vendorprefixexp=''
980 versiononly=''
981 defvoidused=''
982 voidflags=''
983 pm_apiversion=''
984 xs_apiversion=''
985 yacc=''
986 yaccflags=''
987 CONFIG=''
988
989 define='define'
990 undef='undef'
991 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
992 rmlist=''
993
994 : We must find out about Eunice early
995 eunicefix=':'
996 if test -f /etc/unixtovms; then
997         eunicefix=/etc/unixtovms
998 fi
999 if test -f /etc/unixtovms.exe; then
1000         eunicefix=/etc/unixtovms.exe
1001 fi
1002
1003 i_whoami=''
1004 ccname=''
1005 ccversion=''
1006 perllibs=''
1007 : set useposix=false in your hint file to disable the POSIX extension.
1008 useposix=true
1009 : set useopcode=false in your hint file to disable the Opcode extension.
1010 useopcode=true
1011 : Trailing extension.  Override this in a hint file, if needed.
1012 _exe=''
1013 : Extra object files, if any, needed on this platform.
1014 archobjs=''
1015 archname=''
1016 : Possible local include directories to search.
1017 : Set locincpth to "" in a hint file to defeat local include searches.
1018 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1019 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1020 :
1021 : no include file wanted by default
1022 inclwanted=''
1023
1024 groupstype=''
1025 : change the next line if compiling for Xenix/286 on Xenix/386
1026 xlibpth='/usr/lib/386 /lib/386'
1027 : Possible local library directories to search.
1028 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1029 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1030
1031 : general looking path for locating libraries
1032 glibpth="/lib /usr/lib $xlibpth"
1033 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1034 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1035 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1036
1037 : Private path used by Configure to find libraries.  Its value
1038 : is prepended to libpth. This variable takes care of special
1039 : machines, like the mips.  Usually, it should be empty.
1040 plibpth=''
1041
1042 : default library list
1043 libswanted=''
1044 : some systems want to use only the non-versioned libso:s
1045 ignore_versioned_solibs=''
1046 archname64=''
1047 ccflags_uselargefiles=''
1048 ldflags_uselargefiles=''
1049 libswanted_uselargefiles=''
1050 : set usemultiplicity on the Configure command line to enable multiplicity.
1051 : set usesocks on the Configure command line to enable socks.
1052 : set usethreads on the Configure command line to enable threads.
1053 : full support for void wanted by default
1054 defvoidused=15
1055
1056 : List of libraries we want.
1057 : If anyone needs -lnet, put it in a hint file.
1058 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1059 libswanted="$libswanted dld ld sun m c cposix posix"
1060 libswanted="$libswanted ndir dir crypt sec"
1061 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1062 : We probably want to search /usr/shlib before most other libraries.
1063 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1064 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1065 glibpth="/usr/shlib $glibpth"
1066 : Do not use vfork unless overridden by a hint file.
1067 usevfork=false
1068
1069 : Find the basic shell for Bourne shell scripts
1070 case "$sh" in
1071 '')
1072         case "$SYSTYPE" in
1073         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1074         *) xxx='/bin/sh';;
1075         esac
1076         if test -f "$xxx"; then
1077                 sh="$xxx"
1078         else
1079                 : Build up a list and do a single loop so we can 'break' out.
1080                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1081                 for xxx in sh bash ksh pdksh ash; do
1082                         for p in $pth; do
1083                                 try="$try ${p}/${xxx}"
1084                         done
1085                 done
1086                 for xxx in $try; do
1087                         if test -f "$xxx"; then
1088                                 sh="$xxx";
1089                                 break
1090                         elif test -f "$xxx.exe"; then
1091                                 sh="$xxx";
1092                                 break
1093                         fi
1094                 done
1095         fi
1096         ;;
1097 esac
1098
1099 case "$sh" in
1100 '')     cat <<EOM >&2
1101 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1102
1103 Usually it's in /bin/sh.  How did you even get this far?
1104 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1105 we'll try to straighten this all out.
1106 EOM
1107         exit 1
1108         ;;
1109 esac
1110
1111 : see if sh knows # comments
1112 if `$sh -c '#' >/dev/null 2>&1`; then
1113         shsharp=true
1114         spitshell=cat
1115         xcat=/bin/cat
1116         test -f $xcat || xcat=/usr/bin/cat
1117         echo "#!$xcat" >try
1118         $eunicefix try
1119         chmod +x try
1120         ./try > today
1121         if test -s today; then
1122                 sharpbang='#!'
1123         else
1124                 echo "#! $xcat" > try
1125                 $eunicefix try
1126                 chmod +x try
1127                 ./try > today
1128                 if test -s today; then
1129                         sharpbang='#! '
1130                 else
1131                         sharpbang=': use '
1132                 fi
1133         fi
1134 else
1135         echo " "
1136         echo "Your $sh doesn't grok # comments--I will strip them later on."
1137         shsharp=false
1138         cd ..
1139         echo "exec grep -v '^[  ]*#'" >spitshell
1140         chmod +x spitshell
1141         $eunicefix spitshell
1142         spitshell=`pwd`/spitshell
1143         cd UU
1144         echo "I presume that if # doesn't work, #! won't work either!"
1145         sharpbang=': use '
1146 fi
1147 rm -f try today
1148
1149 : figure out how to guarantee sh startup
1150 case "$startsh" in
1151 '') startsh=${sharpbang}${sh} ;;
1152 *)
1153 esac
1154 cat >try <<EOSS
1155 $startsh
1156 set abc
1157 test "$?abc" != 1
1158 EOSS
1159
1160 chmod +x try
1161 $eunicefix try
1162 if ./try; then
1163         : echo "Yup, it does."
1164 else
1165         echo "Hmm... '$startsh' does not guarantee sh startup..."
1166         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1167 fi
1168 rm -f try
1169
1170
1171 : Save command line options in file UU/cmdline.opt for later use in
1172 : generating config.sh.
1173 cat > cmdline.opt <<EOSH
1174 # Configure command line arguments.
1175 config_arg0='$0'
1176 config_args='$*'
1177 config_argc=$#
1178 EOSH
1179 argn=1
1180 for arg in "$@"; do
1181         cat >>cmdline.opt <<EOSH
1182 config_arg$argn='$arg'
1183 EOSH
1184         argn=`expr $argn + 1`
1185 done
1186
1187 : produce awk script to parse command line options
1188 cat >options.awk <<'EOF'
1189 BEGIN {
1190         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1191
1192         len = length(optstr);
1193         for (i = 1; i <= len; i++) {
1194                 c = substr(optstr, i, 1);
1195                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1196                 if (a == ":") {
1197                         arg[c] = 1;
1198                         i++;
1199                 }
1200                 opt[c] = 1;
1201         }
1202 }
1203 {
1204         expect = 0;
1205         str = $0;
1206         if (substr(str, 1, 1) != "-") {
1207                 printf("'%s'\n", str);
1208                 next;
1209         }
1210         len = length($0);
1211         for (i = 2; i <= len; i++) {
1212                 c = substr(str, i, 1);
1213                 if (!opt[c]) {
1214                         printf("-%s\n", substr(str, i));
1215                         next;
1216                 }
1217                 printf("-%s\n", c);
1218                 if (arg[c]) {
1219                         if (i < len)
1220                                 printf("'%s'\n", substr(str, i + 1));
1221                         else
1222                                 expect = 1;
1223                         next;
1224                 }
1225         }
1226 }
1227 END {
1228         if (expect)
1229                 print "?";
1230 }
1231 EOF
1232
1233 : process the command line options
1234 set X `for arg in "$@"; do echo "X$arg"; done |
1235         sed -e s/X// | awk -f options.awk`
1236 eval "set $*"
1237 shift
1238 rm -f options.awk
1239
1240 : set up default values
1241 fastread=''
1242 reuseval=false
1243 config_sh=''
1244 alldone=''
1245 error=''
1246 silent=''
1247 extractsh=''
1248 override=''
1249 knowitall=''
1250 rm -f optdef.sh posthint.sh
1251 cat >optdef.sh <<EOS
1252 $startsh
1253 EOS
1254
1255
1256 : option parsing
1257 while test $# -gt 0; do
1258         case "$1" in
1259         -d) shift; fastread=yes;;
1260         -e) shift; alldone=cont;;
1261         -f)
1262                 shift
1263                 cd ..
1264                 if test -r "$1"; then
1265                         config_sh="$1"
1266                 else
1267                         echo "$me: cannot read config file $1." >&2
1268                         error=true
1269                 fi
1270                 cd UU
1271                 shift;;
1272         -h) shift; error=true;;
1273         -r) shift; reuseval=true;;
1274         -s) shift; silent=true; realsilent=true;;
1275         -E) shift; alldone=exit;;
1276         -K) shift; knowitall=true;;
1277         -O) shift; override=true;;
1278         -S) shift; silent=true; extractsh=true;;
1279         -D)
1280                 shift
1281                 case "$1" in
1282                 *=)
1283                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1284                         echo "$me: ignoring -D $1" >&2
1285                         ;;
1286                 *=*) echo "$1" | \
1287                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1288                 *) echo "$1='define'" >> optdef.sh;;
1289                 esac
1290                 shift
1291                 ;;
1292         -U)
1293                 shift
1294                 case "$1" in
1295                 *=) echo "$1" >> optdef.sh;;
1296                 *=*)
1297                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1298                         echo "$me: ignoring -U $1" >&2
1299                         ;;
1300                 *) echo "$1='undef'" >> optdef.sh;;
1301                 esac
1302                 shift
1303                 ;;
1304         -A)
1305             shift
1306             xxx=''
1307             yyy="$1"
1308             zzz=''
1309             uuu=undef
1310             case "$yyy" in
1311             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1312                  case "$zzz" in
1313                  *:*) zzz='' ;;
1314                  *)   xxx=append
1315                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1316                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1317                  esac
1318                  ;;
1319             esac
1320             case "$xxx" in
1321             '')  case "$yyy" in
1322                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1323                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1324                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1325                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1326                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1327                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1328                  esac
1329                  ;;       
1330             esac
1331             case "$xxx" in
1332             append)
1333                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1334             clear)
1335                 echo "$yyy=''"                  >> posthint.sh ;;
1336             define)
1337                 case "$zzz" in
1338                 '') zzz=define ;;
1339                 esac
1340                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1341             eval)
1342                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1343             prepend)
1344                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1345             undef)
1346                 case "$zzz" in
1347                 '') zzz="$uuu" ;;
1348                 esac
1349                 echo "$yyy=$zzz"                >> posthint.sh ;;
1350             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1351             esac
1352             shift
1353             ;;
1354         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1355             exit 0;;
1356         --) break;;
1357         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1358         *) break;;
1359         esac
1360 done
1361
1362 case "$error" in
1363 true)
1364         cat >&2 <<EOM
1365 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1366                  [-U symbol] [-U symbol=] [-A command:symbol...]
1367   -d : use defaults for all answers.
1368   -e : go on without questioning past the production of config.sh.
1369   -f : specify an alternate default configuration file.
1370   -h : print this help message and exit (with an error status).
1371   -r : reuse C symbols value if possible (skips costly nm extraction).
1372   -s : silent mode, only echoes questions and essential information.
1373   -D : define symbol to have some value:
1374          -D symbol         symbol gets the value 'define'
1375          -D symbol=value   symbol gets the value 'value'
1376   -E : stop at the end of questions, after having produced config.sh.
1377   -K : do not use unless you know what you are doing.
1378   -O : let -D and -U override definitions from loaded configuration file.
1379   -S : perform variable substitutions on all .SH files (can mix with -f)
1380   -U : undefine symbol:
1381          -U symbol    symbol gets the value 'undef'
1382          -U symbol=   symbol gets completely empty
1383   -A : manipulate symbol after the platform specific hints have been applied:
1384          -A symbol=value                append " "value to symbol
1385          -A append:symbol=value         append value to symbol
1386          -A define:symbol=value         define symbol to have value
1387          -A clear:symbol                define symbol to be ''
1388          -A define:symbol               define symbol to be 'define'
1389          -A eval:symbol=value           define symbol to be eval of value
1390          -A prepend:symbol=value        prepend value to symbol
1391          -A undef:symbol                define symbol to be 'undef'
1392          -A undef:symbol=               define symbol to be ''
1393   -V : print version number and exit (with a zero status).
1394 EOM
1395         exit 1
1396         ;;
1397 esac
1398
1399 : Sanity checks
1400 case "$fastread$alldone" in
1401 yescont|yesexit) ;;
1402 *)
1403         case "$extractsh" in
1404         true) ;;
1405         *)
1406                 if test ! -t 0; then
1407                         echo "Say 'sh Configure', not 'sh <Configure'"
1408                         exit 1
1409                 fi
1410                 ;;
1411         esac
1412         ;;
1413 esac
1414
1415 exec 4>&1
1416 case "$silent" in
1417 true) exec 1>/dev/null;;
1418 esac
1419
1420 : run the defines and the undefines, if any, but leave the file out there...
1421 touch optdef.sh
1422 . ./optdef.sh
1423 : create the posthint manipulation script and leave the file out there...
1424 touch posthint.sh
1425
1426 : set package name
1427 package=perl5
1428 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1429 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1430 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1431 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1432 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1433 esac
1434
1435 : Some greps do not return status, grrr.
1436 echo "grimblepritz" >grimble
1437 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1438         contains=contains
1439 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1440         contains=grep
1441 else
1442         contains=contains
1443 fi
1444 rm -f grimble
1445 : the following should work in any shell
1446 case "$contains" in
1447 contains*)
1448         echo " "
1449         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1450         cat >contains <<'EOSS'
1451 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1452 EOSS
1453 chmod +x contains
1454 esac
1455
1456 : Find the path to the source tree
1457 case "$src" in
1458 '') case "$0" in
1459     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1460          case "$src" in
1461          /*)    ;;
1462          .)     ;;
1463          *)     src=`cd ../$src && pwd` ;;
1464          esac
1465          ;;
1466     *)   src='.';;
1467     esac;;
1468 esac
1469 case "$src" in
1470 '')     src=/
1471         rsrc=/
1472         ;;
1473 /*) rsrc="$src";;
1474 *) rsrc="../$src";;
1475 esac
1476 if test -f $rsrc/Configure && \
1477         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1478 then
1479    : found it, so we are ok.
1480 else
1481         rsrc=''
1482         for src in . .. ../.. ../../.. ../../../..; do
1483                 if test -f ../$src/Configure && \
1484                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1485                 then
1486                         rsrc=../$src
1487                         break
1488                 fi
1489         done
1490 fi
1491 case "$rsrc" in
1492 '')
1493         cat <<EOM >&4
1494
1495 Sorry, I can't seem to locate the source dir for $package.  Please start
1496 Configure with an explicit path -- i.e. /some/path/Configure.
1497
1498 EOM
1499         exit 1
1500         ;;
1501 ../.)   rsrc='..';;
1502 *)
1503         echo " "
1504         echo "Sources for $package found in \"$src\"." >&4
1505         ;;
1506 esac
1507
1508 : script used to extract .SH files with variable substitutions
1509 cat >extract <<'EOS'
1510 PERL_CONFIG_SH=true
1511 echo "Doing variable substitutions on .SH files..."
1512 if test -f $src/MANIFEST; then
1513         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1514 else
1515         echo "(Looking for .SH files under the source directory.)"
1516         set x `(cd $src; find . -name "*.SH" -print)`
1517 fi
1518 shift
1519 case $# in
1520 0) set x `(cd $src; echo *.SH)`; shift;;
1521 esac
1522 if test ! -f $src/$1; then
1523         shift
1524 fi
1525 mkdir_p='
1526 name=$1;
1527 create="";
1528 while test $name; do
1529         if test ! -d "$name"; then
1530                 create="$name $create";
1531                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1532                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1533         else
1534                 name="";
1535         fi;
1536 done;
1537 for file in $create; do
1538         mkdir $file;
1539 done
1540 '
1541 for file in $*; do
1542         case "$src" in
1543         ".")
1544                 case "$file" in
1545                 */*)
1546                         dir=`expr X$file : 'X\(.*\)/'`
1547                         file=`expr X$file : 'X.*/\(.*\)'`
1548                         (cd $dir && . ./$file)
1549                         ;;
1550                 *)
1551                         . ./$file
1552                         ;;
1553                 esac
1554                 ;;
1555         *)
1556                 case "$file" in
1557                 */*)
1558                         dir=`expr X$file : 'X\(.*\)/'`
1559                         file=`expr X$file : 'X.*/\(.*\)'`
1560                         (set x $dir; shift; eval $mkdir_p)
1561                         sh <$src/$dir/$file
1562                         ;;
1563                 *)
1564                         sh <$src/$file
1565                         ;;
1566                 esac
1567                 ;;
1568         esac
1569 done
1570 if test -f $src/config_h.SH; then
1571         if test ! -f config.h; then
1572         : oops, they left it out of MANIFEST, probably, so do it anyway.
1573         . $src/config_h.SH
1574         fi
1575 fi
1576 EOS
1577
1578 : extract files and exit if asked to do so
1579 case "$extractsh" in
1580 true)
1581         case "$realsilent" in
1582         true) ;;
1583         *) exec 1>&4;;
1584         esac
1585         case "$config_sh" in
1586         '') config_sh='config.sh';;
1587         esac
1588         echo " "
1589         echo "Fetching answers from $config_sh..."
1590         cd ..
1591         . $config_sh
1592         test "$override" && . ./optdef.sh
1593         echo " "
1594         . UU/extract
1595         rm -rf UU
1596         echo "Done."
1597         exit 0
1598         ;;
1599 esac
1600
1601 : Eunice requires " " instead of "", can you believe it
1602 echo " "
1603 : Here we go...
1604 echo "Beginning of configuration questions for $package."
1605
1606 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1607
1608 : first determine how to suppress newline on echo command
1609 echo " "
1610 echo "Checking echo to see how to suppress newlines..."
1611 (echo "hi there\c" ; echo " ") >.echotmp
1612 if $contains c .echotmp >/dev/null 2>&1 ; then
1613         echo "...using -n."
1614         n='-n'
1615         c=''
1616 else
1617         cat <<'EOM'
1618 ...using \c
1619 EOM
1620         n=''
1621         c='\c'
1622 fi
1623 echo $n "The star should be here-->$c"
1624 echo '*'
1625 rm -f .echotmp
1626
1627 : Now test for existence of everything in MANIFEST
1628 echo " "
1629 if test -f $rsrc/MANIFEST; then
1630         echo "First let's make sure your kit is complete.  Checking..." >&4
1631         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1632         rm -f missing
1633         tmppwd=`pwd`
1634         for filelist in x??; do
1635                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1636         done
1637         if test -s missing; then
1638                 cat missing >&4
1639                 cat >&4 <<'EOM'
1640
1641 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1642
1643 You have the option of continuing the configuration process, despite the
1644 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1645 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1646 and contact the author (perlbug@perl.org).
1647
1648 EOM
1649                 echo $n "Continue? [n] $c" >&4
1650                 read ans
1651                 case "$ans" in
1652                 y*)
1653                         echo "Continuing..." >&4
1654                         rm -f missing
1655                         ;;
1656                 *)
1657                         echo "ABORTING..." >&4
1658                         kill $$
1659                         ;;
1660                 esac
1661         else
1662                 echo "Looks good..."
1663         fi
1664 else
1665         echo "There is no MANIFEST file.  I hope your kit is complete !"
1666 fi
1667 rm -f missing x??
1668
1669 echo " "
1670 : Find the appropriate value for a newline for tr
1671 if test -n "$DJGPP"; then
1672        trnl='\012'
1673 fi
1674 if test X"$trnl" = X; then
1675         case "`echo foo|tr '\n' x 2>/dev/null`" in
1676         foox) trnl='\n' ;;
1677         esac
1678 fi
1679 if test X"$trnl" = X; then
1680         case "`echo foo|tr '\012' x 2>/dev/null`" in
1681         foox) trnl='\012' ;;
1682         esac
1683 fi
1684 if test X"$trnl" = X; then
1685         cat <<EOM >&2
1686
1687 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1688
1689 EOM
1690         exit 1
1691 fi
1692
1693 : compute the number of columns on the terminal for proper question formatting
1694 case "$COLUMNS" in
1695 '') COLUMNS='80';;
1696 esac
1697
1698 : set up the echo used in my read
1699 myecho="case \"\$xxxm\" in
1700 '') echo $n \"\$rp $c\" >&4;;
1701 *) case \"\$rp\" in
1702         '') echo $n \"[\$xxxm] $c\";;
1703         *)
1704                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1705                         echo \"\$rp\" >&4
1706                         echo $n \"[\$xxxm] $c\" >&4
1707                 else
1708                         echo $n \"\$rp [\$xxxm] $c\" >&4
1709                 fi
1710                 ;;
1711         esac;;
1712 esac"
1713
1714 : now set up to do reads with possible shell escape and default assignment
1715 cat <<EOSC >myread
1716 $startsh
1717 xxxm=\$dflt
1718 $myecho
1719 ans='!'
1720 case "\$fastread" in
1721 yes) case "\$dflt" in
1722         '') ;;
1723         *) ans='';
1724                 case "\$silent-\$rp" in
1725                 true-) ;;
1726                 *) echo " " >&4;;
1727                 esac;;
1728         esac;;
1729 *) case "\$silent" in
1730         true) case "\$rp" in
1731                 '') ans='';;
1732                 esac;;
1733         esac;;
1734 esac
1735 while expr "X\$ans" : "X!" >/dev/null; do
1736         read answ
1737         set x \$xxxm
1738         shift
1739         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1740         case  "\$answ" in
1741         "!")
1742                 sh 1>&4
1743                 echo " "
1744                 $myecho
1745                 ;;
1746         !*)
1747                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1748                 shift
1749                 sh 1>&4 -c "\$*"
1750                 echo " "
1751                 $myecho
1752                 ;;
1753         "\$ans")
1754                 case "\$ans" in
1755                 \\&*)
1756                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1757                         shift
1758                         case "\$1" in
1759                         -d)
1760                                 fastread=yes
1761                                 echo "(OK, I'll run with -d after this question.)" >&4
1762                                 ;;
1763                         -*)
1764                                 echo "*** Sorry, \$1 not supported yet." >&4
1765                                 ;;
1766                         esac
1767                         $myecho
1768                         ans=!
1769                         ;;
1770                 esac;;
1771         *)
1772                 case "\$aok" in
1773                 y)
1774                         echo "*** Substitution done -- please confirm."
1775                         xxxm="\$ans"
1776                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1777                         xxxm="\$ans"
1778                         ans=!
1779                         ;;
1780                 *)
1781                         echo "*** Error -- try again."
1782                         ans=!
1783                         ;;
1784                 esac
1785                 $myecho
1786                 ;;
1787         esac
1788         case "\$ans\$xxxm\$nostick" in
1789         '')
1790                 ans=!
1791                 $myecho
1792                 ;;
1793         esac
1794 done
1795 case "\$ans" in
1796 '') ans="\$xxxm";;
1797 esac
1798 EOSC
1799
1800 : create .config dir to save info across Configure sessions
1801 test -d ../.config || mkdir ../.config
1802 cat >../.config/README <<EOF
1803 This directory created by Configure to save information that should
1804 persist across sessions for $package.
1805
1806 You may safely delete it if you wish.
1807 EOF
1808
1809 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1810 case "$usedevel" in
1811 $define|true|[yY]*) ;;
1812 *) case "$xversion" in
1813    *[13579])
1814         cat >&4 <<EOH
1815 *** WHOA THERE!!! ***
1816
1817     This is an UNSTABLE DEVELOPMENT release.
1818     The version of this $package distribution is $xversion, that is, odd,
1819     (as opposed to even) and that signifies a development release.
1820     If you want a maintenance release, you want an even-numbered version.
1821
1822     Do ***NOT*** install this into production use.
1823     Data corruption and crashes are possible.
1824
1825     It is most seriously suggested that you do not continue any further
1826     unless you want to help in developing and debugging Perl.
1827
1828     If you *still* want to build perl, you can answer 'y' now,
1829     or pass -Dusedevel to Configure.
1830
1831 EOH
1832         rp='Do you really want to continue?'
1833         dflt='n'
1834         . ./myread
1835         case "$ans" in
1836         [yY]) echo >&4 "Okay, continuing."
1837               usedevel="$define" ;;
1838         *) echo >&4 "Okay, bye."
1839            exit 1
1840            ;;
1841         esac
1842         ;;
1843     esac
1844     ;;
1845 esac
1846 case "$usedevel" in
1847 $define|true|[yY]*)
1848         case "$versiononly" in
1849         '') versiononly="$define" ;;
1850         esac
1851         case "$installusrbinperl" in
1852         '') installusrbinperl="$undef" ;;
1853         esac
1854         ;;
1855 esac
1856
1857 : general instructions
1858 needman=true
1859 firsttime=true
1860 user=`(logname) 2>/dev/null`
1861 case "$user" in
1862 '') user=`whoami 2>&1`;;
1863 esac
1864 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1865         firsttime=false
1866         echo " "
1867         rp='Would you like to see the instructions?'
1868         dflt=n
1869         . ./myread
1870         case "$ans" in
1871         [yY]*) ;;
1872         *) needman=false;;
1873         esac
1874 fi
1875 if $needman; then
1876         cat <<EOH
1877
1878 This installation shell script will examine your system and ask you questions
1879 to determine how the perl5 package should be installed. If you get
1880 stuck on a question, you may use a ! shell escape to start a subshell or
1881 execute a command.  Many of the questions will have default answers in square
1882 brackets; typing carriage return will give you the default.
1883
1884 On some of the questions which ask for file or directory names you are allowed
1885 to use the ~name construct to specify the login directory belonging to "name",
1886 even if you don't have a shell which knows about that.  Questions where this is
1887 allowed will be marked "(~name ok)".
1888
1889 EOH
1890         rp=''
1891         dflt='Type carriage return to continue'
1892         . ./myread
1893         cat <<'EOH'
1894
1895 The prompter used in this script allows you to use shell variables and
1896 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1897 in the default answer, as if the default line was a set of arguments given to a
1898 script shell.  This means you may also use $* to repeat the whole default line,
1899 so you do not have to re-type everything to add something to the default.
1900
1901 Everytime there is a substitution, you will have to confirm.  If there is an
1902 error (e.g. an unmatched backtick), the default answer will remain unchanged
1903 and you will be prompted again.
1904
1905 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1906 the questions and use the computed defaults (or the previous answers if there
1907 was already a config.sh file). Type 'Configure -h' for a list of options.
1908 You may also start interactively and then answer '& -d' at any prompt to turn
1909 on the non-interactive behaviour for the remainder of the execution.
1910
1911 EOH
1912         . ./myread
1913         cat <<EOH
1914
1915 Much effort has been expended to ensure that this shell script will run on any
1916 Unix system.  If despite that it blows up on yours, your best bet is to edit
1917 Configure and run it again.  If you can't run Configure for some reason,
1918 you'll have to generate a config.sh file by hand.  Whatever problems you
1919 have, let me (perlbug@perl.org) know how I blew it.
1920
1921 This installation script affects things in two ways:
1922
1923 1) it may do direct variable substitutions on some of the files included
1924    in this kit.
1925 2) it builds a config.h file for inclusion in C programs.  You may edit
1926    any of these files as the need arises after running this script.
1927
1928 If you make a mistake on a question, there is no easy way to back up to it
1929 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1930 files.  Configure will offer to let you do this before it runs the SH files.
1931
1932 EOH
1933         dflt='Type carriage return to continue'
1934         . ./myread
1935         case "$firsttime" in
1936         true) echo $user >>../.config/instruct;;
1937         esac
1938 fi
1939
1940 : find out where common programs are
1941 echo " "
1942 echo "Locating common programs..." >&4
1943 cat <<EOSC >loc
1944 $startsh
1945 case \$# in
1946 0) exit 1;;
1947 esac
1948 thing=\$1
1949 shift
1950 dflt=\$1
1951 shift
1952 for dir in \$*; do
1953         case "\$thing" in
1954         .)
1955         if test -d \$dir/\$thing; then
1956                 echo \$dir
1957                 exit 0
1958         fi
1959         ;;
1960         *)
1961         for thisthing in \$dir/\$thing; do
1962                 : just loop through to pick last item
1963         done
1964         if test -f \$thisthing; then
1965                 echo \$thisthing
1966                 exit 0
1967         elif test -f \$dir/\$thing.exe; then
1968                 if test -n "$DJGPP"; then
1969                         echo \$dir/\$thing.exe
1970                 else
1971                         : on Eunice apparently
1972                         echo \$dir/\$thing
1973                 fi
1974                 exit 0
1975         fi
1976         ;;
1977         esac
1978 done
1979 echo \$dflt
1980 exit 1
1981 EOSC
1982 chmod +x loc
1983 $eunicefix loc
1984 loclist="
1985 awk
1986 cat
1987 comm
1988 cp
1989 echo
1990 expr
1991 grep
1992 ls
1993 make
1994 mkdir
1995 rm
1996 sed
1997 sort
1998 touch
1999 tr
2000 uniq
2001 "
2002 trylist="
2003 Mcc
2004 ar
2005 bison
2006 byacc
2007 cpp
2008 csh
2009 date
2010 egrep
2011 gzip
2012 less
2013 ln
2014 more
2015 nm
2016 nroff
2017 pg
2018 test
2019 uname
2020 zip
2021 "
2022 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2023 pth="$pth /lib /usr/lib"
2024 for file in $loclist; do
2025         eval xxx=\$$file
2026         case "$xxx" in
2027         /*|?:[\\/]*)
2028                 if test -f "$xxx"; then
2029                         : ok
2030                 else
2031                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2032                         xxx=`./loc $file $file $pth`
2033                 fi
2034                 ;;
2035         '') xxx=`./loc $file $file $pth`;;
2036         *) xxx=`./loc $xxx $xxx $pth`;;
2037         esac
2038         eval $file=$xxx
2039         eval _$file=$xxx
2040         case "$xxx" in
2041         /*)
2042                 echo $file is in $xxx.
2043                 ;;
2044         ?:[\\/]*)
2045                 echo $file is in $xxx.
2046                 ;;
2047         *)
2048                 echo "I don't know where '$file' is, and my life depends on it." >&4
2049                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2050                 exit 1
2051                 ;;
2052         esac
2053 done
2054 echo " "
2055 echo "Don't worry if any of the following aren't found..."
2056 say=offhand
2057 for file in $trylist; do
2058         eval xxx=\$$file
2059         case "$xxx" in
2060         /*|?:[\\/]*)
2061                 if test -f "$xxx"; then
2062                         : ok
2063                 else
2064                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2065                         xxx=`./loc $file $file $pth`
2066                 fi
2067                 ;;
2068         '') xxx=`./loc $file $file $pth`;;
2069         *) xxx=`./loc $xxx $xxx $pth`;;
2070         esac
2071         eval $file=$xxx
2072         eval _$file=$xxx
2073         case "$xxx" in
2074         /*)
2075                 echo $file is in $xxx.
2076                 ;;
2077         ?:[\\/]*)
2078                 echo $file is in $xxx.
2079                 ;;
2080         *)
2081                 echo "I don't see $file out there, $say."
2082                 say=either
2083                 ;;
2084         esac
2085 done
2086 case "$egrep" in
2087 egrep)
2088         echo "Substituting grep for egrep."
2089         egrep=$grep
2090         ;;
2091 esac
2092 case "$ln" in
2093 ln)
2094         echo "Substituting cp for ln."
2095         ln=$cp
2096         ;;
2097 esac
2098 case "$test" in
2099 test)
2100         echo "Hopefully test is built into your sh."
2101         ;;
2102 *)
2103         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2104                 echo "Using the test built into your sh."
2105                 test=test
2106                 _test=test
2107         fi
2108         ;;
2109 esac
2110 case "$echo" in
2111 echo)
2112         echo "Hopefully echo is built into your sh."
2113         ;;
2114 '') ;;
2115 *)
2116         echo " "
2117 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2118         $echo $n "hi there$c" >foo1
2119         echo $n "hi there$c" >foo2
2120         if cmp foo1 foo2 >/dev/null 2>&1; then
2121                 echo "They are compatible.  In fact, they may be identical."
2122         else
2123                 case "$n" in
2124                 '-n') n='' c='\c';;
2125                 *) n='-n' c='';;
2126                 esac
2127                 cat <<FOO
2128 They are not compatible!  You are probably running ksh on a non-USG system.
2129 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2130 have echo built in and we may have to run some Bourne shell scripts.  That
2131 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2132
2133 FOO
2134                 $echo $n "The star should be here-->$c"
2135                 $echo "*"
2136         fi
2137         $rm -f foo1 foo2
2138         ;;
2139 esac
2140
2141 cat <<EOS >checkcc
2142 $startsh
2143 EOS
2144 cat <<'EOSC' >>checkcc
2145 case "$cc" in
2146 '') ;;
2147 *)  $rm -f try try.*
2148     $cat >try.c <<EOM
2149 int main(int argc, char *argv[]) {
2150   return 0;
2151 }
2152 EOM
2153     if $cc -o try $ccflags $ldflags try.c; then
2154        :
2155     else
2156         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2157         despair=yes
2158         trygcc=yes
2159         case "$cc" in
2160         *gcc*) trygcc=no ;;
2161         esac
2162         case "`$cc -v -c try.c 2>&1`" in
2163         *gcc*) trygcc=no ;;
2164         esac
2165         if $test X"$trygcc" = Xyes; then
2166             if gcc -o try -c try.c; then
2167                 echo " "
2168                 echo "You seem to have a working gcc, though." >&4
2169                 rp="Would you like to use it?"
2170                 dflt=y
2171                 if $test -f myread; then
2172                     . ./myread
2173                 else
2174                     if $test -f UU/myread; then
2175                         . ./UU/myread
2176                     else
2177                         echo "Cannot find myread, sorry.  Aborting." >&2
2178                         exit 1
2179                     fi
2180                 fi  
2181                 case "$ans" in
2182                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2183                 esac
2184             fi
2185         fi
2186         if $test X"$despair" = Xyes; then
2187             $cat >&4 <<EOM
2188 You need to find a working C compiler.
2189 Either (purchase and) install the C compiler supplied by your OS vendor,
2190 or for a free C compiler try http://gcc.gnu.org/
2191 I cannot continue any further, aborting.
2192 EOM
2193             exit 1
2194         fi
2195     fi
2196     $rm -f try try.*
2197     ;;
2198 esac
2199 EOSC
2200
2201 : determine whether symbolic links are supported
2202 echo " "
2203 $touch blurfl
2204 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2205         echo "Symbolic links are supported." >&4
2206         lns="$ln -s"
2207 else
2208         echo "Symbolic links are NOT supported." >&4
2209         lns="$ln"
2210 fi
2211 $rm -f blurfl sym
2212
2213 : determine whether symbolic links are supported
2214 echo " "
2215 case "$lns" in
2216 *"ln -s")
2217         echo "Checking how to test for symbolic links..." >&4
2218         $lns blurfl sym
2219         if $test "X$issymlink" = X; then
2220                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2221                 if test $? = 0; then
2222                         issymlink="test -h"
2223                 fi              
2224         fi
2225         if $test "X$issymlink" = X; then
2226                 if  $test -h >/dev/null 2>&1; then
2227                         issymlink="$test -h"
2228                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2229                 fi              
2230         fi
2231         if $test "X$issymlink" = X; then
2232                 if $test -L sym 2>/dev/null; then
2233                         issymlink="$test -L"
2234                 fi
2235         fi
2236         if $test "X$issymlink" != X; then
2237                 echo "You can test for symbolic links with '$issymlink'." >&4
2238         else
2239                 echo "I do not know how you can test for symbolic links." >&4
2240         fi
2241         $rm -f blurfl sym
2242         ;;
2243 *)      echo "No symbolic links, so not testing for their testing..." >&4
2244         ;;
2245 esac
2246 echo " "
2247
2248
2249 case "$mksymlinks" in
2250 $define|true|[yY]*)
2251         case "$src" in
2252         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2253                 exit 1
2254                 ;;
2255         *)      case "$lns:$issymlink" in
2256                 *"ln -s:"*"test -"?)
2257                         echo "Creating the symbolic links..." >&4
2258                         echo "(First creating the subdirectories...)" >&4
2259                         cd ..
2260                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2261                                 read directory
2262                                 test -z "$directory" && break
2263                                 mkdir -p $directory
2264                         done
2265                         # Sanity check 1.
2266                         if test ! -d t/base; then
2267                                 echo "Failed to create the subdirectories.  Aborting." >&4
2268                                 exit 1
2269                         fi
2270                         echo "(Then creating the symlinks...)" >&4
2271                         awk '{print $1}' $src/MANIFEST | while true; do
2272                                 read filename
2273                                 test -z "$filename" && break
2274                                 if test -f $filename; then
2275                                         if $issymlink $filename; then
2276                                                 rm -f $filename
2277                                         fi
2278                                 fi
2279                                 if test -f $filename; then
2280                                         echo "$filename already exists, not symlinking."
2281                                 else
2282                                         ln -s $src/$filename $filename
2283                                 fi
2284                         done
2285                         # Sanity check 2.
2286                         if test ! -f t/base/commonsense.t; then
2287                                 echo "Failed to create the symlinks.  Aborting." >&4
2288                                 exit 1
2289                         fi
2290                         cd UU
2291                         ;;
2292                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2293                         ;;
2294                 esac
2295                 ;;
2296         esac
2297         ;;
2298 esac
2299
2300 : see whether [:lower:] and [:upper:] are supported character classes
2301 echo " "
2302 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2303 ABYZ)
2304         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2305         up='[:upper:]'
2306         low='[:lower:]'
2307         ;;
2308 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2309         # (0xc9 and 0xd1), therefore that is a nice testing point.
2310         if test "X$up" = X -o "X$low" = X; then
2311             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2312             ij) up='[A-Z]'
2313                 low='[a-z]'
2314                 ;;
2315             esac
2316         fi
2317         if test "X$up" = X -o "X$low" = X; then
2318             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2319             ij) up='A-Z'
2320                 low='a-z'
2321                 ;;
2322             esac
2323         fi
2324         if test "X$up" = X -o "X$low" = X; then
2325             case "`echo IJ | od -x 2>/dev/null`" in
2326             *C9D1*|*c9d1*)
2327                 echo "Hey, this might be EBCDIC." >&4
2328                 if test "X$up" = X -o "X$low" = X; then
2329                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2330                     ij) up='[A-IJ-RS-Z]'
2331                         low='[a-ij-rs-z]'
2332                         ;;
2333                     esac
2334                 fi
2335                 if test "X$up" = X -o "X$low" = X; then
2336                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2337                     ij) up='A-IJ-RS-Z'
2338                         low='a-ij-rs-z'
2339                         ;;
2340                     esac
2341                 fi
2342                 ;;
2343             esac
2344         fi
2345 esac
2346 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2347 ij)
2348     echo "Using $up and $low to convert case." >&4
2349     ;;
2350 *)
2351     echo "I don't know how to translate letters from upper to lower case." >&4
2352     echo "Your tr is not acting any way I know of." >&4
2353     exit 1
2354     ;;
2355 esac
2356 : set up the translation script tr, must be called with ./tr of course
2357 cat >tr <<EOSC
2358 $startsh
2359 case "\$1\$2" in
2360 '[A-Z][a-z]') exec $tr '$up' '$low';;
2361 '[a-z][A-Z]') exec $tr '$low' '$up';;
2362 esac
2363 exec $tr "\$@"
2364 EOSC
2365 chmod +x tr
2366 $eunicefix tr
2367
2368 : Try to determine whether config.sh was made on this system
2369 case "$config_sh" in
2370 '')
2371 myuname=`$uname -a 2>/dev/null`
2372 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2373 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2374 # because the A-Z/a-z are not consecutive.
2375 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2376         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2377 newmyuname="$myuname"
2378 dflt=n
2379 case "$knowitall" in
2380 '')
2381         if test -f ../config.sh; then
2382                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2383                         eval "`grep myuname= ../config.sh`"
2384                 fi
2385                 if test "X$myuname" = "X$newmyuname"; then
2386                         dflt=y
2387                 fi
2388         fi
2389         ;;
2390 *) dflt=y;;
2391 esac
2392
2393 : Get old answers from old config file if Configure was run on the
2394 : same system, otherwise use the hints.
2395 hint=default
2396 cd ..
2397 if test -f config.sh; then
2398         echo " "
2399         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2400         . UU/myread
2401         case "$ans" in
2402         n*|N*) echo "OK, I'll ignore it."
2403                 mv config.sh config.sh.old
2404                 myuname="$newmyuname"
2405                 ;;
2406         *)  echo "Fetching default answers from your old config.sh file..." >&4
2407                 tmp_n="$n"
2408                 tmp_c="$c"
2409                 tmp_sh="$sh"
2410                 . ./config.sh
2411                 cp config.sh UU
2412                 n="$tmp_n"
2413                 c="$tmp_c"
2414                 : Older versions did not always set $sh.  Catch re-use of such
2415                 : an old config.sh.
2416                 case "$sh" in
2417                 '') sh="$tmp_sh" ;;
2418                 esac
2419                 hint=previous
2420                 ;;
2421         esac
2422 fi
2423 . ./UU/checkcc
2424 if test ! -f config.sh; then
2425         $cat <<EOM
2426
2427 First time through, eh?  I have some defaults handy for some systems
2428 that need some extra help getting the Configure answers right:
2429
2430 EOM
2431         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2432         dflt=''
2433         : Half the following guesses are probably wrong... If you have better
2434         : tests or hints, please send them to perlbug@perl.org
2435         : The metaconfig authors would also appreciate a copy...
2436         $test -f /irix && osname=irix
2437         $test -f /xenix && osname=sco_xenix
2438         $test -f /dynix && osname=dynix
2439         $test -f /dnix && osname=dnix
2440         $test -f /lynx.os && osname=lynxos
2441         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2442         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2443         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2444         $test -f /bin/mips && /bin/mips && osname=mips
2445         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2446                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2447         $test -d /usr/apollo/bin && osname=apollo
2448         $test -f /etc/saf/_sactab && osname=svr4
2449         $test -d /usr/include/minix && osname=minix
2450         if $test -d /MachTen -o -d /MachTen_Folder; then
2451                 osname=machten
2452                 if $test -x /sbin/version; then
2453                         osvers=`/sbin/version | $awk '{print $2}' |
2454                         $sed -e 's/[A-Za-z]$//'`
2455                 elif $test -x /usr/etc/version; then
2456                         osvers=`/usr/etc/version | $awk '{print $2}' |
2457                         $sed -e 's/[A-Za-z]$//'`
2458                 else
2459                         osvers="$2.$3"
2460                 fi
2461         fi
2462
2463         $test -f /sys/posix.dll &&
2464                 $test -f /usr/bin/what &&
2465                 set X `/usr/bin/what /sys/posix.dll` &&
2466                 $test "$3" = UWIN &&
2467                 osname=uwin &&
2468                 osvers="$5"
2469
2470         if $test -f $uname; then
2471                 set X $myuname
2472                 shift
2473
2474                 case "$5" in
2475                 fps*) osname=fps ;;
2476                 mips*)
2477                         case "$4" in
2478                         umips) osname=umips ;;
2479                         *) osname=mips ;;
2480                         esac;;
2481                 [23]100) osname=mips ;;
2482                 next*) osname=next ;;
2483                 i386*)
2484                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2485                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2486                                 osname='sco'
2487                                 osvers=$tmp
2488                         elif $test -f /etc/kconfig; then
2489                                 osname=isc
2490                                 if test "$lns" = "$ln -s"; then
2491                                         osvers=4
2492                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2493                                         osvers=3
2494                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2495                                         osvers=2
2496                                 fi
2497                         fi
2498                         tmp=''
2499                         ;;
2500                 pc*)
2501                         if test -n "$DJGPP"; then
2502                                 osname=dos
2503                                 osvers=djgpp
2504                         fi
2505                         ;;
2506                 esac
2507
2508                 case "$1" in
2509                 aix) osname=aix
2510                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2511                         case "$tmp" in
2512                         'not found') osvers="$4"."$3" ;;
2513                         '<3240'|'<>3240') osvers=3.2.0 ;;
2514                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2515                         '=3250'|'>3250') osvers=3.2.5 ;;
2516                         *) osvers=$tmp;;
2517                         esac
2518                         ;;
2519                 bsd386) osname=bsd386
2520                         osvers=`$uname -r`
2521                         ;;
2522                 cygwin*) osname=cygwin
2523                         osvers="$3"
2524                         ;;
2525                 *dc.osx) osname=dcosx
2526                         osvers="$3"
2527                         ;;
2528                 dnix) osname=dnix
2529                         osvers="$3"
2530                         ;;
2531                 domainos) osname=apollo
2532                         osvers="$3"
2533                         ;;
2534                 dgux) osname=dgux 
2535                         osvers="$3"
2536                         ;;
2537                 dynixptx*) osname=dynixptx
2538                         osvers=`echo "$4"|sed 's/^v//'`
2539                         ;;
2540                 freebsd) osname=freebsd 
2541                         osvers="$3" ;;
2542                 genix) osname=genix ;;
2543                 hp*) osname=hpux 
2544                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2545                         ;;
2546                 irix*) osname=irix
2547                         case "$3" in
2548                         4*) osvers=4 ;;
2549                         5*) osvers=5 ;;
2550                         *)      osvers="$3" ;;
2551                         esac
2552                         ;;
2553                 linux) osname=linux
2554                         case "$3" in
2555                         *)      osvers="$3" ;;
2556                         esac
2557                         ;;
2558                 MiNT) osname=mint
2559                         ;;
2560                 netbsd*) osname=netbsd
2561                         osvers="$3"
2562                         ;;
2563                 news-os) osvers="$3"
2564                         case "$3" in
2565                         4*) osname=newsos4 ;;
2566                         *) osname=newsos ;;
2567                         esac
2568                         ;;
2569                 next*) osname=next ;;
2570                 nonstop-ux) osname=nonstopux ;;
2571                 POSIX-BC | posix-bc ) osname=posix-bc
2572                         osvers="$3"
2573                         ;;
2574                 powerux | power_ux | powermax_os | powermaxos | \
2575                 powerunix | power_unix) osname=powerux
2576                         osvers="$3"
2577                         ;;
2578                 qnx) osname=qnx
2579                         osvers="$4"
2580                         ;;
2581                 solaris) osname=solaris
2582                         case "$3" in
2583                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2584                         *)      osvers="$3" ;;
2585                         esac
2586                         ;;
2587                 sunos) osname=sunos
2588                         case "$3" in
2589                         5*) osname=solaris
2590                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2591                         *)      osvers="$3" ;;
2592                         esac
2593                         ;;
2594                 titanos) osname=titanos
2595                         case "$3" in
2596                         1*) osvers=1 ;;
2597                         2*) osvers=2 ;;
2598                         3*) osvers=3 ;;
2599                         4*) osvers=4 ;;
2600                         *)      osvers="$3" ;;
2601                         esac
2602                         ;;
2603                 ultrix) osname=ultrix
2604                         osvers="$3"
2605                         ;;
2606                 osf1|mls+)      case "$5" in
2607                                 alpha)
2608                                         osname=dec_osf
2609                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2610                                         case "$osvers" in
2611                                         [1-9].[0-9]*) ;;
2612                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2613                                         esac
2614                                         ;;
2615                         hp*)    osname=hp_osf1  ;;
2616                         mips)   osname=mips_osf1 ;;
2617                         esac
2618                         ;;
2619                 unixware) osname=svr5
2620                         osvers="$4"
2621                         ;;
2622                 uts) osname=uts
2623                         osvers="$3"
2624                         ;;
2625                 $2) case "$osname" in
2626                         *isc*) ;;
2627                         *freebsd*) ;;
2628                         svr*)
2629                                 : svr4.x or possibly later
2630                                 case "svr$3" in 
2631                                 ${osname}*)
2632                                         osname=svr$3
2633                                         osvers=$4
2634                                         ;;
2635                                 esac
2636                                 case "$osname" in
2637                                 svr4.0)
2638                                         : Check for ESIX
2639                                         if test -f /stand/boot ; then
2640                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2641                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2642                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2643                                                         if test -n "$isesix"; then
2644                                                                 osname=esix4
2645                                                         fi
2646                                                 fi
2647                                         fi
2648                                         ;;
2649                                 esac
2650                                 ;;
2651                         *)      if test -f /etc/systemid; then
2652                                         osname=sco
2653                                         set `echo $3 | $sed 's/\./ /g'` $4
2654                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2655                                                 osvers=$1.$2.$3
2656                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2657                                                 osvers=$1.$2
2658                                         elif $test -f $src/hints/sco_$1.sh; then
2659                                                 osvers=$1
2660                                         fi
2661                                 else
2662                                         case "$osname" in
2663                                         '') : Still unknown.  Probably a generic Sys V.
2664                                                 osname="sysv"
2665                                                 osvers="$3"
2666                                                 ;;
2667                                         esac
2668                                 fi
2669                                 ;;
2670                         esac
2671                         ;;
2672                 *)      case "$osname" in
2673                         '') : Still unknown.  Probably a generic BSD.
2674                                 osname="$1"
2675                                 osvers="$3"
2676                                 ;;
2677                         esac
2678                         ;;
2679                 esac
2680         else
2681                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2682                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2683                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2684                                 osname=news_os
2685                         fi
2686                         $rm -f UU/kernel.what
2687                 elif test -d c:/.; then
2688                         set X $myuname
2689                         osname=os2
2690                         osvers="$5"
2691                 fi
2692         fi
2693         
2694         : Now look for a hint file osname_osvers, unless one has been
2695         : specified already.
2696         case "$hintfile" in
2697         ''|' ')
2698                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2699                 : Also try without trailing minor version numbers.
2700                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2701                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2702                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2703                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2704                 case "$file" in
2705                 '') dflt=none ;;
2706                 *)  case "$osvers" in
2707                         '') dflt=$file
2708                                 ;;
2709                         *)  if $test -f $src/hints/$file.sh ; then
2710                                         dflt=$file
2711                                 elif $test -f $src/hints/$xfile.sh ; then
2712                                         dflt=$xfile
2713                                 elif $test -f $src/hints/$xxfile.sh ; then
2714                                         dflt=$xxfile
2715                                 elif $test -f $src/hints/$xxxfile.sh ; then
2716                                         dflt=$xxxfile
2717                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2718                                         dflt=$xxxxfile
2719                                 elif $test -f "$src/hints/${osname}.sh" ; then
2720                                         dflt="${osname}"
2721                                 else
2722                                         dflt=none
2723                                 fi
2724                                 ;;
2725                         esac
2726                         ;;
2727                 esac
2728                 if $test -f Policy.sh ; then
2729                         case "$dflt" in
2730                         *Policy*) ;;
2731                         none) dflt="Policy" ;;
2732                         *) dflt="Policy $dflt" ;;
2733                         esac
2734                 fi
2735                 ;;
2736         *)
2737                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2738                 ;;
2739         esac
2740
2741         if $test -f Policy.sh ; then
2742                 $cat <<EOM
2743
2744 There's also a Policy hint file available, which should make the
2745 site-specific (policy) questions easier to answer.
2746 EOM
2747
2748         fi
2749
2750         $cat <<EOM
2751
2752 You may give one or more space-separated answers, or "none" if appropriate.
2753 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2754 is a good thing.  DO NOT give a wrong version or a wrong OS.
2755
2756 EOM
2757
2758         rp="Which of these apply, if any?"
2759         . UU/myread
2760         tans=$ans
2761         for file in $tans; do
2762                 if $test X$file = XPolicy -a -f Policy.sh; then
2763                         . Policy.sh
2764                         $cat Policy.sh >> UU/config.sh
2765                 elif $test -f $src/hints/$file.sh; then
2766                         . $src/hints/$file.sh
2767                         $cat $src/hints/$file.sh >> UU/config.sh
2768                 elif $test X$tans = X -o X$tans = Xnone ; then
2769                         : nothing
2770                 else
2771                         : Give one chance to correct a possible typo.
2772                         echo "$file.sh does not exist"
2773                         dflt=$file
2774                         rp="hint to use instead?"
2775                         . UU/myread
2776                         for file in $ans; do
2777                                 if $test -f "$src/hints/$file.sh"; then
2778                                         . $src/hints/$file.sh
2779                                         $cat $src/hints/$file.sh >> UU/config.sh
2780                                 elif $test X$ans = X -o X$ans = Xnone ; then
2781                                         : nothing
2782                                 else
2783                                         echo "$file.sh does not exist -- ignored."
2784                                 fi
2785                         done
2786                 fi
2787         done
2788
2789         hint=recommended
2790         : Remember our hint file for later.
2791         if $test -f "$src/hints/$file.sh" ; then
2792                 hintfile="$file"
2793         else
2794                 hintfile=''
2795         fi
2796 fi
2797 cd UU
2798 ;;
2799 *)
2800         echo " "
2801         echo "Fetching default answers from $config_sh..." >&4
2802         tmp_n="$n"
2803         tmp_c="$c"
2804         cd ..
2805         cp $config_sh config.sh 2>/dev/null
2806         chmod +w config.sh
2807         . ./config.sh
2808         cd UU
2809         cp ../config.sh .
2810         n="$tmp_n"
2811         c="$tmp_c"
2812         hint=previous
2813         ;;
2814 esac
2815 test "$override" && . ./optdef.sh
2816
2817 : Restore computed paths
2818 for file in $loclist $trylist; do
2819         eval $file="\$_$file"
2820 done
2821
2822 cat << EOM
2823
2824 Configure uses the operating system name and version to set some defaults.
2825 The default value is probably right if the name rings a bell. Otherwise,
2826 since spelling matters for me, either accept the default or answer "none"
2827 to leave it blank.
2828
2829 EOM
2830 case "$osname" in
2831         ''|' ')
2832                 case "$hintfile" in
2833                 ''|' '|none) dflt=none ;;
2834                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2835                 esac
2836                 ;;
2837         *) dflt="$osname" ;;
2838 esac
2839 rp="Operating system name?"
2840 . ./myread
2841 case "$ans" in
2842 none)  osname='' ;;
2843 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2844 esac
2845 echo " "
2846 case "$osvers" in
2847         ''|' ')
2848                 case "$hintfile" in
2849                 ''|' '|none) dflt=none ;;
2850                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2851                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2852                         case "$dflt" in
2853                         ''|' ') dflt=none ;;
2854                         esac
2855                         ;;
2856                 esac
2857                 ;;
2858         *) dflt="$osvers" ;;
2859 esac
2860 rp="Operating system version?"
2861 . ./myread
2862 case "$ans" in
2863 none)  osvers='' ;;
2864 *) osvers="$ans" ;;
2865 esac
2866
2867
2868 . ./posthint.sh
2869
2870 : who configured the system
2871 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2872 cf_by=`(logname) 2>/dev/null`
2873 case "$cf_by" in
2874 "")
2875         cf_by=`(whoami) 2>/dev/null`
2876         case "$cf_by" in
2877         "") cf_by=unknown ;;
2878         esac ;;
2879 esac
2880
2881 : set up the script used to warn in case of inconsistency
2882 cat <<EOS >whoa
2883 $startsh
2884 EOS
2885 cat <<'EOSC' >>whoa
2886 dflt=y
2887 echo " "
2888 echo "*** WHOA THERE!!! ***" >&4
2889 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2890 rp="    Keep the $hint value?"
2891 . ./myread
2892 case "$ans" in
2893 y) td=$was; tu=$was;;
2894 esac
2895 EOSC
2896
2897 : function used to set $1 to $val
2898 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2899 case "$val$was" in
2900 $define$undef) . ./whoa; eval "$var=\$td";;
2901 $undef$define) . ./whoa; eval "$var=\$tu";;
2902 *) eval "$var=$val";;
2903 esac'
2904
2905 case "$usethreads" in
2906 $define|true|[yY]*)     dflt='y';;
2907 *) dflt='n';;
2908 esac
2909 cat <<EOM
2910
2911 Perl can be built to take advantage of threads on some systems.
2912 To do so, Configure can be run with -Dusethreads.
2913
2914 Note that threading is a highly experimental feature, and
2915 some known race conditions still remain.  If you choose to try
2916 it, be very sure to not actually deploy it for production
2917 purposes.  README.threads has more details, and is required
2918 reading if you enable threads.
2919
2920 If this doesn't make any sense to you, just accept the default '$dflt'.
2921 EOM
2922 rp='Build a threading Perl?'
2923 . ./myread
2924 case "$ans" in
2925 y|Y)    val="$define" ;;
2926 *)      val="$undef" ;;
2927 esac
2928 set usethreads
2929 eval $setvar
2930
2931 case "$usethreads" in
2932 $define)
2933         $cat <<EOM
2934
2935 As of 5.5.640, Perl has two different internal threading implementations,
2936 the 5.005 version (5005threads) and an interpreter-based version
2937 (ithreads) that has one interpreter per thread.  Both are very 
2938 experimental.  This arrangement exists to help developers work out
2939 which one is better.
2940
2941 If you're a casual user, you probably don't want interpreter-threads
2942 at this time.  There doesn't yet exist a way to create threads from
2943 within Perl in this model, i.e., "use Thread;" will NOT work.
2944 EOM
2945         : Default to ithreads unless overridden on command line or with
2946         : old config.sh
2947         dflt='y'
2948         case "$use5005threads" in
2949                 $define|true|[yY]*) dflt='n';;
2950         esac
2951         case "$useithreads" in
2952                 $undef|false|[nN]*) dflt='n';;
2953         esac
2954         rp='Use interpreter-based ithreads?'
2955         . ./myread
2956         case "$ans" in
2957         y|Y)    val="$define" ;;
2958         *)      val="$undef" ;;
2959         esac
2960         set useithreads
2961         eval $setvar
2962         : Now set use5005threads to the opposite value.
2963         case "$useithreads" in
2964         $define) val="$undef" ;;
2965         *) val="$define" ;;
2966         esac
2967         set use5005threads
2968         eval $setvar
2969         ;;
2970 *)
2971         useithreads="$undef"
2972         use5005threads="$undef"
2973         ;;
2974 esac
2975
2976 case "$useithreads$use5005threads" in
2977 "$define$define")
2978         $cat >&4 <<EOM
2979
2980 You cannot have both the ithreads and the 5.005 threads enabled
2981 at the same time.  Disabling the 5.005 threads since they are
2982 much less stable than the ithreads.
2983
2984 EOM
2985         use5005threads="$undef"
2986         ;;
2987 esac
2988
2989 case "$d_oldpthreads" in
2990 '')     : Configure tests would be welcome here.  For now, assume undef.
2991         val="$undef" ;;
2992 *)      val="$d_oldpthreads" ;;
2993 esac
2994 set d_oldpthreads
2995 eval $setvar
2996
2997
2998 case "$usethreads" in
2999 "$define"|true|[yY]*)
3000 : Look for a hint-file generated 'call-back-unit'.  If the
3001 : user has specified that a threading perl is to be built,
3002 : we may need to set or change some other defaults.
3003         if $test -f usethreads.cbu; then
3004                 echo "Your platform has some specific hints for threaded builds, using them..."
3005                 . ./usethreads.cbu
3006         else
3007                 $cat <<EOM
3008 (Your platform doesn't have any specific hints for threaded builds.
3009  Assuming POSIX threads, then.)
3010 EOM
3011         fi
3012         ;;
3013 esac
3014
3015 cat <<EOM
3016
3017 Perl can be built so that multiple Perl interpreters can coexist
3018 within the same Perl executable.
3019 EOM
3020
3021 case "$useithreads" in
3022 $define)
3023         cat <<EOM
3024 This multiple interpreter support is required for interpreter-based threads.
3025 EOM
3026         val="$define"
3027         ;;
3028 *)      case "$usemultiplicity" in
3029         $define|true|[yY]*)     dflt='y';;
3030         *) dflt='n';;
3031         esac
3032         echo " "
3033         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3034         rp='Build Perl for multiplicity?'
3035         . ./myread
3036         case "$ans" in
3037         y|Y)    val="$define" ;;
3038         *)      val="$undef" ;;
3039         esac
3040         ;;
3041 esac
3042 set usemultiplicity
3043 eval $setvar
3044
3045 : make some quick guesses about what we are up against
3046 echo " "
3047 $echo $n "Hmm...  $c"
3048 echo exit 1 >bsd
3049 echo exit 1 >usg
3050 echo exit 1 >v7
3051 echo exit 1 >osf1
3052 echo exit 1 >eunice
3053 echo exit 1 >xenix
3054 echo exit 1 >venix
3055 echo exit 1 >os2
3056 d_bsd="$undef"
3057 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3058 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3059 then
3060         echo "Looks kind of like an OSF/1 system, but we'll see..."
3061         echo exit 0 >osf1
3062 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3063         xxx=`./loc addbib blurfl $pth`
3064         if $test -f $xxx; then
3065         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3066                 echo exit 0 >bsd
3067                 echo exit 0 >usg
3068         else
3069                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3070                         echo "Looks kind of like an extended USG system, but we'll see..."
3071                 else
3072                         echo "Looks kind of like a USG system, but we'll see..."
3073                 fi
3074                 echo exit 0 >usg
3075         fi
3076 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3077         echo "Looks kind of like a BSD system, but we'll see..."
3078         d_bsd="$define"
3079         echo exit 0 >bsd
3080 else
3081         echo "Looks kind of like a Version 7 system, but we'll see..."
3082         echo exit 0 >v7
3083 fi
3084 case "$eunicefix" in
3085 *unixtovms*)
3086         $cat <<'EOI'
3087 There is, however, a strange, musty smell in the air that reminds me of
3088 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3089 EOI
3090         echo exit 0 >eunice
3091         d_eunice="$define"
3092 : it so happens the Eunice I know will not run shell scripts in Unix format
3093         ;;
3094 *)
3095         echo " "
3096         echo "Congratulations.  You aren't running Eunice."
3097         d_eunice="$undef"
3098         ;;
3099 esac
3100 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3101 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3102 : semicolon as a patch separator
3103 case "$p_" in
3104 :) ;;
3105 *)
3106         $cat <<'EOI'
3107 I have the feeling something is not exactly right, however...don't tell me...
3108 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3109 (Or you may be running DOS with DJGPP.)
3110 EOI
3111         echo exit 0 >os2
3112         ;;
3113 esac
3114 if test -f /xenix; then
3115         echo "Actually, this looks more like a XENIX system..."
3116         echo exit 0 >xenix
3117         d_xenix="$define"
3118 else
3119         echo " "
3120         echo "It's not Xenix..."
3121         d_xenix="$undef"
3122 fi
3123 chmod +x xenix
3124 $eunicefix xenix
3125 if test -f /venix; then
3126         echo "Actually, this looks more like a VENIX system..."
3127         echo exit 0 >venix
3128 else
3129         echo " "
3130         if ./xenix; then
3131                 : null
3132         else
3133                 echo "Nor is it Venix..."
3134         fi
3135 fi
3136 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3137 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3138 $rm -f foo
3139
3140 case "$cc" in
3141 '') dflt=cc;;
3142 *) dflt="$cc";;
3143 esac
3144 rp="Use which C compiler?"
3145 . ./myread
3146 cc="$ans"
3147 : Look for a hint-file generated 'call-back-unit'.  Now that the
3148 : user has specified the compiler, we may need to set or change some
3149 : other defaults.
3150 if $test -f cc.cbu; then
3151     . ./cc.cbu
3152 fi
3153 . ./checkcc
3154
3155 echo " "
3156 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3157 $cat >gccvers.c <<EOM
3158 #include <stdio.h>
3159 int main() {
3160 #ifdef __GNUC__
3161 #ifdef __VERSION__
3162         printf("%s\n", __VERSION__);
3163 #else
3164         printf("%s\n", "1");
3165 #endif
3166 #endif
3167         exit(0);
3168 }
3169 EOM
3170 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3171         gccversion=`./gccvers`
3172         case "$gccversion" in
3173         '') echo "You are not using GNU cc." ;;
3174         *)  echo "You are using GNU cc $gccversion."
3175             ccname=gcc  
3176             ;;
3177         esac
3178 else
3179         echo " "
3180         echo "*** WHOA THERE!!! ***" >&4
3181         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3182         case "$knowitall" in
3183         '')
3184         echo "    You'd better start hunting for one and let me know about it." >&4
3185                 exit 1
3186                 ;;
3187         esac
3188 fi
3189 $rm -f gccvers*
3190 case "$gccversion" in
3191 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3192 esac
3193 case "$gccversion" in
3194 '') gccosandvers='' ;;
3195 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3196    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3197    gccshortvers=''
3198    case "$gccosandvers" in
3199    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3200    $osname$osvers) ;; # looking good
3201    $osname*) cat <<EOM >&4
3202
3203 *** WHOA THERE!!! ***
3204
3205     Your gcc has not been compiled for the exact release of
3206     your operating system ($gccosandvers versus $osname$osvers).
3207
3208     In general it is a good idea to keep gcc synchronized with
3209     the operating system because otherwise serious problems
3210     may ensue when trying to compile software, like Perl.
3211
3212     I'm trying to be optimistic here, though, and will continue.
3213     If later during the configuration and build icky compilation
3214     problems appear (headerfile conflicts being the most common
3215     manifestation), I suggest reinstalling the gcc to match
3216     your operating system release.
3217
3218 EOM
3219       ;;
3220    *) gccosandvers='' ;; # failed to parse, better be silent
3221    esac
3222    ;;
3223 esac
3224 case "$ccname" in
3225 '') ccname="$cc" ;;
3226 esac
3227
3228 case "$gccversion" in
3229 '') ;;
3230 *)  case "$ccflags" in
3231     *-Wall*) ;;
3232     *) ccflags="$ccflags -Wall" ;;
3233     esac
3234     ;;
3235 esac
3236
3237 : see how we invoke the C preprocessor
3238 echo " "
3239 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3240 cat <<'EOT' >testcpp.c
3241 #define ABC abc
3242 #define XYZ xyz
3243 ABC.XYZ
3244 EOT
3245 cd ..
3246 if test ! -f cppstdin; then
3247         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3248                 # AIX cc -E doesn't show the absolute headerfile
3249                 # locations but we'll cheat by using the -M flag.
3250                 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
3251         else
3252                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3253         fi
3254 else
3255         echo "Keeping your $hint cppstdin wrapper."
3256 fi
3257 chmod 755 cppstdin
3258 wrapper=`pwd`/cppstdin
3259 ok='false'
3260 cd UU
3261
3262 if $test "X$cppstdin" != "X" && \
3263         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3265 then
3266         echo "You used to use $cppstdin $cppminus so we'll use that again."
3267         case "$cpprun" in
3268         '') echo "But let's see if we can live without a wrapper..." ;;
3269         *)
3270                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3271                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3272                 then
3273                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3274                         ok='true'
3275                 else
3276                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3277                 fi
3278                 ;;
3279         esac
3280 else
3281         case "$cppstdin" in
3282         '') ;;
3283         *)
3284                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3285                 ;;
3286         esac
3287 fi
3288
3289 if $ok; then
3290         : nothing
3291 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3292         $cc -E <testcpp.c >testcpp.out 2>&1; \
3293         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3294         echo "Yup, it does."
3295         x_cpp="$cc -E"
3296         x_minus='';
3297 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3298         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3299         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3300         echo "Yup, it does."
3301         x_cpp="$cc -E"
3302         x_minus='-';
3303 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3304         $cc -P <testcpp.c >testcpp.out 2>&1; \
3305         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3306         echo "Yipee, that works!"
3307         x_cpp="$cc -P"
3308         x_minus='';
3309 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3310         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3311         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3312         echo "At long last!"
3313         x_cpp="$cc -P"
3314         x_minus='-';
3315 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3316         $cpp <testcpp.c >testcpp.out 2>&1; \
3317         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3318         echo "It works!"
3319         x_cpp="$cpp"
3320         x_minus='';
3321 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3322         $cpp - <testcpp.c >testcpp.out 2>&1; \
3323         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324         echo "Hooray, it works!  I was beginning to wonder."
3325         x_cpp="$cpp"
3326         x_minus='-';
3327 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3328         $wrapper <testcpp.c >testcpp.out 2>&1; \
3329         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3330         x_cpp="$wrapper"
3331         x_minus=''
3332         echo "Eureka!"
3333 else
3334         dflt=''
3335         rp="No dice.  I can't find a C preprocessor.  Name one:"
3336         . ./myread
3337         x_cpp="$ans"
3338         x_minus=''
3339         $x_cpp <testcpp.c >testcpp.out 2>&1
3340         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3341                 echo "OK, that will do." >&4
3342         else
3343 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3344                 exit 1
3345         fi
3346 fi
3347
3348 case "$ok" in
3349 false)
3350         cppstdin="$x_cpp"
3351         cppminus="$x_minus"
3352         cpprun="$x_cpp"
3353         cpplast="$x_minus"
3354         set X $x_cpp
3355         shift
3356         case "$1" in
3357         "$cpp")
3358                 echo "Perhaps can we force $cc -E using a wrapper..."
3359                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3360                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3361                 then
3362                         echo "Yup, we can."
3363                         cppstdin="$wrapper"
3364                         cppminus='';
3365                 else
3366                         echo "Nope, we'll have to live without it..."
3367                 fi
3368                 ;;
3369         esac
3370         case "$cpprun" in
3371         "$wrapper")
3372                 cpprun=''
3373                 cpplast=''
3374                 ;;
3375         esac
3376         ;;
3377 esac
3378
3379 case "$cppstdin" in
3380 "$wrapper"|'cppstdin') ;;
3381 *) $rm -f $wrapper;;
3382 esac
3383 $rm -f testcpp.c testcpp.out
3384
3385 : decide how portable to be.  Allow command line overrides.
3386 case "$d_portable" in
3387 "$undef") ;;
3388 *)      d_portable="$define" ;;
3389 esac
3390
3391 : set up shell script to do ~ expansion
3392 cat >filexp <<EOSS
3393 $startsh
3394 : expand filename
3395 case "\$1" in
3396  ~/*|~)
3397         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3398         ;;
3399  ~*)
3400         if $test -f /bin/csh; then
3401                 /bin/csh -f -c "glob \$1"
3402                 failed=\$?
3403                 echo ""
3404                 exit \$failed
3405         else
3406                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3407                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3408                 if $test ! -d "\$dir"; then
3409                         me=\`basename \$0\`
3410                         echo "\$me: can't locate home directory for: \$name" >&2
3411                         exit 1
3412                 fi
3413                 case "\$1" in
3414                 */*)
3415                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3416                         ;;
3417                 *)
3418                         echo \$dir
3419                         ;;
3420                 esac
3421         fi
3422         ;;
3423 *)
3424         echo \$1
3425         ;;
3426 esac
3427 EOSS
3428 chmod +x filexp
3429 $eunicefix filexp
3430
3431 : now set up to get a file name
3432 cat <<EOS >getfile
3433 $startsh
3434 EOS
3435 cat <<'EOSC' >>getfile
3436 tilde=''
3437 fullpath=''
3438 already=''
3439 skip=''
3440 none_ok=''
3441 exp_file=''
3442 nopath_ok=''
3443 orig_rp="$rp"
3444 orig_dflt="$dflt"
3445 case "$gfpth" in
3446 '') gfpth='.' ;;
3447 esac
3448
3449 case "$fn" in
3450 *\(*)
3451         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3452         fn=`echo $fn | sed 's/(.*)//'`
3453         ;;
3454 esac
3455
3456 case "$fn" in
3457 *:*)
3458         loc_file=`expr $fn : '.*:\(.*\)'`
3459         fn=`expr $fn : '\(.*\):.*'`
3460         ;;
3461 esac
3462
3463 case "$fn" in
3464 *~*) tilde=true;;
3465 esac
3466 case "$fn" in
3467 */*) fullpath=true;;
3468 esac
3469 case "$fn" in
3470 *+*) skip=true;;
3471 esac
3472 case "$fn" in
3473 *n*) none_ok=true;;
3474 esac
3475 case "$fn" in
3476 *e*) exp_file=true;;
3477 esac
3478 case "$fn" in
3479 *p*) nopath_ok=true;;
3480 esac
3481
3482 case "$fn" in
3483 *f*) type='File';;
3484 *d*) type='Directory';;
3485 *l*) type='Locate';;
3486 esac
3487
3488 what="$type"
3489 case "$what" in
3490 Locate) what='File';;
3491 esac
3492
3493 case "$exp_file" in
3494 '')
3495         case "$d_portable" in
3496         "$define") ;;
3497         *) exp_file=true;;
3498         esac
3499         ;;
3500 esac
3501
3502 cd ..
3503 while test "$type"; do
3504         redo=''
3505         rp="$orig_rp"
3506         dflt="$orig_dflt"
3507         case "$tilde" in
3508         true) rp="$rp (~name ok)";;
3509         esac
3510         . UU/myread
3511         if test -f UU/getfile.ok && \
3512                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3513         then
3514                 value="$ans"
3515                 ansexp="$ans"
3516                 break
3517         fi
3518         case "$ans" in
3519         none)
3520                 value=''
3521                 ansexp=''
3522                 case "$none_ok" in
3523                 true) type='';;
3524                 esac
3525                 ;;
3526         *)
3527                 case "$tilde" in
3528                 '') value="$ans"
3529                         ansexp="$ans";;
3530                 *)
3531                         value=`UU/filexp $ans`
3532                         case $? in
3533                         0)
3534                                 if test "$ans" != "$value"; then
3535                                         echo "(That expands to $value on this system.)"
3536                                 fi
3537                                 ;;
3538                         *) value="$ans";;
3539                         esac
3540                         ansexp="$value"
3541                         case "$exp_file" in
3542                         '') value="$ans";;
3543                         esac
3544                         ;;
3545                 esac
3546                 case "$fullpath" in
3547                 true)
3548                         case "$ansexp" in
3549                         /*) value="$ansexp" ;;
3550                         [a-zA-Z]:/*) value="$ansexp" ;;
3551                         *)
3552                                 redo=true
3553                                 case "$already" in
3554                                 true)
3555                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3556                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3557                                         ;;
3558                                 *)
3559                                 echo "Please give a full path name, starting with slash." >&4
3560                                         case "$tilde" in
3561                                         true)
3562                                 echo "Note that using ~name is ok provided it expands well." >&4
3563                                                 already=true
3564                                                 ;;
3565                                         esac
3566                                 esac
3567                                 ;;
3568                         esac
3569                         ;;
3570                 esac
3571                 case "$redo" in
3572                 '')
3573                         case "$type" in
3574                         File)
3575                                 for fp in $gfpth; do
3576                                         if test "X$fp" = X.; then
3577                                             pf="$ansexp"
3578                                         else    
3579                                             pf="$fp/$ansexp"
3580                                         fi
3581                                         if test -f "$pf"; then
3582                                                 type=''
3583                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3584                                         then
3585                                                 echo "($value is not a plain file, but that's ok.)"
3586                                                 type=''
3587                                         fi
3588                                         if test X"$type" = X; then
3589                                             value="$pf"
3590                                             break
3591                                         fi
3592                                 done
3593                                 ;;
3594                         Directory)
3595                                 for fp in $gfpth; do
3596                                         if test "X$fp" = X.; then
3597                                             dir="$ans"
3598                                             direxp="$ansexp"
3599                                         else    
3600                                             dir="$fp/$ansexp"
3601                                             direxp="$fp/$ansexp"
3602                                         fi
3603                                         if test -d "$direxp"; then
3604                                                 type=''
3605                                                 value="$dir"
3606                                                 break
3607                                         fi
3608                                 done
3609                                 ;;
3610                         Locate)
3611                                 if test -d "$ansexp"; then
3612                                         echo "(Looking for $loc_file in directory $value.)"
3613                                         value="$value/$loc_file"
3614                                         ansexp="$ansexp/$loc_file"
3615                                 fi
3616                                 if test -f "$ansexp"; then
3617                                         type=''
3618                                 fi
3619                                 case "$nopath_ok" in
3620                                 true)   case "$value" in
3621                                         */*) ;;
3622                                         *)      echo "Assuming $value will be in people's path."
3623                                                 type=''
3624                                                 ;;
3625                                         esac
3626                                         ;;
3627                                 esac
3628                                 ;;
3629                         esac
3630
3631                         case "$skip" in
3632                         true) type='';
3633                         esac
3634
3635                         case "$type" in
3636                         '') ;;
3637                         *)
3638                                 if test "$fastread" = yes; then
3639                                         dflt=y
3640                                 else
3641                                         dflt=n
3642                                 fi
3643                                 rp="$what $value doesn't exist.  Use that name anyway?"
3644                                 . UU/myread
3645                                 dflt=''
3646                                 case "$ans" in
3647                                 y*) type='';;
3648                                 *) echo " ";;
3649                                 esac
3650                                 ;;
3651                         esac
3652                         ;;
3653                 esac
3654                 ;;
3655         esac
3656 done
3657 cd UU
3658 ans="$value"
3659 rp="$orig_rp"
3660 dflt="$orig_dflt"
3661 rm -f getfile.ok
3662 test "X$gfpthkeep" != Xy && gfpth=""
3663 EOSC
3664
3665 : What should the include directory be ?
3666 echo " "
3667 $echo $n "Hmm...  $c"
3668 dflt='/usr/include'
3669 incpath=''
3670 mips_type=''
3671 if $test -f /bin/mips && /bin/mips; then
3672         echo "Looks like a MIPS system..."
3673         $cat >usr.c <<'EOCP'
3674 #ifdef SYSTYPE_BSD43
3675 /bsd43
3676 #endif
3677 EOCP
3678         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3679                 dflt='/bsd43/usr/include'
3680                 incpath='/bsd43'
3681                 mips_type='BSD 4.3'
3682         else
3683                 mips_type='System V'
3684         fi
3685         $rm -f usr.c usr.out
3686         echo "and you're compiling with the $mips_type compiler and libraries."
3687         xxx_prompt=y
3688         echo "exit 0" >mips
3689 else
3690         echo "Doesn't look like a MIPS system."
3691         xxx_prompt=n
3692         echo "exit 1" >mips
3693 fi
3694 chmod +x mips
3695 $eunicefix mips
3696 case "$usrinc" in
3697 '') ;;
3698 *) dflt="$usrinc";;
3699 esac
3700 case "$xxx_prompt" in
3701 y)      fn=d/
3702         echo " "
3703         rp='Where are the include files you want to use?'
3704         . ./getfile
3705         usrinc="$ans"
3706         ;;
3707 *)      usrinc="$dflt"
3708         ;;
3709 esac
3710
3711 : Set private lib path
3712 case "$plibpth" in
3713 '') if ./mips; then
3714                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3715         fi;;
3716 esac
3717 case "$libpth" in
3718 ' ') dlist='';;
3719 '') dlist="$loclibpth $plibpth $glibpth";;
3720 *) dlist="$libpth";;
3721 esac
3722
3723 : Now check and see which directories actually exist, avoiding duplicates
3724 libpth=''
3725 for xxx in $dlist
3726 do
3727     if $test -d $xxx; then
3728                 case " $libpth " in
3729                 *" $xxx "*) ;;
3730                 *) libpth="$libpth $xxx";;
3731                 esac
3732     fi
3733 done
3734 $cat <<'EOM'
3735
3736 Some systems have incompatible or broken versions of libraries.  Among
3737 the directories listed in the question below, please remove any you
3738 know not to be holding relevant libraries, and add any that are needed.
3739 Say "none" for none.
3740
3741 EOM
3742 case "$libpth" in
3743 '') dflt='none';;
3744 *)
3745         set X $libpth
3746         shift
3747         dflt=${1+"$@"}
3748         ;;
3749 esac
3750 rp="Directories to use for library searches?"
3751 . ./myread
3752 case "$ans" in
3753 none) libpth=' ';;
3754 *) libpth="$ans";;
3755 esac
3756
3757 : compute shared library extension
3758 case "$so" in
3759 '')
3760         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3761                 dflt='sl'
3762         else
3763                 dflt='so'
3764         fi
3765         ;;
3766 *) dflt="$so";;
3767 esac
3768 $cat <<EOM
3769
3770 On some systems, shared libraries may be available.  Answer 'none' if
3771 you want to suppress searching of shared libraries for the remainder
3772 of this configuration.
3773
3774 EOM
3775 rp='What is the file extension used for shared libraries?'
3776 . ./myread
3777 so="$ans"
3778
3779 : Define several unixisms.
3780 : Hints files or command line option can be used to override them.
3781 : The convoluted testing is in case hints files set either the old
3782 : or the new name.
3783 case "$_exe" in
3784 '')     case "$exe_ext" in
3785     '') ;;
3786         *)      _exe="$exe_ext" ;;
3787         esac
3788         ;;
3789 esac
3790 case "$_a" in
3791 '')     case "$lib_ext" in
3792     '') _a='.a';;
3793         *)      _a="$lib_ext" ;;
3794         esac
3795         ;;
3796 esac
3797 case "$_o" in
3798 '') case "$obj_ext" in
3799         '')     _o='.o';;
3800         *)      _o="$obj_ext";;
3801         esac
3802         ;;
3803 esac
3804 case "$p_" in
3805 '') case "$path_sep" in
3806         '')     p_=':';;
3807         *)      p_="$path_sep";;
3808         esac
3809         ;;
3810 esac
3811 exe_ext=$_exe
3812 lib_ext=$_a
3813 obj_ext=$_o
3814 path_sep=$p_
3815
3816 : Which makefile gets called first.  This is used by make depend.
3817 case "$firstmakefile" in
3818 '') firstmakefile='makefile';;
3819 esac
3820
3821 case "$usesocks" in
3822 $define|true|[yY]*)     dflt='y';;
3823 *) dflt='n';;
3824 esac
3825 cat <<EOM
3826
3827 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3828 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3829 to use the PerlIO abstraction layer, this will be implicitly selected.
3830
3831 If this doesn't make any sense to you, just accept the default '$dflt'.
3832 EOM
3833 rp='Build Perl for SOCKS?'
3834 . ./myread
3835 case "$ans" in
3836 y|Y)    val="$define" ;;     
3837 *)      val="$undef" ;;
3838 esac
3839 set usesocks
3840 eval $setvar
3841
3842 case "$usesocks" in
3843 $define|true|[yY]*) useperlio="$define";;
3844 esac
3845
3846 : Looking for optional libraries
3847 echo " "
3848 echo "Checking for optional libraries..." >&4
3849 case "$libs" in
3850 ' '|'') dflt='';;
3851 *) dflt="$libs";;
3852 esac
3853 case "$libswanted" in
3854 '') libswanted='c_s';;
3855 esac
3856 case "$usesocks" in
3857 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3858 esac
3859 libsfound=''
3860 libsfiles=''
3861 libsdirs=''
3862 libspath=''
3863 for thisdir in $libpth $xlibpth; do
3864   test -d $thisdir && libspath="$libspath $thisdir"
3865 done
3866 for thislib in $libswanted; do
3867         for thisdir in $libspath; do
3868             xxx=''
3869             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3870                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3871                 $test -f "$xxx" && eval $libscheck
3872                 $test -f "$xxx" && libstyle=shared
3873             fi
3874             if test ! -f "$xxx"; then
3875                 xxx=$thisdir/lib$thislib.$so
3876                 $test -f "$xxx" && eval $libscheck
3877                 $test -f "$xxx" && libstyle=shared
3878             fi  
3879             if test ! -f "$xxx"; then
3880                 xxx=$thisdir/lib$thislib$_a
3881                 $test -f "$xxx" && eval $libscheck
3882                 $test -f "$xxx" && libstyle=static
3883             fi
3884             if test ! -f "$xxx"; then
3885                 xxx=$thisdir/$thislib$_a
3886                 $test -f "$xxx" && eval $libscheck
3887                 $test -f "$xxx" && libstyle=static
3888             fi
3889             if test ! -f "$xxx"; then
3890                 xxx=$thisdir/lib${thislib}_s$_a
3891                 $test -f "$xxx" && eval $libscheck
3892                 $test -f "$xxx" && libstyle=static
3893                 $test -f "$xxx" && thislib=${thislib}_s
3894             fi
3895             if test ! -f "$xxx"; then
3896                 xxx=$thisdir/Slib$thislib$_a
3897                 $test -f "$xxx" && eval $libscheck
3898                 $test -f "$xxx" && libstyle=static
3899             fi
3900             if $test -f "$xxx"; then
3901                 case "$libstyle" in
3902                 shared) echo "Found -l$thislib (shared)." ;;
3903                 static) echo "Found -l$thislib." ;;
3904                 *)      echo "Found -l$thislib ($libstyle)." ;;
3905                 esac
3906                 case " $dflt " in
3907                 *"-l$thislib "*);;
3908                 *) dflt="$dflt -l$thislib"
3909                    libsfound="$libsfound $xxx"
3910                    yyy=`basename $xxx`
3911                    libsfiles="$libsfiles $yyy"
3912                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3913                    case " $libsdirs " in
3914                    *" $yyy "*) ;;
3915                    *) libsdirs="$libsdirs $yyy" ;;
3916                    esac
3917                    ;;
3918                 esac
3919                 break
3920             fi  
3921         done
3922         if $test ! -f "$xxx"; then
3923             echo "No -l$thislib."
3924         fi
3925 done
3926 set X $dflt
3927 shift
3928 dflt="$*"
3929 case "$libs" in
3930 '') dflt="$dflt";;
3931 *) dflt="$libs";;
3932 esac
3933 case "$dflt" in
3934 ' '|'') dflt='none';;
3935 esac
3936
3937 $cat <<EOM
3938
3939 In order to compile $package on your machine, a number of libraries
3940 are usually needed.  Include any other special libraries here as well.
3941 Say "none" for none.  The default list is almost always right.
3942 EOM
3943
3944 echo " "
3945 rp="What libraries to use?"
3946 . ./myread
3947 case "$ans" in
3948 none) libs=' ';;
3949 *) libs="$ans";;
3950 esac
3951
3952 : determine optimization, if desired, or use for debug flag also
3953 case "$optimize" in
3954 ' '|$undef) dflt='none';;
3955 '') dflt='-O';;
3956 *) dflt="$optimize";;
3957 esac
3958 $cat <<EOH
3959
3960 By default, $package compiles with the -O flag to use the optimizer.
3961 Alternately, you might want to use the symbolic debugger, which uses
3962 the -g flag (on traditional Unix systems).  Either flag can be
3963 specified here.  To use neither flag, specify the word "none".
3964
3965 EOH
3966 rp="What optimizer/debugger flag should be used?"
3967 . ./myread
3968 optimize="$ans"
3969 case "$optimize" in
3970 'none') optimize=" ";;
3971 esac
3972
3973 dflt=''
3974 : We will not override a previous value, but we might want to
3975 : augment a hint file
3976 case "$hint" in
3977 default|recommended)
3978         case "$gccversion" in
3979         1*) dflt='-fpcc-struct-return' ;;
3980         esac
3981         case "$optimize" in
3982         *-g*) dflt="$dflt -DDEBUGGING";;
3983         esac
3984         case "$gccversion" in
3985         2*) if test -d /etc/conf/kconfig.d &&
3986                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3987                 then
3988                         dflt="$dflt -posix"
3989                 fi
3990                 ;;
3991         esac
3992         case "$gccversion" in
3993         1*) ;;
3994         2.[0-8]*) ;;
3995         ?*)     echo " "
3996                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3997                 echo 'int main(void) { return 0; }' > gcctest.c
3998                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3999                         echo "Yes, it does." 2>&1
4000                         case "$ccflags" in
4001                         *strict-aliasing*) 
4002                                 echo "Leaving current flags $ccflags alone." 2>&1
4003                                 ;;
4004                         *) dflt="$dflt -fno-strict-aliasing" ;;
4005                         esac
4006                 else
4007                         echo "Nope, it doesn't, but that's ok." 2>&1
4008                 fi
4009                 ;;
4010         esac
4011         ;;
4012 esac
4013
4014 case "$mips_type" in
4015 *BSD*|'') inclwanted="$locincpth $usrinc";;
4016 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4017 esac
4018 for thisincl in $inclwanted; do
4019         if $test -d $thisincl; then
4020                 if $test x$thisincl != x$usrinc; then
4021                         case "$dflt" in
4022                         *" -I$thisincl "*);;
4023                         *) dflt="$dflt -I$thisincl ";;
4024                         esac
4025                 fi
4026         fi
4027 done
4028
4029 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4030         xxx=true;
4031 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4032         xxx=true;
4033 else
4034         xxx=false;
4035 fi;
4036 if $xxx; then
4037         case "$dflt" in
4038         *$2*);;
4039         *) dflt="$dflt -D$2";;
4040         esac;
4041 fi'
4042
4043 set signal.h LANGUAGE_C; eval $inctest
4044
4045 case "$usesocks" in
4046 $define)
4047         ccflags="$ccflags -DSOCKS"
4048         ;;
4049 esac
4050
4051 case "$hint" in
4052 default|recommended) dflt="$ccflags $dflt" ;;
4053 *) dflt="$ccflags";;
4054 esac
4055
4056 case "$dflt" in
4057 ''|' ') dflt=none;;
4058 esac
4059
4060 $cat <<EOH
4061
4062 Your C compiler may want other flags.  For this question you should include
4063 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4064 but you should NOT include libraries or ld flags like -lwhatever.  If you
4065 want $package to honor its debug switch, you should include -DDEBUGGING here.
4066 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4067
4068 To use no flags, specify the word "none".
4069
4070 EOH
4071 set X $dflt
4072 shift
4073 dflt=${1+"$@"}
4074 rp="Any additional cc flags?"
4075 . ./myread
4076 case "$ans" in
4077 none) ccflags='';;
4078 *) ccflags="$ans";;
4079 esac
4080
4081 : the following weeds options from ccflags that are of no interest to cpp
4082 case "$cppflags" in
4083 '') cppflags="$ccflags" ;;
4084 *)  cppflags="$cppflags $ccflags" ;;
4085 esac
4086 case "$gccversion" in
4087 1*) cppflags="$cppflags -D__GNUC__"
4088 esac
4089 case "$mips_type" in
4090 '');;
4091 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4092 esac
4093 case "$cppflags" in
4094 '');;
4095 *)
4096         echo " "
4097         echo "Let me guess what the preprocessor flags are..." >&4
4098         set X $cppflags
4099         shift
4100         cppflags=''
4101         $cat >cpp.c <<'EOM'
4102 #define BLURFL foo
4103
4104 BLURFL xx LFRULB
4105 EOM
4106         previous=''
4107         for flag in $*
4108         do
4109                 case "$flag" in
4110                 -*) ftry="$flag";;
4111                 *) ftry="$previous $flag";;
4112                 esac
4113                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4114                         >cpp1.out 2>/dev/null && \
4115                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4116                         >cpp2.out 2>/dev/null && \
4117                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4118                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4119                 then
4120                         cppflags="$cppflags $ftry"
4121                         previous=''
4122                 else
4123                         previous="$flag"
4124                 fi
4125         done
4126         set X $cppflags
4127         shift
4128         cppflags=${1+"$@"}
4129         case "$cppflags" in
4130         *-*)  echo "They appear to be: $cppflags";;
4131         esac
4132         $rm -f cpp.c cpp?.out
4133         ;;
4134 esac
4135
4136 : flags used in final linking phase
4137 case "$ldflags" in
4138 '') if ./venix; then
4139                 dflt='-i -z'
4140         else
4141                 dflt=''
4142         fi
4143         case "$ccflags" in
4144         *-posix*) dflt="$dflt -posix" ;;
4145         esac
4146         ;;
4147 *) dflt="$ldflags";;
4148 esac
4149
4150 : Try to guess additional flags to pick up local libraries.
4151 for thislibdir in $libpth; do
4152         case " $loclibpth " in
4153         *" $thislibdir "*)
4154                 case "$dflt " in 
4155                 *"-L$thislibdir "*) ;;
4156                 *)  dflt="$dflt -L$thislibdir" ;;
4157                 esac
4158                 ;;
4159         esac
4160 done
4161
4162 case "$dflt" in
4163 '') dflt='none' ;;
4164 esac
4165
4166 $cat <<EOH
4167
4168 Your C linker may need flags.  For this question you should
4169 include -L/whatever and any other flags used by the C linker, but you
4170 should NOT include libraries like -lwhatever.
4171
4172 Make sure you include the appropriate -L/path flags if your C linker
4173 does not normally search all of the directories you specified above,
4174 namely
4175         $libpth
4176 To use no flags, specify the word "none".
4177
4178 EOH
4179
4180 rp="Any additional ld flags (NOT including libraries)?"
4181 . ./myread
4182 case "$ans" in
4183 none) ldflags='';;
4184 *) ldflags="$ans";;
4185 esac
4186 rmlist="$rmlist pdp11"
4187
4188 : coherency check
4189 echo " "
4190 echo "Checking your choice of C compiler and flags for coherency..." >&4
4191 $cat > try.c <<'EOF'
4192 #include <stdio.h>
4193 int main() { printf("Ok\n"); exit(0); }
4194 EOF
4195 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4196 shift
4197 $cat >try.msg <<'EOM'
4198 I've tried to compile and run the following simple program:
4199
4200 EOM
4201 $cat try.c >> try.msg
4202
4203 $cat >> try.msg <<EOM
4204
4205 I used the command:
4206
4207         $*
4208         ./try
4209
4210 and I got the following output:
4211
4212 EOM
4213 dflt=y
4214 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4215         if $sh -c './try' >>try.msg 2>&1; then
4216                 xxx=`./try`
4217                 case "$xxx" in
4218                 "Ok") dflt=n ;;
4219                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4220                         case " $libs " in
4221                         *" -lsfio "*)
4222                                 cat >> try.msg <<'EOQS'
4223 If $libs contains -lsfio, and sfio is mis-configured, then it
4224 sometimes (apparently) runs and exits with a 0 status, but with no
4225 output!  It may have to do with sfio's use of _exit vs. exit.
4226
4227 EOQS
4228                                 rp="You have a big problem.  Shall I abort Configure"
4229                                 dflt=y
4230                                 ;;
4231                         esac
4232                         ;;
4233                 esac
4234         else
4235                 echo "The program compiled OK, but exited with status $?." >>try.msg
4236                 rp="You have a problem.  Shall I abort Configure"
4237                 dflt=y
4238         fi
4239 else
4240         echo "I can't compile the test program." >>try.msg
4241         rp="You have a BIG problem.  Shall I abort Configure"
4242         dflt=y
4243 fi
4244 case "$dflt" in
4245 y)
4246         $cat try.msg >&4
4247         case "$knowitall" in
4248         '')
4249                 echo "(The supplied flags or libraries might be incorrect.)"
4250                 ;;
4251         *) dflt=n;;
4252         esac
4253         echo " "
4254         . ./myread
4255         case "$ans" in
4256         n*|N*) ;;
4257         *)      echo "Ok.  Stopping Configure." >&4
4258                 exit 1
4259                 ;;
4260         esac
4261         ;;
4262 n) echo "OK, that should do.";;
4263 esac
4264 $rm -f try try.* core
4265
4266 : define an is-a-typedef? function
4267 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4268 case "$inclist" in
4269 "") inclist="sys/types.h";;
4270 esac;
4271 eval "varval=\$$var";
4272 case "$varval" in
4273 "")
4274         $rm -f temp.c;
4275         for inc in $inclist; do
4276                 echo "#include <$inc>" >>temp.c;
4277         done;
4278         echo "#ifdef $type" >> temp.c;
4279         echo "printf(\"We have $type\");" >> temp.c;
4280         echo "#endif" >> temp.c;
4281         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4282         if $contains $type temp.E >/dev/null 2>&1; then
4283                 eval "$var=\$type";
4284         else
4285                 eval "$var=\$def";
4286         fi;
4287         $rm -f temp.?;;
4288 *) eval "$var=\$varval";;
4289 esac'
4290
4291 : define an is-a-typedef? function that prompts if the type is not available.
4292 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4293 case "$inclist" in
4294 "") inclist="sys/types.h";;
4295 esac;
4296 eval "varval=\$$var";
4297 case "$varval" in
4298 "")
4299         $rm -f temp.c;
4300         for inc in $inclist; do
4301                 echo "#include <$inc>" >>temp.c;
4302         done;
4303         echo "#ifdef $type" >> temp.c;
4304         echo "printf(\"We have $type\");" >> temp.c;
4305         echo "#endif" >> temp.c;
4306         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4307         echo " " ;
4308         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4309         if $contains $type temp.E >/dev/null 2>&1; then
4310                 echo "$type found." >&4;
4311                 eval "$var=\$type";
4312         else
4313                 echo "$type NOT found." >&4;
4314                 dflt="$def";
4315                 . ./myread ;
4316                 eval "$var=\$ans";
4317         fi;
4318         $rm -f temp.?;;
4319 *) eval "$var=\$varval";;
4320 esac'
4321
4322 : define a shorthand compile call
4323 compile='
4324 mc_file=$1;
4325 shift;
4326 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4327 : define a shorthand compile call for compilations that should be ok.
4328 compile_ok='
4329 mc_file=$1;
4330 shift;
4331 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4332
4333 : check for lengths of integral types
4334 echo " "
4335 case "$intsize" in
4336 '')
4337         echo "Checking to see how big your integers are..." >&4
4338         $cat >intsize.c <<'EOCP'
4339 #include <stdio.h>
4340 int main()
4341 {
4342         printf("intsize=%d;\n", (int)sizeof(int));
4343         printf("longsize=%d;\n", (int)sizeof(long));
4344         printf("shortsize=%d;\n", (int)sizeof(short));
4345         exit(0);
4346 }
4347 EOCP
4348         set intsize
4349         if eval $compile_ok && ./intsize > /dev/null; then
4350                 eval `./intsize`
4351                 echo "Your integers are $intsize bytes long."
4352                 echo "Your long integers are $longsize bytes long."
4353                 echo "Your short integers are $shortsize bytes long."
4354         else
4355                 $cat >&4 <<EOM
4356 !
4357 Help! I can't compile and run the intsize test program: please enlighten me!
4358 (This is probably a misconfiguration in your system or libraries, and
4359 you really ought to fix it.  Still, I'll try anyway.)
4360 !
4361 EOM
4362                 dflt=4
4363                 rp="What is the size of an integer (in bytes)?"
4364                 . ./myread
4365                 intsize="$ans"
4366                 dflt=$intsize
4367                 rp="What is the size of a long integer (in bytes)?"
4368                 . ./myread
4369                 longsize="$ans"
4370                 dflt=2
4371                 rp="What is the size of a short integer (in bytes)?"
4372                 . ./myread
4373                 shortsize="$ans"
4374         fi
4375         ;;
4376 esac
4377 $rm -f intsize intsize.*
4378
4379 : see what type lseek is declared as in the kernel
4380 rp="What is the type used for lseek's offset on this system?"
4381 set off_t lseektype long stdio.h sys/types.h
4382 eval $typedef_ask
4383
4384 echo " "
4385 echo "Checking to see how big your file offsets are..." >&4
4386 $cat >try.c <<EOCP
4387 #include <sys/types.h>
4388 #include <stdio.h>
4389 int main()
4390 {
4391     printf("%d\n", (int)sizeof($lseektype));
4392     return(0); 
4393 }
4394 EOCP
4395 set try
4396 if eval $compile_ok; then
4397         lseeksize=`./try`
4398         echo "Your file offsets are $lseeksize bytes long."
4399 else
4400         dflt=$longsize
4401         echo " "
4402         echo "(I can't seem to compile the test program.  Guessing...)"
4403         rp="What is the size of your file offsets (in bytes)?"
4404         . ./myread
4405         lseeksize="$ans"
4406 fi
4407 $rm -f try.c try
4408
4409 : see what type file positions are declared as in the library
4410 rp="What is the type for file position used by fsetpos()?"
4411 set fpos_t fpostype long stdio.h sys/types.h
4412 eval $typedef_ask
4413
4414 echo " "
4415 case "$fpostype" in
4416 *_t) zzz="$fpostype"    ;;
4417 *)   zzz="fpos_t"       ;;
4418 esac
4419 echo "Checking the size of $zzz..." >&4 
4420 cat > try.c <<EOCP
4421 #include <sys/types.h>
4422 #include <stdio.h>
4423 int main() {
4424     printf("%d\n", (int)sizeof($fpostype));
4425     exit(0);
4426 }
4427 EOCP
4428 set try
4429 if eval $compile_ok; then
4430         yyy=`./try`
4431         case "$yyy" in
4432         '')     fpossize=4
4433                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4434                 ;;
4435         *)      fpossize=$yyy
4436                 echo "Your $zzz is $fpossize bytes long."
4437                 ;;
4438         esac
4439 else
4440         dflt="$longsize"
4441         echo " " >&4
4442         echo "(I can't compile the test program.  Guessing...)" >&4
4443         rp="What is the size of your file positions (in bytes)?"
4444         . ./myread
4445         fpossize="$ans"
4446 fi
4447
4448
4449
4450 # Backward compatibility (uselfs is deprecated).
4451 case "$uselfs" in
4452 "$define"|true|[yY]*)
4453         cat <<EOM >&4
4454
4455 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4456 EOM
4457         uselargefiles="$define"
4458         ;;
4459 esac                          
4460
4461 case "$lseeksize:$fpossize" in
4462 8:8) cat <<EOM
4463
4464 You can have files larger than 2 gigabytes.
4465 EOM
4466    val="$define" ;;
4467 *)    case "$uselargefiles" in
4468    "$undef"|false|[nN]*) dflt='n' ;;
4469    *)   dflt='y' ;;
4470    esac
4471    cat <<EOM
4472
4473 Perl can be built to understand large files (files larger than 2 gigabytes)
4474 on some systems.  To do so, Configure can be run with -Duselargefiles.
4475
4476 If this doesn't make any sense to you, just accept the default '$dflt'.
4477 EOM
4478    rp='Try to understand large files, if available?'
4479    . ./myread
4480    case "$ans" in
4481    y|Y)         val="$define" ;;
4482    *)           val="$undef"  ;;
4483    esac
4484    ;;
4485 esac
4486 set uselargefiles
4487 eval $setvar
4488 case "$uselargefiles" in
4489 "$define")
4490 : Look for a hint-file generated 'call-back-unit'.  If the
4491 : user has specified that a large files perl is to be built,
4492 : we may need to set or change some other defaults.
4493         if $test -f uselargefiles.cbu; then
4494                 echo "Your platform has some specific hints for large file builds, using them..."
4495                 . ./uselargefiles.cbu
4496                 echo " "
4497                 echo "Rechecking to see how big your file offsets are..." >&4
4498                 $cat >try.c <<EOCP
4499 #include <sys/types.h>
4500 #include <stdio.h>
4501 int main()
4502 {
4503     printf("%d\n", (int)sizeof($lseektype));
4504     return(0); 
4505 }
4506 EOCP
4507                 set try
4508                 if eval $compile_ok; then
4509                         lseeksize=`./try`
4510                         $echo "Your file offsets are now $lseeksize bytes long."
4511                 else
4512                         dflt="$lseeksize"
4513                         echo " "
4514                         echo "(I can't seem to compile the test program.  Guessing...)"
4515                         rp="What is the size of your file offsets (in bytes)?"
4516                         . ./myread
4517                         lseeksize="$ans"
4518                 fi
4519                 case "$fpostype" in
4520                 *_t) zzz="$fpostype"    ;;
4521                 *)   zzz="fpos_t"       ;;
4522                 esac
4523                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4524                 $cat > try.c <<EOCP
4525 #include <sys/types.h>
4526 #include <stdio.h>
4527 int main() {
4528     printf("%d\n", (int)sizeof($fpostype));
4529     exit(0);
4530 }
4531 EOCP
4532                 set try
4533                 if eval $compile_ok; then
4534                         yyy=`./try`
4535                         dflt="$lseeksize"
4536                         case "$yyy" in
4537                         '')     echo " "
4538                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4539                                 ;;
4540                         *)      fpossize=$yyy
4541                                 echo " $fpossize bytes." >&4
4542                                 ;;
4543                         esac
4544                 else
4545                         dflt="$fpossize"
4546                         echo " "
4547                         echo "(I can't compile the test program.  Guessing...)" >&4
4548                         rp="What is the size of your file positions (in bytes)?"
4549                         . ./myread
4550                         fpossize="$ans"
4551                 fi
4552                 $rm -f try.c try
4553         fi
4554         ;;
4555 esac
4556
4557
4558 case "$usemorebits" in
4559 "$define"|true|[yY]*)
4560         use64bitint="$define"
4561         uselongdouble="$define"
4562         usemorebits="$define"
4563         ;;
4564 *)      usemorebits="$undef"
4565         ;;
4566 esac
4567
4568 : check for void type
4569 echo " "
4570 echo "Checking to see how well your C compiler groks the void type..." >&4
4571 case "$voidflags" in
4572 '')
4573         $cat >try.c <<'EOCP'
4574 #if TRY & 1
4575 void sub() {
4576 #else
4577 sub() {
4578 #endif
4579         extern void moo();      /* function returning void */
4580         void (*goo)();          /* ptr to func returning void */
4581 #if TRY & 8
4582         void *hue;              /* generic ptr */
4583 #endif
4584 #if TRY & 2
4585         void (*foo[10])();
4586 #endif
4587
4588 #if TRY & 4
4589         if(goo == moo) {
4590                 exit(0);
4591         }
4592 #endif
4593         exit(0);
4594 }
4595 int main() { sub(); }
4596 EOCP
4597         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4598                 voidflags=$defvoidused
4599         echo "Good.  It appears to support void to the level $package wants.">&4
4600                 if $contains warning .out >/dev/null 2>&1; then
4601                         echo "However, you might get some warnings that look like this:"
4602                         $cat .out
4603                 fi
4604         else
4605 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4606                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4607                         echo "It supports 1..."
4608                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4609                                 echo "It also supports 2..."
4610                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4611                                         voidflags=7
4612                                         echo "And it supports 4 but not 8 definitely."
4613                                 else
4614                                         echo "It doesn't support 4..."
4615                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4616                                                 voidflags=11
4617                                                 echo "But it supports 8."
4618                                         else
4619                                                 voidflags=3
4620                                                 echo "Neither does it support 8."
4621                                         fi
4622                                 fi
4623                         else
4624                                 echo "It does not support 2..."
4625                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4626                                         voidflags=13
4627                                         echo "But it supports 4 and 8."
4628                                 else
4629                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4630                                                 voidflags=5
4631                                                 echo "And it supports 4 but has not heard about 8."
4632                                         else
4633                                                 echo "However it supports 8 but not 4."
4634                                         fi
4635                                 fi
4636                         fi
4637                 else
4638                         echo "There is no support at all for void."
4639                         voidflags=0
4640                 fi
4641         fi
4642 esac
4643 case "$voidflags" in
4644 "$defvoidused") ;;
4645 *)      $cat >&4 <<'EOM'
4646   Support flag bits are:
4647     1: basic void declarations.
4648     2: arrays of pointers to functions returning void.
4649     4: operations between pointers to and addresses of void functions.
4650     8: generic void pointers.
4651 EOM
4652         dflt="$voidflags";
4653         rp="Your void support flags add up to what?"
4654         . ./myread
4655         voidflags="$ans"
4656         ;;
4657 esac
4658 $rm -f try.* .out
4659
4660 : check for length of pointer
4661 echo " "
4662 case "$ptrsize" in
4663 '')
4664         echo "Checking to see how big your pointers are..." >&4
4665         if test "$voidflags" -gt 7; then
4666                 echo '#define VOID_PTR char *' > try.c
4667         else
4668                 echo '#define VOID_PTR void *' > try.c
4669         fi
4670         $cat >>try.c <<'EOCP'
4671 #include <stdio.h>
4672 int main()
4673 {
4674     printf("%d\n", (int)sizeof(VOID_PTR));
4675     exit(0);
4676 }
4677 EOCP
4678         set try
4679         if eval $compile_ok; then
4680                 ptrsize=`./try`
4681                 echo "Your pointers are $ptrsize bytes long."
4682         else
4683                 dflt='4'
4684                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4685                 rp="What is the size of a pointer (in bytes)?"
4686                 . ./myread
4687                 ptrsize="$ans"
4688         fi
4689         ;;
4690 esac
4691 $rm -f try.c try
4692
4693 : check for long long
4694 echo " "
4695 echo "Checking to see if you have long long..." >&4
4696 echo 'int main() { long long x = 7; return 0; }' > try.c
4697 set try
4698 if eval $compile; then
4699         val="$define"
4700         echo "You have long long."
4701 else
4702         val="$undef"
4703         echo "You do not have long long."
4704 fi
4705 $rm try.*
4706 set d_longlong
4707 eval $setvar
4708
4709 : check for length of long long
4710 case "${d_longlong}${longlongsize}" in
4711 $define)
4712         echo " "
4713         echo "Checking to see how big your long longs are..." >&4
4714         $cat >try.c <<'EOCP'
4715 #include <stdio.h>
4716 int main()
4717 {
4718     printf("%d\n", (int)sizeof(long long));
4719     return(0);
4720 }
4721 EOCP
4722         set try
4723         if eval $compile_ok; then
4724                 longlongsize=`./try$exe_ext`
4725                 echo "Your long longs are $longlongsize bytes long."
4726         else
4727                 dflt='8'
4728                 echo " "
4729                 echo "(I can't seem to compile the test program.  Guessing...)"
4730                 rp="What is the size of a long long (in bytes)?"
4731                 . ./myread
4732                 longlongsize="$ans"
4733         fi
4734         if $test "X$longsize" = "X$longlongsize"; then
4735                 echo "(That isn't any different from an ordinary long.)"
4736         fi      
4737         ;;
4738 esac
4739 $rm -f try.* try
4740
4741 : determine filename position in cpp output
4742 echo " "
4743 echo "Computing filename position in cpp output for #include directives..." >&4
4744 echo '#include <stdio.h>' > foo.c
4745 $cat >fieldn <<EOF
4746 $startsh
4747 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4748 $grep '^[       ]*#.*stdio\.h' | \
4749 while read cline; do
4750         pos=1
4751         set \$cline
4752         while $test \$# -gt 0; do
4753                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4754                         echo "\$pos"
4755                         exit 0
4756                 fi
4757                 shift
4758                 pos=\`expr \$pos + 1\`
4759         done
4760 done
4761 EOF
4762 chmod +x fieldn
4763 fieldn=`./fieldn`
4764 $rm -f foo.c fieldn
4765 case $fieldn in
4766 '') pos='???';;
4767 1) pos=first;;
4768 2) pos=second;;
4769 3) pos=third;;
4770 *) pos="${fieldn}th";;
4771 esac
4772 echo "Your cpp writes the filename in the $pos field of the line."
4773
4774 : locate header file
4775 $cat >findhdr <<EOF
4776 $startsh
4777 wanted=\$1
4778 name=''
4779 for usrincdir in $usrinc
4780 do
4781         if test -f \$usrincdir/\$wanted; then
4782                 echo "\$usrincdir/\$wanted"
4783                 exit 0
4784         fi
4785 done
4786 awkprg='{ print \$$fieldn }'
4787 echo "#include <\$wanted>" > foo\$\$.c
4788 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4789 $grep "^[       ]*#.*\$wanted" | \
4790 while read cline; do
4791         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4792         case "\$name" in
4793         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4794         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4795         *) exit 2;;
4796         esac;
4797 done;
4798 #
4799 # status = 0: grep returned 0 lines, case statement not executed
4800 # status = 1: headerfile found
4801 # status = 2: while loop executed, no headerfile found
4802 #
4803 status=\$?
4804 $rm -f foo\$\$.c;
4805 if test \$status -eq 1; then
4806         exit 0;
4807 fi
4808 exit 1
4809 EOF
4810 chmod +x findhdr
4811
4812 : define an alternate in-header-list? function
4813 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4814 cont=true; xxf="echo \"<\$1> found.\" >&4";
4815 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4816 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4817 esac;
4818 case $# in 4) instead=instead;; *) instead="at last";; esac;
4819 while $test "$cont"; do
4820         xxx=`./findhdr $1`
4821         var=$2; eval "was=\$$2";
4822         if $test "$xxx" && $test -r "$xxx";
4823         then eval $xxf;
4824         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4825                 cont="";
4826         else eval $xxnf;
4827         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4828         set $yyy; shift; shift; yyy=$@;
4829         case $# in 0) cont="";;
4830         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4831                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4832         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4833                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4834         esac;
4835 done;
4836 while $test "$yyy";
4837 do set $yyy; var=$2; eval "was=\$$2";
4838         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4839         set $yyy; shift; shift; yyy=$@;
4840 done'
4841
4842 : see if inttypes.h is available
4843 : we want a real compile instead of Inhdr because some systems
4844 : have an inttypes.h which includes non-existent headers
4845 echo " "
4846 $cat >try.c <<EOCP
4847 #include <inttypes.h>
4848 int main() {
4849         static int32_t foo32 = 0x12345678;
4850 }
4851 EOCP
4852 set try
4853 if eval $compile; then
4854         echo "<inttypes.h> found." >&4
4855         val="$define"
4856 else
4857         echo "<inttypes.h> NOT found." >&4
4858         val="$undef"
4859 fi
4860 $rm -f try.c try
4861 set i_inttypes
4862 eval $setvar
4863
4864 : check for int64_t
4865 echo " "
4866 echo "Checking to see if you have int64_t..." >&4
4867 $cat >try.c <<EOCP
4868 #include <sys/types.h>
4869 #$i_inttypes I_INTTYPES
4870 #ifdef I_INTTYPES
4871 #include <inttypes.h>
4872 #endif
4873 int main() { int64_t x = 7; }
4874 EOCP
4875 set try
4876 if eval $compile; then
4877         val="$define"
4878         echo "You have int64_t."
4879 else
4880         val="$undef"
4881         echo "You do not have int64_t."
4882 fi
4883 $rm -f try try.*
4884 set d_int64_t
4885 eval $setvar
4886
4887
4888 echo " "
4889 echo "Checking which 64-bit integer type we could use..." >&4
4890
4891 case "$intsize" in
4892 8) val=int
4893    set quadtype
4894    eval $setvar
4895    val='"unsigned int"'
4896    set uquadtype
4897    eval $setvar
4898    quadkind=1
4899    ;;
4900 *) case "$longsize" in
4901    8) val=long
4902       set quadtype
4903       eval $setvar
4904       val='"unsigned long"'
4905       set uquadtype
4906       eval $setvar
4907       quadkind=2
4908       ;;
4909    *) case "$d_longlong:$longlongsize" in
4910       define:8)
4911         val='"long long"'
4912         set quadtype
4913         eval $setvar
4914         val='"unsigned long long"'
4915         set uquadtype
4916         eval $setvar
4917         quadkind=3
4918         ;;
4919       *) case "$d_int64_t" in
4920          define)
4921            val=int64_t
4922            set quadtype
4923            eval $setvar
4924            val=uint64_t
4925            set uquadtype
4926            eval $setvar
4927            quadkind=4
4928            ;;
4929          esac
4930          ;;
4931       esac
4932       ;;
4933    esac
4934    ;;
4935 esac
4936
4937 case "$quadtype" in
4938 '')     echo "Alas, no 64-bit integer types in sight." >&4
4939         d_quad="$undef"
4940         ;;
4941 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4942         d_quad="$define"
4943         ;;
4944 esac
4945
4946
4947 case "$uselonglong" in
4948 "$define"|true|[yY]*)
4949         cat <<EOM >&4
4950
4951 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4952 EOM
4953         use64bitint="$define"
4954         ;;
4955 esac                          
4956 case "$use64bits" in
4957 "$define"|true|[yY]*)
4958         cat <<EOM >&4
4959
4960 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4961 EOM
4962         use64bitint="$define"
4963         ;;
4964 esac                          
4965 case "$use64bitints" in
4966 "$define"|true|[yY]*)
4967         cat <<EOM >&4
4968
4969 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4970 EOM
4971         use64bitint="$define"
4972         ;;
4973 esac                          
4974 case "$use64bitsint" in
4975 "$define"|true|[yY]*)
4976         cat <<EOM >&4
4977
4978 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4979 EOM
4980         use64bitint="$define"
4981         ;;
4982 esac                          
4983 case "$uselonglongs" in
4984 "$define"|true|[yY]*)
4985         cat <<EOM >&4
4986
4987 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4988 EOM
4989         use64bitint="$define"
4990         ;;
4991 esac                          
4992 case "$use64bitsall" in
4993 "$define"|true|[yY]*)
4994         cat <<EOM >&4
4995
4996 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4997 EOM
4998         use64bitall="$define"
4999         ;;
5000 esac                          
5001
5002 case "$ccflags" in
5003 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5004 esac
5005 case "$use64bitall" in
5006 "$define"|true|[yY]*) use64bitint="$define" ;;
5007 esac
5008
5009 case "$longsize" in
5010 8) cat <<EOM
5011
5012 You have natively 64-bit long integers.
5013 EOM
5014    val="$define"
5015    ;;
5016 *) case "$use64bitint" in
5017    "$define"|true|[yY]*) dflt='y';;
5018    *) dflt='n';;
5019    esac
5020    case "$d_quad" in
5021    "$define") ;;
5022    *) dflt='n' ;;
5023    esac
5024    cat <<EOM
5025
5026 Perl can be built to take advantage of 64-bit integer types
5027 on some systems.  To do so, Configure can be run with -Duse64bitint.
5028 Choosing this option will most probably introduce binary incompatibilities.
5029
5030 If this doesn't make any sense to you, just accept the default '$dflt'.
5031 (The default has been chosen based on your configuration.)
5032 EOM
5033    rp='Try to use 64-bit integers, if available?'
5034    . ./myread
5035    case "$ans" in
5036    [yY]*) val="$define" ;;
5037    *)     val="$undef"  ;;
5038    esac
5039    ;;
5040 esac
5041 set use64bitint
5042 eval $setvar
5043
5044 case "$use64bitall" in
5045 "$define"|true|[yY]*) dflt='y' ;;
5046 *) case "$longsize" in
5047    8) dflt='y' ;;
5048    *) dflt='n' ;;
5049    esac
5050    ;;
5051 esac    
5052 cat <<EOM
5053
5054 You may also choose to try maximal 64-bitness.  It means using as much
5055 64-bitness as possible on the platform.  This in turn means even more
5056 binary incompatibilities.  On the other hand, your platform may not
5057 have any more 64-bitness available than what you already have chosen.
5058
5059 If this doesn't make any sense to you, just accept the default '$dflt'.
5060 (The default has been chosen based on your configuration.)
5061 EOM
5062 rp='Try to use maximal 64-bit support, if available?'
5063 . ./myread
5064 case "$ans" in
5065 [yY]*) val="$define" ;;
5066 *)     val="$undef"  ;;
5067 esac
5068 set use64bitall
5069 eval $setvar
5070 case "$use64bitall" in
5071 "$define")
5072         case "$use64bitint" in
5073         "$undef")
5074                 cat <<EOM
5075
5076 Since you have chosen a maximally 64-bit build, I'm also turning on
5077 the use of 64-bit integers.
5078 EOM
5079                 use64bitint="$define" ;;
5080         esac
5081         ;;
5082 esac
5083
5084 case "$use64bitall" in
5085 "$define"|true|[yY]*)
5086         case "$ptrsize" in
5087         4)      cat <<EOM >&4
5088
5089 *** You have chosen a maximally 64-bit build, but your pointers
5090 *** are only 4 bytes wide, disabling maximal 64-bitness.
5091
5092 EOM
5093                 use64bitall="$undef"
5094                 case "$use64bitint" in
5095                 "$define"|true|[yY]*) ;;
5096                 *)      cat <<EOM >&4
5097
5098 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5099
5100 EOM
5101                         use64bitint="$define"
5102                         ;;
5103                 esac
5104                 ;;
5105         esac
5106         ;;
5107 esac
5108
5109 case "$use64bitint" in
5110 "$define"|true|[yY]*)
5111 : Look for a hint-file generated 'call-back-unit'.  If the
5112 : user has specified that a 64-bit perl is to be built,
5113 : we may need to set or change some other defaults.
5114         if $test -f use64bitint.cbu; then
5115                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5116                 . ./use64bitint.cbu
5117         fi
5118         case "$longsize" in
5119         4) case "$archname64" in
5120            '') archname64=64int ;;
5121            esac
5122            ;;
5123         esac
5124         ;;
5125 esac
5126
5127 case "$use64bitall" in
5128 "$define"|true|[yY]*)
5129 : Look for a hint-file generated 'call-back-unit'.  If the
5130 : user has specified that a maximally 64-bit perl is to be built,
5131 : we may need to set or change some other defaults.
5132         if $test -f use64bitall.cbu; then
5133                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5134                 . ./use64bitall.cbu
5135         fi
5136         case "$longsize" in
5137         4) case "$archname64" in
5138            ''|64int) archname64=64all ;;
5139            esac
5140            ;;
5141         esac
5142         ;;
5143 esac
5144
5145 echo " "
5146 echo "Checking for GNU C Library..." >&4
5147 cat >gnulibc.c <<EOM
5148 #include <stdio.h>
5149 int main()
5150 {
5151 #ifdef __GLIBC__
5152     exit(0);
5153 #else
5154     exit(1);
5155 #endif
5156 }
5157 EOM
5158 set gnulibc
5159 if eval $compile_ok && ./gnulibc; then
5160         val="$define"
5161         echo "You are using the GNU C Library"
5162 else
5163         val="$undef"
5164         echo "You are not using the GNU C Library"
5165 fi
5166 $rm -f gnulibc*
5167 set d_gnulibc
5168 eval $setvar
5169
5170 : see if nm is to be used to determine whether a symbol is defined or not
5171 case "$usenm" in
5172 '')
5173         dflt=''
5174         case "$d_gnulibc" in
5175         "$define")
5176                 echo " "
5177                 echo "nm probably won't work on the GNU C Library." >&4
5178                 dflt=n
5179                 ;;
5180         esac
5181         case "$dflt" in
5182         '') 
5183                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5184                         echo " "
5185                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5186                         echo "'nm' won't be sufficient on this sytem." >&4
5187                         dflt=n
5188                 fi
5189                 ;;
5190         esac
5191         case "$dflt" in
5192         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5193                 if $test $dflt -gt 20; then
5194                         dflt=y
5195                 else
5196                         dflt=n
5197                 fi
5198                 ;;
5199         esac
5200         ;;
5201 *)
5202         case "$usenm" in
5203         true|$define) dflt=y;;
5204         *) dflt=n;;
5205         esac
5206         ;;
5207 esac
5208 $cat <<EOM
5209
5210 I can use $nm to extract the symbols from your C libraries. This
5211 is a time consuming task which may generate huge output on the disk (up
5212 to 3 megabytes) but that should make the symbols extraction faster. The
5213 alternative is to skip the 'nm' extraction part and to compile a small
5214 test program instead to determine whether each symbol is present. If
5215 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5216 this may be the best solution.
5217
5218 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5219
5220 EOM
5221 rp="Shall I use $nm to extract C symbols from the libraries?"
5222 . ./myread
5223 case "$ans" in
5224 [Nn]*) usenm=false;;
5225 *) usenm=true;;
5226 esac
5227
5228 runnm=$usenm
5229 case "$reuseval" in
5230 true) runnm=false;;
5231 esac
5232
5233 : nm options which may be necessary
5234 case "$nm_opt" in
5235 '') if $test -f /mach_boot; then
5236                 nm_opt=''       # Mach
5237         elif $test -d /usr/ccs/lib; then
5238                 nm_opt='-p'     # Solaris (and SunOS?)
5239         elif $test -f /dgux; then
5240                 nm_opt='-p'     # DG-UX
5241         elif $test -f /lib64/rld; then
5242                 nm_opt='-p'     # 64-bit Irix
5243         else
5244                 nm_opt=''
5245         fi;;
5246 esac
5247
5248 : nm options which may be necessary for shared libraries but illegal
5249 : for archive libraries.  Thank you, Linux.
5250 case "$nm_so_opt" in
5251 '')     case "$myuname" in
5252         *linux*)
5253                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5254                         nm_so_opt='--dynamic'
5255                 fi
5256                 ;;
5257         esac
5258         ;;
5259 esac
5260
5261 case "$runnm" in
5262 true)
5263 : get list of predefined functions in a handy place
5264 echo " "
5265 case "$libc" in
5266 '') libc=unknown
5267         case "$libs" in
5268         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5269         esac
5270         ;;
5271 esac
5272 libnames='';
5273 case "$libs" in
5274 '') ;;
5275 *)  for thislib in $libs; do
5276         case "$thislib" in
5277         -lc|-lc_s)
5278                 : Handle C library specially below.
5279                 ;;
5280         -l*)
5281                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5282                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5283                         :
5284                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5285                         :
5286                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5287                         :
5288                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5289                         :
5290                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5291                         :
5292                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5293                         :
5294                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5295                         :
5296                 else
5297                         try=''
5298                 fi
5299                 libnames="$libnames $try"
5300                 ;;
5301         *) libnames="$libnames $thislib" ;;
5302         esac
5303         done
5304         ;;
5305 esac
5306 xxx=normal
5307 case "$libc" in
5308 unknown)
5309         set /lib/libc.$so
5310         for xxx in $libpth; do
5311                 $test -r $1 || set $xxx/libc.$so
5312                 : The messy sed command sorts on library version numbers.
5313                 $test -r $1 || \
5314                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5315                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5316                                 h
5317                                 s/[0-9][0-9]*/0000&/g
5318                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5319                                 G
5320                                 s/\n/ /' | \
5321                          $sort | $sed -e 's/^.* //'`
5322                 eval set \$$#
5323         done
5324         $test -r $1 || set /usr/ccs/lib/libc.$so
5325         $test -r $1 || set /lib/libsys_s$_a
5326         ;;
5327 *)
5328         set blurfl
5329         ;;
5330 esac
5331 if $test -r "$1"; then
5332         echo "Your (shared) C library seems to be in $1."
5333         libc="$1"
5334 elif $test -r /lib/libc && $test -r /lib/clib; then
5335         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5336         xxx=apollo
5337         libc='/lib/clib /lib/libc'
5338         if $test -r /lib/syslib; then
5339                 echo "(Your math library is in /lib/syslib.)"
5340                 libc="$libc /lib/syslib"
5341         fi
5342 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5343         echo "Your C library seems to be in $libc, as you said before."
5344 elif $test -r $incpath/usr/lib/libc$_a; then
5345         libc=$incpath/usr/lib/libc$_a;
5346         echo "Your C library seems to be in $libc.  That's fine."
5347 elif $test -r /lib/libc$_a; then
5348         libc=/lib/libc$_a;
5349         echo "Your C library seems to be in $libc.  You're normal."
5350 else
5351         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5352                 :
5353         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5354                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5355         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5356                 :
5357         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5358                 :
5359         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5360                 :
5361         else
5362                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5363         fi
5364         if $test -r "$tans"; then
5365                 echo "Your C library seems to be in $tans, of all places."
5366                 libc=$tans
5367         else
5368                 libc='blurfl'
5369         fi
5370 fi
5371 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5372         dflt="$libc"
5373         cat <<EOM
5374
5375 If the guess above is wrong (which it might be if you're using a strange
5376 compiler, or your machine supports multiple models), you can override it here.
5377
5378 EOM
5379 else
5380         dflt=''
5381         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5382         cat >&4 <<EOM
5383 I can't seem to find your C library.  I've looked in the following places:
5384
5385 EOM
5386         $sed 's/^/      /' libpath
5387         cat <<EOM
5388
5389 None of these seems to contain your C library. I need to get its name...
5390
5391 EOM
5392 fi
5393 fn=f
5394 rp='Where is your C library?'
5395 . ./getfile
5396 libc="$ans"
5397
5398 echo " "
5399 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5400 set X `cat libnames`
5401 shift
5402 xxx=files
5403 case $# in 1) xxx=file; esac
5404 echo "Extracting names from the following $xxx for later perusal:" >&4
5405 echo " "
5406 $sed 's/^/      /' libnames >&4
5407 echo " "
5408 $echo $n "This may take a while...$c" >&4
5409
5410 for file in $*; do
5411         case $file in
5412         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5413         *) $nm $nm_opt $file 2>/dev/null;;
5414         esac
5415 done >libc.tmp
5416
5417 $echo $n ".$c"
5418 $grep fprintf libc.tmp > libc.ptf
5419 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5420 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5421 xxx='[ADTSIW]'
5422 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5423         eval $xscan;\
5424         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5425                 eval $xrun
5426 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5427         eval $xscan;\
5428         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5429                 eval $xrun
5430 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5431         eval $xscan;\
5432         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5433                 eval $xrun
5434 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5435         eval $xscan;\
5436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5437                 eval $xrun
5438 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5439         eval $xscan;\
5440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5441                 eval $xrun
5442 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5443         eval $xscan;\
5444         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5445                 eval $xrun
5446 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5447                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5448         eval $xscan;\
5449         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5450                 eval $xrun
5451 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5452         eval $xscan;\
5453         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5454                 eval $xrun
5455 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5456         eval $xscan;\
5457         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5458                 eval $xrun
5459 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5460         eval $xscan;\
5461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5462                 eval $xrun
5463 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5464         eval $xscan;\
5465         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5466                 eval $xrun
5467 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5468         eval $xscan;\
5469         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5470                 eval $xrun
5471 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5472         eval $xscan;\
5473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5474                 eval $xrun
5475 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5476         eval $xscan;\
5477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5478                 eval $xrun
5479 else
5480         $nm -p $* 2>/dev/null >libc.tmp
5481         $grep fprintf libc.tmp > libc.ptf
5482         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5483                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5484         then
5485                 nm_opt='-p'
5486                 eval $xrun
5487         else
5488                 echo " "
5489                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5490                 com=''
5491                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5492                         for thisname in $libnames $libc; do
5493                                 $ar t $thisname >>libc.tmp
5494                         done
5495                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5496                         echo "Ok." >&4
5497                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5498                         # Repeat libc to extract forwarders to DLL entries too
5499                         for thisname in $libnames $libc; do
5500                                 $ar tv $thisname >>libc.tmp
5501                                 # Revision 50 of EMX has bug in $ar.
5502                                 # it will not extract forwarders to DLL entries
5503                                 # Use emximp which will extract exactly them.
5504                                 emximp -o tmp.imp $thisname \
5505                                     2>/dev/null && \
5506                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5507                                     < tmp.imp >>libc.tmp
5508                                 $rm tmp.imp
5509                         done
5510                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5511                         echo "Ok." >&4
5512                 else
5513                         echo "$ar didn't seem to work right." >&4
5514                         echo "Maybe this is a Cray...trying bld instead..." >&4
5515                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5516                         then
5517                                 for thisname in $libnames; do
5518                                         bld t $libnames | \
5519                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5520                                         $ar t $thisname >>libc.tmp
5521                                 done
5522                                 echo "Ok." >&4
5523                         else
5524                                 echo "That didn't work either.  Giving up." >&4
5525                                 exit 1
5526                         fi
5527                 fi
5528         fi
5529 fi
5530 nm_extract="$com"
5531 if $test -f /lib/syscalls.exp; then
5532         echo " "
5533         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5534         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5535 fi
5536 ;;
5537 esac
5538 $rm -f libnames libpath
5539
5540 : is a C symbol defined?
5541 csym='tlook=$1;
5542 case "$3" in
5543 -v) tf=libc.tmp; tc=""; tdc="";;
5544 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5545 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5546 esac;
5547 tx=yes;
5548 case "$reuseval-$4" in
5549 true-) ;;
5550 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5551 esac;
5552 case "$tx" in
5553 yes)
5554         case "$runnm" in
5555         true)
5556                 if $contains $tlook $tf >/dev/null 2>&1;
5557                 then tval=true;
5558                 else tval=false;
5559                 fi;;
5560         *)
5561                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5562                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5563                 then tval=true;
5564                 else tval=false;
5565                 fi;
5566                 $rm -f t t.c;;
5567         esac;;
5568 *)
5569         case "$tval" in
5570         $define) tval=true;;
5571         *) tval=false;;
5572         esac;;
5573 esac;
5574 eval "$2=$tval"'
5575
5576 : define an is-in-libc? function
5577 inlibc='echo " "; td=$define; tu=$undef;
5578 sym=$1; var=$2; eval "was=\$$2";
5579 tx=yes;
5580 case "$reuseval$was" in
5581 true) ;;
5582 true*) tx=no;;
5583 esac;
5584 case "$tx" in
5585 yes)
5586         set $sym tres -f;
5587         eval $csym;
5588         case "$tres" in
5589         true)
5590                 echo "$sym() found." >&4;
5591                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5592         *)
5593                 echo "$sym() NOT found." >&4;
5594                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5595         esac;;
5596 *)
5597         case "$was" in
5598         $define) echo "$sym() found." >&4;;
5599         *) echo "$sym() NOT found." >&4;;
5600         esac;;
5601 esac'
5602
5603 : see if sqrtl exists
5604 set sqrtl d_sqrtl
5605 eval $inlibc
5606
5607 case "$ccflags" in
5608 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5609 esac
5610
5611 case "$uselongdouble" in
5612 $define|true|[yY]*)     dflt='y';;
5613 *) dflt='n';;
5614 esac
5615 cat <<EOM
5616
5617 Perl can be built to take advantage of long doubles which
5618 (if available) may give more accuracy and range for floating point numbers.
5619
5620 If this doesn't make any sense to you, just accept the default '$dflt'.
5621 EOM
5622 rp='Try to use long doubles if available?'
5623 . ./myread
5624 case "$ans" in
5625 y|Y)    val="$define"   ;;
5626 *)      val="$undef"    ;;
5627 esac
5628 set uselongdouble
5629 eval $setvar
5630
5631 case "$uselongdouble" in
5632 true|[yY]*) uselongdouble="$define" ;;
5633 esac
5634
5635 case "$uselongdouble" in
5636 $define)
5637 : Look for a hint-file generated 'call-back-unit'.  If the
5638 : user has specified that long doubles should be used,
5639 : we may need to set or change some other defaults.
5640         if $test -f uselongdouble.cbu; then
5641                 echo "Your platform has some specific hints for long doubles, using them..."
5642                 . ./uselongdouble.cbu
5643         else
5644                 $cat <<EOM
5645 (Your platform doesn't have any specific hints for long doubles.)
5646 EOM
5647         fi
5648         ;;
5649 esac
5650
5651 case "$uselongdouble:$d_sqrtl" in
5652 $define:$undef)
5653                 $cat <<EOM >&4
5654
5655 *** You requested the use of long doubles but you do not seem to have
5656 *** the mathematic functions for long doubles.  I'm disabling the use
5657 *** of long doubles.
5658
5659 EOM
5660         uselongdouble=$undef
5661         ;;
5662 esac
5663
5664 : check for length of double
5665 echo " "
5666 case "$doublesize" in
5667 '')
5668         echo "Checking to see how big your double precision numbers are..." >&4
5669         $cat >try.c <<'EOCP'
5670 #include <stdio.h>
5671 int main()
5672 {
5673     printf("%d\n", (int)sizeof(double));
5674     exit(0);
5675 }
5676 EOCP
5677         set try
5678         if eval $compile_ok; then
5679                 doublesize=`./try`
5680                 echo "Your double is $doublesize bytes long."
5681         else
5682                 dflt='8'
5683                 echo "(I can't seem to compile the test program.  Guessing...)"
5684                 rp="What is the size of a double precision number (in bytes)?"
5685                 . ./myread
5686                 doublesize="$ans"
5687         fi
5688         ;;
5689 esac
5690 $rm -f try.c try
5691
5692 : check for long doubles
5693 echo " "
5694 echo "Checking to see if you have long double..." >&4
5695 echo 'int main() { long double x = 7.0; }' > try.c
5696 set try
5697 if eval $compile; then
5698         val="$define"
5699         echo "You have long double."
5700 else
5701         val="$undef"
5702         echo "You do not have long double."
5703 fi
5704 $rm try.*
5705 set d_longdbl
5706 eval $setvar
5707
5708 : check for length of long double
5709 case "${d_longdbl}${longdblsize}" in
5710 $define)
5711         echo " "
5712         echo "Checking to see how big your long doubles are..." >&4
5713         $cat >try.c <<'EOCP'
5714 #include <stdio.h>
5715 int main()
5716 {
5717         printf("%d\n", sizeof(long double));
5718 }
5719 EOCP
5720         set try
5721         set try
5722         if eval $compile; then
5723                 longdblsize=`./try$exe_ext`
5724                 echo "Your long doubles are $longdblsize bytes long."
5725         else
5726                 dflt='8'
5727                 echo " "
5728                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5729                 rp="What is the size of a long double (in bytes)?"
5730                 . ./myread
5731                 longdblsize="$ans"
5732         fi
5733         if $test "X$doublesize" = "X$longdblsize"; then
5734                 echo "(That isn't any different from an ordinary double.)"
5735         fi      
5736         ;;
5737 esac
5738 $rm -f try.* try
5739
5740 case "$useperlio" in
5741 $define|true|[yY]*|'')  dflt='y';;
5742 *) dflt='n';;
5743 esac
5744 cat <<EOM
5745
5746 Previous version of $package used the standard IO mechanisms as
5747 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5748 alternate IO mechanisms via the PerlIO abstraction layer, but the
5749 stdio mechanism is still available if needed.  The abstraction layer
5750 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5751 Using PerlIO with sfio may cause problems with some extension modules.
5752
5753 If this doesn't make any sense to you, just accept the default '$dflt'.
5754 EOM
5755 rp='Use the PerlIO abstraction layer?'
5756 . ./myread
5757 case "$ans" in
5758 y|Y) 
5759         val="$define"
5760         ;;
5761 *)      
5762         echo "Ok, doing things the stdio way."
5763         val="$undef"
5764         ;;
5765 esac
5766 set useperlio
5767 eval $setvar 
5768
5769 case "$usesocks" in
5770 $define|true|[yY]*)
5771         case "$useperlio" in
5772         $define|true|[yY]*) ;;
5773         *)      cat >&4 <<EOM
5774
5775 You are using the SOCKS proxy protocol library which means that you
5776 should also use the PerlIO layer.  You may be headed for trouble.
5777
5778 EOM
5779                 ;;
5780         esac
5781         ;;
5782 esac
5783
5784         
5785 : determine the architecture name
5786 echo " "
5787 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5788         tarch=`arch`"-$osname"
5789 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5790         if uname -m > tmparch 2>&1 ; then
5791                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5792                         -e 's/$/'"-$osname/" tmparch`
5793         else
5794                 tarch="$osname"
5795         fi
5796         $rm -f tmparch
5797 else
5798         tarch="$osname"
5799 fi
5800 case "$myarchname" in
5801 ''|"$tarch") ;;
5802 *)
5803         echo "(Your architecture name used to be $myarchname.)"
5804         archname=''
5805         ;;
5806 esac
5807 myarchname="$tarch"
5808 case "$archname" in
5809 '') dflt="$tarch";;
5810 *) dflt="$archname";;
5811 esac
5812 rp='What is your architecture name'
5813 . ./myread
5814 archname="$ans"
5815 case "$usethreads" in
5816 $define)
5817         echo "Threads selected." >&4
5818         case "$archname" in
5819         *-thread*) echo "...and architecture name already has -thread." >&4
5820                 ;;
5821         *)      archname="$archname-thread"
5822                 echo "...setting architecture name to $archname." >&4
5823                 ;;
5824         esac
5825         ;;
5826 esac
5827 case "$usemultiplicity" in
5828 $define)
5829         echo "Multiplicity selected." >&4
5830         case "$archname" in
5831         *-multi*) echo "...and architecture name already has -multi." >&4
5832                 ;;
5833         *)      archname="$archname-multi"
5834                 echo "...setting architecture name to $archname." >&4
5835                 ;;
5836         esac
5837         ;;
5838 esac
5839 case "$use64bitint$use64bitall" in
5840 *"$define"*)
5841         case "$archname64" in
5842         '')
5843                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5844                 ;;
5845         *)
5846                 case "$use64bitint" in
5847                 "$define") echo "64 bit integers selected." >&4 ;;
5848                 esac
5849                 case "$use64bitall" in
5850                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5851                 esac
5852                 case "$archname" in
5853                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5854                         ;;
5855                 *)      archname="$archname-$archname64"
5856                         echo "...setting architecture name to $archname." >&4
5857                         ;;
5858                 esac
5859                 ;;
5860         esac
5861 esac
5862 case "$uselongdouble" in
5863 $define)
5864         echo "Long doubles selected." >&4
5865         case "$longdblsize" in
5866         $doublesize)
5867                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5868                 ;;
5869         *)
5870                 case "$archname" in
5871                 *-ld*) echo "...and architecture name already has -ld." >&4
5872                         ;;
5873                 *)      archname="$archname-ld"
5874                         echo "...setting architecture name to $archname." >&4
5875                         ;;
5876                 esac
5877                 ;;
5878         esac
5879         ;;
5880 esac
5881 case "$useperlio" in
5882 $define)
5883         echo "Perlio selected." >&4
5884         ;;
5885 *)
5886         echo "Perlio not selected, using stdio." >&4
5887         case "$archname" in
5888         *-stdio*) echo "...and architecture name already has -stdio." >&4
5889                 ;;
5890         *)      archname="$archname-stdio"
5891                 echo "...setting architecture name to $archname." >&4
5892                 ;;
5893         esac
5894         ;;
5895 esac
5896
5897 : determine root of directory hierarchy where package will be installed.
5898 case "$prefix" in
5899 '')
5900         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5901         ;;
5902 *)
5903         dflt="$prefix"
5904         ;;
5905 esac
5906 $cat <<EOM
5907
5908 By default, $package will be installed in $dflt/bin, manual pages
5909 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5910 installation directories. Typically this is something like /usr/local.
5911 If you wish to have binaries under /usr/bin but other parts of the
5912 installation under /usr/local, that's ok: you will be prompted
5913 separately for each of the installation directories, the prefix being
5914 only used to set the defaults.
5915
5916 EOM
5917 fn=d~
5918 rp='Installation prefix to use?'
5919 . ./getfile
5920 oldprefix=''
5921 case "$prefix" in
5922 '') ;;
5923 *)
5924         case "$ans" in
5925         "$prefix") ;;
5926         *) oldprefix="$prefix";;
5927         esac
5928         ;;
5929 esac
5930 prefix="$ans"
5931 prefixexp="$ansexp"
5932
5933 case "$afsroot" in
5934 '')     afsroot=/afs ;;
5935 *)      afsroot=$afsroot ;;
5936 esac
5937
5938 : is AFS running?
5939 echo " "
5940 case "$afs" in
5941 $define|true)   afs=true ;;
5942 $undef|false)   afs=false ;;
5943 *)      if test -d $afsroot; then
5944                 afs=true
5945         else
5946                 afs=false
5947         fi
5948         ;;
5949 esac
5950 if $afs; then
5951         echo "AFS may be running... I'll be extra cautious then..." >&4
5952 else
5953         echo "AFS does not seem to be running..." >&4
5954 fi
5955
5956 : determine installation prefix for where package is to be installed.
5957 if $afs; then 
5958 $cat <<EOM
5959
5960 Since you are running AFS, I need to distinguish the directory in which
5961 files will reside from the directory in which they are installed (and from
5962 which they are presumably copied to the former directory by occult means).
5963
5964 EOM
5965         case "$installprefix" in
5966         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5967         *) dflt="$installprefix";;
5968         esac
5969 else
5970 $cat <<EOM
5971
5972 In some special cases, particularly when building $package for distribution,
5973 it is convenient to distinguish between the directory in which files should 
5974 be installed from the directory ($prefix) in which they 
5975 will eventually reside.  For most users, these two directories are the same.
5976
5977 EOM
5978         case "$installprefix" in
5979         '') dflt=$prefix ;;
5980         *) dflt=$installprefix;;
5981         esac
5982 fi
5983 fn=d~
5984 rp='What installation prefix should I use for installing files?'
5985 . ./getfile
5986 installprefix="$ans"
5987 installprefixexp="$ansexp"
5988
5989 : set the prefixit variable, to compute a suitable default value
5990 prefixit='case "$3" in
5991 ""|none)
5992         case "$oldprefix" in
5993         "") eval "$1=\"\$$2\"";;
5994         *)
5995                 case "$3" in
5996                 "") eval "$1=";;
5997                 none)
5998                         eval "tp=\"\$$2\"";
5999                         case "$tp" in
6000                         ""|" ") eval "$1=\"\$$2\"";;
6001                         *) eval "$1=";;
6002                         esac;;
6003                 esac;;
6004         esac;;
6005 *)
6006         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6007         case "$tp" in
6008         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6009         /*-$oldprefix/*|\~*-$oldprefix/*)
6010                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6011         *) eval "$1=\"\$$2\"";;
6012         esac;;
6013 esac'
6014
6015
6016 : get the patchlevel
6017 echo " "
6018 echo "Getting the current patchlevel..." >&4
6019 if $test -r $rsrc/patchlevel.h;then
6020         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6021         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6022         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6023         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6024         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6025         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6026        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6027 else
6028         revision=0
6029         patchlevel=0
6030         subversion=0
6031         api_revision=0
6032         api_version=0
6033         api_subversion=0
6034         perl_patchlevel=0
6035         $echo "(You do not have patchlevel.h.  Eek.)"
6036 fi
6037 if $test -r $rsrc/.patch ; then  
6038         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6039                 perl_patchlevel=`cat $rsrc/.patch`
6040         fi
6041 fi
6042 case "$perl_patchlevel" in
6043 0)  ;;
6044 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6045 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6046 esac
6047 case "$osname" in
6048 dos|vms)
6049         : XXX Should be a Configure test for double-dots in filenames.
6050         version=`echo $revision $patchlevel $subversion | \
6051                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6052         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6053                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6054         ;;
6055 *)
6056         version=`echo $revision $patchlevel $subversion | \
6057                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6058         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6059                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6060         ;;
6061 esac
6062 : Special case the 5.005_xx maintenance series, which used 5.005
6063 : without any subversion label as a subdirectory in $sitelib
6064 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6065         api_versionstring='5.005'
6066 fi
6067
6068 : determine installation style
6069 : For now, try to deduce it from prefix unless it is already set.
6070 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6071 case "$installstyle" in
6072 '')     case "$prefix" in
6073                 *perl*) dflt='lib';;
6074                 *) dflt='lib/perl5' ;;
6075         esac
6076         ;;
6077 *)      dflt="$installstyle" ;;
6078 esac
6079 : Probably not worth prompting for this since we prompt for all
6080 : the directories individually, and the prompt would be too long and
6081 : confusing anyway.
6082 installstyle=$dflt
6083
6084 : determine where private library files go
6085 : Usual default is /usr/local/lib/perl5/$version.
6086 : Also allow things like /opt/perl/lib/$version, since 
6087 : /opt/perl/lib/perl5... would be redundant.
6088 : The default "style" setting is made in installstyle.U
6089 case "$installstyle" in
6090 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6091 *)       set dflt privlib lib/$version ;;
6092 esac
6093 eval $prefixit
6094 $cat <<EOM
6095
6096 There are some auxiliary files for $package that need to be put into a
6097 private library directory that is accessible by everyone.
6098
6099 EOM
6100 fn=d~+
6101 rp='Pathname where the private library files will reside?'
6102 . ./getfile
6103 privlib="$ans"
6104 privlibexp="$ansexp"
6105 : Change installation prefix, if necessary.
6106 if $test X"$prefix" != X"$installprefix"; then
6107         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6108 else
6109         installprivlib="$privlibexp"
6110 fi
6111
6112 : set the prefixup variable, to restore leading tilda escape
6113 prefixup='case "$prefixexp" in
6114 "$prefix") ;;
6115 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6116 esac'
6117
6118 : determine where public architecture dependent libraries go
6119 set archlib archlib
6120 eval $prefixit
6121 : privlib default is /usr/local/lib/$package/$version
6122 : archlib default is /usr/local/lib/$package/$version/$archname
6123 : privlib may have an optional trailing /share.
6124 tdflt=`echo $privlib | $sed 's,/share$,,'`
6125 tdflt=$tdflt/$archname
6126 case "$archlib" in
6127 '')     dflt=$tdflt
6128         ;;
6129 *)      dflt="$archlib"
6130     ;;
6131 esac
6132 $cat <<EOM
6133
6134 $spackage contains architecture-dependent library files.  If you are
6135 sharing libraries in a heterogeneous environment, you might store
6136 these files in a separate location.  Otherwise, you can just include
6137 them with the rest of the public library files.
6138
6139 EOM
6140 fn=d+~
6141 rp='Where do you want to put the public architecture-dependent libraries?'
6142 . ./getfile
6143 archlib="$ans"
6144 archlibexp="$ansexp"
6145 if $test X"$archlib" = X"$privlib"; then
6146         d_archlib="$undef"
6147 else
6148         d_archlib="$define"
6149 fi
6150 : Change installation prefix, if necessary.
6151 if $test X"$prefix" != X"$installprefix"; then
6152         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6153 else
6154         installarchlib="$archlibexp"
6155 fi
6156
6157
6158 : Binary compatibility with 5.005 is not possible for builds
6159 : with advanced features
6160 case "$usethreads$usemultiplicity" in
6161 *define*)
6162         bincompat5005="$undef"
6163         d_bincompat5005="$undef"
6164         ;;
6165 *)      $cat <<EOM
6166
6167 This version of Perl can be compiled for binary compatibility with 5.005.
6168 If you decide to do so, you will be able to continue using most of the
6169 extensions that were compiled for Perl 5.005.
6170
6171 EOM
6172         case "$bincompat5005$d_bincompat5005" in
6173         *"$undef"*) dflt=n ;;
6174         *) dflt=y ;;
6175         esac
6176         rp='Binary compatibility with Perl 5.005?'
6177         . ./myread
6178         case "$ans" in
6179         y*) val="$define" ;;
6180         *)  val="$undef" ;;
6181         esac
6182         set d_bincompat5005
6183         eval $setvar
6184         case "$d_bincompat5005" in
6185         "$define")
6186                 bincompat5005="$define"
6187                 ;;
6188         *)      bincompat5005="$undef"
6189                 d_bincompat5005="$undef"
6190                 ;;
6191         esac
6192         ;;
6193 esac
6194
6195
6196 : see if setuid scripts can be secure
6197 $cat <<EOM
6198
6199 Some kernels have a bug that prevents setuid #! scripts from being
6200 secure.  Some sites have disabled setuid #! scripts because of this.
6201
6202 First let's decide if your kernel supports secure setuid #! scripts.
6203 (If setuid #! scripts would be secure but have been disabled anyway,
6204 don't say that they are secure if asked.)
6205
6206 EOM
6207
6208 val="$undef"
6209 if $test -d /dev/fd; then
6210         echo "#!$ls" >reflect
6211         chmod +x,u+s reflect
6212         ./reflect >flect 2>&1
6213         if $contains "/dev/fd" flect >/dev/null; then
6214                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6215                 val="$define"
6216         else
6217                 $cat <<EOM
6218 If you are not sure if they are secure, I can check but I'll need a
6219 username and password different from the one you are using right now.
6220 If you don't have such a username or don't want me to test, simply
6221 enter 'none'.
6222
6223 EOM
6224                 rp='Other username to test security of setuid scripts with?'
6225                 dflt='none'
6226                 . ./myread
6227                 case "$ans" in
6228                 n|none)
6229                         case "$d_suidsafe" in
6230                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6231                                 dflt=n;;
6232                         "$undef")
6233                                 echo "Well, the $hint value is *not* secure." >&4
6234                                 dflt=n;;
6235                         *)      echo "Well, the $hint value *is* secure." >&4
6236                                 dflt=y;;
6237                         esac
6238                         ;;
6239                 *)
6240                         $rm -f reflect flect
6241                         echo "#!$ls" >reflect
6242                         chmod +x,u+s reflect
6243                         echo >flect
6244                         chmod a+w flect
6245                         echo '"su" will (probably) prompt you for '"$ans's password."
6246                         su $ans -c './reflect >flect'
6247                         if $contains "/dev/fd" flect >/dev/null; then
6248                                 echo "Okay, it looks like setuid scripts are secure." >&4
6249                                 dflt=y
6250                         else
6251                                 echo "I don't think setuid scripts are secure." >&4
6252                                 dflt=n
6253                         fi
6254                         ;;
6255                 esac
6256                 rp='Does your kernel have *secure* setuid scripts?'
6257                 . ./myread
6258                 case "$ans" in
6259                 [yY]*)  val="$define";;
6260                 *)      val="$undef";;
6261                 esac
6262         fi
6263 else
6264         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6265         echo "(That's for file descriptors, not floppy disks.)"
6266         val="$undef"
6267 fi
6268 set d_suidsafe
6269 eval $setvar
6270
6271 $rm -f reflect flect
6272
6273 : now see if they want to do setuid emulation
6274 echo " "
6275 val="$undef"
6276 case "$d_suidsafe" in
6277 "$define")
6278         val="$undef"
6279         echo "No need to emulate SUID scripts since they are secure here." >& 4
6280         ;;
6281 *)
6282         $cat <<EOM
6283 Some systems have disabled setuid scripts, especially systems where
6284 setuid scripts cannot be secure.  On systems where setuid scripts have
6285 been disabled, the setuid/setgid bits on scripts are currently
6286 useless.  It is possible for $package to detect those bits and emulate
6287 setuid/setgid in a secure fashion.  This emulation will only work if
6288 setuid scripts have been disabled in your kernel.
6289
6290 EOM
6291         case "$d_dosuid" in
6292         "$define") dflt=y ;;
6293         *) dflt=n ;;
6294         esac
6295         rp="Do you want to do setuid/setgid emulation?"
6296         . ./myread
6297         case "$ans" in
6298         [yY]*)  val="$define";;
6299         *)      val="$undef";;
6300         esac
6301         ;;
6302 esac
6303 set d_dosuid
6304 eval $setvar
6305
6306 : see if this is a malloc.h system
6307 set malloc.h i_malloc
6308 eval $inhdr
6309
6310 : see if stdlib is available
6311 set stdlib.h i_stdlib
6312 eval $inhdr
6313
6314 : determine which malloc to compile in
6315 echo " "
6316 case "$usemymalloc" in
6317 [yY]*|true|$define)     dflt='y' ;;
6318 [nN]*|false|$undef)     dflt='n' ;;
6319 *)      case "$ptrsize" in
6320         4) dflt='y' ;;
6321         *) dflt='n' ;;
6322         esac
6323         ;;
6324 esac
6325 rp="Do you wish to attempt to use the malloc that comes with $package?"
6326 . ./myread
6327 usemymalloc="$ans"
6328 case "$ans" in
6329 y*|true)
6330         usemymalloc='y'
6331         mallocsrc='malloc.c'
6332         mallocobj="malloc$_o"
6333         d_mymalloc="$define"
6334         case "$libs" in
6335         *-lmalloc*)
6336                 : Remove malloc from list of libraries to use
6337                 echo "Removing unneeded -lmalloc from library list" >&4
6338                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6339                 shift
6340                 libs="$*"
6341                 echo "libs = $libs" >&4
6342                 ;;
6343         esac
6344         ;;
6345 *)
6346         usemymalloc='n'
6347         mallocsrc=''
6348         mallocobj=''
6349         d_mymalloc="$undef"
6350         ;;
6351 esac
6352
6353 : compute the return types of malloc and free
6354 echo " "
6355 $cat >malloc.c <<END
6356 #$i_malloc I_MALLOC
6357 #$i_stdlib I_STDLIB
6358 #include <stdio.h>
6359 #include <sys/types.h>
6360 #ifdef I_MALLOC
6361 #include <malloc.h>
6362 #endif
6363 #ifdef I_STDLIB
6364 #include <stdlib.h>
6365 #endif
6366 #ifdef TRY_MALLOC
6367 void *malloc();
6368 #endif
6369 #ifdef TRY_FREE
6370 void free();
6371 #endif
6372 END
6373 case "$malloctype" in
6374 '')
6375         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6376                 malloctype='void *'
6377         else
6378                 malloctype='char *'
6379         fi
6380         ;;
6381 esac
6382 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6383
6384 case "$freetype" in
6385 '')
6386         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6387                 freetype='void'
6388         else
6389                 freetype='int'
6390         fi
6391         ;;
6392 esac
6393 echo "Your system uses $freetype free(), it would seem." >&4
6394 $rm -f malloc.[co]
6395 $cat <<EOM
6396
6397 After $package is installed, you may wish to install various
6398 add-on modules and utilities.  Typically, these add-ons will
6399 be installed under $prefix with the rest
6400 of this package.  However, you may wish to install such add-ons
6401 elsewhere under a different prefix.
6402
6403 If you do not wish to put everything under a single prefix, that's
6404 ok.  You will be prompted for the individual locations; this siteprefix
6405 is only used to suggest the defaults.
6406
6407 The default should be fine for most people.
6408
6409 EOM
6410 fn=d~+
6411 rp='Installation prefix to use for add-on modules and utilities?'
6412 : XXX Here might be another good place for an installstyle setting.
6413 case "$siteprefix" in
6414 '') dflt=$prefix ;;
6415 *)  dflt=$siteprefix ;;
6416 esac
6417 . ./getfile
6418 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6419 oldsiteprefix=''
6420 case "$siteprefix" in
6421 '') ;;
6422 *)      case "$ans" in
6423         "$prefix") ;;
6424         *) oldsiteprefix="$prefix";;
6425         esac
6426         ;;
6427 esac
6428 siteprefix="$ans"
6429 siteprefixexp="$ansexp"
6430
6431 : determine where site specific libraries go.
6432 : Usual default is /usr/local/lib/perl5/site_perl/$version
6433 : The default "style" setting is made in installstyle.U
6434 : XXX No longer works with Prefixit stuff.
6435 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6436 case "$sitelib" in
6437 '') case "$installstyle" in
6438         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6439         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6440         esac
6441         ;;
6442 *)      dflt="$sitelib"
6443         ;;
6444 esac
6445 $cat <<EOM
6446
6447 The installation process will create a directory for
6448 site-specific extensions and modules.  Most users find it convenient
6449 to place all site-specific files in this directory rather than in the
6450 main distribution directory.
6451
6452 EOM
6453 fn=d~+
6454 rp='Pathname for the site-specific library files?'
6455 . ./getfile
6456 sitelib="$ans"
6457 sitelibexp="$ansexp"
6458 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6459 : Change installation prefix, if necessary.
6460 if $test X"$prefix" != X"$installprefix"; then
6461         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6462 else
6463         installsitelib="$sitelibexp"
6464 fi
6465
6466 : determine where site specific architecture-dependent libraries go.
6467 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6468 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6469 : sitelib may have an optional trailing /share.
6470 case "$sitearch" in
6471 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6472         dflt="$dflt/$archname"
6473         ;;
6474 *)      dflt="$sitearch"
6475         ;;
6476 esac
6477 set sitearch sitearch none
6478 eval $prefixit
6479 $cat <<EOM
6480
6481 The installation process will also create a directory for
6482 architecture-dependent site-specific extensions and modules.
6483
6484 EOM
6485 fn=d~+
6486 rp='Pathname for the site-specific architecture-dependent library files?'
6487 . ./getfile
6488 sitearch="$ans"
6489 sitearchexp="$ansexp"
6490 : Change installation prefix, if necessary.
6491 if $test X"$prefix" != X"$installprefix"; then
6492         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6493 else
6494         installsitearch="$sitearchexp"
6495 fi
6496
6497 $cat <<EOM
6498
6499 The installation process will also create a directory for
6500 vendor-supplied add-ons.  Vendors who supply perl with their system
6501 may find it convenient to place all vendor-supplied files in this
6502 directory rather than in the main distribution directory.  This will
6503 ease upgrades between binary-compatible maintenance versions of perl.
6504
6505 Of course you may also use these directories in whatever way you see
6506 fit.  For example, you might use them to access modules shared over a
6507 company-wide network.
6508
6509 The default answer should be fine for most people.
6510 This causes further questions about vendor add-ons to be skipped
6511 and no vendor-specific directories will be configured for perl.
6512
6513 EOM
6514 rp='Do you want to configure vendor-specific add-on directories?'
6515 case "$usevendorprefix" in
6516 define|true|[yY]*) dflt=y ;;
6517 *)      : User may have set vendorprefix directly on Configure command line.
6518         case "$vendorprefix" in
6519         ''|' ') dflt=n ;;
6520         *)      dflt=y ;;
6521         esac
6522         ;;
6523 esac
6524 . ./myread
6525 case "$ans" in
6526 [yY]*)  fn=d~+
6527         rp='Installation prefix to use for vendor-supplied add-ons?'
6528         case "$vendorprefix" in
6529         '') dflt='' ;;
6530         *)  dflt=$vendorprefix ;;
6531         esac
6532         . ./getfile
6533         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6534         oldvendorprefix=''
6535         case "$vendorprefix" in
6536         '') ;;
6537         *)      case "$ans" in
6538                 "$prefix") ;;
6539                 *) oldvendorprefix="$prefix";;
6540                 esac
6541                 ;;
6542         esac
6543         usevendorprefix="$define"
6544         vendorprefix="$ans"
6545         vendorprefixexp="$ansexp"
6546         ;;
6547 *)      usevendorprefix="$undef"
6548         vendorprefix=''
6549         vendorprefixexp=''
6550         ;;
6551 esac
6552
6553 case "$vendorprefix" in
6554 '')     d_vendorlib="$undef"
6555         vendorlib=''
6556         vendorlibexp=''
6557         ;;
6558 *)      d_vendorlib="$define"
6559         : determine where vendor-supplied modules go.
6560         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6561         case "$vendorlib" in
6562         '')
6563                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6564                 case "$installstyle" in
6565                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6566                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6567                 esac
6568                 ;;
6569         *)      dflt="$vendorlib"
6570                 ;;
6571         esac
6572         fn=d~+
6573         rp='Pathname for the vendor-supplied library files?'
6574         . ./getfile
6575         vendorlib="$ans"
6576         vendorlibexp="$ansexp"
6577         ;;
6578 esac
6579 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6580 : Change installation prefix, if necessary.
6581 if $test X"$prefix" != X"$installprefix"; then
6582         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6583 else
6584         installvendorlib="$vendorlibexp"
6585 fi
6586
6587 case "$vendorprefix" in
6588 '')     d_vendorarch="$undef"
6589         vendorarch=''
6590         vendorarchexp=''
6591         ;;
6592 *)      d_vendorarch="$define"
6593         : determine where vendor-supplied architecture-dependent libraries go.
6594         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6595         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6596         : vendorlib may have an optional trailing /share.
6597         case "$vendorarch" in
6598         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6599                 dflt="$dflt/$archname"
6600                 ;;
6601         *)      dflt="$vendorarch" ;;
6602         esac
6603         fn=d~+
6604         rp='Pathname for vendor-supplied architecture-dependent files?'
6605         . ./getfile
6606         vendorarch="$ans"
6607         vendorarchexp="$ansexp"
6608         ;;
6609 esac
6610 : Change installation prefix, if necessary.
6611 if $test X"$prefix" != X"$installprefix"; then
6612         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6613 else
6614         installvendorarch="$vendorarchexp"
6615 fi
6616
6617 : Final catch-all directories to search
6618 $cat <<EOM
6619
6620 Lastly, you can have perl look in other directories for extensions and
6621 modules in addition to those already specified.
6622 These directories will be searched after 
6623         $sitearch 
6624         $sitelib 
6625 EOM
6626 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6627 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6628 echo ' '
6629 case "$otherlibdirs" in
6630 ''|' ') dflt='none' ;;
6631 *)      dflt="$otherlibdirs" ;;
6632 esac
6633 $cat <<EOM
6634 Enter a colon-separated set of extra paths to include in perl's @INC
6635 search path, or enter 'none' for no extra paths.
6636
6637 EOM
6638
6639 rp='Colon-separated list of additional directories for perl to search?'
6640 . ./myread
6641 case "$ans" in
6642 ' '|''|none)    otherlibdirs=' ' ;;     
6643 *)      otherlibdirs="$ans" ;;
6644 esac
6645 case "$otherlibdirs" in
6646 ' ') val=$undef ;;
6647 *)      val=$define ;;
6648 esac
6649 set d_perl_otherlibdirs
6650 eval $setvar
6651
6652 : Cruising for prototypes
6653 echo " "
6654 echo "Checking out function prototypes..." >&4
6655 $cat >prototype.c <<'EOCP'
6656 int main(int argc, char *argv[]) {
6657         exit(0);}
6658 EOCP
6659 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6660         echo "Your C compiler appears to support function prototypes."
6661         val="$define"
6662 else
6663         echo "Your C compiler doesn't seem to understand function prototypes."
6664         val="$undef"
6665 fi
6666 set prototype
6667 eval $setvar
6668 $rm -f prototype*
6669
6670 case "$prototype" in
6671 "$define") ;;
6672 *)      ansi2knr='ansi2knr'
6673         echo " "
6674         cat <<EOM >&4
6675
6676 $me:  FATAL ERROR:
6677 This version of $package can only be compiled by a compiler that 
6678 understands function prototypes.  Unfortunately, your C compiler 
6679         $cc $ccflags
6680 doesn't seem to understand them.  Sorry about that.
6681
6682 If GNU cc is available for your system, perhaps you could try that instead.  
6683
6684 Eventually, we hope to support building Perl with pre-ANSI compilers.
6685 If you would like to help in that effort, please contact <perlbug@perl.org>.
6686
6687 Aborting Configure now.
6688 EOM
6689         exit 2
6690         ;;
6691 esac
6692
6693 : determine where public executables go
6694 echo " "
6695 set dflt bin bin
6696 eval $prefixit
6697 fn=d~
6698 rp='Pathname where the public executables will reside?'
6699 . ./getfile
6700 if $test "X$ansexp" != "X$binexp"; then
6701         installbin=''
6702 fi
6703 bin="$ans"
6704 binexp="$ansexp"
6705 : Change installation prefix, if necessary.
6706 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6707 if $test X"$prefix" != X"$installprefix"; then
6708         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6709 else
6710         installbin="$binexp"
6711 fi
6712
6713 : Find perl5.005 or later.
6714 echo "Looking for a previously installed perl5.005 or later... "
6715 case "$perl5" in
6716 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6717                 : Check if this perl is recent and can load a simple module
6718                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6719                         perl5=$tdir/perl
6720                         break;
6721                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6722                         perl5=$tdir/perl5
6723                         break;
6724                 fi
6725         done
6726         ;;
6727 *)      perl5="$perl5"
6728         ;;
6729 esac
6730 case "$perl5" in
6731 '')     echo "None found.  That's ok.";;
6732 *)      echo "Using $perl5." ;;
6733 esac
6734
6735 : Determine list of previous versions to include in @INC
6736 $cat > getverlist <<EOPL
6737 #!$perl5 -w
6738 use File::Basename;
6739 \$api_versionstring = "$api_versionstring";
6740 \$version = "$version";
6741 \$stem = "$sitelib_stem";
6742 \$archname = "$archname";
6743 EOPL
6744         $cat >> getverlist <<'EOPL'
6745 # Can't have leading @ because metaconfig interprets it as a command!
6746 ;@inc_version_list=();
6747 # XXX Redo to do opendir/readdir? 
6748 if (-d $stem) {
6749     chdir($stem);
6750     ;@candidates = glob("5.*");
6751 }
6752 else {
6753     ;@candidates = ();
6754 }
6755
6756 # XXX ToDo:  These comparisons must be reworked when two-digit
6757 # subversions come along, so that 5.7.10 compares as greater than
6758 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6759 # widespread that we can use the built-in version vectors rather
6760 # than reinventing them here.  For 5.6.0, however, we must
6761 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6762 foreach $d (@candidates) {
6763     if ($d lt $version) {
6764         if ($d ge $api_versionstring) {
6765             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6766         }
6767         elsif ($d ge "5.005") {
6768             unshift(@inc_version_list, grep { -d } $d);
6769         }
6770     }
6771     else {
6772         # Skip newer version.  I.e. don't look in
6773         # 5.7.0 if we're installing 5.6.1.
6774     }
6775 }
6776
6777 if (@inc_version_list) {
6778     print join(' ', @inc_version_list);
6779 }
6780 else {
6781     # Blank space to preserve value for next Configure run.
6782     print " ";
6783 }
6784 EOPL
6785 chmod +x getverlist
6786 case "$inc_version_list" in
6787 '')     if test -x "$perl5$exe_ext"; then
6788                 dflt=`$perl5 getverlist`
6789         else
6790                 dflt='none'
6791         fi
6792         ;;
6793 $undef) dflt='none' ;;
6794 *)  eval dflt=\"$inc_version_list\" ;;
6795 esac
6796 case "$dflt" in
6797 ''|' ') dflt=none ;;
6798 esac
6799 case "$dflt" in
6800 5.005) case "$bincompat5005" in
6801        $define|true|[yY]*) ;;
6802        *) dflt=none ;;
6803        esac
6804        ;;
6805 esac
6806 $cat <<'EOM'
6807
6808 In order to ease the process of upgrading, this version of perl 
6809 can be configured to use modules built and installed with earlier 
6810 versions of perl that were installed under $prefix.  Specify here
6811 the list of earlier versions that this version of perl should check.
6812 If Configure detected no earlier versions of perl installed under
6813 $prefix, then the list will be empty.  Answer 'none' to tell perl
6814 to not search earlier versions.
6815
6816 The default should almost always be sensible, so if you're not sure,
6817 just accept the default.
6818 EOM
6819
6820 rp='List of earlier versions to include in @INC?'
6821 . ./myread
6822 case "$ans" in
6823 [Nn]one|''|' ') inc_version_list=' ' ;;
6824 *) inc_version_list="$ans" ;;
6825 esac
6826 case "$inc_version_list" in
6827 ''|' ') 
6828         inc_version_list_init='0';;
6829 *)      inc_version_list_init=`echo $inc_version_list |
6830                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6831         ;;
6832 esac
6833 $rm -f getverlist
6834
6835 : determine whether to install perl also as /usr/bin/perl
6836
6837 echo " "
6838 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6839         $cat <<EOM
6840 Many scripts expect perl to be installed as /usr/bin/perl.
6841 I can install the perl you are about to compile also as /usr/bin/perl
6842 (in addition to $installbin/perl).
6843 EOM
6844         case "$installusrbinperl" in
6845         "$undef"|[nN]*) dflt='n';;
6846         *)              dflt='y';;
6847         esac
6848         rp="Do you want to install perl as /usr/bin/perl?"
6849         . ./myread
6850         case "$ans" in
6851         [yY]*)  val="$define";;
6852         *)      val="$undef" ;;
6853         esac
6854 else
6855         val="$undef"
6856 fi
6857 set installusrbinperl
6858 eval $setvar
6859
6860 : see if dld is available
6861 set dld.h i_dld
6862 eval $inhdr
6863
6864 : see if dlopen exists
6865 xxx_runnm="$runnm"
6866 runnm=false
6867 set dlopen d_dlopen
6868 eval $inlibc
6869 runnm="$xxx_runnm"
6870
6871 : determine which dynamic loading, if any, to compile in
6872 echo " "
6873 dldir="ext/DynaLoader"
6874 case "$usedl" in
6875 $define|y|true)
6876         dflt='y'
6877         usedl="$define"
6878         ;;
6879 $undef|n|false)
6880         dflt='n'
6881         usedl="$undef"
6882         ;;
6883 *) 
6884         dflt='n'
6885         case "$d_dlopen" in
6886             $define) dflt='y' ;;
6887         esac
6888         case "$i_dld" in
6889             $define) dflt='y' ;;
6890         esac
6891         : Does a dl_xxx.xs file exist for this operating system
6892         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6893         ;;
6894 esac
6895 rp="Do you wish to use dynamic loading?"
6896 . ./myread
6897 usedl="$ans"
6898 case "$ans" in
6899 y*) usedl="$define"
6900         case "$dlsrc" in
6901         '')
6902                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6903                         dflt="$dldir/dl_${osname}.xs"
6904                 elif $test "$d_dlopen" = "$define" ; then
6905                         dflt="$dldir/dl_dlopen.xs"
6906                 elif $test "$i_dld" = "$define" ; then
6907                         dflt="$dldir/dl_dld.xs"
6908                 else
6909                         dflt=''
6910                 fi
6911                 ;;
6912         *)      dflt="$dldir/$dlsrc"
6913                 ;;
6914         esac
6915     echo "The following dynamic loading files are available:"
6916         : Can not go over to $dldir because getfile has path hard-coded in.
6917         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6918         rp="Source file to use for dynamic loading"
6919         fn="fne"
6920         gfpth="$src"
6921         . ./getfile
6922         usedl="$define"
6923         : emulate basename
6924         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6925
6926         $cat << EOM
6927
6928 Some systems may require passing special flags to $cc -c to
6929 compile modules that will be used to create a shared library.
6930 To use no flags, say "none".
6931
6932 EOM
6933     case "$cccdlflags" in
6934     '') case "$gccversion" in
6935                 '') case "$osname" in
6936                         hpux)   dflt='+z' ;;
6937                         next)   dflt='none' ;;
6938                         irix*)  dflt='-KPIC' ;;
6939                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6940                         sunos)  dflt='-pic' ;;
6941                         *)      dflt='none' ;;
6942                     esac
6943                         ;;
6944                 *)  case "$osname" in
6945                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6946                         *)      dflt='-fpic' ;;
6947                     esac ;;
6948             esac ;;
6949         ' ') dflt='none' ;;
6950     *)  dflt="$cccdlflags" ;;
6951     esac
6952     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6953     . ./myread
6954     case "$ans" in
6955     none) cccdlflags=' ' ;;
6956     *) cccdlflags="$ans" ;;
6957     esac
6958
6959     cat << EOM
6960
6961 Some systems use ld to create libraries that can be dynamically loaded,
6962 while other systems (such as those using ELF) use $cc.
6963
6964 EOM
6965         case "$ld" in
6966         '')     $cat >try.c <<'EOM'
6967 /* Test for whether ELF binaries are produced */
6968 #include <fcntl.h>
6969 #include <stdlib.h>
6970 int main() {
6971         char b[4];
6972         int i = open("a.out",O_RDONLY);
6973         if(i == -1) 
6974                 exit(1); /* fail */
6975         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6976                 exit(0); /* succeed (yes, it's ELF) */
6977         else
6978                 exit(1); /* fail */
6979 }
6980 EOM
6981                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6982                         cat <<EOM
6983 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6984 EOM
6985                         dflt="$cc"
6986                 else
6987                         echo "I'll use ld to build dynamic libraries."
6988                         dflt='ld'
6989                 fi
6990                 rm -f try.c a.out
6991                 ;;
6992         *)      dflt="$ld"
6993                 ;;
6994         esac
6995
6996     rp="What command should be used to create dynamic libraries?"
6997     . ./myread
6998         ld="$ans"
6999
7000     cat << EOM
7001
7002 Some systems may require passing special flags to $ld to create a
7003 library that can be dynamically loaded.  If your ld flags include
7004 -L/other/path options to locate libraries outside your loader's normal
7005 search path, you may need to specify those -L options here as well.  To
7006 use no flags, say "none".
7007
7008 EOM
7009     case "$lddlflags" in
7010     '') case "$osname" in
7011                         beos) dflt='-nostart' ;;
7012                         hpux) dflt='-b';
7013                               case "$gccversion" in
7014                               '') dflt="$dflt +vnocompatwarnings" ;;
7015                               esac
7016                               ;;        
7017                         linux|irix*)    dflt='-shared' ;;
7018                         next)  dflt='none' ;;
7019                         solaris) dflt='-G' ;;
7020                         sunos) dflt='-assert nodefinitions' ;;
7021                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7022                 *)     dflt='none' ;;
7023                         esac
7024                         ;;
7025     *) dflt="$lddlflags" ;;
7026     esac
7027
7028         : Try to guess additional flags to pick up local libraries.
7029         : Be careful not to append to a plain 'none'
7030         case "$dflt" in
7031         none) dflt='' ;;
7032         esac
7033         for thisflag in $ldflags; do
7034                 case "$thisflag" in
7035                 -L*|-R*)
7036                         case " $dflt " in
7037                         *" $thisflag "*) ;;
7038                         *) dflt="$dflt $thisflag" ;;
7039                         esac
7040                         ;;
7041                 esac
7042         done
7043
7044         case "$dflt" in
7045         ''|' ') dflt='none' ;;
7046         esac
7047
7048     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7049     . ./myread
7050     case "$ans" in
7051     none) lddlflags=' ' ;;
7052     *) lddlflags="$ans" ;;
7053     esac
7054
7055         cat <<EOM
7056
7057 Some systems may require passing special flags to $cc to indicate that
7058 the resulting executable will use dynamic linking.  To use no flags,
7059 say "none".
7060
7061 EOM
7062     case "$ccdlflags" in
7063     '') case "$osname" in
7064                 hpux)   dflt='-Wl,-E' ;;
7065                 linux)  dflt='-rdynamic' ;;
7066                 next)   dflt='none' ;;
7067                 sunos)  dflt='none' ;;
7068                 *)      dflt='none' ;;
7069             esac ;;
7070     ' ')  dflt='none' ;;
7071     *)  dflt="$ccdlflags" ;;
7072     esac
7073     rp="Any special flags to pass to $cc to use dynamic linking?"
7074     . ./myread
7075     case "$ans" in
7076     none) ccdlflags=' ' ;;
7077     *) ccdlflags="$ans" ;;
7078     esac
7079     ;;
7080 *)  usedl="$undef"
7081         ld='ld'
7082     dlsrc='dl_none.xs'
7083     lddlflags=''
7084     ccdlflags=''
7085     ;;
7086 esac
7087
7088 also=''
7089 case "$usedl" in
7090 $undef)
7091         # No dynamic loading being used, so don't bother even to prompt.
7092         useshrplib='false'
7093         ;;
7094 *)      case "$useshrplib" in
7095         '')     case "$osname" in
7096                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7097                         dflt=y
7098                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7099                         ;;
7100                 next*)
7101                         case "$osvers" in
7102                         4*)     dflt=y
7103                                 also='Building a shared libperl is needed for MAB support.'
7104                                 ;;
7105                         *)      dflt=n
7106                                 ;;
7107                         esac
7108                         ;;
7109                 *)      dflt=n
7110                         ;;
7111                 esac
7112                 ;;
7113         $define|true|[Yy]*)
7114                 dflt=y
7115                 ;;
7116         *)      dflt=n
7117                 ;;
7118         esac
7119         $cat << EOM
7120
7121 The perl executable is normally obtained by linking perlmain.c with
7122 libperl${_a}, any static extensions (usually just DynaLoader), and
7123 any other libraries needed on this system (such as -lm, etc.).  Since
7124 your system supports dynamic loading, it is probably possible to build
7125 a shared libperl.$so.  If you will have more than one executable linked
7126 to libperl.$so, this will significantly reduce the size of each
7127 executable, but it may have a noticeable affect on performance.  The
7128 default is probably sensible for your system.
7129 $also
7130
7131 EOM
7132         rp="Build a shared libperl.$so (y/n)"
7133         . ./myread
7134         case "$ans" in
7135         true|$define|[Yy]*)
7136                 useshrplib='true'  ;;
7137         *)      useshrplib='false' ;;
7138         esac
7139         ;;
7140 esac
7141
7142 case "$useshrplib" in
7143 true)
7144         case "$libperl" in
7145         '')
7146                 # Figure out a good name for libperl.so.  Since it gets stored in
7147                 # a version-specific architecture-dependent library, the version
7148                 # number isn't really that important, except for making cc/ld happy.
7149                 #
7150                 # A name such as libperl.so.3.1
7151                 majmin="libperl.$so.$patchlevel.$subversion"
7152                 # A name such as libperl.so.301
7153                 majonly=`echo $patchlevel $subversion |
7154                         $awk '{printf "%d%02d", $1, $2}'`
7155                 majonly=libperl.$so.$majonly
7156                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7157                 # rely on figuring it out from the naming of libc.
7158                 case "${osname}${osvers}" in
7159                 next4*)
7160                         dflt=libperl.5.$so
7161                         # XXX How handle the --version stuff for MAB?
7162                         ;;
7163                 linux*)  # ld won't link with a bare -lperl otherwise.
7164                         dflt=libperl.$so
7165                         ;;
7166                 cygwin*) # include version
7167                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7168                         ;;
7169                 *)      # Try to guess based on whether libc has major.minor.
7170                         case "$libc" in
7171                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7172                         *libc.$so.[0-9]*) dflt=$majonly ;;
7173                         *)      dflt=libperl.$so ;;
7174                         esac
7175                         ;;
7176                 esac
7177                 ;;
7178         *)      dflt=$libperl
7179                 ;;
7180         esac
7181         cat << EOM
7182
7183 I need to select a good name for the shared libperl.  If your system uses
7184 library names with major and minor numbers, then you might want something
7185 like $majmin.  Alternatively, if your system uses a single version
7186 number for shared libraries, then you might want to use $majonly.
7187 Or, your system might be quite happy with a simple libperl.$so.
7188
7189 Since the shared libperl will get installed into a version-specific
7190 architecture-dependent directory, the version number of the shared perl
7191 library probably isn't important, so the default should be o.k.
7192
7193 EOM
7194         rp='What name do you want to give to the shared libperl?'
7195         . ./myread
7196         libperl=$ans
7197         echo "Ok, I'll use $libperl"
7198         ;;
7199 *)
7200         libperl="libperl${_a}"
7201         ;;
7202 esac
7203
7204 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7205 case "$shrpdir" in
7206 '') ;;
7207 *)      $cat >&4 <<EOM
7208 WARNING:  Use of the shrpdir variable for the installation location of
7209 the shared $libperl is not supported.  It was never documented and
7210 will not work in this version.  Let me (perlbug@perl.org)
7211 know of any problems this may cause.
7212
7213 EOM
7214         case "$shrpdir" in
7215         "$archlibexp/CORE")
7216                 $cat >&4 <<EOM
7217 But your current setting of $shrpdir is
7218 the default anyway, so it's harmless.
7219 EOM
7220                 ;;
7221         *)
7222                 $cat >&4 <<EOM
7223 Further, your current attempted setting of $shrpdir
7224 conflicts with the value of $archlibexp/CORE
7225 that installperl will use.
7226 EOM
7227                 ;;
7228         esac
7229         ;;
7230 esac
7231
7232 # How will the perl executable find the installed shared $libperl?
7233 # Add $xxx to ccdlflags.
7234 # If we can't figure out a command-line option, use $shrpenv to
7235 # set env LD_RUN_PATH.  The main perl makefile uses this.
7236 shrpdir=$archlibexp/CORE
7237 xxx=''
7238 tmp_shrpenv=''
7239 if "$useshrplib"; then
7240     case "$osname" in 
7241         aix)
7242                 # We'll set it in Makefile.SH...
7243                 ;;
7244         solaris|netbsd)
7245                 xxx="-R $shrpdir"
7246                 ;;
7247         freebsd)
7248                 xxx="-Wl,-R$shrpdir"
7249                 ;;
7250         linux|irix*|dec_osf)
7251                 xxx="-Wl,-rpath,$shrpdir"
7252                 ;;
7253         next)
7254                 # next doesn't like the default...
7255                 ;;
7256         beos)
7257                 # beos doesn't like the default, either.
7258                 ;;
7259         hpux*)
7260                 # hpux doesn't like the default, either.
7261                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7262                 ;;
7263         *)
7264                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7265                 ;;
7266         esac
7267         case "$xxx" in
7268         '') ;;
7269         *)      
7270                 # Only add $xxx if it isn't already in ccdlflags.
7271                 case " $ccdlflags " in
7272                 *" $xxx "*)     ;;
7273                 *)      ccdlflags="$ccdlflags $xxx"
7274                         cat <<EOM >&4
7275
7276 Adding $xxx to the flags
7277 passed to $ld so that the perl executable will find the 
7278 installed shared $libperl.
7279
7280 EOM
7281                         ;;
7282                 esac
7283                 ;;
7284         esac
7285 fi
7286 # Fix ccdlflags in AIX for building external extensions.
7287 # (For building Perl itself bare -bE:perl.exp is needed,
7288 #  Makefile.SH takes care of this.)
7289 case "$osname" in
7290 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7291 esac
7292 # Respect a hint or command-line value.
7293 case "$shrpenv" in
7294 '') shrpenv="$tmp_shrpenv" ;;
7295 esac
7296 case "$ldlibpthname" in
7297 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7298 none)   ldlibpthname='' ;;
7299 esac
7300
7301 : determine where manual pages are on this system
7302 echo " "
7303 case "$sysman" in
7304 '') 
7305         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7306         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7307         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7308         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7309         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7310         sysman=`./loc . /usr/man/man1 $syspath`
7311         ;;
7312 esac
7313 if $test -d "$sysman"; then
7314         echo "System manual is in $sysman." >&4
7315 else
7316         echo "Could not find manual pages in source form." >&4
7317 fi
7318
7319 : determine where manual pages go
7320 set man1dir man1dir none
7321 eval $prefixit
7322 $cat <<EOM
7323
7324 $spackage has manual pages available in source form.
7325 EOM
7326 case "$nroff" in
7327 nroff)
7328         echo "However, you don't have nroff, so they're probably useless to you."
7329         case "$man1dir" in
7330         '') man1dir="none";;
7331         esac;;
7332 esac
7333 echo "If you don't want the manual sources installed, answer 'none'."
7334 case "$man1dir" in
7335 ' ') dflt=none
7336         ;;
7337 '')
7338         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7339         lookpath="$lookpath $prefixexp/man/p_man/man1"
7340         lookpath="$lookpath $prefixexp/man/u_man/man1"
7341         lookpath="$lookpath $prefixexp/man/man.1"
7342         case "$sysman" in
7343         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7344         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7345         esac
7346         set dflt
7347         eval $prefixup
7348         ;;
7349 *)  dflt="$man1dir"
7350         ;;
7351 esac
7352 echo " "
7353 fn=dn+~
7354 rp="Where do the main $spackage manual pages (source) go?"
7355 . ./getfile
7356 if $test "X$man1direxp" != "X$ansexp"; then
7357         installman1dir=''
7358 fi
7359 man1dir="$ans"
7360 man1direxp="$ansexp"
7361 case "$man1dir" in
7362 '')     man1dir=' '
7363         installman1dir='';;
7364 esac
7365
7366 : Change installation prefix, if necessary.
7367 if $test X"$prefix" != X"$installprefix"; then
7368         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7369 else
7370         installman1dir="$man1direxp"
7371 fi
7372
7373 : What suffix to use on installed man pages
7374
7375 case "$man1dir" in
7376 ' ')
7377         man1ext='0'
7378         ;;
7379 *)
7380         rp="What suffix should be used for the main $spackage man pages?"
7381         case "$man1ext" in
7382         '')     case "$man1dir" in
7383                 *1)  dflt=1 ;;
7384                 *1p) dflt=1p ;;
7385                 *1pm) dflt=1pm ;;
7386                 *l) dflt=l;;
7387                 *n) dflt=n;;
7388                 *o) dflt=o;;
7389                 *p) dflt=p;;
7390                 *C) dflt=C;;
7391                 *L) dflt=L;;
7392                 *L1) dflt=L1;;
7393                 *) dflt=1;;
7394                 esac
7395                 ;;
7396         *)      dflt="$man1ext";;
7397         esac
7398         . ./myread
7399         man1ext="$ans"
7400         ;;
7401 esac
7402
7403 : see if we can have long filenames
7404 echo " "
7405 first=123456789abcdef
7406 $rm -f $first
7407 if (echo hi >$first) 2>/dev/null; then
7408         if $test -f 123456789abcde; then
7409                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7410                 val="$undef"
7411         else
7412                 echo 'You can have filenames longer than 14 characters.'>&4
7413                 val="$define"
7414         fi
7415 else
7416         $cat <<'EOM'
7417 You can't have filenames longer than 14 chars.
7418 You can't even think about them!
7419 EOM
7420         val="$undef"
7421 fi 
7422 set d_flexfnam
7423 eval $setvar
7424 $rm -rf 123456789abcde*
7425
7426 : determine where library module manual pages go
7427 set man3dir man3dir none
7428 eval $prefixit
7429 $cat <<EOM
7430
7431 $spackage has manual pages for many of the library modules.
7432 EOM
7433
7434 case "$nroff" in
7435 nroff)
7436         $cat <<'EOM'
7437 However, you don't have nroff, so they're probably useless to you.
7438 EOM
7439         case "$man3dir" in
7440         '') man3dir="none";;
7441         esac;;
7442 esac
7443
7444 case "$d_flexfnam" in
7445 undef)
7446         $cat <<'EOM'
7447 However, your system can't handle the long file names like File::Basename.3. 
7448 EOM
7449         case "$man3dir" in
7450         '') man3dir="none";;
7451         esac;;
7452 esac
7453
7454 echo "If you don't want the manual sources installed, answer 'none'."
7455 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7456 case "$man3dir" in
7457 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7458         if $test -d "$privlib/man/man3"; then
7459                 cat <<EOM >&4
7460
7461 WARNING:  Previous versions of perl installed man3 pages into
7462 $privlib/man/man3.  This version will suggest a 
7463 new default of $dflt.  
7464 EOM
7465                 tdflt=$dflt
7466                 dflt='n'
7467                 rp='Do you wish to preserve the old behavior?(y/n)'
7468                 . ./myread
7469                 case "$ans" in
7470                 y*) dflt="$privlib/man/man3" ;;
7471                 *)  dflt=$tdflt ;;
7472                 esac
7473     fi
7474         ;;
7475 *)      dflt="$man3dir" ;;
7476 esac
7477 case "$dflt" in
7478 ' ') dflt=none ;;
7479 esac
7480 echo " "
7481 fn=dn+~
7482 rp="Where do the $package library man pages (source) go?"
7483 . ./getfile
7484 man3dir="$ans"
7485 man3direxp="$ansexp"
7486 case "$man3dir" in
7487 '')     man3dir=' '
7488         installman3dir='';;
7489 esac
7490
7491 : Change installation prefix, if necessary.
7492 if $test X"$prefix" != X"$installprefix"; then
7493         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7494 else
7495         installman3dir="$man3direxp"
7496 fi
7497
7498 : What suffix to use on installed man pages
7499 case "$man3dir" in
7500 ' ')
7501         man3ext='0'
7502         ;;
7503 *)
7504         rp="What suffix should be used for the $package library man pages?"
7505         case "$man3ext" in
7506         '')     case "$man3dir" in
7507                 *3)  dflt=3 ;;
7508                 *3p) dflt=3p ;;
7509                 *3pm) dflt=3pm ;;
7510                 *l) dflt=l;;
7511                 *n) dflt=n;;
7512                 *o) dflt=o;;
7513                 *p) dflt=p;;
7514                 *C) dflt=C;;
7515                 *L) dflt=L;;
7516                 *L3) dflt=L3;;
7517                 *) dflt=3;;
7518                 esac
7519                 ;;
7520         *)      dflt="$man3ext";;
7521         esac
7522         . ./myread
7523         man3ext="$ans"
7524         ;;
7525 esac
7526
7527 : see if we have to deal with yellow pages, now NIS.
7528 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7529         if $test -f /usr/etc/nibindd; then
7530                 echo " "
7531                 echo "I'm fairly confident you're on a NeXT."
7532                 echo " "
7533                 rp='Do you get the hosts file via NetInfo?'
7534                 dflt=y
7535                 case "$hostcat" in
7536                 nidump*) ;;
7537                 '') ;;
7538                 *) dflt=n;;
7539                 esac
7540                 . ./myread
7541                 case "$ans" in
7542                 y*) hostcat='nidump hosts .';;
7543                 *)      case "$hostcat" in
7544                         nidump*) hostcat='';;
7545                         esac
7546                         ;;
7547                 esac
7548         fi
7549         case "$hostcat" in
7550         nidump*) ;;
7551         *)
7552                 case "$hostcat" in
7553                 *ypcat*) dflt=y;;
7554                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7555                                 dflt=y
7556                         else
7557                                 dflt=n
7558                         fi;;
7559                 *) dflt=n;;
7560                 esac
7561                 echo " "
7562                 rp='Are you getting the hosts file via yellow pages?'
7563                 . ./myread
7564                 case "$ans" in
7565                 y*) hostcat='ypcat hosts';;
7566                 *) hostcat='cat /etc/hosts';;
7567                 esac
7568                 ;;
7569         esac
7570 fi
7571 case "$hostcat" in
7572 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7573 esac
7574 case "$groupcat" in
7575 '') test -f /etc/group && groupcat='cat /etc/group';;
7576 esac
7577 case "$passcat" in
7578 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7579 esac
7580
7581 : now get the host name
7582 echo " "
7583 echo "Figuring out host name..." >&4
7584 case "$myhostname" in
7585 '') cont=true
7586         echo 'Maybe "hostname" will work...'
7587         if tans=`sh -c hostname 2>&1` ; then
7588                 myhostname=$tans
7589                 phostname=hostname
7590                 cont=''
7591         fi
7592         ;;
7593 *) cont='';;
7594 esac
7595 if $test "$cont"; then
7596         if ./xenix; then
7597                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7598                 if tans=`cat /etc/systemid 2>&1` ; then
7599                         myhostname=$tans
7600                         phostname='cat /etc/systemid'
7601                         echo "Whadyaknow.  Xenix always was a bit strange..."
7602                         cont=''
7603                 fi
7604         elif $test -r /etc/systemid; then
7605                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7606         fi
7607 fi
7608 if $test "$cont"; then
7609         echo 'No, maybe "uuname -l" will work...'
7610         if tans=`sh -c 'uuname -l' 2>&1` ; then
7611                 myhostname=$tans
7612                 phostname='uuname -l'
7613         else
7614                 echo 'Strange.  Maybe "uname -n" will work...'
7615                 if tans=`sh -c 'uname -n' 2>&1` ; then
7616                         myhostname=$tans
7617                         phostname='uname -n'
7618                 else
7619                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7620                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7621                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7622                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7623                         else
7624                                 case "$myhostname" in
7625                                 '') echo "Does this machine have an identity crisis or something?"
7626                                         phostname='';;
7627                                 *)
7628                                         echo "Well, you said $myhostname before..."
7629                                         phostname='echo $myhostname';;
7630                                 esac
7631                         fi
7632                 fi
7633         fi
7634 fi
7635 : you do not want to know about this
7636 set $myhostname
7637 myhostname=$1
7638
7639 : verify guess
7640 if $test "$myhostname" ; then
7641         dflt=y
7642         rp='Your host name appears to be "'$myhostname'".'" Right?"
7643         . ./myread
7644         case "$ans" in
7645         y*) ;;
7646         *) myhostname='';;
7647         esac
7648 fi
7649
7650 : bad guess or no guess
7651 while $test "X$myhostname" = X ; do
7652         dflt=''
7653         rp="Please type the (one word) name of your host:"
7654         . ./myread
7655         myhostname="$ans"
7656 done
7657
7658 : translate upper to lower if necessary
7659 case "$myhostname" in
7660 *[A-Z]*)
7661         echo "(Normalizing case in your host name)"
7662         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7663         ;;
7664 esac
7665
7666 case "$myhostname" in
7667 *.*)
7668         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7669         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7670         echo "(Trimming domain name from host name--host name is now $myhostname)"
7671         ;;
7672 *) case "$mydomain" in
7673         '')
7674                 {
7675                         test "X$hostcat" = "Xypcat hosts" &&
7676                         ypmatch "$myhostname" hosts 2>/dev/null |\
7677                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7678                         $test -s hosts
7679                 } || {
7680                         test "X$hostcat" != "X" &&
7681                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7682                                         /[       ]$myhostname[  . ]/p" > hosts
7683                 }
7684                 tmp_re="[       . ]"
7685                 if $test -f hosts; then
7686                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7687                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7688                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7689                                 hosts | $sort | $uniq | \
7690                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7691                         case `$echo X$dflt` in
7692                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7693                                 dflt=.
7694                                 ;;
7695                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7696                                 ;;
7697                         esac
7698                 else
7699                         echo "(I cannot locate a hosts database anywhere)"
7700                         dflt=.
7701                 fi
7702                 case "$dflt" in
7703                 .)
7704                         tans=`./loc resolv.conf X /etc /usr/etc`
7705                         if $test -f "$tans"; then
7706                                 echo "(Attempting domain name extraction from $tans)"
7707                                 dflt=.`$sed -n -e 's/   / /g' \
7708                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7709                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7710                                 case "$dflt" in
7711                                 .) dflt=.`$sed -n -e 's/        / /g' \
7712                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7713                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7714                                         ;;
7715                                 esac
7716                         fi
7717                         ;;
7718                 esac
7719                 case "$dflt" in
7720                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7721                         dflt=.`sh -c domainname 2>/dev/null`
7722                         case "$dflt" in
7723                         '') dflt='.';;
7724                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7725                         esac
7726                         ;;
7727                 esac
7728                 case "$dflt$osname" in
7729                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7730                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7731                         ;;
7732                 esac
7733                 case "$dflt" in
7734                 .) echo "(Lost all hope -- silly guess then)"
7735                         dflt='.uucp'
7736                         ;;
7737                 esac
7738                 $rm -f hosts
7739                 ;;
7740         *) dflt="$mydomain";;
7741         esac;;
7742 esac
7743 echo " "
7744 rp="What is your domain name?"
7745 . ./myread
7746 tans="$ans"
7747 case "$ans" in
7748 '') ;;
7749 .*) ;;
7750 *) tans=".$tans";;
7751 esac
7752 mydomain="$tans"
7753
7754 : translate upper to lower if necessary
7755 case "$mydomain" in
7756 *[A-Z]*)
7757         echo "(Normalizing case in your domain name)"
7758         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7759         ;;
7760 esac
7761
7762 : a little sanity check here
7763 case "$phostname" in
7764 '') ;;
7765 *)
7766         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7767         $myhostname$mydomain|$myhostname) ;;
7768         *)
7769                 case "$phostname" in
7770                 sed*)
7771                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7772                         ;;
7773                 *)
7774                         echo "(That doesn't agree with your $phostname command, by the way.)"
7775                         ;;
7776                 esac
7777         ;;
7778         esac
7779         ;;
7780 esac
7781
7782 $cat <<EOM
7783
7784 I need to get your e-mail address in Internet format if possible, i.e.
7785 something like user@host.domain. Please answer accurately since I have
7786 no easy means to double check it. The default value provided below
7787 is most probably close to reality but may not be valid from outside
7788 your organization...
7789
7790 EOM
7791 cont=x
7792 while test "$cont"; do
7793         case "$cf_email" in
7794         '') dflt="$cf_by@$myhostname$mydomain";;
7795         *) dflt="$cf_email";;
7796         esac
7797         rp='What is your e-mail address?'
7798         . ./myread
7799         cf_email="$ans"
7800         case "$cf_email" in
7801         *@*.*) cont='' ;;
7802         *)
7803                 rp='Address does not look like an Internet one.  Use it anyway?'
7804                 case "$fastread" in
7805                 yes) dflt=y ;;
7806                 *) dflt=n ;;
7807                 esac
7808                 . ./myread
7809                 case "$ans" in
7810                 y*) cont='' ;;
7811                 *) echo " " ;;
7812                 esac
7813                 ;;
7814         esac
7815 done
7816
7817 $cat <<EOM
7818
7819 If you or somebody else will be maintaining perl at your site, please
7820 fill in the correct e-mail address here so that they may be contacted
7821 if necessary. Currently, the "perlbug" program included with perl
7822 will send mail to this address in addition to perlbug@perl.org. You may
7823 enter "none" for no administrator.
7824
7825 EOM
7826 case "$perladmin" in
7827 '') dflt="$cf_email";;
7828 *) dflt="$perladmin";;
7829 esac
7830 rp='Perl administrator e-mail address'
7831 . ./myread
7832 perladmin="$ans"
7833
7834 : determine whether to only install version-specific parts.
7835 echo " "
7836 $cat <<EOM
7837 Do you want to install only the version-specific parts of the perl
7838 distribution?  Usually you do *not* want to do this.
7839 EOM
7840 case "$versiononly" in
7841 "$define"|[Yy]*|true) dflt='y' ;;
7842 *) dflt='n';
7843 esac
7844 rp="Do you want to install only the version-specific parts of perl?"
7845 . ./myread
7846 case "$ans" in
7847 [yY]*)  val="$define";;
7848 *)      val="$undef" ;;
7849 esac
7850 set versiononly
7851 eval $setvar
7852
7853 : figure out how to guarantee perl startup
7854 case "$startperl" in
7855 '')
7856         case "$sharpbang" in
7857         *!)
7858                 $cat <<EOH
7859
7860 I can use the #! construct to start perl on your system. This will
7861 make startup of perl scripts faster, but may cause problems if you
7862 want to share those scripts and perl is not in a standard place
7863 ($binexp/perl) on all your platforms. The alternative is to force
7864 a shell by starting the script with a single ':' character.
7865
7866 EOH
7867                 case "$versiononly" in
7868                 "$define")      dflt="$binexp/perl$version";;  
7869                 *)              dflt="$binexp/perl";;
7870                 esac
7871                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7872                 . ./myread
7873                 case "$ans" in
7874                 none)   startperl=": # use perl";;
7875                 *)      startperl="#!$ans"
7876                         if $test 30 -lt `echo "$ans" | wc -c`; then
7877                                 $cat >&4 <<EOM
7878
7879 WARNING:  Some systems limit the #! command to 32 characters.
7880 If you experience difficulty running Perl scripts with #!, try
7881 installing Perl in a directory with a shorter pathname.
7882
7883 EOM
7884                         fi ;;
7885                 esac
7886                 ;;
7887         *) startperl=": # use perl"
7888                 ;;
7889         esac
7890         ;;
7891 esac
7892 echo "I'll use $startperl to start perl scripts."
7893
7894 : figure best path for perl in scripts
7895 case "$perlpath" in
7896 '')
7897         perlpath="$binexp/perl"
7898         case "$startperl" in
7899         *!*) ;;
7900         *)
7901                 $cat <<EOH
7902
7903 I will use the "eval 'exec'" idiom to start Perl on your system.
7904 I can use the full path of your Perl binary for this purpose, but
7905 doing so may cause problems if you want to share those scripts and
7906 Perl is not always in a standard place ($binexp/perl).
7907
7908 EOH
7909                 dflt="$binexp/perl"
7910                 rp="What path shall I use in \"eval 'exec'\"?"
7911                 . ./myread
7912                 perlpath="$ans"
7913                 ;;
7914         esac
7915         ;;
7916 esac
7917 case "$startperl" in
7918 *!*)    ;;
7919 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7920 esac
7921
7922 : determine where public executable scripts go
7923 set scriptdir scriptdir
7924 eval $prefixit
7925 case "$scriptdir" in
7926 '')
7927         dflt="$bin"
7928         : guess some guesses
7929         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7930         $test -d /usr/share/bin     && dflt=/usr/share/bin
7931         $test -d /usr/local/script  && dflt=/usr/local/script
7932         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7933         $test -d $prefixexp/script  && dflt=$prefixexp/script
7934         set dflt
7935         eval $prefixup
7936         ;;
7937 *)  dflt="$scriptdir"
7938         ;;
7939 esac
7940 $cat <<EOM
7941  
7942 Some installations have a separate directory just for executable scripts so
7943 that they can mount it across multiple architectures but keep the scripts in
7944 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7945 Or you might just lump your scripts in with all your other executables.
7946  
7947 EOM
7948 fn=d~
7949 rp='Where do you keep publicly executable scripts?'
7950 . ./getfile
7951 if $test "X$ansexp" != "X$scriptdirexp"; then
7952         installscript=''
7953 fi
7954 scriptdir="$ans"
7955 scriptdirexp="$ansexp"
7956 : Change installation prefix, if necessary.
7957 if $test X"$prefix" != X"$installprefix"; then
7958         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7959 else
7960         installscript="$scriptdirexp"
7961 fi
7962
7963 : determine where add-on public executables go
7964 case "$sitebin" in
7965 '')     dflt=$siteprefix/bin ;;
7966 *)      dflt=$sitebin ;;
7967 esac
7968 fn=d~
7969 rp='Pathname where the add-on public executables should be installed?'
7970 . ./getfile
7971 sitebin="$ans"
7972 sitebinexp="$ansexp"
7973 : Change installation prefix, if necessary.
7974 if $test X"$prefix" != X"$installprefix"; then
7975         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7976 else
7977         installsitebin="$sitebinexp"
7978 fi
7979
7980 case "$vendorprefix" in
7981 '')     d_vendorbin="$undef"
7982         vendorbin=''
7983         vendorbinexp=''
7984         ;;
7985 *)      d_vendorbin="$define"
7986         : determine where vendor-supplied executables go.
7987         case "$vendorbin" in
7988         '') dflt=$vendorprefix/bin ;;
7989         *)      dflt="$vendorbin" ;;
7990         esac
7991         fn=d~+
7992         rp='Pathname for the vendor-supplied executables directory?'
7993         . ./getfile
7994         vendorbin="$ans"
7995         vendorbinexp="$ansexp"
7996         ;;
7997 esac
7998 : Change installation prefix, if necessary.
7999 if $test X"$prefix" != X"$installprefix"; then
8000         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8001 else
8002         installvendorbin="$vendorbinexp"
8003 fi
8004
8005 : see if qgcvt exists
8006 set qgcvt d_qgcvt
8007 eval $inlibc
8008
8009 echo " "
8010
8011 if $test X"$d_longdbl" = X"$define"; then
8012
8013 echo "Checking how to print long doubles..." >&4
8014
8015 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8016         $cat >try.c <<'EOCP'
8017 #include <sys/types.h>
8018 #include <stdio.h>
8019 int main() {
8020   double d = 123.456;
8021   printf("%.3f\n", d);
8022 }
8023 EOCP
8024         set try
8025         if eval $compile; then
8026                 yyy=`./try$exe_ext`
8027                 case "$yyy" in
8028                 123.456)
8029                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8030                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8031                         echo "We will use %f."
8032                         ;;
8033                 esac
8034         fi
8035 fi
8036
8037 if $test X"$sPRIfldbl" = X; then
8038         $cat >try.c <<'EOCP'
8039 #include <sys/types.h>
8040 #include <stdio.h>
8041 int main() {
8042   long double d = 123.456;
8043   printf("%.3llf\n", d);
8044 }
8045 EOCP
8046         set try
8047         if eval $compile; then
8048                 yyy=`./try$exe_ext`
8049                 case "$yyy" in
8050                 123.456)
8051                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8052                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8053                         echo "We will use %llf."
8054                         ;;
8055                 esac
8056         fi
8057 fi
8058
8059 if $test X"$sPRIfldbl" = X; then
8060         $cat >try.c <<'EOCP'
8061 #include <sys/types.h>
8062 #include <stdio.h>
8063 int main() {
8064   long double d = 123.456;
8065   printf("%.3Lf\n", d);
8066 }
8067 EOCP
8068         set try
8069         if eval $compile; then
8070                 yyy=`./try$exe_ext`
8071                 case "$yyy" in
8072                 123.456)
8073                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8074                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8075                         echo "We will use %Lf."
8076                         ;;
8077                 esac
8078         fi
8079 fi
8080
8081 if $test X"$sPRIfldbl" = X; then
8082         $cat >try.c <<'EOCP'
8083 #include <sys/types.h>
8084 #include <stdio.h>
8085 int main() {
8086   long double d = 123.456;
8087   printf("%.3lf\n", d);
8088 }
8089 EOCP
8090         set try
8091         if eval $compile; then
8092                 yyy=`./try$exe_ext`
8093                 case "$yyy" in
8094                 123.456)
8095                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8096                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8097                         echo "We will use %lf."
8098                         ;;
8099                 esac
8100         fi
8101 fi
8102
8103 if $test X"$sPRIfldbl" = X; then
8104         echo "Cannot figure out how to print long doubles." >&4
8105 else
8106         sSCNfldbl=$sPRIfldbl    # expect consistency
8107 fi
8108
8109 $rm -f try try.*
8110
8111 fi # d_longdbl
8112
8113 case "$sPRIfldbl" in
8114 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8115         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8116         d_SCNfldbl="$undef";
8117         ;;
8118 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8119         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8120         d_SCNfldbl="$define";
8121         ;;
8122 esac
8123
8124 : Check how to convert floats to strings.
8125 echo " "
8126 echo "Checking for an efficient way to convert floats to strings."
8127 echo " " > try.c
8128 case "$uselongdouble" in
8129 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8130 esac
8131 case "$d_longdbl" in
8132 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8133 esac
8134 case "$d_PRIgldbl" in
8135 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8136 esac
8137 $cat >>try.c <<EOP
8138 #ifdef TRY_gconvert
8139 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8140 char *myname = "gconvert";
8141 #endif
8142 #ifdef TRY_gcvt
8143 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8144 char *myname = "gcvt";
8145 #endif
8146 #ifdef TRY_qgcvt
8147 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8148 char *myname = "qgcvt";
8149 #define DOUBLETYPE long double
8150 #endif
8151 #ifdef TRY_sprintf
8152 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8153 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8154 #else
8155 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8156 #endif
8157 char *myname = "sprintf";
8158 #endif
8159
8160 #ifndef DOUBLETYPE
8161 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8162 #define DOUBLETYPE long double
8163 #else
8164 #define DOUBLETYPE double
8165 #endif
8166 #endif
8167
8168 #include <stdio.h>
8169
8170 #define I_STDLIB $i_stdlib
8171 #ifdef I_STDLIB
8172 #include <stdlib.h>
8173 #endif
8174
8175 int
8176 checkit(expect, got)
8177 char *expect;
8178 char *got;
8179 {
8180     if (strcmp(expect, got)) {
8181                 printf("%s oddity:  Expected %s, got %s\n",
8182                         myname, expect, got);
8183                 exit(1);
8184         }
8185 }
8186
8187 int main()
8188
8189         char buf[64]; 
8190         buf[63] = '\0';
8191
8192         /* This must be 1st test on (which?) platform */
8193         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8194         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8195         checkit("0.1", buf);
8196
8197         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8198         checkit("1", buf);
8199
8200         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8201         checkit("1.1", buf);
8202
8203         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8204         checkit("1.01", buf);
8205
8206         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8207         checkit("1.001", buf);
8208
8209         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8210         checkit("1.0001", buf);
8211
8212         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8213         checkit("1.00001", buf);
8214
8215         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8216         checkit("1.000001", buf);
8217
8218         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8219         checkit("0", buf);
8220
8221         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8222         checkit("-1", buf);
8223
8224         /* Some Linux gcvt's give 1.e+5 here. */
8225         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8226         checkit("100000", buf);
8227         
8228         /* Some Linux gcvt's give -1.e+5 here. */
8229         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8230         checkit("-100000", buf);
8231
8232         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8233         checkit("123.456", buf);
8234
8235         exit(0);
8236 }
8237 EOP
8238 case "$d_Gconvert" in
8239 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8240 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8241 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8242 *) xxx_list='gconvert gcvt sprintf' ;;
8243 esac
8244
8245 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8246 "$define$define$define")
8247     # for long doubles prefer first qgcvt, then sprintf
8248     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8249     xxx_list="sprintf $xxx_list"
8250     case "$d_qgcvt" in
8251     "$define") xxx_list="qgcvt $xxx_list" ;;
8252     esac
8253     ;;
8254 esac
8255
8256 for xxx_convert in $xxx_list; do
8257         echo "Trying $xxx_convert..."
8258         $rm -f try try$_o
8259         set try -DTRY_$xxx_convert
8260         if eval $compile; then
8261                 echo "$xxx_convert() found." >&4
8262                 if ./try; then
8263                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8264                         break;
8265                 else
8266                         echo "...But $xxx_convert didn't work as I expected."
8267                 fi
8268         else
8269                 echo "$xxx_convert NOT found." >&4
8270         fi
8271 done
8272         
8273 case "$xxx_convert" in
8274 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8275 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8276 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8277 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8278    "$define$define$define")
8279       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8280    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8281    esac
8282    ;;  
8283 esac
8284
8285 : see if _fwalk exists
8286 set fwalk d__fwalk
8287 eval $inlibc
8288
8289 : Initialize h_fcntl
8290 h_fcntl=false
8291
8292 : Initialize h_sysfile
8293 h_sysfile=false
8294
8295 : access call always available on UNIX
8296 set access d_access
8297 eval $inlibc
8298
8299 : locate the flags for 'access()'
8300 case "$d_access" in
8301 "$define")
8302         echo " "
8303         $cat >access.c <<'EOCP'
8304 #include <sys/types.h>
8305 #ifdef I_FCNTL
8306 #include <fcntl.h>
8307 #endif
8308 #ifdef I_SYS_FILE
8309 #include <sys/file.h>
8310 #endif
8311 #ifdef I_UNISTD
8312 #include <unistd.h>
8313 #endif
8314 int main() {
8315         exit(R_OK);
8316 }
8317 EOCP
8318         : check sys/file.h first, no particular reason here
8319         if $test `./findhdr sys/file.h` && \
8320                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8321                 h_sysfile=true;
8322                 echo "<sys/file.h> defines the *_OK access constants." >&4
8323         elif $test `./findhdr fcntl.h` && \
8324                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8325                 h_fcntl=true;
8326                 echo "<fcntl.h> defines the *_OK access constants." >&4
8327         elif $test `./findhdr unistd.h` && \
8328                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8329                 echo "<unistd.h> defines the *_OK access constants." >&4
8330         else
8331                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8332         fi
8333         ;;
8334 esac
8335 $rm -f access*
8336
8337 : see if accessx exists
8338 set accessx d_accessx
8339 eval $inlibc
8340
8341 : see if alarm exists
8342 set alarm d_alarm
8343 eval $inlibc
8344
8345 : see if atolf exists
8346 set atolf d_atolf
8347 eval $inlibc
8348
8349 : see if atoll exists
8350 set atoll d_atoll
8351 eval $inlibc
8352
8353 : Look for GNU-cc style attribute checking
8354 echo " "
8355 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8356 $cat >attrib.c <<'EOCP'
8357 #include <stdio.h>
8358 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8359 EOCP
8360 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8361         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8362                 echo "Your C compiler doesn't fully support __attribute__."
8363                 val="$undef"
8364         else
8365                 echo "Your C compiler supports __attribute__."
8366                 val="$define"
8367         fi
8368 else
8369         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8370         val="$undef"
8371 fi
8372 set d_attribut
8373 eval $setvar
8374 $rm -f attrib*
8375
8376 : see if bcmp exists
8377 set bcmp d_bcmp
8378 eval $inlibc
8379
8380 : see if bcopy exists
8381 set bcopy d_bcopy
8382 eval $inlibc
8383
8384 : see if this is a unistd.h system
8385 set unistd.h i_unistd
8386 eval $inhdr
8387
8388 : see if getpgrp exists
8389 set getpgrp d_getpgrp
8390 eval $inlibc
8391
8392 case "$d_getpgrp" in
8393 "$define")
8394         echo " "
8395         echo "Checking to see which flavor of getpgrp is in use..."
8396         $cat >set.c <<EOP
8397 #$i_unistd I_UNISTD
8398 #include <sys/types.h>
8399 #ifdef I_UNISTD
8400 #  include <unistd.h>
8401 #endif
8402 int main()
8403 {
8404         if (getuid() == 0) {
8405                 printf("(I see you are running Configure as super-user...)\n");
8406                 setuid(1);
8407         }
8408 #ifdef TRY_BSD_PGRP
8409         if (getpgrp(1) == 0)
8410                 exit(0);
8411 #else
8412         if (getpgrp() > 0)
8413                 exit(0);
8414 #endif
8415         exit(1);
8416 }
8417 EOP
8418         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8419                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8420                 val="$define"
8421         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8422                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8423                 val="$undef"
8424         else
8425                 echo "I can't seem to compile and run the test program."
8426                 if ./usg; then
8427                         xxx="a USG one, i.e. you use getpgrp()."
8428                 else
8429                         # SVR4 systems can appear rather BSD-ish.
8430                         case "$i_unistd" in
8431                         $undef)
8432                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8433                                 val="$define"
8434                                 ;;
8435                         $define)
8436                                 xxx="probably a USG one, i.e. you use getpgrp()."
8437                                 val="$undef"
8438                                 ;;
8439                         esac
8440                 fi
8441                 echo "Assuming your getpgrp is $xxx" >&4
8442         fi
8443         ;;
8444 *) val="$undef";;
8445 esac
8446 set d_bsdgetpgrp
8447 eval $setvar
8448 $rm -f set set.c
8449
8450 : see if setpgrp exists
8451 set setpgrp d_setpgrp
8452 eval $inlibc
8453
8454 case "$d_setpgrp" in
8455 "$define")
8456         echo " "
8457         echo "Checking to see which flavor of setpgrp is in use..."
8458         $cat >set.c <<EOP
8459 #$i_unistd I_UNISTD
8460 #include <sys/types.h>
8461 #ifdef I_UNISTD
8462 #  include <unistd.h>
8463 #endif
8464 int main()
8465 {
8466         if (getuid() == 0) {
8467                 printf("(I see you are running Configure as super-user...)\n");
8468                 setuid(1);
8469         }
8470 #ifdef TRY_BSD_PGRP
8471         if (-1 == setpgrp(1, 1))
8472                 exit(0);
8473 #else
8474         if (setpgrp() != -1)
8475                 exit(0);
8476 #endif
8477         exit(1);
8478 }
8479 EOP
8480         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8481                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8482                 val="$define"
8483         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8484                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8485                 val="$undef"
8486         else
8487                 echo "(I can't seem to compile and run the test program.)"
8488                 if ./usg; then
8489                         xxx="a USG one, i.e. you use setpgrp()."
8490                 else
8491                         # SVR4 systems can appear rather BSD-ish.
8492                         case "$i_unistd" in
8493                         $undef)
8494                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8495                                 val="$define"
8496                                 ;;
8497                         $define)
8498                                 xxx="probably a USG one, i.e. you use setpgrp()."
8499                                 val="$undef"
8500                                 ;;
8501                         esac
8502                 fi
8503                 echo "Assuming your setpgrp is $xxx" >&4
8504         fi
8505         ;;
8506 *) val="$undef";;
8507 esac
8508 set d_bsdsetpgrp
8509 eval $setvar
8510 $rm -f set set.c
8511 : see if bzero exists
8512 set bzero d_bzero
8513 eval $inlibc
8514
8515 : see if signal is declared as pointer to function returning int or void
8516 echo " "
8517 xxx=`./findhdr signal.h`
8518 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8519 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8520         echo "You have int (*signal())() instead of void." >&4
8521         val="$undef"
8522 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8523         echo "You have void (*signal())()." >&4
8524         val="$define"
8525 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8526         echo "You have int (*signal())() instead of void." >&4
8527         val="$undef"
8528 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8529         echo "You have void (*signal())()." >&4
8530         val="$define"
8531 else
8532         case "$d_voidsig" in
8533         '')
8534         echo "I can't determine whether signal handler returns void or int..." >&4
8535                 dflt=void
8536                 rp="What type does your signal handler return?"
8537                 . ./myread
8538                 case "$ans" in
8539                 v*) val="$define";;
8540                 *) val="$undef";;
8541                 esac;;
8542         "$define")
8543                 echo "As you already told me, signal handler returns void." >&4
8544                 val="$define"
8545                 ;;
8546         *)      echo "As you already told me, signal handler returns int." >&4
8547                 val="$undef"
8548                 ;;
8549         esac
8550 fi
8551 set d_voidsig
8552 eval $setvar
8553 case "$d_voidsig" in
8554 "$define") signal_t="void";;
8555 *) signal_t="int";;
8556 esac
8557 $rm -f $$.tmp
8558
8559 : check for ability to cast large floats to 32-bit ints.
8560 echo " "
8561 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8562 if $test "$intsize" -ge 4; then
8563         xxx=int
8564 else
8565         xxx=long
8566 fi
8567 $cat >try.c <<EOCP
8568 #include <stdio.h>
8569 #include <sys/types.h>
8570 #include <signal.h>
8571 $signal_t blech(s) int s; { exit(3); }
8572 int main()
8573 {
8574         $xxx i32;
8575         double f, g;
8576         int result = 0;
8577         char str[16];
8578         signal(SIGFPE, blech);
8579
8580         /* Don't let compiler optimize the test away.  Store the number 
8581            in a writable string for gcc to pass to sscanf under HP/UX.
8582         */
8583         sprintf(str, "2147483647");
8584         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8585         g = 10 * f;
8586         i32  = ($xxx) g;
8587
8588         /* x86 processors will probably give 0x8000 0000, which is a
8589        sign change.  We don't want that.  We want to mimic SPARC
8590            behavior here, which is to preserve the sign and give
8591            back 0x7fff ffff.
8592         */
8593         if (i32 != ($xxx) f)
8594                 result |= 1;
8595         exit(result);
8596 }
8597 EOCP
8598 set try
8599 if eval $compile_ok; then
8600         ./try
8601         yyy=$?
8602 else
8603         echo "(I can't seem to compile the test program--assuming it can't)"
8604         yyy=1
8605 fi
8606 case "$yyy" in
8607 0)      val="$define"
8608         echo "Yup, it can."
8609         ;;
8610 *)      val="$undef"
8611         echo "Nope, it can't."
8612         ;;
8613 esac
8614 set d_casti32
8615 eval $setvar
8616 $rm -f try try.*
8617
8618 : check for ability to cast negative floats to unsigned
8619 echo " "
8620 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8621 $cat >try.c <<EOCP
8622 #include <stdio.h>
8623 #include <sys/types.h>
8624 #include <signal.h>
8625 $signal_t blech(s) int s; { exit(7); }
8626 $signal_t blech_in_list(s) int s; { exit(4); }
8627 unsigned long dummy_long(p) unsigned long p; { return p; }
8628 unsigned int dummy_int(p) unsigned int p; { return p; }
8629 unsigned short dummy_short(p) unsigned short p; { return p; }
8630 int main()
8631 {
8632         double f;
8633         unsigned long along;
8634         unsigned int aint;
8635         unsigned short ashort;
8636         int result = 0;
8637         char str[16];
8638         
8639         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8640            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8641            optimized the whole file away
8642         */
8643         /* Store the number in a writable string for gcc to pass to 
8644            sscanf under HP/UX.
8645         */
8646         sprintf(str, "-123");
8647         sscanf(str, "%lf", &f);  /* f = -123.; */
8648
8649         signal(SIGFPE, blech);
8650         along = (unsigned long)f;
8651         aint = (unsigned int)f;
8652         ashort = (unsigned short)f;
8653         if (along != (unsigned long)-123)
8654                 result |= 1;
8655         if (aint != (unsigned int)-123)
8656                 result |= 1;
8657         if (ashort != (unsigned short)-123)
8658                 result |= 1;
8659         sprintf(str, "1073741824.");
8660         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8661         f = f + f;
8662         along = 0;
8663         along = (unsigned long)f;
8664         if (along != 0x80000000)
8665                 result |= 2;
8666         f -= 1.;
8667         along = 0;
8668         along = (unsigned long)f;
8669         if (along != 0x7fffffff)
8670                 result |= 1;
8671         f += 2.;
8672         along = 0;
8673         along = (unsigned long)f;
8674         if (along != 0x80000001)
8675                 result |= 2;
8676         if (result)
8677                 exit(result);
8678         signal(SIGFPE, blech_in_list);
8679         sprintf(str, "123.");
8680         sscanf(str, "%lf", &f);  /* f = 123.; */
8681         along = dummy_long((unsigned long)f);
8682         aint = dummy_int((unsigned int)f);
8683         ashort = dummy_short((unsigned short)f);
8684         if (along != (unsigned long)123)
8685                 result |= 4;
8686         if (aint != (unsigned int)123)
8687                 result |= 4;
8688         if (ashort != (unsigned short)123)
8689                 result |= 4;
8690         exit(result);
8691
8692 }
8693 EOCP
8694 set try
8695 if eval $compile_ok; then
8696         ./try
8697         castflags=$?
8698 else
8699         echo "(I can't seem to compile the test program--assuming it can't)"
8700         castflags=7
8701 fi
8702 case "$castflags" in
8703 0)      val="$define"
8704         echo "Yup, it can."
8705         ;;
8706 *)      val="$undef"
8707         echo "Nope, it can't."
8708         ;;
8709 esac
8710 set d_castneg
8711 eval $setvar
8712 $rm -f try.*
8713
8714 : see if vprintf exists
8715 echo " "
8716 if set vprintf val -f d_vprintf; eval $csym; $val; then
8717         echo 'vprintf() found.' >&4
8718         val="$define"
8719         $cat >vprintf.c <<'EOF'
8720 #include <varargs.h>
8721
8722 int main() { xxx("foo"); }
8723
8724 xxx(va_alist)
8725 va_dcl
8726 {
8727         va_list args;
8728         char buf[10];
8729
8730         va_start(args);
8731         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8732 }
8733 EOF
8734         set vprintf
8735         if eval $compile && ./vprintf; then
8736                 echo "Your vsprintf() returns (int)." >&4
8737                 val2="$undef"
8738         else
8739                 echo "Your vsprintf() returns (char*)." >&4
8740                 val2="$define"
8741         fi
8742 else
8743         echo 'vprintf() NOT found.' >&4
8744                 val="$undef"
8745                 val2="$undef"
8746 fi
8747 set d_vprintf
8748 eval $setvar
8749 val=$val2
8750 set d_charvspr
8751 eval $setvar
8752
8753 : see if chown exists
8754 set chown d_chown
8755 eval $inlibc
8756
8757 : see if chroot exists
8758 set chroot d_chroot
8759 eval $inlibc
8760
8761 : see if chsize exists
8762 set chsize d_chsize
8763 eval $inlibc
8764
8765 hasstruct='varname=$1; struct=$2; shift; shift;
8766 while $test $# -ge 2; do
8767         case "$1" in
8768         $define) echo "#include <$2>";;
8769         esac ;
8770     shift 2;
8771 done > try.c;
8772 echo "int main () { struct $struct foo; }" >> try.c;
8773 set try;
8774 if eval $compile; then
8775         val="$define";
8776 else
8777         val="$undef";
8778 fi;
8779 set $varname;
8780 eval $setvar;
8781 $rm -f try.c try.o'
8782
8783 : see if sys/types.h has to be included
8784 set sys/types.h i_systypes
8785 eval $inhdr
8786
8787 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8788 while $test $# -ge 2; do
8789         case "$1" in
8790         $define) echo "#include <$2>";;
8791         esac ;
8792     shift 2;
8793 done > try.c;
8794 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8795 set try;
8796 if eval $compile; then
8797         val="$define";
8798 else
8799         val="$undef";
8800 fi;
8801 set $varname;
8802 eval $setvar;
8803 $rm -f try.c try.o'
8804
8805 socketlib=''
8806 sockethdr=''
8807 : see whether socket exists
8808 echo " "
8809 $echo $n "Hmm... $c" >&4
8810 if set socket val -f d_socket; eval $csym; $val; then
8811         echo "Looks like you have Berkeley networking support." >&4
8812         d_socket="$define"
8813         if set setsockopt val -f; eval $csym; $val; then
8814                 d_oldsock="$undef"
8815         else
8816                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8817                 d_oldsock="$define"
8818         fi
8819 else
8820         if $contains socklib libc.list >/dev/null 2>&1; then
8821                 echo "Looks like you have Berkeley networking support." >&4
8822                 d_socket="$define"
8823                 : we will have to assume that it supports the 4.2 BSD interface
8824                 d_oldsock="$undef"
8825         else
8826                 echo "You don't have Berkeley networking in libc$_a..." >&4
8827                 if test "X$d_socket" = "X$define"; then
8828                    echo "...but you seem to believe that you have sockets." >&4
8829                 else
8830                         for net in net socket
8831                         do
8832                                 if test -f /usr/lib/lib$net$_a; then
8833                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8834                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8835                                         if $contains socket libc.list >/dev/null 2>&1; then
8836                                                 d_socket="$define"
8837                                                 socketlib="-l$net"
8838                                                 case "$net" in
8839                                                 net)
8840                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8841                                                         sockethdr="-I/usr/netinclude"
8842                                                         ;;
8843                                                 esac
8844                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8845                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8846                                                         d_oldsock="$undef"
8847                                                 else
8848                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8849                                                         d_oldsock="$define"
8850                                                 fi
8851                                                 break
8852                                         fi
8853                                 fi
8854                         done
8855                         if test "X$d_socket" != "X$define"; then
8856                            echo "or anywhere else I see." >&4
8857                            d_socket="$undef"
8858                            d_oldsock="$undef"
8859                         fi
8860                 fi
8861         fi
8862 fi
8863
8864 : see if socketpair exists
8865 set socketpair d_sockpair
8866 eval $inlibc
8867
8868
8869 echo " "
8870 echo "Checking the availability of certain socket constants..." >& 4
8871 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8872         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8873         $cat >try.c <<EOF
8874 #include <sys/types.h>
8875 #include <sys/socket.h>
8876 int main() {
8877     int i = $ENUM;
8878 }
8879 EOF
8880         val="$undef"
8881         set try; if eval $compile; then
8882                 val="$define"
8883         fi
8884         set d_${enum}; eval $setvar
8885         $rm -f try.c try
8886 done
8887
8888 : see if this is a sys/uio.h system
8889 set sys/uio.h i_sysuio
8890 eval $inhdr
8891
8892
8893 echo " "
8894 echo "Checking to see if your system supports struct cmsghdr..." >&4
8895 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8896 eval $hasstruct
8897 case "$d_cmsghdr_s" in
8898 "$define")      echo "Yes, it does."   ;;
8899 *)              echo "No, it doesn't." ;;
8900 esac
8901
8902
8903 : check for const keyword
8904 echo " "
8905 echo 'Checking to see if your C compiler knows about "const"...' >&4
8906 $cat >const.c <<'EOCP'
8907 typedef struct spug { int drokk; } spug;
8908 int main()
8909 {
8910         const char *foo;
8911         const spug y;
8912 }
8913 EOCP
8914 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8915         val="$define"
8916         echo "Yup, it does."
8917 else
8918         val="$undef"
8919         echo "Nope, it doesn't."
8920 fi
8921 set d_const
8922 eval $setvar
8923
8924 : see if crypt exists
8925 echo " "
8926 if set crypt val -f d_crypt; eval $csym; $val; then
8927         echo 'crypt() found.' >&4
8928         val="$define"
8929         cryptlib=''
8930 else
8931         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8932         if $test -z "$cryptlib"; then
8933                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8934         else
8935                 cryptlib=-lcrypt
8936         fi
8937         if $test -z "$cryptlib"; then
8938                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8939         else
8940                 cryptlib=-lcrypt
8941         fi
8942         if $test -z "$cryptlib"; then
8943                 cryptlib=`./loc libcrypt$_a "" $libpth`
8944         else
8945                 cryptlib=-lcrypt
8946         fi
8947         if $test -z "$cryptlib"; then
8948                 echo 'crypt() NOT found.' >&4
8949                 val="$undef"
8950         else
8951                 val="$define"
8952         fi
8953 fi
8954 set d_crypt
8955 eval $setvar
8956
8957 : get csh whereabouts
8958 case "$csh" in
8959 'csh') val="$undef" ;;
8960 *) val="$define" ;;
8961 esac
8962 set d_csh
8963 eval $setvar
8964 : Respect a hint or command line value for full_csh.
8965 case "$full_csh" in
8966 '') full_csh=$csh ;;
8967 esac
8968
8969 : see if cuserid exists
8970 set cuserid d_cuserid
8971 eval $inlibc
8972
8973 : see if this is a limits.h system
8974 set limits.h i_limits
8975 eval $inhdr
8976
8977 : see if this is a float.h system
8978 set float.h i_float
8979 eval $inhdr
8980
8981 : See if number of significant digits in a double precision number is known
8982 echo " "
8983 $cat >dbl_dig.c <<EOM
8984 #$i_limits I_LIMITS
8985 #$i_float I_FLOAT
8986 #ifdef I_LIMITS
8987 #include <limits.h>
8988 #endif
8989 #ifdef I_FLOAT
8990 #include <float.h>
8991 #endif
8992 #ifdef DBL_DIG
8993 printf("Contains DBL_DIG");
8994 #endif
8995 EOM
8996 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8997 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8998         echo "DBL_DIG found." >&4
8999         val="$define"
9000 else
9001         echo "DBL_DIG NOT found." >&4
9002         val="$undef"
9003 fi
9004 $rm -f dbl_dig.?
9005 set d_dbl_dig
9006 eval $setvar
9007
9008 : see if difftime exists
9009 set difftime d_difftime
9010 eval $inlibc
9011
9012 : see if this is a dirent system
9013 echo " "
9014 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9015         val="$define"
9016         echo "<dirent.h> found." >&4
9017 else
9018         val="$undef"
9019         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9020                 echo "<sys/dir.h> found." >&4
9021                 echo " "
9022         else
9023                 xinc=`./findhdr sys/ndir.h`
9024         fi
9025         echo "<dirent.h> NOT found." >&4
9026 fi
9027 set i_dirent
9028 eval $setvar
9029
9030 : Look for type of directory structure.
9031 echo " "
9032 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9033
9034 case "$direntrytype" in
9035 ''|' ')
9036         case "$i_dirent" in
9037         $define) guess1='struct dirent' ;;
9038         *) guess1='struct direct'  ;;
9039         esac
9040         ;;
9041 *)      guess1="$direntrytype"
9042         ;;
9043 esac
9044
9045 case "$guess1" in
9046 'struct dirent') guess2='struct direct' ;;
9047 *) guess2='struct dirent' ;;
9048 esac
9049                 
9050 if $contains "$guess1" try.c >/dev/null 2>&1; then
9051         direntrytype="$guess1"
9052         echo "Your directory entries are $direntrytype." >&4
9053 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9054         direntrytype="$guess2"
9055         echo "Your directory entries seem to be $direntrytype." >&4
9056 else
9057         echo "I don't recognize your system's directory entries." >&4
9058         rp="What type is used for directory entries on this system?"
9059         dflt="$guess1"
9060         . ./myread
9061         direntrytype="$ans"
9062 fi
9063 $rm -f try.c
9064
9065
9066 : see if the directory entry stores field length
9067 echo " "
9068 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9069 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9070         echo "Good, your directory entry keeps length information in d_namlen." >&4
9071         val="$define"
9072 else
9073         echo "Your directory entry does not know about the d_namlen field." >&4
9074         val="$undef"
9075 fi
9076 set d_dirnamlen
9077 eval $setvar
9078 $rm -f try.c
9079
9080 : see if dlerror exists
9081 xxx_runnm="$runnm"
9082 runnm=false
9083 set dlerror d_dlerror
9084 eval $inlibc
9085 runnm="$xxx_runnm"
9086
9087 : see if dlfcn is available
9088 set dlfcn.h i_dlfcn
9089 eval $inhdr
9090
9091 case "$usedl" in
9092 $define|y|true)
9093         $cat << EOM
9094
9095 On a few systems, the dynamically loaded modules that perl generates and uses
9096 will need a different extension than shared libs. The default will probably
9097 be appropriate.
9098
9099 EOM
9100         case "$dlext" in
9101         '')     dflt="$so" ;;
9102         *)      dflt="$dlext" ;;
9103         esac
9104         rp='What is the extension of dynamically loaded modules'
9105         . ./myread
9106         dlext="$ans"
9107         ;;
9108 *)
9109         dlext="none"
9110         ;;
9111 esac
9112
9113 : Check if dlsym need a leading underscore
9114 echo " "
9115 val="$undef"
9116
9117 case "$dlsrc" in
9118 dl_dlopen.xs)
9119         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9120         $cat >dyna.c <<'EOM'
9121 fred () { }
9122 EOM
9123
9124 $cat >fred.c<<EOM
9125
9126 #include <stdio.h>
9127 #$i_dlfcn I_DLFCN
9128 #ifdef I_DLFCN
9129 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9130 #else
9131 #include <sys/types.h>
9132 #include <nlist.h>
9133 #include <link.h>
9134 #endif
9135
9136 extern int fred() ;
9137
9138 int main()
9139 {
9140     void * handle ;
9141     void * symbol ;
9142 #ifndef RTLD_LAZY
9143     int mode = 1 ;
9144 #else
9145     int mode = RTLD_LAZY ;
9146 #endif
9147     handle = dlopen("./dyna.$dlext", mode) ;
9148     if (handle == NULL) {
9149         printf ("1\n") ;
9150         fflush (stdout) ;
9151         exit(0);
9152     }
9153     symbol = dlsym(handle, "fred") ;
9154     if (symbol == NULL) {
9155         /* try putting a leading underscore */
9156         symbol = dlsym(handle, "_fred") ;
9157         if (symbol == NULL) {
9158             printf ("2\n") ;
9159             fflush (stdout) ;
9160             exit(0);
9161         }
9162         printf ("3\n") ;
9163     }
9164     else
9165         printf ("4\n") ;
9166     fflush (stdout) ;
9167     exit(0);
9168 }
9169 EOM
9170         : Call the object file tmp-dyna.o in case dlext=o.
9171         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9172                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9173                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9174                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9175                 xxx=`./fred`
9176                 case $xxx in
9177                 1)      echo "Test program failed using dlopen." >&4
9178                         echo "Perhaps you should not use dynamic loading." >&4;;
9179                 2)      echo "Test program failed using dlsym." >&4
9180                         echo "Perhaps you should not use dynamic loading." >&4;;
9181                 3)      echo "dlsym needs a leading underscore" >&4
9182                         val="$define" ;;
9183                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9184                 esac
9185         else
9186                 echo "I can't compile and run the test program." >&4
9187                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9188         fi
9189         ;;
9190 esac
9191                 
9192 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9193
9194 set d_dlsymun
9195 eval $setvar
9196
9197 hasproto='varname=$1; func=$2; shift; shift;
9198 while $test $# -ge 2; do
9199         case "$1" in
9200         $define) echo "#include <$2>";;
9201         esac ;
9202     shift 2;
9203 done > try.c;
9204 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9205 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9206         echo "$func() prototype found.";
9207         val="$define";
9208 else
9209         echo "$func() prototype NOT found.";
9210         val="$undef";
9211 fi;
9212 set $varname;
9213 eval $setvar;
9214 $rm -f try.c tryout.c'
9215
9216 : see if prototype for drand48 is available
9217 echo " "
9218 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9219 eval $hasproto
9220
9221 : see if dup2 exists
9222 set dup2 d_dup2
9223 eval $inlibc
9224
9225 : see if eaccess exists
9226 set eaccess d_eaccess
9227 eval $inlibc
9228
9229 : see if endgrent exists
9230 set endgrent d_endgrent
9231 eval $inlibc
9232
9233 : see if endhostent exists
9234 set endhostent d_endhent
9235 eval $inlibc
9236
9237 : see if endnetent exists
9238 set endnetent d_endnent
9239 eval $inlibc
9240
9241 : see if endprotoent exists
9242 set endprotoent d_endpent
9243 eval $inlibc
9244
9245 : see if endpwent exists
9246 set endpwent d_endpwent
9247 eval $inlibc
9248
9249 : see if endservent exists
9250 set endservent d_endsent
9251 eval $inlibc
9252
9253 : Locate the flags for 'open()'
9254 echo " "
9255 $cat >open3.c <<'EOCP'
9256 #include <sys/types.h>
9257 #ifdef I_FCNTL
9258 #include <fcntl.h>
9259 #endif
9260 #ifdef I_SYS_FILE
9261 #include <sys/file.h>
9262 #endif
9263 int main() {
9264         if(O_RDONLY);
9265 #ifdef O_TRUNC
9266         exit(0);
9267 #else
9268         exit(1);
9269 #endif
9270 }
9271 EOCP
9272 : check sys/file.h first to get FREAD on Sun
9273 if $test `./findhdr sys/file.h` && \
9274                 set open3 -DI_SYS_FILE && eval $compile; then
9275         h_sysfile=true;
9276         echo "<sys/file.h> defines the O_* constants..." >&4
9277         if ./open3; then
9278                 echo "and you have the 3 argument form of open()." >&4
9279                 val="$define"
9280         else
9281                 echo "but not the 3 argument form of open().  Oh, well." >&4
9282                 val="$undef"
9283         fi
9284 elif $test `./findhdr fcntl.h` && \
9285                 set open3 -DI_FCNTL && eval $compile; then
9286         h_fcntl=true;
9287         echo "<fcntl.h> defines the O_* constants..." >&4
9288         if ./open3; then
9289                 echo "and you have the 3 argument form of open()." >&4
9290                 val="$define"
9291         else
9292                 echo "but not the 3 argument form of open().  Oh, well." >&4
9293                 val="$undef"
9294         fi
9295 else
9296         val="$undef"
9297         echo "I can't find the O_* constant definitions!  You got problems." >&4
9298 fi
9299 set d_open3
9300 eval $setvar
9301 $rm -f open3*
9302
9303 : see which of string.h or strings.h is needed
9304 echo " "
9305 strings=`./findhdr string.h`
9306 if $test "$strings" && $test -r "$strings"; then
9307         echo "Using <string.h> instead of <strings.h>." >&4
9308         val="$define"
9309 else
9310         val="$undef"
9311         strings=`./findhdr strings.h`
9312         if $test "$strings" && $test -r "$strings"; then
9313                 echo "Using <strings.h> instead of <string.h>." >&4
9314         else
9315                 echo "No string header found -- You'll surely have problems." >&4
9316         fi
9317 fi
9318 set i_string
9319 eval $setvar
9320 case "$i_string" in
9321 "$undef") strings=`./findhdr strings.h`;;
9322 *)        strings=`./findhdr string.h`;;
9323 esac
9324
9325 : check for non-blocking I/O stuff
9326 case "$h_sysfile" in
9327 true) echo "#include <sys/file.h>" > head.c;;
9328 *)
9329        case "$h_fcntl" in
9330        true) echo "#include <fcntl.h>" > head.c;;
9331        *) echo "#include <sys/fcntl.h>" > head.c;;
9332        esac
9333        ;;
9334 esac
9335 echo " "
9336 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9337 case "$o_nonblock" in
9338 '')
9339         $cat head.c > try.c
9340         $cat >>try.c <<'EOCP'
9341 #include <stdio.h>
9342 int main() {
9343 #ifdef O_NONBLOCK
9344         printf("O_NONBLOCK\n");
9345         exit(0);
9346 #endif
9347 #ifdef O_NDELAY
9348         printf("O_NDELAY\n");
9349         exit(0);
9350 #endif
9351 #ifdef FNDELAY
9352         printf("FNDELAY\n");
9353         exit(0);
9354 #endif
9355         exit(0);
9356 }
9357 EOCP
9358         set try
9359         if eval $compile_ok; then
9360                 o_nonblock=`./try`
9361                 case "$o_nonblock" in
9362                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9363                 *) echo "Seems like we can use $o_nonblock.";;
9364                 esac
9365         else
9366                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9367         fi
9368         ;;
9369 *) echo "Using $hint value $o_nonblock.";;
9370 esac
9371 $rm -f try try.* .out core
9372
9373 echo " "
9374 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9375 case "$eagain" in
9376 '')
9377         $cat head.c > try.c
9378         $cat >>try.c <<EOCP
9379 #include <errno.h>
9380 #include <sys/types.h>
9381 #include <signal.h>
9382 #include <stdio.h> 
9383 #define MY_O_NONBLOCK $o_nonblock
9384 #ifndef errno  /* XXX need better Configure test */
9385 extern int errno;
9386 #endif
9387 #$i_unistd I_UNISTD
9388 #ifdef I_UNISTD
9389 #include <unistd.h>
9390 #endif
9391 #$i_string I_STRING
9392 #ifdef I_STRING
9393 #include <string.h>
9394 #else
9395 #include <strings.h>
9396 #endif
9397 $signal_t blech(x) int x; { exit(3); }
9398 EOCP
9399         $cat >> try.c <<'EOCP'
9400 int main()
9401 {
9402         int pd[2];
9403         int pu[2];
9404         char buf[1];
9405         char string[100];
9406
9407         pipe(pd);       /* Down: child -> parent */
9408         pipe(pu);       /* Up: parent -> child */
9409         if (0 != fork()) {
9410                 int ret;
9411                 close(pd[1]);   /* Parent reads from pd[0] */
9412                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9413 #ifdef F_SETFL
9414                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9415                         exit(1);
9416 #else
9417                 exit(4);
9418 #endif
9419                 signal(SIGALRM, blech);
9420                 alarm(5);
9421                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9422                         exit(2);
9423                 sprintf(string, "%d\n", ret);
9424                 write(2, string, strlen(string));
9425                 alarm(0);
9426 #ifdef EAGAIN
9427                 if (errno == EAGAIN) {
9428                         printf("EAGAIN\n");
9429                         goto ok;
9430                 }
9431 #endif
9432 #ifdef EWOULDBLOCK
9433                 if (errno == EWOULDBLOCK)
9434                         printf("EWOULDBLOCK\n");
9435 #endif
9436         ok:
9437                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9438                 sleep(2);                               /* Give it time to close our pipe */
9439                 alarm(5);
9440                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9441                 alarm(0);
9442                 sprintf(string, "%d\n", ret);
9443                 write(3, string, strlen(string));
9444                 exit(0);
9445         }
9446
9447         close(pd[0]);                   /* We write to pd[1] */
9448         close(pu[1]);                   /* We read from pu[0] */
9449         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9450         close(pd[1]);                   /* Pipe pd is now fully closed! */
9451         exit(0);                                /* Bye bye, thank you for playing! */
9452 }
9453 EOCP
9454         set try
9455         if eval $compile_ok; then
9456                 echo "$startsh" >mtry
9457                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9458                 chmod +x mtry
9459                 ./mtry >/dev/null 2>&1
9460                 case $? in
9461                 0) eagain=`$cat try.out`;;
9462                 1) echo "Could not perform non-blocking setting!";;
9463                 2) echo "I did a successful read() for something that was not there!";;
9464                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9465                 4) echo "Could not find F_SETFL!";;
9466                 *) echo "Something terribly wrong happened during testing.";;
9467                 esac
9468                 rd_nodata=`$cat try.ret`
9469                 echo "A read() system call with no data present returns $rd_nodata."
9470                 case "$rd_nodata" in
9471                 0|-1) ;;
9472                 *)
9473                         echo "(That's peculiar, fixing that to be -1.)"
9474                         rd_nodata=-1
9475                         ;;
9476                 esac
9477                 case "$eagain" in
9478                 '')
9479                         echo "Forcing errno EAGAIN on read() with no data available."
9480                         eagain=EAGAIN
9481                         ;;
9482                 *)
9483                         echo "Your read() sets errno to $eagain when no data is available."
9484                         ;;
9485                 esac
9486                 status=`$cat try.err`
9487                 case "$status" in
9488                 0) echo "And it correctly returns 0 to signal EOF.";;
9489                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9490                 *) echo "However, your read() returns '$status' on EOF??";;
9491                 esac
9492                 val="$define"
9493                 if test "$status" = "$rd_nodata"; then
9494                         echo "WARNING: you can't distinguish between EOF and no data!"
9495                         val="$undef"
9496                 fi
9497         else
9498                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9499                 eagain=EAGAIN
9500         fi
9501         set d_eofnblk
9502         eval $setvar
9503         ;;
9504 *)
9505         echo "Using $hint value $eagain."
9506         echo "Your read() returns $rd_nodata when no data is present."
9507         case "$d_eofnblk" in
9508         "$define") echo "And you can see EOF because read() returns 0.";;
9509         "$undef") echo "But you can't see EOF status from read() returned value.";;
9510         *)
9511                 echo "(Assuming you can't see EOF status from read anyway.)"
9512                 d_eofnblk=$undef
9513                 ;;
9514         esac
9515         ;;
9516 esac
9517 $rm -f try try.* .out core head.c mtry
9518
9519 : see if fchmod exists
9520 set fchmod d_fchmod
9521 eval $inlibc
9522
9523 : see if fchown exists
9524 set fchown d_fchown
9525 eval $inlibc
9526
9527 : see if this is an fcntl system
9528 set fcntl d_fcntl
9529 eval $inlibc
9530
9531 echo " "
9532 : See if fcntl-based locking works.
9533 $cat >try.c <<'EOCP'
9534 #include <stdlib.h>
9535 #include <unistd.h>
9536 #include <fcntl.h>
9537 int main() {
9538 #if defined(F_SETLK) && defined(F_SETLKW)
9539      struct flock flock;
9540      int retval, fd;
9541      fd = open("try.c", O_RDONLY);
9542      flock.l_type = F_RDLCK;
9543      flock.l_whence = SEEK_SET;
9544      flock.l_start = flock.l_len = 0;
9545      retval = fcntl(fd, F_SETLK, &flock);
9546      close(fd);
9547      (retval < 0 ? exit(2) : exit(0));
9548 #else
9549      exit(2);
9550 #endif
9551 }
9552 EOCP
9553 echo "Checking if fcntl-based file locking works... "
9554 case "$d_fcntl" in
9555 "$define")
9556         set try
9557         if eval $compile_ok; then
9558                 if ./try; then
9559                         echo "Yes, it seems to work."
9560                         val="$define"
9561                 else
9562                         echo "Nope, it didn't work."
9563                         val="$undef"
9564                 fi
9565         else
9566                 echo "I'm unable to compile the test program, so I'll assume not."
9567                 val="$undef"
9568         fi
9569         ;;
9570 *) val="$undef";
9571         echo "Nope, since you don't even have fcntl()."
9572         ;;
9573 esac
9574 set d_fcntl_can_lock
9575 eval $setvar
9576 $rm -f try*
9577
9578
9579 : see if sys/select.h has to be included
9580 set sys/select.h i_sysselct
9581 eval $inhdr
9582
9583 : see if we should include time.h, sys/time.h, or both
9584 echo " "
9585 if test "X$timeincl" = X; then
9586         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9587         $echo $n "I'm now running the test program...$c"
9588         $cat >try.c <<'EOCP'
9589 #include <sys/types.h>
9590 #ifdef I_TIME
9591 #include <time.h>
9592 #endif
9593 #ifdef I_SYSTIME
9594 #ifdef SYSTIMEKERNEL
9595 #define KERNEL
9596 #endif
9597 #include <sys/time.h>
9598 #endif
9599 #ifdef I_SYSSELECT
9600 #include <sys/select.h>
9601 #endif
9602 int main()
9603 {
9604         struct tm foo;
9605 #ifdef S_TIMEVAL
9606         struct timeval bar;
9607 #endif
9608 #ifdef S_TIMEZONE
9609         struct timezone tzp;
9610 #endif
9611         if (foo.tm_sec == foo.tm_sec)
9612                 exit(0);
9613 #ifdef S_TIMEVAL
9614         if (bar.tv_sec == bar.tv_sec)
9615                 exit(0);
9616 #endif
9617         exit(1);
9618 }
9619 EOCP
9620         flags=''
9621         for s_timezone in '-DS_TIMEZONE' ''; do
9622         sysselect=''
9623         for s_timeval in '-DS_TIMEVAL' ''; do
9624         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9625         for i_time in '' '-DI_TIME'; do
9626         for i_systime in '-DI_SYSTIME' ''; do
9627                 case "$flags" in
9628                 '') $echo $n ".$c"
9629                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9630                         if eval $compile; then
9631                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9632                                 shift
9633                                 flags="$*"
9634                                 echo " "
9635                                 $echo $n "Succeeded with $flags$c"
9636                         fi
9637                         ;;
9638                 esac
9639         done
9640         done
9641         done
9642         done
9643         done
9644         timeincl=''
9645         echo " "
9646         case "$flags" in
9647         *SYSTIMEKERNEL*) i_systimek="$define"
9648                 timeincl=`./findhdr sys/time.h`
9649                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9650         *) i_systimek="$undef";;
9651         esac
9652         case "$flags" in
9653         *I_TIME*) i_time="$define"
9654                 timeincl=`./findhdr time.h`" $timeincl"
9655                 echo "We'll include <time.h>." >&4;;
9656         *) i_time="$undef";;
9657         esac
9658         case "$flags" in
9659         *I_SYSTIME*) i_systime="$define"
9660                 timeincl=`./findhdr sys/time.h`" $timeincl"
9661                 echo "We'll include <sys/time.h>." >&4;;
9662         *) i_systime="$undef";;
9663         esac
9664         $rm -f try.c try
9665 fi
9666
9667 : check for fd_set items
9668 $cat <<EOM
9669
9670 Checking to see how well your C compiler handles fd_set and friends ...
9671 EOM
9672 $cat >fd_set.c <<EOCP
9673 #$i_systime I_SYS_TIME
9674 #$i_sysselct I_SYS_SELECT
9675 #$d_socket HAS_SOCKET
9676 #include <sys/types.h>
9677 #ifdef HAS_SOCKET
9678 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9679 #endif
9680 #ifdef I_SYS_TIME
9681 #include <sys/time.h>
9682 #endif
9683 #ifdef I_SYS_SELECT
9684 #include <sys/select.h>
9685 #endif
9686 int main() {
9687         fd_set fds;
9688
9689 #ifdef TRYBITS
9690         if(fds.fds_bits);
9691 #endif
9692
9693 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9694         exit(0);
9695 #else
9696         exit(1);
9697 #endif
9698 }
9699 EOCP
9700 set fd_set -DTRYBITS
9701 if eval $compile; then
9702         d_fds_bits="$define"
9703         d_fd_set="$define"
9704         echo "Well, your system knows about the normal fd_set typedef..." >&4
9705         if ./fd_set; then
9706                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9707                 d_fd_macros="$define"
9708         else
9709                 $cat >&4 <<'EOM'
9710 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9711 EOM
9712                 d_fd_macros="$undef"
9713         fi
9714 else
9715         $cat <<'EOM'
9716 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9717 EOM
9718         set fd_set
9719         if eval $compile; then
9720                 d_fds_bits="$undef"
9721                 d_fd_set="$define"
9722                 echo "Well, your system has some sort of fd_set available..." >&4
9723                 if ./fd_set; then
9724                         echo "and you have the normal fd_set macros." >&4
9725                         d_fd_macros="$define"
9726                 else
9727                         $cat <<'EOM'
9728 but not the normal fd_set macros!  Gross!  More work for me...
9729 EOM
9730                         d_fd_macros="$undef"
9731                 fi
9732         else
9733         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9734                 d_fd_set="$undef"
9735                 d_fds_bits="$undef"
9736                 d_fd_macros="$undef"
9737         fi
9738 fi
9739 $rm -f fd_set*
9740
9741 : see if fgetpos exists
9742 set fgetpos d_fgetpos
9743 eval $inlibc
9744
9745 : see if flock exists
9746 set flock d_flock
9747 eval $inlibc
9748
9749 : see if fork exists
9750 set fork d_fork
9751 eval $inlibc
9752
9753 : see if pathconf exists
9754 set pathconf d_pathconf
9755 eval $inlibc
9756
9757 : see if fpathconf exists
9758 set fpathconf d_fpathconf
9759 eval $inlibc
9760
9761
9762 : check for fpos64_t
9763 echo " "
9764 echo "Checking to see if you have fpos64_t..." >&4
9765 $cat >try.c <<EOCP
9766 #include <stdio.h>
9767 int main() { fpos64_t x = 7; }
9768 EOCP
9769 set try
9770 if eval $compile; then
9771         val="$define"
9772         echo "You have fpos64_t."
9773 else
9774         val="$undef"
9775         echo "You do not have fpos64_t."
9776         case "$fpossize" in
9777         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9778         esac
9779 fi
9780 $rm -f try.* try
9781 set d_fpos64_t
9782 eval $setvar
9783
9784 : see if frexpl exists
9785 set frexpl d_frexpl
9786 eval $inlibc
9787
9788 : see if this is a sys/param system
9789 set sys/param.h i_sysparam
9790 eval $inhdr
9791
9792 : see if this is a sys/mount.h system
9793 set sys/mount.h i_sysmount
9794 eval $inhdr
9795
9796
9797 echo " "
9798 echo "Checking to see if your system supports struct fs_data..." >&4
9799 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9800 eval $hasstruct
9801 case "$d_fs_data_s" in
9802 "$define")      echo "Yes, it does."   ;;
9803 *)              echo "No, it doesn't." ;;
9804 esac
9805
9806 : see if fseeko exists
9807 set fseeko d_fseeko
9808 eval $inlibc
9809 case "$longsize" in
9810 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9811 esac
9812
9813 : see if fsetpos exists
9814 set fsetpos d_fsetpos
9815 eval $inlibc
9816
9817
9818 : see if fstatfs exists
9819 set fstatfs d_fstatfs
9820 eval $inlibc
9821
9822
9823 : see if statvfs exists
9824 set statvfs d_statvfs
9825 eval $inlibc
9826
9827 : see if fstatvfs exists
9828 set fstatvfs d_fstatvfs
9829 eval $inlibc
9830
9831
9832 : see if fsync exists
9833 set fsync d_fsync
9834 eval $inlibc
9835
9836 : see if ftello exists
9837 set ftello d_ftello
9838 eval $inlibc
9839 case "$longsize" in
9840 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9841 esac
9842
9843 : see if getcwd exists
9844 set getcwd d_getcwd
9845 eval $inlibc
9846
9847 : see if getespwnam exists
9848 set getespwnam d_getespwnam
9849 eval $inlibc
9850
9851
9852 : see if getfsstat exists
9853 set getfsstat d_getfsstat
9854 eval $inlibc
9855
9856 : see if getgrent exists
9857 set getgrent d_getgrent
9858 eval $inlibc
9859
9860 : see if gethostbyaddr exists
9861 set gethostbyaddr d_gethbyaddr
9862 eval $inlibc
9863
9864 : see if gethostbyname exists
9865 set gethostbyname d_gethbyname
9866 eval $inlibc
9867
9868 : see if gethostent exists
9869 set gethostent d_gethent
9870 eval $inlibc
9871
9872 : see how we will look up host name
9873 echo " "
9874 call=''
9875 if set gethostname val -f d_gethname; eval $csym; $val; then
9876         echo 'gethostname() found.' >&4
9877         d_gethname="$define"
9878         call=gethostname
9879 fi
9880 if set uname val -f d_uname; eval $csym; $val; then
9881         if ./xenix; then
9882                 $cat <<'EOM'
9883 uname() was found, but you're running xenix, and older versions of xenix
9884 have a broken uname(). If you don't really know whether your xenix is old
9885 enough to have a broken system call, use the default answer.
9886
9887 EOM
9888                 dflt=y
9889                 case "$d_uname" in
9890                 "$define") dflt=n;;
9891                 esac
9892                 rp='Is your uname() broken?'
9893                 . ./myread
9894                 case "$ans" in
9895                 n*) d_uname="$define"; call=uname;;
9896                 esac
9897         else
9898                 echo 'uname() found.' >&4
9899                 d_uname="$define"
9900                 case "$call" in
9901                 '') call=uname ;;
9902                 esac
9903         fi
9904 fi
9905 case "$d_gethname" in
9906 '') d_gethname="$undef";;
9907 esac
9908 case "$d_uname" in
9909 '') d_uname="$undef";;
9910 esac
9911 case "$d_uname$d_gethname" in
9912 *define*)
9913         dflt=n
9914         cat <<EOM
9915  
9916 Every now and then someone has a $call() that lies about the hostname
9917 but can't be fixed for political or economic reasons.  If you wish, I can
9918 pretend $call() isn't there and maybe compute hostname at run-time
9919 thanks to the '$phostname' command.
9920
9921 EOM
9922         rp="Shall I ignore $call() from now on?"
9923         . ./myread
9924         case "$ans" in
9925         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9926         esac;;
9927 esac
9928 case "$phostname" in
9929 '') aphostname='';;
9930 *) case "$aphostname" in
9931         /*) ;;
9932         *) set X $phostname
9933                 shift
9934                 file=$1
9935                 shift
9936                 file=`./loc $file $file $pth`
9937                 aphostname=`echo $file $*`
9938                 ;;
9939         esac
9940         ;;
9941 esac
9942 case "$d_uname$d_gethname" in
9943 *define*) ;;
9944 *)
9945         case "$phostname" in
9946         '')
9947                 echo "There will be no way for $package to get your hostname." >&4;;
9948         *)
9949         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9950                 ;;
9951         esac;;
9952 esac
9953 case "$d_phostname" in
9954 '') d_phostname="$undef";;
9955 esac
9956
9957 : see if this is a netdb.h system
9958 set netdb.h i_netdb
9959 eval $inhdr
9960
9961 : see if prototypes for various gethostxxx netdb.h functions are available
9962 echo " "
9963 set d_gethostprotos gethostent $i_netdb netdb.h
9964 eval $hasproto
9965
9966 : see if getitimer exists
9967 set getitimer d_getitimer
9968 eval $inlibc
9969
9970 : see if getlogin exists
9971 set getlogin d_getlogin
9972 eval $inlibc
9973
9974 : see if getmnt exists
9975 set getmnt d_getmnt
9976 eval $inlibc
9977
9978 : see if getmntent exists
9979 set getmntent d_getmntent
9980 eval $inlibc
9981
9982 : see if getnetbyaddr exists
9983 set getnetbyaddr d_getnbyaddr
9984 eval $inlibc
9985
9986 : see if getnetbyname exists
9987 set getnetbyname d_getnbyname
9988 eval $inlibc
9989
9990 : see if getnetent exists
9991 set getnetent d_getnent
9992 eval $inlibc
9993
9994 : see if prototypes for various getnetxxx netdb.h functions are available
9995 echo " "
9996 set d_getnetprotos getnetent $i_netdb netdb.h
9997 eval $hasproto
9998
9999 : see if getpagesize exists
10000 set getpagesize d_getpagsz
10001 eval $inlibc
10002
10003
10004 : see if getprotobyname exists
10005 set getprotobyname d_getpbyname
10006 eval $inlibc
10007
10008 : see if getprotobynumber exists
10009 set getprotobynumber d_getpbynumber
10010 eval $inlibc
10011
10012 : see if getprotoent exists
10013 set getprotoent d_getpent
10014 eval $inlibc
10015
10016 : see if getpgid exists
10017 set getpgid d_getpgid
10018 eval $inlibc
10019
10020 : see if getpgrp2 exists
10021 set getpgrp2 d_getpgrp2
10022 eval $inlibc
10023
10024 : see if getppid exists
10025 set getppid d_getppid
10026 eval $inlibc
10027
10028 : see if getpriority exists
10029 set getpriority d_getprior
10030 eval $inlibc
10031
10032 : see if prototypes for various getprotoxxx netdb.h functions are available
10033 echo " "
10034 set d_getprotoprotos getprotoent $i_netdb netdb.h
10035 eval $hasproto
10036
10037 : see if getprpwnam exists
10038 set getprpwnam d_getprpwnam
10039 eval $inlibc
10040
10041 : see if getpwent exists
10042 set getpwent d_getpwent
10043 eval $inlibc
10044
10045
10046 : see if getservbyname exists
10047 set getservbyname d_getsbyname
10048 eval $inlibc
10049
10050 : see if getservbyport exists
10051 set getservbyport d_getsbyport
10052 eval $inlibc
10053
10054 : see if getservent exists
10055 set getservent d_getsent
10056 eval $inlibc
10057
10058 : see if prototypes for various getservxxx netdb.h functions are available
10059 echo " "
10060 set d_getservprotos getservent $i_netdb netdb.h
10061 eval $hasproto
10062
10063 : see if getspnam exists
10064 set getspnam d_getspnam
10065 eval $inlibc
10066
10067 : see if gettimeofday or ftime exists
10068 set gettimeofday d_gettimeod
10069 eval $inlibc
10070 case "$d_gettimeod" in
10071 "$undef")
10072         set ftime d_ftime 
10073         eval $inlibc
10074         ;;
10075 *)
10076         val="$undef"; set d_ftime; eval $setvar
10077         ;;
10078 esac
10079 case "$d_gettimeod$d_ftime" in
10080 "$undef$undef")
10081         echo " "
10082         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10083         ;;
10084 esac
10085
10086 : see if this is an grp system
10087 set grp.h i_grp
10088 eval $inhdr
10089
10090 case "$i_grp" in
10091 $define)
10092         xxx=`./findhdr grp.h`
10093         $cppstdin $cppflags $cppminus < $xxx >$$.h
10094
10095         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10096                 val="$define"
10097         else
10098                 val="$undef"
10099         fi
10100         set d_grpasswd
10101         eval $setvar
10102
10103         $rm -f $$.h
10104         ;;
10105 *)
10106         val="$undef";
10107         set d_grpasswd; eval $setvar
10108         ;;
10109 esac
10110
10111 : see if hasmntopt exists
10112 set hasmntopt d_hasmntopt
10113 eval $inlibc
10114
10115 : see if this is a netinet/in.h or sys/in.h system
10116 set netinet/in.h i_niin sys/in.h i_sysin
10117 eval $inhdr
10118
10119 : see if arpa/inet.h has to be included
10120 set arpa/inet.h i_arpainet
10121 eval $inhdr
10122
10123 : see if htonl --and friends-- exists
10124 val=''
10125 set htonl val
10126 eval $inlibc
10127
10128 : Maybe they are macros.
10129 case "$val" in
10130 $undef)
10131         $cat >htonl.c <<EOM
10132 #include <stdio.h>
10133 #include <sys/types.h>
10134 #$i_niin I_NETINET_IN
10135 #$i_sysin I_SYS_IN
10136 #$i_arpainet I_ARPA_INET
10137 #ifdef I_NETINET_IN
10138 #include <netinet/in.h>
10139 #endif
10140 #ifdef I_SYS_IN
10141 #include <sys/in.h>
10142 #endif
10143 #ifdef I_ARPA_INET
10144 #include <arpa/inet.h>
10145 #endif
10146 #ifdef htonl
10147 printf("Defined as a macro.");
10148 #endif
10149 EOM
10150         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10151         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10152                 val="$define"
10153                 echo "But it seems to be defined as a macro." >&4
10154         fi
10155         $rm -f htonl.?
10156         ;;
10157 esac
10158 set d_htonl
10159 eval $setvar
10160
10161 : see if iconv exists
10162 set iconv d_iconv
10163 eval $inlibc
10164
10165 : index or strchr
10166 echo " "
10167 if set index val -f; eval $csym; $val; then
10168         if set strchr val -f d_strchr; eval $csym; $val; then
10169                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10170                         val="$define"
10171                         vali="$undef"
10172                         echo "strchr() found." >&4
10173                 else
10174                         val="$undef"
10175                         vali="$define"
10176                         echo "index() found." >&4
10177                 fi
10178         else
10179                 val="$undef"
10180                 vali="$define"
10181                 echo "index() found." >&4
10182         fi
10183 else
10184         if set strchr val -f d_strchr; eval $csym; $val; then
10185                 val="$define"
10186                 vali="$undef"
10187                 echo "strchr() found." >&4
10188         else
10189                 echo "No index() or strchr() found!" >&4
10190                 val="$undef"
10191                 vali="$undef"
10192         fi
10193 fi
10194 set d_strchr; eval $setvar
10195 val="$vali"
10196 set d_index; eval $setvar
10197
10198 : check whether inet_aton exists
10199 set inet_aton d_inetaton
10200 eval $inlibc
10201
10202 : Look for isascii
10203 echo " "
10204 $cat >isascii.c <<'EOCP'
10205 #include <stdio.h>
10206 #include <ctype.h>
10207 int main() {
10208         int c = 'A';
10209         if (isascii(c))
10210                 exit(0);
10211         else
10212                 exit(1);
10213 }
10214 EOCP
10215 set isascii
10216 if eval $compile; then
10217         echo "isascii() found." >&4
10218         val="$define"
10219 else
10220         echo "isascii() NOT found." >&4
10221         val="$undef"
10222 fi
10223 set d_isascii
10224 eval $setvar
10225 $rm -f isascii*
10226
10227 : see if isnan exists
10228 set isnan d_isnan
10229 eval $inlibc
10230
10231 : see if isnanl exists
10232 set isnanl d_isnanl
10233 eval $inlibc
10234
10235 : see if killpg exists
10236 set killpg d_killpg
10237 eval $inlibc
10238
10239 : see if lchown exists
10240 echo " "
10241 $cat > try.c <<'EOCP'
10242 /* System header to define __stub macros and hopefully few prototypes,
10243     which can conflict with char lchown(); below.  */
10244 #include <assert.h>
10245 /* Override any gcc2 internal prototype to avoid an error.  */
10246 /* We use char because int might match the return type of a gcc2
10247    builtin and then its argument prototype would still apply.  */
10248 char lchown();
10249 int main() {
10250     /*  The GNU C library defines this for functions which it implements
10251         to always fail with ENOSYS.  Some functions are actually named
10252         something starting with __ and the normal name is an alias.  */
10253 #if defined (__stub_lchown) || defined (__stub___lchown)
10254 choke me
10255 #else
10256 lchown();
10257 #endif
10258 ; return 0; }
10259 EOCP
10260 set try
10261 if eval $compile; then
10262     $echo "lchown() found." >&4
10263     val="$define"
10264 else
10265     $echo "lchown() NOT found." >&4
10266     val="$undef"
10267 fi
10268 set d_lchown
10269 eval $setvar
10270
10271 : See if number of significant digits in a double precision number is known
10272 echo " "
10273 $cat >ldbl_dig.c <<EOM
10274 #$i_limits I_LIMITS
10275 #$i_float I_FLOAT
10276 #ifdef I_LIMITS
10277 #include <limits.h>
10278 #endif
10279 #ifdef I_FLOAT
10280 #include <float.h>
10281 #endif
10282 #ifdef LDBL_DIG
10283 printf("Contains LDBL_DIG");
10284 #endif
10285 EOM
10286 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10287 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10288         echo "LDBL_DIG found." >&4
10289         val="$define"
10290 else
10291         echo "LDBL_DIG NOT found." >&4
10292         val="$undef"
10293 fi
10294 $rm -f ldbl_dig.?
10295 set d_ldbl_dig
10296 eval $setvar
10297
10298 : see if link exists
10299 set link d_link
10300 eval $inlibc
10301
10302 : see if localeconv exists
10303 set localeconv d_locconv
10304 eval $inlibc
10305
10306 : see if lockf exists
10307 set lockf d_lockf
10308 eval $inlibc
10309
10310 : see if prototype for lseek is available
10311 echo " "
10312 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10313 eval $hasproto
10314
10315 : see if lstat exists
10316 set lstat d_lstat
10317 eval $inlibc
10318
10319 : see if madvise exists
10320 set madvise d_madvise
10321 eval $inlibc
10322
10323 : see if mblen exists
10324 set mblen d_mblen
10325 eval $inlibc
10326
10327 : see if mbstowcs exists
10328 set mbstowcs d_mbstowcs
10329 eval $inlibc
10330
10331 : see if mbtowc exists
10332 set mbtowc d_mbtowc
10333 eval $inlibc
10334
10335 : see if memchr exists
10336 set memchr d_memchr
10337 eval $inlibc
10338
10339 : see if memcmp exists
10340 set memcmp d_memcmp
10341 eval $inlibc
10342
10343 : see if memcpy exists
10344 set memcpy d_memcpy
10345 eval $inlibc
10346
10347 : see if memmove exists
10348 set memmove d_memmove
10349 eval $inlibc
10350
10351 : see if memset exists
10352 set memset d_memset
10353 eval $inlibc
10354
10355 : see if mkdir exists
10356 set mkdir d_mkdir
10357 eval $inlibc
10358
10359 : see if mkdtemp exists
10360 set mkdtemp d_mkdtemp
10361 eval $inlibc
10362
10363 : see if mkfifo exists
10364 set mkfifo d_mkfifo
10365 eval $inlibc
10366
10367 : see if mkstemp exists
10368 set mkstemp d_mkstemp
10369 eval $inlibc
10370
10371 : see if mkstemps exists
10372 set mkstemps d_mkstemps
10373 eval $inlibc
10374
10375 : see if mktime exists
10376 set mktime d_mktime
10377 eval $inlibc
10378
10379 : see if this is a sys/mman.h system
10380 set sys/mman.h i_sysmman
10381 eval $inhdr
10382
10383 : see if mmap exists
10384 set mmap d_mmap
10385 eval $inlibc
10386 : see what shmat returns
10387 : default to something harmless
10388 mmaptype='void *'
10389 case "$i_sysmman$d_mmap" in
10390 "$define$define")
10391         $cat >mmap.c <<'END'
10392 #include <sys/mman.h>
10393 void *mmap();
10394 END
10395         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10396                 mmaptype='void *'
10397         else
10398                 mmaptype='caddr_t'
10399         fi
10400         echo "and it returns ($mmaptype)." >&4
10401         ;;
10402 esac
10403
10404
10405
10406 : see if modfl exists
10407 set modfl d_modfl
10408 eval $inlibc
10409
10410 : see if mprotect exists
10411 set mprotect d_mprotect
10412 eval $inlibc
10413
10414 : see if msgctl exists
10415 set msgctl d_msgctl
10416 eval $inlibc
10417
10418 : see if msgget exists
10419 set msgget d_msgget
10420 eval $inlibc
10421
10422 : see if msgsnd exists
10423 set msgsnd d_msgsnd
10424 eval $inlibc
10425
10426 : see if msgrcv exists
10427 set msgrcv d_msgrcv
10428 eval $inlibc
10429
10430 : see how much of the 'msg*(2)' library is present.
10431 h_msg=true
10432 echo " "
10433 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10434 *"$undef"*) h_msg=false;;
10435 esac
10436 case "$osname" in
10437 freebsd)
10438     case "`ipcs 2>&1`" in
10439     "SVID messages"*"not configured"*)
10440         echo "Your $osname does not have the msg*(2) configured." >&4
10441         h_msg=false
10442         val="$undef"
10443         set msgctl d_msgctl
10444         eval $setvar
10445         set msgget d_msgget
10446         eval $setvar
10447         set msgsnd d_msgsnd
10448         eval $setvar
10449         set msgrcv d_msgrcv
10450         eval $setvar
10451         ;;
10452     esac
10453     ;;
10454 esac
10455 : we could also check for sys/ipc.h ...
10456 if $h_msg && $test `./findhdr sys/msg.h`; then
10457         echo "You have the full msg*(2) library." >&4
10458         val="$define"
10459 else
10460         echo "You don't have the full msg*(2) library." >&4
10461         val="$undef"
10462 fi
10463 set d_msg
10464 eval $setvar
10465
10466
10467 echo " "
10468 echo "Checking to see if your system supports struct msghdr..." >&4
10469 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10470 eval $hasstruct
10471 case "$d_msghdr_s" in
10472 "$define")      echo "Yes, it does."   ;;
10473 *)              echo "No, it doesn't." ;;
10474 esac
10475
10476
10477 : see if msync exists
10478 set msync d_msync
10479 eval $inlibc
10480
10481 : see if munmap exists
10482 set munmap d_munmap
10483 eval $inlibc
10484
10485 : see if nice exists
10486 set nice d_nice
10487 eval $inlibc
10488
10489 : check for length of character
10490 echo " "
10491 case "$charsize" in
10492 '')
10493         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10494         $cat >try.c <<'EOCP'
10495 #include <stdio.h>
10496 int main()
10497 {
10498     printf("%d\n", (int)sizeof(char));
10499     exit(0);
10500 }
10501 EOCP
10502         set try
10503         if eval $compile_ok; then
10504                 dflt=`./try`
10505         else
10506                 dflt='1'
10507                 echo "(I can't seem to compile the test program.  Guessing...)"
10508         fi
10509         ;;
10510 *)
10511         dflt="$charsize"
10512         ;;
10513 esac
10514 rp="What is the size of a character (in bytes)?"
10515 . ./myread
10516 charsize="$ans"
10517 $rm -f try.c try
10518
10519 : check for volatile keyword
10520 echo " "
10521 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10522 $cat >try.c <<'EOCP'
10523 int main()
10524 {
10525         typedef struct _goo_struct goo_struct;
10526         goo_struct * volatile goo = ((goo_struct *)0);
10527         struct _goo_struct {
10528                 long long_int;
10529                 int reg_int;
10530                 char char_var;
10531         };
10532         typedef unsigned short foo_t;
10533         char *volatile foo;
10534         volatile int bar;
10535         volatile foo_t blech;
10536         foo = foo;
10537 }
10538 EOCP
10539 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10540         val="$define"
10541         echo "Yup, it does."
10542 else
10543         val="$undef"
10544         echo "Nope, it doesn't."
10545 fi
10546 set d_volatile
10547 eval $setvar
10548 $rm -f try.*
10549
10550
10551 echo " "
10552 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10553
10554 case "$use64bitint:$d_quad:$quadtype" in
10555 define:define:?*)
10556         ivtype="$quadtype"
10557         uvtype="$uquadtype"
10558         ivsize=8
10559         uvsize=8
10560         ;;
10561 *)      ivtype="long"
10562         uvtype="unsigned long"
10563         ivsize=$longsize
10564         uvsize=$longsize
10565         ;;
10566 esac
10567
10568 case "$uselongdouble:$d_longdbl" in
10569 define:define)
10570         nvtype="long double"
10571         nvsize=$longdblsize
10572         ;;
10573 *)      nvtype=double
10574         nvsize=$doublesize
10575         ;;
10576 esac
10577
10578 $echo "(IV will be "$ivtype", $ivsize bytes)"
10579 $echo "(UV will be "$uvtype", $uvsize bytes)"
10580 $echo "(NV will be "$nvtype", $nvsize bytes)"
10581
10582 $cat >try.c <<EOCP
10583 #$i_inttypes I_INTTYPES
10584 #ifdef I_INTTYPES
10585 #include <inttypes.h>
10586 #endif
10587 #include <stdio.h>
10588 int main() {
10589 #ifdef INT8
10590    int8_t i =  INT8_MAX;
10591   uint8_t u = UINT8_MAX;
10592   printf("int8_t\n");
10593 #endif
10594 #ifdef INT16
10595    int16_t i =  INT16_MAX;
10596   uint16_t i = UINT16_MAX;
10597   printf("int16_t\n");
10598 #endif
10599 #ifdef INT32
10600    int32_t i =  INT32_MAX;
10601   uint32_t u = UINT32_MAX;
10602   printf("int32_t\n");
10603 #endif
10604 }
10605 EOCP
10606
10607 case "$i8type" in
10608 '')     case "$charsize" in
10609         1)      i8type=char
10610                 u8type="unsigned char"
10611                 i8size=$charsize
10612                 u8size=$charsize
10613                 ;;
10614         esac
10615         ;;
10616 esac
10617 case "$i8type" in
10618 '')     set try -DINT8
10619         if eval $compile; then
10620                 case "`./try$exe_ext`" in
10621                 int8_t) i8type=int8_t
10622                         u8type=uint8_t
10623                         i8size=1
10624                         u8size=1
10625                         ;;
10626                 esac
10627         fi
10628         ;;
10629 esac
10630 case "$i8type" in
10631 '')     if $test $charsize -ge 1; then
10632                 i8type=char
10633                 u8type="unsigned char"
10634                 i8size=$charsize
10635                 u8size=$charsize
10636         fi
10637         ;;
10638 esac
10639
10640 case "$i16type" in
10641 '')     case "$shortsize" in
10642         2)      i16type=short
10643                 u16type="unsigned short"
10644                 i16size=$shortsize
10645                 u16size=$shortsize
10646                 ;;
10647         esac
10648         ;;
10649 esac
10650 case "$i16type" in
10651 '')     set try -DINT16
10652         if eval $compile; then
10653                 case "`./try$exe_ext`" in
10654                 int16_t)
10655                         i16type=int16_t
10656                         u16type=uint16_t
10657                         i16size=2
10658                         u16size=2
10659                         ;;
10660                 esac
10661         fi
10662         ;;
10663 esac
10664 case "$i16type" in
10665 '')     if $test $shortsize -ge 2; then
10666                 i16type=short
10667                 u16type="unsigned short"
10668                 i16size=$shortsize
10669                 u16size=$shortsize
10670         fi
10671         ;;
10672 esac
10673
10674 case "$i32type" in
10675 '')     case "$longsize" in
10676         4)      i32type=long
10677                 u32type="unsigned long"
10678                 i32size=$longsize
10679                 u32size=$longsize
10680                 ;;
10681         *)      case "$intsize" in
10682                 4)      i32type=int
10683                         u32type="unsigned int"
10684                         i32size=$intsize
10685                         u32size=$intsize
10686                         ;;
10687                 esac
10688                 ;;
10689         esac
10690         ;;
10691 esac
10692 case "$i32type" in
10693 '')     set try -DINT32
10694         if eval $compile; then
10695                 case "`./try$exe_ext`" in
10696                 int32_t)
10697                         i32type=int32_t
10698                         u32type=uint32_t
10699                         i32size=4
10700                         u32size=4
10701                         ;;
10702                 esac
10703         fi
10704         ;;
10705 esac
10706 case "$i32type" in
10707 '')     if $test $intsize -ge 4; then
10708                 i32type=int
10709                 u32type="unsigned int"
10710                 i32size=$intsize
10711                 u32size=$intsize
10712         fi
10713         ;;
10714 esac
10715
10716 case "$i64type" in
10717 '')     case "$d_quad:$quadtype" in
10718         define:?*)
10719                 i64type="$quadtype"
10720                 u64type="$uquadtype"
10721                 i64size=8
10722                 u64size=8
10723                 ;;
10724         esac
10725         ;;
10726 esac
10727
10728 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10729 : volatile so that the compiler has to store it out to memory.
10730 if test X"$d_volatile" = X"$define"; then
10731         volatile=volatile
10732 fi
10733 $cat <<EOP >try.c
10734 #include <stdio.h>
10735 #include <sys/types.h>
10736 #include <signal.h>
10737 #ifdef SIGFPE
10738 $volatile int bletched = 0;
10739 $signal_t blech(s) int s; { bletched = 1; }
10740 #endif
10741 int main() {
10742     $uvtype u = 0;
10743     $nvtype d;
10744     int     n = 8 * $uvsize;
10745     int     i;
10746 #ifdef SIGFPE
10747     signal(SIGFPE, blech);
10748 #endif
10749
10750     for (i = 0; i < n; i++) {
10751       u = u << 1 | ($uvtype)1;
10752       d = ($nvtype)u;
10753       if (($uvtype)d != u)
10754         break;
10755       if (d <= 0)
10756         break;
10757       d = ($nvtype)(u - 1);
10758       if (($uvtype)d != (u - 1))
10759         break;
10760 #ifdef SIGFPE
10761       if (bletched) {
10762         break;
10763 #endif
10764       } 
10765     }
10766     printf("%d\n", ((i == n) ? -n : i));
10767     exit(0);
10768 }
10769 EOP
10770 set try
10771
10772 d_nv_preserves_uv="$undef"
10773 if eval $compile; then
10774         d_nv_preserves_uv_bits="`./try$exe_ext`"
10775 fi
10776 case "$d_nv_preserves_uv_bits" in
10777 \-[1-9]*)       
10778         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10779         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10780         d_nv_preserves_uv="$define"
10781         ;;
10782 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10783         d_nv_preserves_uv="$undef" ;;
10784 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10785         d_nv_preserves_uv_bits="$undef" ;;
10786 esac
10787
10788 $rm -f try.* try
10789
10790
10791 : check for off64_t
10792 echo " "
10793 echo "Checking to see if you have off64_t..." >&4
10794 $cat >try.c <<EOCP
10795 #include <sys/types.h>
10796 #include <unistd.h>
10797 int main() { off64_t x = 7; }
10798 EOCP
10799 set try
10800 if eval $compile; then
10801         val="$define"
10802         echo "You have off64_t."
10803 else
10804         val="$undef"
10805         echo "You do not have off64_t."
10806         case "$lseeksize" in
10807         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10808         esac
10809 fi
10810 $rm -f try.* try
10811 set d_off64_t
10812 eval $setvar
10813
10814 : see if POSIX threads are available
10815 set pthread.h i_pthread
10816 eval $inhdr
10817
10818
10819
10820
10821 : how to create joinable pthreads
10822 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10823         echo " "
10824         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10825         $cat >try.c <<'EOCP'
10826 #include <pthread.h>
10827 int main() {
10828     int detachstate = JOINABLE;
10829 }
10830 EOCP
10831         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10832         if eval $compile; then
10833                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10834                 val="$undef" # Yes, undef.
10835                 set d_old_pthread_create_joinable
10836                 eval $setvar
10837                 val=""
10838                 set old_pthread_create_joinable
10839                 eval $setvar
10840         else
10841                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10842                 if eval $compile; then
10843                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10844                         val="$define"
10845                         set d_old_pthread_create_joinable
10846                         eval $setvar
10847                         val=PTHREAD_CREATE_UNDETACHED
10848                         set old_pthread_create_joinable
10849                         eval $setvar
10850                 else            
10851                         set try -DJOINABLE=__UNDETACHED
10852                         if eval $compile; then
10853                                 echo "You seem to use __UNDETACHED." >&4
10854                                 val="$define"
10855                                 set d_old_pthread_create_joinable
10856                                 eval $setvar
10857                                 val=__UNDETACHED
10858                                 set old_pthread_create_joinable
10859                                 eval $setvar
10860                         else
10861                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10862                                 val="$define"
10863                                 set d_old_pthread_create_joinable
10864                                 eval $setvar
10865                                 val=0
10866                                 set old_pthread_create_joinable
10867                                 eval $setvar
10868                         fi
10869                 fi
10870         fi
10871         $rm -f try try.*
10872 else
10873     d_old_pthread_create_joinable="$undef"
10874     old_pthread_create_joinable=""
10875 fi
10876
10877 : see if pause exists
10878 set pause d_pause
10879 eval $inlibc
10880
10881 : see if pipe exists
10882 set pipe d_pipe
10883 eval $inlibc
10884
10885 : see if poll exists
10886 set poll d_poll
10887 eval $inlibc
10888
10889
10890 : see whether the various POSIXish _yields exist
10891 $cat >try.c <<EOP
10892 #include <pthread.h>
10893 #include <stdio.h>
10894 int main() {
10895 #ifdef SCHED_YIELD
10896         sched_yield();
10897 #else
10898 #ifdef PTHREAD_YIELD
10899         pthread_yield();
10900 #else
10901 #ifdef PTHREAD_YIELD_NULL
10902         pthread_yield(NULL);
10903 #endif
10904 #endif
10905 #endif
10906 }
10907 EOP
10908 : see if sched_yield exists
10909 set try -DSCHED_YIELD
10910 if eval $compile; then
10911     val="$define"
10912     sched_yield='sched_yield()'
10913 else
10914     val="$undef"
10915 fi
10916 case "$usethreads" in
10917 $define)
10918         case "$val" in
10919         $define) echo 'sched_yield() found.' >&4        ;;
10920         *)       echo 'sched_yield() NOT found.' >&4    ;;
10921         esac
10922 esac
10923 set d_sched_yield
10924 eval $setvar
10925
10926 : see if pthread_yield exists
10927 set try -DPTHREAD_YIELD
10928 if eval $compile; then
10929     val="$define"
10930     case "$sched_yield" in
10931     '') sched_yield='pthread_yield()' ;;
10932     esac
10933 else
10934     set try -DPTHREAD_YIELD_NULL
10935     if eval $compile; then
10936         val="$define"
10937         case "$sched_yield" in
10938         '') sched_yield='pthread_yield(NULL)' ;;
10939         esac
10940     else
10941         val="$undef"
10942     fi
10943 fi
10944 case "$usethreads" in
10945 $define)
10946         case "$val" in
10947         $define) echo 'pthread_yield() found.' >&4      ;;
10948         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10949         esac
10950         ;;
10951 esac
10952 set d_pthread_yield
10953 eval $setvar
10954
10955 case "$sched_yield" in
10956 '') sched_yield=undef ;;
10957 esac
10958
10959 $rm -f try try.*
10960
10961 : see if this is a pwd.h system
10962 set pwd.h i_pwd
10963 eval $inhdr
10964
10965 case "$i_pwd" in
10966 $define)
10967         xxx=`./findhdr pwd.h`
10968         $cppstdin $cppflags $cppminus < $xxx >$$.h
10969
10970         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10971                 val="$define"
10972         else
10973                 val="$undef"
10974         fi
10975         set d_pwquota
10976         eval $setvar
10977
10978         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10979                 val="$define"
10980         else
10981                 val="$undef"
10982         fi
10983         set d_pwage
10984         eval $setvar
10985
10986         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10987                 val="$define"
10988         else
10989                 val="$undef"
10990         fi
10991         set d_pwchange
10992         eval $setvar
10993
10994         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10995                 val="$define"
10996         else
10997                 val="$undef"
10998         fi
10999         set d_pwclass
11000         eval $setvar
11001
11002         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11003                 val="$define"
11004         else
11005                 val="$undef"
11006         fi
11007         set d_pwexpire
11008         eval $setvar
11009
11010         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11011                 val="$define"
11012         else
11013                 val="$undef"
11014         fi
11015         set d_pwcomment
11016         eval $setvar
11017
11018         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11019                 val="$define"
11020         else
11021                 val="$undef"
11022         fi
11023         set d_pwgecos
11024         eval $setvar
11025
11026         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11027                 val="$define"
11028         else
11029                 val="$undef"
11030         fi
11031         set d_pwpasswd
11032         eval $setvar
11033
11034         $rm -f $$.h
11035         ;;
11036 *)
11037         val="$undef"; 
11038         set d_pwquota; eval $setvar
11039         set d_pwage; eval $setvar
11040         set d_pwchange; eval $setvar
11041         set d_pwclass; eval $setvar
11042         set d_pwexpire; eval $setvar
11043         set d_pwcomment; eval $setvar
11044         set d_pwgecos; eval $setvar
11045         set d_pwpasswd; eval $setvar
11046         ;;
11047 esac
11048
11049 : see if readdir and friends exist
11050 set readdir d_readdir
11051 eval $inlibc
11052 set seekdir d_seekdir
11053 eval $inlibc
11054 set telldir d_telldir
11055 eval $inlibc
11056 set rewinddir d_rewinddir
11057 eval $inlibc
11058
11059 : see if readlink exists
11060 set readlink d_readlink
11061 eval $inlibc
11062
11063 : see if readv exists
11064 set readv d_readv
11065 eval $inlibc
11066
11067 : see if realpath exists
11068 set realpath d_realpath
11069 eval $inlibc
11070
11071 : see if recvmsg exists
11072 set recvmsg d_recvmsg
11073 eval $inlibc
11074
11075 : see if rename exists
11076 set rename d_rename
11077 eval $inlibc
11078
11079 : see if rmdir exists
11080 set rmdir d_rmdir
11081 eval $inlibc
11082
11083 : see if memory.h is available.
11084 val=''
11085 set memory.h val
11086 eval $inhdr
11087
11088 : See if it conflicts with string.h
11089 case "$val" in
11090 $define)
11091         case "$strings" in
11092         '') ;;
11093         *)
11094                 $cppstdin $cppflags $cppminus < $strings > mem.h
11095                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11096                         echo " "
11097                         echo "We won't be including <memory.h>."
11098                         val="$undef"
11099                 fi
11100                 $rm -f mem.h
11101                 ;;
11102         esac
11103 esac
11104 set i_memory
11105 eval $setvar
11106
11107 : can bcopy handle overlapping blocks?
11108 val="$undef"
11109 case "$d_bcopy" in
11110 "$define")
11111         echo " "
11112         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11113         $cat >try.c <<EOCP
11114 #$i_memory I_MEMORY
11115 #$i_stdlib I_STDLIB
11116 #$i_string I_STRING
11117 #$i_unistd I_UNISTD
11118 EOCP
11119         $cat >>try.c <<'EOCP'
11120 #include <stdio.h>
11121 #ifdef I_MEMORY
11122 #  include <memory.h>
11123 #endif
11124 #ifdef I_STDLIB
11125 #  include <stdlib.h>
11126 #endif
11127 #ifdef I_STRING
11128 #  include <string.h>
11129 #else
11130 #  include <strings.h>
11131 #endif
11132 #ifdef I_UNISTD
11133 #  include <unistd.h>  /* Needed for NetBSD */
11134 #endif
11135 int main()
11136 {
11137 char buf[128], abc[128];
11138 char *b;
11139 int len;
11140 int off;
11141 int align;
11142
11143 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11144
11145 for (align = 7; align >= 0; align--) {
11146         for (len = 36; len; len--) {
11147                 b = buf+align;
11148                 bcopy(abc, b, len);
11149                 for (off = 1; off <= len; off++) {
11150                         bcopy(b, b+off, len);
11151                         bcopy(b+off, b, len);
11152                         if (bcmp(b, abc, len))
11153                                 exit(1);
11154                 }
11155         }
11156 }
11157 exit(0);
11158 }
11159 EOCP
11160         set try
11161         if eval $compile_ok; then
11162                 if ./try 2>/dev/null; then
11163                         echo "Yes, it can."
11164                         val="$define"
11165                 else
11166                         echo "It can't, sorry."
11167                         case "$d_memmove" in
11168                         "$define") echo "But that's Ok since you have memmove()." ;;
11169                         esac
11170                 fi
11171         else
11172                 echo "(I can't compile the test program, so we'll assume not...)"
11173                 case "$d_memmove" in
11174                 "$define") echo "But that's Ok since you have memmove()." ;;
11175                 esac
11176         fi
11177         ;;
11178 esac
11179 $rm -f try.* try core
11180 set d_safebcpy
11181 eval $setvar
11182
11183 : can memcpy handle overlapping blocks?
11184 val="$undef"
11185 case "$d_memcpy" in
11186 "$define")
11187         echo " "
11188         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11189         $cat >try.c <<EOCP
11190 #$i_memory I_MEMORY
11191 #$i_stdlib I_STDLIB
11192 #$i_string I_STRING
11193 #$i_unistd I_UNISTD
11194 EOCP
11195         $cat >>try.c <<'EOCP'
11196 #include <stdio.h>
11197 #ifdef I_MEMORY
11198 #  include <memory.h>
11199 #endif
11200 #ifdef I_STDLIB
11201 #  include <stdlib.h>
11202 #endif
11203 #ifdef I_STRING
11204 #  include <string.h>
11205 #else
11206 #  include <strings.h>
11207 #endif
11208 #ifdef I_UNISTD
11209 #  include <unistd.h>  /* Needed for NetBSD */
11210 #endif
11211 int main()
11212 {
11213 char buf[128], abc[128];
11214 char *b;
11215 int len;
11216 int off;
11217 int align;
11218
11219 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11220    try to store the string in read-only memory. */
11221 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11222
11223 for (align = 7; align >= 0; align--) {
11224         for (len = 36; len; len--) {
11225                 b = buf+align;
11226                 memcpy(b, abc, len);
11227                 for (off = 1; off <= len; off++) {
11228                         memcpy(b+off, b, len);
11229                         memcpy(b, b+off, len);
11230                         if (memcmp(b, abc, len))
11231                                 exit(1);
11232                 }
11233         }
11234 }
11235 exit(0);
11236 }
11237 EOCP
11238         set try
11239         if eval $compile_ok; then
11240                 if ./try 2>/dev/null; then
11241                         echo "Yes, it can."
11242                         val="$define"
11243                 else
11244                         echo "It can't, sorry."
11245                         case "$d_memmove" in
11246                         "$define") echo "But that's Ok since you have memmove()." ;;
11247                         esac
11248                 fi
11249         else
11250                 echo "(I can't compile the test program, so we'll assume not...)"
11251                 case "$d_memmove" in
11252                 "$define") echo "But that's Ok since you have memmove()." ;;
11253                 esac
11254         fi
11255         ;;
11256 esac
11257 $rm -f try.* try core
11258 set d_safemcpy
11259 eval $setvar
11260
11261 : can memcmp be trusted to compare relative magnitude?
11262 val="$undef"
11263 case "$d_memcmp" in
11264 "$define")
11265         echo " "
11266         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11267         $cat >try.c <<EOCP
11268 #$i_memory I_MEMORY
11269 #$i_stdlib I_STDLIB
11270 #$i_string I_STRING
11271 #$i_unistd I_UNISTD
11272 EOCP
11273         $cat >>try.c <<'EOCP'
11274 #include <stdio.h>
11275 #ifdef I_MEMORY
11276 #  include <memory.h>
11277 #endif
11278 #ifdef I_STDLIB
11279 #  include <stdlib.h>
11280 #endif
11281 #ifdef I_STRING
11282 #  include <string.h>
11283 #else
11284 #  include <strings.h>
11285 #endif
11286 #ifdef I_UNISTD
11287 #  include <unistd.h>  /* Needed for NetBSD */
11288 #endif
11289 int main()
11290 {
11291 char a = -1;
11292 char b = 0;
11293 if ((a < b) && memcmp(&a, &b, 1) < 0)
11294         exit(1);
11295 exit(0);
11296 }
11297 EOCP
11298         set try
11299         if eval $compile_ok; then
11300                 if ./try 2>/dev/null; then
11301                         echo "Yes, it can."
11302                         val="$define"
11303                 else
11304                         echo "No, it can't (it uses signed chars)."
11305                 fi
11306         else
11307                 echo "(I can't compile the test program, so we'll assume not...)"
11308         fi
11309         ;;
11310 esac
11311 $rm -f try.* try core
11312 set d_sanemcmp
11313 eval $setvar
11314
11315 : see if prototype for sbrk is available
11316 echo " "
11317 set d_sbrkproto sbrk $i_unistd unistd.h
11318 eval $hasproto
11319
11320 : see if select exists
11321 set select d_select
11322 eval $inlibc
11323
11324 : see if semctl exists
11325 set semctl d_semctl
11326 eval $inlibc
11327
11328 : see if semget exists
11329 set semget d_semget
11330 eval $inlibc
11331
11332 : see if semop exists
11333 set semop d_semop
11334 eval $inlibc
11335
11336 : see how much of the 'sem*(2)' library is present.
11337 h_sem=true
11338 echo " "
11339 case "$d_semctl$d_semget$d_semop" in
11340 *"$undef"*) h_sem=false;;
11341 esac
11342 case "$osname" in
11343 freebsd)
11344     case "`ipcs 2>&1`" in
11345     "SVID messages"*"not configured"*)
11346         echo "Your $osname does not have the sem*(2) configured." >&4
11347         h_sem=false
11348         val="$undef"
11349         set semctl d_semctl
11350         eval $setvar
11351         set semget d_semget
11352         eval $setvar
11353         set semop d_semop
11354         eval $setvar
11355         ;;
11356     esac
11357     ;;
11358 esac
11359 : we could also check for sys/ipc.h ...
11360 if $h_sem && $test `./findhdr sys/sem.h`; then
11361         echo "You have the full sem*(2) library." >&4
11362         val="$define"
11363 else
11364         echo "You don't have the full sem*(2) library." >&4
11365         val="$undef"
11366 fi
11367 set d_sem
11368 eval $setvar
11369
11370 : see whether sys/sem.h defines union semun
11371 echo " "
11372 $cat > try.c <<'END'
11373 #include <sys/types.h>
11374 #include <sys/ipc.h>
11375 #include <sys/sem.h>
11376 int main () { union semun semun; semun.buf = 0; }
11377 END
11378 set try
11379 if eval $compile; then
11380     echo "You have union semun in <sys/sem.h>." >&4
11381     val="$define"
11382 else
11383     echo "You do not have union semun in <sys/sem.h>." >&4
11384     val="$undef"
11385 fi
11386 $rm -f try try.c try.h
11387 set d_union_semun
11388 eval $setvar
11389
11390 : see how to do semctl IPC_STAT
11391 case "$d_sem" in
11392 $define)
11393     : see whether semctl IPC_STAT can use union semun
11394     echo " "
11395     $cat > try.h <<END
11396 #ifndef S_IRUSR
11397 #   ifdef S_IREAD
11398 #       define S_IRUSR S_IREAD
11399 #       define S_IWUSR S_IWRITE
11400 #       define S_IXUSR S_IEXEC
11401 #   else
11402 #       define S_IRUSR 0400
11403 #       define S_IWUSR 0200
11404 #       define S_IXUSR 0100
11405 #   endif
11406 #   define S_IRGRP (S_IRUSR>>3)
11407 #   define S_IWGRP (S_IWUSR>>3)
11408 #   define S_IXGRP (S_IXUSR>>3)
11409 #   define S_IROTH (S_IRUSR>>6)
11410 #   define S_IWOTH (S_IWUSR>>6)
11411 #   define S_IXOTH (S_IXUSR>>6)
11412 #endif
11413 #ifndef S_IRWXU
11414 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11415 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11416 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11417 #endif
11418 END
11419
11420     $cat > try.c <<END
11421 #include <sys/types.h>
11422 #include <sys/ipc.h>
11423 #include <sys/sem.h>
11424 #include <sys/stat.h>
11425 #include <stdio.h>
11426 #include <errno.h>
11427 #include "try.h"
11428 #ifndef errno
11429 extern int errno;
11430 #endif
11431 #$d_union_semun HAS_UNION_SEMUN
11432 int main() {
11433     union semun
11434 #ifndef HAS_UNION_SEMUN
11435     {
11436         int val;
11437         struct semid_ds *buf;
11438         unsigned short *array;
11439     }
11440 #endif
11441     arg;
11442     int sem, st;
11443
11444 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11445     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11446     if (sem > -1) {
11447         struct semid_ds argbuf;
11448         arg.buf = &argbuf;
11449 #       ifdef IPC_STAT
11450         st = semctl(sem, 0, IPC_STAT, arg);
11451         if (st == 0)
11452             printf("semun\n");
11453         else
11454 #       endif /* IPC_STAT */
11455             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11456 #       ifdef IPC_RMID
11457         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11458 #       endif /* IPC_RMID */
11459             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11460     } else
11461 #endif /* IPC_PRIVATE && ... */
11462         printf("semget failed: errno = %d\n", errno);
11463   return 0;
11464 }
11465 END
11466     val="$undef"
11467     set try
11468     if eval $compile; then
11469         xxx=`./try`
11470         case "$xxx" in
11471         semun) val="$define" ;;
11472         esac
11473     fi
11474     $rm -f try try.c
11475     set d_semctl_semun
11476     eval $setvar
11477     case "$d_semctl_semun" in
11478     $define)
11479         echo "You can use union semun for semctl IPC_STAT." >&4
11480         also='also'
11481         ;;
11482     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11483         also=''
11484         ;;
11485     esac
11486
11487     : see whether semctl IPC_STAT can use struct semid_ds pointer
11488     $cat > try.c <<'END'
11489 #include <sys/types.h>
11490 #include <sys/ipc.h>
11491 #include <sys/sem.h>
11492 #include <sys/stat.h>
11493 #include "try.h"
11494 #include <stdio.h>
11495 #include <errno.h>
11496 #ifndef errno
11497 extern int errno;
11498 #endif
11499 int main() {
11500     struct semid_ds arg;
11501     int sem, st;
11502
11503 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11504     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11505     if (sem > -1) {
11506 #       ifdef IPC_STAT
11507         st = semctl(sem, 0, IPC_STAT, &arg);
11508         if (st == 0)
11509             printf("semid_ds\n");
11510         else
11511 #       endif /* IPC_STAT */
11512             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11513 #       ifdef IPC_RMID
11514         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11515 #       endif /* IPC_RMID */
11516             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11517     } else
11518 #endif /* IPC_PRIVATE && ... */
11519         printf("semget failed: errno = %d\n", errno);
11520
11521     return 0;
11522 }
11523 END
11524     val="$undef"
11525     set try
11526     if eval $compile; then
11527         xxx=`./try`
11528         case "$xxx" in
11529         semid_ds) val="$define" ;;
11530         esac
11531     fi
11532     $rm -f try try.c
11533     set d_semctl_semid_ds
11534     eval $setvar
11535     case "$d_semctl_semid_ds" in
11536     $define)
11537         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11538         ;;
11539     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11540         ;;
11541     esac
11542     $rm -f try.h
11543     ;;
11544 *)  val="$undef"
11545
11546     # We do not have the full sem*(2) library, so assume we can not
11547     # use either.
11548
11549     set d_semctl_semun
11550     eval $setvar
11551
11552     set d_semctl_semid_ds
11553     eval $setvar
11554     ;;
11555 esac
11556
11557 : see if sendmsg exists
11558 set sendmsg d_sendmsg
11559 eval $inlibc
11560
11561 : see if setegid exists
11562 set setegid d_setegid
11563 eval $inlibc
11564
11565 : see if seteuid exists
11566 set seteuid d_seteuid
11567 eval $inlibc
11568
11569 : see if setgrent exists
11570 set setgrent d_setgrent
11571 eval $inlibc
11572
11573 : see if sethostent exists
11574 set sethostent d_sethent
11575 eval $inlibc
11576
11577 : see if setitimer exists
11578 set setitimer d_setitimer
11579 eval $inlibc
11580
11581 : see if setlinebuf exists
11582 set setlinebuf d_setlinebuf
11583 eval $inlibc
11584
11585 : see if setlocale exists
11586 set setlocale d_setlocale
11587 eval $inlibc
11588
11589 : see if setnetent exists
11590 set setnetent d_setnent
11591 eval $inlibc
11592
11593 : see if setprotoent exists
11594 set setprotoent d_setpent
11595 eval $inlibc
11596
11597 : see if setpgid exists
11598 set setpgid d_setpgid
11599 eval $inlibc
11600
11601 : see if setpgrp2 exists
11602 set setpgrp2 d_setpgrp2
11603 eval $inlibc
11604
11605 : see if setpriority exists
11606 set setpriority d_setprior
11607 eval $inlibc
11608
11609 : see if setproctitle exists
11610 set setproctitle d_setproctitle
11611 eval $inlibc
11612
11613 : see if setpwent exists
11614 set setpwent d_setpwent
11615 eval $inlibc
11616
11617 : see if setregid exists
11618 set setregid d_setregid
11619 eval $inlibc
11620 set setresgid d_setresgid
11621 eval $inlibc
11622
11623 : see if setreuid exists
11624 set setreuid d_setreuid
11625 eval $inlibc
11626 set setresuid d_setresuid
11627 eval $inlibc
11628
11629 : see if setrgid exists
11630 set setrgid d_setrgid
11631 eval $inlibc
11632
11633 : see if setruid exists
11634 set setruid d_setruid
11635 eval $inlibc
11636
11637 : see if setservent exists
11638 set setservent d_setsent
11639 eval $inlibc
11640
11641 : see if setsid exists
11642 set setsid d_setsid
11643 eval $inlibc
11644
11645 : see if setvbuf exists
11646 set setvbuf d_setvbuf
11647 eval $inlibc
11648
11649 : see if sfio.h is available
11650 set sfio.h i_sfio
11651 eval $inhdr
11652
11653
11654 : see if sfio library is available
11655 case "$i_sfio" in
11656 $define)
11657         val=''
11658         set sfreserve val
11659         eval $inlibc
11660         ;;
11661 *)
11662         val="$undef"
11663         ;;
11664 esac
11665 : Ok, but do we want to use it.
11666 case "$val" in
11667 $define)
11668         case "$usesfio" in
11669         true|$define|[yY]*) dflt='y';;
11670         *) dflt='n';;
11671         esac
11672         echo "$package can use the sfio library, but it is experimental."
11673         case "$useperlio" in
11674         "$undef")
11675             echo "For sfio also the PerlIO abstraction layer is needed."
11676             echo "Earlier you said you wouldn't want that."
11677             ;;
11678         esac
11679         rp="You seem to have sfio available, do you want to try using it?"
11680         . ./myread
11681         case "$ans" in
11682         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11683                 useperlio="$define"
11684                 val="$define"
11685                 ;;
11686         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11687                 val="$undef"
11688                 ;;
11689         esac
11690         ;;
11691 *)      case "$usesfio" in
11692         true|$define|[yY]*)
11693                 echo "Sorry, cannot find sfio on this machine." >&4
11694                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11695                 val="$undef"
11696                 ;;
11697         esac
11698         ;;
11699 esac
11700 set d_sfio
11701 eval $setvar
11702 case "$d_sfio" in
11703 $define) usesfio='true';;
11704 *) usesfio='false';;
11705 esac
11706 case "$d_sfio" in
11707 $define) ;;
11708 *)      : Remove sfio from list of libraries to use
11709         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11710         shift
11711         libs="$*"
11712         echo "libs = $libs" >&4
11713 ;;
11714 esac
11715
11716
11717 : see if shmctl exists
11718 set shmctl d_shmctl
11719 eval $inlibc
11720
11721 : see if shmget exists
11722 set shmget d_shmget
11723 eval $inlibc
11724
11725 : see if shmat exists
11726 set shmat d_shmat
11727 eval $inlibc
11728 : see what shmat returns
11729 case "$d_shmat" in
11730 "$define")
11731         $cat >shmat.c <<'END'
11732 #include <sys/shm.h>
11733 void *shmat();
11734 END
11735         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11736                 shmattype='void *'
11737         else
11738                 shmattype='char *'
11739         fi
11740         echo "and it returns ($shmattype)." >&4
11741         : see if a prototype for shmat is available
11742         xxx=`./findhdr sys/shm.h`
11743         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11744         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11745                 val="$define"
11746         else
11747                 val="$undef"
11748         fi
11749         $rm -f shmat.[co]
11750         ;;
11751 *)
11752         val="$undef"
11753         ;;
11754 esac
11755 set d_shmatprototype
11756 eval $setvar
11757
11758 : see if shmdt exists
11759 set shmdt d_shmdt
11760 eval $inlibc
11761
11762 : see how much of the 'shm*(2)' library is present.
11763 h_shm=true
11764 echo " "
11765 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11766 *"$undef"*) h_shm=false;;
11767 esac
11768 case "$osname" in
11769 freebsd)
11770     case "`ipcs 2>&1`" in
11771     "SVID shared memory"*"not configured"*)
11772         echo "Your $osname does not have the shm*(2) configured." >&4
11773         h_shm=false
11774         val="$undef"
11775         set shmctl d_shmctl
11776         evat $setvar
11777         set shmget d_shmget
11778         evat $setvar
11779         set shmat d_shmat
11780         evat $setvar
11781         set shmdt d_shmdt
11782         evat $setvar
11783         ;;
11784     esac
11785     ;;
11786 esac
11787 : we could also check for sys/ipc.h ...
11788 if $h_shm && $test `./findhdr sys/shm.h`; then
11789         echo "You have the full shm*(2) library." >&4
11790         val="$define"
11791 else
11792         echo "You don't have the full shm*(2) library." >&4
11793         val="$undef"
11794 fi
11795 set d_shm
11796 eval $setvar
11797
11798 echo " "
11799 : see if we have sigaction
11800 if set sigaction val -f d_sigaction; eval $csym; $val; then
11801         echo 'sigaction() found.' >&4
11802         $cat > try.c <<'EOP'
11803 #include <stdio.h>
11804 #include <sys/types.h>
11805 #include <signal.h>
11806 int main()
11807 {
11808     struct sigaction act, oact;
11809     act.sa_flags = 0;
11810     oact.sa_handler = 0;
11811     /* so that act and oact are used */
11812     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11813 }
11814 EOP
11815         set try
11816         if eval $compile_ok; then
11817                 val="$define"
11818         else
11819                 echo "But you don't seem to have a useable struct sigaction." >&4
11820                 val="$undef"
11821         fi
11822 else
11823         echo 'sigaction NOT found.' >&4
11824         val="$undef"
11825 fi
11826 set d_sigaction; eval $setvar
11827 $rm -f try try$_o try.c
11828
11829 : see if sigprocmask exists
11830 set sigprocmask d_sigprocmask
11831 eval $inlibc
11832
11833 : see if sigsetjmp exists
11834 echo " "
11835 case "$d_sigsetjmp" in
11836 '')
11837         $cat >try.c <<'EOP'
11838 #include <setjmp.h>
11839 sigjmp_buf env;
11840 int set = 1;
11841 int main()
11842 {
11843         if (sigsetjmp(env,1))
11844                 exit(set);
11845         set = 0;
11846         siglongjmp(env, 1);
11847         exit(1);
11848 }
11849 EOP
11850         set try
11851         if eval $compile; then
11852                 if ./try >/dev/null 2>&1; then
11853                         echo "POSIX sigsetjmp found." >&4
11854                         val="$define"
11855                 else
11856                         $cat >&4 <<EOM
11857 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11858 I'll ignore them.
11859 EOM
11860                         val="$undef"
11861                 fi
11862         else
11863                 echo "sigsetjmp not found." >&4
11864                 val="$undef"
11865         fi
11866         ;;
11867 *) val="$d_sigsetjmp"
11868         case "$d_sigsetjmp" in
11869         $define) echo "POSIX sigsetjmp found." >&4;;
11870         $undef) echo "sigsetjmp not found." >&4;;
11871         esac
11872         ;;
11873 esac
11874 set d_sigsetjmp
11875 eval $setvar
11876 $rm -f try.c try
11877
11878 : see if sockatmark exists
11879 set sockatmark d_sockatmark
11880 eval $inlibc
11881
11882 : see if socks5_init exists
11883 set socks5_init d_socks5_init
11884 eval $inlibc
11885
11886 : see if prototype for setresgid is available
11887 echo " "
11888 set d_sresgproto setresgid $i_unistd unistd.h
11889 eval $hasproto
11890
11891 : see if prototype for setresuid is available
11892 echo " "
11893 set d_sresuproto setresuid $i_unistd unistd.h
11894 eval $hasproto
11895
11896 : see if sys/stat.h is available
11897 set sys/stat.h i_sysstat
11898 eval $inhdr
11899
11900
11901 : see if stat knows about block sizes
11902 echo " "
11903 echo "Checking to see if your struct stat has st_blocks field..." >&4
11904 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11905 eval $hasfield
11906
11907
11908 : see if this is a sys/vfs.h system
11909 set sys/vfs.h i_sysvfs
11910 eval $inhdr
11911
11912
11913 : see if this is a sys/statfs.h system
11914 set sys/statfs.h i_sysstatfs
11915 eval $inhdr
11916
11917
11918 echo " "
11919 echo "Checking to see if your system supports struct statfs..." >&4
11920 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
11921 eval $hasstruct
11922 case "$d_statfs_s" in
11923 "$define")      echo "Yes, it does."   ;;
11924 *)              echo "No, it doesn't." ;;
11925 esac
11926
11927
11928
11929 : see if struct statfs knows about f_flags
11930 case "$d_statfs_s" in
11931 define) 
11932         echo " "
11933         echo "Checking to see if your struct statfs has f_flags field..." >&4
11934         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
11935         eval $hasfield
11936         ;;
11937 *)      val="$undef"
11938         set d_statfs_f_flags
11939         eval $setvar
11940         ;;
11941 esac
11942 case "$d_statfs_f_flags" in
11943 "$define")      echo "Yes, it does."   ;;
11944 *)              echo "No, it doesn't." ;;
11945 esac
11946
11947 : see if _ptr and _cnt from stdio act std
11948 echo " "
11949
11950 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11951         echo "(Looks like you have stdio.h from BSD.)"
11952         case "$stdio_ptr" in
11953         '') stdio_ptr='((fp)->_p)'
11954                 ptr_lval=$define
11955                 ;;
11956         *)      ptr_lval=$d_stdio_ptr_lval;;
11957         esac
11958         case "$stdio_cnt" in
11959         '') stdio_cnt='((fp)->_r)'
11960                 cnt_lval=$define
11961                 ;;
11962         *)      cnt_lval=$d_stdio_cnt_lval;;
11963         esac
11964         case "$stdio_base" in
11965         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11966         esac
11967         case "$stdio_bufsiz" in
11968         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11969         esac
11970 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11971         echo "(Looks like you have stdio.h from Linux.)"
11972         case "$stdio_ptr" in
11973         '') stdio_ptr='((fp)->_IO_read_ptr)'
11974                 ptr_lval=$define
11975                 ;;
11976         *)      ptr_lval=$d_stdio_ptr_lval;;
11977         esac
11978         case "$stdio_cnt" in
11979         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11980                 cnt_lval=$undef
11981                 ;;
11982         *)      cnt_lval=$d_stdio_cnt_lval;;
11983         esac
11984         case "$stdio_base" in
11985         '') stdio_base='((fp)->_IO_read_base)';;
11986         esac
11987         case "$stdio_bufsiz" in
11988         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11989         esac
11990 else
11991         case "$stdio_ptr" in
11992         '') stdio_ptr='((fp)->_ptr)'
11993                 ptr_lval=$define
11994                 ;;
11995         *)      ptr_lval=$d_stdio_ptr_lval;;
11996         esac
11997         case "$stdio_cnt" in
11998         '') stdio_cnt='((fp)->_cnt)'
11999                 cnt_lval=$define
12000                 ;;
12001         *)      cnt_lval=$d_stdio_cnt_lval;;
12002         esac
12003         case "$stdio_base" in
12004         '') stdio_base='((fp)->_base)';;
12005         esac
12006         case "$stdio_bufsiz" in
12007         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12008         esac
12009 fi
12010
12011 : test whether _ptr and _cnt really work
12012 echo "Checking how std your stdio is..." >&4
12013 $cat >try.c <<EOP
12014 #include <stdio.h>
12015 #define FILE_ptr(fp)    $stdio_ptr
12016 #define FILE_cnt(fp)    $stdio_cnt
12017 int main() {
12018         FILE *fp = fopen("try.c", "r");
12019         char c = getc(fp);
12020         if (
12021                 18 <= FILE_cnt(fp) &&
12022                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12023         )
12024                 exit(0);
12025         exit(1);
12026 }
12027 EOP
12028 val="$undef"
12029 set try
12030 if eval $compile; then
12031         if ./try; then
12032                 echo "Your stdio acts pretty std."
12033                 val="$define"
12034         else
12035                 echo "Your stdio isn't very std."
12036         fi
12037 else
12038         echo "Your stdio doesn't appear very std."
12039 fi
12040 $rm -f try.c try
12041 set d_stdstdio
12042 eval $setvar
12043
12044 : Can _ptr be used as an lvalue?
12045 case "$d_stdstdio$ptr_lval" in
12046 $define$define) val=$define ;;
12047 *) val=$undef ;;
12048 esac
12049 set d_stdio_ptr_lval
12050 eval $setvar
12051
12052 : Can _cnt be used as an lvalue?
12053 case "$d_stdstdio$cnt_lval" in
12054 $define$define) val=$define ;;
12055 *) val=$undef ;;
12056 esac
12057 set d_stdio_cnt_lval
12058 eval $setvar
12059
12060
12061 : test whether setting _ptr sets _cnt as a side effect
12062 d_stdio_ptr_lval_sets_cnt="$undef"
12063 d_stdio_ptr_lval_nochange_cnt="$undef"
12064 case "$d_stdio_ptr_lval$d_stdstdio" in
12065 $define$define)
12066         echo "Checking to see what happens if we set the stdio ptr..." >&4
12067 $cat >try.c <<EOP
12068 #include <stdio.h>
12069 /* Can we scream? */
12070 /* Eat dust sed :-) */
12071 /* In the buffer space, no one can hear you scream. */
12072 #define FILE_ptr(fp)    $stdio_ptr
12073 #define FILE_cnt(fp)    $stdio_cnt
12074 #include <sys/types.h>
12075 int main() {
12076         FILE *fp = fopen("try.c", "r");
12077         int c;
12078         char *ptr;
12079         size_t cnt;
12080         if (!fp) {
12081             puts("Fail even to read");
12082             exit(1);
12083         }
12084         c = getc(fp); /* Read away the first # */
12085         if (c == EOF) {
12086             puts("Fail even to read");
12087             exit(1);
12088         }
12089         if (!(
12090                 18 <= FILE_cnt(fp) &&
12091                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12092         )) {
12093                 puts("Fail even to read");
12094                 exit (1);
12095         }
12096         ptr = (char*) FILE_ptr(fp);
12097         cnt = (size_t)FILE_cnt(fp);
12098
12099         FILE_ptr(fp) += 42;
12100
12101         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12102                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12103                 exit (1);
12104         }
12105         if (FILE_cnt(fp) <= 20) {
12106                 printf ("Fail (<20 chars to test)");
12107                 exit (1);
12108         }
12109         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12110                 puts("Fail compare");
12111                 exit (1);
12112         }
12113         if (cnt == FILE_cnt(fp)) {
12114                 puts("Pass_unchanged");
12115                 exit (0);
12116         }       
12117         if (FILE_cnt(fp) == (cnt - 42)) {
12118                 puts("Pass_changed");
12119                 exit (0);
12120         }
12121         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12122         return 1;
12123
12124 }
12125 EOP
12126         set try
12127         if eval $compile; then
12128                 case `./try$exe_ext` in
12129                 Pass_changed)
12130                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12131                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12132                 Pass_unchanged)
12133                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12134                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12135                 Fail*)
12136                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12137                 *)
12138                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12139         esac
12140         else
12141                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12142         fi
12143         $rm -f try.c try
12144         ;;
12145 esac
12146
12147 : see if _base is also standard
12148 val="$undef"
12149 case "$d_stdstdio" in
12150 $define)
12151         $cat >try.c <<EOP
12152 #include <stdio.h>
12153 #define FILE_base(fp)   $stdio_base
12154 #define FILE_bufsiz(fp) $stdio_bufsiz
12155 int main() {
12156         FILE *fp = fopen("try.c", "r");
12157         char c = getc(fp);
12158         if (
12159                 19 <= FILE_bufsiz(fp) &&
12160                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12161         )
12162                 exit(0);
12163         exit(1);
12164 }
12165 EOP
12166         set try
12167         if eval $compile; then
12168                 if ./try; then
12169                         echo "And its _base field acts std."
12170                         val="$define"
12171                 else
12172                         echo "But its _base field isn't std."
12173                 fi
12174         else
12175                 echo "However, it seems to be lacking the _base field."
12176         fi
12177         $rm -f try.c try
12178         ;;
12179 esac
12180 set d_stdiobase
12181 eval $setvar
12182
12183 $cat >&4 <<EOM
12184 Checking how to access stdio streams by file descriptor number...
12185 EOM
12186 case "$stdio_stream_array" in
12187 '')     $cat >try.c <<EOCP
12188 #include <stdio.h>
12189 int main() {
12190   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12191     printf("yes\n");
12192 }
12193 EOCP
12194         for s in _iob __iob __sF
12195         do
12196                 set try -DSTDIO_STREAM_ARRAY=$s
12197                 if eval $compile; then
12198                         case "`./try$exe_ext`" in
12199                         yes)    stdio_stream_array=$s; break ;;
12200                         esac
12201                 fi
12202         done
12203         $rm -f try.* try$exe_ext
12204 esac
12205 case "$stdio_stream_array" in
12206 '')     $cat >&4 <<EOM
12207 I can't figure out how to access stdio streams by file descriptor number.
12208 EOM
12209         d_stdio_stream_array="$undef"
12210         ;;
12211 *)      $cat >&4 <<EOM
12212 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12213 EOM
12214         d_stdio_stream_array="$define"
12215         ;;
12216 esac
12217
12218 : see if strcoll exists
12219 set strcoll d_strcoll
12220 eval $inlibc
12221
12222 : check for structure copying
12223 echo " "
12224 echo "Checking to see if your C compiler can copy structs..." >&4
12225 $cat >try.c <<'EOCP'
12226 int main()
12227 {
12228         struct blurfl {
12229                 int dyick;
12230         } foo, bar;
12231
12232         foo = bar;
12233 }
12234 EOCP
12235 if $cc -c try.c >/dev/null 2>&1 ; then
12236         val="$define"
12237         echo "Yup, it can."
12238 else
12239         val="$undef"
12240         echo "Nope, it can't."
12241 fi
12242 set d_strctcpy
12243 eval $setvar
12244 $rm -f try.*
12245
12246 : see if strerror and/or sys_errlist[] exist
12247 echo " "
12248 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12249     if set strerror val -f d_strerror; eval $csym; $val; then
12250                 echo 'strerror() found.' >&4
12251                 d_strerror="$define"
12252                 d_strerrm='strerror(e)'
12253                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12254                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12255                         d_syserrlst="$define"
12256                 else
12257                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12258                         d_syserrlst="$undef"
12259                 fi
12260     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12261                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12262                 echo 'strerror() found in string header.' >&4
12263                 d_strerror="$define"
12264                 d_strerrm='strerror(e)'
12265                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12266                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12267                                 d_syserrlst="$define"
12268                 else
12269                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12270                         d_syserrlst="$undef"
12271                 fi
12272     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12273                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12274                 d_strerror="$undef"
12275                 d_syserrlst="$define"
12276                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12277     else
12278                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12279                 d_strerror="$undef"
12280                 d_syserrlst="$undef"
12281                 d_strerrm='"unknown"'
12282     fi
12283 fi
12284
12285 : see if strftime exists
12286 set strftime d_strftime
12287 eval $inlibc
12288
12289 : see if strtod exists
12290 set strtod d_strtod
12291 eval $inlibc
12292
12293 : see if strtol exists
12294 set strtol d_strtol
12295 eval $inlibc
12296
12297 : see if strtold exists
12298 set strtold d_strtold
12299 eval $inlibc
12300
12301 : see if strtoll exists
12302 set strtoll d_strtoll
12303 eval $inlibc
12304
12305 case "$d_longlong-$d_strtoll" in
12306 "$define-$define")
12307         $cat <<EOM
12308 Checking whether your strtoll() works okay...
12309 EOM
12310         $cat >try.c <<'EOCP'
12311 #include <errno.h>
12312 #ifdef __hpux
12313 #define strtoll __strtoll
12314 #endif
12315 #ifdef __EMX__
12316 #define strtoll _strtoll
12317 #endif
12318 #include <stdio.h>
12319 extern long long int strtoll(char *s, char **, int); 
12320 static int bad = 0;
12321 int check(char *s, long long ell, int een) {
12322         long long gll;
12323         errno = 0;
12324         gll = strtoll(s, 0, 10);
12325         if (!((gll == ell) && (errno == een)))
12326                 bad++;
12327 }
12328 int main() {
12329         check(" 1",                                      1LL, 0);
12330         check(" 0",                                      0LL, 0);
12331         check("-1",                                     -1LL, 0);
12332         check("-9223372036854775808", -9223372036854775808LL, 0);
12333         check("-9223372036854775808", -9223372036854775808LL, 0);
12334         check(" 9223372036854775807",  9223372036854775807LL, 0);
12335         check("-9223372036854775808", -9223372036854775808LL, 0);
12336         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12337         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12338         if (!bad)
12339                 printf("ok\n");
12340 }
12341 EOCP
12342         set try
12343         if eval $compile; then
12344                 yyy=`./try`
12345                 case "$yyy" in
12346                 ok) echo "Your strtoll() seems to be working okay." ;;
12347                 *) cat <<EOM >&4
12348 Your strtoll() doesn't seem to be working okay.
12349 EOM
12350                    d_strtoll="$undef"
12351                    ;;
12352                 esac
12353         else
12354                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12355                 d_strtoll="$undef"
12356         fi
12357         ;;
12358 esac
12359
12360 : see if strtoq exists
12361 set strtoq d_strtoq
12362 eval $inlibc
12363
12364 : see if strtoul exists
12365 set strtoul d_strtoul
12366 eval $inlibc
12367
12368 case "$d_strtoul" in
12369 "$define")
12370         $cat <<EOM
12371 Checking whether your strtoul() works okay...
12372 EOM
12373         $cat >try.c <<'EOCP'
12374 #include <errno.h>
12375 #include <stdio.h>
12376 extern unsigned long int strtoul(char *s, char **, int); 
12377 static int bad = 0;
12378 void check(char *s, unsigned long eul, int een) {
12379         unsigned long gul;
12380         errno = 0;
12381         gul = strtoul(s, 0, 10);
12382         if (!((gul == eul) && (errno == een)))
12383                 bad++;
12384 }
12385 int main() {
12386         check(" 1", 1L, 0);
12387         check(" 0", 0L, 0);
12388 EOCP
12389         case "$longsize" in
12390         8)
12391             $cat >>try.c <<'EOCP'
12392         check("18446744073709551615", 18446744073709551615UL, 0);
12393         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12394 #if 0 /* strtoul() for /^-/ strings is undefined. */
12395         check("-1", 18446744073709551615UL, 0);
12396         check("-18446744073709551614", 2, 0);
12397         check("-18446744073709551615", 1, 0);
12398         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12399         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12400 #endif
12401 EOCP
12402                 ;;
12403         4)
12404                     $cat >>try.c <<'EOCP'
12405         check("4294967295", 4294967295UL, 0);
12406         check("4294967296", 4294967295UL, ERANGE);
12407 #if 0 /* strtoul() for /^-/ strings is undefined. */
12408         check("-1", 4294967295UL, 0);
12409         check("-4294967294", 2, 0);
12410         check("-4294967295", 1, 0);
12411         check("-4294967296", 4294967295UL, ERANGE);
12412         check("-4294967297", 4294967295UL, ERANGE);
12413 #endif
12414 EOCP
12415                 ;;
12416         *)
12417 : Should we write these tests to be more portable by sprintf-ing
12418 : ~0 and then manipulating that char string as input for strtol?
12419                 ;;
12420         esac
12421         $cat >>try.c <<'EOCP'
12422         if (!bad)
12423                 printf("ok\n");
12424         return 0;
12425 }
12426 EOCP
12427         set try
12428         if eval $compile; then
12429                 case "`./try`" in
12430                 ok) echo "Your strtoul() seems to be working okay." ;;
12431                 *) cat <<EOM >&4
12432 Your strtoul() doesn't seem to be working okay.
12433 EOM
12434                    d_strtoul="$undef"
12435                    ;;
12436                 esac
12437         fi
12438         ;;
12439 esac
12440
12441 : see if strtoull exists
12442 set strtoull d_strtoull
12443 eval $inlibc
12444
12445 case "$d_longlong-$d_strtoull" in
12446 "$define-$define")
12447         $cat <<EOM
12448 Checking whether your strtoull() works okay...
12449 EOM
12450         $cat >try.c <<'EOCP'
12451 #include <errno.h>
12452 #ifdef __hpux
12453 #define strtoull __strtoull
12454 #endif
12455 #include <stdio.h>
12456 extern unsigned long long int strtoull(char *s, char **, int); 
12457 static int bad = 0;
12458 int check(char *s, long long eull, int een) {
12459         long long gull;
12460         errno = 0;
12461         gull = strtoull(s, 0, 10);
12462         if (!((gull == eull) && (errno == een)))
12463                 bad++;
12464 }
12465 int main() {
12466         check(" 1",                                        1LL, 0);
12467         check(" 0",                                        0LL, 0);
12468         check("18446744073709551615",  18446744073709551615ULL, 0);
12469         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12470 #if 0 /* strtoull() for /^-/ strings is undefined. */
12471         check("-1",                    18446744073709551615ULL, 0);
12472         check("-18446744073709551614",                     2LL, 0);
12473         check("-18446744073709551615",                     1LL, 0);
12474         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12475         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12476 #endif
12477         if (!bad)
12478                 printf("ok\n");
12479 }
12480 EOCP
12481         set try
12482         if eval $compile; then
12483                 case "`./try`" in
12484                 ok) echo "Your strtoull() seems to be working okay." ;;
12485                 *) cat <<EOM >&4
12486 Your strtoull() doesn't seem to be working okay.
12487 EOM
12488                    d_strtoull="$undef"
12489                    ;;
12490                 esac
12491         fi
12492         ;;
12493 esac
12494
12495 : see if strtouq exists
12496 set strtouq d_strtouq
12497 eval $inlibc
12498
12499 case "$d_strtouq" in
12500 "$define")
12501         $cat <<EOM
12502 Checking whether your strtouq() works okay...
12503 EOM
12504         $cat >try.c <<'EOCP'
12505 #include <errno.h>
12506 #include <stdio.h>
12507 extern unsigned long long int strtouq(char *s, char **, int); 
12508 static int bad = 0;
12509 void check(char *s, unsigned long long eull, int een) {
12510         unsigned long long gull;
12511         errno = 0;
12512         gull = strtouq(s, 0, 10);
12513         if (!((gull == eull) && (errno == een)))
12514                 bad++;
12515 }
12516 int main() {
12517         check(" 1",                                        1LL, 0);
12518         check(" 0",                                        0LL, 0);
12519         check("18446744073709551615",  18446744073709551615ULL, 0);
12520         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12521 #if 0 /* strtouq() for /^-/ strings is undefined. */
12522         check("-1",                    18446744073709551615ULL, 0);
12523         check("-18446744073709551614",                     2LL, 0);
12524         check("-18446744073709551615",                     1LL, 0);
12525         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12526         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12527 #endif
12528         if (!bad)
12529                 printf("ok\n");
12530         return 0;
12531 }
12532 EOCP
12533         set try
12534         if eval $compile; then
12535                 case "`./try`" in
12536                 ok) echo "Your strtouq() seems to be working okay." ;;
12537                 *) cat <<EOM >&4
12538 Your strtouq() doesn't seem to be working okay.
12539 EOM
12540                    d_strtouq="$undef"
12541                    ;;
12542                 esac
12543         fi
12544         ;;
12545 esac
12546
12547 : see if strxfrm exists
12548 set strxfrm d_strxfrm
12549 eval $inlibc
12550
12551 : see if symlink exists
12552 set symlink d_symlink
12553 eval $inlibc
12554
12555 : see if syscall exists
12556 set syscall d_syscall
12557 eval $inlibc
12558
12559 : see if sysconf exists
12560 set sysconf d_sysconf
12561 eval $inlibc
12562
12563 : see if system exists
12564 set system d_system
12565 eval $inlibc
12566
12567 : see if tcgetpgrp exists
12568 set tcgetpgrp d_tcgetpgrp
12569 eval $inlibc
12570
12571 : see if tcsetpgrp exists
12572 set tcsetpgrp d_tcsetpgrp
12573 eval $inlibc
12574
12575 : see if prototype for telldir is available
12576 echo " "
12577 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12578 eval $hasproto
12579
12580 : see if this is a sys/times.h system
12581 set sys/times.h i_systimes
12582 eval $inhdr
12583
12584 : see if times exists
12585 echo " "
12586 if set times val -f d_times; eval $csym; $val; then
12587         echo 'times() found.' >&4
12588         d_times="$define"
12589         inc=''
12590         case "$i_systimes" in
12591         "$define") inc='sys/times.h';;
12592         esac
12593         rp="What is the type returned by times() on this system?"
12594         set clock_t clocktype long stdio.h sys/types.h $inc
12595         eval $typedef_ask
12596 else
12597         echo 'times() NOT found, hope that will do.' >&4
12598         d_times="$undef"
12599         clocktype='int'
12600 fi
12601
12602 : see if truncate exists
12603 set truncate d_truncate
12604 eval $inlibc
12605
12606 : see if tzname[] exists
12607 echo " "
12608 if set tzname val -a d_tzname; eval $csym; $val; then
12609         val="$define"
12610         echo 'tzname[] found.' >&4
12611 else
12612         val="$undef"
12613         echo 'tzname[] NOT found.' >&4
12614 fi
12615 set d_tzname
12616 eval $setvar
12617
12618 case "$crosscompile" in
12619 ''|[nN]*) crosscompile="$undef" ;;
12620 esac
12621
12622 case "$osname" in
12623 next|rhapsody|darwin) multiarch="$define" ;;
12624 esac
12625 case "$multiarch" in
12626 ''|[nN]*) multiarch="$undef" ;;
12627 esac
12628
12629 : check for ordering of bytes in a long
12630 echo " "
12631 case "$crosscompile$multiarch" in
12632 *$define*)
12633         $cat <<EOM
12634 You seem to be either cross-compiling or doing a multiarchitecture build,
12635 skipping the byteorder check.
12636
12637 EOM
12638         byteorder='0xffff'
12639         ;;
12640 *)
12641         case "$byteorder" in
12642         '')
12643                 $cat <<'EOM'
12644 In the following, larger digits indicate more significance.  A big-endian
12645 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12646 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12647 machines may have weird orders like 3412.  A Cray will report 87654321,
12648 an Alpha will report 12345678. If the test program works the default is
12649 probably right.
12650 I'm now running the test program...
12651 EOM
12652                 $cat >try.c <<'EOCP'
12653 #include <stdio.h>
12654 int main()
12655 {
12656         int i;
12657         union {
12658                 unsigned long l;
12659                 char c[sizeof(long)];
12660         } u;
12661
12662         if (sizeof(long) > 4)
12663                 u.l = (0x08070605L << 32) | 0x04030201L;
12664         else
12665                 u.l = 0x04030201L;
12666         for (i = 0; i < sizeof(long); i++)
12667                 printf("%c", u.c[i]+'0');
12668         printf("\n");
12669         exit(0);
12670 }
12671 EOCP
12672                 xxx_prompt=y
12673                 set try
12674                 if eval $compile && ./try > /dev/null; then
12675                         dflt=`./try`
12676                         case "$dflt" in
12677                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12678                                 echo "(The test program ran ok.)"
12679                                 echo "byteorder=$dflt"
12680                                 xxx_prompt=n
12681                         ;;
12682                         ????|????????) echo "(The test program ran ok.)" ;;
12683                         *) echo "(The test program didn't run right for some reason.)" ;;
12684                         esac
12685                 else
12686                         dflt='4321'
12687                         cat <<'EOM'
12688 (I can't seem to compile the test program.  Guessing big-endian...)
12689 EOM
12690                 fi
12691                 case "$xxx_prompt" in
12692                 y)
12693                         rp="What is the order of bytes in a long?"
12694                         . ./myread
12695                         byteorder="$ans"
12696                         ;;
12697                 *)      byteorder=$dflt
12698                         ;;
12699                 esac
12700                 ;;
12701         esac
12702         $rm -f try.c try
12703         ;;
12704 esac
12705
12706
12707 $cat <<EOM
12708
12709 Checking to see whether you can access character data unalignedly...
12710 EOM
12711 $cat >try.c <<EOCP
12712 #include <stdio.h>
12713 #define U32 $u32type
12714 #define BYTEORDER $byteorder
12715 int main() {
12716 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12717     U8 buf[] = "\0\0\0\1\0\0\0\0";
12718     U32 *up;
12719     int i;
12720
12721     if (sizeof(U32) != 4) {
12722         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12723         exit(1);
12724     }
12725
12726     fflush(stdout);
12727
12728     for (i = 0; i < 4; i++) {
12729         up = (U32*)(buf + i);
12730         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12731                (*up == 1 << (8*(3-i)))  /* little-endian */
12732               )
12733            )
12734         {
12735             printf("read failed (%x)\n", *up);
12736             exit(2);
12737         }
12738     }
12739
12740     /* write test */
12741     for (i = 0; i < 4; i++) {
12742         up = (U32*)(buf + i);
12743         *up = 0xBeef;
12744         if (*up != 0xBeef) {
12745             printf("write failed (%x)\n", *up);
12746             exit(3);
12747         }
12748     }
12749
12750     exit(0);
12751 #else
12752     printf("1\n");
12753     exit(1);
12754 #endif
12755     return 0;
12756 }
12757 EOCP
12758 set try
12759 if eval $compile_ok; then
12760         echo "(This test may dump core.)" >&4
12761         ./try >&2 >/dev/null
12762         case "$?" in
12763         0)      cat >&4 <<EOM
12764 You can access character data pretty unalignedly.
12765 EOM
12766                 d_u32align="$undef"
12767                 ;;
12768         *)      cat >&4 <<EOM
12769 It seems that you must access character data in an aligned manner.
12770 EOM
12771                 d_u32align="$define"
12772                 ;;
12773         esac
12774         $rm -f core core.try.* try.core
12775 else
12776         rp='Can you access character data at unaligned addresses?'
12777         dflt='n'
12778         . ./myread
12779         case "$ans" in
12780         [yY]*)  d_u32align="$undef"  ;;
12781         *)      d_u32align="$define" ;;
12782         esac
12783 fi
12784
12785 : see if ualarm exists
12786 set ualarm d_ualarm
12787 eval $inlibc
12788
12789 : see if umask exists
12790 set umask d_umask
12791 eval $inlibc
12792
12793 : see if usleep exists
12794 set usleep d_usleep
12795 eval $inlibc
12796
12797 : see if ustat exists
12798 set ustat d_ustat
12799 eval $inlibc
12800
12801 : backward compatibility for d_hvfork
12802 if test X$d_hvfork != X; then
12803         d_vfork="$d_hvfork"
12804         d_hvfork=''
12805 fi
12806 : see if there is a vfork
12807 val=''
12808 set vfork val
12809 eval $inlibc
12810
12811 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12812 : perl on Solaris 2.x, and probably elsewhere.
12813 case "$val" in
12814 $define)
12815         echo " "
12816         case "$usevfork" in
12817         false) dflt='n';;
12818         *) dflt='y';;
12819         esac
12820         cat <<'EOM'
12821  
12822 Perl can only use a vfork() that doesn't suffer from strict
12823 restrictions on calling functions or modifying global data in
12824 the child.  For example, glibc-2.1 contains such a vfork()
12825 that is unsuitable.  If your system provides a proper fork()
12826 call, chances are that you do NOT want perl to use vfork().
12827
12828 EOM
12829         rp="Do you still want to use vfork()?"
12830         . ./myread
12831         case "$ans" in
12832         y|Y) ;;
12833         *)
12834                 echo "Ok, we won't use vfork()."
12835                 val="$undef"
12836                 ;;
12837         esac
12838         ;;
12839 esac
12840 set d_vfork
12841 eval $setvar
12842 case "$d_vfork" in
12843 $define) usevfork='true';;
12844 *) usevfork='false';;
12845 esac
12846
12847 : see if this is an sysdir system
12848 set sys/dir.h i_sysdir
12849 eval $inhdr
12850
12851 : see if this is an sysndir system
12852 set sys/ndir.h i_sysndir
12853 eval $inhdr
12854
12855 : see if closedir exists
12856 set closedir d_closedir
12857 eval $inlibc
12858
12859 case "$d_closedir" in
12860 "$define")
12861         echo " "
12862         echo "Checking whether closedir() returns a status..." >&4
12863         cat > closedir.c <<EOM
12864 #$i_dirent I_DIRENT             /**/
12865 #$i_sysdir I_SYS_DIR            /**/
12866 #$i_sysndir I_SYS_NDIR          /**/
12867 #$i_systypes I_SYS_TYPES        /**/
12868
12869 #if defined(I_SYS_TYPES)
12870 #include <sys/types.h>
12871 #endif
12872 #if defined(I_DIRENT)
12873 #include <dirent.h>
12874 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12875 #include <sys/dir.h>
12876 #endif
12877 #else
12878 #ifdef I_SYS_NDIR
12879 #include <sys/ndir.h>
12880 #else
12881 #ifdef I_SYS_DIR
12882 #ifdef hp9000s500
12883 #include <ndir.h>       /* may be wrong in the future */
12884 #else
12885 #include <sys/dir.h>
12886 #endif
12887 #endif
12888 #endif
12889 #endif 
12890 int main() { return closedir(opendir(".")); }
12891 EOM
12892         set closedir
12893         if eval $compile_ok; then
12894                 if ./closedir > /dev/null 2>&1 ; then
12895                         echo "Yes, it does."
12896                         val="$undef"
12897                 else
12898                         echo "No, it doesn't."
12899                         val="$define"
12900                 fi
12901         else
12902                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12903                 val="$define"
12904         fi
12905         ;;
12906 *)
12907         val="$undef";
12908         ;;
12909 esac
12910 set d_void_closedir
12911 eval $setvar
12912 $rm -f closedir*
12913 : see if there is a wait4
12914 set wait4 d_wait4
12915 eval $inlibc
12916
12917 : see if waitpid exists
12918 set waitpid d_waitpid
12919 eval $inlibc
12920
12921 : see if wcstombs exists
12922 set wcstombs d_wcstombs
12923 eval $inlibc
12924
12925 : see if wctomb exists
12926 set wctomb d_wctomb
12927 eval $inlibc
12928
12929 : see if writev exists
12930 set writev d_writev
12931 eval $inlibc
12932
12933 : preserve RCS keywords in files with variable substitution, grrr
12934 Date='$Date'
12935 Id='$Id'
12936 Log='$Log'
12937 RCSfile='$RCSfile'
12938 Revision='$Revision'
12939
12940 : check for alignment requirements
12941 echo " "
12942 case "$crosscompile$multiarch" in
12943 *$define*)
12944         $cat <<EOM
12945 You seem to be either cross-compiling or doing a multiarchitecture build,
12946 skipping the memory alignment check.
12947
12948 EOM
12949         case "$alignbytes" in
12950         '') alignbytes=8 ;;
12951         esac
12952         ;;
12953 *)
12954         case "$alignbytes" in
12955         '') echo "Checking alignment constraints..." >&4
12956                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12957                         $cat >try.c <<'EOCP'
12958 typedef long double NV;
12959 EOCP
12960                 else
12961                         $cat >try.c <<'EOCP'
12962 typedef double NV;
12963 EOCP
12964                 fi
12965                 $cat >>try.c <<'EOCP'
12966 #include <stdio.h>
12967 struct foobar {
12968         char foo;
12969         NV bar;
12970 } try_algn;
12971 int main()
12972 {
12973     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12974     return(0);
12975 }
12976 EOCP
12977                 set try
12978                 if eval $compile_ok; then
12979                         dflt=`./try`
12980                 else
12981                         dflt='8'
12982                         echo "(I can't seem to compile the test program...)"
12983                 fi
12984                 ;;
12985         *) dflt="$alignbytes"
12986                 ;;
12987         esac
12988         rp="Doubles must be aligned on a how-many-byte boundary?"
12989         . ./myread
12990         alignbytes="$ans"
12991         $rm -f try.c try
12992         ;;
12993 esac
12994
12995
12996 : set the base revision
12997 baserev=5.0
12998
12999 : how do we catenate cpp tokens here?
13000 echo " "
13001 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13002 $cat >cpp_stuff.c <<'EOCP'
13003 #define RCAT(a,b)a/**/b
13004 #define ACAT(a,b)a ## b
13005 RCAT(Rei,ser)
13006 ACAT(Cir,cus)
13007 EOCP
13008 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13009 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13010         echo "Oh!  Smells like ANSI's been here." >&4
13011         echo "We can catify or stringify, separately or together!"
13012         cpp_stuff=42
13013 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13014         echo "Ah, yes!  The good old days!" >&4
13015         echo "However, in the good old days we don't know how to stringify and"
13016         echo "catify at the same time."
13017         cpp_stuff=1
13018 else
13019         $cat >&4 <<EOM
13020 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13021 to have to edit the values of CAT[2-5] in config.h...
13022 EOM
13023         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13024 fi
13025 $rm -f cpp_stuff.*
13026
13027 : see if this is a db.h system
13028 set db.h i_db
13029 eval $inhdr
13030
13031 case "$i_db" in
13032 $define)
13033         : Check db version.
13034         echo " "
13035         echo "Checking Berkeley DB version ..." >&4
13036         $cat >try.c <<EOCP
13037 #$d_const HASCONST
13038 #ifndef HASCONST
13039 #define const
13040 #endif
13041 #include <sys/types.h>
13042 #include <stdio.h>
13043 #include <db.h>
13044 int main(int argc, char *argv[])
13045 {
13046 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13047     int Major, Minor, Patch ;
13048     unsigned long Version ;
13049     (void)db_version(&Major, &Minor, &Patch) ;
13050     if (argc == 2) {
13051         printf("%d %d %d %d %d %d\n",
13052                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13053                Major, Minor, Patch);
13054         exit(0);
13055     }
13056     printf("You have Berkeley DB Version 2 or greater.\n");
13057
13058     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13059                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13060     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13061                 Major, Minor, Patch) ;
13062
13063     /* check that db.h & libdb are compatible */
13064     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13065         printf("db.h and libdb are incompatible.\n") ;
13066         exit(3);        
13067     }
13068
13069     printf("db.h and libdb are compatible.\n") ;
13070
13071     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13072                 + DB_VERSION_PATCH ;
13073
13074     /* needs to be >= 2.3.4 */
13075     if (Version < 2003004) {
13076     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13077         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13078         exit(2);        
13079     }
13080
13081     exit(0);
13082 #else
13083 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13084     if (argc == 2) {
13085         printf("1 0 0\n");
13086         exit(0);
13087     }
13088     printf("You have Berkeley DB Version 1.\n");
13089     exit(0);    /* DB version < 2: the coast is clear. */
13090 #else
13091     exit(1);    /* <db.h> not Berkeley DB? */
13092 #endif
13093 #endif
13094 }
13095 EOCP
13096         set try
13097         if eval $compile_ok && ./try; then
13098                 echo 'Looks OK.' >&4
13099                 set `./try 1`
13100                 db_version_major=$1
13101                 db_version_minor=$2
13102                 db_version_patch=$3
13103         else
13104                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13105                 i_db=$undef
13106                 case " $libs " in
13107                 *"-ldb "*)
13108                         : Remove db from list of libraries to use
13109                         echo "Removing unusable -ldb from library list" >&4
13110                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13111                         shift
13112                         libs="$*"
13113                         echo "libs = $libs" >&4
13114                         ;;
13115                 esac
13116         fi
13117         $rm -f try.*
13118         ;;
13119 esac
13120
13121 case "$i_db" in
13122 define)
13123         : Check the return type needed for hash 
13124         echo " "
13125         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13126         $cat >try.c <<EOCP
13127 #$d_const HASCONST
13128 #ifndef HASCONST
13129 #define const
13130 #endif
13131 #include <sys/types.h>
13132 #include <db.h>
13133
13134 #ifndef DB_VERSION_MAJOR
13135 u_int32_t hash_cb (ptr, size)
13136 const void *ptr;
13137 size_t size;
13138 {
13139 }
13140 HASHINFO info;
13141 int main()
13142 {
13143         info.hash = hash_cb;
13144 }
13145 #endif
13146 EOCP
13147         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13148                 if $contains warning try.out >>/dev/null 2>&1 ; then
13149                         db_hashtype='int'
13150                 else
13151                         db_hashtype='u_int32_t'
13152                 fi
13153         else
13154                 : XXX Maybe we should just give up here.
13155                 db_hashtype=u_int32_t
13156                 $cat try.out >&4
13157                 echo "Help:  I can't seem to compile the db test program." >&4
13158                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13159         fi
13160         $rm -f try.*
13161         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13162         ;;
13163 *)      db_hashtype=u_int32_t
13164         ;;
13165 esac
13166 case "$i_db" in
13167 define)
13168         : Check the return type needed for prefix 
13169         echo " "
13170         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13171         cat >try.c <<EOCP
13172 #$d_const HASCONST
13173 #ifndef HASCONST
13174 #define const
13175 #endif
13176 #include <sys/types.h>
13177 #include <db.h>
13178
13179 #ifndef DB_VERSION_MAJOR
13180 size_t prefix_cb (key1, key2)
13181 const DBT *key1;
13182 const DBT *key2;
13183 {
13184 }
13185 BTREEINFO info;
13186 int main()
13187 {
13188         info.prefix = prefix_cb;
13189 }
13190 #endif
13191 EOCP
13192         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13193                 if $contains warning try.out >>/dev/null 2>&1 ; then
13194                         db_prefixtype='int'
13195                 else
13196                         db_prefixtype='size_t'
13197                 fi
13198         else
13199                 db_prefixtype='size_t'
13200                 : XXX Maybe we should just give up here.
13201                 $cat try.out >&4
13202                 echo "Help:  I can't seem to compile the db test program." >&4
13203                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13204         fi
13205         $rm -f try.*
13206         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13207         ;;
13208 *)      db_prefixtype='size_t'
13209         ;;
13210 esac
13211
13212
13213 : How can we generate normalized random numbers ?
13214 echo " "
13215 echo "Looking for a random number function..." >&4
13216 case "$randfunc" in
13217 '')
13218         if set drand48 val -f; eval $csym; $val; then
13219                 dflt="drand48"
13220                 echo "Good, found drand48()." >&4
13221         elif set random val -f; eval $csym; $val; then
13222                 dflt="random"
13223                 echo "OK, found random()." >&4
13224         else
13225                 dflt="rand"
13226                 echo "Yick, looks like I have to use rand()." >&4
13227         fi
13228         echo " "
13229         ;;
13230 *)
13231         dflt="$randfunc"
13232         ;;
13233 esac
13234 cont=true
13235
13236 case "$ccflags" in
13237 *-Dmy_rand=*|*-Dmy_srand=*)
13238         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13239         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13240         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13241         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13242         ;;
13243 esac
13244
13245 while $test "$cont"; do
13246         rp="Use which function to generate random numbers?"
13247         . ./myread
13248         if $test "$ans" = "$dflt"; then
13249                 : null
13250         else
13251                 randbits=''
13252         fi
13253         randfunc="$ans"
13254         if set $ans val -f; eval $csym; $val; then
13255                 cont=''
13256         else
13257                 dflt=y
13258                 rp="I cannot find function $ans. Use that name anyway?"
13259                 . ./myread
13260                 dflt=rand
13261                 case "$ans" in
13262                         [yY]*) cont='';;
13263                 esac
13264         fi
13265         case "$cont" in
13266         '')
13267                 case "$randfunc" in
13268                 drand48)
13269                         drand01="drand48()"
13270                         seedfunc="srand48"
13271                         randbits=48
13272                         randseedtype=long
13273                         ;;
13274                 rand|random)
13275                         case "$randbits" in
13276                         '')
13277 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13278                                 $cat >try.c <<EOCP
13279 #$i_unistd I_UNISTD
13280 #$i_stdlib I_STDLIB
13281 #include <stdio.h>
13282 #ifdef I_UNISTD
13283 #  include <unistd.h>
13284 #endif
13285 #ifdef I_STDLIB
13286 #  include <stdlib.h>
13287 #endif
13288 int main()
13289 {
13290         register int i;
13291         register unsigned long tmp;
13292         register unsigned long max = 0L;
13293
13294         for (i = 1000; i; i--) {
13295                 tmp = (unsigned long) $randfunc();
13296                 if (tmp > max) max = tmp;
13297         }
13298         for (i = 0; max; i++)
13299                 max /= 2;
13300         printf("%d\n",i);
13301 }
13302 EOCP
13303                                 set try
13304                                 if eval $compile_ok; then
13305                                         dflt=`try`
13306                                 else
13307                                         dflt='?'
13308                                         echo "(I can't seem to compile the test program...)"
13309                                 fi
13310                                 ;;
13311                         *)
13312                                 dflt="$randbits"
13313                                 ;;
13314                         esac
13315                         rp="How many bits does your $randfunc() function produce?"
13316                         . ./myread
13317                         randbits="$ans"
13318                         $rm -f try.c try
13319                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13320                         seedfunc="s$randfunc"
13321                         randseedtype=unsigned
13322                         ;;
13323                 *)
13324                         dflt="31"
13325                         rp="How many bits does your $randfunc() function produce?"
13326                         . ./myread
13327                         randbits="$ans"
13328                         seedfunc="s$randfunc"
13329                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13330                         if set $seedfunc val -f; eval $csym; $val; then
13331                                 echo "(Using $seedfunc() to seed random generator)"
13332                         else
13333                                 echo "(Warning: no $seedfunc() to seed random generator)"
13334                                 seedfunc=rand
13335                         fi
13336                         randseedtype=unsigned
13337                         ;;
13338                 esac
13339                 ;;
13340         esac
13341 done
13342
13343 echo " "
13344 echo "Determining whether or not we are on an EBCDIC system..." >&4
13345 $cat >tebcdic.c <<'EOM'
13346 int main()
13347 {
13348   if ('M'==0xd4) return 0;
13349   return 1;
13350 }
13351 EOM
13352
13353 val=$undef
13354 set tebcdic
13355 if eval $compile_ok; then
13356         if ./tebcdic; then
13357                 echo "You seem to speak EBCDIC." >&4
13358                 val="$define"
13359         else
13360                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13361         fi
13362 else
13363         echo "I'm unable to compile the test program." >&4
13364         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13365 fi
13366 $rm -f tebcdic.c tebcdic
13367 set ebcdic
13368 eval $setvar
13369
13370 echo " "
13371 $cat >&4 <<EOM
13372 Checking how to flush all pending stdio output...
13373 EOM
13374 # I only know how to find the first 32 possibly open files on SunOS.
13375 # See also hints/sunos_4_1.sh and util.c  --AD
13376 case "$osname" in
13377 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13378 esac
13379 $cat >>try.c <<EOCP
13380 #include <stdio.h>
13381 #$i_unistd I_UNISTD
13382 #ifdef I_UNISTD
13383 # include <unistd.h>
13384 #endif
13385 #$d_sysconf HAS_SYSCONF
13386 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13387 #ifdef HAS_STDIO_STREAM_ARRAY
13388 # define STDIO_STREAM_ARRAY $stdio_stream_array
13389 #endif
13390 int main() {
13391   FILE* p = fopen("try.out", "w");
13392 #ifdef TRY_FPUTC
13393   fputc('x', p);
13394 #else
13395 # ifdef TRY_FPRINTF
13396   fprintf(p, "x");
13397 # endif
13398 #endif
13399 #ifdef TRY_FFLUSH_NULL
13400   fflush(NULL);
13401 #endif
13402 #ifdef TRY_FFLUSH_ALL
13403   {
13404     long open_max = -1;
13405 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13406     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13407 # else
13408 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13409     open_max = sysconf(_SC_OPEN_MAX);
13410 #  else
13411 #   ifdef FOPEN_MAX
13412     open_max = FOPEN_MAX;
13413 #   else
13414 #    ifdef OPEN_MAX
13415     open_max = OPEN_MAX;
13416 #    else
13417 #     ifdef _NFILE
13418     open_max = _NFILE;
13419 #     endif
13420 #    endif
13421 #   endif
13422 #  endif
13423 # endif 
13424 # ifdef HAS_STDIO_STREAM_ARRAY
13425     if (open_max > 0) {
13426       long i;
13427       for (i = 0; i < open_max; i++)
13428             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13429                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13430                 STDIO_STREAM_ARRAY[i]._flag)
13431                 fflush(&STDIO_STREAM_ARRAY[i]);
13432     }   
13433   }
13434 # endif
13435 #endif
13436   _exit(42);
13437 }
13438 EOCP
13439 : first we have to find out how _not_ to flush
13440 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13441     output=''
13442     set try -DTRY_FPUTC
13443     if eval $compile; then
13444             $rm -f try.out
13445             ./try$exe_ext 2>/dev/null
13446             if $test ! -s try.out -a "X$?" = X42; then
13447                 output=-DTRY_FPUTC
13448             fi
13449     fi
13450     case "$output" in
13451     '')
13452             set try -DTRY_FPRINTF
13453             $rm -f try.out
13454             if eval $compile; then
13455                     $rm -f try.out
13456                     ./try$exe_ext 2>/dev/null
13457                     if $test ! -s try.out -a "X$?" = X42; then
13458                         output=-DTRY_FPRINTF
13459                     fi
13460             fi
13461         ;;
13462     esac
13463 fi
13464 : check for fflush NULL behaviour
13465 case "$fflushNULL" in
13466 '')     set try -DTRY_FFLUSH_NULL $output
13467         if eval $compile; then
13468                 $rm -f try.out
13469                 ./try$exe_ext 2>/dev/null
13470                 code="$?"
13471                 if $test -s try.out -a "X$code" = X42; then
13472                         fflushNULL="`$cat try.out`"
13473                 else
13474                         if $test "X$code" != X42; then
13475                                 $cat >&4 <<EOM
13476 (If this test failed, don't worry, we'll try another method shortly.)
13477 EOM
13478                         fi
13479                 fi
13480         fi
13481         $rm -f core try.core core.try.*
13482         case "$fflushNULL" in
13483         x)      $cat >&4 <<EOM
13484 Your fflush(NULL) works okay for output streams.
13485 Let's see if it clobbers input pipes...
13486 EOM
13487 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13488 # bug that improperly flushes the input end of pipes.  So we avoid the
13489 # autoflush on fork/system/exec support for now. :-(
13490 $cat >tryp.c <<EOCP
13491 #include <stdio.h>
13492 int
13493 main(int argc, char **argv)
13494 {
13495     char buf[1024];
13496     int i;
13497     char *bp = buf;
13498     while (1) {
13499         while ((i = getc(stdin)) != -1
13500                && (*bp++ = i) != '\n'
13501                && bp < &buf[1024])
13502         /* DO NOTHING */ ;
13503         *bp = '\0';
13504         fprintf(stdout, "%s", buf);
13505         fflush(NULL);
13506         if (i == -1)
13507             return 0;
13508         bp = buf;
13509     }
13510 }
13511 EOCP
13512                 fflushNULL="$define"
13513                 set tryp
13514                 if eval $compile; then
13515                     $rm -f tryp.out
13516                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13517                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13518                        $cat >&4 <<EOM
13519 fflush(NULL) seems to behave okay with input streams.
13520 EOM
13521                         fflushNULL="$define"
13522                     else
13523                         $cat >&4 <<EOM
13524 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13525 EOM
13526                         fflushNULL="$undef"
13527                     fi
13528                 fi
13529                 $rm -f core tryp.c tryp.core core.tryp.*
13530                 ;;
13531         '')     $cat >&4 <<EOM
13532 Your fflush(NULL) isn't working (contrary to ANSI C).
13533 EOM
13534                 fflushNULL="$undef"
13535                 ;;
13536         *)      $cat >&4 <<EOM
13537 Cannot figure out whether your fflush(NULL) works or not.
13538 I'm assuming it doesn't (contrary to ANSI C).
13539 EOM
13540                 fflushNULL="$undef"
13541                 ;;
13542         esac
13543         ;;
13544 $define|true|[yY]*)
13545         fflushNULL="$define"
13546         ;;
13547 *)
13548         fflushNULL="$undef"
13549         ;;
13550 esac
13551 : check explicit looping only if NULL did not work, and if the pipe
13552 : bug does not show up on an explicit flush too
13553 case "$fflushNULL" in
13554 "$undef")
13555         $cat >tryp.c <<EOCP
13556 #include <stdio.h>
13557 int
13558 main(int argc, char **argv)
13559 {
13560     char buf[1024];
13561     int i;
13562     char *bp = buf;
13563     while (1) {
13564         while ((i = getc(stdin)) != -1
13565                && (*bp++ = i) != '\n'
13566                && bp < &buf[1024])
13567         /* DO NOTHING */ ;
13568         *bp = '\0';
13569         fprintf(stdout, "%s", buf);
13570         fflush(stdin);
13571         if (i == -1)
13572             return 0;
13573         bp = buf;
13574     }
13575 }
13576 EOCP
13577         set tryp
13578         if eval $compile; then
13579             $rm -f tryp.out
13580             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13581             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13582                $cat >&4 <<EOM
13583 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13584 EOM
13585                 : now check for fflushall behaviour
13586                 case "$fflushall" in
13587                 '')     set try -DTRY_FFLUSH_ALL $output
13588                         if eval $compile; then
13589                                 $cat >&4 <<EOM
13590 (Now testing the other method--but note that this also may fail.)
13591 EOM
13592                                 $rm -f try.out
13593                                 ./try$exe_ext 2>/dev/null
13594                                 if $test -s try.out -a "X$?" = X42; then
13595                                         fflushall="`$cat try.out`"
13596                                 fi
13597                         fi
13598                         $rm -f core try.core core.try.*
13599                         case "$fflushall" in
13600                         x)      $cat >&4 <<EOM
13601 Whew. Flushing explicitly all the stdio streams works.
13602 EOM
13603                                 fflushall="$define"
13604                                 ;;
13605                         '')     $cat >&4 <<EOM
13606 Sigh. Flushing explicitly all the stdio streams doesn't work.
13607 EOM
13608                                 fflushall="$undef"
13609                                 ;;
13610                         *)      $cat >&4 <<EOM
13611 Cannot figure out whether flushing stdio streams explicitly works or not.
13612 I'm assuming it doesn't.
13613 EOM
13614                                 fflushall="$undef"
13615                                 ;;
13616                         esac
13617                         ;;
13618                 "$define"|true|[yY]*)
13619                         fflushall="$define"
13620                         ;;
13621                 *)
13622                         fflushall="$undef"
13623                         ;;
13624                 esac
13625             else
13626                 $cat >&4 <<EOM
13627 All is futile.  Even fflush(stdin) clobbers input pipes!
13628 EOM
13629                 fflushall="$undef"
13630             fi
13631         else
13632             fflushall="$undef"
13633         fi
13634         $rm -f core tryp.c tryp.core core.tryp.*
13635         ;;
13636 *)      fflushall="$undef"
13637         ;;
13638 esac
13639
13640 case "$fflushNULL$fflushall" in
13641 undefundef)
13642         $cat <<EOM
13643 OK, I give up.  I cannot figure out how to flush pending stdio output.
13644 We won't be flushing handles at all before fork/exec/popen.
13645 EOM
13646         ;;
13647 esac
13648 $rm -f try.* try$exe_ext
13649
13650 : Store the full pathname to the ar program for use in the C program
13651 : Respect a hint or command line value for full_ar.
13652 case "$full_ar" in
13653 '') full_ar=$ar ;;
13654 esac
13655
13656 : Store the full pathname to the sed program for use in the C program
13657 full_sed=$sed
13658
13659 : see what type gids are declared as in the kernel
13660 echo " "
13661 echo "Looking for the type for group ids returned by getgid()."
13662 set gid_t gidtype xxx stdio.h sys/types.h
13663 eval $typedef
13664 case "$gidtype" in
13665 xxx)
13666         xxx=`./findhdr sys/user.h`
13667         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13668         case $1 in
13669         unsigned) dflt="$1 $2" ;;
13670         *) dflt="$1" ;;
13671         esac
13672         ;;
13673 *) dflt="$gidtype";;
13674 esac
13675 case "$gidtype" in
13676 gid_t) echo "gid_t found." ;;
13677 *)      rp="What is the type for group ids returned by getgid()?"
13678         . ./myread
13679         gidtype="$ans"
13680         ;;
13681 esac
13682
13683 echo " "
13684 case "$gidtype" in
13685 *_t) zzz="$gidtype"     ;;
13686 *)   zzz="gid"          ;;
13687 esac
13688 echo "Checking the size of $zzz..." >&4 
13689 cat > try.c <<EOCP
13690 #include <sys/types.h>
13691 #include <stdio.h>
13692 int main() {
13693     printf("%d\n", (int)sizeof($gidtype));
13694     exit(0);
13695 }
13696 EOCP
13697 set try
13698 if eval $compile_ok; then
13699         yyy=`./try`
13700         case "$yyy" in
13701         '')     gidsize=4
13702                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13703                 ;;
13704         *)      gidsize=$yyy
13705                 echo "Your $zzz is $gidsize bytes long."
13706                 ;;
13707         esac
13708 else
13709         gidsize=4
13710         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13711 fi
13712
13713
13714 echo " "
13715 case "$gidtype" in
13716 *_t) zzz="$gidtype"     ;;
13717 *)   zzz="gid"          ;;
13718 esac
13719 echo "Checking the sign of $zzz..." >&4 
13720 cat > try.c <<EOCP
13721 #include <sys/types.h>
13722 #include <stdio.h>
13723 int main() {
13724         $gidtype foo = -1;
13725         if (foo < 0)
13726                 printf("-1\n");
13727         else
13728                 printf("1\n");
13729 }
13730 EOCP
13731 set try
13732 if eval $compile; then
13733         yyy=`./try`
13734         case "$yyy" in
13735         '')     gidsign=1
13736                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13737                 ;;
13738         *)      gidsign=$yyy
13739                 case "$gidsign" in
13740                  1) echo "Your $zzz is unsigned." ;;
13741                 -1) echo "Your $zzz is signed."   ;;
13742                 esac
13743                 ;;
13744         esac
13745 else
13746         gidsign=1
13747         echo "(I can't compile the test program--guessing unsigned.)" >&4
13748 fi
13749
13750
13751 echo " "
13752
13753 if $test X"$quadtype" != X; then
13754
13755 echo "Checking how to print 64-bit integers..." >&4
13756
13757 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13758         $cat >try.c <<'EOCP'
13759 #include <sys/types.h>
13760 #include <stdio.h>
13761 int main() {
13762   int q = 12345678901;
13763   printf("%ld\n", q);
13764 }
13765 EOCP
13766         set try
13767         if eval $compile; then
13768                 yyy=`./try$exe_ext`
13769                 case "$yyy" in
13770                 12345678901)
13771                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13772                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13773                         echo "We will use %d."
13774                         ;;
13775                 esac
13776         fi
13777 fi
13778
13779 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13780         $cat >try.c <<'EOCP'
13781 #include <sys/types.h>
13782 #include <stdio.h>
13783 int main() {
13784   long q = 12345678901;
13785   printf("%ld\n", q);
13786 }
13787 EOCP
13788         set try
13789         if eval $compile; then
13790                 yyy=`./try$exe_ext`
13791                 case "$yyy" in
13792                 12345678901)
13793                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13794                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13795                         echo "We will use %ld."
13796                         ;;
13797                 esac
13798         fi
13799 fi
13800
13801 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13802         $cat >try.c <<'EOCP'
13803 #include <sys/types.h>
13804 #include <inttypes.h>
13805 #include <stdio.h>
13806 int main() {
13807   int64_t q = 12345678901;
13808   printf("%" PRId64 "\n", q);
13809 }
13810 EOCP
13811         set try
13812         if eval $compile; then
13813                 yyy=`./try$exe_ext`
13814                 case "$yyy" in
13815                 12345678901)
13816                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13817                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13818                         echo "We will use the C9X style."
13819                         ;;
13820                 esac
13821         fi
13822 fi
13823
13824 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13825         $cat >try.c <<'EOCP'
13826 #include <sys/types.h>
13827 #include <stdio.h>
13828 int main() {
13829   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13830   printf("%lld\n", q);
13831 }
13832 EOCP
13833         set try
13834         if eval $compile; then
13835                 yyy=`./try$exe_ext`
13836                 case "$yyy" in
13837                 12345678901)
13838                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13839                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13840                         echo "We will use the %lld style."
13841                         ;;
13842                 esac
13843         fi
13844 fi
13845
13846 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13847         $cat >try.c <<EOCP
13848 #include <sys/types.h>
13849 #include <stdio.h>
13850 int main() {
13851   $quadtype q = 12345678901;
13852   printf("%Ld\n", q);
13853 }
13854 EOCP
13855         set try
13856         if eval $compile; then
13857                 yyy=`./try$exe_ext`
13858                 case "$yyy" in
13859                 12345678901)
13860                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13861                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13862                         echo "We will use %Ld."
13863                         ;;
13864                 esac
13865         fi
13866 fi
13867
13868 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13869         $cat >try.c <<EOCP
13870 #include <sys/types.h>
13871 #include <stdio.h>
13872 int main() {
13873   $quadtype q = 12345678901;
13874   printf("%qd\n", q);
13875 }
13876 EOCP
13877         set try
13878         if eval $compile; then
13879                 yyy=`./try$exe_ext`
13880                 case "$yyy" in
13881                 12345678901)
13882                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13883                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13884                         echo "We will use %qd."
13885                         ;;
13886                 esac
13887         fi
13888 fi
13889
13890 if $test X"$sPRId64" = X; then
13891         echo "Cannot figure out how to print 64-bit integers." >&4
13892 fi
13893
13894 $rm -f try try.*
13895
13896 fi
13897
13898 case "$sPRId64" in
13899 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13900         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13901         ;;
13902 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13903         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13904         ;;
13905 esac
13906
13907
13908 echo " "
13909 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13910
13911 if $test X"$ivsize" = X8; then
13912         ivdformat="$sPRId64"
13913         uvuformat="$sPRIu64"
13914         uvoformat="$sPRIo64"
13915         uvxformat="$sPRIx64"
13916         uvXUformat="$sPRIXU64"
13917 else
13918         if $test X"$ivsize" = X"$longsize"; then
13919                 ivdformat='"ld"'
13920                 uvuformat='"lu"'
13921                 uvoformat='"lo"'
13922                 uvxformat='"lx"'
13923                 uvXUformat='"lX"'
13924         else
13925                 if $test X"$ivsize" = X"$intsize"; then
13926                         ivdformat='"d"'
13927                         uvuformat='"u"'
13928                         uvoformat='"o"'
13929                         uvxformat='"x"'
13930                         uvXUformat='"X"'
13931                 else
13932                         : far out
13933                         if $test X"$ivsize" = X"$shortsize"; then
13934                                 ivdformat='"hd"'
13935                                 uvuformat='"hu"'
13936                                 uvoformat='"ho"'
13937                                 uvxformat='"hx"'
13938                                 uvXUformat='"hX"'
13939                         fi
13940                 fi
13941         fi
13942 fi
13943
13944 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13945         nveformat="$sPRIeldbl"
13946         nvfformat="$sPRIfldbl"
13947         nvgformat="$sPRIgldbl"
13948         nvEUformat="$sPRIEUldbl"
13949         nvFUformat="$sPRIFUldbl"
13950         nvGUformat="$sPRIGUldbl"
13951 else
13952         nveformat='"e"'
13953         nvfformat='"f"'
13954         nvgformat='"g"'
13955         nvEUformat='"E"'
13956         nvFUformat='"F"'
13957         nvGUformat='"G"'
13958 fi
13959
13960 case "$ivdformat" in
13961 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13962     exit 1
13963     ;;
13964 esac
13965
13966
13967 echo " "
13968 $echo "Checking the format string to be used for gids..." >&4
13969
13970 case "$gidsign" in
13971 -1)     if $test X"$gidsize" = X"$ivsize"; then
13972                 gidformat="$ivdformat"
13973         else
13974                 if $test X"$gidsize" = X"$longsize"; then
13975                         gidformat='"ld"'
13976                 else
13977                         if $test X"$gidsize" = X"$intsize"; then
13978                                 gidformat='"d"'
13979                         else
13980                                 if $test X"$gidsize" = X"$shortsize"; then
13981                                         gidformat='"hd"'
13982                                 fi
13983                         fi
13984                 fi
13985         fi
13986         ;;
13987 *)      if $test X"$gidsize" = X"$uvsize"; then
13988                 gidformat="$uvuformat"
13989         else
13990                 if $test X"$gidsize" = X"$longsize"; then
13991                         gidformat='"lu"'
13992                 else
13993                         if $test X"$gidsize" = X"$intsize"; then
13994                                 gidformat='"u"'
13995                         else
13996                                 if $test X"$gidsize" = X"$shortsize"; then
13997                                         gidformat='"hu"'
13998                                 fi
13999                         fi
14000                 fi
14001         fi
14002         ;;
14003 esac
14004
14005 : see if getgroups exists
14006 set getgroups d_getgrps
14007 eval $inlibc
14008
14009 : see if setgroups exists
14010 set setgroups d_setgrps
14011 eval $inlibc
14012
14013
14014 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14015 echo " "
14016 case "$d_getgrps$d_setgrps" in
14017 *define*)
14018         case "$groupstype" in
14019         '') dflt="$gidtype" ;;
14020         *)  dflt="$groupstype" ;;
14021         esac
14022         $cat <<EOM
14023 What type of pointer is the second argument to getgroups() and setgroups()?
14024 Usually this is the same as group ids, $gidtype, but not always.
14025
14026 EOM
14027         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14028         . ./myread
14029         groupstype="$ans"
14030         ;;
14031 *)  groupstype="$gidtype";;
14032 esac
14033
14034 echo " "
14035 echo "Checking if your $make program sets \$(MAKE)..." >&4
14036 case "$make_set_make" in
14037 '')
14038         $sed 's/^X //' > testmake.mak << 'EOF'
14039 Xall:
14040 X       @echo 'maketemp="$(MAKE)"'
14041 EOF
14042         case "`$make -f testmake.mak 2>/dev/null`" in
14043         *maketemp=*) make_set_make='#' ;;
14044         *)      make_set_make="MAKE=$make" ;;
14045         esac
14046         $rm -f testmake.mak
14047         ;;
14048 esac
14049 case "$make_set_make" in
14050 '#') echo "Yup, it does.";;
14051 *) echo "Nope, it doesn't.";;
14052 esac
14053
14054 : see what type is used for mode_t
14055 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14056 set mode_t modetype int stdio.h sys/types.h
14057 eval $typedef_ask
14058
14059 : see if stdarg is available
14060 echo " "
14061 if $test `./findhdr stdarg.h`; then
14062         echo "<stdarg.h> found." >&4
14063         valstd="$define"
14064 else
14065         echo "<stdarg.h> NOT found." >&4
14066         valstd="$undef"
14067 fi
14068
14069 : see if varags is available
14070 echo " "
14071 if $test `./findhdr varargs.h`; then
14072         echo "<varargs.h> found." >&4
14073 else
14074         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14075 fi
14076
14077 : set up the varargs testing programs
14078 $cat > varargs.c <<EOP
14079 #ifdef I_STDARG
14080 #include <stdarg.h>
14081 #endif
14082 #ifdef I_VARARGS
14083 #include <varargs.h>
14084 #endif
14085
14086 #ifdef I_STDARG
14087 int f(char *p, ...)
14088 #else
14089 int f(va_alist)
14090 va_dcl
14091 #endif
14092 {
14093         va_list ap;
14094 #ifndef I_STDARG
14095         char *p;
14096 #endif
14097 #ifdef I_STDARG
14098         va_start(ap,p);
14099 #else
14100         va_start(ap);
14101         p = va_arg(ap, char *);
14102 #endif
14103         va_end(ap);
14104 }
14105 EOP
14106 $cat > varargs <<EOP
14107 $startsh
14108 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14109         echo "true"
14110 else
14111         echo "false"
14112 fi
14113 $rm -f varargs$_o
14114 EOP
14115 chmod +x varargs
14116
14117 : now check which varargs header should be included
14118 echo " "
14119 i_varhdr=''
14120 case "$valstd" in
14121 "$define")
14122         if `./varargs I_STDARG`; then
14123                 val='stdarg.h'
14124         elif `./varargs I_VARARGS`; then
14125                 val='varargs.h'
14126         fi
14127         ;;
14128 *)
14129         if `./varargs I_VARARGS`; then
14130                 val='varargs.h'
14131         fi
14132         ;;
14133 esac
14134 case "$val" in
14135 '')
14136 echo "I could not find the definition for va_dcl... You have problems..." >&4
14137         val="$undef"; set i_stdarg; eval $setvar
14138         val="$undef"; set i_varargs; eval $setvar
14139         ;;
14140 *) 
14141         set i_varhdr
14142         eval $setvar
14143         case "$i_varhdr" in
14144         stdarg.h)
14145                 val="$define"; set i_stdarg; eval $setvar
14146                 val="$undef"; set i_varargs; eval $setvar
14147                 ;;
14148         varargs.h)
14149                 val="$undef"; set i_stdarg; eval $setvar
14150                 val="$define"; set i_varargs; eval $setvar
14151                 ;;
14152         esac
14153         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14154 esac
14155 $rm -f varargs*
14156
14157 : see if we need va_copy
14158 echo " "
14159 case "$i_stdarg" in
14160 "$define")
14161         $cat >try.c <<EOCP
14162 #include <stdarg.h>
14163 #include <stdio.h>
14164 #$i_stdlib I_STDLIB
14165 #ifdef I_STDLIB
14166 #include <stdlib.h>
14167 #endif
14168 #include <signal.h>
14169
14170 int
14171 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14172 {
14173   return vfprintf(f, fmt, *valp);
14174 }
14175  
14176 int    
14177 myvfprintf(FILE *f, const  char *fmt, va_list val)
14178 {
14179   return ivfprintf(f, fmt, &val);
14180 }
14181       
14182 int
14183 myprintf(char *fmt, ...) 
14184 {
14185   va_list val;
14186   va_start(val, fmt);
14187   return myvfprintf(stdout, fmt, val); 
14188 }         
14189
14190 int
14191 main(int ac, char **av)
14192 {
14193   signal(SIGSEGV, exit);
14194
14195   myprintf("%s%cs all right, then\n", "that", '\'');                            
14196   exit(0);      
14197 }
14198 EOCP
14199         set try
14200         if eval $compile && ./try 2>&1 >/dev/null; then
14201                 case "`./try`" in
14202                 "that's all right, then")
14203                         okay=yes
14204                         ;;
14205                 esac
14206         fi
14207         case "$okay" in
14208         yes)    echo "It seems that you don't need va_copy()." >&4
14209                 need_va_copy="$undef"
14210                 ;;
14211         *)      echo "It seems that va_copy() or similar will be needed." >&4
14212                 need_va_copy="$define"
14213                 ;;
14214         esac
14215         $rm -f try.* core core.* *.core *.core.*
14216         ;;
14217 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14218         ;;
14219 esac
14220
14221 : define a fucntion to check prototypes
14222 $cat > protochk <<EOSH
14223 $startsh
14224 cc="$cc"
14225 optimize="$optimize"
14226 ccflags="$ccflags"
14227 prototype="$prototype"
14228 define="$define"
14229 rm=$rm
14230 EOSH
14231
14232 $cat >> protochk <<'EOSH'
14233
14234 $rm -f try.c
14235 foo="$1"
14236 shift
14237 while test $# -ge 2; do
14238         case "$1" in
14239                 $define) echo "#include <$2>" >> try.c ;;
14240                 literal) echo "$2" >> try.c ;;
14241         esac
14242     shift 2
14243 done
14244 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14245 cat >> try.c <<'EOCP'
14246 #ifdef CAN_PROTOTYPE
14247 #define _(args) args
14248 #else
14249 #define _(args) ()
14250 #endif
14251 EOCP
14252 echo "$foo" >> try.c
14253 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14254 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14255 status=$?
14256 $rm -f try.[co]
14257 exit $status
14258 EOSH
14259 chmod +x protochk
14260 $eunicefix protochk
14261
14262 : see what type is used for size_t
14263 rp="What is the type used for the length parameter for string functions?"
14264 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14265 eval $typedef_ask
14266
14267 : check for type of arguments to gethostbyaddr. 
14268 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14269         case "$d_gethbyaddr" in
14270         $define)
14271                 $cat <<EOM
14272
14273 Checking to see what type of arguments are accepted by gethostbyaddr().
14274 EOM
14275                 hdrs="$define sys/types.h
14276                         $d_socket sys/socket.h 
14277                         $i_niin netinet/in.h 
14278                         $i_netdb netdb.h
14279                         $i_unistd unistd.h"
14280                 : The first arg can 'char *' or 'void *'
14281                 : The second arg is some of integral type
14282                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14283                         for yyy in size_t long int; do
14284                                 case "$netdb_host_type" in
14285                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14286                                         if ./protochk "$try" $hdrs; then
14287                                                 echo "Your system accepts $xxx for the first arg."
14288                                                 echo "...and $yyy for the second arg."
14289                                                 netdb_host_type="$xxx"
14290                                                 netdb_hlen_type="$yyy"
14291                                         fi
14292                                         ;;
14293                                 esac
14294                         done
14295                 done
14296                 : In case none of those worked, prompt the user.
14297                 case "$netdb_host_type" in
14298                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14299                         dflt='char *'
14300                         . ./myread
14301                         netdb_host_type=$ans
14302                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14303                         dflt="$sizetype"
14304                         . ./myread
14305                         netdb_hlen_type=$ans
14306                         ;;
14307                 esac
14308                 ;;
14309         *)      : no gethostbyaddr, so pick harmless defaults
14310                 netdb_host_type='char *'
14311                 netdb_hlen_type="$sizetype"
14312                 ;;
14313         esac
14314         # Remove the "const" if needed. -- but then we'll have a 
14315         # prototype clash!
14316         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14317 fi
14318
14319 : check for type of argument to gethostbyname. 
14320 if test "X$netdb_name_type" = X ; then
14321         case "$d_gethbyname" in
14322         $define)
14323                 $cat <<EOM
14324
14325 Checking to see what type of argument is accepted by gethostbyname().
14326 EOM
14327                 hdrs="$define sys/types.h
14328                         $d_socket sys/socket.h 
14329                         $i_niin netinet/in.h 
14330                         $i_netdb netdb.h
14331                         $i_unistd unistd.h"
14332                 for xxx in "const char *" "char *"; do
14333                         case "$netdb_name_type" in
14334                         '')     try="extern struct hostent *gethostbyname($xxx);"
14335                                 if ./protochk "$try" $hdrs; then
14336                                         echo "Your system accepts $xxx."
14337                                         netdb_name_type="$xxx"
14338                                 fi
14339                                 ;;
14340                         esac
14341                 done
14342                 : In case none of those worked, prompt the user.
14343                 case "$netdb_name_type" in
14344                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14345                         dflt='char *'
14346                         . ./myread
14347                         netdb_name_type=$ans
14348                         ;;
14349                 esac
14350                 ;;
14351         *)      : no gethostbyname, so pick harmless default
14352                 netdb_name_type='char *'
14353                 ;;
14354         esac
14355 fi
14356
14357 : check for type of 1st argument to getnetbyaddr. 
14358 if test "X$netdb_net_type" = X ; then
14359         case "$d_getnbyaddr" in
14360         $define)
14361                 $cat <<EOM
14362
14363 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14364 EOM
14365                 hdrs="$define sys/types.h
14366                         $d_socket sys/socket.h 
14367                         $i_niin netinet/in.h 
14368                         $i_netdb netdb.h
14369                         $i_unistd unistd.h"
14370                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14371                         case "$netdb_net_type" in
14372                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14373                                 if ./protochk "$try" $hdrs; then
14374                                         echo "Your system accepts $xxx."
14375                                         netdb_net_type="$xxx"
14376                                 fi
14377                                 ;;
14378                         esac
14379                 done
14380                 : In case none of those worked, prompt the user.
14381                 case "$netdb_net_type" in
14382                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14383                         dflt='long'
14384                         . ./myread
14385                         netdb_net_type=$ans
14386                         ;;
14387                 esac
14388                 ;;
14389         *)      : no getnetbyaddr, so pick harmless default
14390                 netdb_net_type='long'
14391                 ;;
14392         esac
14393 fi
14394 : locate the preferred pager for this system
14395 case "$pager" in
14396 '')
14397         dflt=''
14398         case "$pg" in
14399         /*) dflt=$pg;;
14400         [a-zA-Z]:/*) dflt=$pg;;
14401         esac
14402         case "$more" in
14403         /*) dflt=$more;;
14404         [a-zA-Z]:/*) dflt=$more;;
14405         esac
14406         case "$less" in
14407         /*) dflt=$less;;
14408         [a-zA-Z]:/*) dflt=$less;;
14409         esac
14410         case "$dflt" in
14411         '') dflt=/usr/ucb/more;;
14412         esac
14413         ;;
14414 *) dflt="$pager";;
14415 esac
14416 echo " "
14417 fn=f/
14418 rp='What pager is used on your system?'
14419 . ./getfile
14420 pager="$ans"
14421
14422 : see what type pids are declared as in the kernel
14423 rp="What is the type of process ids on this system?"
14424 set pid_t pidtype int stdio.h sys/types.h
14425 eval $typedef_ask
14426
14427 : Find earliest binary compatible site_perl subdirectory perl can use.
14428 case "$bincompat5005" in
14429 "$define") xs_apiversion='5.005' ;;
14430 *) xs_apiversion=$version ;;   # The current site_perl version.
14431 esac
14432 : Find earliest pure perl site_perl subdirectory perl can use.
14433 : The versioned directories started at 5.005.
14434 pm_apiversion='5.005'
14435
14436 : see if ar generates random libraries by itself
14437 echo " "
14438 echo "Checking how to generate random libraries on your machine..." >&4
14439 echo 'int bar1() { return bar2(); }' > bar1.c
14440 echo 'int bar2() { return 2; }' > bar2.c
14441 $cat > foo.c <<'EOP'
14442 int main() { printf("%d\n", bar1()); exit(0); }
14443 EOP
14444 $cc $ccflags -c bar1.c >/dev/null 2>&1
14445 $cc $ccflags -c bar2.c >/dev/null 2>&1
14446 $cc $ccflags -c foo.c >/dev/null 2>&1
14447 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14448 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14449         ./foobar >/dev/null 2>&1; then
14450         echo "$ar appears to generate random libraries itself."
14451         orderlib=false
14452         ranlib=":"
14453 elif $ar ts bar$_a >/dev/null 2>&1 &&
14454         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14455         ./foobar >/dev/null 2>&1; then
14456                 echo "a table of contents needs to be added with '$ar ts'."
14457                 orderlib=false
14458                 ranlib="$ar ts"
14459 else
14460         case "$ranlib" in
14461         :) ranlib='';;
14462         '')
14463                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14464                 $test -f $ranlib || ranlib=''
14465                 ;;
14466         esac
14467         if $test -n "$ranlib"; then
14468                 echo "your system has '$ranlib'; we'll use that."
14469                 orderlib=false
14470         else
14471                 echo "your system doesn't seem to support random libraries"
14472                 echo "so we'll use lorder and tsort to order the libraries."
14473                 orderlib=true
14474                 ranlib=":"
14475         fi
14476 fi
14477 $rm -f foo* bar* 
14478
14479 : check for type of arguments to select. 
14480 case "$selecttype" in
14481 '') case "$d_select" in
14482         $define)
14483                 echo " "
14484                 $cat <<EOM
14485 Checking to see what type of arguments are accepted by select().
14486 EOM
14487                 hdrs="$define sys/types.h
14488                         $i_systime sys/time.h 
14489                         $i_sysselct sys/select.h
14490                         $d_socket sys/socket.h"
14491                 : The first arg can be int, unsigned, or size_t
14492                 : The last arg may or may not be 'const'
14493                 val=''
14494                 : void pointer has been seen but using that
14495                 : breaks the selectminbits test
14496                 for xxx in 'fd_set *' 'int *'; do
14497                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14498                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14499                                         case "$val" in
14500                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14501                                                 if ./protochk "$try" $hdrs; then
14502                                                         echo "Your system accepts $xxx."
14503                                                         val="$xxx"
14504                                                 fi
14505                                                 ;;
14506                                         esac
14507                                 done
14508                         done
14509                 done
14510                 case "$val" in
14511                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14512                         case "$d_fd_set" in
14513                                 $define) dflt="fd_set *" ;;
14514                                 *)              dflt="int *" ;;
14515                         esac
14516                         . ./myread
14517                         val=$ans
14518                         ;;
14519                 esac
14520                 selecttype="$val"
14521                 ;;
14522         *)      : no select, so pick a harmless default
14523                 selecttype='int *'
14524                 ;;
14525         esac
14526         ;;
14527 esac
14528
14529 : check for the select 'width'
14530 case "$selectminbits" in
14531 '') case "$d_select" in
14532         $define)
14533                 $cat <<EOM
14534
14535 Checking to see on how many bits at a time your select() operates...
14536 EOM
14537                 $cat >try.c <<EOCP
14538 #include <sys/types.h>
14539 #$i_time I_TIME
14540 #$i_systime I_SYS_TIME
14541 #$i_systimek I_SYS_TIME_KERNEL
14542 #ifdef I_TIME
14543 #   include <time.h>
14544 #endif
14545 #ifdef I_SYS_TIME
14546 #   ifdef I_SYS_TIME_KERNEL
14547 #       define KERNEL
14548 #   endif
14549 #   include <sys/time.h>
14550 #   ifdef I_SYS_TIME_KERNEL
14551 #       undef KERNEL
14552 #   endif
14553 #endif
14554 #$i_sysselct I_SYS_SELECT
14555 #ifdef I_SYS_SELECT
14556 #include <sys/select.h>
14557 #endif
14558 #$d_socket HAS_SOCKET
14559 #ifdef HAS_SOCKET
14560 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14561 #endif
14562 #include <stdio.h>
14563 $selecttype b;
14564 #define S sizeof(*(b))
14565 #define MINBITS 64
14566 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14567 #define NBITS  (NBYTES * 8)
14568 int main() {
14569     char s[NBYTES];
14570     struct timeval t;
14571     int i;
14572     FILE* fp;
14573     int fd;
14574
14575     fclose(stdin);
14576     fp = fopen("try.c", "r");
14577     if (fp == 0)
14578       exit(1);
14579     fd = fileno(fp);
14580     if (fd < 0)
14581       exit(2);
14582     b = ($selecttype)s;
14583     for (i = 0; i < NBITS; i++)
14584         FD_SET(i, b);
14585     t.tv_sec  = 0;
14586     t.tv_usec = 0;
14587     select(fd + 1, b, 0, 0, &t);
14588     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14589     printf("%d\n", i + 1);
14590     return 0;
14591 }
14592 EOCP
14593                 set try
14594                 if eval $compile_ok; then
14595                         selectminbits=`./try`
14596                         case "$selectminbits" in
14597                         '')     cat >&4 <<EOM
14598 Cannot figure out on how many bits at a time your select() operates.
14599 I'll play safe and guess it is 32 bits.
14600 EOM
14601                                 selectminbits=32
14602                                 bits="32 bits"
14603                                 ;;
14604                         1)      bits="1 bit" ;;
14605                         *)      bits="$selectminbits bits" ;;
14606                         esac
14607                         echo "Your select() operates on $bits at a time." >&4
14608                 else
14609                         rp='What is the minimum number of bits your select() operates on?'
14610                         case "$byteorder" in
14611                         1234|12345678)  dflt=32 ;;
14612                         *)              dflt=1  ;;
14613                         esac
14614                         . ./myread
14615                         val=$ans
14616                         selectminbits="$val"
14617                 fi
14618                 $rm -f try.* try
14619                 ;;
14620         *)      : no select, so pick a harmless default
14621                 selectminbits='32'
14622                 ;;
14623         esac
14624         ;;
14625 esac
14626
14627 : Trace out the files included by signal.h, then look for SIGxxx names.
14628 : Remove SIGARRAYSIZE used by HPUX.
14629 : Remove SIGSTKSIZE used by Linux.
14630 : Remove SIGSTKSZ used by Posix.
14631 : Remove SIGTYP void lines used by OS2.
14632 : Some cpps, like os390, dont give the file name anywhere
14633 if [ "X$fieldn" = X ]; then
14634         : Just make some guesses.  We check them later.
14635         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14636 else
14637         xxx=`echo '#include <signal.h>' |
14638         $cppstdin $cppminus $cppflags 2>/dev/null |
14639         $grep '^[       ]*#.*include' | 
14640         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14641 fi
14642 : Check this list of files to be sure we have parsed the cpp output ok.
14643 : This will also avoid potentially non-existent files, such 
14644 : as ../foo/bar.h
14645 xxxfiles=''
14646 for xx in $xxx /dev/null ; do
14647         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14648 done
14649 : If we have found no files, at least try signal.h
14650 case "$xxxfiles" in
14651 '')     xxxfiles=`./findhdr signal.h` ;;
14652 esac
14653 xxx=`awk '
14654 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14655         print substr($2, 4, 20)
14656 }
14657 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14658         print substr($3, 4, 20)
14659 }' $xxxfiles`
14660 : Append some common names just in case the awk scan failed.
14661 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14662 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14663 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14664 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14665 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14666
14667 : generate a few handy files for later
14668 $cat > signal.c <<'EOCP'
14669 #include <sys/types.h>
14670 #include <signal.h>
14671 #include <stdio.h>
14672 int main() {
14673
14674 /* Strange style to avoid deeply-nested #if/#else/#endif */
14675 #ifndef NSIG
14676 #  ifdef _NSIG
14677 #    define NSIG (_NSIG)
14678 #  endif
14679 #endif
14680
14681 #ifndef NSIG
14682 #  ifdef SIGMAX
14683 #    define NSIG (SIGMAX+1)
14684 #  endif
14685 #endif
14686
14687 #ifndef NSIG
14688 #  ifdef SIG_MAX
14689 #    define NSIG (SIG_MAX+1)
14690 #  endif
14691 #endif
14692
14693 #ifndef NSIG
14694 #  ifdef MAXSIG
14695 #    define NSIG (MAXSIG+1)
14696 #  endif
14697 #endif
14698
14699 #ifndef NSIG
14700 #  ifdef MAX_SIG
14701 #    define NSIG (MAX_SIG+1)
14702 #  endif
14703 #endif
14704
14705 #ifndef NSIG
14706 #  ifdef SIGARRAYSIZE
14707 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14708 #  endif
14709 #endif
14710
14711 #ifndef NSIG
14712 #  ifdef _sys_nsig
14713 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14714 #  endif
14715 #endif
14716
14717 /* Default to some arbitrary number that's big enough to get most
14718    of the common signals.
14719 */
14720 #ifndef NSIG
14721 #    define NSIG 50
14722 #endif
14723
14724 printf("NSIG %d\n", NSIG);
14725
14726 #ifndef JUST_NSIG
14727
14728 EOCP
14729
14730 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14731 {
14732         printf "#ifdef SIG"; printf $1; printf "\n"
14733         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14734         printf $1; printf ");\n"
14735         printf "#endif\n"
14736 }
14737 END {
14738         printf "#endif /* JUST_NSIG */\n";
14739         printf "exit(0);\n}\n";
14740 }
14741 ' >>signal.c
14742 $cat >signal.awk <<'EOP'
14743 BEGIN { ndups = 0 }
14744 $1 ~ /^NSIG$/ { nsig = $2 }
14745 ($1 !~ /^NSIG$/) && (NF == 2) {
14746     if ($2 > maxsig) { maxsig = $2 }
14747     if (sig_name[$2]) {
14748         dup_name[ndups] = $1
14749         dup_num[ndups] = $2
14750         ndups++ 
14751     }
14752     else {
14753         sig_name[$2] = $1
14754         sig_num[$2] = $2
14755     }
14756 }
14757 END { 
14758     if (nsig == 0) {
14759         nsig = maxsig + 1
14760     }
14761     printf("NSIG %d\n", nsig);
14762     for (n = 1; n < nsig; n++) {
14763         if (sig_name[n]) {
14764             printf("%s %d\n", sig_name[n], sig_num[n])
14765         }
14766         else {
14767             printf("NUM%d %d\n", n, n) 
14768         }
14769     }
14770     for (n = 0; n < ndups; n++) {
14771         printf("%s %d\n", dup_name[n], dup_num[n])
14772     }
14773 }
14774 EOP
14775 $cat >signal_cmd <<EOS
14776 $startsh
14777 if $test -s signal.lst; then
14778     echo "Using your existing signal.lst file"
14779         exit 0
14780 fi
14781 xxx="$xxx"
14782 EOS
14783 $cat >>signal_cmd <<'EOS'
14784
14785 set signal
14786 if eval $compile_ok; then
14787         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14788 else
14789         echo "(I can't seem be able to compile the whole test program)" >&4
14790         echo "(I'll try it in little pieces.)" >&4
14791         set signal -DJUST_NSIG
14792         if eval $compile_ok; then
14793                 ./signal$_exe > signal.nsg
14794                 $cat signal.nsg
14795         else
14796                 echo "I can't seem to figure out how many signals you have." >&4
14797                 echo "Guessing 50." >&4
14798                 echo 'NSIG 50' > signal.nsg
14799         fi
14800         : Now look at all the signal names, one at a time.
14801         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14802                 $cat > signal.c <<EOCP
14803 #include <sys/types.h>
14804 #include <signal.h>
14805 #include <stdio.h>
14806 int main() {
14807 printf("$xx %d\n", SIG${xx});
14808 return 0;
14809 }
14810 EOCP
14811                 set signal
14812                 if eval $compile; then
14813                         echo "SIG${xx} found."
14814                         ./signal$_exe  >> signal.ls1
14815                 else
14816                         echo "SIG${xx} NOT found."
14817                 fi
14818         done
14819         if $test -s signal.ls1; then
14820                 $cat signal.nsg signal.ls1 |
14821                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14822         fi
14823
14824 fi
14825 if $test -s signal.lst; then
14826         :
14827 else
14828         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14829         echo 'kill -l' >signal
14830         set X `csh -f <signal`
14831         $rm -f signal
14832         shift
14833         case $# in
14834         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14835         esac
14836         echo $@ | $tr ' ' $trnl | \
14837             $awk '{ printf "%s %d\n", $1, ++s; }
14838                   END { printf "NSIG %d\n", ++s }' >signal.lst
14839 fi
14840 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14841 EOS
14842 chmod a+x signal_cmd
14843 $eunicefix signal_cmd
14844
14845 : generate list of signal names
14846 echo " "
14847 case "$sig_name_init" in
14848 '') doinit=yes ;;
14849 *)  case "$sig_num_init" in
14850     ''|*,*) doinit=yes ;;
14851     esac ;;
14852 esac
14853 case "$doinit" in
14854 yes)
14855         echo "Generating a list of signal names and numbers..." >&4
14856         . ./signal_cmd
14857         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14858         sig_name=`$awk 'BEGIN { printf "ZERO " }
14859                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14860         sig_num=`$awk  'BEGIN { printf "0 " }
14861                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14862         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14863                              !/^NSIG/   { printf "\"%s\", ", $1 }
14864                              END        { printf "0\n" }' signal.lst`
14865         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14866                              !/^NSIG/   { printf "%d, ", $2}
14867                              END        { printf "0\n"}' signal.lst`
14868         ;;
14869 esac
14870 echo "The following $sig_count signals are available:"
14871 echo " "
14872 echo $sig_name | $awk \
14873 'BEGIN { linelen = 0 }
14874 {
14875         for (i = 1; i <= NF; i++) {
14876                 name = "SIG" $i " "
14877                 linelen = linelen + length(name)
14878                 if (linelen > 70) {
14879                         printf "\n"
14880                         linelen = length(name)
14881                 }
14882                 printf "%s", name
14883         }
14884         printf "\n"
14885 }'
14886 sig_size=`echo $sig_name | awk '{print NF}'`
14887 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14888
14889 echo " "
14890 case "$sizetype" in
14891 *_t) zzz="$sizetype"    ;;
14892 *)   zzz="filesize"     ;;
14893 esac
14894 echo "Checking the size of $zzz..." >&4 
14895 cat > try.c <<EOCP
14896 #include <sys/types.h>
14897 #include <stdio.h>
14898 int main() {
14899     printf("%d\n", (int)sizeof($sizetype));
14900     exit(0);
14901 }
14902 EOCP
14903 set try
14904 if eval $compile_ok; then
14905         yyy=`./try`
14906         case "$yyy" in
14907         '')     sizesize=4
14908                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14909                 ;;
14910         *)      sizesize=$yyy
14911                 echo "Your $zzz size is $sizesize bytes."
14912                 ;;
14913         esac
14914 else
14915         sizesize=4
14916         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14917 fi
14918
14919
14920 : check for socklen_t
14921 echo " "
14922 echo "Checking to see if you have socklen_t..." >&4
14923 $cat >try.c <<EOCP
14924 #include <sys/types.h>
14925 #$d_socket HAS_SOCKET
14926 #ifdef HAS_SOCKET
14927 #include <sys/socket.h>
14928 #endif
14929 int main() { socklen_t x = 16; }
14930 EOCP
14931 set try
14932 if eval $compile; then
14933         val="$define"
14934         echo "You have socklen_t."
14935 else
14936         val="$undef"
14937         echo "You do not have socklen_t."
14938         case "$sizetype" in
14939         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14940         esac
14941 fi
14942 $rm -f try try.*
14943 set d_socklen_t
14944 eval $setvar
14945
14946 : see if this is a socks.h system
14947 set socks.h i_socks
14948 eval $inhdr
14949
14950 : check for type of the size argument to socket calls
14951 case "$d_socket" in
14952 "$define")
14953         $cat <<EOM
14954
14955 Checking to see what type is the last argument of accept().
14956 EOM
14957         yyy=''
14958         case "$d_socklen_t" in
14959         "$define") yyy="$yyy socklen_t"
14960         esac
14961         yyy="$yyy $sizetype int long unsigned"
14962         for xxx in $yyy; do
14963                 case "$socksizetype" in
14964                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14965                         case "$usesocks" in
14966                         "$define")
14967                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14968                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14969                                         socksizetype="$xxx"
14970                                 fi
14971                                 ;;
14972                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14973                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14974                                         socksizetype="$xxx"
14975                                 fi
14976                                 ;;
14977                         esac
14978                         ;;
14979                 esac
14980         done
14981 : In case none of those worked, prompt the user.
14982         case "$socksizetype" in
14983         '')     rp='What is the type for socket address structure sizes?'
14984                 dflt='int'
14985                 . ./myread
14986                 socksizetype=$ans
14987                 ;;
14988         esac
14989         ;;
14990 *)      : no sockets, so pick relatively harmless default
14991         socksizetype='int'
14992         ;;
14993 esac
14994
14995 : see what type is used for signed size_t
14996 set ssize_t ssizetype int stdio.h sys/types.h
14997 eval $typedef
14998 dflt="$ssizetype"
14999 $cat > ssize.c <<EOM
15000 #include <stdio.h>
15001 #include <sys/types.h>
15002 #define Size_t $sizetype
15003 #define SSize_t $dflt
15004 int main()
15005 {
15006         if (sizeof(Size_t) == sizeof(SSize_t))
15007                 printf("$dflt\n");
15008         else if (sizeof(Size_t) == sizeof(int))
15009                 printf("int\n");
15010         else 
15011                 printf("long\n");
15012         exit(0);
15013 }
15014 EOM
15015 echo " "
15016 set ssize
15017 if eval $compile_ok && ./ssize > /dev/null; then
15018         ssizetype=`./ssize`
15019         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15020 else
15021         $cat >&4 <<EOM
15022 Help! I can't compile and run the ssize_t test program: please enlighten me!
15023 (This is probably a misconfiguration in your system or libraries, and
15024 you really ought to fix it.  Still, I'll try anyway.)
15025
15026 I need a type that is the same size as $sizetype, but is guaranteed to
15027 be signed.  Common values are ssize_t, int and long.
15028
15029 EOM
15030         rp="What signed type is the same size as $sizetype?"
15031         . ./myread
15032         ssizetype="$ans"
15033 fi
15034 $rm -f ssize ssize.*
15035
15036 : see what type of char stdio uses.
15037 echo " "
15038 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15039 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15040         echo "Your stdio uses unsigned chars." >&4
15041         stdchar="unsigned char"
15042 else
15043         echo "Your stdio uses signed chars." >&4
15044         stdchar="char"
15045 fi
15046 $rm -f stdioh
15047
15048
15049
15050 : see if time exists
15051 echo " "
15052 if test "X$d_time" = X -o X"$timetype" = X; then
15053     if set time val -f d_time; eval $csym; $val; then
15054                 echo 'time() found.' >&4
15055                 val="$define"
15056                 rp="What is the type returned by time() on this system?"
15057                 set time_t timetype long stdio.h sys/types.h
15058                 eval $typedef_ask
15059     else
15060                 echo 'time() not found, hope that will do.' >&4
15061                 val="$undef"
15062                 timetype='int';
15063     fi
15064     set d_time
15065     eval $setvar
15066 fi
15067
15068 : see what type uids are declared as in the kernel
15069 echo " "
15070 echo "Looking for the type for user ids returned by getuid()."
15071 set uid_t uidtype xxx stdio.h sys/types.h
15072 eval $typedef
15073 case "$uidtype" in
15074 xxx)
15075         xxx=`./findhdr sys/user.h`
15076         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15077         case $1 in
15078         unsigned) dflt="$1 $2" ;;
15079         *) dflt="$1" ;;
15080         esac
15081         ;;
15082 *) dflt="$uidtype";;
15083 esac
15084 case "$uidtype" in
15085 uid_t)  echo "uid_t found." ;;
15086 *)      rp="What is the type for user ids returned by getuid()?"
15087         . ./myread
15088         uidtype="$ans"
15089         ;;
15090 esac
15091
15092 echo " "
15093 case "$uidtype" in
15094 *_t) zzz="$uidtype"     ;;
15095 *)   zzz="uid"          ;;
15096 esac
15097 echo "Checking the size of $zzz..." >&4 
15098 cat > try.c <<EOCP
15099 #include <sys/types.h>
15100 #include <stdio.h>
15101 int main() {
15102     printf("%d\n", (int)sizeof($uidtype));
15103     exit(0);
15104 }
15105 EOCP
15106 set try
15107 if eval $compile_ok; then
15108         yyy=`./try`
15109         case "$yyy" in
15110         '')     uidsize=4
15111                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15112                 ;;
15113         *)      uidsize=$yyy
15114                 echo "Your $zzz is $uidsize bytes long."
15115                 ;;
15116         esac
15117 else
15118         uidsize=4
15119         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15120 fi
15121
15122 echo " "
15123 case "$uidtype" in
15124 *_t) zzz="$uidtype"     ;;
15125 *)   zzz="uid"          ;;
15126 esac
15127 echo "Checking the sign of $zzz..." >&4
15128 cat > try.c <<EOCP
15129 #include <sys/types.h>
15130 #include <stdio.h>
15131 int main() {
15132         $uidtype foo = -1;
15133         if (foo < 0)
15134                 printf("-1\n");
15135         else
15136                 printf("1\n");
15137 }
15138 EOCP
15139 set try
15140 if eval $compile; then
15141         yyy=`./try`
15142         case "$yyy" in
15143         '')     uidsign=1
15144                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15145                 ;;
15146         *)      uidsign=$yyy
15147                 case "$uidsign" in
15148                  1) echo "Your $zzz is unsigned." ;;
15149                 -1) echo "Your $zzz is signed."   ;;
15150                 esac
15151                 ;;
15152         esac
15153 else
15154         uidsign=1
15155         echo "(I can't compile the test program--guessing unsigned.)" >&4
15156 fi
15157
15158
15159
15160 echo " "
15161 $echo "Checking the format string to be used for uids..." >&4
15162
15163 case "$uidsign" in
15164 -1)     if $test X"$uidsize" = X"$ivsize"; then
15165                 uidformat="$ivdformat"
15166         else
15167                 if $test X"$uidsize" = X"$longsize"; then
15168                         uidformat='"ld"'
15169                 else
15170                         if $test X"$uidsize" = X"$intsize"; then
15171                                 uidformat='"d"'
15172                         else
15173                                 if $test X"$uidsize" = X"$shortsize"; then
15174                                         uidformat='"hd"'
15175                                 fi
15176                         fi
15177                 fi
15178         fi
15179         ;;
15180 *)      if $test X"$uidsize" = X"$uvsize"; then
15181                 uidformat="$uvuformat"
15182         else
15183                 if $test X"$uidsize" = X"$longsize"; then
15184                         uidformat='"lu"'
15185                 else
15186                         if $test X"$uidsize" = X"$intsize"; then
15187                                 uidformat='"u"'
15188                         else
15189                                 if $test X"$uidsize" = X"$shortsize"; then
15190                                         uidformat='"hu"'
15191                                 fi
15192                         fi
15193                 fi
15194         fi
15195         ;;
15196 esac
15197
15198 : determine compiler compiler
15199 case "$yacc" in
15200 '')
15201         dflt=yacc;;
15202 *)
15203         dflt="$yacc";;
15204 esac
15205 echo " "
15206 comp='yacc'
15207 if $test -f "$byacc"; then
15208         dflt="$byacc"
15209         comp="byacc or $comp"
15210 fi
15211 if $test -f "$bison"; then
15212         comp="$comp or bison -y"
15213 fi
15214 rp="Which compiler compiler ($comp) shall I use?"
15215 . ./myread
15216 yacc="$ans"
15217 case "$yacc" in
15218 *bis*)
15219         case "$yacc" in
15220         *-y*) ;;
15221         *)
15222                 yacc="$yacc -y"
15223                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15224                 ;;
15225         esac
15226         ;;
15227 esac
15228
15229 : see if dbm.h is available
15230 : see if dbmclose exists
15231 set dbmclose d_dbmclose
15232 eval $inlibc
15233
15234 case "$d_dbmclose" in
15235 $define)
15236         set dbm.h i_dbm
15237         eval $inhdr
15238         case "$i_dbm" in
15239         $define)
15240                 val="$undef"
15241                 set i_rpcsvcdbm
15242                 eval $setvar
15243                 ;;
15244         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15245                 eval $inhdr
15246                 ;;
15247         esac
15248         ;;
15249 *)      echo "We won't be including <dbm.h>"
15250         val="$undef"
15251         set i_dbm
15252         eval $setvar
15253         val="$undef"
15254         set i_rpcsvcdbm
15255         eval $setvar
15256         ;;
15257 esac
15258
15259 : see if this is a sys/file.h system
15260 val=''
15261 set sys/file.h val
15262 eval $inhdr
15263
15264 : do we need to include sys/file.h ?
15265 case "$val" in
15266 "$define")
15267         echo " "
15268         if $h_sysfile; then
15269                 val="$define"
15270                 echo "We'll be including <sys/file.h>." >&4
15271         else
15272                 val="$undef"
15273                 echo "We won't be including <sys/file.h>." >&4
15274         fi
15275         ;;
15276 *)
15277         h_sysfile=false
15278         ;;
15279 esac
15280 set i_sysfile
15281 eval $setvar
15282
15283 : see if fcntl.h is there
15284 val=''
15285 set fcntl.h val
15286 eval $inhdr
15287
15288 : see if we can include fcntl.h
15289 case "$val" in
15290 "$define")
15291         echo " "
15292         if $h_fcntl; then
15293                 val="$define"
15294                 echo "We'll be including <fcntl.h>." >&4
15295         else
15296                 val="$undef"
15297                 if $h_sysfile; then
15298         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15299                 else
15300                         echo "We won't be including <fcntl.h>." >&4
15301                 fi
15302         fi
15303         ;;
15304 *)
15305         h_fcntl=false
15306         val="$undef"
15307         ;;
15308 esac
15309 set i_fcntl
15310 eval $setvar
15311
15312 : see if this is a iconv.h system
15313 set iconv.h i_iconv
15314 eval $inhdr
15315
15316 : see if this is a ieeefp.h system
15317 set ieeefp.h i_ieeefp
15318 eval $inhdr
15319
15320 : see if this is a libutil.h system
15321 set libutil.h i_libutil
15322 eval $inhdr
15323
15324 : see if locale.h is available
15325 set locale.h i_locale
15326 eval $inhdr
15327
15328 : see if mach cthreads are available
15329 if test "X$usethreads" = "X$define"; then
15330         set mach/cthreads.h i_machcthr
15331         eval $inhdr
15332 else
15333         i_machcthr="$undef"
15334 fi
15335
15336
15337
15338 : see if this is a math.h system
15339 set math.h i_math
15340 eval $inhdr
15341
15342 : see if this is a mntent.h system
15343 set mntent.h i_mntent
15344 eval $inhdr
15345
15346 : see if ndbm.h is available
15347 set ndbm.h t_ndbm
15348 eval $inhdr
15349 case "$t_ndbm" in
15350 $define)
15351         : see if dbm_open exists
15352         set dbm_open d_dbm_open
15353         eval $inlibc
15354         case "$d_dbm_open" in
15355         $undef)
15356                 t_ndbm="$undef"
15357                 echo "We won't be including <ndbm.h>"
15358                 ;;
15359         esac
15360         ;;
15361 esac
15362 val="$t_ndbm"
15363 set i_ndbm
15364 eval $setvar
15365
15366 : see if net/errno.h is available
15367 val=''
15368 set net/errno.h val
15369 eval $inhdr
15370
15371 : Unfortunately, it causes problems on some systems.  Arrgh.
15372 case "$val" in
15373 $define)
15374         cat > try.c <<'EOM'
15375 #include <stdio.h>
15376 #include <errno.h>
15377 #include <net/errno.h>
15378 int func()
15379 {
15380         return ENOTSOCK;
15381 }
15382 EOM
15383         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15384                 echo "We'll be including <net/errno.h>." >&4
15385         else
15386                 echo "We won't be including <net/errno.h>." >&4
15387                 val="$undef"
15388         fi
15389         $rm -f try.* try
15390         ;;
15391 esac
15392 set i_neterrno
15393 eval $setvar
15394
15395 : see if netinet/tcp.h is available
15396 set netinet/tcp.h i_netinettcp
15397 eval $inhdr
15398
15399 : see if this is a poll.h system
15400 set poll.h i_poll
15401 eval $inhdr
15402
15403 : see if this is a prot.h system
15404 set prot.h i_prot
15405 eval $inhdr
15406
15407 echo " "
15408 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15409 $cat <<'EOSH' > Cppsym.know
15410 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15411 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15412 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15413 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15414 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15415 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15416 bull c cadmus clipper CMU COFF COMPILER_VERSION
15417 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15418 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15419 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15420 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15421 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15422 H3050R H3050RX hbullx20 hcx host_mips
15423 hp200 hp300 hp700 HP700 hp800 hp9000
15424 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15425 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15426 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15427 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15428 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15429 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15430 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15431 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15432 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15433 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15434 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15435 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15436 MATH_HAS_NO_SIDE_EFFECTS
15437 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15438 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15439 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15440 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15441 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15442 NetBSD news1500 news1700 news1800 news1900 news3700
15443 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15444 ns32016 ns32332 ns32k nsc32000
15445 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15446 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15447 pc532 pdp11 PGC PIC plexus PORTAR posix
15448 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15449 POSIX_C_SOURCE POSIX_SOURCE POWER
15450 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15451 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15452 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15453 sony sony_news sonyrisc sparc sparclite spectrum
15454 stardent stdc STDC_EXT stratos sun sun3 sun386
15455 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15456 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15457 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15458 sysV68 sysV88 Tek4132 Tek4300 titan
15459 TM3200 TM5400 TM5600
15460 tower tower32 tower32_200 tower32_600 tower32_700
15461 tower32_800 tower32_850 tss
15462 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15463 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15464 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15465 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15466 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15467 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15468 z8000
15469 EOSH
15470 # Maybe put other stuff here too.
15471 cat <<EOSH >>Cppsym.know
15472 $osname
15473 EOSH
15474 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15475 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15476 $cat Cppsym.know > Cppsym.c
15477 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15478 $rm -f Cppsym.a Cppsym.b Cppsym.c
15479 cat <<EOSH > Cppsym
15480 $startsh
15481 if $test \$# -gt 0; then
15482     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15483     if $test -s Cppsym.got; then
15484         $rm -f Cppsym.got
15485         exit 0
15486     fi
15487     $rm -f Cppsym.got
15488     exit 1
15489 else
15490     $tr " " "$trnl" | ./Cppsym.try
15491     exit 0
15492 fi
15493 EOSH
15494 chmod +x Cppsym
15495 $eunicefix Cppsym
15496 cat <<EOSH > Cppsym.try
15497 $startsh
15498 cat <<'EOCP' > try.c
15499 #include <stdio.h>
15500 int main() {
15501 EOCP
15502 $awk \\
15503 EOSH
15504 cat <<'EOSH' >> Cppsym.try
15505 'length($1) > 0 {
15506     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
15507     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
15508     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
15509     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
15510 }'       >> try.c
15511 echo '}' >> try.c
15512 EOSH
15513 cat <<EOSH >> Cppsym.try
15514 ccflags="$ccflags"
15515 case "$osname-$gccversion" in
15516 irix-) ccflags="\$ccflags -woff 1178" ;;
15517 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15518 esac
15519 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15520 EOSH
15521 chmod +x Cppsym.try
15522 $eunicefix Cppsym.try
15523 ./Cppsym < Cppsym.know > Cppsym.true
15524 : now check the C compiler for additional symbols
15525 postprocess_cc_v=''
15526 case "$osname" in
15527 aix) postprocess_cc_v="|$tr , ' '" ;;
15528 esac
15529 $cat >ccsym <<EOS
15530 $startsh
15531 $cat >tmp.c <<EOF
15532 extern int foo;
15533 EOF
15534 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15535 do
15536         case "\$i" in
15537         -D*) echo "\$i" | $sed 's/^-D//';;
15538         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15539         esac
15540 done
15541 $rm -f try.c
15542 EOS
15543 postprocess_cc_v=''
15544 chmod +x ccsym
15545 $eunicefix ccsym
15546 ./ccsym > ccsym1.raw
15547 if $test -s ccsym1.raw; then
15548        $sort ccsym1.raw | $uniq >ccsym.raw
15549 else
15550        mv ccsym1.raw ccsym.raw
15551 fi
15552
15553 $awk '/\=/ { print $0; next }
15554         { print $0"=1" }' ccsym.raw >ccsym.list
15555 $awk '/\=/ { print $0; next }
15556         { print $0"=1" }' Cppsym.true >ccsym.true
15557 $comm -13 ccsym.true ccsym.list >ccsym.own
15558 $comm -12 ccsym.true ccsym.list >ccsym.com
15559 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15560 also=''
15561 if $test -z ccsym.raw; then
15562         echo "Your C compiler doesn't seem to define any symbols!" >&4
15563         echo " "
15564         echo "However, your C preprocessor defines the following symbols:"
15565         $cat Cppsym.true
15566         ccsymbols=''
15567         cppsymbols=`$cat Cppsym.true`
15568         cppsymbols=`echo $cppsymbols`
15569         cppccsymbols="$cppsymbols"
15570 else
15571         if $test -s ccsym.com; then
15572                 echo "Your C compiler and pre-processor define these symbols:"
15573                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15574                 also='also '
15575                 symbols='ones'
15576                 cppccsymbols=`$cat ccsym.com`
15577                 cppccsymbols=`echo $cppccsymbols`
15578                 $test "$silent" || sleep 1
15579         fi
15580         if $test -s ccsym.cpp; then
15581                 $test "$also" && echo " "
15582                 echo "Your C pre-processor ${also}defines the following symbols:"
15583                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15584                 also='further '
15585                 cppsymbols=`$cat ccsym.cpp`
15586                 cppsymbols=`echo $cppsymbols`
15587                 $test "$silent" || sleep 1
15588         fi
15589         if $test -s ccsym.own; then
15590                 $test "$also" && echo " "
15591                 echo "Your C compiler ${also}defines the following cpp symbols:"
15592                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15593                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15594                 ccsymbols=`$cat ccsym.own`
15595                 ccsymbols=`echo $ccsymbols`
15596                 $test "$silent" || sleep 1
15597         fi
15598 fi
15599 $rm -f ccsym* Cppsym.*
15600
15601 : see if this is a termio system
15602 val="$undef"
15603 val2="$undef"
15604 val3="$undef"
15605 if $test `./findhdr termios.h`; then
15606         set tcsetattr i_termios
15607         eval $inlibc
15608         val3="$i_termios"
15609 fi
15610 echo " "
15611 case "$val3" in
15612 "$define") echo "You have POSIX termios.h... good!" >&4;;
15613 *) if ./Cppsym pyr; then
15614                 case "`/bin/universe`" in
15615                 ucb) if $test `./findhdr sgtty.h`; then
15616                                 val2="$define"
15617                                 echo "<sgtty.h> found." >&4
15618                         else
15619                                 echo "System is pyramid with BSD universe."
15620                                 echo "<sgtty.h> not found--you could have problems." >&4
15621                         fi;;
15622                 *) if $test `./findhdr termio.h`; then
15623                                 val="$define"
15624                                 echo "<termio.h> found." >&4
15625                         else
15626                                 echo "System is pyramid with USG universe."
15627                                 echo "<termio.h> not found--you could have problems." >&4
15628                         fi;;
15629                 esac
15630         elif ./usg; then
15631                 if $test `./findhdr termio.h`; then
15632                         echo "<termio.h> found." >&4
15633                         val="$define"
15634                 elif $test `./findhdr sgtty.h`; then
15635                         echo "<sgtty.h> found." >&4
15636                         val2="$define"
15637                 else
15638 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15639                 fi
15640         else
15641                 if $test `./findhdr sgtty.h`; then
15642                         echo "<sgtty.h> found." >&4
15643                         val2="$define"
15644                 elif $test `./findhdr termio.h`; then
15645                         echo "<termio.h> found." >&4
15646                         val="$define"
15647                 else
15648 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15649                 fi
15650         fi;;
15651 esac
15652 set i_termio; eval $setvar
15653 val=$val2; set i_sgtty; eval $setvar
15654 val=$val3; set i_termios; eval $setvar
15655
15656 : see if this is a shadow.h system
15657 set shadow.h i_shadow
15658 eval $inhdr
15659
15660 : see if stddef is available
15661 set stddef.h i_stddef
15662 eval $inhdr
15663
15664 : see if this is a sunmath.h system
15665 set sunmath.h i_sunmath
15666 eval $inhdr
15667
15668 : see if sys/access.h is available
15669 set sys/access.h i_sysaccess
15670 eval $inhdr
15671
15672 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15673 set sys/filio.h i_sysfilio
15674 eval $inhdr
15675 echo " "
15676 if $test `./findhdr sys/ioctl.h`; then
15677         val="$define"
15678         echo '<sys/ioctl.h> found.' >&4
15679 else
15680         val="$undef"
15681         if $test $i_sysfilio = "$define"; then
15682             echo '<sys/ioctl.h> NOT found.' >&4
15683         else
15684                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15685                 $test $i_termio = "$define" && xxx="termio.h"
15686                 $test $i_termios = "$define" && xxx="termios.h"
15687 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15688         fi
15689 fi
15690 set i_sysioctl
15691 eval $setvar
15692
15693 : see if socket ioctl defs are in sys/sockio.h
15694 echo " "
15695 xxx=`./findhdr sys/sockio.h`
15696 if $test "$xxx"; then
15697         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15698                 val="$define"
15699                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15700         else
15701                 val="$undef"
15702                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15703         fi
15704 else
15705         val="$undef"
15706         $cat <<EOM
15707 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15708 EOM
15709 fi
15710 set i_syssockio
15711 eval $setvar
15712
15713
15714 : see if this is a syslog.h system
15715 set syslog.h i_syslog
15716 eval $inhdr
15717
15718
15719 : see if this is a sys/mode.h system
15720 set sys/mode.h i_sysmode
15721 eval $inhdr
15722
15723 : see if sys/resource.h has to be included
15724 set sys/resource.h i_sysresrc
15725 eval $inhdr
15726
15727 : see if sys/security.h is available
15728 set sys/security.h i_syssecrt
15729 eval $inhdr
15730
15731 : see if this is a sys/statvfs.h system
15732 set sys/statvfs.h i_sysstatvfs
15733 eval $inhdr
15734
15735 : see if this is a sys/un.h system
15736 set sys/un.h i_sysun
15737 eval $inhdr
15738
15739
15740 : see if this is a sys/utsname.h system
15741 set sys/utsname.h i_sysutsname
15742 eval $inhdr
15743
15744 : see if this is a syswait system
15745 set sys/wait.h i_syswait
15746 eval $inhdr
15747
15748 : see if this is a ustat.h system
15749 set ustat.h i_ustat
15750 eval $inhdr
15751
15752 : see if this is an utime system
15753 set utime.h i_utime
15754 eval $inhdr
15755
15756 : see if this is a values.h system
15757 set values.h i_values
15758 eval $inhdr
15759
15760 : see if this is a vfork system
15761 case "$d_vfork" in
15762 "$define")
15763         set vfork.h i_vfork
15764         eval $inhdr
15765         ;;
15766 *)
15767         i_vfork="$undef"
15768         ;;
15769 esac
15770
15771 : see if gdbm.h is available
15772 set gdbm.h t_gdbm
15773 eval $inhdr
15774 case "$t_gdbm" in
15775 $define)
15776         : see if gdbm_open exists
15777         set gdbm_open d_gdbm_open
15778         eval $inlibc
15779         case "$d_gdbm_open" in
15780         $undef)
15781                 t_gdbm="$undef"
15782                 echo "We won't be including <gdbm.h>"
15783                 ;;
15784         esac
15785         ;;
15786 esac
15787 val="$t_gdbm"
15788 set i_gdbm
15789 eval $setvar
15790
15791 echo " "
15792 echo "Looking for extensions..." >&4
15793 : If we are using the old config.sh, known_extensions may contain
15794 : old or inaccurate or duplicate values.
15795 known_extensions=''
15796 nonxs_extensions=''
15797 : We do not use find because it might not be available.
15798 : We do not just use MANIFEST because the user may have dropped
15799 : some additional extensions into the source tree and expect them
15800 : to be built.
15801
15802 : Function to recursively find available extensions, ignoring DynaLoader
15803 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15804 find_extensions='
15805     for xxx in *; do
15806        case "$xxx" in
15807            DynaLoader|dynaload) ;;
15808            *)
15809            if $test -f $xxx/$xxx.xs; then
15810                known_extensions="$known_extensions $1$xxx";
15811            elif $test -f $xxx/Makefile.PL; then
15812                nonxs_extensions="$nonxs_extensions $1$xxx";
15813            else
15814                if $test -d $xxx -a $# -lt 10; then
15815                    set $1$xxx/ $*;
15816                    cd $xxx;
15817                    eval $find_extensions;
15818                    cd ..;
15819                    shift;
15820                fi;
15821            fi
15822            ;;
15823        esac;
15824     done'
15825 tdir=`pwd`
15826 cd $rsrc/ext
15827 set X
15828 shift
15829 eval $find_extensions
15830 set X $nonxs_extensions
15831 shift
15832 nonxs_extensions="$*"
15833 set X $known_extensions
15834 shift
15835 known_extensions="$*"
15836 cd $tdir
15837
15838 : Now see which are supported on this system.
15839 avail_ext=''
15840 for xxx in $known_extensions ; do
15841         case "$xxx" in
15842         DB_File|db_file)
15843                 case "$i_db" in
15844                 $define) avail_ext="$avail_ext $xxx" ;;
15845                 esac
15846                 ;;
15847         GDBM_File|gdbm_fil)
15848                 case "$i_gdbm" in 
15849                 $define) avail_ext="$avail_ext $xxx" ;;
15850                 esac
15851                 ;;
15852         NDBM_File|ndbm_fil)
15853                 case "$i_ndbm" in
15854                 $define)
15855                     case "$osname-$use64bitint" in
15856                     hpux-define)
15857                         case "$libs" in
15858                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15859                         esac
15860                         ;;
15861                     *) avail_ext="$avail_ext $xxx" ;;
15862                     esac
15863                     ;;
15864                 esac
15865                 ;;
15866         ODBM_File|odbm_fil) 
15867                 case "${i_dbm}${i_rpcsvcdbm}" in
15868                 *"${define}"*)
15869                     case "$osname-$use64bitint" in
15870                     hpux-define)
15871                         case "$libs" in
15872                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15873                         esac
15874                         ;;
15875                     *) avail_ext="$avail_ext $xxx" ;;
15876                     esac
15877                     ;;
15878                 esac
15879                 ;;
15880         POSIX|posix)
15881                 case "$useposix" in
15882                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15883                 esac
15884                 ;;
15885         Opcode|opcode)
15886                 case "$useopcode" in
15887                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15888                 esac
15889                 ;;
15890         Socket|socket)
15891                 case "$d_socket" in 
15892                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15893                 esac
15894                 ;;
15895         Sys/Syslog|sys/syslog)
15896                 : XXX syslog requires socket
15897                 case "$d_socket" in 
15898                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15899                 esac
15900                 ;;
15901         Thread|thread)
15902                 case "$usethreads" in 
15903                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15904                 esac
15905                 ;;
15906         IPC/SysV|ipc/sysv)
15907                 : XXX Do we need a useipcsysv variable here
15908                 case "${d_msg}${d_sem}${d_shm}" in 
15909                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15910                 esac
15911                 ;;
15912         *)      avail_ext="$avail_ext $xxx"
15913                 ;;
15914         esac
15915 done
15916
15917 set X $avail_ext
15918 shift
15919 avail_ext="$*"
15920
15921 : Now see which nonxs extensions are supported on this system.
15922 : For now assume all are.
15923 nonxs_ext=''
15924 for xxx in $nonxs_extensions ; do
15925         case "$xxx" in
15926         *)      nonxs_ext="$nonxs_ext $xxx"
15927                 ;;
15928         esac
15929 done
15930
15931 set X $nonxs_ext
15932 shift
15933 nonxs_ext="$*"
15934
15935 case $usedl in
15936 $define)
15937         $cat <<EOM
15938 A number of extensions are supplied with $package.  You may choose to
15939 compile these extensions for dynamic loading (the default), compile
15940 them into the $package executable (static loading), or not include
15941 them at all.  Answer "none" to include no extensions.
15942 Note that DynaLoader is always built and need not be mentioned here.
15943
15944 EOM
15945         case "$dynamic_ext" in
15946         '') dflt="$avail_ext" ;;
15947         *)      dflt="$dynamic_ext"
15948                 # Perhaps we are reusing an old out-of-date config.sh.
15949                 case "$hint" in
15950                 previous)
15951                         if test X"$dynamic_ext" != X"$avail_ext"; then
15952                                 $cat <<EOM
15953 NOTICE:  Your previous config.sh list may be incorrect. 
15954 The extensions now available to you are 
15955         ${avail_ext}
15956 but the default list from your previous config.sh is
15957         ${dynamic_ext} 
15958
15959 EOM
15960                         fi
15961                         ;;
15962                 esac
15963                 ;;
15964         esac
15965         case "$dflt" in
15966         '')     dflt=none;;
15967         esac
15968         rp="What extensions do you wish to load dynamically?"
15969         . ./myread
15970         case "$ans" in
15971         none) dynamic_ext=' ' ;;
15972         *) dynamic_ext="$ans" ;;
15973         esac
15974
15975         case "$static_ext" in
15976         '')
15977                 : Exclude those already listed in dynamic linking
15978                 dflt=''
15979                 for xxx in $avail_ext; do
15980                         case " $dynamic_ext " in
15981                         *" $xxx "*) ;;
15982                         *) dflt="$dflt $xxx" ;;
15983                         esac
15984                 done
15985                 set X $dflt
15986                 shift
15987                 dflt="$*"
15988                 ;;
15989         *)  dflt="$static_ext" 
15990                 ;;
15991         esac
15992
15993         case "$dflt" in
15994         '')     dflt=none;;
15995         esac
15996         rp="What extensions do you wish to load statically?"
15997         . ./myread
15998         case "$ans" in
15999         none) static_ext=' ' ;;
16000         *) static_ext="$ans" ;;
16001         esac
16002         ;;
16003 *)
16004         $cat <<EOM
16005 A number of extensions are supplied with $package.  Answer "none" 
16006 to include no extensions. 
16007 Note that DynaLoader is always built and need not be mentioned here.
16008
16009 EOM
16010         case "$static_ext" in
16011         '') dflt="$avail_ext" ;;
16012         *)      dflt="$static_ext"
16013                 # Perhaps we are reusing an old out-of-date config.sh.
16014                 case "$hint" in
16015                 previous)
16016                         if test X"$static_ext" != X"$avail_ext"; then
16017                                 $cat <<EOM
16018 NOTICE:  Your previous config.sh list may be incorrect. 
16019 The extensions now available to you are 
16020         ${avail_ext}
16021 but the default list from your previous config.sh is
16022         ${static_ext} 
16023
16024 EOM
16025                         fi
16026                         ;;
16027                 esac
16028                 ;;
16029         esac
16030         : Exclude those that are not xs extensions
16031         case "$dflt" in
16032         '')     dflt=none;;
16033         esac
16034         rp="What extensions do you wish to include?"
16035         . ./myread
16036         case "$ans" in
16037         none) static_ext=' ' ;;
16038         *) static_ext="$ans" ;;
16039         esac
16040         ;;
16041 esac
16042
16043 set X $dynamic_ext $static_ext $nonxs_ext
16044 shift
16045 extensions="$*"
16046
16047 : Remove libraries needed only for extensions
16048 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16049 : The exception is SunOS 4.x, which needs them.
16050 case "${osname}X${osvers}" in
16051 sunos*X4*)
16052     perllibs="$libs"
16053     ;;
16054 *) case "$usedl" in
16055     $define|true|[yY]*)
16056             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16057             shift
16058             perllibs="$*"
16059             ;;
16060     *)  perllibs="$libs"
16061             ;;
16062     esac
16063     ;;
16064 esac
16065
16066 : Remove build directory name from cppstdin so it can be used from
16067 : either the present location or the final installed location.
16068 echo " "
16069 : Get out of the UU directory to get correct path name.
16070 cd ..
16071 case "$cppstdin" in
16072 `pwd`/cppstdin)
16073         echo "Stripping down cppstdin path name"
16074         cppstdin=cppstdin
16075         ;;
16076 esac
16077 cd UU
16078
16079 : end of configuration questions
16080 echo " "
16081 echo "End of configuration questions."
16082 echo " "
16083
16084 : back to where it started
16085 if test -d ../UU; then
16086         cd ..
16087 fi
16088
16089 : configuration may be patched via a 'config.over' file
16090 if $test -f config.over; then
16091         echo " "
16092         dflt=y
16093         rp='I see a config.over file.  Do you wish to load it?'
16094         . UU/myread
16095         case "$ans" in
16096         n*) echo "OK, I'll ignore it.";;
16097         *)      . ./config.over
16098                 echo "Configuration override changes have been loaded."
16099                 ;;
16100         esac
16101 fi
16102
16103 : in case they want portability, strip down executable paths
16104 case "$d_portable" in
16105 "$define")
16106         echo " "
16107         echo "Stripping down executable paths..." >&4
16108         for file in $loclist $trylist; do
16109                 eval temp=\$$file
16110                 eval $file=`basename $temp`
16111         done
16112         ;;
16113 esac
16114
16115 : create config.sh file
16116 echo " "
16117 echo "Creating config.sh..." >&4
16118 $spitshell <<EOT >config.sh
16119 $startsh
16120 #
16121 # This file was produced by running the Configure script. It holds all the
16122 # definitions figured out by Configure. Should you modify one of these values,
16123 # do not forget to propagate your changes by running "Configure -der". You may
16124 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16125 #
16126
16127 # Package name      : $package
16128 # Source directory  : $src
16129 # Configuration time: $cf_time
16130 # Configured by     : $cf_by
16131 # Target system     : $myuname
16132
16133 Author='$Author'
16134 Date='$Date'
16135 Header='$Header'
16136 Id='$Id'
16137 Locker='$Locker'
16138 Log='$Log'
16139 Mcc='$Mcc'
16140 RCSfile='$RCSfile'
16141 Revision='$Revision'
16142 Source='$Source'
16143 State='$State'
16144 _a='$_a'
16145 _exe='$_exe'
16146 _o='$_o'
16147 afs='$afs'
16148 afsroot='$afsroot'
16149 alignbytes='$alignbytes'
16150 ansi2knr='$ansi2knr'
16151 aphostname='$aphostname'
16152 api_revision='$api_revision'
16153 api_subversion='$api_subversion'
16154 api_version='$api_version'
16155 api_versionstring='$api_versionstring'
16156 ar='$ar'
16157 archlib='$archlib'
16158 archlibexp='$archlibexp'
16159 archname64='$archname64'
16160 archname='$archname'
16161 archobjs='$archobjs'
16162 awk='$awk'
16163 baserev='$baserev'
16164 bash='$bash'
16165 bin='$bin'
16166 bincompat5005='$bincompat5005'
16167 binexp='$binexp'
16168 bison='$bison'
16169 byacc='$byacc'
16170 byteorder='$byteorder'
16171 c='$c'
16172 castflags='$castflags'
16173 cat='$cat'
16174 cc='$cc'
16175 cccdlflags='$cccdlflags'
16176 ccdlflags='$ccdlflags'
16177 ccflags='$ccflags'
16178 ccflags_uselargefiles='$ccflags_uselargefiles'
16179 ccname='$ccname'
16180 ccsymbols='$ccsymbols'
16181 ccversion='$ccversion'
16182 cf_by='$cf_by'
16183 cf_email='$cf_email'
16184 cf_time='$cf_time'
16185 charsize='$charsize'
16186 chgrp='$chgrp'
16187 chmod='$chmod'
16188 chown='$chown'
16189 clocktype='$clocktype'
16190 comm='$comm'
16191 compress='$compress'
16192 contains='$contains'
16193 cp='$cp'
16194 cpio='$cpio'
16195 cpp='$cpp'
16196 cpp_stuff='$cpp_stuff'
16197 cppccsymbols='$cppccsymbols'
16198 cppflags='$cppflags'
16199 cpplast='$cpplast'
16200 cppminus='$cppminus'
16201 cpprun='$cpprun'
16202 cppstdin='$cppstdin'
16203 cppsymbols='$cppsymbols'
16204 crosscompile='$crosscompile'
16205 cryptlib='$cryptlib'
16206 csh='$csh'
16207 d_Gconvert='$d_Gconvert'
16208 d_PRIEUldbl='$d_PRIEUldbl'
16209 d_PRIFUldbl='$d_PRIFUldbl'
16210 d_PRIGUldbl='$d_PRIGUldbl'
16211 d_PRIXU64='$d_PRIXU64'
16212 d_PRId64='$d_PRId64'
16213 d_PRIeldbl='$d_PRIeldbl'
16214 d_PRIfldbl='$d_PRIfldbl'
16215 d_PRIgldbl='$d_PRIgldbl'
16216 d_PRIi64='$d_PRIi64'
16217 d_PRIo64='$d_PRIo64'
16218 d_PRIu64='$d_PRIu64'
16219 d_PRIx64='$d_PRIx64'
16220 d_SCNfldbl='$d_SCNfldbl'
16221 d__fwalk='$d__fwalk'
16222 d_access='$d_access'
16223 d_accessx='$d_accessx'
16224 d_alarm='$d_alarm'
16225 d_archlib='$d_archlib'
16226 d_atolf='$d_atolf'
16227 d_atoll='$d_atoll'
16228 d_attribut='$d_attribut'
16229 d_bcmp='$d_bcmp'
16230 d_bcopy='$d_bcopy'
16231 d_bincompat5005='$d_bincompat5005'
16232 d_bsd='$d_bsd'
16233 d_bsdgetpgrp='$d_bsdgetpgrp'
16234 d_bsdsetpgrp='$d_bsdsetpgrp'
16235 d_bzero='$d_bzero'
16236 d_casti32='$d_casti32'
16237 d_castneg='$d_castneg'
16238 d_charvspr='$d_charvspr'
16239 d_chown='$d_chown'
16240 d_chroot='$d_chroot'
16241 d_chsize='$d_chsize'
16242 d_closedir='$d_closedir'
16243 d_cmsghdr_s='$d_cmsghdr_s'
16244 d_const='$d_const'
16245 d_crypt='$d_crypt'
16246 d_csh='$d_csh'
16247 d_cuserid='$d_cuserid'
16248 d_dbl_dig='$d_dbl_dig'
16249 d_difftime='$d_difftime'
16250 d_dirnamlen='$d_dirnamlen'
16251 d_dlerror='$d_dlerror'
16252 d_dlopen='$d_dlopen'
16253 d_dlsymun='$d_dlsymun'
16254 d_dosuid='$d_dosuid'
16255 d_drand48proto='$d_drand48proto'
16256 d_dup2='$d_dup2'
16257 d_eaccess='$d_eaccess'
16258 d_endgrent='$d_endgrent'
16259 d_endhent='$d_endhent'
16260 d_endnent='$d_endnent'
16261 d_endpent='$d_endpent'
16262 d_endpwent='$d_endpwent'
16263 d_endsent='$d_endsent'
16264 d_eofnblk='$d_eofnblk'
16265 d_eunice='$d_eunice'
16266 d_fchmod='$d_fchmod'
16267 d_fchown='$d_fchown'
16268 d_fcntl='$d_fcntl'
16269 d_fcntl_can_lock='$d_fcntl_can_lock'
16270 d_fd_macros='$d_fd_macros'
16271 d_fd_set='$d_fd_set'
16272 d_fds_bits='$d_fds_bits'
16273 d_fgetpos='$d_fgetpos'
16274 d_flexfnam='$d_flexfnam'
16275 d_flock='$d_flock'
16276 d_fork='$d_fork'
16277 d_fpathconf='$d_fpathconf'
16278 d_fpos64_t='$d_fpos64_t'
16279 d_frexpl='$d_frexpl'
16280 d_fs_data_s='$d_fs_data_s'
16281 d_fseeko='$d_fseeko'
16282 d_fsetpos='$d_fsetpos'
16283 d_fstatfs='$d_fstatfs'
16284 d_fstatvfs='$d_fstatvfs'
16285 d_fsync='$d_fsync'
16286 d_ftello='$d_ftello'
16287 d_ftime='$d_ftime'
16288 d_getcwd='$d_getcwd'
16289 d_getespwnam='$d_getespwnam'
16290 d_getfsstat='$d_getfsstat'
16291 d_getgrent='$d_getgrent'
16292 d_getgrps='$d_getgrps'
16293 d_gethbyaddr='$d_gethbyaddr'
16294 d_gethbyname='$d_gethbyname'
16295 d_gethent='$d_gethent'
16296 d_gethname='$d_gethname'
16297 d_gethostprotos='$d_gethostprotos'
16298 d_getitimer='$d_getitimer'
16299 d_getlogin='$d_getlogin'
16300 d_getmnt='$d_getmnt'
16301 d_getmntent='$d_getmntent'
16302 d_getnbyaddr='$d_getnbyaddr'
16303 d_getnbyname='$d_getnbyname'
16304 d_getnent='$d_getnent'
16305 d_getnetprotos='$d_getnetprotos'
16306 d_getpagsz='$d_getpagsz'
16307 d_getpbyname='$d_getpbyname'
16308 d_getpbynumber='$d_getpbynumber'
16309 d_getpent='$d_getpent'
16310 d_getpgid='$d_getpgid'
16311 d_getpgrp2='$d_getpgrp2'
16312 d_getpgrp='$d_getpgrp'
16313 d_getppid='$d_getppid'
16314 d_getprior='$d_getprior'
16315 d_getprotoprotos='$d_getprotoprotos'
16316 d_getprpwnam='$d_getprpwnam'
16317 d_getpwent='$d_getpwent'
16318 d_getsbyname='$d_getsbyname'
16319 d_getsbyport='$d_getsbyport'
16320 d_getsent='$d_getsent'
16321 d_getservprotos='$d_getservprotos'
16322 d_getspnam='$d_getspnam'
16323 d_gettimeod='$d_gettimeod'
16324 d_gnulibc='$d_gnulibc'
16325 d_grpasswd='$d_grpasswd'
16326 d_hasmntopt='$d_hasmntopt'
16327 d_htonl='$d_htonl'
16328 d_iconv='$d_iconv'
16329 d_index='$d_index'
16330 d_inetaton='$d_inetaton'
16331 d_int64_t='$d_int64_t'
16332 d_isascii='$d_isascii'
16333 d_isnan='$d_isnan'
16334 d_isnanl='$d_isnanl'
16335 d_killpg='$d_killpg'
16336 d_lchown='$d_lchown'
16337 d_ldbl_dig='$d_ldbl_dig'
16338 d_link='$d_link'
16339 d_locconv='$d_locconv'
16340 d_lockf='$d_lockf'
16341 d_longdbl='$d_longdbl'
16342 d_longlong='$d_longlong'
16343 d_lseekproto='$d_lseekproto'
16344 d_lstat='$d_lstat'
16345 d_madvise='$d_madvise'
16346 d_mblen='$d_mblen'
16347 d_mbstowcs='$d_mbstowcs'
16348 d_mbtowc='$d_mbtowc'
16349 d_memchr='$d_memchr'
16350 d_memcmp='$d_memcmp'
16351 d_memcpy='$d_memcpy'
16352 d_memmove='$d_memmove'
16353 d_memset='$d_memset'
16354 d_mkdir='$d_mkdir'
16355 d_mkdtemp='$d_mkdtemp'
16356 d_mkfifo='$d_mkfifo'
16357 d_mkstemp='$d_mkstemp'
16358 d_mkstemps='$d_mkstemps'
16359 d_mktime='$d_mktime'
16360 d_mmap='$d_mmap'
16361 d_modfl='$d_modfl'
16362 d_mprotect='$d_mprotect'
16363 d_msg='$d_msg'
16364 d_msg_ctrunc='$d_msg_ctrunc'
16365 d_msg_dontroute='$d_msg_dontroute'
16366 d_msg_oob='$d_msg_oob'
16367 d_msg_peek='$d_msg_peek'
16368 d_msg_proxy='$d_msg_proxy'
16369 d_msgctl='$d_msgctl'
16370 d_msgget='$d_msgget'
16371 d_msghdr_s='$d_msghdr_s'
16372 d_msgrcv='$d_msgrcv'
16373 d_msgsnd='$d_msgsnd'
16374 d_msync='$d_msync'
16375 d_munmap='$d_munmap'
16376 d_mymalloc='$d_mymalloc'
16377 d_nice='$d_nice'
16378 d_nv_preserves_uv='$d_nv_preserves_uv'
16379 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16380 d_off64_t='$d_off64_t'
16381 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16382 d_oldpthreads='$d_oldpthreads'
16383 d_oldsock='$d_oldsock'
16384 d_open3='$d_open3'
16385 d_pathconf='$d_pathconf'
16386 d_pause='$d_pause'
16387 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16388 d_phostname='$d_phostname'
16389 d_pipe='$d_pipe'
16390 d_poll='$d_poll'
16391 d_portable='$d_portable'
16392 d_pthread_yield='$d_pthread_yield'
16393 d_pwage='$d_pwage'
16394 d_pwchange='$d_pwchange'
16395 d_pwclass='$d_pwclass'
16396 d_pwcomment='$d_pwcomment'
16397 d_pwexpire='$d_pwexpire'
16398 d_pwgecos='$d_pwgecos'
16399 d_pwpasswd='$d_pwpasswd'
16400 d_pwquota='$d_pwquota'
16401 d_qgcvt='$d_qgcvt'
16402 d_quad='$d_quad'
16403 d_readdir='$d_readdir'
16404 d_readlink='$d_readlink'
16405 d_readv='$d_readv'
16406 d_realpath='$d_realpath'
16407 d_recvmsg='$d_recvmsg'
16408 d_rename='$d_rename'
16409 d_rewinddir='$d_rewinddir'
16410 d_rmdir='$d_rmdir'
16411 d_safebcpy='$d_safebcpy'
16412 d_safemcpy='$d_safemcpy'
16413 d_sanemcmp='$d_sanemcmp'
16414 d_sbrkproto='$d_sbrkproto'
16415 d_sched_yield='$d_sched_yield'
16416 d_scm_rights='$d_scm_rights'
16417 d_seekdir='$d_seekdir'
16418 d_select='$d_select'
16419 d_sem='$d_sem'
16420 d_semctl='$d_semctl'
16421 d_semctl_semid_ds='$d_semctl_semid_ds'
16422 d_semctl_semun='$d_semctl_semun'
16423 d_semget='$d_semget'
16424 d_semop='$d_semop'
16425 d_sendmsg='$d_sendmsg'
16426 d_setegid='$d_setegid'
16427 d_seteuid='$d_seteuid'
16428 d_setgrent='$d_setgrent'
16429 d_setgrps='$d_setgrps'
16430 d_sethent='$d_sethent'
16431 d_setitimer='$d_setitimer'
16432 d_setlinebuf='$d_setlinebuf'
16433 d_setlocale='$d_setlocale'
16434 d_setnent='$d_setnent'
16435 d_setpent='$d_setpent'
16436 d_setpgid='$d_setpgid'
16437 d_setpgrp2='$d_setpgrp2'
16438 d_setpgrp='$d_setpgrp'
16439 d_setprior='$d_setprior'
16440 d_setproctitle='$d_setproctitle'
16441 d_setpwent='$d_setpwent'
16442 d_setregid='$d_setregid'
16443 d_setresgid='$d_setresgid'
16444 d_setresuid='$d_setresuid'
16445 d_setreuid='$d_setreuid'
16446 d_setrgid='$d_setrgid'
16447 d_setruid='$d_setruid'
16448 d_setsent='$d_setsent'
16449 d_setsid='$d_setsid'
16450 d_setvbuf='$d_setvbuf'
16451 d_sfio='$d_sfio'
16452 d_shm='$d_shm'
16453 d_shmat='$d_shmat'
16454 d_shmatprototype='$d_shmatprototype'
16455 d_shmctl='$d_shmctl'
16456 d_shmdt='$d_shmdt'
16457 d_shmget='$d_shmget'
16458 d_sigaction='$d_sigaction'
16459 d_sigprocmask='$d_sigprocmask'
16460 d_sigsetjmp='$d_sigsetjmp'
16461 d_sockatmark='$d_sockatmark'
16462 d_socket='$d_socket'
16463 d_socklen_t='$d_socklen_t'
16464 d_sockpair='$d_sockpair'
16465 d_socks5_init='$d_socks5_init'
16466 d_sqrtl='$d_sqrtl'
16467 d_sresgproto='$d_sresgproto'
16468 d_sresuproto='$d_sresuproto'
16469 d_statblks='$d_statblks'
16470 d_statfs_f_flags='$d_statfs_f_flags'
16471 d_statfs_s='$d_statfs_s'
16472 d_statvfs='$d_statvfs'
16473 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16474 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16475 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16476 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16477 d_stdio_stream_array='$d_stdio_stream_array'
16478 d_stdiobase='$d_stdiobase'
16479 d_stdstdio='$d_stdstdio'
16480 d_strchr='$d_strchr'
16481 d_strcoll='$d_strcoll'
16482 d_strctcpy='$d_strctcpy'
16483 d_strerrm='$d_strerrm'
16484 d_strerror='$d_strerror'
16485 d_strftime='$d_strftime'
16486 d_strtod='$d_strtod'
16487 d_strtol='$d_strtol'
16488 d_strtold='$d_strtold'
16489 d_strtoll='$d_strtoll'
16490 d_strtoq='$d_strtoq'
16491 d_strtoul='$d_strtoul'
16492 d_strtoull='$d_strtoull'
16493 d_strtouq='$d_strtouq'
16494 d_strxfrm='$d_strxfrm'
16495 d_suidsafe='$d_suidsafe'
16496 d_symlink='$d_symlink'
16497 d_syscall='$d_syscall'
16498 d_sysconf='$d_sysconf'
16499 d_sysernlst='$d_sysernlst'
16500 d_syserrlst='$d_syserrlst'
16501 d_system='$d_system'
16502 d_tcgetpgrp='$d_tcgetpgrp'
16503 d_tcsetpgrp='$d_tcsetpgrp'
16504 d_telldir='$d_telldir'
16505 d_telldirproto='$d_telldirproto'
16506 d_time='$d_time'
16507 d_times='$d_times'
16508 d_truncate='$d_truncate'
16509 d_tzname='$d_tzname'
16510 d_u32align='$d_u32align'
16511 d_ualarm='$d_ualarm'
16512 d_umask='$d_umask'
16513 d_uname='$d_uname'
16514 d_union_semun='$d_union_semun'
16515 d_usleep='$d_usleep'
16516 d_ustat='$d_ustat'
16517 d_vendorarch='$d_vendorarch'
16518 d_vendorbin='$d_vendorbin'
16519 d_vendorlib='$d_vendorlib'
16520 d_vfork='$d_vfork'
16521 d_void_closedir='$d_void_closedir'
16522 d_voidsig='$d_voidsig'
16523 d_voidtty='$d_voidtty'
16524 d_volatile='$d_volatile'
16525 d_vprintf='$d_vprintf'
16526 d_wait4='$d_wait4'
16527 d_waitpid='$d_waitpid'
16528 d_wcstombs='$d_wcstombs'
16529 d_wctomb='$d_wctomb'
16530 d_writev='$d_writev'
16531 d_xenix='$d_xenix'
16532 date='$date'
16533 db_hashtype='$db_hashtype'
16534 db_prefixtype='$db_prefixtype'
16535 db_version_major='$db_version_major'
16536 db_version_minor='$db_version_minor'
16537 db_version_patch='$db_version_patch'
16538 defvoidused='$defvoidused'
16539 direntrytype='$direntrytype'
16540 dlext='$dlext'
16541 dlsrc='$dlsrc'
16542 doublesize='$doublesize'
16543 drand01='$drand01'
16544 dynamic_ext='$dynamic_ext'
16545 eagain='$eagain'
16546 ebcdic='$ebcdic'
16547 echo='$echo'
16548 egrep='$egrep'
16549 emacs='$emacs'
16550 eunicefix='$eunicefix'
16551 exe_ext='$exe_ext'
16552 expr='$expr'
16553 extensions='$extensions'
16554 fflushNULL='$fflushNULL'
16555 fflushall='$fflushall'
16556 find='$find'
16557 firstmakefile='$firstmakefile'
16558 flex='$flex'
16559 fpossize='$fpossize'
16560 fpostype='$fpostype'
16561 freetype='$freetype'
16562 full_ar='$full_ar'
16563 full_csh='$full_csh'
16564 full_sed='$full_sed'
16565 gccosandvers='$gccosandvers'
16566 gccversion='$gccversion'
16567 gidformat='$gidformat'
16568 gidsign='$gidsign'
16569 gidsize='$gidsize'
16570 gidtype='$gidtype'
16571 glibpth='$glibpth'
16572 grep='$grep'
16573 groupcat='$groupcat'
16574 groupstype='$groupstype'
16575 gzip='$gzip'
16576 h_fcntl='$h_fcntl'
16577 h_sysfile='$h_sysfile'
16578 hint='$hint'
16579 hostcat='$hostcat'
16580 i16size='$i16size'
16581 i16type='$i16type'
16582 i32size='$i32size'
16583 i32type='$i32type'
16584 i64size='$i64size'
16585 i64type='$i64type'
16586 i8size='$i8size'
16587 i8type='$i8type'
16588 i_arpainet='$i_arpainet'
16589 i_bsdioctl='$i_bsdioctl'
16590 i_db='$i_db'
16591 i_dbm='$i_dbm'
16592 i_dirent='$i_dirent'
16593 i_dld='$i_dld'
16594 i_dlfcn='$i_dlfcn'
16595 i_fcntl='$i_fcntl'
16596 i_float='$i_float'
16597 i_gdbm='$i_gdbm'
16598 i_grp='$i_grp'
16599 i_iconv='$i_iconv'
16600 i_ieeefp='$i_ieeefp'
16601 i_inttypes='$i_inttypes'
16602 i_libutil='$i_libutil'
16603 i_limits='$i_limits'
16604 i_locale='$i_locale'
16605 i_machcthr='$i_machcthr'
16606 i_malloc='$i_malloc'
16607 i_math='$i_math'
16608 i_memory='$i_memory'
16609 i_mntent='$i_mntent'
16610 i_ndbm='$i_ndbm'
16611 i_netdb='$i_netdb'
16612 i_neterrno='$i_neterrno'
16613 i_netinettcp='$i_netinettcp'
16614 i_niin='$i_niin'
16615 i_poll='$i_poll'
16616 i_prot='$i_prot'
16617 i_pthread='$i_pthread'
16618 i_pwd='$i_pwd'
16619 i_rpcsvcdbm='$i_rpcsvcdbm'
16620 i_sfio='$i_sfio'
16621 i_sgtty='$i_sgtty'
16622 i_shadow='$i_shadow'
16623 i_socks='$i_socks'
16624 i_stdarg='$i_stdarg'
16625 i_stddef='$i_stddef'
16626 i_stdlib='$i_stdlib'
16627 i_string='$i_string'
16628 i_sunmath='$i_sunmath'
16629 i_sysaccess='$i_sysaccess'
16630 i_sysdir='$i_sysdir'
16631 i_sysfile='$i_sysfile'
16632 i_sysfilio='$i_sysfilio'
16633 i_sysin='$i_sysin'
16634 i_sysioctl='$i_sysioctl'
16635 i_syslog='$i_syslog'
16636 i_sysmman='$i_sysmman'
16637 i_sysmode='$i_sysmode'
16638 i_sysmount='$i_sysmount'
16639 i_sysndir='$i_sysndir'
16640 i_sysparam='$i_sysparam'
16641 i_sysresrc='$i_sysresrc'
16642 i_syssecrt='$i_syssecrt'
16643 i_sysselct='$i_sysselct'
16644 i_syssockio='$i_syssockio'
16645 i_sysstat='$i_sysstat'
16646 i_sysstatfs='$i_sysstatfs'
16647 i_sysstatvfs='$i_sysstatvfs'
16648 i_systime='$i_systime'
16649 i_systimek='$i_systimek'
16650 i_systimes='$i_systimes'
16651 i_systypes='$i_systypes'
16652 i_sysuio='$i_sysuio'
16653 i_sysun='$i_sysun'
16654 i_sysutsname='$i_sysutsname'
16655 i_sysvfs='$i_sysvfs'
16656 i_syswait='$i_syswait'
16657 i_termio='$i_termio'
16658 i_termios='$i_termios'
16659 i_time='$i_time'
16660 i_unistd='$i_unistd'
16661 i_ustat='$i_ustat'
16662 i_utime='$i_utime'
16663 i_values='$i_values'
16664 i_varargs='$i_varargs'
16665 i_varhdr='$i_varhdr'
16666 i_vfork='$i_vfork'
16667 ignore_versioned_solibs='$ignore_versioned_solibs'
16668 inc_version_list='$inc_version_list'
16669 inc_version_list_init='$inc_version_list_init'
16670 incpath='$incpath'
16671 inews='$inews'
16672 installarchlib='$installarchlib'
16673 installbin='$installbin'
16674 installman1dir='$installman1dir'
16675 installman3dir='$installman3dir'
16676 installprefix='$installprefix'
16677 installprefixexp='$installprefixexp'
16678 installprivlib='$installprivlib'
16679 installscript='$installscript'
16680 installsitearch='$installsitearch'
16681 installsitebin='$installsitebin'
16682 installsitelib='$installsitelib'
16683 installstyle='$installstyle'
16684 installusrbinperl='$installusrbinperl'
16685 installvendorarch='$installvendorarch'
16686 installvendorbin='$installvendorbin'
16687 installvendorlib='$installvendorlib'
16688 intsize='$intsize'
16689 issymlink='$issymlink'
16690 ivdformat='$ivdformat'
16691 ivsize='$ivsize'
16692 ivtype='$ivtype'
16693 known_extensions='$known_extensions'
16694 ksh='$ksh'
16695 ld='$ld'
16696 lddlflags='$lddlflags'
16697 ldflags='$ldflags'
16698 ldflags_uselargefiles='$ldflags_uselargefiles'
16699 ldlibpthname='$ldlibpthname'
16700 less='$less'
16701 lib_ext='$lib_ext'
16702 libc='$libc'
16703 libperl='$libperl'
16704 libpth='$libpth'
16705 libs='$libs'
16706 libsdirs='$libsdirs'
16707 libsfiles='$libsfiles'
16708 libsfound='$libsfound'
16709 libspath='$libspath'
16710 libswanted='$libswanted'
16711 libswanted_uselargefiles='$libswanted_uselargefiles'
16712 line='$line'
16713 lint='$lint'
16714 lkflags='$lkflags'
16715 ln='$ln'
16716 lns='$lns'
16717 locincpth='$locincpth'
16718 loclibpth='$loclibpth'
16719 longdblsize='$longdblsize'
16720 longlongsize='$longlongsize'
16721 longsize='$longsize'
16722 lp='$lp'
16723 lpr='$lpr'
16724 ls='$ls'
16725 lseeksize='$lseeksize'
16726 lseektype='$lseektype'
16727 mail='$mail'
16728 mailx='$mailx'
16729 make='$make'
16730 make_set_make='$make_set_make'
16731 mallocobj='$mallocobj'
16732 mallocsrc='$mallocsrc'
16733 malloctype='$malloctype'
16734 man1dir='$man1dir'
16735 man1direxp='$man1direxp'
16736 man1ext='$man1ext'
16737 man3dir='$man3dir'
16738 man3direxp='$man3direxp'
16739 man3ext='$man3ext'
16740 mips_type='$mips_type'
16741 mkdir='$mkdir'
16742 mmaptype='$mmaptype'
16743 modetype='$modetype'
16744 more='$more'
16745 multiarch='$multiarch'
16746 mv='$mv'
16747 myarchname='$myarchname'
16748 mydomain='$mydomain'
16749 myhostname='$myhostname'
16750 myuname='$myuname'
16751 n='$n'
16752 need_va_copy='$need_va_copy'
16753 netdb_hlen_type='$netdb_hlen_type'
16754 netdb_host_type='$netdb_host_type'
16755 netdb_name_type='$netdb_name_type'
16756 netdb_net_type='$netdb_net_type'
16757 nm='$nm'
16758 nm_opt='$nm_opt'
16759 nm_so_opt='$nm_so_opt'
16760 nonxs_ext='$nonxs_ext'
16761 nroff='$nroff'
16762 nvEUformat='$nvEUformat'
16763 nvFUformat='$nvFUformat'
16764 nvGUformat='$nvGUformat'
16765 nveformat='$nveformat'
16766 nvfformat='$nvfformat'
16767 nvgformat='$nvgformat'
16768 nvsize='$nvsize'
16769 nvtype='$nvtype'
16770 o_nonblock='$o_nonblock'
16771 obj_ext='$obj_ext'
16772 old_pthread_create_joinable='$old_pthread_create_joinable'
16773 optimize='$optimize'
16774 orderlib='$orderlib'
16775 osname='$osname'
16776 osvers='$osvers'
16777 otherlibdirs='$otherlibdirs'
16778 package='$package'
16779 pager='$pager'
16780 passcat='$passcat'
16781 patchlevel='$patchlevel'
16782 path_sep='$path_sep'
16783 perl5='$perl5'
16784 perl='$perl'
16785 perl_patchlevel='$perl_patchlevel'
16786 perladmin='$perladmin'
16787 perllibs='$perllibs'
16788 perlpath='$perlpath'
16789 pg='$pg'
16790 phostname='$phostname'
16791 pidtype='$pidtype'
16792 plibpth='$plibpth'
16793 pm_apiversion='$pm_apiversion'
16794 pmake='$pmake'
16795 pr='$pr'
16796 prefix='$prefix'
16797 prefixexp='$prefixexp'
16798 privlib='$privlib'
16799 privlibexp='$privlibexp'
16800 prototype='$prototype'
16801 ptrsize='$ptrsize'
16802 quadkind='$quadkind'
16803 quadtype='$quadtype'
16804 randbits='$randbits'
16805 randfunc='$randfunc'
16806 randseedtype='$randseedtype'
16807 ranlib='$ranlib'
16808 rd_nodata='$rd_nodata'
16809 revision='$revision'
16810 rm='$rm'
16811 rmail='$rmail'
16812 runnm='$runnm'
16813 sPRIEUldbl='$sPRIEUldbl'
16814 sPRIFUldbl='$sPRIFUldbl'
16815 sPRIGUldbl='$sPRIGUldbl'
16816 sPRIXU64='$sPRIXU64'
16817 sPRId64='$sPRId64'
16818 sPRIeldbl='$sPRIeldbl'
16819 sPRIfldbl='$sPRIfldbl'
16820 sPRIgldbl='$sPRIgldbl'
16821 sPRIi64='$sPRIi64'
16822 sPRIo64='$sPRIo64'
16823 sPRIu64='$sPRIu64'
16824 sPRIx64='$sPRIx64'
16825 sSCNfldbl='$sSCNfldbl'
16826 sched_yield='$sched_yield'
16827 scriptdir='$scriptdir'
16828 scriptdirexp='$scriptdirexp'
16829 sed='$sed'
16830 seedfunc='$seedfunc'
16831 selectminbits='$selectminbits'
16832 selecttype='$selecttype'
16833 sendmail='$sendmail'
16834 sh='$sh'
16835 shar='$shar'
16836 sharpbang='$sharpbang'
16837 shmattype='$shmattype'
16838 shortsize='$shortsize'
16839 shrpenv='$shrpenv'
16840 shsharp='$shsharp'
16841 sig_count='$sig_count'
16842 sig_name='$sig_name'
16843 sig_name_init='$sig_name_init'
16844 sig_num='$sig_num'
16845 sig_num_init='$sig_num_init'
16846 sig_size='$sig_size'
16847 signal_t='$signal_t'
16848 sitearch='$sitearch'
16849 sitearchexp='$sitearchexp'
16850 sitebin='$sitebin'
16851 sitebinexp='$sitebinexp'
16852 sitelib='$sitelib'
16853 sitelib_stem='$sitelib_stem'
16854 sitelibexp='$sitelibexp'
16855 siteprefix='$siteprefix'
16856 siteprefixexp='$siteprefixexp'
16857 sizesize='$sizesize'
16858 sizetype='$sizetype'
16859 sleep='$sleep'
16860 smail='$smail'
16861 so='$so'
16862 sockethdr='$sockethdr'
16863 socketlib='$socketlib'
16864 socksizetype='$socksizetype'
16865 sort='$sort'
16866 spackage='$spackage'
16867 spitshell='$spitshell'
16868 src='$src'
16869 ssizetype='$ssizetype'
16870 startperl='$startperl'
16871 startsh='$startsh'
16872 static_ext='$static_ext'
16873 stdchar='$stdchar'
16874 stdio_base='$stdio_base'
16875 stdio_bufsiz='$stdio_bufsiz'
16876 stdio_cnt='$stdio_cnt'
16877 stdio_filbuf='$stdio_filbuf'
16878 stdio_ptr='$stdio_ptr'
16879 stdio_stream_array='$stdio_stream_array'
16880 strings='$strings'
16881 submit='$submit'
16882 subversion='$subversion'
16883 sysman='$sysman'
16884 tail='$tail'
16885 tar='$tar'
16886 tbl='$tbl'
16887 tee='$tee'
16888 test='$test'
16889 timeincl='$timeincl'
16890 timetype='$timetype'
16891 touch='$touch'
16892 tr='$tr'
16893 trnl='$trnl'
16894 troff='$troff'
16895 u16size='$u16size'
16896 u16type='$u16type'
16897 u32size='$u32size'
16898 u32type='$u32type'
16899 u64size='$u64size'
16900 u64type='$u64type'
16901 u8size='$u8size'
16902 u8type='$u8type'
16903 uidformat='$uidformat'
16904 uidsign='$uidsign'
16905 uidsize='$uidsize'
16906 uidtype='$uidtype'
16907 uname='$uname'
16908 uniq='$uniq'
16909 uquadtype='$uquadtype'
16910 use5005threads='$use5005threads'
16911 use64bitall='$use64bitall'
16912 use64bitint='$use64bitint'
16913 usedl='$usedl'
16914 useithreads='$useithreads'
16915 uselargefiles='$uselargefiles'
16916 uselongdouble='$uselongdouble'
16917 usemorebits='$usemorebits'
16918 usemultiplicity='$usemultiplicity'
16919 usemymalloc='$usemymalloc'
16920 usenm='$usenm'
16921 useopcode='$useopcode'
16922 useperlio='$useperlio'
16923 useposix='$useposix'
16924 usesfio='$usesfio'
16925 useshrplib='$useshrplib'
16926 usesocks='$usesocks'
16927 usethreads='$usethreads'
16928 usevendorprefix='$usevendorprefix'
16929 usevfork='$usevfork'
16930 usrinc='$usrinc'
16931 uuname='$uuname'
16932 uvXUformat='$uvXUformat'
16933 uvoformat='$uvoformat'
16934 uvsize='$uvsize'
16935 uvtype='$uvtype'
16936 uvuformat='$uvuformat'
16937 uvxformat='$uvxformat'
16938 vendorarch='$vendorarch'
16939 vendorarchexp='$vendorarchexp'
16940 vendorbin='$vendorbin'
16941 vendorbinexp='$vendorbinexp'
16942 vendorlib='$vendorlib'
16943 vendorlib_stem='$vendorlib_stem'
16944 vendorlibexp='$vendorlibexp'
16945 vendorprefix='$vendorprefix'
16946 vendorprefixexp='$vendorprefixexp'
16947 version='$version'
16948 versiononly='$versiononly'
16949 vi='$vi'
16950 voidflags='$voidflags'
16951 xlibpth='$xlibpth'
16952 xs_apiversion='$xs_apiversion'
16953 yacc='$yacc'
16954 yaccflags='$yaccflags'
16955 zcat='$zcat'
16956 zip='$zip'
16957 EOT
16958
16959 : Add in command line options if available
16960 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16961
16962 : add special variables
16963 $test -f $src/patchlevel.h && \
16964 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16965 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
16966 echo "PERL_CONFIG_SH=true" >>config.sh
16967
16968 : propagate old symbols
16969 if $test -f UU/config.sh; then
16970         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16971         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16972         $sort | $uniq -u >UU/oldsyms
16973         set X `cat UU/oldsyms`
16974         shift
16975         case $# in
16976         0) ;;
16977         *)
16978                 cat <<EOM
16979 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16980 EOM
16981                 echo "# Variables propagated from previous config.sh file." >>config.sh
16982                 for sym in `cat UU/oldsyms`; do
16983                         echo "    Propagating $hint variable "'$'"$sym..."
16984                         eval 'tmp="$'"${sym}"'"'
16985                         echo "$tmp" | \
16986                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16987                 done
16988                 ;;
16989         esac
16990 fi
16991
16992 : Finish up by extracting the .SH files
16993 case "$alldone" in
16994 exit)
16995         $rm -rf UU
16996         echo "Done."
16997         exit 0
16998         ;;
16999 cont)
17000         ;;
17001 '')
17002         dflt=''
17003         nostick=true
17004         $cat <<EOM
17005
17006 If you'd like to make any changes to the config.sh file before I begin
17007 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17008
17009 EOM
17010         rp="Press return or use a shell escape to edit config.sh:"
17011         . UU/myread
17012         nostick=''
17013         case "$ans" in
17014         '') ;;
17015         *) : in case they cannot read
17016                 sh 1>&4 -c "$ans";;
17017         esac
17018         ;;
17019 esac
17020
17021 : if this fails, just run all the .SH files by hand
17022 . ./config.sh
17023
17024 echo " "
17025 exec 1>&4
17026 . ./UU/extract
17027
17028 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17029         dflt=y
17030         case "$silent" in
17031         true) ;;
17032         *)
17033                 $cat <<EOM
17034
17035 Now you need to generate make dependencies by running "$make depend".
17036 You might prefer to run it in background: "$make depend > makedepend.out &"
17037 It can take a while, so you might not want to run it right now.
17038
17039 EOM
17040                 ;;
17041         esac
17042         rp="Run $make depend now?"
17043         . UU/myread
17044         case "$ans" in
17045         y*)
17046                 $make depend && echo "Now you must run '$make'."
17047                 ;;
17048         *)
17049                 echo "You must run '$make depend' then '$make'."
17050                 ;;
17051         esac
17052 elif test -f [Mm]akefile; then
17053         echo " "
17054         echo "Now you must run a $make."
17055 else
17056         echo "Done."
17057 fi
17058
17059 if $test -f Policy.sh; then
17060     $cat <<EOM
17061
17062 If you compile $package on a different machine or from a different object
17063 directory, copy the Policy.sh file from this object directory to the
17064 new one before you run Configure -- this will help you with most of
17065 the policy defaults.
17066
17067 EOM
17068 fi
17069 if $test -f config.msg; then
17070     echo "Hmm.  I also noted the following information while running:"
17071     echo " "
17072     $cat config.msg >&4
17073     $rm -f config.msg
17074 fi
17075 $rm -f kit*isdone ark*isdone
17076 $rm -rf UU
17077
17078 : End of Configure
17079