This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Introduce $Config{afsroot}.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed May 30 17:55:32 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_recvmsg=''
482 d_rename=''
483 d_rmdir=''
484 d_safebcpy=''
485 d_safemcpy=''
486 d_sanemcmp=''
487 d_sbrkproto=''
488 d_select=''
489 d_sem=''
490 d_semctl=''
491 d_semget=''
492 d_semop=''
493 d_sendmsg=''
494 d_setegid=''
495 d_seteuid=''
496 d_setgrent=''
497 d_setgrps=''
498 d_sethent=''
499 d_setitimer=''
500 d_setlinebuf=''
501 d_setlocale=''
502 d_setnent=''
503 d_setpent=''
504 d_setpgid=''
505 d_setpgrp2=''
506 d_bsdsetpgrp=''
507 d_setpgrp=''
508 d_setprior=''
509 d_setproctitle=''
510 d_setpwent=''
511 d_setregid=''
512 d_setresgid=''
513 d_setresuid=''
514 d_setreuid=''
515 d_setrgid=''
516 d_setruid=''
517 d_setsent=''
518 d_setsid=''
519 d_setvbuf=''
520 d_sfio=''
521 usesfio=''
522 d_shm=''
523 d_shmat=''
524 d_shmatprototype=''
525 shmattype=''
526 d_shmctl=''
527 d_shmdt=''
528 d_shmget=''
529 d_sigaction=''
530 d_sigprocmask=''
531 d_sigsetjmp=''
532 d_sockatmark=''
533 d_msg_ctrunc=''
534 d_msg_dontroute=''
535 d_msg_oob=''
536 d_msg_peek=''
537 d_msg_proxy=''
538 d_oldsock=''
539 d_scm_rights=''
540 d_socket=''
541 d_sockpair=''
542 sockethdr=''
543 socketlib=''
544 d_socklen_t=''
545 d_socks5_init=''
546 d_sqrtl=''
547 d_statblks=''
548 d_statfs_f_flags=''
549 d_statfs_s=''
550 d_fstatvfs=''
551 d_statvfs=''
552 d_stdio_cnt_lval=''
553 d_stdio_ptr_lval=''
554 d_stdio_ptr_lval_nochange_cnt=''
555 d_stdio_ptr_lval_sets_cnt=''
556 d_stdiobase=''
557 d_stdstdio=''
558 stdio_base=''
559 stdio_bufsiz=''
560 stdio_cnt=''
561 stdio_filbuf=''
562 stdio_ptr=''
563 d_index=''
564 d_strchr=''
565 d_strcoll=''
566 d_strctcpy=''
567 d_strerrm=''
568 d_strerror=''
569 d_sysernlst=''
570 d_syserrlst=''
571 d_strftime=''
572 d_strtod=''
573 d_strtol=''
574 d_strtold=''
575 d_strtoll=''
576 d_strtoq=''
577 d_strtoul=''
578 d_strtoull=''
579 d_strtouq=''
580 d_strxfrm=''
581 d_symlink=''
582 d_syscall=''
583 d_sysconf=''
584 d_system=''
585 d_tcgetpgrp=''
586 d_tcsetpgrp=''
587 d_telldirproto=''
588 d_time=''
589 timetype=''
590 clocktype=''
591 d_times=''
592 d_truncate=''
593 d_tzname=''
594 d_u32align=''
595 d_ualarm=''
596 d_umask=''
597 d_semctl_semid_ds=''
598 d_semctl_semun=''
599 d_union_semun=''
600 d_usleep=''
601 d_ustat=''
602 d_vfork=''
603 usevfork=''
604 d_voidsig=''
605 signal_t=''
606 d_volatile=''
607 d_charvspr=''
608 d_vprintf=''
609 d_wait4=''
610 d_waitpid=''
611 d_wcstombs=''
612 d_wctomb=''
613 d_writev=''
614 dlext=''
615 cccdlflags=''
616 ccdlflags=''
617 dlsrc=''
618 ld=''
619 lddlflags=''
620 usedl=''
621 doublesize=''
622 ebcdic=''
623 fflushNULL=''
624 fflushall=''
625 fpossize=''
626 fpostype=''
627 gccosandvers=''
628 gccversion=''
629 gidformat=''
630 gidsign=''
631 gidsize=''
632 gidtype=''
633 groupstype=''
634 h_fcntl=''
635 h_sysfile=''
636 i_arpainet=''
637 db_hashtype=''
638 db_prefixtype=''
639 i_db=''
640 i_dbm=''
641 i_rpcsvcdbm=''
642 d_dirnamlen=''
643 direntrytype=''
644 i_dirent=''
645 i_dld=''
646 i_dlfcn=''
647 i_fcntl=''
648 i_float=''
649 i_gdbm=''
650 d_grpasswd=''
651 i_grp=''
652 i_iconv=''
653 i_ieeefp=''
654 i_inttypes=''
655 i_libutil=''
656 i_limits=''
657 i_locale=''
658 i_machcthr=''
659 i_malloc=''
660 i_math=''
661 i_memory=''
662 i_mntent=''
663 i_ndbm=''
664 i_netdb=''
665 i_neterrno=''
666 i_netinettcp=''
667 i_niin=''
668 i_sysin=''
669 i_poll=''
670 i_prot=''
671 i_pthread=''
672 d_pwage=''
673 d_pwchange=''
674 d_pwclass=''
675 d_pwcomment=''
676 d_pwexpire=''
677 d_pwgecos=''
678 d_pwpasswd=''
679 d_pwquota=''
680 i_pwd=''
681 i_sfio=''
682 i_shadow=''
683 i_socks=''
684 i_stddef=''
685 i_stdlib=''
686 i_string=''
687 strings=''
688 i_sunmath=''
689 i_sysaccess=''
690 i_sysdir=''
691 i_sysfile=''
692 d_voidtty=''
693 i_bsdioctl=''
694 i_sysfilio=''
695 i_sysioctl=''
696 i_syssockio=''
697 i_syslog=''
698 i_sysmman=''
699 i_sysmode=''
700 i_sysmount=''
701 i_sysndir=''
702 i_sysparam=''
703 i_sysresrc=''
704 i_syssecrt=''
705 i_sysselct=''
706 i_sysstat=''
707 i_sysstatfs=''
708 i_sysstatvfs=''
709 i_systimes=''
710 i_systypes=''
711 i_sysuio=''
712 i_sysun=''
713 i_sysutsname=''
714 i_sysvfs=''
715 i_syswait=''
716 i_sgtty=''
717 i_termio=''
718 i_termios=''
719 i_systime=''
720 i_systimek=''
721 i_time=''
722 timeincl=''
723 i_unistd=''
724 i_ustat=''
725 i_utime=''
726 i_values=''
727 i_stdarg=''
728 i_varargs=''
729 i_varhdr=''
730 i_vfork=''
731 inc_version_list=''
732 inc_version_list_init=''
733 installprefix=''
734 installprefixexp=''
735 installstyle=''
736 installusrbinperl=''
737 intsize=''
738 longsize=''
739 shortsize=''
740 issymlink=''
741 libc=''
742 ldlibpthname=''
743 libperl=''
744 shrpenv=''
745 useshrplib=''
746 glibpth=''
747 libpth=''
748 loclibpth=''
749 plibpth=''
750 xlibpth=''
751 ignore_versioned_solibs=''
752 libs=''
753 libsdirs=''
754 libsfiles=''
755 libsfound=''
756 libspath=''
757 lns=''
758 d_PRIEUldbl=''
759 d_PRIFUldbl=''
760 d_PRIGUldbl=''
761 d_PRIeldbl=''
762 d_PRIfldbl=''
763 d_PRIgldbl=''
764 d_SCNfldbl=''
765 sPRIEUldbl=''
766 sPRIFUldbl=''
767 sPRIGUldbl=''
768 sPRIeldbl=''
769 sPRIfldbl=''
770 sPRIgldbl=''
771 sSCNfldbl=''
772 lseeksize=''
773 lseektype=''
774 make_set_make=''
775 d_mymalloc=''
776 freetype=''
777 mallocobj=''
778 mallocsrc=''
779 malloctype=''
780 usemymalloc=''
781 installman1dir=''
782 man1dir=''
783 man1direxp=''
784 man1ext=''
785 installman3dir=''
786 man3dir=''
787 man3direxp=''
788 man3ext=''
789 modetype=''
790 multiarch=''
791 mydomain=''
792 myhostname=''
793 phostname=''
794 c=''
795 n=''
796 d_eofnblk=''
797 eagain=''
798 o_nonblock=''
799 rd_nodata=''
800 need_va_copy=''
801 netdb_hlen_type=''
802 netdb_host_type=''
803 netdb_name_type=''
804 netdb_net_type=''
805 groupcat=''
806 hostcat=''
807 passcat=''
808 orderlib=''
809 ranlib=''
810 d_perl_otherlibdirs=''
811 otherlibdirs=''
812 package=''
813 spackage=''
814 pager=''
815 api_revision=''
816 api_subversion=''
817 api_version=''
818 api_versionstring=''
819 patchlevel=''
820 perl_patchlevel=''
821 revision=''
822 subversion=''
823 version=''
824 perl5=''
825 perladmin=''
826 perlpath=''
827 d_nv_preserves_uv=''
828 d_nv_preserves_uv_bits=''
829 i16size=''
830 i16type=''
831 i32size=''
832 i32type=''
833 i64size=''
834 i64type=''
835 i8size=''
836 i8type=''
837 ivsize=''
838 ivtype=''
839 nvsize=''
840 nvtype=''
841 u16size=''
842 u16type=''
843 u32size=''
844 u32type=''
845 u64size=''
846 u64type=''
847 u8size=''
848 u8type=''
849 uvsize=''
850 uvtype=''
851 ivdformat=''
852 nvEUformat=''
853 nvFUformat=''
854 nvGUformat=''
855 nveformat=''
856 nvfformat=''
857 nvgformat=''
858 uvXUformat=''
859 uvoformat=''
860 uvuformat=''
861 uvxformat=''
862 pidtype=''
863 prefix=''
864 prefixexp=''
865 installprivlib=''
866 privlib=''
867 privlibexp=''
868 prototype=''
869 ptrsize=''
870 d_PRIXU64=''
871 d_PRId64=''
872 d_PRIi64=''
873 d_PRIo64=''
874 d_PRIu64=''
875 d_PRIx64=''
876 sPRIXU64=''
877 sPRId64=''
878 sPRIi64=''
879 sPRIo64=''
880 sPRIu64=''
881 sPRIx64=''
882 d_quad=''
883 quadkind=''
884 quadtype=''
885 uquadtype=''
886 drand01=''
887 randbits=''
888 randfunc=''
889 randseedtype=''
890 seedfunc=''
891 installscript=''
892 scriptdir=''
893 scriptdirexp=''
894 selectminbits=''
895 selecttype=''
896 sh=''
897 sig_count=''
898 sig_name=''
899 sig_name_init=''
900 sig_num=''
901 sig_num_init=''
902 sig_size=''
903 installsitearch=''
904 sitearch=''
905 sitearchexp=''
906 installsitebin=''
907 sitebin=''
908 sitebinexp=''
909 installsitelib=''
910 sitelib=''
911 sitelib_stem=''
912 sitelibexp=''
913 siteprefix=''
914 siteprefixexp=''
915 sizesize=''
916 sizetype=''
917 so=''
918 socksizetype=''
919 sharpbang=''
920 shsharp=''
921 spitshell=''
922 src=''
923 ssizetype=''
924 startperl=''
925 startsh=''
926 stdchar=''
927 d_stdio_stream_array=''
928 stdio_stream_array=''
929 sysman=''
930 trnl=''
931 uidformat=''
932 uidsign=''
933 uidsize=''
934 uidtype=''
935 archname64=''
936 use64bitall=''
937 use64bitint=''
938 ccflags_uselargefiles=''
939 ldflags_uselargefiles=''
940 libswanted_uselargefiles=''
941 uselargefiles=''
942 uselongdouble=''
943 usemorebits=''
944 usemultiplicity=''
945 nm_opt=''
946 nm_so_opt=''
947 runnm=''
948 usenm=''
949 useperlio=''
950 usesocks=''
951 d_oldpthreads=''
952 use5005threads=''
953 useithreads=''
954 usethreads=''
955 incpath=''
956 mips_type=''
957 usrinc=''
958 d_vendorarch=''
959 installvendorarch=''
960 vendorarch=''
961 vendorarchexp=''
962 d_vendorbin=''
963 installvendorbin=''
964 vendorbin=''
965 vendorbinexp=''
966 d_vendorlib=''
967 installvendorlib=''
968 vendorlib=''
969 vendorlib_stem=''
970 vendorlibexp=''
971 usevendorprefix=''
972 vendorprefix=''
973 vendorprefixexp=''
974 versiononly=''
975 defvoidused=''
976 voidflags=''
977 pm_apiversion=''
978 xs_apiversion=''
979 yacc=''
980 yaccflags=''
981 CONFIG=''
982
983 define='define'
984 undef='undef'
985 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
986 rmlist=''
987
988 : We must find out about Eunice early
989 eunicefix=':'
990 if test -f /etc/unixtovms; then
991         eunicefix=/etc/unixtovms
992 fi
993 if test -f /etc/unixtovms.exe; then
994         eunicefix=/etc/unixtovms.exe
995 fi
996
997 i_whoami=''
998 ccname=''
999 ccversion=''
1000 perllibs=''
1001 : set useposix=false in your hint file to disable the POSIX extension.
1002 useposix=true
1003 : set useopcode=false in your hint file to disable the Opcode extension.
1004 useopcode=true
1005 : Trailing extension.  Override this in a hint file, if needed.
1006 _exe=''
1007 : Extra object files, if any, needed on this platform.
1008 archobjs=''
1009 archname=''
1010 : Possible local include directories to search.
1011 : Set locincpth to "" in a hint file to defeat local include searches.
1012 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1013 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1014 :
1015 : no include file wanted by default
1016 inclwanted=''
1017
1018 groupstype=''
1019 : change the next line if compiling for Xenix/286 on Xenix/386
1020 xlibpth='/usr/lib/386 /lib/386'
1021 : Possible local library directories to search.
1022 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1023 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1024
1025 : general looking path for locating libraries
1026 glibpth="/lib /usr/lib $xlibpth"
1027 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1028 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1029 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1030
1031 : Private path used by Configure to find libraries.  Its value
1032 : is prepended to libpth. This variable takes care of special
1033 : machines, like the mips.  Usually, it should be empty.
1034 plibpth=''
1035
1036 : default library list
1037 libswanted=''
1038 : some systems want to use only the non-versioned libso:s
1039 ignore_versioned_solibs=''
1040 archname64=''
1041 ccflags_uselargefiles=''
1042 ldflags_uselargefiles=''
1043 libswanted_uselargefiles=''
1044 : set usemultiplicity on the Configure command line to enable multiplicity.
1045 : set usesocks on the Configure command line to enable socks.
1046 : set usethreads on the Configure command line to enable threads.
1047 : full support for void wanted by default
1048 defvoidused=15
1049
1050 : List of libraries we want.
1051 : If anyone needs -lnet, put it in a hint file.
1052 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1053 libswanted="$libswanted dld ld sun m c cposix posix"
1054 libswanted="$libswanted ndir dir crypt sec"
1055 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1056 : We probably want to search /usr/shlib before most other libraries.
1057 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1058 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1059 glibpth="/usr/shlib $glibpth"
1060 : Do not use vfork unless overridden by a hint file.
1061 usevfork=false
1062
1063 : Find the basic shell for Bourne shell scripts
1064 case "$sh" in
1065 '')
1066         case "$SYSTYPE" in
1067         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1068         *) xxx='/bin/sh';;
1069         esac
1070         if test -f "$xxx"; then
1071                 sh="$xxx"
1072         else
1073                 : Build up a list and do a single loop so we can 'break' out.
1074                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1075                 for xxx in sh bash ksh pdksh ash; do
1076                         for p in $pth; do
1077                                 try="$try ${p}/${xxx}"
1078                         done
1079                 done
1080                 for xxx in $try; do
1081                         if test -f "$xxx"; then
1082                                 sh="$xxx";
1083                                 break
1084                         elif test -f "$xxx.exe"; then
1085                                 sh="$xxx";
1086                                 break
1087                         fi
1088                 done
1089         fi
1090         ;;
1091 esac
1092
1093 case "$sh" in
1094 '')     cat <<EOM >&2
1095 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1096
1097 Usually it's in /bin/sh.  How did you even get this far?
1098 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1099 we'll try to straighten this all out.
1100 EOM
1101         exit 1
1102         ;;
1103 esac
1104
1105 : see if sh knows # comments
1106 if `$sh -c '#' >/dev/null 2>&1`; then
1107         shsharp=true
1108         spitshell=cat
1109         xcat=/bin/cat
1110         test -f $xcat || xcat=/usr/bin/cat
1111         echo "#!$xcat" >try
1112         $eunicefix try
1113         chmod +x try
1114         ./try > today
1115         if test -s today; then
1116                 sharpbang='#!'
1117         else
1118                 echo "#! $xcat" > try
1119                 $eunicefix try
1120                 chmod +x try
1121                 ./try > today
1122                 if test -s today; then
1123                         sharpbang='#! '
1124                 else
1125                         sharpbang=': use '
1126                 fi
1127         fi
1128 else
1129         echo " "
1130         echo "Your $sh doesn't grok # comments--I will strip them later on."
1131         shsharp=false
1132         cd ..
1133         echo "exec grep -v '^[  ]*#'" >spitshell
1134         chmod +x spitshell
1135         $eunicefix spitshell
1136         spitshell=`pwd`/spitshell
1137         cd UU
1138         echo "I presume that if # doesn't work, #! won't work either!"
1139         sharpbang=': use '
1140 fi
1141 rm -f try today
1142
1143 : figure out how to guarantee sh startup
1144 case "$startsh" in
1145 '') startsh=${sharpbang}${sh} ;;
1146 *)
1147 esac
1148 cat >try <<EOSS
1149 $startsh
1150 set abc
1151 test "$?abc" != 1
1152 EOSS
1153
1154 chmod +x try
1155 $eunicefix try
1156 if ./try; then
1157         : echo "Yup, it does."
1158 else
1159         echo "Hmm... '$startsh' does not guarantee sh startup..."
1160         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1161 fi
1162 rm -f try
1163
1164
1165 : Save command line options in file UU/cmdline.opt for later use in
1166 : generating config.sh.
1167 cat > cmdline.opt <<EOSH
1168 # Configure command line arguments.
1169 config_arg0='$0'
1170 config_args='$*'
1171 config_argc=$#
1172 EOSH
1173 argn=1
1174 for arg in "$@"; do
1175         cat >>cmdline.opt <<EOSH
1176 config_arg$argn='$arg'
1177 EOSH
1178         argn=`expr $argn + 1`
1179 done
1180
1181 : produce awk script to parse command line options
1182 cat >options.awk <<'EOF'
1183 BEGIN {
1184         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1185
1186         len = length(optstr);
1187         for (i = 1; i <= len; i++) {
1188                 c = substr(optstr, i, 1);
1189                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1190                 if (a == ":") {
1191                         arg[c] = 1;
1192                         i++;
1193                 }
1194                 opt[c] = 1;
1195         }
1196 }
1197 {
1198         expect = 0;
1199         str = $0;
1200         if (substr(str, 1, 1) != "-") {
1201                 printf("'%s'\n", str);
1202                 next;
1203         }
1204         len = length($0);
1205         for (i = 2; i <= len; i++) {
1206                 c = substr(str, i, 1);
1207                 if (!opt[c]) {
1208                         printf("-%s\n", substr(str, i));
1209                         next;
1210                 }
1211                 printf("-%s\n", c);
1212                 if (arg[c]) {
1213                         if (i < len)
1214                                 printf("'%s'\n", substr(str, i + 1));
1215                         else
1216                                 expect = 1;
1217                         next;
1218                 }
1219         }
1220 }
1221 END {
1222         if (expect)
1223                 print "?";
1224 }
1225 EOF
1226
1227 : process the command line options
1228 set X `for arg in "$@"; do echo "X$arg"; done |
1229         sed -e s/X// | awk -f options.awk`
1230 eval "set $*"
1231 shift
1232 rm -f options.awk
1233
1234 : set up default values
1235 fastread=''
1236 reuseval=false
1237 config_sh=''
1238 alldone=''
1239 error=''
1240 silent=''
1241 extractsh=''
1242 override=''
1243 knowitall=''
1244 rm -f optdef.sh posthint.sh
1245 cat >optdef.sh <<EOS
1246 $startsh
1247 EOS
1248
1249
1250 : option parsing
1251 while test $# -gt 0; do
1252         case "$1" in
1253         -d) shift; fastread=yes;;
1254         -e) shift; alldone=cont;;
1255         -f)
1256                 shift
1257                 cd ..
1258                 if test -r "$1"; then
1259                         config_sh="$1"
1260                 else
1261                         echo "$me: cannot read config file $1." >&2
1262                         error=true
1263                 fi
1264                 cd UU
1265                 shift;;
1266         -h) shift; error=true;;
1267         -r) shift; reuseval=true;;
1268         -s) shift; silent=true; realsilent=true;;
1269         -E) shift; alldone=exit;;
1270         -K) shift; knowitall=true;;
1271         -O) shift; override=true;;
1272         -S) shift; silent=true; extractsh=true;;
1273         -D)
1274                 shift
1275                 case "$1" in
1276                 *=)
1277                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1278                         echo "$me: ignoring -D $1" >&2
1279                         ;;
1280                 *=*) echo "$1" | \
1281                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1282                 *) echo "$1='define'" >> optdef.sh;;
1283                 esac
1284                 shift
1285                 ;;
1286         -U)
1287                 shift
1288                 case "$1" in
1289                 *=) echo "$1" >> optdef.sh;;
1290                 *=*)
1291                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1292                         echo "$me: ignoring -U $1" >&2
1293                         ;;
1294                 *) echo "$1='undef'" >> optdef.sh;;
1295                 esac
1296                 shift
1297                 ;;
1298         -A)
1299             shift
1300             xxx=''
1301             yyy="$1"
1302             zzz=''
1303             uuu=undef
1304             case "$yyy" in
1305             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1306                  case "$zzz" in
1307                  *:*) zzz='' ;;
1308                  *)   xxx=append
1309                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1310                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1311                  esac
1312                  ;;
1313             esac
1314             case "$xxx" in
1315             '')  case "$yyy" in
1316                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1317                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1318                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1319                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1320                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1321                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1322                  esac
1323                  ;;       
1324             esac
1325             case "$xxx" in
1326             append)
1327                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1328             clear)
1329                 echo "$yyy=''"                  >> posthint.sh ;;
1330             define)
1331                 case "$zzz" in
1332                 '') zzz=define ;;
1333                 esac
1334                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1335             eval)
1336                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1337             prepend)
1338                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1339             undef)
1340                 case "$zzz" in
1341                 '') zzz="$uuu" ;;
1342                 esac
1343                 echo "$yyy=$zzz"                >> posthint.sh ;;
1344             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1345             esac
1346             shift
1347             ;;
1348         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1349             exit 0;;
1350         --) break;;
1351         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1352         *) break;;
1353         esac
1354 done
1355
1356 case "$error" in
1357 true)
1358         cat >&2 <<EOM
1359 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1360                  [-U symbol] [-U symbol=] [-A command:symbol...]
1361   -d : use defaults for all answers.
1362   -e : go on without questioning past the production of config.sh.
1363   -f : specify an alternate default configuration file.
1364   -h : print this help message and exit (with an error status).
1365   -r : reuse C symbols value if possible (skips costly nm extraction).
1366   -s : silent mode, only echoes questions and essential information.
1367   -D : define symbol to have some value:
1368          -D symbol         symbol gets the value 'define'
1369          -D symbol=value   symbol gets the value 'value'
1370   -E : stop at the end of questions, after having produced config.sh.
1371   -K : do not use unless you know what you are doing.
1372   -O : let -D and -U override definitions from loaded configuration file.
1373   -S : perform variable substitutions on all .SH files (can mix with -f)
1374   -U : undefine symbol:
1375          -U symbol    symbol gets the value 'undef'
1376          -U symbol=   symbol gets completely empty
1377   -A : manipulate symbol after the platform specific hints have been applied:
1378          -A symbol=value                append " "value to symbol
1379          -A append:symbol=value         append value to symbol
1380          -A define:symbol=value         define symbol to have value
1381          -A clear:symbol                define symbol to be ''
1382          -A define:symbol               define symbol to be 'define'
1383          -A eval:symbol=value           define symbol to be eval of value
1384          -A prepend:symbol=value        prepend value to symbol
1385          -A undef:symbol                define symbol to be 'undef'
1386          -A undef:symbol=               define symbol to be ''
1387   -V : print version number and exit (with a zero status).
1388 EOM
1389         exit 1
1390         ;;
1391 esac
1392
1393 : Sanity checks
1394 case "$fastread$alldone" in
1395 yescont|yesexit) ;;
1396 *)
1397         case "$extractsh" in
1398         true) ;;
1399         *)
1400                 if test ! -t 0; then
1401                         echo "Say 'sh Configure', not 'sh <Configure'"
1402                         exit 1
1403                 fi
1404                 ;;
1405         esac
1406         ;;
1407 esac
1408
1409 exec 4>&1
1410 case "$silent" in
1411 true) exec 1>/dev/null;;
1412 esac
1413
1414 : run the defines and the undefines, if any, but leave the file out there...
1415 touch optdef.sh
1416 . ./optdef.sh
1417 : create the posthint manipulation script and leave the file out there...
1418 touch posthint.sh
1419
1420 : set package name
1421 package=perl5
1422 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1423 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1424 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1425 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1426 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1427 esac
1428
1429 : Some greps do not return status, grrr.
1430 echo "grimblepritz" >grimble
1431 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1432         contains=contains
1433 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1434         contains=grep
1435 else
1436         contains=contains
1437 fi
1438 rm -f grimble
1439 : the following should work in any shell
1440 case "$contains" in
1441 contains*)
1442         echo " "
1443         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1444         cat >contains <<'EOSS'
1445 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1446 EOSS
1447 chmod +x contains
1448 esac
1449
1450 : Find the path to the source tree
1451 case "$src" in
1452 '') case "$0" in
1453     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1454          case "$src" in
1455          /*)    ;;
1456          .)     ;;
1457          *)     src=`cd ../$src && pwd` ;;
1458          esac
1459          ;;
1460     *)   src='.';;
1461     esac;;
1462 esac
1463 case "$src" in
1464 '')     src=/
1465         rsrc=/
1466         ;;
1467 /*) rsrc="$src";;
1468 *) rsrc="../$src";;
1469 esac
1470 if test -f $rsrc/Configure && \
1471         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1472 then
1473    : found it, so we are ok.
1474 else
1475         rsrc=''
1476         for src in . .. ../.. ../../.. ../../../..; do
1477                 if test -f ../$src/Configure && \
1478                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1479                 then
1480                         rsrc=../$src
1481                         break
1482                 fi
1483         done
1484 fi
1485 case "$rsrc" in
1486 '')
1487         cat <<EOM >&4
1488
1489 Sorry, I can't seem to locate the source dir for $package.  Please start
1490 Configure with an explicit path -- i.e. /some/path/Configure.
1491
1492 EOM
1493         exit 1
1494         ;;
1495 ../.)   rsrc='..';;
1496 *)
1497         echo " "
1498         echo "Sources for $package found in \"$src\"." >&4
1499         ;;
1500 esac
1501
1502 : script used to extract .SH files with variable substitutions
1503 cat >extract <<'EOS'
1504 PERL_CONFIG_SH=true
1505 echo "Doing variable substitutions on .SH files..."
1506 if test -f $src/MANIFEST; then
1507         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1508 else
1509         echo "(Looking for .SH files under the source directory.)"
1510         set x `(cd $src; find . -name "*.SH" -print)`
1511 fi
1512 shift
1513 case $# in
1514 0) set x `(cd $src; echo *.SH)`; shift;;
1515 esac
1516 if test ! -f $src/$1; then
1517         shift
1518 fi
1519 mkdir_p='
1520 name=$1;
1521 create="";
1522 while test $name; do
1523         if test ! -d "$name"; then
1524                 create="$name $create";
1525                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1526                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1527         else
1528                 name="";
1529         fi;
1530 done;
1531 for file in $create; do
1532         mkdir $file;
1533 done
1534 '
1535 for file in $*; do
1536         case "$src" in
1537         ".")
1538                 case "$file" in
1539                 */*)
1540                         dir=`expr X$file : 'X\(.*\)/'`
1541                         file=`expr X$file : 'X.*/\(.*\)'`
1542                         (cd $dir && . ./$file)
1543                         ;;
1544                 *)
1545                         . ./$file
1546                         ;;
1547                 esac
1548                 ;;
1549         *)
1550                 case "$file" in
1551                 */*)
1552                         dir=`expr X$file : 'X\(.*\)/'`
1553                         file=`expr X$file : 'X.*/\(.*\)'`
1554                         (set x $dir; shift; eval $mkdir_p)
1555                         sh <$src/$dir/$file
1556                         ;;
1557                 *)
1558                         sh <$src/$file
1559                         ;;
1560                 esac
1561                 ;;
1562         esac
1563 done
1564 if test -f $src/config_h.SH; then
1565         if test ! -f config.h; then
1566         : oops, they left it out of MANIFEST, probably, so do it anyway.
1567         . $src/config_h.SH
1568         fi
1569 fi
1570 EOS
1571
1572 : extract files and exit if asked to do so
1573 case "$extractsh" in
1574 true)
1575         case "$realsilent" in
1576         true) ;;
1577         *) exec 1>&4;;
1578         esac
1579         case "$config_sh" in
1580         '') config_sh='config.sh';;
1581         esac
1582         echo " "
1583         echo "Fetching answers from $config_sh..."
1584         cd ..
1585         . $config_sh
1586         test "$override" && . ./optdef.sh
1587         echo " "
1588         . UU/extract
1589         rm -rf UU
1590         echo "Done."
1591         exit 0
1592         ;;
1593 esac
1594
1595 : Eunice requires " " instead of "", can you believe it
1596 echo " "
1597 : Here we go...
1598 echo "Beginning of configuration questions for $package."
1599
1600 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1601
1602 : first determine how to suppress newline on echo command
1603 echo " "
1604 echo "Checking echo to see how to suppress newlines..."
1605 (echo "hi there\c" ; echo " ") >.echotmp
1606 if $contains c .echotmp >/dev/null 2>&1 ; then
1607         echo "...using -n."
1608         n='-n'
1609         c=''
1610 else
1611         cat <<'EOM'
1612 ...using \c
1613 EOM
1614         n=''
1615         c='\c'
1616 fi
1617 echo $n "The star should be here-->$c"
1618 echo '*'
1619 rm -f .echotmp
1620
1621 : Now test for existence of everything in MANIFEST
1622 echo " "
1623 if test -f $rsrc/MANIFEST; then
1624         echo "First let's make sure your kit is complete.  Checking..." >&4
1625         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1626         rm -f missing
1627         tmppwd=`pwd`
1628         for filelist in x??; do
1629                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1630         done
1631         if test -s missing; then
1632                 cat missing >&4
1633                 cat >&4 <<'EOM'
1634
1635 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1636
1637 You have the option of continuing the configuration process, despite the
1638 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1639 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1640 and contact the author (perlbug@perl.org).
1641
1642 EOM
1643                 echo $n "Continue? [n] $c" >&4
1644                 read ans
1645                 case "$ans" in
1646                 y*)
1647                         echo "Continuing..." >&4
1648                         rm -f missing
1649                         ;;
1650                 *)
1651                         echo "ABORTING..." >&4
1652                         kill $$
1653                         ;;
1654                 esac
1655         else
1656                 echo "Looks good..."
1657         fi
1658 else
1659         echo "There is no MANIFEST file.  I hope your kit is complete !"
1660 fi
1661 rm -f missing x??
1662
1663 echo " "
1664 : Find the appropriate value for a newline for tr
1665 if test -n "$DJGPP"; then
1666        trnl='\012'
1667 fi
1668 if test X"$trnl" = X; then
1669         case "`echo foo|tr '\n' x 2>/dev/null`" in
1670         foox) trnl='\n' ;;
1671         esac
1672 fi
1673 if test X"$trnl" = X; then
1674         case "`echo foo|tr '\012' x 2>/dev/null`" in
1675         foox) trnl='\012' ;;
1676         esac
1677 fi
1678 if test X"$trnl" = X; then
1679         cat <<EOM >&2
1680
1681 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1682
1683 EOM
1684         exit 1
1685 fi
1686
1687 : compute the number of columns on the terminal for proper question formatting
1688 case "$COLUMNS" in
1689 '') COLUMNS='80';;
1690 esac
1691
1692 : set up the echo used in my read
1693 myecho="case \"\$xxxm\" in
1694 '') echo $n \"\$rp $c\" >&4;;
1695 *) case \"\$rp\" in
1696         '') echo $n \"[\$xxxm] $c\";;
1697         *)
1698                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1699                         echo \"\$rp\" >&4
1700                         echo $n \"[\$xxxm] $c\" >&4
1701                 else
1702                         echo $n \"\$rp [\$xxxm] $c\" >&4
1703                 fi
1704                 ;;
1705         esac;;
1706 esac"
1707
1708 : now set up to do reads with possible shell escape and default assignment
1709 cat <<EOSC >myread
1710 $startsh
1711 xxxm=\$dflt
1712 $myecho
1713 ans='!'
1714 case "\$fastread" in
1715 yes) case "\$dflt" in
1716         '') ;;
1717         *) ans='';
1718                 case "\$silent-\$rp" in
1719                 true-) ;;
1720                 *) echo " " >&4;;
1721                 esac;;
1722         esac;;
1723 *) case "\$silent" in
1724         true) case "\$rp" in
1725                 '') ans='';;
1726                 esac;;
1727         esac;;
1728 esac
1729 while expr "X\$ans" : "X!" >/dev/null; do
1730         read answ
1731         set x \$xxxm
1732         shift
1733         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1734         case  "\$answ" in
1735         "!")
1736                 sh 1>&4
1737                 echo " "
1738                 $myecho
1739                 ;;
1740         !*)
1741                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1742                 shift
1743                 sh 1>&4 -c "\$*"
1744                 echo " "
1745                 $myecho
1746                 ;;
1747         "\$ans")
1748                 case "\$ans" in
1749                 \\&*)
1750                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1751                         shift
1752                         case "\$1" in
1753                         -d)
1754                                 fastread=yes
1755                                 echo "(OK, I'll run with -d after this question.)" >&4
1756                                 ;;
1757                         -*)
1758                                 echo "*** Sorry, \$1 not supported yet." >&4
1759                                 ;;
1760                         esac
1761                         $myecho
1762                         ans=!
1763                         ;;
1764                 esac;;
1765         *)
1766                 case "\$aok" in
1767                 y)
1768                         echo "*** Substitution done -- please confirm."
1769                         xxxm="\$ans"
1770                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1771                         xxxm="\$ans"
1772                         ans=!
1773                         ;;
1774                 *)
1775                         echo "*** Error -- try again."
1776                         ans=!
1777                         ;;
1778                 esac
1779                 $myecho
1780                 ;;
1781         esac
1782         case "\$ans\$xxxm\$nostick" in
1783         '')
1784                 ans=!
1785                 $myecho
1786                 ;;
1787         esac
1788 done
1789 case "\$ans" in
1790 '') ans="\$xxxm";;
1791 esac
1792 EOSC
1793
1794 : create .config dir to save info across Configure sessions
1795 test -d ../.config || mkdir ../.config
1796 cat >../.config/README <<EOF
1797 This directory created by Configure to save information that should
1798 persist across sessions for $package.
1799
1800 You may safely delete it if you wish.
1801 EOF
1802
1803 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1804 case "$usedevel" in
1805 $define|true|[yY]*) ;;
1806 *) case "$xversion" in
1807    *[13579])
1808         cat >&4 <<EOH
1809 *** WHOA THERE!!! ***
1810
1811     This is an UNSTABLE DEVELOPMENT release.
1812     The version of this $package distribution is $xversion, that is, odd,
1813     (as opposed to even) and that signifies a development release.
1814     If you want a maintenance release, you want an even-numbered version.
1815
1816     Do ***NOT*** install this into production use.
1817     Data corruption and crashes are possible.
1818
1819     It is most seriously suggested that you do not continue any further
1820     unless you want to help in developing and debugging Perl.
1821
1822     If you *still* want to build perl, you can answer 'y' now,
1823     or pass -Dusedevel to Configure.
1824
1825 EOH
1826         rp='Do you really want to continue?'
1827         dflt='n'
1828         . ./myread
1829         case "$ans" in
1830         [yY]) echo >&4 "Okay, continuing."
1831               usedevel="$define" ;;
1832         *) echo >&4 "Okay, bye."
1833            exit 1
1834            ;;
1835         esac
1836         ;;
1837     esac
1838     ;;
1839 esac
1840 case "$usedevel" in
1841 $define|true|[yY]*)
1842         case "$versiononly" in
1843         '') versiononly="$define" ;;
1844         esac
1845         case "$installusrbinperl" in
1846         '') installusrbinperl="$undef" ;;
1847         esac
1848         ;;
1849 esac
1850
1851 : general instructions
1852 needman=true
1853 firsttime=true
1854 user=`(logname) 2>/dev/null`
1855 case "$user" in
1856 '') user=`whoami 2>&1`;;
1857 esac
1858 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1859         firsttime=false
1860         echo " "
1861         rp='Would you like to see the instructions?'
1862         dflt=n
1863         . ./myread
1864         case "$ans" in
1865         [yY]*) ;;
1866         *) needman=false;;
1867         esac
1868 fi
1869 if $needman; then
1870         cat <<EOH
1871
1872 This installation shell script will examine your system and ask you questions
1873 to determine how the perl5 package should be installed. If you get
1874 stuck on a question, you may use a ! shell escape to start a subshell or
1875 execute a command.  Many of the questions will have default answers in square
1876 brackets; typing carriage return will give you the default.
1877
1878 On some of the questions which ask for file or directory names you are allowed
1879 to use the ~name construct to specify the login directory belonging to "name",
1880 even if you don't have a shell which knows about that.  Questions where this is
1881 allowed will be marked "(~name ok)".
1882
1883 EOH
1884         rp=''
1885         dflt='Type carriage return to continue'
1886         . ./myread
1887         cat <<'EOH'
1888
1889 The prompter used in this script allows you to use shell variables and
1890 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1891 in the default answer, as if the default line was a set of arguments given to a
1892 script shell.  This means you may also use $* to repeat the whole default line,
1893 so you do not have to re-type everything to add something to the default.
1894
1895 Everytime there is a substitution, you will have to confirm.  If there is an
1896 error (e.g. an unmatched backtick), the default answer will remain unchanged
1897 and you will be prompted again.
1898
1899 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1900 the questions and use the computed defaults (or the previous answers if there
1901 was already a config.sh file). Type 'Configure -h' for a list of options.
1902 You may also start interactively and then answer '& -d' at any prompt to turn
1903 on the non-interactive behaviour for the remainder of the execution.
1904
1905 EOH
1906         . ./myread
1907         cat <<EOH
1908
1909 Much effort has been expended to ensure that this shell script will run on any
1910 Unix system.  If despite that it blows up on yours, your best bet is to edit
1911 Configure and run it again.  If you can't run Configure for some reason,
1912 you'll have to generate a config.sh file by hand.  Whatever problems you
1913 have, let me (perlbug@perl.org) know how I blew it.
1914
1915 This installation script affects things in two ways:
1916
1917 1) it may do direct variable substitutions on some of the files included
1918    in this kit.
1919 2) it builds a config.h file for inclusion in C programs.  You may edit
1920    any of these files as the need arises after running this script.
1921
1922 If you make a mistake on a question, there is no easy way to back up to it
1923 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1924 files.  Configure will offer to let you do this before it runs the SH files.
1925
1926 EOH
1927         dflt='Type carriage return to continue'
1928         . ./myread
1929         case "$firsttime" in
1930         true) echo $user >>../.config/instruct;;
1931         esac
1932 fi
1933
1934 : find out where common programs are
1935 echo " "
1936 echo "Locating common programs..." >&4
1937 cat <<EOSC >loc
1938 $startsh
1939 case \$# in
1940 0) exit 1;;
1941 esac
1942 thing=\$1
1943 shift
1944 dflt=\$1
1945 shift
1946 for dir in \$*; do
1947         case "\$thing" in
1948         .)
1949         if test -d \$dir/\$thing; then
1950                 echo \$dir
1951                 exit 0
1952         fi
1953         ;;
1954         *)
1955         for thisthing in \$dir/\$thing; do
1956                 : just loop through to pick last item
1957         done
1958         if test -f \$thisthing; then
1959                 echo \$thisthing
1960                 exit 0
1961         elif test -f \$dir/\$thing.exe; then
1962                 if test -n "$DJGPP"; then
1963                         echo \$dir/\$thing.exe
1964                 else
1965                         : on Eunice apparently
1966                         echo \$dir/\$thing
1967                 fi
1968                 exit 0
1969         fi
1970         ;;
1971         esac
1972 done
1973 echo \$dflt
1974 exit 1
1975 EOSC
1976 chmod +x loc
1977 $eunicefix loc
1978 loclist="
1979 awk
1980 cat
1981 comm
1982 cp
1983 echo
1984 expr
1985 grep
1986 ls
1987 make
1988 mkdir
1989 rm
1990 sed
1991 sort
1992 touch
1993 tr
1994 uniq
1995 "
1996 trylist="
1997 Mcc
1998 ar
1999 bison
2000 byacc
2001 cpp
2002 csh
2003 date
2004 egrep
2005 gzip
2006 less
2007 ln
2008 more
2009 nm
2010 nroff
2011 pg
2012 test
2013 uname
2014 zip
2015 "
2016 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2017 pth="$pth /lib /usr/lib"
2018 for file in $loclist; do
2019         eval xxx=\$$file
2020         case "$xxx" in
2021         /*|?:[\\/]*)
2022                 if test -f "$xxx"; then
2023                         : ok
2024                 else
2025                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2026                         xxx=`./loc $file $file $pth`
2027                 fi
2028                 ;;
2029         '') xxx=`./loc $file $file $pth`;;
2030         *) xxx=`./loc $xxx $xxx $pth`;;
2031         esac
2032         eval $file=$xxx
2033         eval _$file=$xxx
2034         case "$xxx" in
2035         /*)
2036                 echo $file is in $xxx.
2037                 ;;
2038         ?:[\\/]*)
2039                 echo $file is in $xxx.
2040                 ;;
2041         *)
2042                 echo "I don't know where '$file' is, and my life depends on it." >&4
2043                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2044                 exit 1
2045                 ;;
2046         esac
2047 done
2048 echo " "
2049 echo "Don't worry if any of the following aren't found..."
2050 say=offhand
2051 for file in $trylist; do
2052         eval xxx=\$$file
2053         case "$xxx" in
2054         /*|?:[\\/]*)
2055                 if test -f "$xxx"; then
2056                         : ok
2057                 else
2058                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2059                         xxx=`./loc $file $file $pth`
2060                 fi
2061                 ;;
2062         '') xxx=`./loc $file $file $pth`;;
2063         *) xxx=`./loc $xxx $xxx $pth`;;
2064         esac
2065         eval $file=$xxx
2066         eval _$file=$xxx
2067         case "$xxx" in
2068         /*)
2069                 echo $file is in $xxx.
2070                 ;;
2071         ?:[\\/]*)
2072                 echo $file is in $xxx.
2073                 ;;
2074         *)
2075                 echo "I don't see $file out there, $say."
2076                 say=either
2077                 ;;
2078         esac
2079 done
2080 case "$egrep" in
2081 egrep)
2082         echo "Substituting grep for egrep."
2083         egrep=$grep
2084         ;;
2085 esac
2086 case "$ln" in
2087 ln)
2088         echo "Substituting cp for ln."
2089         ln=$cp
2090         ;;
2091 esac
2092 case "$test" in
2093 test)
2094         echo "Hopefully test is built into your sh."
2095         ;;
2096 *)
2097         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2098                 echo "Using the test built into your sh."
2099                 test=test
2100                 _test=test
2101         fi
2102         ;;
2103 esac
2104 case "$echo" in
2105 echo)
2106         echo "Hopefully echo is built into your sh."
2107         ;;
2108 '') ;;
2109 *)
2110         echo " "
2111 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2112         $echo $n "hi there$c" >foo1
2113         echo $n "hi there$c" >foo2
2114         if cmp foo1 foo2 >/dev/null 2>&1; then
2115                 echo "They are compatible.  In fact, they may be identical."
2116         else
2117                 case "$n" in
2118                 '-n') n='' c='\c';;
2119                 *) n='-n' c='';;
2120                 esac
2121                 cat <<FOO
2122 They are not compatible!  You are probably running ksh on a non-USG system.
2123 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2124 have echo built in and we may have to run some Bourne shell scripts.  That
2125 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2126
2127 FOO
2128                 $echo $n "The star should be here-->$c"
2129                 $echo "*"
2130         fi
2131         $rm -f foo1 foo2
2132         ;;
2133 esac
2134
2135 cat <<EOS >checkcc
2136 $startsh
2137 EOS
2138 cat <<'EOSC' >>checkcc
2139 case "$cc" in
2140 '') ;;
2141 *)  $rm -f try try.*
2142     $cat >try.c <<EOM
2143 int main(int argc, char *argv[]) {
2144   return 0;
2145 }
2146 EOM
2147     if $cc -o try $ccflags $ldflags try.c; then
2148        :
2149     else
2150         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2151         despair=yes
2152         trygcc=yes
2153         case "$cc" in
2154         *gcc*) trygcc=no ;;
2155         esac
2156         case "`$cc -v -c try.c 2>&1`" in
2157         *gcc*) trygcc=no ;;
2158         esac
2159         if $test X"$trygcc" = Xyes; then
2160             if gcc -o try -c try.c; then
2161                 echo " "
2162                 echo "You seem to have a working gcc, though." >&4
2163                 rp="Would you like to use it?"
2164                 dflt=y
2165                 if $test -f myread; then
2166                     . ./myread
2167                 else
2168                     if $test -f UU/myread; then
2169                         . ./UU/myread
2170                     else
2171                         echo "Cannot find myread, sorry.  Aborting." >&2
2172                         exit 1
2173                     fi
2174                 fi  
2175                 case "$ans" in
2176                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2177                 esac
2178             fi
2179         fi
2180         if $test X"$despair" = Xyes; then
2181             $cat >&4 <<EOM
2182 You need to find a working C compiler.
2183 Either (purchase and) install the C compiler supplied by your OS vendor,
2184 or for a free C compiler try http://gcc.gnu.org/
2185 I cannot continue any further, aborting.
2186 EOM
2187             exit 1
2188         fi
2189     fi
2190     $rm -f try try.*
2191     ;;
2192 esac
2193 EOSC
2194
2195 : determine whether symbolic links are supported
2196 echo " "
2197 $touch blurfl
2198 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2199         echo "Symbolic links are supported." >&4
2200         lns="$ln -s"
2201 else
2202         echo "Symbolic links are NOT supported." >&4
2203         lns="$ln"
2204 fi
2205 $rm -f blurfl sym
2206
2207 : determine whether symbolic links are supported
2208 echo " "
2209 case "$lns" in
2210 *"ln -s")
2211         echo "Checking how to test for symbolic links..." >&4
2212         $lns blurfl sym
2213         if $test "X$issymlink" = X; then
2214                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2215                 if test $? = 0; then
2216                         issymlink="test -h"
2217                 fi              
2218         fi
2219         if $test "X$issymlink" = X; then
2220                 if  $test -h >/dev/null 2>&1; then
2221                         issymlink="$test -h"
2222                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2223                 fi              
2224         fi
2225         if $test "X$issymlink" = X; then
2226                 if $test -L sym 2>/dev/null; then
2227                         issymlink="$test -L"
2228                 fi
2229         fi
2230         if $test "X$issymlink" != X; then
2231                 echo "You can test for symbolic links with '$issymlink'." >&4
2232         else
2233                 echo "I do not know how you can test for symbolic links." >&4
2234         fi
2235         $rm -f blurfl sym
2236         ;;
2237 *)      echo "No symbolic links, so not testing for their testing..." >&4
2238         ;;
2239 esac
2240 echo " "
2241
2242
2243 case "$mksymlinks" in
2244 $define|true|[yY]*)
2245         case "$src" in
2246         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2247                 exit 1
2248                 ;;
2249         *)      case "$lns:$issymlink" in
2250                 *"ln -s:"*"test -"?)
2251                         echo "Creating the symbolic links..." >&4
2252                         echo "(First creating the subdirectories...)" >&4
2253                         cd ..
2254                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2255                                 read directory
2256                                 test -z "$directory" && break
2257                                 mkdir -p $directory
2258                         done
2259                         # Sanity check 1.
2260                         if test ! -d t/base; then
2261                                 echo "Failed to create the subdirectories.  Aborting." >&4
2262                                 exit 1
2263                         fi
2264                         echo "(Then creating the symlinks...)" >&4
2265                         awk '{print $1}' $src/MANIFEST | while true; do
2266                                 read filename
2267                                 test -z "$filename" && break
2268                                 if test -f $filename; then
2269                                         if $issymlink $filename; then
2270                                                 rm -f $filename
2271                                         fi
2272                                 fi
2273                                 if test -f $filename; then
2274                                         echo "$filename already exists, not symlinking."
2275                                 else
2276                                         ln -s $src/$filename $filename
2277                                 fi
2278                         done
2279                         # Sanity check 2.
2280                         if test ! -f t/base/commonsense.t; then
2281                                 echo "Failed to create the symlinks.  Aborting." >&4
2282                                 exit 1
2283                         fi
2284                         cd UU
2285                         ;;
2286                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2287                         ;;
2288                 esac
2289                 ;;
2290         esac
2291         ;;
2292 esac
2293
2294 : see whether [:lower:] and [:upper:] are supported character classes
2295 echo " "
2296 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2297 ABYZ)
2298         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2299         up='[:upper:]'
2300         low='[:lower:]'
2301         ;;
2302 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2303         # (0xc9 and 0xd1), therefore that is a nice testing point.
2304         if test "X$up" = X -o "X$low" = X; then
2305             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2306             ij) up='[A-Z]'
2307                 low='[a-z]'
2308                 ;;
2309             esac
2310         fi
2311         if test "X$up" = X -o "X$low" = X; then
2312             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2313             ij) up='A-Z'
2314                 low='a-z'
2315                 ;;
2316             esac
2317         fi
2318         if test "X$up" = X -o "X$low" = X; then
2319             case "`echo IJ | od -x 2>/dev/null`" in
2320             *C9D1*|*c9d1*)
2321                 echo "Hey, this might be EBCDIC." >&4
2322                 if test "X$up" = X -o "X$low" = X; then
2323                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2324                     ij) up='[A-IJ-RS-Z]'
2325                         low='[a-ij-rs-z]'
2326                         ;;
2327                     esac
2328                 fi
2329                 if test "X$up" = X -o "X$low" = X; then
2330                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2331                     ij) up='A-IJ-RS-Z'
2332                         low='a-ij-rs-z'
2333                         ;;
2334                     esac
2335                 fi
2336                 ;;
2337             esac
2338         fi
2339 esac
2340 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2341 ij)
2342     echo "Using $up and $low to convert case." >&4
2343     ;;
2344 *)
2345     echo "I don't know how to translate letters from upper to lower case." >&4
2346     echo "Your tr is not acting any way I know of." >&4
2347     exit 1
2348     ;;
2349 esac
2350 : set up the translation script tr, must be called with ./tr of course
2351 cat >tr <<EOSC
2352 $startsh
2353 case "\$1\$2" in
2354 '[A-Z][a-z]') exec $tr '$up' '$low';;
2355 '[a-z][A-Z]') exec $tr '$low' '$up';;
2356 esac
2357 exec $tr "\$@"
2358 EOSC
2359 chmod +x tr
2360 $eunicefix tr
2361
2362 : Try to determine whether config.sh was made on this system
2363 case "$config_sh" in
2364 '')
2365 myuname=`$uname -a 2>/dev/null`
2366 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2367 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2368 # because the A-Z/a-z are not consecutive.
2369 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2370         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2371 newmyuname="$myuname"
2372 dflt=n
2373 case "$knowitall" in
2374 '')
2375         if test -f ../config.sh; then
2376                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2377                         eval "`grep myuname= ../config.sh`"
2378                 fi
2379                 if test "X$myuname" = "X$newmyuname"; then
2380                         dflt=y
2381                 fi
2382         fi
2383         ;;
2384 *) dflt=y;;
2385 esac
2386
2387 : Get old answers from old config file if Configure was run on the
2388 : same system, otherwise use the hints.
2389 hint=default
2390 cd ..
2391 if test -f config.sh; then
2392         echo " "
2393         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2394         . UU/myread
2395         case "$ans" in
2396         n*|N*) echo "OK, I'll ignore it."
2397                 mv config.sh config.sh.old
2398                 myuname="$newmyuname"
2399                 ;;
2400         *)  echo "Fetching default answers from your old config.sh file..." >&4
2401                 tmp_n="$n"
2402                 tmp_c="$c"
2403                 tmp_sh="$sh"
2404                 . ./config.sh
2405                 cp config.sh UU
2406                 n="$tmp_n"
2407                 c="$tmp_c"
2408                 : Older versions did not always set $sh.  Catch re-use of such
2409                 : an old config.sh.
2410                 case "$sh" in
2411                 '') sh="$tmp_sh" ;;
2412                 esac
2413                 hint=previous
2414                 ;;
2415         esac
2416 fi
2417 . ./UU/checkcc
2418 if test ! -f config.sh; then
2419         $cat <<EOM
2420
2421 First time through, eh?  I have some defaults handy for some systems
2422 that need some extra help getting the Configure answers right:
2423
2424 EOM
2425         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2426         dflt=''
2427         : Half the following guesses are probably wrong... If you have better
2428         : tests or hints, please send them to perlbug@perl.org
2429         : The metaconfig authors would also appreciate a copy...
2430         $test -f /irix && osname=irix
2431         $test -f /xenix && osname=sco_xenix
2432         $test -f /dynix && osname=dynix
2433         $test -f /dnix && osname=dnix
2434         $test -f /lynx.os && osname=lynxos
2435         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2436         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2437         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2438         $test -f /bin/mips && /bin/mips && osname=mips
2439         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2440                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2441         $test -d /usr/apollo/bin && osname=apollo
2442         $test -f /etc/saf/_sactab && osname=svr4
2443         $test -d /usr/include/minix && osname=minix
2444         if $test -d /MachTen -o -d /MachTen_Folder; then
2445                 osname=machten
2446                 if $test -x /sbin/version; then
2447                         osvers=`/sbin/version | $awk '{print $2}' |
2448                         $sed -e 's/[A-Za-z]$//'`
2449                 elif $test -x /usr/etc/version; then
2450                         osvers=`/usr/etc/version | $awk '{print $2}' |
2451                         $sed -e 's/[A-Za-z]$//'`
2452                 else
2453                         osvers="$2.$3"
2454                 fi
2455         fi
2456
2457         $test -f /sys/posix.dll &&
2458                 $test -f /usr/bin/what &&
2459                 set X `/usr/bin/what /sys/posix.dll` &&
2460                 $test "$3" = UWIN &&
2461                 osname=uwin &&
2462                 osvers="$5"
2463
2464         if $test -f $uname; then
2465                 set X $myuname
2466                 shift
2467
2468                 case "$5" in
2469                 fps*) osname=fps ;;
2470                 mips*)
2471                         case "$4" in
2472                         umips) osname=umips ;;
2473                         *) osname=mips ;;
2474                         esac;;
2475                 [23]100) osname=mips ;;
2476                 next*) osname=next ;;
2477                 i386*)
2478                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2479                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2480                                 osname='sco'
2481                                 osvers=$tmp
2482                         elif $test -f /etc/kconfig; then
2483                                 osname=isc
2484                                 if test "$lns" = "$ln -s"; then
2485                                         osvers=4
2486                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2487                                         osvers=3
2488                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2489                                         osvers=2
2490                                 fi
2491                         fi
2492                         tmp=''
2493                         ;;
2494                 pc*)
2495                         if test -n "$DJGPP"; then
2496                                 osname=dos
2497                                 osvers=djgpp
2498                         fi
2499                         ;;
2500                 esac
2501
2502                 case "$1" in
2503                 aix) osname=aix
2504                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2505                         case "$tmp" in
2506                         'not found') osvers="$4"."$3" ;;
2507                         '<3240'|'<>3240') osvers=3.2.0 ;;
2508                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2509                         '=3250'|'>3250') osvers=3.2.5 ;;
2510                         *) osvers=$tmp;;
2511                         esac
2512                         ;;
2513                 bsd386) osname=bsd386
2514                         osvers=`$uname -r`
2515                         ;;
2516                 cygwin*) osname=cygwin
2517                         osvers="$3"
2518                         ;;
2519                 *dc.osx) osname=dcosx
2520                         osvers="$3"
2521                         ;;
2522                 dnix) osname=dnix
2523                         osvers="$3"
2524                         ;;
2525                 domainos) osname=apollo
2526                         osvers="$3"
2527                         ;;
2528                 dgux) osname=dgux 
2529                         osvers="$3"
2530                         ;;
2531                 dynixptx*) osname=dynixptx
2532                         osvers=`echo "$4"|sed 's/^v//'`
2533                         ;;
2534                 freebsd) osname=freebsd 
2535                         osvers="$3" ;;
2536                 genix) osname=genix ;;
2537                 hp*) osname=hpux 
2538                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2539                         ;;
2540                 irix*) osname=irix
2541                         case "$3" in
2542                         4*) osvers=4 ;;
2543                         5*) osvers=5 ;;
2544                         *)      osvers="$3" ;;
2545                         esac
2546                         ;;
2547                 linux) osname=linux
2548                         case "$3" in
2549                         *)      osvers="$3" ;;
2550                         esac
2551                         ;;
2552                 MiNT) osname=mint
2553                         ;;
2554                 netbsd*) osname=netbsd
2555                         osvers="$3"
2556                         ;;
2557                 news-os) osvers="$3"
2558                         case "$3" in
2559                         4*) osname=newsos4 ;;
2560                         *) osname=newsos ;;
2561                         esac
2562                         ;;
2563                 next*) osname=next ;;
2564                 nonstop-ux) osname=nonstopux ;;
2565                 POSIX-BC | posix-bc ) osname=posix-bc
2566                         osvers="$3"
2567                         ;;
2568                 powerux | power_ux | powermax_os | powermaxos | \
2569                 powerunix | power_unix) osname=powerux
2570                         osvers="$3"
2571                         ;;
2572                 qnx) osname=qnx
2573                         osvers="$4"
2574                         ;;
2575                 solaris) osname=solaris
2576                         case "$3" in
2577                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2578                         *)      osvers="$3" ;;
2579                         esac
2580                         ;;
2581                 sunos) osname=sunos
2582                         case "$3" in
2583                         5*) osname=solaris
2584                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2585                         *)      osvers="$3" ;;
2586                         esac
2587                         ;;
2588                 titanos) osname=titanos
2589                         case "$3" in
2590                         1*) osvers=1 ;;
2591                         2*) osvers=2 ;;
2592                         3*) osvers=3 ;;
2593                         4*) osvers=4 ;;
2594                         *)      osvers="$3" ;;
2595                         esac
2596                         ;;
2597                 ultrix) osname=ultrix
2598                         osvers="$3"
2599                         ;;
2600                 osf1|mls+)      case "$5" in
2601                                 alpha)
2602                                         osname=dec_osf
2603                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2604                                         case "$osvers" in
2605                                         [1-9].[0-9]*) ;;
2606                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2607                                         esac
2608                                         ;;
2609                         hp*)    osname=hp_osf1  ;;
2610                         mips)   osname=mips_osf1 ;;
2611                         esac
2612                         ;;
2613                 unixware) osname=svr5
2614                         osvers="$4"
2615                         ;;
2616                 uts) osname=uts
2617                         osvers="$3"
2618                         ;;
2619                 $2) case "$osname" in
2620                         *isc*) ;;
2621                         *freebsd*) ;;
2622                         svr*)
2623                                 : svr4.x or possibly later
2624                                 case "svr$3" in 
2625                                 ${osname}*)
2626                                         osname=svr$3
2627                                         osvers=$4
2628                                         ;;
2629                                 esac
2630                                 case "$osname" in
2631                                 svr4.0)
2632                                         : Check for ESIX
2633                                         if test -f /stand/boot ; then
2634                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2635                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2636                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2637                                                         if test -n "$isesix"; then
2638                                                                 osname=esix4
2639                                                         fi
2640                                                 fi
2641                                         fi
2642                                         ;;
2643                                 esac
2644                                 ;;
2645                         *)      if test -f /etc/systemid; then
2646                                         osname=sco
2647                                         set `echo $3 | $sed 's/\./ /g'` $4
2648                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2649                                                 osvers=$1.$2.$3
2650                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2651                                                 osvers=$1.$2
2652                                         elif $test -f $src/hints/sco_$1.sh; then
2653                                                 osvers=$1
2654                                         fi
2655                                 else
2656                                         case "$osname" in
2657                                         '') : Still unknown.  Probably a generic Sys V.
2658                                                 osname="sysv"
2659                                                 osvers="$3"
2660                                                 ;;
2661                                         esac
2662                                 fi
2663                                 ;;
2664                         esac
2665                         ;;
2666                 *)      case "$osname" in
2667                         '') : Still unknown.  Probably a generic BSD.
2668                                 osname="$1"
2669                                 osvers="$3"
2670                                 ;;
2671                         esac
2672                         ;;
2673                 esac
2674         else
2675                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2676                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2677                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2678                                 osname=news_os
2679                         fi
2680                         $rm -f UU/kernel.what
2681                 elif test -d c:/.; then
2682                         set X $myuname
2683                         osname=os2
2684                         osvers="$5"
2685                 fi
2686         fi
2687         
2688         : Now look for a hint file osname_osvers, unless one has been
2689         : specified already.
2690         case "$hintfile" in
2691         ''|' ')
2692                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2693                 : Also try without trailing minor version numbers.
2694                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2695                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2696                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2697                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2698                 case "$file" in
2699                 '') dflt=none ;;
2700                 *)  case "$osvers" in
2701                         '') dflt=$file
2702                                 ;;
2703                         *)  if $test -f $src/hints/$file.sh ; then
2704                                         dflt=$file
2705                                 elif $test -f $src/hints/$xfile.sh ; then
2706                                         dflt=$xfile
2707                                 elif $test -f $src/hints/$xxfile.sh ; then
2708                                         dflt=$xxfile
2709                                 elif $test -f $src/hints/$xxxfile.sh ; then
2710                                         dflt=$xxxfile
2711                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2712                                         dflt=$xxxxfile
2713                                 elif $test -f "$src/hints/${osname}.sh" ; then
2714                                         dflt="${osname}"
2715                                 else
2716                                         dflt=none
2717                                 fi
2718                                 ;;
2719                         esac
2720                         ;;
2721                 esac
2722                 if $test -f Policy.sh ; then
2723                         case "$dflt" in
2724                         *Policy*) ;;
2725                         none) dflt="Policy" ;;
2726                         *) dflt="Policy $dflt" ;;
2727                         esac
2728                 fi
2729                 ;;
2730         *)
2731                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2732                 ;;
2733         esac
2734
2735         if $test -f Policy.sh ; then
2736                 $cat <<EOM
2737
2738 There's also a Policy hint file available, which should make the
2739 site-specific (policy) questions easier to answer.
2740 EOM
2741
2742         fi
2743
2744         $cat <<EOM
2745
2746 You may give one or more space-separated answers, or "none" if appropriate.
2747 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2748 is a good thing.  DO NOT give a wrong version or a wrong OS.
2749
2750 EOM
2751
2752         rp="Which of these apply, if any?"
2753         . UU/myread
2754         tans=$ans
2755         for file in $tans; do
2756                 if $test X$file = XPolicy -a -f Policy.sh; then
2757                         . Policy.sh
2758                         $cat Policy.sh >> UU/config.sh
2759                 elif $test -f $src/hints/$file.sh; then
2760                         . $src/hints/$file.sh
2761                         $cat $src/hints/$file.sh >> UU/config.sh
2762                 elif $test X$tans = X -o X$tans = Xnone ; then
2763                         : nothing
2764                 else
2765                         : Give one chance to correct a possible typo.
2766                         echo "$file.sh does not exist"
2767                         dflt=$file
2768                         rp="hint to use instead?"
2769                         . UU/myread
2770                         for file in $ans; do
2771                                 if $test -f "$src/hints/$file.sh"; then
2772                                         . $src/hints/$file.sh
2773                                         $cat $src/hints/$file.sh >> UU/config.sh
2774                                 elif $test X$ans = X -o X$ans = Xnone ; then
2775                                         : nothing
2776                                 else
2777                                         echo "$file.sh does not exist -- ignored."
2778                                 fi
2779                         done
2780                 fi
2781         done
2782
2783         hint=recommended
2784         : Remember our hint file for later.
2785         if $test -f "$src/hints/$file.sh" ; then
2786                 hintfile="$file"
2787         else
2788                 hintfile=''
2789         fi
2790 fi
2791 cd UU
2792 ;;
2793 *)
2794         echo " "
2795         echo "Fetching default answers from $config_sh..." >&4
2796         tmp_n="$n"
2797         tmp_c="$c"
2798         cd ..
2799         cp $config_sh config.sh 2>/dev/null
2800         chmod +w config.sh
2801         . ./config.sh
2802         cd UU
2803         cp ../config.sh .
2804         n="$tmp_n"
2805         c="$tmp_c"
2806         hint=previous
2807         ;;
2808 esac
2809 test "$override" && . ./optdef.sh
2810
2811 : Restore computed paths
2812 for file in $loclist $trylist; do
2813         eval $file="\$_$file"
2814 done
2815
2816 cat << EOM
2817
2818 Configure uses the operating system name and version to set some defaults.
2819 The default value is probably right if the name rings a bell. Otherwise,
2820 since spelling matters for me, either accept the default or answer "none"
2821 to leave it blank.
2822
2823 EOM
2824 case "$osname" in
2825         ''|' ')
2826                 case "$hintfile" in
2827                 ''|' '|none) dflt=none ;;
2828                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2829                 esac
2830                 ;;
2831         *) dflt="$osname" ;;
2832 esac
2833 rp="Operating system name?"
2834 . ./myread
2835 case "$ans" in
2836 none)  osname='' ;;
2837 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2838 esac
2839 echo " "
2840 case "$osvers" in
2841         ''|' ')
2842                 case "$hintfile" in
2843                 ''|' '|none) dflt=none ;;
2844                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2845                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2846                         case "$dflt" in
2847                         ''|' ') dflt=none ;;
2848                         esac
2849                         ;;
2850                 esac
2851                 ;;
2852         *) dflt="$osvers" ;;
2853 esac
2854 rp="Operating system version?"
2855 . ./myread
2856 case "$ans" in
2857 none)  osvers='' ;;
2858 *) osvers="$ans" ;;
2859 esac
2860
2861
2862 . ./posthint.sh
2863
2864 : who configured the system
2865 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2866 cf_by=`(logname) 2>/dev/null`
2867 case "$cf_by" in
2868 "")
2869         cf_by=`(whoami) 2>/dev/null`
2870         case "$cf_by" in
2871         "") cf_by=unknown ;;
2872         esac ;;
2873 esac
2874
2875 : set up the script used to warn in case of inconsistency
2876 cat <<EOS >whoa
2877 $startsh
2878 EOS
2879 cat <<'EOSC' >>whoa
2880 dflt=y
2881 echo " "
2882 echo "*** WHOA THERE!!! ***" >&4
2883 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2884 rp="    Keep the $hint value?"
2885 . ./myread
2886 case "$ans" in
2887 y) td=$was; tu=$was;;
2888 esac
2889 EOSC
2890
2891 : function used to set $1 to $val
2892 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2893 case "$val$was" in
2894 $define$undef) . ./whoa; eval "$var=\$td";;
2895 $undef$define) . ./whoa; eval "$var=\$tu";;
2896 *) eval "$var=$val";;
2897 esac'
2898
2899 case "$usethreads" in
2900 $define|true|[yY]*)     dflt='y';;
2901 *) dflt='n';;
2902 esac
2903 cat <<EOM
2904
2905 Perl can be built to take advantage of threads on some systems.
2906 To do so, Configure can be run with -Dusethreads.
2907
2908 Note that threading is a highly experimental feature, and
2909 some known race conditions still remain.  If you choose to try
2910 it, be very sure to not actually deploy it for production
2911 purposes.  README.threads has more details, and is required
2912 reading if you enable threads.
2913
2914 If this doesn't make any sense to you, just accept the default '$dflt'.
2915 EOM
2916 rp='Build a threading Perl?'
2917 . ./myread
2918 case "$ans" in
2919 y|Y)    val="$define" ;;
2920 *)      val="$undef" ;;
2921 esac
2922 set usethreads
2923 eval $setvar
2924
2925 case "$usethreads" in
2926 $define)
2927         $cat <<EOM
2928
2929 As of 5.5.640, Perl has two different internal threading implementations,
2930 the 5.005 version (5005threads) and an interpreter-based version
2931 (ithreads) that has one interpreter per thread.  Both are very 
2932 experimental.  This arrangement exists to help developers work out
2933 which one is better.
2934
2935 If you're a casual user, you probably don't want interpreter-threads
2936 at this time.  There doesn't yet exist a way to create threads from
2937 within Perl in this model, i.e., "use Thread;" will NOT work.
2938 EOM
2939         : Default to ithreads unless overridden on command line or with
2940         : old config.sh
2941         dflt='y'
2942         case "$use5005threads" in
2943                 $define|true|[yY]*) dflt='n';;
2944         esac
2945         case "$useithreads" in
2946                 $undef|false|[nN]*) dflt='n';;
2947         esac
2948         rp='Use interpreter-based ithreads?'
2949         . ./myread
2950         case "$ans" in
2951         y|Y)    val="$define" ;;
2952         *)      val="$undef" ;;
2953         esac
2954         set useithreads
2955         eval $setvar
2956         : Now set use5005threads to the opposite value.
2957         case "$useithreads" in
2958         $define) val="$undef" ;;
2959         *) val="$define" ;;
2960         esac
2961         set use5005threads
2962         eval $setvar
2963         ;;
2964 *)
2965         useithreads="$undef"
2966         use5005threads="$undef"
2967         ;;
2968 esac
2969
2970 case "$useithreads$use5005threads" in
2971 "$define$define")
2972         $cat >&4 <<EOM
2973
2974 You cannot have both the ithreads and the 5.005 threads enabled
2975 at the same time.  Disabling the 5.005 threads since they are
2976 much less stable than the ithreads.
2977
2978 EOM
2979         use5005threads="$undef"
2980         ;;
2981 esac
2982
2983 case "$d_oldpthreads" in
2984 '')     : Configure tests would be welcome here.  For now, assume undef.
2985         val="$undef" ;;
2986 *)      val="$d_oldpthreads" ;;
2987 esac
2988 set d_oldpthreads
2989 eval $setvar
2990
2991
2992 case "$usethreads" in
2993 "$define"|true|[yY]*)
2994 : Look for a hint-file generated 'call-back-unit'.  If the
2995 : user has specified that a threading perl is to be built,
2996 : we may need to set or change some other defaults.
2997         if $test -f usethreads.cbu; then
2998                 echo "Your platform has some specific hints for threaded builds, using them..."
2999                 . ./usethreads.cbu
3000         else
3001                 $cat <<EOM
3002 (Your platform doesn't have any specific hints for threaded builds.
3003  Assuming POSIX threads, then.)
3004 EOM
3005         fi
3006         ;;
3007 esac
3008
3009 cat <<EOM
3010
3011 Perl can be built so that multiple Perl interpreters can coexist
3012 within the same Perl executable.
3013 EOM
3014
3015 case "$useithreads" in
3016 $define)
3017         cat <<EOM
3018 This multiple interpreter support is required for interpreter-based threads.
3019 EOM
3020         val="$define"
3021         ;;
3022 *)      case "$usemultiplicity" in
3023         $define|true|[yY]*)     dflt='y';;
3024         *) dflt='n';;
3025         esac
3026         echo " "
3027         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3028         rp='Build Perl for multiplicity?'
3029         . ./myread
3030         case "$ans" in
3031         y|Y)    val="$define" ;;
3032         *)      val="$undef" ;;
3033         esac
3034         ;;
3035 esac
3036 set usemultiplicity
3037 eval $setvar
3038
3039 : make some quick guesses about what we are up against
3040 echo " "
3041 $echo $n "Hmm...  $c"
3042 echo exit 1 >bsd
3043 echo exit 1 >usg
3044 echo exit 1 >v7
3045 echo exit 1 >osf1
3046 echo exit 1 >eunice
3047 echo exit 1 >xenix
3048 echo exit 1 >venix
3049 echo exit 1 >os2
3050 d_bsd="$undef"
3051 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3052 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3053 then
3054         echo "Looks kind of like an OSF/1 system, but we'll see..."
3055         echo exit 0 >osf1
3056 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3057         xxx=`./loc addbib blurfl $pth`
3058         if $test -f $xxx; then
3059         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3060                 echo exit 0 >bsd
3061                 echo exit 0 >usg
3062         else
3063                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3064                         echo "Looks kind of like an extended USG system, but we'll see..."
3065                 else
3066                         echo "Looks kind of like a USG system, but we'll see..."
3067                 fi
3068                 echo exit 0 >usg
3069         fi
3070 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3071         echo "Looks kind of like a BSD system, but we'll see..."
3072         d_bsd="$define"
3073         echo exit 0 >bsd
3074 else
3075         echo "Looks kind of like a Version 7 system, but we'll see..."
3076         echo exit 0 >v7
3077 fi
3078 case "$eunicefix" in
3079 *unixtovms*)
3080         $cat <<'EOI'
3081 There is, however, a strange, musty smell in the air that reminds me of
3082 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3083 EOI
3084         echo exit 0 >eunice
3085         d_eunice="$define"
3086 : it so happens the Eunice I know will not run shell scripts in Unix format
3087         ;;
3088 *)
3089         echo " "
3090         echo "Congratulations.  You aren't running Eunice."
3091         d_eunice="$undef"
3092         ;;
3093 esac
3094 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3095 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3096 : semicolon as a patch separator
3097 case "$p_" in
3098 :) ;;
3099 *)
3100         $cat <<'EOI'
3101 I have the feeling something is not exactly right, however...don't tell me...
3102 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3103 (Or you may be running DOS with DJGPP.)
3104 EOI
3105         echo exit 0 >os2
3106         ;;
3107 esac
3108 if test -f /xenix; then
3109         echo "Actually, this looks more like a XENIX system..."
3110         echo exit 0 >xenix
3111         d_xenix="$define"
3112 else
3113         echo " "
3114         echo "It's not Xenix..."
3115         d_xenix="$undef"
3116 fi
3117 chmod +x xenix
3118 $eunicefix xenix
3119 if test -f /venix; then
3120         echo "Actually, this looks more like a VENIX system..."
3121         echo exit 0 >venix
3122 else
3123         echo " "
3124         if ./xenix; then
3125                 : null
3126         else
3127                 echo "Nor is it Venix..."
3128         fi
3129 fi
3130 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3131 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3132 $rm -f foo
3133
3134 case "$cc" in
3135 '') dflt=cc;;
3136 *) dflt="$cc";;
3137 esac
3138 rp="Use which C compiler?"
3139 . ./myread
3140 cc="$ans"
3141 : Look for a hint-file generated 'call-back-unit'.  Now that the
3142 : user has specified the compiler, we may need to set or change some
3143 : other defaults.
3144 if $test -f cc.cbu; then
3145     . ./cc.cbu
3146 fi
3147 . ./checkcc
3148
3149 echo " "
3150 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3151 $cat >gccvers.c <<EOM
3152 #include <stdio.h>
3153 int main() {
3154 #ifdef __GNUC__
3155 #ifdef __VERSION__
3156         printf("%s\n", __VERSION__);
3157 #else
3158         printf("%s\n", "1");
3159 #endif
3160 #endif
3161         exit(0);
3162 }
3163 EOM
3164 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3165         gccversion=`./gccvers`
3166         case "$gccversion" in
3167         '') echo "You are not using GNU cc." ;;
3168         *)  echo "You are using GNU cc $gccversion."
3169             ccname=gcc  
3170             ;;
3171         esac
3172 else
3173         echo " "
3174         echo "*** WHOA THERE!!! ***" >&4
3175         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3176         case "$knowitall" in
3177         '')
3178         echo "    You'd better start hunting for one and let me know about it." >&4
3179                 exit 1
3180                 ;;
3181         esac
3182 fi
3183 $rm -f gccvers*
3184 case "$gccversion" in
3185 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3186 esac
3187 case "$gccversion" in
3188 '') gccosandvers='' ;;
3189 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3190    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3191    gccshortvers=''
3192    case "$gccosandvers" in
3193    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3194    $osname$osvers) ;; # looking good
3195    $osname*) cat <<EOM >&4
3196
3197 *** WHOA THERE!!! ***
3198
3199     Your gcc has not been compiled for the exact release of
3200     your operating system ($gccosandvers versus $osname$osvers).
3201
3202     In general it is a good idea to keep gcc synchronized with
3203     the operating system because otherwise serious problems
3204     may ensue when trying to compile software, like Perl.
3205
3206     I'm trying to be optimistic here, though, and will continue.
3207     If later during the configuration and build icky compilation
3208     problems appear (headerfile conflicts being the most common
3209     manifestation), I suggest reinstalling the gcc to match
3210     your operating system release.
3211
3212 EOM
3213       ;;
3214    *) gccosandvers='' ;; # failed to parse, better be silent
3215    esac
3216    ;;
3217 esac
3218 case "$ccname" in
3219 '') ccname="$cc" ;;
3220 esac
3221
3222 : see how we invoke the C preprocessor
3223 echo " "
3224 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3225 cat <<'EOT' >testcpp.c
3226 #define ABC abc
3227 #define XYZ xyz
3228 ABC.XYZ
3229 EOT
3230 cd ..
3231 if test ! -f cppstdin; then
3232         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3233                 # AIX cc -E doesn't show the absolute headerfile
3234                 # locations but we'll cheat by using the -M flag.
3235                 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
3236         else
3237                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3238         fi
3239 else
3240         echo "Keeping your $hint cppstdin wrapper."
3241 fi
3242 chmod 755 cppstdin
3243 wrapper=`pwd`/cppstdin
3244 ok='false'
3245 cd UU
3246
3247 if $test "X$cppstdin" != "X" && \
3248         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3249         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3250 then
3251         echo "You used to use $cppstdin $cppminus so we'll use that again."
3252         case "$cpprun" in
3253         '') echo "But let's see if we can live without a wrapper..." ;;
3254         *)
3255                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3256                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3257                 then
3258                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3259                         ok='true'
3260                 else
3261                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3262                 fi
3263                 ;;
3264         esac
3265 else
3266         case "$cppstdin" in
3267         '') ;;
3268         *)
3269                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3270                 ;;
3271         esac
3272 fi
3273
3274 if $ok; then
3275         : nothing
3276 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3277         $cc -E <testcpp.c >testcpp.out 2>&1; \
3278         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3279         echo "Yup, it does."
3280         x_cpp="$cc -E"
3281         x_minus='';
3282 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3283         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3284         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3285         echo "Yup, it does."
3286         x_cpp="$cc -E"
3287         x_minus='-';
3288 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3289         $cc -P <testcpp.c >testcpp.out 2>&1; \
3290         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3291         echo "Yipee, that works!"
3292         x_cpp="$cc -P"
3293         x_minus='';
3294 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3295         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3296         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3297         echo "At long last!"
3298         x_cpp="$cc -P"
3299         x_minus='-';
3300 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3301         $cpp <testcpp.c >testcpp.out 2>&1; \
3302         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3303         echo "It works!"
3304         x_cpp="$cpp"
3305         x_minus='';
3306 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3307         $cpp - <testcpp.c >testcpp.out 2>&1; \
3308         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3309         echo "Hooray, it works!  I was beginning to wonder."
3310         x_cpp="$cpp"
3311         x_minus='-';
3312 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3313         $wrapper <testcpp.c >testcpp.out 2>&1; \
3314         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3315         x_cpp="$wrapper"
3316         x_minus=''
3317         echo "Eureka!"
3318 else
3319         dflt=''
3320         rp="No dice.  I can't find a C preprocessor.  Name one:"
3321         . ./myread
3322         x_cpp="$ans"
3323         x_minus=''
3324         $x_cpp <testcpp.c >testcpp.out 2>&1
3325         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3326                 echo "OK, that will do." >&4
3327         else
3328 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3329                 exit 1
3330         fi
3331 fi
3332
3333 case "$ok" in
3334 false)
3335         cppstdin="$x_cpp"
3336         cppminus="$x_minus"
3337         cpprun="$x_cpp"
3338         cpplast="$x_minus"
3339         set X $x_cpp
3340         shift
3341         case "$1" in
3342         "$cpp")
3343                 echo "Perhaps can we force $cc -E using a wrapper..."
3344                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3345                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3346                 then
3347                         echo "Yup, we can."
3348                         cppstdin="$wrapper"
3349                         cppminus='';
3350                 else
3351                         echo "Nope, we'll have to live without it..."
3352                 fi
3353                 ;;
3354         esac
3355         case "$cpprun" in
3356         "$wrapper")
3357                 cpprun=''
3358                 cpplast=''
3359                 ;;
3360         esac
3361         ;;
3362 esac
3363
3364 case "$cppstdin" in
3365 "$wrapper"|'cppstdin') ;;
3366 *) $rm -f $wrapper;;
3367 esac
3368 $rm -f testcpp.c testcpp.out
3369
3370 : decide how portable to be.  Allow command line overrides.
3371 case "$d_portable" in
3372 "$undef") ;;
3373 *)      d_portable="$define" ;;
3374 esac
3375
3376 : set up shell script to do ~ expansion
3377 cat >filexp <<EOSS
3378 $startsh
3379 : expand filename
3380 case "\$1" in
3381  ~/*|~)
3382         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3383         ;;
3384  ~*)
3385         if $test -f /bin/csh; then
3386                 /bin/csh -f -c "glob \$1"
3387                 failed=\$?
3388                 echo ""
3389                 exit \$failed
3390         else
3391                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3392                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3393                 if $test ! -d "\$dir"; then
3394                         me=\`basename \$0\`
3395                         echo "\$me: can't locate home directory for: \$name" >&2
3396                         exit 1
3397                 fi
3398                 case "\$1" in
3399                 */*)
3400                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3401                         ;;
3402                 *)
3403                         echo \$dir
3404                         ;;
3405                 esac
3406         fi
3407         ;;
3408 *)
3409         echo \$1
3410         ;;
3411 esac
3412 EOSS
3413 chmod +x filexp
3414 $eunicefix filexp
3415
3416 : now set up to get a file name
3417 cat <<EOS >getfile
3418 $startsh
3419 EOS
3420 cat <<'EOSC' >>getfile
3421 tilde=''
3422 fullpath=''
3423 already=''
3424 skip=''
3425 none_ok=''
3426 exp_file=''
3427 nopath_ok=''
3428 orig_rp="$rp"
3429 orig_dflt="$dflt"
3430 case "$gfpth" in
3431 '') gfpth='.' ;;
3432 esac
3433
3434 case "$fn" in
3435 *\(*)
3436         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3437         fn=`echo $fn | sed 's/(.*)//'`
3438         ;;
3439 esac
3440
3441 case "$fn" in
3442 *:*)
3443         loc_file=`expr $fn : '.*:\(.*\)'`
3444         fn=`expr $fn : '\(.*\):.*'`
3445         ;;
3446 esac
3447
3448 case "$fn" in
3449 *~*) tilde=true;;
3450 esac
3451 case "$fn" in
3452 */*) fullpath=true;;
3453 esac
3454 case "$fn" in
3455 *+*) skip=true;;
3456 esac
3457 case "$fn" in
3458 *n*) none_ok=true;;
3459 esac
3460 case "$fn" in
3461 *e*) exp_file=true;;
3462 esac
3463 case "$fn" in
3464 *p*) nopath_ok=true;;
3465 esac
3466
3467 case "$fn" in
3468 *f*) type='File';;
3469 *d*) type='Directory';;
3470 *l*) type='Locate';;
3471 esac
3472
3473 what="$type"
3474 case "$what" in
3475 Locate) what='File';;
3476 esac
3477
3478 case "$exp_file" in
3479 '')
3480         case "$d_portable" in
3481         "$define") ;;
3482         *) exp_file=true;;
3483         esac
3484         ;;
3485 esac
3486
3487 cd ..
3488 while test "$type"; do
3489         redo=''
3490         rp="$orig_rp"
3491         dflt="$orig_dflt"
3492         case "$tilde" in
3493         true) rp="$rp (~name ok)";;
3494         esac
3495         . UU/myread
3496         if test -f UU/getfile.ok && \
3497                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3498         then
3499                 value="$ans"
3500                 ansexp="$ans"
3501                 break
3502         fi
3503         case "$ans" in
3504         none)
3505                 value=''
3506                 ansexp=''
3507                 case "$none_ok" in
3508                 true) type='';;
3509                 esac
3510                 ;;
3511         *)
3512                 case "$tilde" in
3513                 '') value="$ans"
3514                         ansexp="$ans";;
3515                 *)
3516                         value=`UU/filexp $ans`
3517                         case $? in
3518                         0)
3519                                 if test "$ans" != "$value"; then
3520                                         echo "(That expands to $value on this system.)"
3521                                 fi
3522                                 ;;
3523                         *) value="$ans";;
3524                         esac
3525                         ansexp="$value"
3526                         case "$exp_file" in
3527                         '') value="$ans";;
3528                         esac
3529                         ;;
3530                 esac
3531                 case "$fullpath" in
3532                 true)
3533                         case "$ansexp" in
3534                         /*) value="$ansexp" ;;
3535                         [a-zA-Z]:/*) value="$ansexp" ;;
3536                         *)
3537                                 redo=true
3538                                 case "$already" in
3539                                 true)
3540                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3541                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3542                                         ;;
3543                                 *)
3544                                 echo "Please give a full path name, starting with slash." >&4
3545                                         case "$tilde" in
3546                                         true)
3547                                 echo "Note that using ~name is ok provided it expands well." >&4
3548                                                 already=true
3549                                                 ;;
3550                                         esac
3551                                 esac
3552                                 ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 case "$redo" in
3557                 '')
3558                         case "$type" in
3559                         File)
3560                                 for fp in $gfpth; do
3561                                         if test "X$fp" = X.; then
3562                                             pf="$ansexp"
3563                                         else    
3564                                             pf="$fp/$ansexp"
3565                                         fi
3566                                         if test -f "$pf"; then
3567                                                 type=''
3568                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3569                                         then
3570                                                 echo "($value is not a plain file, but that's ok.)"
3571                                                 type=''
3572                                         fi
3573                                         if test X"$type" = X; then
3574                                             value="$pf"
3575                                             break
3576                                         fi
3577                                 done
3578                                 ;;
3579                         Directory)
3580                                 for fp in $gfpth; do
3581                                         if test "X$fp" = X.; then
3582                                             dir="$ans"
3583                                             direxp="$ansexp"
3584                                         else    
3585                                             dir="$fp/$ansexp"
3586                                             direxp="$fp/$ansexp"
3587                                         fi
3588                                         if test -d "$direxp"; then
3589                                                 type=''
3590                                                 value="$dir"
3591                                                 break
3592                                         fi
3593                                 done
3594                                 ;;
3595                         Locate)
3596                                 if test -d "$ansexp"; then
3597                                         echo "(Looking for $loc_file in directory $value.)"
3598                                         value="$value/$loc_file"
3599                                         ansexp="$ansexp/$loc_file"
3600                                 fi
3601                                 if test -f "$ansexp"; then
3602                                         type=''
3603                                 fi
3604                                 case "$nopath_ok" in
3605                                 true)   case "$value" in
3606                                         */*) ;;
3607                                         *)      echo "Assuming $value will be in people's path."
3608                                                 type=''
3609                                                 ;;
3610                                         esac
3611                                         ;;
3612                                 esac
3613                                 ;;
3614                         esac
3615
3616                         case "$skip" in
3617                         true) type='';
3618                         esac
3619
3620                         case "$type" in
3621                         '') ;;
3622                         *)
3623                                 if test "$fastread" = yes; then
3624                                         dflt=y
3625                                 else
3626                                         dflt=n
3627                                 fi
3628                                 rp="$what $value doesn't exist.  Use that name anyway?"
3629                                 . UU/myread
3630                                 dflt=''
3631                                 case "$ans" in
3632                                 y*) type='';;
3633                                 *) echo " ";;
3634                                 esac
3635                                 ;;
3636                         esac
3637                         ;;
3638                 esac
3639                 ;;
3640         esac
3641 done
3642 cd UU
3643 ans="$value"
3644 rp="$orig_rp"
3645 dflt="$orig_dflt"
3646 rm -f getfile.ok
3647 test "X$gfpthkeep" != Xy && gfpth=""
3648 EOSC
3649
3650 : What should the include directory be ?
3651 echo " "
3652 $echo $n "Hmm...  $c"
3653 dflt='/usr/include'
3654 incpath=''
3655 mips_type=''
3656 if $test -f /bin/mips && /bin/mips; then
3657         echo "Looks like a MIPS system..."
3658         $cat >usr.c <<'EOCP'
3659 #ifdef SYSTYPE_BSD43
3660 /bsd43
3661 #endif
3662 EOCP
3663         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3664                 dflt='/bsd43/usr/include'
3665                 incpath='/bsd43'
3666                 mips_type='BSD 4.3'
3667         else
3668                 mips_type='System V'
3669         fi
3670         $rm -f usr.c usr.out
3671         echo "and you're compiling with the $mips_type compiler and libraries."
3672         xxx_prompt=y
3673         echo "exit 0" >mips
3674 else
3675         echo "Doesn't look like a MIPS system."
3676         xxx_prompt=n
3677         echo "exit 1" >mips
3678 fi
3679 chmod +x mips
3680 $eunicefix mips
3681 case "$usrinc" in
3682 '') ;;
3683 *) dflt="$usrinc";;
3684 esac
3685 case "$xxx_prompt" in
3686 y)      fn=d/
3687         echo " "
3688         rp='Where are the include files you want to use?'
3689         . ./getfile
3690         usrinc="$ans"
3691         ;;
3692 *)      usrinc="$dflt"
3693         ;;
3694 esac
3695
3696 : Set private lib path
3697 case "$plibpth" in
3698 '') if ./mips; then
3699                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3700         fi;;
3701 esac
3702 case "$libpth" in
3703 ' ') dlist='';;
3704 '') dlist="$loclibpth $plibpth $glibpth";;
3705 *) dlist="$libpth";;
3706 esac
3707
3708 : Now check and see which directories actually exist, avoiding duplicates
3709 libpth=''
3710 for xxx in $dlist
3711 do
3712     if $test -d $xxx; then
3713                 case " $libpth " in
3714                 *" $xxx "*) ;;
3715                 *) libpth="$libpth $xxx";;
3716                 esac
3717     fi
3718 done
3719 $cat <<'EOM'
3720
3721 Some systems have incompatible or broken versions of libraries.  Among
3722 the directories listed in the question below, please remove any you
3723 know not to be holding relevant libraries, and add any that are needed.
3724 Say "none" for none.
3725
3726 EOM
3727 case "$libpth" in
3728 '') dflt='none';;
3729 *)
3730         set X $libpth
3731         shift
3732         dflt=${1+"$@"}
3733         ;;
3734 esac
3735 rp="Directories to use for library searches?"
3736 . ./myread
3737 case "$ans" in
3738 none) libpth=' ';;
3739 *) libpth="$ans";;
3740 esac
3741
3742 : compute shared library extension
3743 case "$so" in
3744 '')
3745         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3746                 dflt='sl'
3747         else
3748                 dflt='so'
3749         fi
3750         ;;
3751 *) dflt="$so";;
3752 esac
3753 $cat <<EOM
3754
3755 On some systems, shared libraries may be available.  Answer 'none' if
3756 you want to suppress searching of shared libraries for the remainder
3757 of this configuration.
3758
3759 EOM
3760 rp='What is the file extension used for shared libraries?'
3761 . ./myread
3762 so="$ans"
3763
3764 : Define several unixisms.
3765 : Hints files or command line option can be used to override them.
3766 : The convoluted testing is in case hints files set either the old
3767 : or the new name.
3768 case "$_exe" in
3769 '')     case "$exe_ext" in
3770     '') ;;
3771         *)      _exe="$exe_ext" ;;
3772         esac
3773         ;;
3774 esac
3775 case "$_a" in
3776 '')     case "$lib_ext" in
3777     '') _a='.a';;
3778         *)      _a="$lib_ext" ;;
3779         esac
3780         ;;
3781 esac
3782 case "$_o" in
3783 '') case "$obj_ext" in
3784         '')     _o='.o';;
3785         *)      _o="$obj_ext";;
3786         esac
3787         ;;
3788 esac
3789 case "$p_" in
3790 '') case "$path_sep" in
3791         '')     p_=':';;
3792         *)      p_="$path_sep";;
3793         esac
3794         ;;
3795 esac
3796 exe_ext=$_exe
3797 lib_ext=$_a
3798 obj_ext=$_o
3799 path_sep=$p_
3800
3801 : Which makefile gets called first.  This is used by make depend.
3802 case "$firstmakefile" in
3803 '') firstmakefile='makefile';;
3804 esac
3805
3806 case "$usesocks" in
3807 $define|true|[yY]*)     dflt='y';;
3808 *) dflt='n';;
3809 esac
3810 cat <<EOM
3811
3812 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3813 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3814 to use the PerlIO abstraction layer, this will be implicitly selected.
3815
3816 If this doesn't make any sense to you, just accept the default '$dflt'.
3817 EOM
3818 rp='Build Perl for SOCKS?'
3819 . ./myread
3820 case "$ans" in
3821 y|Y)    val="$define" ;;     
3822 *)      val="$undef" ;;
3823 esac
3824 set usesocks
3825 eval $setvar
3826
3827 case "$usesocks" in
3828 $define|true|[yY]*) useperlio="$define";;
3829 esac
3830
3831 : Looking for optional libraries
3832 echo " "
3833 echo "Checking for optional libraries..." >&4
3834 case "$libs" in
3835 ' '|'') dflt='';;
3836 *) dflt="$libs";;
3837 esac
3838 case "$libswanted" in
3839 '') libswanted='c_s';;
3840 esac
3841 case "$usesocks" in
3842 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3843 esac
3844 libsfound=''
3845 libsfiles=''
3846 libsdirs=''
3847 libspath=''
3848 for thisdir in $libpth $xlibpth; do
3849   test -d $thisdir && libspath="$libspath $thisdir"
3850 done
3851 for thislib in $libswanted; do
3852         for thisdir in $libspath; do
3853             xxx=''
3854             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3855                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3856                 $test -f "$xxx" && eval $libscheck
3857                 $test -f "$xxx" && libstyle=shared
3858             fi
3859             if test ! -f "$xxx"; then
3860                 xxx=$thisdir/lib$thislib.$so
3861                 $test -f "$xxx" && eval $libscheck
3862                 $test -f "$xxx" && libstyle=shared
3863             fi  
3864             if test ! -f "$xxx"; then
3865                 xxx=$thisdir/lib$thislib$_a
3866                 $test -f "$xxx" && eval $libscheck
3867                 $test -f "$xxx" && libstyle=static
3868             fi
3869             if test ! -f "$xxx"; then
3870                 xxx=$thisdir/$thislib$_a
3871                 $test -f "$xxx" && eval $libscheck
3872                 $test -f "$xxx" && libstyle=static
3873             fi
3874             if test ! -f "$xxx"; then
3875                 xxx=$thisdir/lib${thislib}_s$_a
3876                 $test -f "$xxx" && eval $libscheck
3877                 $test -f "$xxx" && libstyle=static
3878                 $test -f "$xxx" && thislib=${thislib}_s
3879             fi
3880             if test ! -f "$xxx"; then
3881                 xxx=$thisdir/Slib$thislib$_a
3882                 $test -f "$xxx" && eval $libscheck
3883                 $test -f "$xxx" && libstyle=static
3884             fi
3885             if $test -f "$xxx"; then
3886                 case "$libstyle" in
3887                 shared) echo "Found -l$thislib (shared)." ;;
3888                 static) echo "Found -l$thislib." ;;
3889                 *)      echo "Found -l$thislib ($libstyle)." ;;
3890                 esac
3891                 case " $dflt " in
3892                 *"-l$thislib "*);;
3893                 *) dflt="$dflt -l$thislib"
3894                    libsfound="$libsfound $xxx"
3895                    yyy=`basename $xxx`
3896                    libsfiles="$libsfiles $yyy"
3897                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3898                    case " $libsdirs " in
3899                    *" $yyy "*) ;;
3900                    *) libsdirs="$libsdirs $yyy" ;;
3901                    esac
3902                    ;;
3903                 esac
3904                 break
3905             fi  
3906         done
3907         if $test ! -f "$xxx"; then
3908             echo "No -l$thislib."
3909         fi
3910 done
3911 set X $dflt
3912 shift
3913 dflt="$*"
3914 case "$libs" in
3915 '') dflt="$dflt";;
3916 *) dflt="$libs";;
3917 esac
3918 case "$dflt" in
3919 ' '|'') dflt='none';;
3920 esac
3921
3922 $cat <<EOM
3923
3924 In order to compile $package on your machine, a number of libraries
3925 are usually needed.  Include any other special libraries here as well.
3926 Say "none" for none.  The default list is almost always right.
3927 EOM
3928
3929 echo " "
3930 rp="What libraries to use?"
3931 . ./myread
3932 case "$ans" in
3933 none) libs=' ';;
3934 *) libs="$ans";;
3935 esac
3936
3937 : determine optimization, if desired, or use for debug flag also
3938 case "$optimize" in
3939 ' '|$undef) dflt='none';;
3940 '') dflt='-O';;
3941 *) dflt="$optimize";;
3942 esac
3943 $cat <<EOH
3944
3945 By default, $package compiles with the -O flag to use the optimizer.
3946 Alternately, you might want to use the symbolic debugger, which uses
3947 the -g flag (on traditional Unix systems).  Either flag can be
3948 specified here.  To use neither flag, specify the word "none".
3949
3950 EOH
3951 rp="What optimizer/debugger flag should be used?"
3952 . ./myread
3953 optimize="$ans"
3954 case "$optimize" in
3955 'none') optimize=" ";;
3956 esac
3957
3958 dflt=''
3959 : We will not override a previous value, but we might want to
3960 : augment a hint file
3961 case "$hint" in
3962 default|recommended)
3963         case "$gccversion" in
3964         1*) dflt='-fpcc-struct-return' ;;
3965         esac
3966         case "$optimize" in
3967         *-g*) dflt="$dflt -DDEBUGGING";;
3968         esac
3969         case "$gccversion" in
3970         2*) if test -d /etc/conf/kconfig.d &&
3971                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3972                 then
3973                         dflt="$dflt -posix"
3974                 fi
3975                 ;;
3976         esac
3977         case "$gccversion" in
3978         1*) ;;
3979         2.[0-8]*) ;;
3980         ?*)     echo " "
3981                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3982                 echo 'int main(void) { return 0; }' > gcctest.c
3983                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3984                         echo "Yes, it does." 2>&1
3985                         case "$ccflags" in
3986                         *strict-aliasing*) 
3987                                 echo "Leaving current flags $ccflags alone." 2>&1
3988                                 ;;
3989                         *) dflt="$dflt -fno-strict-aliasing" ;;
3990                         esac
3991                 else
3992                         echo "Nope, it doesn't, but that's ok." 2>&1
3993                 fi
3994                 ;;
3995         esac
3996         ;;
3997 esac
3998
3999 case "$mips_type" in
4000 *BSD*|'') inclwanted="$locincpth $usrinc";;
4001 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4002 esac
4003 for thisincl in $inclwanted; do
4004         if $test -d $thisincl; then
4005                 if $test x$thisincl != x$usrinc; then
4006                         case "$dflt" in
4007                         *" -I$thisincl "*);;
4008                         *) dflt="$dflt -I$thisincl ";;
4009                         esac
4010                 fi
4011         fi
4012 done
4013
4014 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4015         xxx=true;
4016 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4017         xxx=true;
4018 else
4019         xxx=false;
4020 fi;
4021 if $xxx; then
4022         case "$dflt" in
4023         *$2*);;
4024         *) dflt="$dflt -D$2";;
4025         esac;
4026 fi'
4027
4028 set signal.h LANGUAGE_C; eval $inctest
4029
4030 case "$usesocks" in
4031 $define)
4032         ccflags="$ccflags -DSOCKS"
4033         ;;
4034 esac
4035
4036 case "$hint" in
4037 default|recommended) dflt="$ccflags $dflt" ;;
4038 *) dflt="$ccflags";;
4039 esac
4040
4041 case "$dflt" in
4042 ''|' ') dflt=none;;
4043 esac
4044
4045 $cat <<EOH
4046
4047 Your C compiler may want other flags.  For this question you should include
4048 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4049 but you should NOT include libraries or ld flags like -lwhatever.  If you
4050 want $package to honor its debug switch, you should include -DDEBUGGING here.
4051 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4052
4053 To use no flags, specify the word "none".
4054
4055 EOH
4056 set X $dflt
4057 shift
4058 dflt=${1+"$@"}
4059 rp="Any additional cc flags?"
4060 . ./myread
4061 case "$ans" in
4062 none) ccflags='';;
4063 *) ccflags="$ans";;
4064 esac
4065
4066 : the following weeds options from ccflags that are of no interest to cpp
4067 case "$cppflags" in
4068 '') cppflags="$ccflags" ;;
4069 *)  cppflags="$cppflags $ccflags" ;;
4070 esac
4071 case "$gccversion" in
4072 1*) cppflags="$cppflags -D__GNUC__"
4073 esac
4074 case "$mips_type" in
4075 '');;
4076 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4077 esac
4078 case "$cppflags" in
4079 '');;
4080 *)
4081         echo " "
4082         echo "Let me guess what the preprocessor flags are..." >&4
4083         set X $cppflags
4084         shift
4085         cppflags=''
4086         $cat >cpp.c <<'EOM'
4087 #define BLURFL foo
4088
4089 BLURFL xx LFRULB
4090 EOM
4091         previous=''
4092         for flag in $*
4093         do
4094                 case "$flag" in
4095                 -*) ftry="$flag";;
4096                 *) ftry="$previous $flag";;
4097                 esac
4098                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4099                         >cpp1.out 2>/dev/null && \
4100                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4101                         >cpp2.out 2>/dev/null && \
4102                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4103                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4104                 then
4105                         cppflags="$cppflags $ftry"
4106                         previous=''
4107                 else
4108                         previous="$flag"
4109                 fi
4110         done
4111         set X $cppflags
4112         shift
4113         cppflags=${1+"$@"}
4114         case "$cppflags" in
4115         *-*)  echo "They appear to be: $cppflags";;
4116         esac
4117         $rm -f cpp.c cpp?.out
4118         ;;
4119 esac
4120
4121 : flags used in final linking phase
4122 case "$ldflags" in
4123 '') if ./venix; then
4124                 dflt='-i -z'
4125         else
4126                 dflt=''
4127         fi
4128         case "$ccflags" in
4129         *-posix*) dflt="$dflt -posix" ;;
4130         esac
4131         ;;
4132 *) dflt="$ldflags";;
4133 esac
4134
4135 : Try to guess additional flags to pick up local libraries.
4136 for thislibdir in $libpth; do
4137         case " $loclibpth " in
4138         *" $thislibdir "*)
4139                 case "$dflt " in 
4140                 *"-L$thislibdir "*) ;;
4141                 *)  dflt="$dflt -L$thislibdir" ;;
4142                 esac
4143                 ;;
4144         esac
4145 done
4146
4147 case "$dflt" in
4148 '') dflt='none' ;;
4149 esac
4150
4151 $cat <<EOH
4152
4153 Your C linker may need flags.  For this question you should
4154 include -L/whatever and any other flags used by the C linker, but you
4155 should NOT include libraries like -lwhatever.
4156
4157 Make sure you include the appropriate -L/path flags if your C linker
4158 does not normally search all of the directories you specified above,
4159 namely
4160         $libpth
4161 To use no flags, specify the word "none".
4162
4163 EOH
4164
4165 rp="Any additional ld flags (NOT including libraries)?"
4166 . ./myread
4167 case "$ans" in
4168 none) ldflags='';;
4169 *) ldflags="$ans";;
4170 esac
4171 rmlist="$rmlist pdp11"
4172
4173 : coherency check
4174 echo " "
4175 echo "Checking your choice of C compiler and flags for coherency..." >&4
4176 $cat > try.c <<'EOF'
4177 #include <stdio.h>
4178 int main() { printf("Ok\n"); exit(0); }
4179 EOF
4180 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4181 shift
4182 $cat >try.msg <<'EOM'
4183 I've tried to compile and run the following simple program:
4184
4185 EOM
4186 $cat try.c >> try.msg
4187
4188 $cat >> try.msg <<EOM
4189
4190 I used the command:
4191
4192         $*
4193         ./try
4194
4195 and I got the following output:
4196
4197 EOM
4198 dflt=y
4199 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4200         if $sh -c './try' >>try.msg 2>&1; then
4201                 xxx=`./try`
4202                 case "$xxx" in
4203                 "Ok") dflt=n ;;
4204                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4205                         case " $libs " in
4206                         *" -lsfio "*)
4207                                 cat >> try.msg <<'EOQS'
4208 If $libs contains -lsfio, and sfio is mis-configured, then it
4209 sometimes (apparently) runs and exits with a 0 status, but with no
4210 output!  It may have to do with sfio's use of _exit vs. exit.
4211
4212 EOQS
4213                                 rp="You have a big problem.  Shall I abort Configure"
4214                                 dflt=y
4215                                 ;;
4216                         esac
4217                         ;;
4218                 esac
4219         else
4220                 echo "The program compiled OK, but exited with status $?." >>try.msg
4221                 rp="You have a problem.  Shall I abort Configure"
4222                 dflt=y
4223         fi
4224 else
4225         echo "I can't compile the test program." >>try.msg
4226         rp="You have a BIG problem.  Shall I abort Configure"
4227         dflt=y
4228 fi
4229 case "$dflt" in
4230 y)
4231         $cat try.msg >&4
4232         case "$knowitall" in
4233         '')
4234                 echo "(The supplied flags or libraries might be incorrect.)"
4235                 ;;
4236         *) dflt=n;;
4237         esac
4238         echo " "
4239         . ./myread
4240         case "$ans" in
4241         n*|N*) ;;
4242         *)      echo "Ok.  Stopping Configure." >&4
4243                 exit 1
4244                 ;;
4245         esac
4246         ;;
4247 n) echo "OK, that should do.";;
4248 esac
4249 $rm -f try try.* core
4250
4251 : define an is-a-typedef? function
4252 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4253 case "$inclist" in
4254 "") inclist="sys/types.h";;
4255 esac;
4256 eval "varval=\$$var";
4257 case "$varval" in
4258 "")
4259         $rm -f temp.c;
4260         for inc in $inclist; do
4261                 echo "#include <$inc>" >>temp.c;
4262         done;
4263         echo "#ifdef $type" >> temp.c;
4264         echo "printf(\"We have $type\");" >> temp.c;
4265         echo "#endif" >> temp.c;
4266         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4267         if $contains $type temp.E >/dev/null 2>&1; then
4268                 eval "$var=\$type";
4269         else
4270                 eval "$var=\$def";
4271         fi;
4272         $rm -f temp.?;;
4273 *) eval "$var=\$varval";;
4274 esac'
4275
4276 : define an is-a-typedef? function that prompts if the type is not available.
4277 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4278 case "$inclist" in
4279 "") inclist="sys/types.h";;
4280 esac;
4281 eval "varval=\$$var";
4282 case "$varval" in
4283 "")
4284         $rm -f temp.c;
4285         for inc in $inclist; do
4286                 echo "#include <$inc>" >>temp.c;
4287         done;
4288         echo "#ifdef $type" >> temp.c;
4289         echo "printf(\"We have $type\");" >> temp.c;
4290         echo "#endif" >> temp.c;
4291         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4292         echo " " ;
4293         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4294         if $contains $type temp.E >/dev/null 2>&1; then
4295                 echo "$type found." >&4;
4296                 eval "$var=\$type";
4297         else
4298                 echo "$type NOT found." >&4;
4299                 dflt="$def";
4300                 . ./myread ;
4301                 eval "$var=\$ans";
4302         fi;
4303         $rm -f temp.?;;
4304 *) eval "$var=\$varval";;
4305 esac'
4306
4307 : define a shorthand compile call
4308 compile='
4309 mc_file=$1;
4310 shift;
4311 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4312 : define a shorthand compile call for compilations that should be ok.
4313 compile_ok='
4314 mc_file=$1;
4315 shift;
4316 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4317
4318 : check for lengths of integral types
4319 echo " "
4320 case "$intsize" in
4321 '')
4322         echo "Checking to see how big your integers are..." >&4
4323         $cat >intsize.c <<'EOCP'
4324 #include <stdio.h>
4325 int main()
4326 {
4327         printf("intsize=%d;\n", (int)sizeof(int));
4328         printf("longsize=%d;\n", (int)sizeof(long));
4329         printf("shortsize=%d;\n", (int)sizeof(short));
4330         exit(0);
4331 }
4332 EOCP
4333         set intsize
4334         if eval $compile_ok && ./intsize > /dev/null; then
4335                 eval `./intsize`
4336                 echo "Your integers are $intsize bytes long."
4337                 echo "Your long integers are $longsize bytes long."
4338                 echo "Your short integers are $shortsize bytes long."
4339         else
4340                 $cat >&4 <<EOM
4341 !
4342 Help! I can't compile and run the intsize test program: please enlighten me!
4343 (This is probably a misconfiguration in your system or libraries, and
4344 you really ought to fix it.  Still, I'll try anyway.)
4345 !
4346 EOM
4347                 dflt=4
4348                 rp="What is the size of an integer (in bytes)?"
4349                 . ./myread
4350                 intsize="$ans"
4351                 dflt=$intsize
4352                 rp="What is the size of a long integer (in bytes)?"
4353                 . ./myread
4354                 longsize="$ans"
4355                 dflt=2
4356                 rp="What is the size of a short integer (in bytes)?"
4357                 . ./myread
4358                 shortsize="$ans"
4359         fi
4360         ;;
4361 esac
4362 $rm -f intsize intsize.*
4363
4364 : see what type lseek is declared as in the kernel
4365 rp="What is the type used for lseek's offset on this system?"
4366 set off_t lseektype long stdio.h sys/types.h
4367 eval $typedef_ask
4368
4369 echo " "
4370 echo "Checking to see how big your file offsets are..." >&4
4371 $cat >try.c <<EOCP
4372 #include <sys/types.h>
4373 #include <stdio.h>
4374 int main()
4375 {
4376     printf("%d\n", (int)sizeof($lseektype));
4377     return(0); 
4378 }
4379 EOCP
4380 set try
4381 if eval $compile_ok; then
4382         lseeksize=`./try`
4383         echo "Your file offsets are $lseeksize bytes long."
4384 else
4385         dflt=$longsize
4386         echo " "
4387         echo "(I can't seem to compile the test program.  Guessing...)"
4388         rp="What is the size of your file offsets (in bytes)?"
4389         . ./myread
4390         lseeksize="$ans"
4391 fi
4392 $rm -f try.c try
4393
4394 : see what type file positions are declared as in the library
4395 rp="What is the type for file position used by fsetpos()?"
4396 set fpos_t fpostype long stdio.h sys/types.h
4397 eval $typedef_ask
4398
4399 echo " "
4400 case "$fpostype" in
4401 *_t) zzz="$fpostype"    ;;
4402 *)   zzz="fpos_t"       ;;
4403 esac
4404 echo "Checking the size of $zzz..." >&4 
4405 cat > try.c <<EOCP
4406 #include <sys/types.h>
4407 #include <stdio.h>
4408 int main() {
4409     printf("%d\n", (int)sizeof($fpostype));
4410     exit(0);
4411 }
4412 EOCP
4413 set try
4414 if eval $compile_ok; then
4415         yyy=`./try`
4416         case "$yyy" in
4417         '')     fpossize=4
4418                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4419                 ;;
4420         *)      fpossize=$yyy
4421                 echo "Your $zzz is $fpossize bytes long."
4422                 ;;
4423         esac
4424 else
4425         dflt="$longsize"
4426         echo " " >&4
4427         echo "(I can't compile the test program.  Guessing...)" >&4
4428         rp="What is the size of your file positions (in bytes)?"
4429         . ./myread
4430         fpossize="$ans"
4431 fi
4432
4433
4434
4435 # Backward compatibility (uselfs is deprecated).
4436 case "$uselfs" in
4437 "$define"|true|[yY]*)
4438         cat <<EOM >&4
4439
4440 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4441 EOM
4442         uselargefiles="$define"
4443         ;;
4444 esac                          
4445
4446 case "$lseeksize:$fpossize" in
4447 8:8) cat <<EOM
4448
4449 You can have files larger than 2 gigabytes.
4450 EOM
4451    val="$define" ;;
4452 *)    case "$uselargefiles" in
4453    "$undef"|false|[nN]*) dflt='n' ;;
4454    *)   dflt='y' ;;
4455    esac
4456    cat <<EOM
4457
4458 Perl can be built to understand large files (files larger than 2 gigabytes)
4459 on some systems.  To do so, Configure can be run with -Duselargefiles.
4460
4461 If this doesn't make any sense to you, just accept the default '$dflt'.
4462 EOM
4463    rp='Try to understand large files, if available?'
4464    . ./myread
4465    case "$ans" in
4466    y|Y)         val="$define" ;;
4467    *)           val="$undef"  ;;
4468    esac
4469    ;;
4470 esac
4471 set uselargefiles
4472 eval $setvar
4473 case "$uselargefiles" in
4474 "$define")
4475 : Look for a hint-file generated 'call-back-unit'.  If the
4476 : user has specified that a large files perl is to be built,
4477 : we may need to set or change some other defaults.
4478         if $test -f uselargefiles.cbu; then
4479                 echo "Your platform has some specific hints for large file builds, using them..."
4480                 . ./uselargefiles.cbu
4481                 echo " "
4482                 echo "Rechecking to see how big your file offsets are..." >&4
4483                 $cat >try.c <<EOCP
4484 #include <sys/types.h>
4485 #include <stdio.h>
4486 int main()
4487 {
4488     printf("%d\n", (int)sizeof($lseektype));
4489     return(0); 
4490 }
4491 EOCP
4492                 set try
4493                 if eval $compile_ok; then
4494                         lseeksize=`./try`
4495                         $echo "Your file offsets are now $lseeksize bytes long."
4496                 else
4497                         dflt="$lseeksize"
4498                         echo " "
4499                         echo "(I can't seem to compile the test program.  Guessing...)"
4500                         rp="What is the size of your file offsets (in bytes)?"
4501                         . ./myread
4502                         lseeksize="$ans"
4503                 fi
4504                 case "$fpostype" in
4505                 *_t) zzz="$fpostype"    ;;
4506                 *)   zzz="fpos_t"       ;;
4507                 esac
4508                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4509                 $cat > try.c <<EOCP
4510 #include <sys/types.h>
4511 #include <stdio.h>
4512 int main() {
4513     printf("%d\n", (int)sizeof($fpostype));
4514     exit(0);
4515 }
4516 EOCP
4517                 set try
4518                 if eval $compile_ok; then
4519                         yyy=`./try`
4520                         dflt="$lseeksize"
4521                         case "$yyy" in
4522                         '')     echo " "
4523                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4524                                 ;;
4525                         *)      fpossize=$yyy
4526                                 echo " $fpossize bytes." >&4
4527                                 ;;
4528                         esac
4529                 else
4530                         dflt="$fpossize"
4531                         echo " "
4532                         echo "(I can't compile the test program.  Guessing...)" >&4
4533                         rp="What is the size of your file positions (in bytes)?"
4534                         . ./myread
4535                         fpossize="$ans"
4536                 fi
4537                 $rm -f try.c try
4538         fi
4539         ;;
4540 esac
4541
4542
4543 case "$usemorebits" in
4544 "$define"|true|[yY]*)
4545         use64bitint="$define"
4546         uselongdouble="$define"
4547         usemorebits="$define"
4548         ;;
4549 *)      usemorebits="$undef"
4550         ;;
4551 esac
4552
4553 : check for void type
4554 echo " "
4555 echo "Checking to see how well your C compiler groks the void type..." >&4
4556 case "$voidflags" in
4557 '')
4558         $cat >try.c <<'EOCP'
4559 #if TRY & 1
4560 void sub() {
4561 #else
4562 sub() {
4563 #endif
4564         extern void moo();      /* function returning void */
4565         void (*goo)();          /* ptr to func returning void */
4566 #if TRY & 8
4567         void *hue;              /* generic ptr */
4568 #endif
4569 #if TRY & 2
4570         void (*foo[10])();
4571 #endif
4572
4573 #if TRY & 4
4574         if(goo == moo) {
4575                 exit(0);
4576         }
4577 #endif
4578         exit(0);
4579 }
4580 int main() { sub(); }
4581 EOCP
4582         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4583                 voidflags=$defvoidused
4584         echo "Good.  It appears to support void to the level $package wants.">&4
4585                 if $contains warning .out >/dev/null 2>&1; then
4586                         echo "However, you might get some warnings that look like this:"
4587                         $cat .out
4588                 fi
4589         else
4590 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4591                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4592                         echo "It supports 1..."
4593                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4594                                 echo "It also supports 2..."
4595                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4596                                         voidflags=7
4597                                         echo "And it supports 4 but not 8 definitely."
4598                                 else
4599                                         echo "It doesn't support 4..."
4600                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4601                                                 voidflags=11
4602                                                 echo "But it supports 8."
4603                                         else
4604                                                 voidflags=3
4605                                                 echo "Neither does it support 8."
4606                                         fi
4607                                 fi
4608                         else
4609                                 echo "It does not support 2..."
4610                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4611                                         voidflags=13
4612                                         echo "But it supports 4 and 8."
4613                                 else
4614                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4615                                                 voidflags=5
4616                                                 echo "And it supports 4 but has not heard about 8."
4617                                         else
4618                                                 echo "However it supports 8 but not 4."
4619                                         fi
4620                                 fi
4621                         fi
4622                 else
4623                         echo "There is no support at all for void."
4624                         voidflags=0
4625                 fi
4626         fi
4627 esac
4628 case "$voidflags" in
4629 "$defvoidused") ;;
4630 *)      $cat >&4 <<'EOM'
4631   Support flag bits are:
4632     1: basic void declarations.
4633     2: arrays of pointers to functions returning void.
4634     4: operations between pointers to and addresses of void functions.
4635     8: generic void pointers.
4636 EOM
4637         dflt="$voidflags";
4638         rp="Your void support flags add up to what?"
4639         . ./myread
4640         voidflags="$ans"
4641         ;;
4642 esac
4643 $rm -f try.* .out
4644
4645 : check for length of pointer
4646 echo " "
4647 case "$ptrsize" in
4648 '')
4649         echo "Checking to see how big your pointers are..." >&4
4650         if test "$voidflags" -gt 7; then
4651                 echo '#define VOID_PTR char *' > try.c
4652         else
4653                 echo '#define VOID_PTR void *' > try.c
4654         fi
4655         $cat >>try.c <<'EOCP'
4656 #include <stdio.h>
4657 int main()
4658 {
4659     printf("%d\n", (int)sizeof(VOID_PTR));
4660     exit(0);
4661 }
4662 EOCP
4663         set try
4664         if eval $compile_ok; then
4665                 ptrsize=`./try`
4666                 echo "Your pointers are $ptrsize bytes long."
4667         else
4668                 dflt='4'
4669                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4670                 rp="What is the size of a pointer (in bytes)?"
4671                 . ./myread
4672                 ptrsize="$ans"
4673         fi
4674         ;;
4675 esac
4676 $rm -f try.c try
4677
4678 : check for long long
4679 echo " "
4680 echo "Checking to see if you have long long..." >&4
4681 echo 'int main() { long long x = 7; return 0; }' > try.c
4682 set try
4683 if eval $compile; then
4684         val="$define"
4685         echo "You have long long."
4686 else
4687         val="$undef"
4688         echo "You do not have long long."
4689 fi
4690 $rm try.*
4691 set d_longlong
4692 eval $setvar
4693
4694 : check for length of long long
4695 case "${d_longlong}${longlongsize}" in
4696 $define)
4697         echo " "
4698         echo "Checking to see how big your long longs are..." >&4
4699         $cat >try.c <<'EOCP'
4700 #include <stdio.h>
4701 int main()
4702 {
4703     printf("%d\n", (int)sizeof(long long));
4704     return(0);
4705 }
4706 EOCP
4707         set try
4708         if eval $compile_ok; then
4709                 longlongsize=`./try$exe_ext`
4710                 echo "Your long longs are $longlongsize bytes long."
4711         else
4712                 dflt='8'
4713                 echo " "
4714                 echo "(I can't seem to compile the test program.  Guessing...)"
4715                 rp="What is the size of a long long (in bytes)?"
4716                 . ./myread
4717                 longlongsize="$ans"
4718         fi
4719         if $test "X$longsize" = "X$longlongsize"; then
4720                 echo "(That isn't any different from an ordinary long.)"
4721         fi      
4722         ;;
4723 esac
4724 $rm -f try.* try
4725
4726 : determine filename position in cpp output
4727 echo " "
4728 echo "Computing filename position in cpp output for #include directives..." >&4
4729 echo '#include <stdio.h>' > foo.c
4730 $cat >fieldn <<EOF
4731 $startsh
4732 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4733 $grep '^[       ]*#.*stdio\.h' | \
4734 while read cline; do
4735         pos=1
4736         set \$cline
4737         while $test \$# -gt 0; do
4738                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4739                         echo "\$pos"
4740                         exit 0
4741                 fi
4742                 shift
4743                 pos=\`expr \$pos + 1\`
4744         done
4745 done
4746 EOF
4747 chmod +x fieldn
4748 fieldn=`./fieldn`
4749 $rm -f foo.c fieldn
4750 case $fieldn in
4751 '') pos='???';;
4752 1) pos=first;;
4753 2) pos=second;;
4754 3) pos=third;;
4755 *) pos="${fieldn}th";;
4756 esac
4757 echo "Your cpp writes the filename in the $pos field of the line."
4758
4759 : locate header file
4760 $cat >findhdr <<EOF
4761 $startsh
4762 wanted=\$1
4763 name=''
4764 for usrincdir in $usrinc
4765 do
4766         if test -f \$usrincdir/\$wanted; then
4767                 echo "\$usrincdir/\$wanted"
4768                 exit 0
4769         fi
4770 done
4771 awkprg='{ print \$$fieldn }'
4772 echo "#include <\$wanted>" > foo\$\$.c
4773 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4774 $grep "^[       ]*#.*\$wanted" | \
4775 while read cline; do
4776         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4777         case "\$name" in
4778         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4779         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4780         *) exit 2;;
4781         esac;
4782 done;
4783 #
4784 # status = 0: grep returned 0 lines, case statement not executed
4785 # status = 1: headerfile found
4786 # status = 2: while loop executed, no headerfile found
4787 #
4788 status=\$?
4789 $rm -f foo\$\$.c;
4790 if test \$status -eq 1; then
4791         exit 0;
4792 fi
4793 exit 1
4794 EOF
4795 chmod +x findhdr
4796
4797 : define an alternate in-header-list? function
4798 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4799 cont=true; xxf="echo \"<\$1> found.\" >&4";
4800 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4801 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4802 esac;
4803 case $# in 4) instead=instead;; *) instead="at last";; esac;
4804 while $test "$cont"; do
4805         xxx=`./findhdr $1`
4806         var=$2; eval "was=\$$2";
4807         if $test "$xxx" && $test -r "$xxx";
4808         then eval $xxf;
4809         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4810                 cont="";
4811         else eval $xxnf;
4812         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4813         set $yyy; shift; shift; yyy=$@;
4814         case $# in 0) cont="";;
4815         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4816                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4817         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4818                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4819         esac;
4820 done;
4821 while $test "$yyy";
4822 do set $yyy; var=$2; eval "was=\$$2";
4823         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4824         set $yyy; shift; shift; yyy=$@;
4825 done'
4826
4827 : see if inttypes.h is available
4828 : we want a real compile instead of Inhdr because some systems
4829 : have an inttypes.h which includes non-existent headers
4830 echo " "
4831 $cat >try.c <<EOCP
4832 #include <inttypes.h>
4833 int main() {
4834         static int32_t foo32 = 0x12345678;
4835 }
4836 EOCP
4837 set try
4838 if eval $compile; then
4839         echo "<inttypes.h> found." >&4
4840         val="$define"
4841 else
4842         echo "<inttypes.h> NOT found." >&4
4843         val="$undef"
4844 fi
4845 $rm -f try.c try
4846 set i_inttypes
4847 eval $setvar
4848
4849 : check for int64_t
4850 echo " "
4851 echo "Checking to see if you have int64_t..." >&4
4852 $cat >try.c <<EOCP
4853 #include <sys/types.h>
4854 #$i_inttypes I_INTTYPES
4855 #ifdef I_INTTYPES
4856 #include <inttypes.h>
4857 #endif
4858 int main() { int64_t x = 7; }
4859 EOCP
4860 set try
4861 if eval $compile; then
4862         val="$define"
4863         echo "You have int64_t."
4864 else
4865         val="$undef"
4866         echo "You do not have int64_t."
4867 fi
4868 $rm -f try try.*
4869 set d_int64_t
4870 eval $setvar
4871
4872
4873 echo " "
4874 echo "Checking which 64-bit integer type we could use..." >&4
4875
4876 case "$intsize" in
4877 8) val=int
4878    set quadtype
4879    eval $setvar
4880    val='"unsigned int"'
4881    set uquadtype
4882    eval $setvar
4883    quadkind=1
4884    ;;
4885 *) case "$longsize" in
4886    8) val=long
4887       set quadtype
4888       eval $setvar
4889       val='"unsigned long"'
4890       set uquadtype
4891       eval $setvar
4892       quadkind=2
4893       ;;
4894    *) case "$d_longlong:$longlongsize" in
4895       define:8)
4896         val='"long long"'
4897         set quadtype
4898         eval $setvar
4899         val='"unsigned long long"'
4900         set uquadtype
4901         eval $setvar
4902         quadkind=3
4903         ;;
4904       *) case "$d_int64_t" in
4905          define)
4906            val=int64_t
4907            set quadtype
4908            eval $setvar
4909            val=uint64_t
4910            set uquadtype
4911            eval $setvar
4912            quadkind=4
4913            ;;
4914          esac
4915          ;;
4916       esac
4917       ;;
4918    esac
4919    ;;
4920 esac
4921
4922 case "$quadtype" in
4923 '')     echo "Alas, no 64-bit integer types in sight." >&4
4924         d_quad="$undef"
4925         ;;
4926 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4927         d_quad="$define"
4928         ;;
4929 esac
4930
4931
4932 case "$uselonglong" in
4933 "$define"|true|[yY]*)
4934         cat <<EOM >&4
4935
4936 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4937 EOM
4938         use64bitint="$define"
4939         ;;
4940 esac                          
4941 case "$use64bits" in
4942 "$define"|true|[yY]*)
4943         cat <<EOM >&4
4944
4945 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4946 EOM
4947         use64bitint="$define"
4948         ;;
4949 esac                          
4950 case "$use64bitints" in
4951 "$define"|true|[yY]*)
4952         cat <<EOM >&4
4953
4954 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4955 EOM
4956         use64bitint="$define"
4957         ;;
4958 esac                          
4959 case "$use64bitsint" in
4960 "$define"|true|[yY]*)
4961         cat <<EOM >&4
4962
4963 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4964 EOM
4965         use64bitint="$define"
4966         ;;
4967 esac                          
4968 case "$uselonglongs" in
4969 "$define"|true|[yY]*)
4970         cat <<EOM >&4
4971
4972 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4973 EOM
4974         use64bitint="$define"
4975         ;;
4976 esac                          
4977 case "$use64bitsall" in
4978 "$define"|true|[yY]*)
4979         cat <<EOM >&4
4980
4981 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4982 EOM
4983         use64bitall="$define"
4984         ;;
4985 esac                          
4986
4987 case "$ccflags" in
4988 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4989 esac
4990 case "$use64bitall" in
4991 "$define"|true|[yY]*) use64bitint="$define" ;;
4992 esac
4993
4994 case "$longsize" in
4995 8) cat <<EOM
4996
4997 You have natively 64-bit long integers.
4998 EOM
4999    val="$define"
5000    ;;
5001 *) case "$use64bitint" in
5002    "$define"|true|[yY]*) dflt='y';;
5003    *) dflt='n';;
5004    esac
5005    case "$d_quad" in
5006    "$define") ;;
5007    *) dflt='n' ;;
5008    esac
5009    cat <<EOM
5010
5011 Perl can be built to take advantage of 64-bit integer types
5012 on some systems.  To do so, Configure can be run with -Duse64bitint.
5013 Choosing this option will most probably introduce binary incompatibilities.
5014
5015 If this doesn't make any sense to you, just accept the default '$dflt'.
5016 (The default has been chosen based on your configuration.)
5017 EOM
5018    rp='Try to use 64-bit integers, if available?'
5019    . ./myread
5020    case "$ans" in
5021    [yY]*) val="$define" ;;
5022    *)     val="$undef"  ;;
5023    esac
5024    ;;
5025 esac
5026 set use64bitint
5027 eval $setvar
5028
5029 case "$use64bitall" in
5030 "$define"|true|[yY]*) dflt='y' ;;
5031 *) case "$longsize" in
5032    8) dflt='y' ;;
5033    *) dflt='n' ;;
5034    esac
5035    ;;
5036 esac    
5037 cat <<EOM
5038
5039 You may also choose to try maximal 64-bitness.  It means using as much
5040 64-bitness as possible on the platform.  This in turn means even more
5041 binary incompatibilities.  On the other hand, your platform may not
5042 have any more 64-bitness available than what you already have chosen.
5043
5044 If this doesn't make any sense to you, just accept the default '$dflt'.
5045 (The default has been chosen based on your configuration.)
5046 EOM
5047 rp='Try to use maximal 64-bit support, if available?'
5048 . ./myread
5049 case "$ans" in
5050 [yY]*) val="$define" ;;
5051 *)     val="$undef"  ;;
5052 esac
5053 set use64bitall
5054 eval $setvar
5055 case "$use64bitall" in
5056 "$define")
5057         case "$use64bitint" in
5058         "$undef")
5059                 cat <<EOM
5060
5061 Since you have chosen a maximally 64-bit build, I'm also turning on
5062 the use of 64-bit integers.
5063 EOM
5064                 use64bitint="$define" ;;
5065         esac
5066         ;;
5067 esac
5068
5069 case "$use64bitall" in
5070 "$define"|true|[yY]*)
5071         case "$ptrsize" in
5072         4)      cat <<EOM >&4
5073
5074 *** You have chosen a maximally 64-bit build, but your pointers
5075 *** are only 4 bytes wide, disabling maximal 64-bitness.
5076
5077 EOM
5078                 use64bitall="$undef"
5079                 case "$use64bitint" in
5080                 "$define"|true|[yY]*) ;;
5081                 *)      cat <<EOM >&4
5082
5083 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5084
5085 EOM
5086                         use64bitint="$define"
5087                         ;;
5088                 esac
5089                 ;;
5090         esac
5091         ;;
5092 esac
5093
5094 case "$use64bitint" in
5095 "$define"|true|[yY]*)
5096 : Look for a hint-file generated 'call-back-unit'.  If the
5097 : user has specified that a 64-bit perl is to be built,
5098 : we may need to set or change some other defaults.
5099         if $test -f use64bitint.cbu; then
5100                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5101                 . ./use64bitint.cbu
5102         fi
5103         case "$longsize" in
5104         4) case "$archname64" in
5105            '') archname64=64int ;;
5106            esac
5107            ;;
5108         esac
5109         ;;
5110 esac
5111
5112 case "$use64bitall" in
5113 "$define"|true|[yY]*)
5114 : Look for a hint-file generated 'call-back-unit'.  If the
5115 : user has specified that a maximally 64-bit perl is to be built,
5116 : we may need to set or change some other defaults.
5117         if $test -f use64bitall.cbu; then
5118                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5119                 . ./use64bitall.cbu
5120         fi
5121         case "$longsize" in
5122         4) case "$archname64" in
5123            ''|64int) archname64=64all ;;
5124            esac
5125            ;;
5126         esac
5127         ;;
5128 esac
5129
5130 echo " "
5131 echo "Checking for GNU C Library..." >&4
5132 cat >gnulibc.c <<EOM
5133 #include <stdio.h>
5134 int main()
5135 {
5136 #ifdef __GLIBC__
5137     exit(0);
5138 #else
5139     exit(1);
5140 #endif
5141 }
5142 EOM
5143 set gnulibc
5144 if eval $compile_ok && ./gnulibc; then
5145         val="$define"
5146         echo "You are using the GNU C Library"
5147 else
5148         val="$undef"
5149         echo "You are not using the GNU C Library"
5150 fi
5151 $rm -f gnulibc*
5152 set d_gnulibc
5153 eval $setvar
5154
5155 : see if nm is to be used to determine whether a symbol is defined or not
5156 case "$usenm" in
5157 '')
5158         dflt=''
5159         case "$d_gnulibc" in
5160         "$define")
5161                 echo " "
5162                 echo "nm probably won't work on the GNU C Library." >&4
5163                 dflt=n
5164                 ;;
5165         esac
5166         case "$dflt" in
5167         '') 
5168                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5169                         echo " "
5170                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5171                         echo "'nm' won't be sufficient on this sytem." >&4
5172                         dflt=n
5173                 fi
5174                 ;;
5175         esac
5176         case "$dflt" in
5177         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5178                 if $test $dflt -gt 20; then
5179                         dflt=y
5180                 else
5181                         dflt=n
5182                 fi
5183                 ;;
5184         esac
5185         ;;
5186 *)
5187         case "$usenm" in
5188         true|$define) dflt=y;;
5189         *) dflt=n;;
5190         esac
5191         ;;
5192 esac
5193 $cat <<EOM
5194
5195 I can use $nm to extract the symbols from your C libraries. This
5196 is a time consuming task which may generate huge output on the disk (up
5197 to 3 megabytes) but that should make the symbols extraction faster. The
5198 alternative is to skip the 'nm' extraction part and to compile a small
5199 test program instead to determine whether each symbol is present. If
5200 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5201 this may be the best solution.
5202
5203 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5204
5205 EOM
5206 rp="Shall I use $nm to extract C symbols from the libraries?"
5207 . ./myread
5208 case "$ans" in
5209 [Nn]*) usenm=false;;
5210 *) usenm=true;;
5211 esac
5212
5213 runnm=$usenm
5214 case "$reuseval" in
5215 true) runnm=false;;
5216 esac
5217
5218 : nm options which may be necessary
5219 case "$nm_opt" in
5220 '') if $test -f /mach_boot; then
5221                 nm_opt=''       # Mach
5222         elif $test -d /usr/ccs/lib; then
5223                 nm_opt='-p'     # Solaris (and SunOS?)
5224         elif $test -f /dgux; then
5225                 nm_opt='-p'     # DG-UX
5226         elif $test -f /lib64/rld; then
5227                 nm_opt='-p'     # 64-bit Irix
5228         else
5229                 nm_opt=''
5230         fi;;
5231 esac
5232
5233 : nm options which may be necessary for shared libraries but illegal
5234 : for archive libraries.  Thank you, Linux.
5235 case "$nm_so_opt" in
5236 '')     case "$myuname" in
5237         *linux*)
5238                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5239                         nm_so_opt='--dynamic'
5240                 fi
5241                 ;;
5242         esac
5243         ;;
5244 esac
5245
5246 case "$runnm" in
5247 true)
5248 : get list of predefined functions in a handy place
5249 echo " "
5250 case "$libc" in
5251 '') libc=unknown
5252         case "$libs" in
5253         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5254         esac
5255         ;;
5256 esac
5257 libnames='';
5258 case "$libs" in
5259 '') ;;
5260 *)  for thislib in $libs; do
5261         case "$thislib" in
5262         -lc|-lc_s)
5263                 : Handle C library specially below.
5264                 ;;
5265         -l*)
5266                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5267                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5268                         :
5269                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5270                         :
5271                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5272                         :
5273                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5274                         :
5275                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5276                         :
5277                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5278                         :
5279                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5280                         :
5281                 else
5282                         try=''
5283                 fi
5284                 libnames="$libnames $try"
5285                 ;;
5286         *) libnames="$libnames $thislib" ;;
5287         esac
5288         done
5289         ;;
5290 esac
5291 xxx=normal
5292 case "$libc" in
5293 unknown)
5294         set /lib/libc.$so
5295         for xxx in $libpth; do
5296                 $test -r $1 || set $xxx/libc.$so
5297                 : The messy sed command sorts on library version numbers.
5298                 $test -r $1 || \
5299                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5300                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5301                                 h
5302                                 s/[0-9][0-9]*/0000&/g
5303                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5304                                 G
5305                                 s/\n/ /' | \
5306                          $sort | $sed -e 's/^.* //'`
5307                 eval set \$$#
5308         done
5309         $test -r $1 || set /usr/ccs/lib/libc.$so
5310         $test -r $1 || set /lib/libsys_s$_a
5311         ;;
5312 *)
5313         set blurfl
5314         ;;
5315 esac
5316 if $test -r "$1"; then
5317         echo "Your (shared) C library seems to be in $1."
5318         libc="$1"
5319 elif $test -r /lib/libc && $test -r /lib/clib; then
5320         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5321         xxx=apollo
5322         libc='/lib/clib /lib/libc'
5323         if $test -r /lib/syslib; then
5324                 echo "(Your math library is in /lib/syslib.)"
5325                 libc="$libc /lib/syslib"
5326         fi
5327 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5328         echo "Your C library seems to be in $libc, as you said before."
5329 elif $test -r $incpath/usr/lib/libc$_a; then
5330         libc=$incpath/usr/lib/libc$_a;
5331         echo "Your C library seems to be in $libc.  That's fine."
5332 elif $test -r /lib/libc$_a; then
5333         libc=/lib/libc$_a;
5334         echo "Your C library seems to be in $libc.  You're normal."
5335 else
5336         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5337                 :
5338         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5339                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5340         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5341                 :
5342         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5343                 :
5344         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5345                 :
5346         else
5347                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5348         fi
5349         if $test -r "$tans"; then
5350                 echo "Your C library seems to be in $tans, of all places."
5351                 libc=$tans
5352         else
5353                 libc='blurfl'
5354         fi
5355 fi
5356 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5357         dflt="$libc"
5358         cat <<EOM
5359
5360 If the guess above is wrong (which it might be if you're using a strange
5361 compiler, or your machine supports multiple models), you can override it here.
5362
5363 EOM
5364 else
5365         dflt=''
5366         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5367         cat >&4 <<EOM
5368 I can't seem to find your C library.  I've looked in the following places:
5369
5370 EOM
5371         $sed 's/^/      /' libpath
5372         cat <<EOM
5373
5374 None of these seems to contain your C library. I need to get its name...
5375
5376 EOM
5377 fi
5378 fn=f
5379 rp='Where is your C library?'
5380 . ./getfile
5381 libc="$ans"
5382
5383 echo " "
5384 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5385 set X `cat libnames`
5386 shift
5387 xxx=files
5388 case $# in 1) xxx=file; esac
5389 echo "Extracting names from the following $xxx for later perusal:" >&4
5390 echo " "
5391 $sed 's/^/      /' libnames >&4
5392 echo " "
5393 $echo $n "This may take a while...$c" >&4
5394
5395 for file in $*; do
5396         case $file in
5397         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5398         *) $nm $nm_opt $file 2>/dev/null;;
5399         esac
5400 done >libc.tmp
5401
5402 $echo $n ".$c"
5403 $grep fprintf libc.tmp > libc.ptf
5404 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5405 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5406 xxx='[ADTSIW]'
5407 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5408         eval $xscan;\
5409         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5410                 eval $xrun
5411 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5412         eval $xscan;\
5413         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5414                 eval $xrun
5415 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5416         eval $xscan;\
5417         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5418                 eval $xrun
5419 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5420         eval $xscan;\
5421         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5422                 eval $xrun
5423 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5424         eval $xscan;\
5425         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5426                 eval $xrun
5427 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5428         eval $xscan;\
5429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5430                 eval $xrun
5431 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5432                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5433         eval $xscan;\
5434         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5435                 eval $xrun
5436 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5437         eval $xscan;\
5438         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5439                 eval $xrun
5440 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5441         eval $xscan;\
5442         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5443                 eval $xrun
5444 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5445         eval $xscan;\
5446         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5447                 eval $xrun
5448 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5449         eval $xscan;\
5450         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5451                 eval $xrun
5452 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5453         eval $xscan;\
5454         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5455                 eval $xrun
5456 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5457         eval $xscan;\
5458         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5459                 eval $xrun
5460 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5461         eval $xscan;\
5462         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5463                 eval $xrun
5464 else
5465         $nm -p $* 2>/dev/null >libc.tmp
5466         $grep fprintf libc.tmp > libc.ptf
5467         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5468                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5469         then
5470                 nm_opt='-p'
5471                 eval $xrun
5472         else
5473                 echo " "
5474                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5475                 com=''
5476                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5477                         for thisname in $libnames $libc; do
5478                                 $ar t $thisname >>libc.tmp
5479                         done
5480                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5481                         echo "Ok." >&4
5482                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5483                         # Repeat libc to extract forwarders to DLL entries too
5484                         for thisname in $libnames $libc; do
5485                                 $ar tv $thisname >>libc.tmp
5486                                 # Revision 50 of EMX has bug in $ar.
5487                                 # it will not extract forwarders to DLL entries
5488                                 # Use emximp which will extract exactly them.
5489                                 emximp -o tmp.imp $thisname \
5490                                     2>/dev/null && \
5491                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5492                                     < tmp.imp >>libc.tmp
5493                                 $rm tmp.imp
5494                         done
5495                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5496                         echo "Ok." >&4
5497                 else
5498                         echo "$ar didn't seem to work right." >&4
5499                         echo "Maybe this is a Cray...trying bld instead..." >&4
5500                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5501                         then
5502                                 for thisname in $libnames; do
5503                                         bld t $libnames | \
5504                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5505                                         $ar t $thisname >>libc.tmp
5506                                 done
5507                                 echo "Ok." >&4
5508                         else
5509                                 echo "That didn't work either.  Giving up." >&4
5510                                 exit 1
5511                         fi
5512                 fi
5513         fi
5514 fi
5515 nm_extract="$com"
5516 if $test -f /lib/syscalls.exp; then
5517         echo " "
5518         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5519         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5520 fi
5521 ;;
5522 esac
5523 $rm -f libnames libpath
5524
5525 : is a C symbol defined?
5526 csym='tlook=$1;
5527 case "$3" in
5528 -v) tf=libc.tmp; tc=""; tdc="";;
5529 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5530 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5531 esac;
5532 tx=yes;
5533 case "$reuseval-$4" in
5534 true-) ;;
5535 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5536 esac;
5537 case "$tx" in
5538 yes)
5539         case "$runnm" in
5540         true)
5541                 if $contains $tlook $tf >/dev/null 2>&1;
5542                 then tval=true;
5543                 else tval=false;
5544                 fi;;
5545         *)
5546                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5547                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5548                 then tval=true;
5549                 else tval=false;
5550                 fi;
5551                 $rm -f t t.c;;
5552         esac;;
5553 *)
5554         case "$tval" in
5555         $define) tval=true;;
5556         *) tval=false;;
5557         esac;;
5558 esac;
5559 eval "$2=$tval"'
5560
5561 : define an is-in-libc? function
5562 inlibc='echo " "; td=$define; tu=$undef;
5563 sym=$1; var=$2; eval "was=\$$2";
5564 tx=yes;
5565 case "$reuseval$was" in
5566 true) ;;
5567 true*) tx=no;;
5568 esac;
5569 case "$tx" in
5570 yes)
5571         set $sym tres -f;
5572         eval $csym;
5573         case "$tres" in
5574         true)
5575                 echo "$sym() found." >&4;
5576                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5577         *)
5578                 echo "$sym() NOT found." >&4;
5579                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5580         esac;;
5581 *)
5582         case "$was" in
5583         $define) echo "$sym() found." >&4;;
5584         *) echo "$sym() NOT found." >&4;;
5585         esac;;
5586 esac'
5587
5588 : see if sqrtl exists
5589 set sqrtl d_sqrtl
5590 eval $inlibc
5591
5592 case "$ccflags" in
5593 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5594 esac
5595
5596 case "$uselongdouble" in
5597 $define|true|[yY]*)     dflt='y';;
5598 *) dflt='n';;
5599 esac
5600 cat <<EOM
5601
5602 Perl can be built to take advantage of long doubles which
5603 (if available) may give more accuracy and range for floating point numbers.
5604
5605 If this doesn't make any sense to you, just accept the default '$dflt'.
5606 EOM
5607 rp='Try to use long doubles if available?'
5608 . ./myread
5609 case "$ans" in
5610 y|Y)    val="$define"   ;;
5611 *)      val="$undef"    ;;
5612 esac
5613 set uselongdouble
5614 eval $setvar
5615
5616 case "$uselongdouble" in
5617 true|[yY]*) uselongdouble="$define" ;;
5618 esac
5619
5620 case "$uselongdouble" in
5621 $define)
5622 : Look for a hint-file generated 'call-back-unit'.  If the
5623 : user has specified that long doubles should be used,
5624 : we may need to set or change some other defaults.
5625         if $test -f uselongdouble.cbu; then
5626                 echo "Your platform has some specific hints for long doubles, using them..."
5627                 . ./uselongdouble.cbu
5628         else
5629                 $cat <<EOM
5630 (Your platform doesn't have any specific hints for long doubles.)
5631 EOM
5632         fi
5633         ;;
5634 esac
5635
5636 case "$uselongdouble:$d_sqrtl" in
5637 $define:$undef)
5638                 $cat <<EOM >&4
5639
5640 *** You requested the use of long doubles but you do not seem to have
5641 *** the mathematic functions for long doubles.  I'm disabling the use
5642 *** of long doubles.
5643
5644 EOM
5645         uselongdouble=$undef
5646         ;;
5647 esac
5648
5649 : check for length of double
5650 echo " "
5651 case "$doublesize" in
5652 '')
5653         echo "Checking to see how big your double precision numbers are..." >&4
5654         $cat >try.c <<'EOCP'
5655 #include <stdio.h>
5656 int main()
5657 {
5658     printf("%d\n", (int)sizeof(double));
5659     exit(0);
5660 }
5661 EOCP
5662         set try
5663         if eval $compile_ok; then
5664                 doublesize=`./try`
5665                 echo "Your double is $doublesize bytes long."
5666         else
5667                 dflt='8'
5668                 echo "(I can't seem to compile the test program.  Guessing...)"
5669                 rp="What is the size of a double precision number (in bytes)?"
5670                 . ./myread
5671                 doublesize="$ans"
5672         fi
5673         ;;
5674 esac
5675 $rm -f try.c try
5676
5677 : check for long doubles
5678 echo " "
5679 echo "Checking to see if you have long double..." >&4
5680 echo 'int main() { long double x = 7.0; }' > try.c
5681 set try
5682 if eval $compile; then
5683         val="$define"
5684         echo "You have long double."
5685 else
5686         val="$undef"
5687         echo "You do not have long double."
5688 fi
5689 $rm try.*
5690 set d_longdbl
5691 eval $setvar
5692
5693 : check for length of long double
5694 case "${d_longdbl}${longdblsize}" in
5695 $define)
5696         echo " "
5697         echo "Checking to see how big your long doubles are..." >&4
5698         $cat >try.c <<'EOCP'
5699 #include <stdio.h>
5700 int main()
5701 {
5702         printf("%d\n", sizeof(long double));
5703 }
5704 EOCP
5705         set try
5706         set try
5707         if eval $compile; then
5708                 longdblsize=`./try$exe_ext`
5709                 echo "Your long doubles are $longdblsize bytes long."
5710         else
5711                 dflt='8'
5712                 echo " "
5713                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5714                 rp="What is the size of a long double (in bytes)?"
5715                 . ./myread
5716                 longdblsize="$ans"
5717         fi
5718         if $test "X$doublesize" = "X$longdblsize"; then
5719                 echo "(That isn't any different from an ordinary double.)"
5720         fi      
5721         ;;
5722 esac
5723 $rm -f try.* try
5724
5725 case "$useperlio" in
5726 $define|true|[yY]*|'')  dflt='y';;
5727 *) dflt='n';;
5728 esac
5729 cat <<EOM
5730
5731 Previous version of $package used the standard IO mechanisms as
5732 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5733 alternate IO mechanisms via the PerlIO abstraction layer, but the
5734 stdio mechanism is still available if needed.  The abstraction layer
5735 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5736 Using PerlIO with sfio may cause problems with some extension modules.
5737
5738 If this doesn't make any sense to you, just accept the default '$dflt'.
5739 EOM
5740 rp='Use the PerlIO abstraction layer?'
5741 . ./myread
5742 case "$ans" in
5743 y|Y) 
5744         val="$define"
5745         ;;
5746 *)      
5747         echo "Ok, doing things the stdio way."
5748         val="$undef"
5749         ;;
5750 esac
5751 set useperlio
5752 eval $setvar 
5753
5754 case "$usesocks" in
5755 $define|true|[yY]*)
5756         case "$useperlio" in
5757         $define|true|[yY]*) ;;
5758         *)      cat >&4 <<EOM
5759
5760 You are using the SOCKS proxy protocol library which means that you
5761 should also use the PerlIO layer.  You may be headed for trouble.
5762
5763 EOM
5764                 ;;
5765         esac
5766         ;;
5767 esac
5768
5769         
5770 : determine the architecture name
5771 echo " "
5772 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5773         tarch=`arch`"-$osname"
5774 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5775         if uname -m > tmparch 2>&1 ; then
5776                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5777                         -e 's/$/'"-$osname/" tmparch`
5778         else
5779                 tarch="$osname"
5780         fi
5781         $rm -f tmparch
5782 else
5783         tarch="$osname"
5784 fi
5785 case "$myarchname" in
5786 ''|"$tarch") ;;
5787 *)
5788         echo "(Your architecture name used to be $myarchname.)"
5789         archname=''
5790         ;;
5791 esac
5792 myarchname="$tarch"
5793 case "$archname" in
5794 '') dflt="$tarch";;
5795 *) dflt="$archname";;
5796 esac
5797 rp='What is your architecture name'
5798 . ./myread
5799 archname="$ans"
5800 case "$usethreads" in
5801 $define)
5802         echo "Threads selected." >&4
5803         case "$archname" in
5804         *-thread*) echo "...and architecture name already has -thread." >&4
5805                 ;;
5806         *)      archname="$archname-thread"
5807                 echo "...setting architecture name to $archname." >&4
5808                 ;;
5809         esac
5810         ;;
5811 esac
5812 case "$usemultiplicity" in
5813 $define)
5814         echo "Multiplicity selected." >&4
5815         case "$archname" in
5816         *-multi*) echo "...and architecture name already has -multi." >&4
5817                 ;;
5818         *)      archname="$archname-multi"
5819                 echo "...setting architecture name to $archname." >&4
5820                 ;;
5821         esac
5822         ;;
5823 esac
5824 case "$use64bitint$use64bitall" in
5825 *"$define"*)
5826         case "$archname64" in
5827         '')
5828                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5829                 ;;
5830         *)
5831                 case "$use64bitint" in
5832                 "$define") echo "64 bit integers selected." >&4 ;;
5833                 esac
5834                 case "$use64bitall" in
5835                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5836                 esac
5837                 case "$archname" in
5838                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5839                         ;;
5840                 *)      archname="$archname-$archname64"
5841                         echo "...setting architecture name to $archname." >&4
5842                         ;;
5843                 esac
5844                 ;;
5845         esac
5846 esac
5847 case "$uselongdouble" in
5848 $define)
5849         echo "Long doubles selected." >&4
5850         case "$longdblsize" in
5851         $doublesize)
5852                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5853                 ;;
5854         *)
5855                 case "$archname" in
5856                 *-ld*) echo "...and architecture name already has -ld." >&4
5857                         ;;
5858                 *)      archname="$archname-ld"
5859                         echo "...setting architecture name to $archname." >&4
5860                         ;;
5861                 esac
5862                 ;;
5863         esac
5864         ;;
5865 esac
5866 case "$useperlio" in
5867 $define)
5868         echo "Perlio selected." >&4
5869         ;;
5870 *)
5871         echo "Perlio not selected, using stdio." >&4
5872         case "$archname" in
5873         *-stdio*) echo "...and architecture name already has -stdio." >&4
5874                 ;;
5875         *)      archname="$archname-stdio"
5876                 echo "...setting architecture name to $archname." >&4
5877                 ;;
5878         esac
5879         ;;
5880 esac
5881
5882 : determine root of directory hierarchy where package will be installed.
5883 case "$prefix" in
5884 '')
5885         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5886         ;;
5887 *)
5888         dflt="$prefix"
5889         ;;
5890 esac
5891 $cat <<EOM
5892
5893 By default, $package will be installed in $dflt/bin, manual pages
5894 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5895 installation directories. Typically this is something like /usr/local.
5896 If you wish to have binaries under /usr/bin but other parts of the
5897 installation under /usr/local, that's ok: you will be prompted
5898 separately for each of the installation directories, the prefix being
5899 only used to set the defaults.
5900
5901 EOM
5902 fn=d~
5903 rp='Installation prefix to use?'
5904 . ./getfile
5905 oldprefix=''
5906 case "$prefix" in
5907 '') ;;
5908 *)
5909         case "$ans" in
5910         "$prefix") ;;
5911         *) oldprefix="$prefix";;
5912         esac
5913         ;;
5914 esac
5915 prefix="$ans"
5916 prefixexp="$ansexp"
5917
5918 case "$afsroot" in
5919 '')     afsroot=/afs ;;
5920 *)      afsroot=$afsroot ;;
5921 esac
5922
5923 : is AFS running?
5924 echo " "
5925 case "$afs" in
5926 $define|true)   afs=true ;;
5927 $undef|false)   afs=false ;;
5928 *)      if test -d $afsroot; then
5929                 afs=true
5930         else
5931                 afs=false
5932         fi
5933         ;;
5934 esac
5935 if $afs; then
5936         echo "AFS may be running... I'll be extra cautious then..." >&4
5937 else
5938         echo "AFS does not seem to be running..." >&4
5939 fi
5940
5941 : determine installation prefix for where package is to be installed.
5942 if $afs; then 
5943 $cat <<EOM
5944
5945 Since you are running AFS, I need to distinguish the directory in which
5946 files will reside from the directory in which they are installed (and from
5947 which they are presumably copied to the former directory by occult means).
5948
5949 EOM
5950         case "$installprefix" in
5951         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5952         *) dflt="$installprefix";;
5953         esac
5954 else
5955 $cat <<EOM
5956
5957 In some special cases, particularly when building $package for distribution,
5958 it is convenient to distinguish between the directory in which files should 
5959 be installed from the directory ($prefix) in which they 
5960 will eventually reside.  For most users, these two directories are the same.
5961
5962 EOM
5963         case "$installprefix" in
5964         '') dflt=$prefix ;;
5965         *) dflt=$installprefix;;
5966         esac
5967 fi
5968 fn=d~
5969 rp='What installation prefix should I use for installing files?'
5970 . ./getfile
5971 installprefix="$ans"
5972 installprefixexp="$ansexp"
5973
5974 : set the prefixit variable, to compute a suitable default value
5975 prefixit='case "$3" in
5976 ""|none)
5977         case "$oldprefix" in
5978         "") eval "$1=\"\$$2\"";;
5979         *)
5980                 case "$3" in
5981                 "") eval "$1=";;
5982                 none)
5983                         eval "tp=\"\$$2\"";
5984                         case "$tp" in
5985                         ""|" ") eval "$1=\"\$$2\"";;
5986                         *) eval "$1=";;
5987                         esac;;
5988                 esac;;
5989         esac;;
5990 *)
5991         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5992         case "$tp" in
5993         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5994         /*-$oldprefix/*|\~*-$oldprefix/*)
5995                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5996         *) eval "$1=\"\$$2\"";;
5997         esac;;
5998 esac'
5999
6000
6001 : get the patchlevel
6002 echo " "
6003 echo "Getting the current patchlevel..." >&4
6004 if $test -r $rsrc/patchlevel.h;then
6005         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6006         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6007         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6008         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6009         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6010         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6011        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6012 else
6013         revision=0
6014         patchlevel=0
6015         subversion=0
6016         api_revision=0
6017         api_version=0
6018         api_subversion=0
6019         perl_patchlevel=0
6020         $echo "(You do not have patchlevel.h.  Eek.)"
6021 fi
6022 if $test -r $rsrc/.patch ; then  
6023         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6024                 perl_patchlevel=`cat $rsrc/.patch`
6025         fi
6026 fi
6027 case "$perl_patchlevel" in
6028 0)  ;;
6029 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6030 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6031 esac
6032 case "$osname" in
6033 dos|vms)
6034         : XXX Should be a Configure test for double-dots in filenames.
6035         version=`echo $revision $patchlevel $subversion | \
6036                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6037         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6038                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6039         ;;
6040 *)
6041         version=`echo $revision $patchlevel $subversion | \
6042                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6043         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6044                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6045         ;;
6046 esac
6047 : Special case the 5.005_xx maintenance series, which used 5.005
6048 : without any subversion label as a subdirectory in $sitelib
6049 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6050         api_versionstring='5.005'
6051 fi
6052
6053 : determine installation style
6054 : For now, try to deduce it from prefix unless it is already set.
6055 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6056 case "$installstyle" in
6057 '')     case "$prefix" in
6058                 *perl*) dflt='lib';;
6059                 *) dflt='lib/perl5' ;;
6060         esac
6061         ;;
6062 *)      dflt="$installstyle" ;;
6063 esac
6064 : Probably not worth prompting for this since we prompt for all
6065 : the directories individually, and the prompt would be too long and
6066 : confusing anyway.
6067 installstyle=$dflt
6068
6069 : determine where private library files go
6070 : Usual default is /usr/local/lib/perl5/$version.
6071 : Also allow things like /opt/perl/lib/$version, since 
6072 : /opt/perl/lib/perl5... would be redundant.
6073 : The default "style" setting is made in installstyle.U
6074 case "$installstyle" in
6075 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6076 *)       set dflt privlib lib/$version ;;
6077 esac
6078 eval $prefixit
6079 $cat <<EOM
6080
6081 There are some auxiliary files for $package that need to be put into a
6082 private library directory that is accessible by everyone.
6083
6084 EOM
6085 fn=d~+
6086 rp='Pathname where the private library files will reside?'
6087 . ./getfile
6088 privlib="$ans"
6089 privlibexp="$ansexp"
6090 : Change installation prefix, if necessary.
6091 if $test X"$prefix" != X"$installprefix"; then
6092         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6093 else
6094         installprivlib="$privlibexp"
6095 fi
6096
6097 : set the prefixup variable, to restore leading tilda escape
6098 prefixup='case "$prefixexp" in
6099 "$prefix") ;;
6100 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6101 esac'
6102
6103 : determine where public architecture dependent libraries go
6104 set archlib archlib
6105 eval $prefixit
6106 : privlib default is /usr/local/lib/$package/$version
6107 : archlib default is /usr/local/lib/$package/$version/$archname
6108 : privlib may have an optional trailing /share.
6109 tdflt=`echo $privlib | $sed 's,/share$,,'`
6110 tdflt=$tdflt/$archname
6111 case "$archlib" in
6112 '')     dflt=$tdflt
6113         ;;
6114 *)      dflt="$archlib"
6115     ;;
6116 esac
6117 $cat <<EOM
6118
6119 $spackage contains architecture-dependent library files.  If you are
6120 sharing libraries in a heterogeneous environment, you might store
6121 these files in a separate location.  Otherwise, you can just include
6122 them with the rest of the public library files.
6123
6124 EOM
6125 fn=d+~
6126 rp='Where do you want to put the public architecture-dependent libraries?'
6127 . ./getfile
6128 archlib="$ans"
6129 archlibexp="$ansexp"
6130 if $test X"$archlib" = X"$privlib"; then
6131         d_archlib="$undef"
6132 else
6133         d_archlib="$define"
6134 fi
6135 : Change installation prefix, if necessary.
6136 if $test X"$prefix" != X"$installprefix"; then
6137         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6138 else
6139         installarchlib="$archlibexp"
6140 fi
6141
6142
6143 : Binary compatibility with 5.005 is not possible for builds
6144 : with advanced features
6145 case "$usethreads$usemultiplicity" in
6146 *define*)
6147         bincompat5005="$undef"
6148         d_bincompat5005="$undef"
6149         ;;
6150 *)      $cat <<EOM
6151
6152 This version of Perl can be compiled for binary compatibility with 5.005.
6153 If you decide to do so, you will be able to continue using most of the
6154 extensions that were compiled for Perl 5.005.
6155
6156 EOM
6157         case "$bincompat5005$d_bincompat5005" in
6158         *"$undef"*) dflt=n ;;
6159         *) dflt=y ;;
6160         esac
6161         rp='Binary compatibility with Perl 5.005?'
6162         . ./myread
6163         case "$ans" in
6164         y*) val="$define" ;;
6165         *)  val="$undef" ;;
6166         esac
6167         set d_bincompat5005
6168         eval $setvar
6169         case "$d_bincompat5005" in
6170         "$define")
6171                 bincompat5005="$define"
6172                 ;;
6173         *)      bincompat5005="$undef"
6174                 d_bincompat5005="$undef"
6175                 ;;
6176         esac
6177         ;;
6178 esac
6179
6180
6181 : see if setuid scripts can be secure
6182 $cat <<EOM
6183
6184 Some kernels have a bug that prevents setuid #! scripts from being
6185 secure.  Some sites have disabled setuid #! scripts because of this.
6186
6187 First let's decide if your kernel supports secure setuid #! scripts.
6188 (If setuid #! scripts would be secure but have been disabled anyway,
6189 don't say that they are secure if asked.)
6190
6191 EOM
6192
6193 val="$undef"
6194 if $test -d /dev/fd; then
6195         echo "#!$ls" >reflect
6196         chmod +x,u+s reflect
6197         ./reflect >flect 2>&1
6198         if $contains "/dev/fd" flect >/dev/null; then
6199                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6200                 val="$define"
6201         else
6202                 $cat <<EOM
6203 If you are not sure if they are secure, I can check but I'll need a
6204 username and password different from the one you are using right now.
6205 If you don't have such a username or don't want me to test, simply
6206 enter 'none'.
6207
6208 EOM
6209                 rp='Other username to test security of setuid scripts with?'
6210                 dflt='none'
6211                 . ./myread
6212                 case "$ans" in
6213                 n|none)
6214                         case "$d_suidsafe" in
6215                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6216                                 dflt=n;;
6217                         "$undef")
6218                                 echo "Well, the $hint value is *not* secure." >&4
6219                                 dflt=n;;
6220                         *)      echo "Well, the $hint value *is* secure." >&4
6221                                 dflt=y;;
6222                         esac
6223                         ;;
6224                 *)
6225                         $rm -f reflect flect
6226                         echo "#!$ls" >reflect
6227                         chmod +x,u+s reflect
6228                         echo >flect
6229                         chmod a+w flect
6230                         echo '"su" will (probably) prompt you for '"$ans's password."
6231                         su $ans -c './reflect >flect'
6232                         if $contains "/dev/fd" flect >/dev/null; then
6233                                 echo "Okay, it looks like setuid scripts are secure." >&4
6234                                 dflt=y
6235                         else
6236                                 echo "I don't think setuid scripts are secure." >&4
6237                                 dflt=n
6238                         fi
6239                         ;;
6240                 esac
6241                 rp='Does your kernel have *secure* setuid scripts?'
6242                 . ./myread
6243                 case "$ans" in
6244                 [yY]*)  val="$define";;
6245                 *)      val="$undef";;
6246                 esac
6247         fi
6248 else
6249         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6250         echo "(That's for file descriptors, not floppy disks.)"
6251         val="$undef"
6252 fi
6253 set d_suidsafe
6254 eval $setvar
6255
6256 $rm -f reflect flect
6257
6258 : now see if they want to do setuid emulation
6259 echo " "
6260 val="$undef"
6261 case "$d_suidsafe" in
6262 "$define")
6263         val="$undef"
6264         echo "No need to emulate SUID scripts since they are secure here." >& 4
6265         ;;
6266 *)
6267         $cat <<EOM
6268 Some systems have disabled setuid scripts, especially systems where
6269 setuid scripts cannot be secure.  On systems where setuid scripts have
6270 been disabled, the setuid/setgid bits on scripts are currently
6271 useless.  It is possible for $package to detect those bits and emulate
6272 setuid/setgid in a secure fashion.  This emulation will only work if
6273 setuid scripts have been disabled in your kernel.
6274
6275 EOM
6276         case "$d_dosuid" in
6277         "$define") dflt=y ;;
6278         *) dflt=n ;;
6279         esac
6280         rp="Do you want to do setuid/setgid emulation?"
6281         . ./myread
6282         case "$ans" in
6283         [yY]*)  val="$define";;
6284         *)      val="$undef";;
6285         esac
6286         ;;
6287 esac
6288 set d_dosuid
6289 eval $setvar
6290
6291 : see if this is a malloc.h system
6292 set malloc.h i_malloc
6293 eval $inhdr
6294
6295 : see if stdlib is available
6296 set stdlib.h i_stdlib
6297 eval $inhdr
6298
6299 : determine which malloc to compile in
6300 echo " "
6301 case "$usemymalloc" in
6302 [yY]*|true|$define)     dflt='y' ;;
6303 [nN]*|false|$undef)     dflt='n' ;;
6304 *)      case "$ptrsize" in
6305         4) dflt='y' ;;
6306         *) dflt='n' ;;
6307         esac
6308         ;;
6309 esac
6310 rp="Do you wish to attempt to use the malloc that comes with $package?"
6311 . ./myread
6312 usemymalloc="$ans"
6313 case "$ans" in
6314 y*|true)
6315         usemymalloc='y'
6316         mallocsrc='malloc.c'
6317         mallocobj="malloc$_o"
6318         d_mymalloc="$define"
6319         case "$libs" in
6320         *-lmalloc*)
6321                 : Remove malloc from list of libraries to use
6322                 echo "Removing unneeded -lmalloc from library list" >&4
6323                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6324                 shift
6325                 libs="$*"
6326                 echo "libs = $libs" >&4
6327                 ;;
6328         esac
6329         ;;
6330 *)
6331         usemymalloc='n'
6332         mallocsrc=''
6333         mallocobj=''
6334         d_mymalloc="$undef"
6335         ;;
6336 esac
6337
6338 : compute the return types of malloc and free
6339 echo " "
6340 $cat >malloc.c <<END
6341 #$i_malloc I_MALLOC
6342 #$i_stdlib I_STDLIB
6343 #include <stdio.h>
6344 #include <sys/types.h>
6345 #ifdef I_MALLOC
6346 #include <malloc.h>
6347 #endif
6348 #ifdef I_STDLIB
6349 #include <stdlib.h>
6350 #endif
6351 #ifdef TRY_MALLOC
6352 void *malloc();
6353 #endif
6354 #ifdef TRY_FREE
6355 void free();
6356 #endif
6357 END
6358 case "$malloctype" in
6359 '')
6360         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6361                 malloctype='void *'
6362         else
6363                 malloctype='char *'
6364         fi
6365         ;;
6366 esac
6367 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6368
6369 case "$freetype" in
6370 '')
6371         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6372                 freetype='void'
6373         else
6374                 freetype='int'
6375         fi
6376         ;;
6377 esac
6378 echo "Your system uses $freetype free(), it would seem." >&4
6379 $rm -f malloc.[co]
6380 $cat <<EOM
6381
6382 After $package is installed, you may wish to install various
6383 add-on modules and utilities.  Typically, these add-ons will
6384 be installed under $prefix with the rest
6385 of this package.  However, you may wish to install such add-ons
6386 elsewhere under a different prefix.
6387
6388 If you do not wish to put everything under a single prefix, that's
6389 ok.  You will be prompted for the individual locations; this siteprefix
6390 is only used to suggest the defaults.
6391
6392 The default should be fine for most people.
6393
6394 EOM
6395 fn=d~+
6396 rp='Installation prefix to use for add-on modules and utilities?'
6397 : XXX Here might be another good place for an installstyle setting.
6398 case "$siteprefix" in
6399 '') dflt=$prefix ;;
6400 *)  dflt=$siteprefix ;;
6401 esac
6402 . ./getfile
6403 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6404 oldsiteprefix=''
6405 case "$siteprefix" in
6406 '') ;;
6407 *)      case "$ans" in
6408         "$prefix") ;;
6409         *) oldsiteprefix="$prefix";;
6410         esac
6411         ;;
6412 esac
6413 siteprefix="$ans"
6414 siteprefixexp="$ansexp"
6415
6416 : determine where site specific libraries go.
6417 : Usual default is /usr/local/lib/perl5/site_perl/$version
6418 : The default "style" setting is made in installstyle.U
6419 : XXX No longer works with Prefixit stuff.
6420 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6421 case "$sitelib" in
6422 '') case "$installstyle" in
6423         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6424         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6425         esac
6426         ;;
6427 *)      dflt="$sitelib"
6428         ;;
6429 esac
6430 $cat <<EOM
6431
6432 The installation process will create a directory for
6433 site-specific extensions and modules.  Most users find it convenient
6434 to place all site-specific files in this directory rather than in the
6435 main distribution directory.
6436
6437 EOM
6438 fn=d~+
6439 rp='Pathname for the site-specific library files?'
6440 . ./getfile
6441 sitelib="$ans"
6442 sitelibexp="$ansexp"
6443 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6444 : Change installation prefix, if necessary.
6445 if $test X"$prefix" != X"$installprefix"; then
6446         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6447 else
6448         installsitelib="$sitelibexp"
6449 fi
6450
6451 : determine where site specific architecture-dependent libraries go.
6452 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6453 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6454 : sitelib may have an optional trailing /share.
6455 case "$sitearch" in
6456 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6457         dflt="$dflt/$archname"
6458         ;;
6459 *)      dflt="$sitearch"
6460         ;;
6461 esac
6462 set sitearch sitearch none
6463 eval $prefixit
6464 $cat <<EOM
6465
6466 The installation process will also create a directory for
6467 architecture-dependent site-specific extensions and modules.
6468
6469 EOM
6470 fn=d~+
6471 rp='Pathname for the site-specific architecture-dependent library files?'
6472 . ./getfile
6473 sitearch="$ans"
6474 sitearchexp="$ansexp"
6475 : Change installation prefix, if necessary.
6476 if $test X"$prefix" != X"$installprefix"; then
6477         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6478 else
6479         installsitearch="$sitearchexp"
6480 fi
6481
6482 $cat <<EOM
6483
6484 The installation process will also create a directory for
6485 vendor-supplied add-ons.  Vendors who supply perl with their system
6486 may find it convenient to place all vendor-supplied files in this
6487 directory rather than in the main distribution directory.  This will
6488 ease upgrades between binary-compatible maintenance versions of perl.
6489
6490 Of course you may also use these directories in whatever way you see
6491 fit.  For example, you might use them to access modules shared over a
6492 company-wide network.
6493
6494 The default answer should be fine for most people.
6495 This causes further questions about vendor add-ons to be skipped
6496 and no vendor-specific directories will be configured for perl.
6497
6498 EOM
6499 rp='Do you want to configure vendor-specific add-on directories?'
6500 case "$usevendorprefix" in
6501 define|true|[yY]*) dflt=y ;;
6502 *)      : User may have set vendorprefix directly on Configure command line.
6503         case "$vendorprefix" in
6504         ''|' ') dflt=n ;;
6505         *)      dflt=y ;;
6506         esac
6507         ;;
6508 esac
6509 . ./myread
6510 case "$ans" in
6511 [yY]*)  fn=d~+
6512         rp='Installation prefix to use for vendor-supplied add-ons?'
6513         case "$vendorprefix" in
6514         '') dflt='' ;;
6515         *)  dflt=$vendorprefix ;;
6516         esac
6517         . ./getfile
6518         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6519         oldvendorprefix=''
6520         case "$vendorprefix" in
6521         '') ;;
6522         *)      case "$ans" in
6523                 "$prefix") ;;
6524                 *) oldvendorprefix="$prefix";;
6525                 esac
6526                 ;;
6527         esac
6528         usevendorprefix="$define"
6529         vendorprefix="$ans"
6530         vendorprefixexp="$ansexp"
6531         ;;
6532 *)      usevendorprefix="$undef"
6533         vendorprefix=''
6534         vendorprefixexp=''
6535         ;;
6536 esac
6537
6538 case "$vendorprefix" in
6539 '')     d_vendorlib="$undef"
6540         vendorlib=''
6541         vendorlibexp=''
6542         ;;
6543 *)      d_vendorlib="$define"
6544         : determine where vendor-supplied modules go.
6545         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6546         case "$vendorlib" in
6547         '')
6548                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6549                 case "$installstyle" in
6550                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6551                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6552                 esac
6553                 ;;
6554         *)      dflt="$vendorlib"
6555                 ;;
6556         esac
6557         fn=d~+
6558         rp='Pathname for the vendor-supplied library files?'
6559         . ./getfile
6560         vendorlib="$ans"
6561         vendorlibexp="$ansexp"
6562         ;;
6563 esac
6564 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6565 : Change installation prefix, if necessary.
6566 if $test X"$prefix" != X"$installprefix"; then
6567         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6568 else
6569         installvendorlib="$vendorlibexp"
6570 fi
6571
6572 case "$vendorprefix" in
6573 '')     d_vendorarch="$undef"
6574         vendorarch=''
6575         vendorarchexp=''
6576         ;;
6577 *)      d_vendorarch="$define"
6578         : determine where vendor-supplied architecture-dependent libraries go.
6579         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6580         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6581         : vendorlib may have an optional trailing /share.
6582         case "$vendorarch" in
6583         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6584                 dflt="$dflt/$archname"
6585                 ;;
6586         *)      dflt="$vendorarch" ;;
6587         esac
6588         fn=d~+
6589         rp='Pathname for vendor-supplied architecture-dependent files?'
6590         . ./getfile
6591         vendorarch="$ans"
6592         vendorarchexp="$ansexp"
6593         ;;
6594 esac
6595 : Change installation prefix, if necessary.
6596 if $test X"$prefix" != X"$installprefix"; then
6597         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6598 else
6599         installvendorarch="$vendorarchexp"
6600 fi
6601
6602 : Final catch-all directories to search
6603 $cat <<EOM
6604
6605 Lastly, you can have perl look in other directories for extensions and
6606 modules in addition to those already specified.
6607 These directories will be searched after 
6608         $sitearch 
6609         $sitelib 
6610 EOM
6611 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6612 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6613 echo ' '
6614 case "$otherlibdirs" in
6615 ''|' ') dflt='none' ;;
6616 *)      dflt="$otherlibdirs" ;;
6617 esac
6618 $cat <<EOM
6619 Enter a colon-separated set of extra paths to include in perl's @INC
6620 search path, or enter 'none' for no extra paths.
6621
6622 EOM
6623
6624 rp='Colon-separated list of additional directories for perl to search?'
6625 . ./myread
6626 case "$ans" in
6627 ' '|''|none)    otherlibdirs=' ' ;;     
6628 *)      otherlibdirs="$ans" ;;
6629 esac
6630 case "$otherlibdirs" in
6631 ' ') val=$undef ;;
6632 *)      val=$define ;;
6633 esac
6634 set d_perl_otherlibdirs
6635 eval $setvar
6636
6637 : Cruising for prototypes
6638 echo " "
6639 echo "Checking out function prototypes..." >&4
6640 $cat >prototype.c <<'EOCP'
6641 int main(int argc, char *argv[]) {
6642         exit(0);}
6643 EOCP
6644 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6645         echo "Your C compiler appears to support function prototypes."
6646         val="$define"
6647 else
6648         echo "Your C compiler doesn't seem to understand function prototypes."
6649         val="$undef"
6650 fi
6651 set prototype
6652 eval $setvar
6653 $rm -f prototype*
6654
6655 case "$prototype" in
6656 "$define") ;;
6657 *)      ansi2knr='ansi2knr'
6658         echo " "
6659         cat <<EOM >&4
6660
6661 $me:  FATAL ERROR:
6662 This version of $package can only be compiled by a compiler that 
6663 understands function prototypes.  Unfortunately, your C compiler 
6664         $cc $ccflags
6665 doesn't seem to understand them.  Sorry about that.
6666
6667 If GNU cc is available for your system, perhaps you could try that instead.  
6668
6669 Eventually, we hope to support building Perl with pre-ANSI compilers.
6670 If you would like to help in that effort, please contact <perlbug@perl.org>.
6671
6672 Aborting Configure now.
6673 EOM
6674         exit 2
6675         ;;
6676 esac
6677
6678 : determine where public executables go
6679 echo " "
6680 set dflt bin bin
6681 eval $prefixit
6682 fn=d~
6683 rp='Pathname where the public executables will reside?'
6684 . ./getfile
6685 if $test "X$ansexp" != "X$binexp"; then
6686         installbin=''
6687 fi
6688 bin="$ans"
6689 binexp="$ansexp"
6690 : Change installation prefix, if necessary.
6691 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6692 if $test X"$prefix" != X"$installprefix"; then
6693         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6694 else
6695         installbin="$binexp"
6696 fi
6697
6698 : Find perl5.005 or later.
6699 echo "Looking for a previously installed perl5.005 or later... "
6700 case "$perl5" in
6701 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6702                 : Check if this perl is recent and can load a simple module
6703                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6704                         perl5=$tdir/perl
6705                         break;
6706                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6707                         perl5=$tdir/perl5
6708                         break;
6709                 fi
6710         done
6711         ;;
6712 *)      perl5="$perl5"
6713         ;;
6714 esac
6715 case "$perl5" in
6716 '')     echo "None found.  That's ok.";;
6717 *)      echo "Using $perl5." ;;
6718 esac
6719
6720 : Determine list of previous versions to include in @INC
6721 $cat > getverlist <<EOPL
6722 #!$perl5 -w
6723 use File::Basename;
6724 \$api_versionstring = "$api_versionstring";
6725 \$version = "$version";
6726 \$stem = "$sitelib_stem";
6727 \$archname = "$archname";
6728 EOPL
6729         $cat >> getverlist <<'EOPL'
6730 # Can't have leading @ because metaconfig interprets it as a command!
6731 ;@inc_version_list=();
6732 # XXX Redo to do opendir/readdir? 
6733 if (-d $stem) {
6734     chdir($stem);
6735     ;@candidates = glob("5.*");
6736 }
6737 else {
6738     ;@candidates = ();
6739 }
6740
6741 # XXX ToDo:  These comparisons must be reworked when two-digit
6742 # subversions come along, so that 5.7.10 compares as greater than
6743 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6744 # widespread that we can use the built-in version vectors rather
6745 # than reinventing them here.  For 5.6.0, however, we must
6746 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6747 foreach $d (@candidates) {
6748     if ($d lt $version) {
6749         if ($d ge $api_versionstring) {
6750             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6751         }
6752         elsif ($d ge "5.005") {
6753             unshift(@inc_version_list, grep { -d } $d);
6754         }
6755     }
6756     else {
6757         # Skip newer version.  I.e. don't look in
6758         # 5.7.0 if we're installing 5.6.1.
6759     }
6760 }
6761
6762 if (@inc_version_list) {
6763     print join(' ', @inc_version_list);
6764 }
6765 else {
6766     # Blank space to preserve value for next Configure run.
6767     print " ";
6768 }
6769 EOPL
6770 chmod +x getverlist
6771 case "$inc_version_list" in
6772 '')     if test -x "$perl5$exe_ext"; then
6773                 dflt=`$perl5 getverlist`
6774         else
6775                 dflt='none'
6776         fi
6777         ;;
6778 $undef) dflt='none' ;;
6779 *)  dflt="$inc_version_list" ;;
6780 esac
6781 case "$dflt" in
6782 ''|' ') dflt=none ;;
6783 esac
6784 case "$dflt" in
6785 5.005) case "$bincompat5005" in
6786        $define|true|[yY]*) ;;
6787        *) dflt=none ;;
6788        esac
6789        ;;
6790 esac
6791 $cat <<'EOM'
6792
6793 In order to ease the process of upgrading, this version of perl 
6794 can be configured to use modules built and installed with earlier 
6795 versions of perl that were installed under $prefix.  Specify here
6796 the list of earlier versions that this version of perl should check.
6797 If Configure detected no earlier versions of perl installed under
6798 $prefix, then the list will be empty.  Answer 'none' to tell perl
6799 to not search earlier versions.
6800
6801 The default should almost always be sensible, so if you're not sure,
6802 just accept the default.
6803 EOM
6804
6805 rp='List of earlier versions to include in @INC?'
6806 . ./myread
6807 case "$ans" in
6808 [Nn]one|''|' ') inc_version_list=' ' ;;
6809 *) inc_version_list="$ans" ;;
6810 esac
6811 case "$inc_version_list" in
6812 ''|' ') 
6813         inc_version_list_init='0';;
6814 *)      inc_version_list_init=`echo $inc_version_list |
6815                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6816         ;;
6817 esac
6818 $rm -f getverlist
6819
6820 : determine whether to install perl also as /usr/bin/perl
6821
6822 echo " "
6823 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6824         $cat <<EOM
6825 Many scripts expect perl to be installed as /usr/bin/perl.
6826 I can install the perl you are about to compile also as /usr/bin/perl
6827 (in addition to $installbin/perl).
6828 EOM
6829         case "$installusrbinperl" in
6830         "$undef"|[nN]*) dflt='n';;
6831         *)              dflt='y';;
6832         esac
6833         rp="Do you want to install perl as /usr/bin/perl?"
6834         . ./myread
6835         case "$ans" in
6836         [yY]*)  val="$define";;
6837         *)      val="$undef" ;;
6838         esac
6839 else
6840         val="$undef"
6841 fi
6842 set installusrbinperl
6843 eval $setvar
6844
6845 : see if dld is available
6846 set dld.h i_dld
6847 eval $inhdr
6848
6849 : see if dlopen exists
6850 xxx_runnm="$runnm"
6851 runnm=false
6852 set dlopen d_dlopen
6853 eval $inlibc
6854 runnm="$xxx_runnm"
6855
6856 : determine which dynamic loading, if any, to compile in
6857 echo " "
6858 dldir="ext/DynaLoader"
6859 case "$usedl" in
6860 $define|y|true)
6861         dflt='y'
6862         usedl="$define"
6863         ;;
6864 $undef|n|false)
6865         dflt='n'
6866         usedl="$undef"
6867         ;;
6868 *) 
6869         dflt='n'
6870         case "$d_dlopen" in
6871             $define) dflt='y' ;;
6872         esac
6873         case "$i_dld" in
6874             $define) dflt='y' ;;
6875         esac
6876         : Does a dl_xxx.xs file exist for this operating system
6877         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6878         ;;
6879 esac
6880 rp="Do you wish to use dynamic loading?"
6881 . ./myread
6882 usedl="$ans"
6883 case "$ans" in
6884 y*) usedl="$define"
6885         case "$dlsrc" in
6886         '')
6887                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6888                         dflt="$dldir/dl_${osname}.xs"
6889                 elif $test "$d_dlopen" = "$define" ; then
6890                         dflt="$dldir/dl_dlopen.xs"
6891                 elif $test "$i_dld" = "$define" ; then
6892                         dflt="$dldir/dl_dld.xs"
6893                 else
6894                         dflt=''
6895                 fi
6896                 ;;
6897         *)      dflt="$dldir/$dlsrc"
6898                 ;;
6899         esac
6900     echo "The following dynamic loading files are available:"
6901         : Can not go over to $dldir because getfile has path hard-coded in.
6902         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6903         rp="Source file to use for dynamic loading"
6904         fn="fne"
6905         gfpth="$src"
6906         . ./getfile
6907         usedl="$define"
6908         : emulate basename
6909         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6910
6911         $cat << EOM
6912
6913 Some systems may require passing special flags to $cc -c to
6914 compile modules that will be used to create a shared library.
6915 To use no flags, say "none".
6916
6917 EOM
6918     case "$cccdlflags" in
6919     '') case "$gccversion" in
6920                 '') case "$osname" in
6921                         hpux)   dflt='+z' ;;
6922                         next)   dflt='none' ;;
6923                         irix*)  dflt='-KPIC' ;;
6924                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6925                         sunos)  dflt='-pic' ;;
6926                         *)      dflt='none' ;;
6927                     esac
6928                         ;;
6929                 *)  case "$osname" in
6930                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6931                         *)      dflt='-fpic' ;;
6932                     esac ;;
6933             esac ;;
6934         ' ') dflt='none' ;;
6935     *)  dflt="$cccdlflags" ;;
6936     esac
6937     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6938     . ./myread
6939     case "$ans" in
6940     none) cccdlflags=' ' ;;
6941     *) cccdlflags="$ans" ;;
6942     esac
6943
6944     cat << EOM
6945
6946 Some systems use ld to create libraries that can be dynamically loaded,
6947 while other systems (such as those using ELF) use $cc.
6948
6949 EOM
6950         case "$ld" in
6951         '')     $cat >try.c <<'EOM'
6952 /* Test for whether ELF binaries are produced */
6953 #include <fcntl.h>
6954 #include <stdlib.h>
6955 int main() {
6956         char b[4];
6957         int i = open("a.out",O_RDONLY);
6958         if(i == -1) 
6959                 exit(1); /* fail */
6960         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6961                 exit(0); /* succeed (yes, it's ELF) */
6962         else
6963                 exit(1); /* fail */
6964 }
6965 EOM
6966                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6967                         cat <<EOM
6968 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6969 EOM
6970                         dflt="$cc"
6971                 else
6972                         echo "I'll use ld to build dynamic libraries."
6973                         dflt='ld'
6974                 fi
6975                 rm -f try.c a.out
6976                 ;;
6977         *)      dflt="$ld"
6978                 ;;
6979         esac
6980
6981     rp="What command should be used to create dynamic libraries?"
6982     . ./myread
6983         ld="$ans"
6984
6985     cat << EOM
6986
6987 Some systems may require passing special flags to $ld to create a
6988 library that can be dynamically loaded.  If your ld flags include
6989 -L/other/path options to locate libraries outside your loader's normal
6990 search path, you may need to specify those -L options here as well.  To
6991 use no flags, say "none".
6992
6993 EOM
6994     case "$lddlflags" in
6995     '') case "$osname" in
6996                         beos) dflt='-nostart' ;;
6997                         hpux) dflt='-b';
6998                               case "$gccversion" in
6999                               '') dflt="$dflt +vnocompatwarnings" ;;
7000                               esac
7001                               ;;        
7002                         linux|irix*)    dflt='-shared' ;;
7003                         next)  dflt='none' ;;
7004                         solaris) dflt='-G' ;;
7005                         sunos) dflt='-assert nodefinitions' ;;
7006                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7007                 *)     dflt='none' ;;
7008                         esac
7009                         ;;
7010     *) dflt="$lddlflags" ;;
7011     esac
7012
7013         : Try to guess additional flags to pick up local libraries.
7014         : Be careful not to append to a plain 'none'
7015         case "$dflt" in
7016         none) dflt='' ;;
7017         esac
7018         for thisflag in $ldflags; do
7019                 case "$thisflag" in
7020                 -L*|-R*)
7021                         case " $dflt " in
7022                         *" $thisflag "*) ;;
7023                         *) dflt="$dflt $thisflag" ;;
7024                         esac
7025                         ;;
7026                 esac
7027         done
7028
7029         case "$dflt" in
7030         ''|' ') dflt='none' ;;
7031         esac
7032
7033     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7034     . ./myread
7035     case "$ans" in
7036     none) lddlflags=' ' ;;
7037     *) lddlflags="$ans" ;;
7038     esac
7039
7040         cat <<EOM
7041
7042 Some systems may require passing special flags to $cc to indicate that
7043 the resulting executable will use dynamic linking.  To use no flags,
7044 say "none".
7045
7046 EOM
7047     case "$ccdlflags" in
7048     '') case "$osname" in
7049                 hpux)   dflt='-Wl,-E' ;;
7050                 linux)  dflt='-rdynamic' ;;
7051                 next)   dflt='none' ;;
7052                 sunos)  dflt='none' ;;
7053                 *)      dflt='none' ;;
7054             esac ;;
7055     ' ')  dflt='none' ;;
7056     *)  dflt="$ccdlflags" ;;
7057     esac
7058     rp="Any special flags to pass to $cc to use dynamic linking?"
7059     . ./myread
7060     case "$ans" in
7061     none) ccdlflags=' ' ;;
7062     *) ccdlflags="$ans" ;;
7063     esac
7064     ;;
7065 *)  usedl="$undef"
7066         ld='ld'
7067     dlsrc='dl_none.xs'
7068     lddlflags=''
7069     ccdlflags=''
7070     ;;
7071 esac
7072
7073 also=''
7074 case "$usedl" in
7075 $undef)
7076         # No dynamic loading being used, so don't bother even to prompt.
7077         useshrplib='false'
7078         ;;
7079 *)      case "$useshrplib" in
7080         '')     case "$osname" in
7081                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7082                         dflt=y
7083                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7084                         ;;
7085                 next*)
7086                         case "$osvers" in
7087                         4*)     dflt=y
7088                                 also='Building a shared libperl is needed for MAB support.'
7089                                 ;;
7090                         *)      dflt=n
7091                                 ;;
7092                         esac
7093                         ;;
7094                 *)      dflt=n
7095                         ;;
7096                 esac
7097                 ;;
7098         $define|true|[Yy]*)
7099                 dflt=y
7100                 ;;
7101         *)      dflt=n
7102                 ;;
7103         esac
7104         $cat << EOM
7105
7106 The perl executable is normally obtained by linking perlmain.c with
7107 libperl${_a}, any static extensions (usually just DynaLoader), and
7108 any other libraries needed on this system (such as -lm, etc.).  Since
7109 your system supports dynamic loading, it is probably possible to build
7110 a shared libperl.$so.  If you will have more than one executable linked
7111 to libperl.$so, this will significantly reduce the size of each
7112 executable, but it may have a noticeable affect on performance.  The
7113 default is probably sensible for your system.
7114 $also
7115
7116 EOM
7117         rp="Build a shared libperl.$so (y/n)"
7118         . ./myread
7119         case "$ans" in
7120         true|$define|[Yy]*)
7121                 useshrplib='true'  ;;
7122         *)      useshrplib='false' ;;
7123         esac
7124         ;;
7125 esac
7126
7127 case "$useshrplib" in
7128 true)
7129         case "$libperl" in
7130         '')
7131                 # Figure out a good name for libperl.so.  Since it gets stored in
7132                 # a version-specific architecture-dependent library, the version
7133                 # number isn't really that important, except for making cc/ld happy.
7134                 #
7135                 # A name such as libperl.so.3.1
7136                 majmin="libperl.$so.$patchlevel.$subversion"
7137                 # A name such as libperl.so.301
7138                 majonly=`echo $patchlevel $subversion |
7139                         $awk '{printf "%d%02d", $1, $2}'`
7140                 majonly=libperl.$so.$majonly
7141                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7142                 # rely on figuring it out from the naming of libc.
7143                 case "${osname}${osvers}" in
7144                 next4*)
7145                         dflt=libperl.5.$so
7146                         # XXX How handle the --version stuff for MAB?
7147                         ;;
7148                 linux*)  # ld won't link with a bare -lperl otherwise.
7149                         dflt=libperl.$so
7150                         ;;
7151                 cygwin*) # include version
7152                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7153                         ;;
7154                 *)      # Try to guess based on whether libc has major.minor.
7155                         case "$libc" in
7156                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7157                         *libc.$so.[0-9]*) dflt=$majonly ;;
7158                         *)      dflt=libperl.$so ;;
7159                         esac
7160                         ;;
7161                 esac
7162                 ;;
7163         *)      dflt=$libperl
7164                 ;;
7165         esac
7166         cat << EOM
7167
7168 I need to select a good name for the shared libperl.  If your system uses
7169 library names with major and minor numbers, then you might want something
7170 like $majmin.  Alternatively, if your system uses a single version
7171 number for shared libraries, then you might want to use $majonly.
7172 Or, your system might be quite happy with a simple libperl.$so.
7173
7174 Since the shared libperl will get installed into a version-specific
7175 architecture-dependent directory, the version number of the shared perl
7176 library probably isn't important, so the default should be o.k.
7177
7178 EOM
7179         rp='What name do you want to give to the shared libperl?'
7180         . ./myread
7181         libperl=$ans
7182         echo "Ok, I'll use $libperl"
7183         ;;
7184 *)
7185         libperl="libperl${_a}"
7186         ;;
7187 esac
7188
7189 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7190 case "$shrpdir" in
7191 '') ;;
7192 *)      $cat >&4 <<EOM
7193 WARNING:  Use of the shrpdir variable for the installation location of
7194 the shared $libperl is not supported.  It was never documented and
7195 will not work in this version.  Let me (perlbug@perl.org)
7196 know of any problems this may cause.
7197
7198 EOM
7199         case "$shrpdir" in
7200         "$archlibexp/CORE")
7201                 $cat >&4 <<EOM
7202 But your current setting of $shrpdir is
7203 the default anyway, so it's harmless.
7204 EOM
7205                 ;;
7206         *)
7207                 $cat >&4 <<EOM
7208 Further, your current attempted setting of $shrpdir
7209 conflicts with the value of $archlibexp/CORE
7210 that installperl will use.
7211 EOM
7212                 ;;
7213         esac
7214         ;;
7215 esac
7216
7217 # How will the perl executable find the installed shared $libperl?
7218 # Add $xxx to ccdlflags.
7219 # If we can't figure out a command-line option, use $shrpenv to
7220 # set env LD_RUN_PATH.  The main perl makefile uses this.
7221 shrpdir=$archlibexp/CORE
7222 xxx=''
7223 tmp_shrpenv=''
7224 if "$useshrplib"; then
7225     case "$osname" in 
7226         aix)
7227                 # We'll set it in Makefile.SH...
7228                 ;;
7229         solaris|netbsd)
7230                 xxx="-R $shrpdir"
7231                 ;;
7232         freebsd)
7233                 xxx="-Wl,-R$shrpdir"
7234                 ;;
7235         linux|irix*|dec_osf)
7236                 xxx="-Wl,-rpath,$shrpdir"
7237                 ;;
7238         next)
7239                 # next doesn't like the default...
7240                 ;;
7241         beos)
7242                 # beos doesn't like the default, either.
7243                 ;;
7244         hpux*)
7245                 # hpux doesn't like the default, either.
7246                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7247                 ;;
7248         *)
7249                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7250                 ;;
7251         esac
7252         case "$xxx" in
7253         '') ;;
7254         *)      
7255                 # Only add $xxx if it isn't already in ccdlflags.
7256                 case " $ccdlflags " in
7257                 *" $xxx "*)     ;;
7258                 *)      ccdlflags="$ccdlflags $xxx"
7259                         cat <<EOM >&4
7260
7261 Adding $xxx to the flags
7262 passed to $ld so that the perl executable will find the 
7263 installed shared $libperl.
7264
7265 EOM
7266                         ;;
7267                 esac
7268                 ;;
7269         esac
7270 fi
7271 # Fix ccdlflags in AIX for building external extensions.
7272 # (For building Perl itself bare -bE:perl.exp is needed,
7273 #  Makefile.SH takes care of this.)
7274 case "$osname" in
7275 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7276 esac
7277 # Respect a hint or command-line value.
7278 case "$shrpenv" in
7279 '') shrpenv="$tmp_shrpenv" ;;
7280 esac
7281 case "$ldlibpthname" in
7282 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7283 none)   ldlibpthname='' ;;
7284 esac
7285
7286 : determine where manual pages are on this system
7287 echo " "
7288 case "$sysman" in
7289 '') 
7290         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7291         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7292         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7293         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7294         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7295         sysman=`./loc . /usr/man/man1 $syspath`
7296         ;;
7297 esac
7298 if $test -d "$sysman"; then
7299         echo "System manual is in $sysman." >&4
7300 else
7301         echo "Could not find manual pages in source form." >&4
7302 fi
7303
7304 : determine where manual pages go
7305 set man1dir man1dir none
7306 eval $prefixit
7307 $cat <<EOM
7308
7309 $spackage has manual pages available in source form.
7310 EOM
7311 case "$nroff" in
7312 nroff)
7313         echo "However, you don't have nroff, so they're probably useless to you."
7314         case "$man1dir" in
7315         '') man1dir="none";;
7316         esac;;
7317 esac
7318 echo "If you don't want the manual sources installed, answer 'none'."
7319 case "$man1dir" in
7320 ' ') dflt=none
7321         ;;
7322 '')
7323         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7324         lookpath="$lookpath $prefixexp/man/p_man/man1"
7325         lookpath="$lookpath $prefixexp/man/u_man/man1"
7326         lookpath="$lookpath $prefixexp/man/man.1"
7327         case "$sysman" in
7328         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7329         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7330         esac
7331         set dflt
7332         eval $prefixup
7333         ;;
7334 *)  dflt="$man1dir"
7335         ;;
7336 esac
7337 echo " "
7338 fn=dn+~
7339 rp="Where do the main $spackage manual pages (source) go?"
7340 . ./getfile
7341 if $test "X$man1direxp" != "X$ansexp"; then
7342         installman1dir=''
7343 fi
7344 man1dir="$ans"
7345 man1direxp="$ansexp"
7346 case "$man1dir" in
7347 '')     man1dir=' '
7348         installman1dir='';;
7349 esac
7350
7351 : Change installation prefix, if necessary.
7352 if $test X"$prefix" != X"$installprefix"; then
7353         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7354 else
7355         installman1dir="$man1direxp"
7356 fi
7357
7358 : What suffix to use on installed man pages
7359
7360 case "$man1dir" in
7361 ' ')
7362         man1ext='0'
7363         ;;
7364 *)
7365         rp="What suffix should be used for the main $spackage man pages?"
7366         case "$man1ext" in
7367         '')     case "$man1dir" in
7368                 *1)  dflt=1 ;;
7369                 *1p) dflt=1p ;;
7370                 *1pm) dflt=1pm ;;
7371                 *l) dflt=l;;
7372                 *n) dflt=n;;
7373                 *o) dflt=o;;
7374                 *p) dflt=p;;
7375                 *C) dflt=C;;
7376                 *L) dflt=L;;
7377                 *L1) dflt=L1;;
7378                 *) dflt=1;;
7379                 esac
7380                 ;;
7381         *)      dflt="$man1ext";;
7382         esac
7383         . ./myread
7384         man1ext="$ans"
7385         ;;
7386 esac
7387
7388 : see if we can have long filenames
7389 echo " "
7390 first=123456789abcdef
7391 $rm -f $first
7392 if (echo hi >$first) 2>/dev/null; then
7393         if $test -f 123456789abcde; then
7394                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7395                 val="$undef"
7396         else
7397                 echo 'You can have filenames longer than 14 characters.'>&4
7398                 val="$define"
7399         fi
7400 else
7401         $cat <<'EOM'
7402 You can't have filenames longer than 14 chars.
7403 You can't even think about them!
7404 EOM
7405         val="$undef"
7406 fi 
7407 set d_flexfnam
7408 eval $setvar
7409 $rm -rf 123456789abcde*
7410
7411 : determine where library module manual pages go
7412 set man3dir man3dir none
7413 eval $prefixit
7414 $cat <<EOM
7415
7416 $spackage has manual pages for many of the library modules.
7417 EOM
7418
7419 case "$nroff" in
7420 nroff)
7421         $cat <<'EOM'
7422 However, you don't have nroff, so they're probably useless to you.
7423 EOM
7424         case "$man3dir" in
7425         '') man3dir="none";;
7426         esac;;
7427 esac
7428
7429 case "$d_flexfnam" in
7430 undef)
7431         $cat <<'EOM'
7432 However, your system can't handle the long file names like File::Basename.3. 
7433 EOM
7434         case "$man3dir" in
7435         '') man3dir="none";;
7436         esac;;
7437 esac
7438
7439 echo "If you don't want the manual sources installed, answer 'none'."
7440 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7441 case "$man3dir" in
7442 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7443         if $test -d "$privlib/man/man3"; then
7444                 cat <<EOM >&4
7445
7446 WARNING:  Previous versions of perl installed man3 pages into
7447 $privlib/man/man3.  This version will suggest a 
7448 new default of $dflt.  
7449 EOM
7450                 tdflt=$dflt
7451                 dflt='n'
7452                 rp='Do you wish to preserve the old behavior?(y/n)'
7453                 . ./myread
7454                 case "$ans" in
7455                 y*) dflt="$privlib/man/man3" ;;
7456                 *)  dflt=$tdflt ;;
7457                 esac
7458     fi
7459         ;;
7460 *)      dflt="$man3dir" ;;
7461 esac
7462 case "$dflt" in
7463 ' ') dflt=none ;;
7464 esac
7465 echo " "
7466 fn=dn+~
7467 rp="Where do the $package library man pages (source) go?"
7468 . ./getfile
7469 man3dir="$ans"
7470 man3direxp="$ansexp"
7471 case "$man3dir" in
7472 '')     man3dir=' '
7473         installman3dir='';;
7474 esac
7475
7476 : Change installation prefix, if necessary.
7477 if $test X"$prefix" != X"$installprefix"; then
7478         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7479 else
7480         installman3dir="$man3direxp"
7481 fi
7482
7483 : What suffix to use on installed man pages
7484 case "$man3dir" in
7485 ' ')
7486         man3ext='0'
7487         ;;
7488 *)
7489         rp="What suffix should be used for the $package library man pages?"
7490         case "$man3ext" in
7491         '')     case "$man3dir" in
7492                 *3)  dflt=3 ;;
7493                 *3p) dflt=3p ;;
7494                 *3pm) dflt=3pm ;;
7495                 *l) dflt=l;;
7496                 *n) dflt=n;;
7497                 *o) dflt=o;;
7498                 *p) dflt=p;;
7499                 *C) dflt=C;;
7500                 *L) dflt=L;;
7501                 *L3) dflt=L3;;
7502                 *) dflt=3;;
7503                 esac
7504                 ;;
7505         *)      dflt="$man3ext";;
7506         esac
7507         . ./myread
7508         man3ext="$ans"
7509         ;;
7510 esac
7511
7512 : see if we have to deal with yellow pages, now NIS.
7513 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7514         if $test -f /usr/etc/nibindd; then
7515                 echo " "
7516                 echo "I'm fairly confident you're on a NeXT."
7517                 echo " "
7518                 rp='Do you get the hosts file via NetInfo?'
7519                 dflt=y
7520                 case "$hostcat" in
7521                 nidump*) ;;
7522                 '') ;;
7523                 *) dflt=n;;
7524                 esac
7525                 . ./myread
7526                 case "$ans" in
7527                 y*) hostcat='nidump hosts .';;
7528                 *)      case "$hostcat" in
7529                         nidump*) hostcat='';;
7530                         esac
7531                         ;;
7532                 esac
7533         fi
7534         case "$hostcat" in
7535         nidump*) ;;
7536         *)
7537                 case "$hostcat" in
7538                 *ypcat*) dflt=y;;
7539                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7540                                 dflt=y
7541                         else
7542                                 dflt=n
7543                         fi;;
7544                 *) dflt=n;;
7545                 esac
7546                 echo " "
7547                 rp='Are you getting the hosts file via yellow pages?'
7548                 . ./myread
7549                 case "$ans" in
7550                 y*) hostcat='ypcat hosts';;
7551                 *) hostcat='cat /etc/hosts';;
7552                 esac
7553                 ;;
7554         esac
7555 fi
7556 case "$hostcat" in
7557 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7558 esac
7559 case "$groupcat" in
7560 '') test -f /etc/group && groupcat='cat /etc/group';;
7561 esac
7562 case "$passcat" in
7563 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7564 esac
7565
7566 : now get the host name
7567 echo " "
7568 echo "Figuring out host name..." >&4
7569 case "$myhostname" in
7570 '') cont=true
7571         echo 'Maybe "hostname" will work...'
7572         if tans=`sh -c hostname 2>&1` ; then
7573                 myhostname=$tans
7574                 phostname=hostname
7575                 cont=''
7576         fi
7577         ;;
7578 *) cont='';;
7579 esac
7580 if $test "$cont"; then
7581         if ./xenix; then
7582                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7583                 if tans=`cat /etc/systemid 2>&1` ; then
7584                         myhostname=$tans
7585                         phostname='cat /etc/systemid'
7586                         echo "Whadyaknow.  Xenix always was a bit strange..."
7587                         cont=''
7588                 fi
7589         elif $test -r /etc/systemid; then
7590                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7591         fi
7592 fi
7593 if $test "$cont"; then
7594         echo 'No, maybe "uuname -l" will work...'
7595         if tans=`sh -c 'uuname -l' 2>&1` ; then
7596                 myhostname=$tans
7597                 phostname='uuname -l'
7598         else
7599                 echo 'Strange.  Maybe "uname -n" will work...'
7600                 if tans=`sh -c 'uname -n' 2>&1` ; then
7601                         myhostname=$tans
7602                         phostname='uname -n'
7603                 else
7604                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7605                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7606                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7607                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7608                         else
7609                                 case "$myhostname" in
7610                                 '') echo "Does this machine have an identity crisis or something?"
7611                                         phostname='';;
7612                                 *)
7613                                         echo "Well, you said $myhostname before..."
7614                                         phostname='echo $myhostname';;
7615                                 esac
7616                         fi
7617                 fi
7618         fi
7619 fi
7620 : you do not want to know about this
7621 set $myhostname
7622 myhostname=$1
7623
7624 : verify guess
7625 if $test "$myhostname" ; then
7626         dflt=y
7627         rp='Your host name appears to be "'$myhostname'".'" Right?"
7628         . ./myread
7629         case "$ans" in
7630         y*) ;;
7631         *) myhostname='';;
7632         esac
7633 fi
7634
7635 : bad guess or no guess
7636 while $test "X$myhostname" = X ; do
7637         dflt=''
7638         rp="Please type the (one word) name of your host:"
7639         . ./myread
7640         myhostname="$ans"
7641 done
7642
7643 : translate upper to lower if necessary
7644 case "$myhostname" in
7645 *[A-Z]*)
7646         echo "(Normalizing case in your host name)"
7647         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7648         ;;
7649 esac
7650
7651 case "$myhostname" in
7652 *.*)
7653         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7654         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7655         echo "(Trimming domain name from host name--host name is now $myhostname)"
7656         ;;
7657 *) case "$mydomain" in
7658         '')
7659                 {
7660                         test "X$hostcat" = "Xypcat hosts" &&
7661                         ypmatch "$myhostname" hosts 2>/dev/null |\
7662                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7663                         $test -s hosts
7664                 } || {
7665                         test "X$hostcat" != "X" &&
7666                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7667                                         /[       ]$myhostname[  . ]/p" > hosts
7668                 }
7669                 tmp_re="[       . ]"
7670                 if $test -f hosts; then
7671                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7672                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7673                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7674                                 hosts | $sort | $uniq | \
7675                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7676                         case `$echo X$dflt` in
7677                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7678                                 dflt=.
7679                                 ;;
7680                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7681                                 ;;
7682                         esac
7683                 else
7684                         echo "(I cannot locate a hosts database anywhere)"
7685                         dflt=.
7686                 fi
7687                 case "$dflt" in
7688                 .)
7689                         tans=`./loc resolv.conf X /etc /usr/etc`
7690                         if $test -f "$tans"; then
7691                                 echo "(Attempting domain name extraction from $tans)"
7692                                 dflt=.`$sed -n -e 's/   / /g' \
7693                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7694                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7695                                 case "$dflt" in
7696                                 .) dflt=.`$sed -n -e 's/        / /g' \
7697                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7698                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7699                                         ;;
7700                                 esac
7701                         fi
7702                         ;;
7703                 esac
7704                 case "$dflt" in
7705                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7706                         dflt=.`sh -c domainname 2>/dev/null`
7707                         case "$dflt" in
7708                         '') dflt='.';;
7709                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7710                         esac
7711                         ;;
7712                 esac
7713                 case "$dflt$osname" in
7714                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7715                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7716                         ;;
7717                 esac
7718                 case "$dflt" in
7719                 .) echo "(Lost all hope -- silly guess then)"
7720                         dflt='.uucp'
7721                         ;;
7722                 esac
7723                 $rm -f hosts
7724                 ;;
7725         *) dflt="$mydomain";;
7726         esac;;
7727 esac
7728 echo " "
7729 rp="What is your domain name?"
7730 . ./myread
7731 tans="$ans"
7732 case "$ans" in
7733 '') ;;
7734 .*) ;;
7735 *) tans=".$tans";;
7736 esac
7737 mydomain="$tans"
7738
7739 : translate upper to lower if necessary
7740 case "$mydomain" in
7741 *[A-Z]*)
7742         echo "(Normalizing case in your domain name)"
7743         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7744         ;;
7745 esac
7746
7747 : a little sanity check here
7748 case "$phostname" in
7749 '') ;;
7750 *)
7751         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7752         $myhostname$mydomain|$myhostname) ;;
7753         *)
7754                 case "$phostname" in
7755                 sed*)
7756                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7757                         ;;
7758                 *)
7759                         echo "(That doesn't agree with your $phostname command, by the way.)"
7760                         ;;
7761                 esac
7762         ;;
7763         esac
7764         ;;
7765 esac
7766
7767 $cat <<EOM
7768
7769 I need to get your e-mail address in Internet format if possible, i.e.
7770 something like user@host.domain. Please answer accurately since I have
7771 no easy means to double check it. The default value provided below
7772 is most probably close to reality but may not be valid from outside
7773 your organization...
7774
7775 EOM
7776 cont=x
7777 while test "$cont"; do
7778         case "$cf_email" in
7779         '') dflt="$cf_by@$myhostname$mydomain";;
7780         *) dflt="$cf_email";;
7781         esac
7782         rp='What is your e-mail address?'
7783         . ./myread
7784         cf_email="$ans"
7785         case "$cf_email" in
7786         *@*.*) cont='' ;;
7787         *)
7788                 rp='Address does not look like an Internet one.  Use it anyway?'
7789                 case "$fastread" in
7790                 yes) dflt=y ;;
7791                 *) dflt=n ;;
7792                 esac
7793                 . ./myread
7794                 case "$ans" in
7795                 y*) cont='' ;;
7796                 *) echo " " ;;
7797                 esac
7798                 ;;
7799         esac
7800 done
7801
7802 $cat <<EOM
7803
7804 If you or somebody else will be maintaining perl at your site, please
7805 fill in the correct e-mail address here so that they may be contacted
7806 if necessary. Currently, the "perlbug" program included with perl
7807 will send mail to this address in addition to perlbug@perl.org. You may
7808 enter "none" for no administrator.
7809
7810 EOM
7811 case "$perladmin" in
7812 '') dflt="$cf_email";;
7813 *) dflt="$perladmin";;
7814 esac
7815 rp='Perl administrator e-mail address'
7816 . ./myread
7817 perladmin="$ans"
7818
7819 : determine whether to only install version-specific parts.
7820 echo " "
7821 $cat <<EOM
7822 Do you want to install only the version-specific parts of the perl
7823 distribution?  Usually you do *not* want to do this.
7824 EOM
7825 case "$versiononly" in
7826 "$define"|[Yy]*|true) dflt='y' ;;
7827 *) dflt='n';
7828 esac
7829 rp="Do you want to install only the version-specific parts of perl?"
7830 . ./myread
7831 case "$ans" in
7832 [yY]*)  val="$define";;
7833 *)      val="$undef" ;;
7834 esac
7835 set versiononly
7836 eval $setvar
7837
7838 : figure out how to guarantee perl startup
7839 case "$startperl" in
7840 '')
7841         case "$sharpbang" in
7842         *!)
7843                 $cat <<EOH
7844
7845 I can use the #! construct to start perl on your system. This will
7846 make startup of perl scripts faster, but may cause problems if you
7847 want to share those scripts and perl is not in a standard place
7848 ($binexp/perl) on all your platforms. The alternative is to force
7849 a shell by starting the script with a single ':' character.
7850
7851 EOH
7852                 case "$versiononly" in
7853                 "$define")      dflt="$binexp/perl$version";;  
7854                 *)              dflt="$binexp/perl";;
7855                 esac
7856                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7857                 . ./myread
7858                 case "$ans" in
7859                 none)   startperl=": # use perl";;
7860                 *)      startperl="#!$ans"
7861                         if $test 30 -lt `echo "$ans" | wc -c`; then
7862                                 $cat >&4 <<EOM
7863
7864 WARNING:  Some systems limit the #! command to 32 characters.
7865 If you experience difficulty running Perl scripts with #!, try
7866 installing Perl in a directory with a shorter pathname.
7867
7868 EOM
7869                         fi ;;
7870                 esac
7871                 ;;
7872         *) startperl=": # use perl"
7873                 ;;
7874         esac
7875         ;;
7876 esac
7877 echo "I'll use $startperl to start perl scripts."
7878
7879 : figure best path for perl in scripts
7880 case "$perlpath" in
7881 '')
7882         perlpath="$binexp/perl"
7883         case "$startperl" in
7884         *!*) ;;
7885         *)
7886                 $cat <<EOH
7887
7888 I will use the "eval 'exec'" idiom to start Perl on your system.
7889 I can use the full path of your Perl binary for this purpose, but
7890 doing so may cause problems if you want to share those scripts and
7891 Perl is not always in a standard place ($binexp/perl).
7892
7893 EOH
7894                 dflt="$binexp/perl"
7895                 rp="What path shall I use in \"eval 'exec'\"?"
7896                 . ./myread
7897                 perlpath="$ans"
7898                 ;;
7899         esac
7900         ;;
7901 esac
7902 case "$startperl" in
7903 *!*)    ;;
7904 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7905 esac
7906
7907 : determine where public executable scripts go
7908 set scriptdir scriptdir
7909 eval $prefixit
7910 case "$scriptdir" in
7911 '')
7912         dflt="$bin"
7913         : guess some guesses
7914         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7915         $test -d /usr/share/bin     && dflt=/usr/share/bin
7916         $test -d /usr/local/script  && dflt=/usr/local/script
7917         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7918         $test -d $prefixexp/script  && dflt=$prefixexp/script
7919         set dflt
7920         eval $prefixup
7921         ;;
7922 *)  dflt="$scriptdir"
7923         ;;
7924 esac
7925 $cat <<EOM
7926  
7927 Some installations have a separate directory just for executable scripts so
7928 that they can mount it across multiple architectures but keep the scripts in
7929 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7930 Or you might just lump your scripts in with all your other executables.
7931  
7932 EOM
7933 fn=d~
7934 rp='Where do you keep publicly executable scripts?'
7935 . ./getfile
7936 if $test "X$ansexp" != "X$scriptdirexp"; then
7937         installscript=''
7938 fi
7939 scriptdir="$ans"
7940 scriptdirexp="$ansexp"
7941 : Change installation prefix, if necessary.
7942 if $test X"$prefix" != X"$installprefix"; then
7943         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7944 else
7945         installscript="$scriptdirexp"
7946 fi
7947
7948 : determine where add-on public executables go
7949 case "$sitebin" in
7950 '')     dflt=$siteprefix/bin ;;
7951 *)      dflt=$sitebin ;;
7952 esac
7953 fn=d~
7954 rp='Pathname where the add-on public executables should be installed?'
7955 . ./getfile
7956 sitebin="$ans"
7957 sitebinexp="$ansexp"
7958 : Change installation prefix, if necessary.
7959 if $test X"$prefix" != X"$installprefix"; then
7960         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7961 else
7962         installsitebin="$sitebinexp"
7963 fi
7964
7965 case "$vendorprefix" in
7966 '')     d_vendorbin="$undef"
7967         vendorbin=''
7968         vendorbinexp=''
7969         ;;
7970 *)      d_vendorbin="$define"
7971         : determine where vendor-supplied executables go.
7972         case "$vendorbin" in
7973         '') dflt=$vendorprefix/bin ;;
7974         *)      dflt="$vendorbin" ;;
7975         esac
7976         fn=d~+
7977         rp='Pathname for the vendor-supplied executables directory?'
7978         . ./getfile
7979         vendorbin="$ans"
7980         vendorbinexp="$ansexp"
7981         ;;
7982 esac
7983 : Change installation prefix, if necessary.
7984 if $test X"$prefix" != X"$installprefix"; then
7985         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7986 else
7987         installvendorbin="$vendorbinexp"
7988 fi
7989
7990 : see if qgcvt exists
7991 set qgcvt d_qgcvt
7992 eval $inlibc
7993
7994 echo " "
7995
7996 if $test X"$d_longdbl" = X"$define"; then
7997
7998 echo "Checking how to print long doubles..." >&4
7999
8000 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8001         $cat >try.c <<'EOCP'
8002 #include <sys/types.h>
8003 #include <stdio.h>
8004 int main() {
8005   double d = 123.456;
8006   printf("%.3f\n", d);
8007 }
8008 EOCP
8009         set try
8010         if eval $compile; then
8011                 yyy=`./try$exe_ext`
8012                 case "$yyy" in
8013                 123.456)
8014                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8015                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8016                         echo "We will use %f."
8017                         ;;
8018                 esac
8019         fi
8020 fi
8021
8022 if $test X"$sPRIfldbl" = X; then
8023         $cat >try.c <<'EOCP'
8024 #include <sys/types.h>
8025 #include <stdio.h>
8026 int main() {
8027   long double d = 123.456;
8028   printf("%.3llf\n", d);
8029 }
8030 EOCP
8031         set try
8032         if eval $compile; then
8033                 yyy=`./try$exe_ext`
8034                 case "$yyy" in
8035                 123.456)
8036                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8037                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8038                         echo "We will use %llf."
8039                         ;;
8040                 esac
8041         fi
8042 fi
8043
8044 if $test X"$sPRIfldbl" = X; then
8045         $cat >try.c <<'EOCP'
8046 #include <sys/types.h>
8047 #include <stdio.h>
8048 int main() {
8049   long double d = 123.456;
8050   printf("%.3Lf\n", d);
8051 }
8052 EOCP
8053         set try
8054         if eval $compile; then
8055                 yyy=`./try$exe_ext`
8056                 case "$yyy" in
8057                 123.456)
8058                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8059                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8060                         echo "We will use %Lf."
8061                         ;;
8062                 esac
8063         fi
8064 fi
8065
8066 if $test X"$sPRIfldbl" = X; then
8067         $cat >try.c <<'EOCP'
8068 #include <sys/types.h>
8069 #include <stdio.h>
8070 int main() {
8071   long double d = 123.456;
8072   printf("%.3lf\n", d);
8073 }
8074 EOCP
8075         set try
8076         if eval $compile; then
8077                 yyy=`./try$exe_ext`
8078                 case "$yyy" in
8079                 123.456)
8080                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8081                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8082                         echo "We will use %lf."
8083                         ;;
8084                 esac
8085         fi
8086 fi
8087
8088 if $test X"$sPRIfldbl" = X; then
8089         echo "Cannot figure out how to print long doubles." >&4
8090 else
8091         sSCNfldbl=$sPRIfldbl    # expect consistency
8092 fi
8093
8094 $rm -f try try.*
8095
8096 fi # d_longdbl
8097
8098 case "$sPRIfldbl" in
8099 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8100         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8101         d_SCNfldbl="$undef";
8102         ;;
8103 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8104         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8105         d_SCNfldbl="$define";
8106         ;;
8107 esac
8108
8109 : Check how to convert floats to strings.
8110 echo " "
8111 echo "Checking for an efficient way to convert floats to strings."
8112 echo " " > try.c
8113 case "$uselongdouble" in
8114 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8115 esac
8116 case "$d_longdbl" in
8117 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8118 esac
8119 case "$d_PRIgldbl" in
8120 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8121 esac
8122 $cat >>try.c <<EOP
8123 #ifdef TRY_gconvert
8124 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8125 char *myname = "gconvert";
8126 #endif
8127 #ifdef TRY_gcvt
8128 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8129 char *myname = "gcvt";
8130 #endif
8131 #ifdef TRY_qgcvt
8132 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8133 char *myname = "qgcvt";
8134 #define DOUBLETYPE long double
8135 #endif
8136 #ifdef TRY_sprintf
8137 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8138 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8139 #else
8140 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8141 #endif
8142 char *myname = "sprintf";
8143 #endif
8144
8145 #ifndef DOUBLETYPE
8146 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8147 #define DOUBLETYPE long double
8148 #else
8149 #define DOUBLETYPE double
8150 #endif
8151 #endif
8152
8153 #include <stdio.h>
8154
8155 #define I_STDLIB $i_stdlib
8156 #ifdef I_STDLIB
8157 #include <stdlib.h>
8158 #endif
8159
8160 int
8161 checkit(expect, got)
8162 char *expect;
8163 char *got;
8164 {
8165     if (strcmp(expect, got)) {
8166                 printf("%s oddity:  Expected %s, got %s\n",
8167                         myname, expect, got);
8168                 exit(1);
8169         }
8170 }
8171
8172 int main()
8173
8174         char buf[64]; 
8175         buf[63] = '\0';
8176
8177         /* This must be 1st test on (which?) platform */
8178         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8179         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8180         checkit("0.1", buf);
8181
8182         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8183         checkit("1", buf);
8184
8185         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8186         checkit("1.1", buf);
8187
8188         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8189         checkit("1.01", buf);
8190
8191         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8192         checkit("1.001", buf);
8193
8194         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8195         checkit("1.0001", buf);
8196
8197         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8198         checkit("1.00001", buf);
8199
8200         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8201         checkit("1.000001", buf);
8202
8203         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8204         checkit("0", buf);
8205
8206         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8207         checkit("-1", buf);
8208
8209         /* Some Linux gcvt's give 1.e+5 here. */
8210         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8211         checkit("100000", buf);
8212         
8213         /* Some Linux gcvt's give -1.e+5 here. */
8214         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8215         checkit("-100000", buf);
8216
8217         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8218         checkit("123.456", buf);
8219
8220         exit(0);
8221 }
8222 EOP
8223 case "$d_Gconvert" in
8224 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8225 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8226 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8227 *) xxx_list='gconvert gcvt sprintf' ;;
8228 esac
8229
8230 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8231 "$define$define$define")
8232     # for long doubles prefer first qgcvt, then sprintf
8233     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8234     xxx_list="sprintf $xxx_list"
8235     case "$d_qgcvt" in
8236     "$define") xxx_list="qgcvt $xxx_list" ;;
8237     esac
8238     ;;
8239 esac
8240
8241 for xxx_convert in $xxx_list; do
8242         echo "Trying $xxx_convert..."
8243         $rm -f try try$_o
8244         set try -DTRY_$xxx_convert
8245         if eval $compile; then
8246                 echo "$xxx_convert() found." >&4
8247                 if ./try; then
8248                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8249                         break;
8250                 else
8251                         echo "...But $xxx_convert didn't work as I expected."
8252                 fi
8253         else
8254                 echo "$xxx_convert NOT found." >&4
8255         fi
8256 done
8257         
8258 case "$xxx_convert" in
8259 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8260 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8261 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8262 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8263    "$define$define$define")
8264       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8265    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8266    esac
8267    ;;  
8268 esac
8269
8270 : see if _fwalk exists
8271 set fwalk d__fwalk
8272 eval $inlibc
8273
8274 : Initialize h_fcntl
8275 h_fcntl=false
8276
8277 : Initialize h_sysfile
8278 h_sysfile=false
8279
8280 : access call always available on UNIX
8281 set access d_access
8282 eval $inlibc
8283
8284 : locate the flags for 'access()'
8285 case "$d_access" in
8286 "$define")
8287         echo " "
8288         $cat >access.c <<'EOCP'
8289 #include <sys/types.h>
8290 #ifdef I_FCNTL
8291 #include <fcntl.h>
8292 #endif
8293 #ifdef I_SYS_FILE
8294 #include <sys/file.h>
8295 #endif
8296 #ifdef I_UNISTD
8297 #include <unistd.h>
8298 #endif
8299 int main() {
8300         exit(R_OK);
8301 }
8302 EOCP
8303         : check sys/file.h first, no particular reason here
8304         if $test `./findhdr sys/file.h` && \
8305                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8306                 h_sysfile=true;
8307                 echo "<sys/file.h> defines the *_OK access constants." >&4
8308         elif $test `./findhdr fcntl.h` && \
8309                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8310                 h_fcntl=true;
8311                 echo "<fcntl.h> defines the *_OK access constants." >&4
8312         elif $test `./findhdr unistd.h` && \
8313                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8314                 echo "<unistd.h> defines the *_OK access constants." >&4
8315         else
8316                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8317         fi
8318         ;;
8319 esac
8320 $rm -f access*
8321
8322 : see if accessx exists
8323 set accessx d_accessx
8324 eval $inlibc
8325
8326 : see if alarm exists
8327 set alarm d_alarm
8328 eval $inlibc
8329
8330 : see if atolf exists
8331 set atolf d_atolf
8332 eval $inlibc
8333
8334 : see if atoll exists
8335 set atoll d_atoll
8336 eval $inlibc
8337
8338 : Look for GNU-cc style attribute checking
8339 echo " "
8340 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8341 $cat >attrib.c <<'EOCP'
8342 #include <stdio.h>
8343 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8344 EOCP
8345 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8346         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8347                 echo "Your C compiler doesn't fully support __attribute__."
8348                 val="$undef"
8349         else
8350                 echo "Your C compiler supports __attribute__."
8351                 val="$define"
8352         fi
8353 else
8354         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8355         val="$undef"
8356 fi
8357 set d_attribut
8358 eval $setvar
8359 $rm -f attrib*
8360
8361 : see if bcmp exists
8362 set bcmp d_bcmp
8363 eval $inlibc
8364
8365 : see if bcopy exists
8366 set bcopy d_bcopy
8367 eval $inlibc
8368
8369 : see if this is a unistd.h system
8370 set unistd.h i_unistd
8371 eval $inhdr
8372
8373 : see if getpgrp exists
8374 set getpgrp d_getpgrp
8375 eval $inlibc
8376
8377 case "$d_getpgrp" in
8378 "$define")
8379         echo " "
8380         echo "Checking to see which flavor of getpgrp is in use..."
8381         $cat >set.c <<EOP
8382 #$i_unistd I_UNISTD
8383 #include <sys/types.h>
8384 #ifdef I_UNISTD
8385 #  include <unistd.h>
8386 #endif
8387 int main()
8388 {
8389         if (getuid() == 0) {
8390                 printf("(I see you are running Configure as super-user...)\n");
8391                 setuid(1);
8392         }
8393 #ifdef TRY_BSD_PGRP
8394         if (getpgrp(1) == 0)
8395                 exit(0);
8396 #else
8397         if (getpgrp() > 0)
8398                 exit(0);
8399 #endif
8400         exit(1);
8401 }
8402 EOP
8403         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8404                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8405                 val="$define"
8406         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8407                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8408                 val="$undef"
8409         else
8410                 echo "I can't seem to compile and run the test program."
8411                 if ./usg; then
8412                         xxx="a USG one, i.e. you use getpgrp()."
8413                 else
8414                         # SVR4 systems can appear rather BSD-ish.
8415                         case "$i_unistd" in
8416                         $undef)
8417                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8418                                 val="$define"
8419                                 ;;
8420                         $define)
8421                                 xxx="probably a USG one, i.e. you use getpgrp()."
8422                                 val="$undef"
8423                                 ;;
8424                         esac
8425                 fi
8426                 echo "Assuming your getpgrp is $xxx" >&4
8427         fi
8428         ;;
8429 *) val="$undef";;
8430 esac
8431 set d_bsdgetpgrp
8432 eval $setvar
8433 $rm -f set set.c
8434
8435 : see if setpgrp exists
8436 set setpgrp d_setpgrp
8437 eval $inlibc
8438
8439 case "$d_setpgrp" in
8440 "$define")
8441         echo " "
8442         echo "Checking to see which flavor of setpgrp is in use..."
8443         $cat >set.c <<EOP
8444 #$i_unistd I_UNISTD
8445 #include <sys/types.h>
8446 #ifdef I_UNISTD
8447 #  include <unistd.h>
8448 #endif
8449 int main()
8450 {
8451         if (getuid() == 0) {
8452                 printf("(I see you are running Configure as super-user...)\n");
8453                 setuid(1);
8454         }
8455 #ifdef TRY_BSD_PGRP
8456         if (-1 == setpgrp(1, 1))
8457                 exit(0);
8458 #else
8459         if (setpgrp() != -1)
8460                 exit(0);
8461 #endif
8462         exit(1);
8463 }
8464 EOP
8465         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8466                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8467                 val="$define"
8468         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8469                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8470                 val="$undef"
8471         else
8472                 echo "(I can't seem to compile and run the test program.)"
8473                 if ./usg; then
8474                         xxx="a USG one, i.e. you use setpgrp()."
8475                 else
8476                         # SVR4 systems can appear rather BSD-ish.
8477                         case "$i_unistd" in
8478                         $undef)
8479                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8480                                 val="$define"
8481                                 ;;
8482                         $define)
8483                                 xxx="probably a USG one, i.e. you use setpgrp()."
8484                                 val="$undef"
8485                                 ;;
8486                         esac
8487                 fi
8488                 echo "Assuming your setpgrp is $xxx" >&4
8489         fi
8490         ;;
8491 *) val="$undef";;
8492 esac
8493 set d_bsdsetpgrp
8494 eval $setvar
8495 $rm -f set set.c
8496 : see if bzero exists
8497 set bzero d_bzero
8498 eval $inlibc
8499
8500 : see if signal is declared as pointer to function returning int or void
8501 echo " "
8502 xxx=`./findhdr signal.h`
8503 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8504 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8505         echo "You have int (*signal())() instead of void." >&4
8506         val="$undef"
8507 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8508         echo "You have void (*signal())()." >&4
8509         val="$define"
8510 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8511         echo "You have int (*signal())() instead of void." >&4
8512         val="$undef"
8513 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8514         echo "You have void (*signal())()." >&4
8515         val="$define"
8516 else
8517         case "$d_voidsig" in
8518         '')
8519         echo "I can't determine whether signal handler returns void or int..." >&4
8520                 dflt=void
8521                 rp="What type does your signal handler return?"
8522                 . ./myread
8523                 case "$ans" in
8524                 v*) val="$define";;
8525                 *) val="$undef";;
8526                 esac;;
8527         "$define")
8528                 echo "As you already told me, signal handler returns void." >&4
8529                 val="$define"
8530                 ;;
8531         *)      echo "As you already told me, signal handler returns int." >&4
8532                 val="$undef"
8533                 ;;
8534         esac
8535 fi
8536 set d_voidsig
8537 eval $setvar
8538 case "$d_voidsig" in
8539 "$define") signal_t="void";;
8540 *) signal_t="int";;
8541 esac
8542 $rm -f $$.tmp
8543
8544 : check for ability to cast large floats to 32-bit ints.
8545 echo " "
8546 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8547 if $test "$intsize" -ge 4; then
8548         xxx=int
8549 else
8550         xxx=long
8551 fi
8552 $cat >try.c <<EOCP
8553 #include <stdio.h>
8554 #include <sys/types.h>
8555 #include <signal.h>
8556 $signal_t blech(s) int s; { exit(3); }
8557 int main()
8558 {
8559         $xxx i32;
8560         double f, g;
8561         int result = 0;
8562         char str[16];
8563         signal(SIGFPE, blech);
8564
8565         /* Don't let compiler optimize the test away.  Store the number 
8566            in a writable string for gcc to pass to sscanf under HP/UX.
8567         */
8568         sprintf(str, "2147483647");
8569         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8570         g = 10 * f;
8571         i32  = ($xxx) g;
8572
8573         /* x86 processors will probably give 0x8000 0000, which is a
8574        sign change.  We don't want that.  We want to mimic SPARC
8575            behavior here, which is to preserve the sign and give
8576            back 0x7fff ffff.
8577         */
8578         if (i32 != ($xxx) f)
8579                 result |= 1;
8580         exit(result);
8581 }
8582 EOCP
8583 set try
8584 if eval $compile_ok; then
8585         ./try
8586         yyy=$?
8587 else
8588         echo "(I can't seem to compile the test program--assuming it can't)"
8589         yyy=1
8590 fi
8591 case "$yyy" in
8592 0)      val="$define"
8593         echo "Yup, it can."
8594         ;;
8595 *)      val="$undef"
8596         echo "Nope, it can't."
8597         ;;
8598 esac
8599 set d_casti32
8600 eval $setvar
8601 $rm -f try try.*
8602
8603 : check for ability to cast negative floats to unsigned
8604 echo " "
8605 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8606 $cat >try.c <<EOCP
8607 #include <stdio.h>
8608 #include <sys/types.h>
8609 #include <signal.h>
8610 $signal_t blech(s) int s; { exit(7); }
8611 $signal_t blech_in_list(s) int s; { exit(4); }
8612 unsigned long dummy_long(p) unsigned long p; { return p; }
8613 unsigned int dummy_int(p) unsigned int p; { return p; }
8614 unsigned short dummy_short(p) unsigned short p; { return p; }
8615 int main()
8616 {
8617         double f;
8618         unsigned long along;
8619         unsigned int aint;
8620         unsigned short ashort;
8621         int result = 0;
8622         char str[16];
8623         
8624         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8625            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8626            optimized the whole file away
8627         */
8628         /* Store the number in a writable string for gcc to pass to 
8629            sscanf under HP/UX.
8630         */
8631         sprintf(str, "-123");
8632         sscanf(str, "%lf", &f);  /* f = -123.; */
8633
8634         signal(SIGFPE, blech);
8635         along = (unsigned long)f;
8636         aint = (unsigned int)f;
8637         ashort = (unsigned short)f;
8638         if (along != (unsigned long)-123)
8639                 result |= 1;
8640         if (aint != (unsigned int)-123)
8641                 result |= 1;
8642         if (ashort != (unsigned short)-123)
8643                 result |= 1;
8644         sprintf(str, "1073741824.");
8645         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8646         f = f + f;
8647         along = 0;
8648         along = (unsigned long)f;
8649         if (along != 0x80000000)
8650                 result |= 2;
8651         f -= 1.;
8652         along = 0;
8653         along = (unsigned long)f;
8654         if (along != 0x7fffffff)
8655                 result |= 1;
8656         f += 2.;
8657         along = 0;
8658         along = (unsigned long)f;
8659         if (along != 0x80000001)
8660                 result |= 2;
8661         if (result)
8662                 exit(result);
8663         signal(SIGFPE, blech_in_list);
8664         sprintf(str, "123.");
8665         sscanf(str, "%lf", &f);  /* f = 123.; */
8666         along = dummy_long((unsigned long)f);
8667         aint = dummy_int((unsigned int)f);
8668         ashort = dummy_short((unsigned short)f);
8669         if (along != (unsigned long)123)
8670                 result |= 4;
8671         if (aint != (unsigned int)123)
8672                 result |= 4;
8673         if (ashort != (unsigned short)123)
8674                 result |= 4;
8675         exit(result);
8676
8677 }
8678 EOCP
8679 set try
8680 if eval $compile_ok; then
8681         ./try
8682         castflags=$?
8683 else
8684         echo "(I can't seem to compile the test program--assuming it can't)"
8685         castflags=7
8686 fi
8687 case "$castflags" in
8688 0)      val="$define"
8689         echo "Yup, it can."
8690         ;;
8691 *)      val="$undef"
8692         echo "Nope, it can't."
8693         ;;
8694 esac
8695 set d_castneg
8696 eval $setvar
8697 $rm -f try.*
8698
8699 : see if vprintf exists
8700 echo " "
8701 if set vprintf val -f d_vprintf; eval $csym; $val; then
8702         echo 'vprintf() found.' >&4
8703         val="$define"
8704         $cat >vprintf.c <<'EOF'
8705 #include <varargs.h>
8706
8707 int main() { xxx("foo"); }
8708
8709 xxx(va_alist)
8710 va_dcl
8711 {
8712         va_list args;
8713         char buf[10];
8714
8715         va_start(args);
8716         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8717 }
8718 EOF
8719         set vprintf
8720         if eval $compile && ./vprintf; then
8721                 echo "Your vsprintf() returns (int)." >&4
8722                 val2="$undef"
8723         else
8724                 echo "Your vsprintf() returns (char*)." >&4
8725                 val2="$define"
8726         fi
8727 else
8728         echo 'vprintf() NOT found.' >&4
8729                 val="$undef"
8730                 val2="$undef"
8731 fi
8732 set d_vprintf
8733 eval $setvar
8734 val=$val2
8735 set d_charvspr
8736 eval $setvar
8737
8738 : see if chown exists
8739 set chown d_chown
8740 eval $inlibc
8741
8742 : see if chroot exists
8743 set chroot d_chroot
8744 eval $inlibc
8745
8746 : see if chsize exists
8747 set chsize d_chsize
8748 eval $inlibc
8749
8750 hasstruct='varname=$1; struct=$2; shift; shift;
8751 while $test $# -ge 2; do
8752         case "$1" in
8753         $define) echo "#include <$2>";;
8754         esac ;
8755     shift 2;
8756 done > try.c;
8757 echo "int main () { struct $struct foo; }" >> try.c;
8758 set try;
8759 if eval $compile; then
8760         val="$define";
8761 else
8762         val="$undef";
8763 fi;
8764 set $varname;
8765 eval $setvar;
8766 $rm -f try.c try.o'
8767
8768 : see if sys/types.h has to be included
8769 set sys/types.h i_systypes
8770 eval $inhdr
8771
8772 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8773 while $test $# -ge 2; do
8774         case "$1" in
8775         $define) echo "#include <$2>";;
8776         esac ;
8777     shift 2;
8778 done > try.c;
8779 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8780 set try;
8781 if eval $compile; then
8782         val="$define";
8783 else
8784         val="$undef";
8785 fi;
8786 set $varname;
8787 eval $setvar;
8788 $rm -f try.c try.o'
8789
8790 socketlib=''
8791 sockethdr=''
8792 : see whether socket exists
8793 echo " "
8794 $echo $n "Hmm... $c" >&4
8795 if set socket val -f d_socket; eval $csym; $val; then
8796         echo "Looks like you have Berkeley networking support." >&4
8797         d_socket="$define"
8798         if set setsockopt val -f; eval $csym; $val; then
8799                 d_oldsock="$undef"
8800         else
8801                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8802                 d_oldsock="$define"
8803         fi
8804 else
8805         if $contains socklib libc.list >/dev/null 2>&1; then
8806                 echo "Looks like you have Berkeley networking support." >&4
8807                 d_socket="$define"
8808                 : we will have to assume that it supports the 4.2 BSD interface
8809                 d_oldsock="$undef"
8810         else
8811                 echo "You don't have Berkeley networking in libc$_a..." >&4
8812                 if test "X$d_socket" = "X$define"; then
8813                    echo "...but you seem to believe that you have sockets." >&4
8814                 else
8815                         for net in net socket
8816                         do
8817                                 if test -f /usr/lib/lib$net$_a; then
8818                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8819                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8820                                         if $contains socket libc.list >/dev/null 2>&1; then
8821                                                 d_socket="$define"
8822                                                 socketlib="-l$net"
8823                                                 case "$net" in
8824                                                 net)
8825                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8826                                                         sockethdr="-I/usr/netinclude"
8827                                                         ;;
8828                                                 esac
8829                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8830                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8831                                                         d_oldsock="$undef"
8832                                                 else
8833                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8834                                                         d_oldsock="$define"
8835                                                 fi
8836                                                 break
8837                                         fi
8838                                 fi
8839                         done
8840                         if test "X$d_socket" != "X$define"; then
8841                            echo "or anywhere else I see." >&4
8842                            d_socket="$undef"
8843                            d_oldsock="$undef"
8844                         fi
8845                 fi
8846         fi
8847 fi
8848
8849 : see if socketpair exists
8850 set socketpair d_sockpair
8851 eval $inlibc
8852
8853
8854 echo " "
8855 echo "Checking the availability of certain socket constants..." >& 4
8856 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8857         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8858         $cat >try.c <<EOF
8859 #include <sys/types.h>
8860 #include <sys/socket.h>
8861 int main() {
8862     int i = $ENUM;
8863 }
8864 EOF
8865         val="$undef"
8866         set try; if eval $compile; then
8867                 val="$define"
8868         fi
8869         set d_${enum}; eval $setvar
8870         $rm -f try.c try
8871 done
8872
8873 : see if this is a sys/uio.h system
8874 set sys/uio.h i_sysuio
8875 eval $inhdr
8876
8877
8878 echo " "
8879 echo "Checking to see if your system supports struct cmsghdr..." >&4
8880 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8881 eval $hasstruct
8882 case "$d_cmsghdr_s" in
8883 "$define")      echo "Yes, it does."   ;;
8884 *)              echo "No, it doesn't." ;;
8885 esac
8886
8887
8888 : check for const keyword
8889 echo " "
8890 echo 'Checking to see if your C compiler knows about "const"...' >&4
8891 $cat >const.c <<'EOCP'
8892 typedef struct spug { int drokk; } spug;
8893 int main()
8894 {
8895         const char *foo;
8896         const spug y;
8897 }
8898 EOCP
8899 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8900         val="$define"
8901         echo "Yup, it does."
8902 else
8903         val="$undef"
8904         echo "Nope, it doesn't."
8905 fi
8906 set d_const
8907 eval $setvar
8908
8909 : see if crypt exists
8910 echo " "
8911 if set crypt val -f d_crypt; eval $csym; $val; then
8912         echo 'crypt() found.' >&4
8913         val="$define"
8914         cryptlib=''
8915 else
8916         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8917         if $test -z "$cryptlib"; then
8918                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8919         else
8920                 cryptlib=-lcrypt
8921         fi
8922         if $test -z "$cryptlib"; then
8923                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8924         else
8925                 cryptlib=-lcrypt
8926         fi
8927         if $test -z "$cryptlib"; then
8928                 cryptlib=`./loc libcrypt$_a "" $libpth`
8929         else
8930                 cryptlib=-lcrypt
8931         fi
8932         if $test -z "$cryptlib"; then
8933                 echo 'crypt() NOT found.' >&4
8934                 val="$undef"
8935         else
8936                 val="$define"
8937         fi
8938 fi
8939 set d_crypt
8940 eval $setvar
8941
8942 : get csh whereabouts
8943 case "$csh" in
8944 'csh') val="$undef" ;;
8945 *) val="$define" ;;
8946 esac
8947 set d_csh
8948 eval $setvar
8949 : Respect a hint or command line value for full_csh.
8950 case "$full_csh" in
8951 '') full_csh=$csh ;;
8952 esac
8953
8954 : see if cuserid exists
8955 set cuserid d_cuserid
8956 eval $inlibc
8957
8958 : see if this is a limits.h system
8959 set limits.h i_limits
8960 eval $inhdr
8961
8962 : see if this is a float.h system
8963 set float.h i_float
8964 eval $inhdr
8965
8966 : See if number of significant digits in a double precision number is known
8967 echo " "
8968 $cat >dbl_dig.c <<EOM
8969 #$i_limits I_LIMITS
8970 #$i_float I_FLOAT
8971 #ifdef I_LIMITS
8972 #include <limits.h>
8973 #endif
8974 #ifdef I_FLOAT
8975 #include <float.h>
8976 #endif
8977 #ifdef DBL_DIG
8978 printf("Contains DBL_DIG");
8979 #endif
8980 EOM
8981 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8982 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8983         echo "DBL_DIG found." >&4
8984         val="$define"
8985 else
8986         echo "DBL_DIG NOT found." >&4
8987         val="$undef"
8988 fi
8989 $rm -f dbl_dig.?
8990 set d_dbl_dig
8991 eval $setvar
8992
8993 : see if difftime exists
8994 set difftime d_difftime
8995 eval $inlibc
8996
8997 : see if this is a dirent system
8998 echo " "
8999 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9000         val="$define"
9001         echo "<dirent.h> found." >&4
9002 else
9003         val="$undef"
9004         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9005                 echo "<sys/dir.h> found." >&4
9006                 echo " "
9007         else
9008                 xinc=`./findhdr sys/ndir.h`
9009         fi
9010         echo "<dirent.h> NOT found." >&4
9011 fi
9012 set i_dirent
9013 eval $setvar
9014
9015 : Look for type of directory structure.
9016 echo " "
9017 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9018
9019 case "$direntrytype" in
9020 ''|' ')
9021         case "$i_dirent" in
9022         $define) guess1='struct dirent' ;;
9023         *) guess1='struct direct'  ;;
9024         esac
9025         ;;
9026 *)      guess1="$direntrytype"
9027         ;;
9028 esac
9029
9030 case "$guess1" in
9031 'struct dirent') guess2='struct direct' ;;
9032 *) guess2='struct dirent' ;;
9033 esac
9034                 
9035 if $contains "$guess1" try.c >/dev/null 2>&1; then
9036         direntrytype="$guess1"
9037         echo "Your directory entries are $direntrytype." >&4
9038 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9039         direntrytype="$guess2"
9040         echo "Your directory entries seem to be $direntrytype." >&4
9041 else
9042         echo "I don't recognize your system's directory entries." >&4
9043         rp="What type is used for directory entries on this system?"
9044         dflt="$guess1"
9045         . ./myread
9046         direntrytype="$ans"
9047 fi
9048 $rm -f try.c
9049
9050
9051 : see if the directory entry stores field length
9052 echo " "
9053 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9054 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9055         echo "Good, your directory entry keeps length information in d_namlen." >&4
9056         val="$define"
9057 else
9058         echo "Your directory entry does not know about the d_namlen field." >&4
9059         val="$undef"
9060 fi
9061 set d_dirnamlen
9062 eval $setvar
9063 $rm -f try.c
9064
9065 : see if dlerror exists
9066 xxx_runnm="$runnm"
9067 runnm=false
9068 set dlerror d_dlerror
9069 eval $inlibc
9070 runnm="$xxx_runnm"
9071
9072 : see if dlfcn is available
9073 set dlfcn.h i_dlfcn
9074 eval $inhdr
9075
9076 case "$usedl" in
9077 $define|y|true)
9078         $cat << EOM
9079
9080 On a few systems, the dynamically loaded modules that perl generates and uses
9081 will need a different extension than shared libs. The default will probably
9082 be appropriate.
9083
9084 EOM
9085         case "$dlext" in
9086         '')     dflt="$so" ;;
9087         *)      dflt="$dlext" ;;
9088         esac
9089         rp='What is the extension of dynamically loaded modules'
9090         . ./myread
9091         dlext="$ans"
9092         ;;
9093 *)
9094         dlext="none"
9095         ;;
9096 esac
9097
9098 : Check if dlsym need a leading underscore
9099 echo " "
9100 val="$undef"
9101
9102 case "$dlsrc" in
9103 dl_dlopen.xs)
9104         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9105         $cat >dyna.c <<'EOM'
9106 fred () { }
9107 EOM
9108
9109 $cat >fred.c<<EOM
9110
9111 #include <stdio.h>
9112 #$i_dlfcn I_DLFCN
9113 #ifdef I_DLFCN
9114 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9115 #else
9116 #include <sys/types.h>
9117 #include <nlist.h>
9118 #include <link.h>
9119 #endif
9120
9121 extern int fred() ;
9122
9123 int main()
9124 {
9125     void * handle ;
9126     void * symbol ;
9127 #ifndef RTLD_LAZY
9128     int mode = 1 ;
9129 #else
9130     int mode = RTLD_LAZY ;
9131 #endif
9132     handle = dlopen("./dyna.$dlext", mode) ;
9133     if (handle == NULL) {
9134         printf ("1\n") ;
9135         fflush (stdout) ;
9136         exit(0);
9137     }
9138     symbol = dlsym(handle, "fred") ;
9139     if (symbol == NULL) {
9140         /* try putting a leading underscore */
9141         symbol = dlsym(handle, "_fred") ;
9142         if (symbol == NULL) {
9143             printf ("2\n") ;
9144             fflush (stdout) ;
9145             exit(0);
9146         }
9147         printf ("3\n") ;
9148     }
9149     else
9150         printf ("4\n") ;
9151     fflush (stdout) ;
9152     exit(0);
9153 }
9154 EOM
9155         : Call the object file tmp-dyna.o in case dlext=o.
9156         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9157                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9158                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9159                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9160                 xxx=`./fred`
9161                 case $xxx in
9162                 1)      echo "Test program failed using dlopen." >&4
9163                         echo "Perhaps you should not use dynamic loading." >&4;;
9164                 2)      echo "Test program failed using dlsym." >&4
9165                         echo "Perhaps you should not use dynamic loading." >&4;;
9166                 3)      echo "dlsym needs a leading underscore" >&4
9167                         val="$define" ;;
9168                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9169                 esac
9170         else
9171                 echo "I can't compile and run the test program." >&4
9172                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9173         fi
9174         ;;
9175 esac
9176                 
9177 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9178
9179 set d_dlsymun
9180 eval $setvar
9181
9182 hasproto='varname=$1; func=$2; shift; shift;
9183 while $test $# -ge 2; do
9184         case "$1" in
9185         $define) echo "#include <$2>";;
9186         esac ;
9187     shift 2;
9188 done > try.c;
9189 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9190 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9191         echo "$func() prototype found.";
9192         val="$define";
9193 else
9194         echo "$func() prototype NOT found.";
9195         val="$undef";
9196 fi;
9197 set $varname;
9198 eval $setvar;
9199 $rm -f try.c tryout.c'
9200
9201 : see if prototype for drand48 is available
9202 echo " "
9203 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9204 eval $hasproto
9205
9206 : see if dup2 exists
9207 set dup2 d_dup2
9208 eval $inlibc
9209
9210 : see if eaccess exists
9211 set eaccess d_eaccess
9212 eval $inlibc
9213
9214 : see if endgrent exists
9215 set endgrent d_endgrent
9216 eval $inlibc
9217
9218 : see if endhostent exists
9219 set endhostent d_endhent
9220 eval $inlibc
9221
9222 : see if endnetent exists
9223 set endnetent d_endnent
9224 eval $inlibc
9225
9226 : see if endprotoent exists
9227 set endprotoent d_endpent
9228 eval $inlibc
9229
9230 : see if endpwent exists
9231 set endpwent d_endpwent
9232 eval $inlibc
9233
9234 : see if endservent exists
9235 set endservent d_endsent
9236 eval $inlibc
9237
9238 : Locate the flags for 'open()'
9239 echo " "
9240 $cat >open3.c <<'EOCP'
9241 #include <sys/types.h>
9242 #ifdef I_FCNTL
9243 #include <fcntl.h>
9244 #endif
9245 #ifdef I_SYS_FILE
9246 #include <sys/file.h>
9247 #endif
9248 int main() {
9249         if(O_RDONLY);
9250 #ifdef O_TRUNC
9251         exit(0);
9252 #else
9253         exit(1);
9254 #endif
9255 }
9256 EOCP
9257 : check sys/file.h first to get FREAD on Sun
9258 if $test `./findhdr sys/file.h` && \
9259                 set open3 -DI_SYS_FILE && eval $compile; then
9260         h_sysfile=true;
9261         echo "<sys/file.h> defines the O_* constants..." >&4
9262         if ./open3; then
9263                 echo "and you have the 3 argument form of open()." >&4
9264                 val="$define"
9265         else
9266                 echo "but not the 3 argument form of open().  Oh, well." >&4
9267                 val="$undef"
9268         fi
9269 elif $test `./findhdr fcntl.h` && \
9270                 set open3 -DI_FCNTL && eval $compile; then
9271         h_fcntl=true;
9272         echo "<fcntl.h> defines the O_* constants..." >&4
9273         if ./open3; then
9274                 echo "and you have the 3 argument form of open()." >&4
9275                 val="$define"
9276         else
9277                 echo "but not the 3 argument form of open().  Oh, well." >&4
9278                 val="$undef"
9279         fi
9280 else
9281         val="$undef"
9282         echo "I can't find the O_* constant definitions!  You got problems." >&4
9283 fi
9284 set d_open3
9285 eval $setvar
9286 $rm -f open3*
9287
9288 : see which of string.h or strings.h is needed
9289 echo " "
9290 strings=`./findhdr string.h`
9291 if $test "$strings" && $test -r "$strings"; then
9292         echo "Using <string.h> instead of <strings.h>." >&4
9293         val="$define"
9294 else
9295         val="$undef"
9296         strings=`./findhdr strings.h`
9297         if $test "$strings" && $test -r "$strings"; then
9298                 echo "Using <strings.h> instead of <string.h>." >&4
9299         else
9300                 echo "No string header found -- You'll surely have problems." >&4
9301         fi
9302 fi
9303 set i_string
9304 eval $setvar
9305 case "$i_string" in
9306 "$undef") strings=`./findhdr strings.h`;;
9307 *)        strings=`./findhdr string.h`;;
9308 esac
9309
9310 : check for non-blocking I/O stuff
9311 case "$h_sysfile" in
9312 true) echo "#include <sys/file.h>" > head.c;;
9313 *)
9314        case "$h_fcntl" in
9315        true) echo "#include <fcntl.h>" > head.c;;
9316        *) echo "#include <sys/fcntl.h>" > head.c;;
9317        esac
9318        ;;
9319 esac
9320 echo " "
9321 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9322 case "$o_nonblock" in
9323 '')
9324         $cat head.c > try.c
9325         $cat >>try.c <<'EOCP'
9326 #include <stdio.h>
9327 int main() {
9328 #ifdef O_NONBLOCK
9329         printf("O_NONBLOCK\n");
9330         exit(0);
9331 #endif
9332 #ifdef O_NDELAY
9333         printf("O_NDELAY\n");
9334         exit(0);
9335 #endif
9336 #ifdef FNDELAY
9337         printf("FNDELAY\n");
9338         exit(0);
9339 #endif
9340         exit(0);
9341 }
9342 EOCP
9343         set try
9344         if eval $compile_ok; then
9345                 o_nonblock=`./try`
9346                 case "$o_nonblock" in
9347                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9348                 *) echo "Seems like we can use $o_nonblock.";;
9349                 esac
9350         else
9351                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9352         fi
9353         ;;
9354 *) echo "Using $hint value $o_nonblock.";;
9355 esac
9356 $rm -f try try.* .out core
9357
9358 echo " "
9359 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9360 case "$eagain" in
9361 '')
9362         $cat head.c > try.c
9363         $cat >>try.c <<EOCP
9364 #include <errno.h>
9365 #include <sys/types.h>
9366 #include <signal.h>
9367 #include <stdio.h> 
9368 #define MY_O_NONBLOCK $o_nonblock
9369 #ifndef errno  /* XXX need better Configure test */
9370 extern int errno;
9371 #endif
9372 #$i_unistd I_UNISTD
9373 #ifdef I_UNISTD
9374 #include <unistd.h>
9375 #endif
9376 #$i_string I_STRING
9377 #ifdef I_STRING
9378 #include <string.h>
9379 #else
9380 #include <strings.h>
9381 #endif
9382 $signal_t blech(x) int x; { exit(3); }
9383 EOCP
9384         $cat >> try.c <<'EOCP'
9385 int main()
9386 {
9387         int pd[2];
9388         int pu[2];
9389         char buf[1];
9390         char string[100];
9391
9392         pipe(pd);       /* Down: child -> parent */
9393         pipe(pu);       /* Up: parent -> child */
9394         if (0 != fork()) {
9395                 int ret;
9396                 close(pd[1]);   /* Parent reads from pd[0] */
9397                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9398 #ifdef F_SETFL
9399                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9400                         exit(1);
9401 #else
9402                 exit(4);
9403 #endif
9404                 signal(SIGALRM, blech);
9405                 alarm(5);
9406                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9407                         exit(2);
9408                 sprintf(string, "%d\n", ret);
9409                 write(2, string, strlen(string));
9410                 alarm(0);
9411 #ifdef EAGAIN
9412                 if (errno == EAGAIN) {
9413                         printf("EAGAIN\n");
9414                         goto ok;
9415                 }
9416 #endif
9417 #ifdef EWOULDBLOCK
9418                 if (errno == EWOULDBLOCK)
9419                         printf("EWOULDBLOCK\n");
9420 #endif
9421         ok:
9422                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9423                 sleep(2);                               /* Give it time to close our pipe */
9424                 alarm(5);
9425                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9426                 alarm(0);
9427                 sprintf(string, "%d\n", ret);
9428                 write(3, string, strlen(string));
9429                 exit(0);
9430         }
9431
9432         close(pd[0]);                   /* We write to pd[1] */
9433         close(pu[1]);                   /* We read from pu[0] */
9434         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9435         close(pd[1]);                   /* Pipe pd is now fully closed! */
9436         exit(0);                                /* Bye bye, thank you for playing! */
9437 }
9438 EOCP
9439         set try
9440         if eval $compile_ok; then
9441                 echo "$startsh" >mtry
9442                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9443                 chmod +x mtry
9444                 ./mtry >/dev/null 2>&1
9445                 case $? in
9446                 0) eagain=`$cat try.out`;;
9447                 1) echo "Could not perform non-blocking setting!";;
9448                 2) echo "I did a successful read() for something that was not there!";;
9449                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9450                 4) echo "Could not find F_SETFL!";;
9451                 *) echo "Something terribly wrong happened during testing.";;
9452                 esac
9453                 rd_nodata=`$cat try.ret`
9454                 echo "A read() system call with no data present returns $rd_nodata."
9455                 case "$rd_nodata" in
9456                 0|-1) ;;
9457                 *)
9458                         echo "(That's peculiar, fixing that to be -1.)"
9459                         rd_nodata=-1
9460                         ;;
9461                 esac
9462                 case "$eagain" in
9463                 '')
9464                         echo "Forcing errno EAGAIN on read() with no data available."
9465                         eagain=EAGAIN
9466                         ;;
9467                 *)
9468                         echo "Your read() sets errno to $eagain when no data is available."
9469                         ;;
9470                 esac
9471                 status=`$cat try.err`
9472                 case "$status" in
9473                 0) echo "And it correctly returns 0 to signal EOF.";;
9474                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9475                 *) echo "However, your read() returns '$status' on EOF??";;
9476                 esac
9477                 val="$define"
9478                 if test "$status" = "$rd_nodata"; then
9479                         echo "WARNING: you can't distinguish between EOF and no data!"
9480                         val="$undef"
9481                 fi
9482         else
9483                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9484                 eagain=EAGAIN
9485         fi
9486         set d_eofnblk
9487         eval $setvar
9488         ;;
9489 *)
9490         echo "Using $hint value $eagain."
9491         echo "Your read() returns $rd_nodata when no data is present."
9492         case "$d_eofnblk" in
9493         "$define") echo "And you can see EOF because read() returns 0.";;
9494         "$undef") echo "But you can't see EOF status from read() returned value.";;
9495         *)
9496                 echo "(Assuming you can't see EOF status from read anyway.)"
9497                 d_eofnblk=$undef
9498                 ;;
9499         esac
9500         ;;
9501 esac
9502 $rm -f try try.* .out core head.c mtry
9503
9504 : see if fchmod exists
9505 set fchmod d_fchmod
9506 eval $inlibc
9507
9508 : see if fchown exists
9509 set fchown d_fchown
9510 eval $inlibc
9511
9512 : see if this is an fcntl system
9513 set fcntl d_fcntl
9514 eval $inlibc
9515
9516 echo " "
9517 : See if fcntl-based locking works.
9518 $cat >try.c <<'EOCP'
9519 #include <stdlib.h>
9520 #include <unistd.h>
9521 #include <fcntl.h>
9522 int main() {
9523 #if defined(F_SETLK) && defined(F_SETLKW)
9524      struct flock flock;
9525      int retval, fd;
9526      fd = open("try.c", O_RDONLY);
9527      flock.l_type = F_RDLCK;
9528      flock.l_whence = SEEK_SET;
9529      flock.l_start = flock.l_len = 0;
9530      retval = fcntl(fd, F_SETLK, &flock);
9531      close(fd);
9532      (retval < 0 ? exit(2) : exit(0));
9533 #else
9534      exit(2);
9535 #endif
9536 }
9537 EOCP
9538 echo "Checking if fcntl-based file locking works... "
9539 case "$d_fcntl" in
9540 "$define")
9541         set try
9542         if eval $compile_ok; then
9543                 if ./try; then
9544                         echo "Yes, it seems to work."
9545                         val="$define"
9546                 else
9547                         echo "Nope, it didn't work."
9548                         val="$undef"
9549                 fi
9550         else
9551                 echo "I'm unable to compile the test program, so I'll assume not."
9552                 val="$undef"
9553         fi
9554         ;;
9555 *) val="$undef";
9556         echo "Nope, since you don't even have fcntl()."
9557         ;;
9558 esac
9559 set d_fcntl_can_lock
9560 eval $setvar
9561 $rm -f try*
9562
9563
9564 : see if sys/select.h has to be included
9565 set sys/select.h i_sysselct
9566 eval $inhdr
9567
9568 : see if we should include time.h, sys/time.h, or both
9569 echo " "
9570 if test "X$timeincl" = X; then
9571         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9572         $echo $n "I'm now running the test program...$c"
9573         $cat >try.c <<'EOCP'
9574 #include <sys/types.h>
9575 #ifdef I_TIME
9576 #include <time.h>
9577 #endif
9578 #ifdef I_SYSTIME
9579 #ifdef SYSTIMEKERNEL
9580 #define KERNEL
9581 #endif
9582 #include <sys/time.h>
9583 #endif
9584 #ifdef I_SYSSELECT
9585 #include <sys/select.h>
9586 #endif
9587 int main()
9588 {
9589         struct tm foo;
9590 #ifdef S_TIMEVAL
9591         struct timeval bar;
9592 #endif
9593 #ifdef S_TIMEZONE
9594         struct timezone tzp;
9595 #endif
9596         if (foo.tm_sec == foo.tm_sec)
9597                 exit(0);
9598 #ifdef S_TIMEVAL
9599         if (bar.tv_sec == bar.tv_sec)
9600                 exit(0);
9601 #endif
9602         exit(1);
9603 }
9604 EOCP
9605         flags=''
9606         for s_timezone in '-DS_TIMEZONE' ''; do
9607         sysselect=''
9608         for s_timeval in '-DS_TIMEVAL' ''; do
9609         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9610         for i_time in '' '-DI_TIME'; do
9611         for i_systime in '-DI_SYSTIME' ''; do
9612                 case "$flags" in
9613                 '') $echo $n ".$c"
9614                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9615                         if eval $compile; then
9616                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9617                                 shift
9618                                 flags="$*"
9619                                 echo " "
9620                                 $echo $n "Succeeded with $flags$c"
9621                         fi
9622                         ;;
9623                 esac
9624         done
9625         done
9626         done
9627         done
9628         done
9629         timeincl=''
9630         echo " "
9631         case "$flags" in
9632         *SYSTIMEKERNEL*) i_systimek="$define"
9633                 timeincl=`./findhdr sys/time.h`
9634                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9635         *) i_systimek="$undef";;
9636         esac
9637         case "$flags" in
9638         *I_TIME*) i_time="$define"
9639                 timeincl=`./findhdr time.h`" $timeincl"
9640                 echo "We'll include <time.h>." >&4;;
9641         *) i_time="$undef";;
9642         esac
9643         case "$flags" in
9644         *I_SYSTIME*) i_systime="$define"
9645                 timeincl=`./findhdr sys/time.h`" $timeincl"
9646                 echo "We'll include <sys/time.h>." >&4;;
9647         *) i_systime="$undef";;
9648         esac
9649         $rm -f try.c try
9650 fi
9651
9652 : check for fd_set items
9653 $cat <<EOM
9654
9655 Checking to see how well your C compiler handles fd_set and friends ...
9656 EOM
9657 $cat >fd_set.c <<EOCP
9658 #$i_systime I_SYS_TIME
9659 #$i_sysselct I_SYS_SELECT
9660 #$d_socket HAS_SOCKET
9661 #include <sys/types.h>
9662 #ifdef HAS_SOCKET
9663 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9664 #endif
9665 #ifdef I_SYS_TIME
9666 #include <sys/time.h>
9667 #endif
9668 #ifdef I_SYS_SELECT
9669 #include <sys/select.h>
9670 #endif
9671 int main() {
9672         fd_set fds;
9673
9674 #ifdef TRYBITS
9675         if(fds.fds_bits);
9676 #endif
9677
9678 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9679         exit(0);
9680 #else
9681         exit(1);
9682 #endif
9683 }
9684 EOCP
9685 set fd_set -DTRYBITS
9686 if eval $compile; then
9687         d_fds_bits="$define"
9688         d_fd_set="$define"
9689         echo "Well, your system knows about the normal fd_set typedef..." >&4
9690         if ./fd_set; then
9691                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9692                 d_fd_macros="$define"
9693         else
9694                 $cat >&4 <<'EOM'
9695 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9696 EOM
9697                 d_fd_macros="$undef"
9698         fi
9699 else
9700         $cat <<'EOM'
9701 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9702 EOM
9703         set fd_set
9704         if eval $compile; then
9705                 d_fds_bits="$undef"
9706                 d_fd_set="$define"
9707                 echo "Well, your system has some sort of fd_set available..." >&4
9708                 if ./fd_set; then
9709                         echo "and you have the normal fd_set macros." >&4
9710                         d_fd_macros="$define"
9711                 else
9712                         $cat <<'EOM'
9713 but not the normal fd_set macros!  Gross!  More work for me...
9714 EOM
9715                         d_fd_macros="$undef"
9716                 fi
9717         else
9718         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9719                 d_fd_set="$undef"
9720                 d_fds_bits="$undef"
9721                 d_fd_macros="$undef"
9722         fi
9723 fi
9724 $rm -f fd_set*
9725
9726 : see if fgetpos exists
9727 set fgetpos d_fgetpos
9728 eval $inlibc
9729
9730 : see if flock exists
9731 set flock d_flock
9732 eval $inlibc
9733
9734 : see if fork exists
9735 set fork d_fork
9736 eval $inlibc
9737
9738 : see if pathconf exists
9739 set pathconf d_pathconf
9740 eval $inlibc
9741
9742 : see if fpathconf exists
9743 set fpathconf d_fpathconf
9744 eval $inlibc
9745
9746
9747 : check for fpos64_t
9748 echo " "
9749 echo "Checking to see if you have fpos64_t..." >&4
9750 $cat >try.c <<EOCP
9751 #include <stdio.h>
9752 int main() { fpos64_t x = 7; }
9753 EOCP
9754 set try
9755 if eval $compile; then
9756         val="$define"
9757         echo "You have fpos64_t."
9758 else
9759         val="$undef"
9760         echo "You do not have fpos64_t."
9761         case "$fpossize" in
9762         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9763         esac
9764 fi
9765 $rm -f try.* try
9766 set d_fpos64_t
9767 eval $setvar
9768
9769 : see if frexpl exists
9770 set frexpl d_frexpl
9771 eval $inlibc
9772
9773 : see if this is a sys/param system
9774 set sys/param.h i_sysparam
9775 eval $inhdr
9776
9777 : see if this is a sys/mount.h system
9778 set sys/mount.h i_sysmount
9779 eval $inhdr
9780
9781
9782 echo " "
9783 echo "Checking to see if your system supports struct fs_data..." >&4
9784 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9785 eval $hasstruct
9786 case "$d_fs_data_s" in
9787 "$define")      echo "Yes, it does."   ;;
9788 *)              echo "No, it doesn't." ;;
9789 esac
9790
9791 : see if fseeko exists
9792 set fseeko d_fseeko
9793 eval $inlibc
9794 case "$longsize" in
9795 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9796 esac
9797
9798 : see if fsetpos exists
9799 set fsetpos d_fsetpos
9800 eval $inlibc
9801
9802
9803 : see if fstatfs exists
9804 set fstatfs d_fstatfs
9805 eval $inlibc
9806
9807
9808 : see if statvfs exists
9809 set statvfs d_statvfs
9810 eval $inlibc
9811
9812 : see if fstatvfs exists
9813 set fstatvfs d_fstatvfs
9814 eval $inlibc
9815
9816
9817 : see if fsync exists
9818 set fsync d_fsync
9819 eval $inlibc
9820
9821 : see if ftello exists
9822 set ftello d_ftello
9823 eval $inlibc
9824 case "$longsize" in
9825 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9826 esac
9827
9828 : see if getcwd exists
9829 set getcwd d_getcwd
9830 eval $inlibc
9831
9832 : see if getespwnam exists
9833 set getespwnam d_getespwnam
9834 eval $inlibc
9835
9836
9837 : see if getfsstat exists
9838 set getfsstat d_getfsstat
9839 eval $inlibc
9840
9841 : see if getgrent exists
9842 set getgrent d_getgrent
9843 eval $inlibc
9844
9845 : see if gethostbyaddr exists
9846 set gethostbyaddr d_gethbyaddr
9847 eval $inlibc
9848
9849 : see if gethostbyname exists
9850 set gethostbyname d_gethbyname
9851 eval $inlibc
9852
9853 : see if gethostent exists
9854 set gethostent d_gethent
9855 eval $inlibc
9856
9857 : see how we will look up host name
9858 echo " "
9859 call=''
9860 if set gethostname val -f d_gethname; eval $csym; $val; then
9861         echo 'gethostname() found.' >&4
9862         d_gethname="$define"
9863         call=gethostname
9864 fi
9865 if set uname val -f d_uname; eval $csym; $val; then
9866         if ./xenix; then
9867                 $cat <<'EOM'
9868 uname() was found, but you're running xenix, and older versions of xenix
9869 have a broken uname(). If you don't really know whether your xenix is old
9870 enough to have a broken system call, use the default answer.
9871
9872 EOM
9873                 dflt=y
9874                 case "$d_uname" in
9875                 "$define") dflt=n;;
9876                 esac
9877                 rp='Is your uname() broken?'
9878                 . ./myread
9879                 case "$ans" in
9880                 n*) d_uname="$define"; call=uname;;
9881                 esac
9882         else
9883                 echo 'uname() found.' >&4
9884                 d_uname="$define"
9885                 case "$call" in
9886                 '') call=uname ;;
9887                 esac
9888         fi
9889 fi
9890 case "$d_gethname" in
9891 '') d_gethname="$undef";;
9892 esac
9893 case "$d_uname" in
9894 '') d_uname="$undef";;
9895 esac
9896 case "$d_uname$d_gethname" in
9897 *define*)
9898         dflt=n
9899         cat <<EOM
9900  
9901 Every now and then someone has a $call() that lies about the hostname
9902 but can't be fixed for political or economic reasons.  If you wish, I can
9903 pretend $call() isn't there and maybe compute hostname at run-time
9904 thanks to the '$phostname' command.
9905
9906 EOM
9907         rp="Shall I ignore $call() from now on?"
9908         . ./myread
9909         case "$ans" in
9910         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9911         esac;;
9912 esac
9913 case "$phostname" in
9914 '') aphostname='';;
9915 *) case "$aphostname" in
9916         /*) ;;
9917         *) set X $phostname
9918                 shift
9919                 file=$1
9920                 shift
9921                 file=`./loc $file $file $pth`
9922                 aphostname=`echo $file $*`
9923                 ;;
9924         esac
9925         ;;
9926 esac
9927 case "$d_uname$d_gethname" in
9928 *define*) ;;
9929 *)
9930         case "$phostname" in
9931         '')
9932                 echo "There will be no way for $package to get your hostname." >&4;;
9933         *)
9934         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9935                 ;;
9936         esac;;
9937 esac
9938 case "$d_phostname" in
9939 '') d_phostname="$undef";;
9940 esac
9941
9942 : see if this is a netdb.h system
9943 set netdb.h i_netdb
9944 eval $inhdr
9945
9946 : see if prototypes for various gethostxxx netdb.h functions are available
9947 echo " "
9948 set d_gethostprotos gethostent $i_netdb netdb.h
9949 eval $hasproto
9950
9951 : see if getitimer exists
9952 set getitimer d_getitimer
9953 eval $inlibc
9954
9955 : see if getlogin exists
9956 set getlogin d_getlogin
9957 eval $inlibc
9958
9959 : see if getmnt exists
9960 set getmnt d_getmnt
9961 eval $inlibc
9962
9963 : see if getmntent exists
9964 set getmntent d_getmntent
9965 eval $inlibc
9966
9967 : see if getnetbyaddr exists
9968 set getnetbyaddr d_getnbyaddr
9969 eval $inlibc
9970
9971 : see if getnetbyname exists
9972 set getnetbyname d_getnbyname
9973 eval $inlibc
9974
9975 : see if getnetent exists
9976 set getnetent d_getnent
9977 eval $inlibc
9978
9979 : see if prototypes for various getnetxxx netdb.h functions are available
9980 echo " "
9981 set d_getnetprotos getnetent $i_netdb netdb.h
9982 eval $hasproto
9983
9984 : see if getpagesize exists
9985 set getpagesize d_getpagsz
9986 eval $inlibc
9987
9988
9989 : see if getprotobyname exists
9990 set getprotobyname d_getpbyname
9991 eval $inlibc
9992
9993 : see if getprotobynumber exists
9994 set getprotobynumber d_getpbynumber
9995 eval $inlibc
9996
9997 : see if getprotoent exists
9998 set getprotoent d_getpent
9999 eval $inlibc
10000
10001 : see if getpgid exists
10002 set getpgid d_getpgid
10003 eval $inlibc
10004
10005 : see if getpgrp2 exists
10006 set getpgrp2 d_getpgrp2
10007 eval $inlibc
10008
10009 : see if getppid exists
10010 set getppid d_getppid
10011 eval $inlibc
10012
10013 : see if getpriority exists
10014 set getpriority d_getprior
10015 eval $inlibc
10016
10017 : see if prototypes for various getprotoxxx netdb.h functions are available
10018 echo " "
10019 set d_getprotoprotos getprotoent $i_netdb netdb.h
10020 eval $hasproto
10021
10022 : see if getprpwnam exists
10023 set getprpwnam d_getprpwnam
10024 eval $inlibc
10025
10026 : see if getpwent exists
10027 set getpwent d_getpwent
10028 eval $inlibc
10029
10030
10031 : see if getservbyname exists
10032 set getservbyname d_getsbyname
10033 eval $inlibc
10034
10035 : see if getservbyport exists
10036 set getservbyport d_getsbyport
10037 eval $inlibc
10038
10039 : see if getservent exists
10040 set getservent d_getsent
10041 eval $inlibc
10042
10043 : see if prototypes for various getservxxx netdb.h functions are available
10044 echo " "
10045 set d_getservprotos getservent $i_netdb netdb.h
10046 eval $hasproto
10047
10048 : see if getspnam exists
10049 set getspnam d_getspnam
10050 eval $inlibc
10051
10052 : see if gettimeofday or ftime exists
10053 set gettimeofday d_gettimeod
10054 eval $inlibc
10055 case "$d_gettimeod" in
10056 "$undef")
10057         set ftime d_ftime 
10058         eval $inlibc
10059         ;;
10060 *)
10061         val="$undef"; set d_ftime; eval $setvar
10062         ;;
10063 esac
10064 case "$d_gettimeod$d_ftime" in
10065 "$undef$undef")
10066         echo " "
10067         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10068         ;;
10069 esac
10070
10071 : see if this is an grp system
10072 set grp.h i_grp
10073 eval $inhdr
10074
10075 case "$i_grp" in
10076 $define)
10077         xxx=`./findhdr grp.h`
10078         $cppstdin $cppflags $cppminus < $xxx >$$.h
10079
10080         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10081                 val="$define"
10082         else
10083                 val="$undef"
10084         fi
10085         set d_grpasswd
10086         eval $setvar
10087
10088         $rm -f $$.h
10089         ;;
10090 *)
10091         val="$undef";
10092         set d_grpasswd; eval $setvar
10093         ;;
10094 esac
10095
10096 : see if hasmntopt exists
10097 set hasmntopt d_hasmntopt
10098 eval $inlibc
10099
10100 : see if this is a netinet/in.h or sys/in.h system
10101 set netinet/in.h i_niin sys/in.h i_sysin
10102 eval $inhdr
10103
10104 : see if arpa/inet.h has to be included
10105 set arpa/inet.h i_arpainet
10106 eval $inhdr
10107
10108 : see if htonl --and friends-- exists
10109 val=''
10110 set htonl val
10111 eval $inlibc
10112
10113 : Maybe they are macros.
10114 case "$val" in
10115 $undef)
10116         $cat >htonl.c <<EOM
10117 #include <stdio.h>
10118 #include <sys/types.h>
10119 #$i_niin I_NETINET_IN
10120 #$i_sysin I_SYS_IN
10121 #$i_arpainet I_ARPA_INET
10122 #ifdef I_NETINET_IN
10123 #include <netinet/in.h>
10124 #endif
10125 #ifdef I_SYS_IN
10126 #include <sys/in.h>
10127 #endif
10128 #ifdef I_ARPA_INET
10129 #include <arpa/inet.h>
10130 #endif
10131 #ifdef htonl
10132 printf("Defined as a macro.");
10133 #endif
10134 EOM
10135         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10136         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10137                 val="$define"
10138                 echo "But it seems to be defined as a macro." >&4
10139         fi
10140         $rm -f htonl.?
10141         ;;
10142 esac
10143 set d_htonl
10144 eval $setvar
10145
10146 : see if iconv exists
10147 set iconv d_iconv
10148 eval $inlibc
10149
10150 : index or strchr
10151 echo " "
10152 if set index val -f; eval $csym; $val; then
10153         if set strchr val -f d_strchr; eval $csym; $val; then
10154                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10155                         val="$define"
10156                         vali="$undef"
10157                         echo "strchr() found." >&4
10158                 else
10159                         val="$undef"
10160                         vali="$define"
10161                         echo "index() found." >&4
10162                 fi
10163         else
10164                 val="$undef"
10165                 vali="$define"
10166                 echo "index() found." >&4
10167         fi
10168 else
10169         if set strchr val -f d_strchr; eval $csym; $val; then
10170                 val="$define"
10171                 vali="$undef"
10172                 echo "strchr() found." >&4
10173         else
10174                 echo "No index() or strchr() found!" >&4
10175                 val="$undef"
10176                 vali="$undef"
10177         fi
10178 fi
10179 set d_strchr; eval $setvar
10180 val="$vali"
10181 set d_index; eval $setvar
10182
10183 : check whether inet_aton exists
10184 set inet_aton d_inetaton
10185 eval $inlibc
10186
10187 : Look for isascii
10188 echo " "
10189 $cat >isascii.c <<'EOCP'
10190 #include <stdio.h>
10191 #include <ctype.h>
10192 int main() {
10193         int c = 'A';
10194         if (isascii(c))
10195                 exit(0);
10196         else
10197                 exit(1);
10198 }
10199 EOCP
10200 set isascii
10201 if eval $compile; then
10202         echo "isascii() found." >&4
10203         val="$define"
10204 else
10205         echo "isascii() NOT found." >&4
10206         val="$undef"
10207 fi
10208 set d_isascii
10209 eval $setvar
10210 $rm -f isascii*
10211
10212 : see if isnan exists
10213 set isnan d_isnan
10214 eval $inlibc
10215
10216 : see if isnanl exists
10217 set isnanl d_isnanl
10218 eval $inlibc
10219
10220 : see if killpg exists
10221 set killpg d_killpg
10222 eval $inlibc
10223
10224 : see if lchown exists
10225 echo " "
10226 $cat > try.c <<'EOCP'
10227 /* System header to define __stub macros and hopefully few prototypes,
10228     which can conflict with char lchown(); below.  */
10229 #include <assert.h>
10230 /* Override any gcc2 internal prototype to avoid an error.  */
10231 /* We use char because int might match the return type of a gcc2
10232    builtin and then its argument prototype would still apply.  */
10233 char lchown();
10234 int main() {
10235     /*  The GNU C library defines this for functions which it implements
10236         to always fail with ENOSYS.  Some functions are actually named
10237         something starting with __ and the normal name is an alias.  */
10238 #if defined (__stub_lchown) || defined (__stub___lchown)
10239 choke me
10240 #else
10241 lchown();
10242 #endif
10243 ; return 0; }
10244 EOCP
10245 set try
10246 if eval $compile; then
10247     $echo "lchown() found." >&4
10248     val="$define"
10249 else
10250     $echo "lchown() NOT found." >&4
10251     val="$undef"
10252 fi
10253 set d_lchown
10254 eval $setvar
10255
10256 : See if number of significant digits in a double precision number is known
10257 echo " "
10258 $cat >ldbl_dig.c <<EOM
10259 #$i_limits I_LIMITS
10260 #$i_float I_FLOAT
10261 #ifdef I_LIMITS
10262 #include <limits.h>
10263 #endif
10264 #ifdef I_FLOAT
10265 #include <float.h>
10266 #endif
10267 #ifdef LDBL_DIG
10268 printf("Contains LDBL_DIG");
10269 #endif
10270 EOM
10271 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10272 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10273         echo "LDBL_DIG found." >&4
10274         val="$define"
10275 else
10276         echo "LDBL_DIG NOT found." >&4
10277         val="$undef"
10278 fi
10279 $rm -f ldbl_dig.?
10280 set d_ldbl_dig
10281 eval $setvar
10282
10283 : see if link exists
10284 set link d_link
10285 eval $inlibc
10286
10287 : see if localeconv exists
10288 set localeconv d_locconv
10289 eval $inlibc
10290
10291 : see if lockf exists
10292 set lockf d_lockf
10293 eval $inlibc
10294
10295 : see if prototype for lseek is available
10296 echo " "
10297 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10298 eval $hasproto
10299
10300 : see if lstat exists
10301 set lstat d_lstat
10302 eval $inlibc
10303
10304 : see if madvise exists
10305 set madvise d_madvise
10306 eval $inlibc
10307
10308 : see if mblen exists
10309 set mblen d_mblen
10310 eval $inlibc
10311
10312 : see if mbstowcs exists
10313 set mbstowcs d_mbstowcs
10314 eval $inlibc
10315
10316 : see if mbtowc exists
10317 set mbtowc d_mbtowc
10318 eval $inlibc
10319
10320 : see if memchr exists
10321 set memchr d_memchr
10322 eval $inlibc
10323
10324 : see if memcmp exists
10325 set memcmp d_memcmp
10326 eval $inlibc
10327
10328 : see if memcpy exists
10329 set memcpy d_memcpy
10330 eval $inlibc
10331
10332 : see if memmove exists
10333 set memmove d_memmove
10334 eval $inlibc
10335
10336 : see if memset exists
10337 set memset d_memset
10338 eval $inlibc
10339
10340 : see if mkdir exists
10341 set mkdir d_mkdir
10342 eval $inlibc
10343
10344 : see if mkdtemp exists
10345 set mkdtemp d_mkdtemp
10346 eval $inlibc
10347
10348 : see if mkfifo exists
10349 set mkfifo d_mkfifo
10350 eval $inlibc
10351
10352 : see if mkstemp exists
10353 set mkstemp d_mkstemp
10354 eval $inlibc
10355
10356 : see if mkstemps exists
10357 set mkstemps d_mkstemps
10358 eval $inlibc
10359
10360 : see if mktime exists
10361 set mktime d_mktime
10362 eval $inlibc
10363
10364 : see if this is a sys/mman.h system
10365 set sys/mman.h i_sysmman
10366 eval $inhdr
10367
10368 : see if mmap exists
10369 set mmap d_mmap
10370 eval $inlibc
10371 : see what shmat returns
10372 : default to something harmless
10373 mmaptype='void *'
10374 case "$i_sysmman$d_mmap" in
10375 "$define$define")
10376         $cat >mmap.c <<'END'
10377 #include <sys/mman.h>
10378 void *mmap();
10379 END
10380         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10381                 mmaptype='void *'
10382         else
10383                 mmaptype='caddr_t'
10384         fi
10385         echo "and it returns ($mmaptype)." >&4
10386         ;;
10387 esac
10388
10389
10390
10391 : see if modfl exists
10392 set modfl d_modfl
10393 eval $inlibc
10394
10395 : see if mprotect exists
10396 set mprotect d_mprotect
10397 eval $inlibc
10398
10399 : see if msgctl exists
10400 set msgctl d_msgctl
10401 eval $inlibc
10402
10403 : see if msgget exists
10404 set msgget d_msgget
10405 eval $inlibc
10406
10407 : see if msgsnd exists
10408 set msgsnd d_msgsnd
10409 eval $inlibc
10410
10411 : see if msgrcv exists
10412 set msgrcv d_msgrcv
10413 eval $inlibc
10414
10415 : see how much of the 'msg*(2)' library is present.
10416 h_msg=true
10417 echo " "
10418 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10419 *"$undef"*) h_msg=false;;
10420 esac
10421 case "$osname" in
10422 freebsd)
10423     case "`ipcs 2>&1`" in
10424     "SVID messages"*"not configured"*)
10425         echo "Your $osname does not have the msg*(2) configured." >&4
10426         h_msg=false
10427         val="$undef"
10428         set msgctl d_msgctl
10429         eval $setvar
10430         set msgget d_msgget
10431         eval $setvar
10432         set msgsnd d_msgsnd
10433         eval $setvar
10434         set msgrcv d_msgrcv
10435         eval $setvar
10436         ;;
10437     esac
10438     ;;
10439 esac
10440 : we could also check for sys/ipc.h ...
10441 if $h_msg && $test `./findhdr sys/msg.h`; then
10442         echo "You have the full msg*(2) library." >&4
10443         val="$define"
10444 else
10445         echo "You don't have the full msg*(2) library." >&4
10446         val="$undef"
10447 fi
10448 set d_msg
10449 eval $setvar
10450
10451
10452 echo " "
10453 echo "Checking to see if your system supports struct msghdr..." >&4
10454 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10455 eval $hasstruct
10456 case "$d_msghdr_s" in
10457 "$define")      echo "Yes, it does."   ;;
10458 *)              echo "No, it doesn't." ;;
10459 esac
10460
10461
10462 : see if msync exists
10463 set msync d_msync
10464 eval $inlibc
10465
10466 : see if munmap exists
10467 set munmap d_munmap
10468 eval $inlibc
10469
10470 : see if nice exists
10471 set nice d_nice
10472 eval $inlibc
10473
10474 : check for length of character
10475 echo " "
10476 case "$charsize" in
10477 '')
10478         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10479         $cat >try.c <<'EOCP'
10480 #include <stdio.h>
10481 int main()
10482 {
10483     printf("%d\n", (int)sizeof(char));
10484     exit(0);
10485 }
10486 EOCP
10487         set try
10488         if eval $compile_ok; then
10489                 dflt=`./try`
10490         else
10491                 dflt='1'
10492                 echo "(I can't seem to compile the test program.  Guessing...)"
10493         fi
10494         ;;
10495 *)
10496         dflt="$charsize"
10497         ;;
10498 esac
10499 rp="What is the size of a character (in bytes)?"
10500 . ./myread
10501 charsize="$ans"
10502 $rm -f try.c try
10503
10504 : check for volatile keyword
10505 echo " "
10506 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10507 $cat >try.c <<'EOCP'
10508 int main()
10509 {
10510         typedef struct _goo_struct goo_struct;
10511         goo_struct * volatile goo = ((goo_struct *)0);
10512         struct _goo_struct {
10513                 long long_int;
10514                 int reg_int;
10515                 char char_var;
10516         };
10517         typedef unsigned short foo_t;
10518         char *volatile foo;
10519         volatile int bar;
10520         volatile foo_t blech;
10521         foo = foo;
10522 }
10523 EOCP
10524 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10525         val="$define"
10526         echo "Yup, it does."
10527 else
10528         val="$undef"
10529         echo "Nope, it doesn't."
10530 fi
10531 set d_volatile
10532 eval $setvar
10533 $rm -f try.*
10534
10535
10536 echo " "
10537 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10538
10539 case "$use64bitint:$d_quad:$quadtype" in
10540 define:define:?*)
10541         ivtype="$quadtype"
10542         uvtype="$uquadtype"
10543         ivsize=8
10544         uvsize=8
10545         ;;
10546 *)      ivtype="long"
10547         uvtype="unsigned long"
10548         ivsize=$longsize
10549         uvsize=$longsize
10550         ;;
10551 esac
10552
10553 case "$uselongdouble:$d_longdbl" in
10554 define:define)
10555         nvtype="long double"
10556         nvsize=$longdblsize
10557         ;;
10558 *)      nvtype=double
10559         nvsize=$doublesize
10560         ;;
10561 esac
10562
10563 $echo "(IV will be "$ivtype", $ivsize bytes)"
10564 $echo "(UV will be "$uvtype", $uvsize bytes)"
10565 $echo "(NV will be "$nvtype", $nvsize bytes)"
10566
10567 $cat >try.c <<EOCP
10568 #$i_inttypes I_INTTYPES
10569 #ifdef I_INTTYPES
10570 #include <inttypes.h>
10571 #endif
10572 #include <stdio.h>
10573 int main() {
10574 #ifdef INT8
10575    int8_t i =  INT8_MAX;
10576   uint8_t u = UINT8_MAX;
10577   printf("int8_t\n");
10578 #endif
10579 #ifdef INT16
10580    int16_t i =  INT16_MAX;
10581   uint16_t i = UINT16_MAX;
10582   printf("int16_t\n");
10583 #endif
10584 #ifdef INT32
10585    int32_t i =  INT32_MAX;
10586   uint32_t u = UINT32_MAX;
10587   printf("int32_t\n");
10588 #endif
10589 }
10590 EOCP
10591
10592 case "$i8type" in
10593 '')     case "$charsize" in
10594         1)      i8type=char
10595                 u8type="unsigned char"
10596                 i8size=$charsize
10597                 u8size=$charsize
10598                 ;;
10599         esac
10600         ;;
10601 esac
10602 case "$i8type" in
10603 '')     set try -DINT8
10604         if eval $compile; then
10605                 case "`./try$exe_ext`" in
10606                 int8_t) i8type=int8_t
10607                         u8type=uint8_t
10608                         i8size=1
10609                         u8size=1
10610                         ;;
10611                 esac
10612         fi
10613         ;;
10614 esac
10615 case "$i8type" in
10616 '')     if $test $charsize -ge 1; then
10617                 i8type=char
10618                 u8type="unsigned char"
10619                 i8size=$charsize
10620                 u8size=$charsize
10621         fi
10622         ;;
10623 esac
10624
10625 case "$i16type" in
10626 '')     case "$shortsize" in
10627         2)      i16type=short
10628                 u16type="unsigned short"
10629                 i16size=$shortsize
10630                 u16size=$shortsize
10631                 ;;
10632         esac
10633         ;;
10634 esac
10635 case "$i16type" in
10636 '')     set try -DINT16
10637         if eval $compile; then
10638                 case "`./try$exe_ext`" in
10639                 int16_t)
10640                         i16type=int16_t
10641                         u16type=uint16_t
10642                         i16size=2
10643                         u16size=2
10644                         ;;
10645                 esac
10646         fi
10647         ;;
10648 esac
10649 case "$i16type" in
10650 '')     if $test $shortsize -ge 2; then
10651                 i16type=short
10652                 u16type="unsigned short"
10653                 i16size=$shortsize
10654                 u16size=$shortsize
10655         fi
10656         ;;
10657 esac
10658
10659 case "$i32type" in
10660 '')     case "$longsize" in
10661         4)      i32type=long
10662                 u32type="unsigned long"
10663                 i32size=$longsize
10664                 u32size=$longsize
10665                 ;;
10666         *)      case "$intsize" in
10667                 4)      i32type=int
10668                         u32type="unsigned int"
10669                         i32size=$intsize
10670                         u32size=$intsize
10671                         ;;
10672                 esac
10673                 ;;
10674         esac
10675         ;;
10676 esac
10677 case "$i32type" in
10678 '')     set try -DINT32
10679         if eval $compile; then
10680                 case "`./try$exe_ext`" in
10681                 int32_t)
10682                         i32type=int32_t
10683                         u32type=uint32_t
10684                         i32size=4
10685                         u32size=4
10686                         ;;
10687                 esac
10688         fi
10689         ;;
10690 esac
10691 case "$i32type" in
10692 '')     if $test $intsize -ge 4; then
10693                 i32type=int
10694                 u32type="unsigned int"
10695                 i32size=$intsize
10696                 u32size=$intsize
10697         fi
10698         ;;
10699 esac
10700
10701 case "$i64type" in
10702 '')     case "$d_quad:$quadtype" in
10703         define:?*)
10704                 i64type="$quadtype"
10705                 u64type="$uquadtype"
10706                 i64size=8
10707                 u64size=8
10708                 ;;
10709         esac
10710         ;;
10711 esac
10712
10713 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10714 : volatile so that the compiler has to store it out to memory.
10715 if test X"$d_volatile" = X"$define"; then
10716         volatile=volatile
10717 fi
10718 $cat <<EOP >try.c
10719 #include <stdio.h>
10720 #include <sys/types.h>
10721 #include <signal.h>
10722 #ifdef SIGFPE
10723 $volatile int bletched = 0;
10724 $signal_t blech(s) int s; { bletched = 1; }
10725 #endif
10726 int main() {
10727     $uvtype u = 0;
10728     $nvtype d;
10729     int     n = 8 * $uvsize;
10730     int     i;
10731 #ifdef SIGFPE
10732     signal(SIGFPE, blech);
10733 #endif
10734
10735     for (i = 0; i < n; i++) {
10736       u = u << 1 | ($uvtype)1;
10737       d = ($nvtype)u;
10738       if (($uvtype)d != u)
10739         break;
10740       if (d <= 0)
10741         break;
10742       d = ($nvtype)(u - 1);
10743       if (($uvtype)d != (u - 1))
10744         break;
10745 #ifdef SIGFPE
10746       if (bletched) {
10747         break;
10748 #endif
10749       } 
10750     }
10751     printf("%d\n", ((i == n) ? -n : i));
10752     exit(0);
10753 }
10754 EOP
10755 set try
10756
10757 d_nv_preserves_uv="$undef"
10758 if eval $compile; then
10759         d_nv_preserves_uv_bits="`./try$exe_ext`"
10760 fi
10761 case "$d_nv_preserves_uv_bits" in
10762 \-[1-9]*)       
10763         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10764         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10765         d_nv_preserves_uv="$define"
10766         ;;
10767 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10768         d_nv_preserves_uv="$undef" ;;
10769 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10770         d_nv_preserves_uv_bits="$undef" ;;
10771 esac
10772
10773 $rm -f try.* try
10774
10775
10776 : check for off64_t
10777 echo " "
10778 echo "Checking to see if you have off64_t..." >&4
10779 $cat >try.c <<EOCP
10780 #include <sys/types.h>
10781 #include <unistd.h>
10782 int main() { off64_t x = 7; }
10783 EOCP
10784 set try
10785 if eval $compile; then
10786         val="$define"
10787         echo "You have off64_t."
10788 else
10789         val="$undef"
10790         echo "You do not have off64_t."
10791         case "$lseeksize" in
10792         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10793         esac
10794 fi
10795 $rm -f try.* try
10796 set d_off64_t
10797 eval $setvar
10798
10799 : see if POSIX threads are available
10800 set pthread.h i_pthread
10801 eval $inhdr
10802
10803
10804
10805
10806 : how to create joinable pthreads
10807 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10808         echo " "
10809         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10810         $cat >try.c <<'EOCP'
10811 #include <pthread.h>
10812 int main() {
10813     int detachstate = JOINABLE;
10814 }
10815 EOCP
10816         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10817         if eval $compile; then
10818                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10819                 val="$undef" # Yes, undef.
10820                 set d_old_pthread_create_joinable
10821                 eval $setvar
10822                 val=""
10823                 set old_pthread_create_joinable
10824                 eval $setvar
10825         else
10826                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10827                 if eval $compile; then
10828                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10829                         val="$define"
10830                         set d_old_pthread_create_joinable
10831                         eval $setvar
10832                         val=PTHREAD_CREATE_UNDETACHED
10833                         set old_pthread_create_joinable
10834                         eval $setvar
10835                 else            
10836                         set try -DJOINABLE=__UNDETACHED
10837                         if eval $compile; then
10838                                 echo "You seem to use __UNDETACHED." >&4
10839                                 val="$define"
10840                                 set d_old_pthread_create_joinable
10841                                 eval $setvar
10842                                 val=__UNDETACHED
10843                                 set old_pthread_create_joinable
10844                                 eval $setvar
10845                         else
10846                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10847                                 val="$define"
10848                                 set d_old_pthread_create_joinable
10849                                 eval $setvar
10850                                 val=0
10851                                 set old_pthread_create_joinable
10852                                 eval $setvar
10853                         fi
10854                 fi
10855         fi
10856         $rm -f try try.*
10857 else
10858     d_old_pthread_create_joinable="$undef"
10859     old_pthread_create_joinable=""
10860 fi
10861
10862 : see if pause exists
10863 set pause d_pause
10864 eval $inlibc
10865
10866 : see if pipe exists
10867 set pipe d_pipe
10868 eval $inlibc
10869
10870 : see if poll exists
10871 set poll d_poll
10872 eval $inlibc
10873
10874
10875 : see whether the various POSIXish _yields exist
10876 $cat >try.c <<EOP
10877 #include <pthread.h>
10878 #include <stdio.h>
10879 int main() {
10880 #ifdef SCHED_YIELD
10881         sched_yield();
10882 #else
10883 #ifdef PTHREAD_YIELD
10884         pthread_yield();
10885 #else
10886 #ifdef PTHREAD_YIELD_NULL
10887         pthread_yield(NULL);
10888 #endif
10889 #endif
10890 #endif
10891 }
10892 EOP
10893 : see if sched_yield exists
10894 set try -DSCHED_YIELD
10895 if eval $compile; then
10896     val="$define"
10897     sched_yield='sched_yield()'
10898 else
10899     val="$undef"
10900 fi
10901 case "$usethreads" in
10902 $define)
10903         case "$val" in
10904         $define) echo 'sched_yield() found.' >&4        ;;
10905         *)       echo 'sched_yield() NOT found.' >&4    ;;
10906         esac
10907 esac
10908 set d_sched_yield
10909 eval $setvar
10910
10911 : see if pthread_yield exists
10912 set try -DPTHREAD_YIELD
10913 if eval $compile; then
10914     val="$define"
10915     case "$sched_yield" in
10916     '') sched_yield='pthread_yield()' ;;
10917     esac
10918 else
10919     set try -DPTHREAD_YIELD_NULL
10920     if eval $compile; then
10921         val="$define"
10922         case "$sched_yield" in
10923         '') sched_yield='pthread_yield(NULL)' ;;
10924         esac
10925     else
10926         val="$undef"
10927     fi
10928 fi
10929 case "$usethreads" in
10930 $define)
10931         case "$val" in
10932         $define) echo 'pthread_yield() found.' >&4      ;;
10933         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10934         esac
10935         ;;
10936 esac
10937 set d_pthread_yield
10938 eval $setvar
10939
10940 case "$sched_yield" in
10941 '') sched_yield=undef ;;
10942 esac
10943
10944 $rm -f try try.*
10945
10946 : see if this is a pwd.h system
10947 set pwd.h i_pwd
10948 eval $inhdr
10949
10950 case "$i_pwd" in
10951 $define)
10952         xxx=`./findhdr pwd.h`
10953         $cppstdin $cppflags $cppminus < $xxx >$$.h
10954
10955         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10956                 val="$define"
10957         else
10958                 val="$undef"
10959         fi
10960         set d_pwquota
10961         eval $setvar
10962
10963         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10964                 val="$define"
10965         else
10966                 val="$undef"
10967         fi
10968         set d_pwage
10969         eval $setvar
10970
10971         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10972                 val="$define"
10973         else
10974                 val="$undef"
10975         fi
10976         set d_pwchange
10977         eval $setvar
10978
10979         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10980                 val="$define"
10981         else
10982                 val="$undef"
10983         fi
10984         set d_pwclass
10985         eval $setvar
10986
10987         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10988                 val="$define"
10989         else
10990                 val="$undef"
10991         fi
10992         set d_pwexpire
10993         eval $setvar
10994
10995         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10996                 val="$define"
10997         else
10998                 val="$undef"
10999         fi
11000         set d_pwcomment
11001         eval $setvar
11002
11003         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11004                 val="$define"
11005         else
11006                 val="$undef"
11007         fi
11008         set d_pwgecos
11009         eval $setvar
11010
11011         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11012                 val="$define"
11013         else
11014                 val="$undef"
11015         fi
11016         set d_pwpasswd
11017         eval $setvar
11018
11019         $rm -f $$.h
11020         ;;
11021 *)
11022         val="$undef"; 
11023         set d_pwquota; eval $setvar
11024         set d_pwage; eval $setvar
11025         set d_pwchange; eval $setvar
11026         set d_pwclass; eval $setvar
11027         set d_pwexpire; eval $setvar
11028         set d_pwcomment; eval $setvar
11029         set d_pwgecos; eval $setvar
11030         set d_pwpasswd; eval $setvar
11031         ;;
11032 esac
11033
11034 : see if readdir and friends exist
11035 set readdir d_readdir
11036 eval $inlibc
11037 set seekdir d_seekdir
11038 eval $inlibc
11039 set telldir d_telldir
11040 eval $inlibc
11041 set rewinddir d_rewinddir
11042 eval $inlibc
11043
11044 : see if readlink exists
11045 set readlink d_readlink
11046 eval $inlibc
11047
11048 : see if readv exists
11049 set readv d_readv
11050 eval $inlibc
11051
11052 : see if recvmsg exists
11053 set recvmsg d_recvmsg
11054 eval $inlibc
11055
11056 : see if rename exists
11057 set rename d_rename
11058 eval $inlibc
11059
11060 : see if rmdir exists
11061 set rmdir d_rmdir
11062 eval $inlibc
11063
11064 : see if memory.h is available.
11065 val=''
11066 set memory.h val
11067 eval $inhdr
11068
11069 : See if it conflicts with string.h
11070 case "$val" in
11071 $define)
11072         case "$strings" in
11073         '') ;;
11074         *)
11075                 $cppstdin $cppflags $cppminus < $strings > mem.h
11076                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11077                         echo " "
11078                         echo "We won't be including <memory.h>."
11079                         val="$undef"
11080                 fi
11081                 $rm -f mem.h
11082                 ;;
11083         esac
11084 esac
11085 set i_memory
11086 eval $setvar
11087
11088 : can bcopy handle overlapping blocks?
11089 val="$undef"
11090 case "$d_bcopy" in
11091 "$define")
11092         echo " "
11093         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11094         $cat >try.c <<EOCP
11095 #$i_memory I_MEMORY
11096 #$i_stdlib I_STDLIB
11097 #$i_string I_STRING
11098 #$i_unistd I_UNISTD
11099 EOCP
11100         $cat >>try.c <<'EOCP'
11101 #include <stdio.h>
11102 #ifdef I_MEMORY
11103 #  include <memory.h>
11104 #endif
11105 #ifdef I_STDLIB
11106 #  include <stdlib.h>
11107 #endif
11108 #ifdef I_STRING
11109 #  include <string.h>
11110 #else
11111 #  include <strings.h>
11112 #endif
11113 #ifdef I_UNISTD
11114 #  include <unistd.h>  /* Needed for NetBSD */
11115 #endif
11116 int main()
11117 {
11118 char buf[128], abc[128];
11119 char *b;
11120 int len;
11121 int off;
11122 int align;
11123
11124 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11125
11126 for (align = 7; align >= 0; align--) {
11127         for (len = 36; len; len--) {
11128                 b = buf+align;
11129                 bcopy(abc, b, len);
11130                 for (off = 1; off <= len; off++) {
11131                         bcopy(b, b+off, len);
11132                         bcopy(b+off, b, len);
11133                         if (bcmp(b, abc, len))
11134                                 exit(1);
11135                 }
11136         }
11137 }
11138 exit(0);
11139 }
11140 EOCP
11141         set try
11142         if eval $compile_ok; then
11143                 if ./try 2>/dev/null; then
11144                         echo "Yes, it can."
11145                         val="$define"
11146                 else
11147                         echo "It can't, sorry."
11148                         case "$d_memmove" in
11149                         "$define") echo "But that's Ok since you have memmove()." ;;
11150                         esac
11151                 fi
11152         else
11153                 echo "(I can't compile the test program, so we'll assume not...)"
11154                 case "$d_memmove" in
11155                 "$define") echo "But that's Ok since you have memmove()." ;;
11156                 esac
11157         fi
11158         ;;
11159 esac
11160 $rm -f try.* try core
11161 set d_safebcpy
11162 eval $setvar
11163
11164 : can memcpy handle overlapping blocks?
11165 val="$undef"
11166 case "$d_memcpy" in
11167 "$define")
11168         echo " "
11169         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11170         $cat >try.c <<EOCP
11171 #$i_memory I_MEMORY
11172 #$i_stdlib I_STDLIB
11173 #$i_string I_STRING
11174 #$i_unistd I_UNISTD
11175 EOCP
11176         $cat >>try.c <<'EOCP'
11177 #include <stdio.h>
11178 #ifdef I_MEMORY
11179 #  include <memory.h>
11180 #endif
11181 #ifdef I_STDLIB
11182 #  include <stdlib.h>
11183 #endif
11184 #ifdef I_STRING
11185 #  include <string.h>
11186 #else
11187 #  include <strings.h>
11188 #endif
11189 #ifdef I_UNISTD
11190 #  include <unistd.h>  /* Needed for NetBSD */
11191 #endif
11192 int main()
11193 {
11194 char buf[128], abc[128];
11195 char *b;
11196 int len;
11197 int off;
11198 int align;
11199
11200 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11201    try to store the string in read-only memory. */
11202 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11203
11204 for (align = 7; align >= 0; align--) {
11205         for (len = 36; len; len--) {
11206                 b = buf+align;
11207                 memcpy(b, abc, len);
11208                 for (off = 1; off <= len; off++) {
11209                         memcpy(b+off, b, len);
11210                         memcpy(b, b+off, len);
11211                         if (memcmp(b, abc, len))
11212                                 exit(1);
11213                 }
11214         }
11215 }
11216 exit(0);
11217 }
11218 EOCP
11219         set try
11220         if eval $compile_ok; then
11221                 if ./try 2>/dev/null; then
11222                         echo "Yes, it can."
11223                         val="$define"
11224                 else
11225                         echo "It can't, sorry."
11226                         case "$d_memmove" in
11227                         "$define") echo "But that's Ok since you have memmove()." ;;
11228                         esac
11229                 fi
11230         else
11231                 echo "(I can't compile the test program, so we'll assume not...)"
11232                 case "$d_memmove" in
11233                 "$define") echo "But that's Ok since you have memmove()." ;;
11234                 esac
11235         fi
11236         ;;
11237 esac
11238 $rm -f try.* try core
11239 set d_safemcpy
11240 eval $setvar
11241
11242 : can memcmp be trusted to compare relative magnitude?
11243 val="$undef"
11244 case "$d_memcmp" in
11245 "$define")
11246         echo " "
11247         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11248         $cat >try.c <<EOCP
11249 #$i_memory I_MEMORY
11250 #$i_stdlib I_STDLIB
11251 #$i_string I_STRING
11252 #$i_unistd I_UNISTD
11253 EOCP
11254         $cat >>try.c <<'EOCP'
11255 #include <stdio.h>
11256 #ifdef I_MEMORY
11257 #  include <memory.h>
11258 #endif
11259 #ifdef I_STDLIB
11260 #  include <stdlib.h>
11261 #endif
11262 #ifdef I_STRING
11263 #  include <string.h>
11264 #else
11265 #  include <strings.h>
11266 #endif
11267 #ifdef I_UNISTD
11268 #  include <unistd.h>  /* Needed for NetBSD */
11269 #endif
11270 int main()
11271 {
11272 char a = -1;
11273 char b = 0;
11274 if ((a < b) && memcmp(&a, &b, 1) < 0)
11275         exit(1);
11276 exit(0);
11277 }
11278 EOCP
11279         set try
11280         if eval $compile_ok; then
11281                 if ./try 2>/dev/null; then
11282                         echo "Yes, it can."
11283                         val="$define"
11284                 else
11285                         echo "No, it can't (it uses signed chars)."
11286                 fi
11287         else
11288                 echo "(I can't compile the test program, so we'll assume not...)"
11289         fi
11290         ;;
11291 esac
11292 $rm -f try.* try core
11293 set d_sanemcmp
11294 eval $setvar
11295
11296 : see if prototype for sbrk is available
11297 echo " "
11298 set d_sbrkproto sbrk $i_unistd unistd.h
11299 eval $hasproto
11300
11301 : see if select exists
11302 set select d_select
11303 eval $inlibc
11304
11305 : see if semctl exists
11306 set semctl d_semctl
11307 eval $inlibc
11308
11309 : see if semget exists
11310 set semget d_semget
11311 eval $inlibc
11312
11313 : see if semop exists
11314 set semop d_semop
11315 eval $inlibc
11316
11317 : see how much of the 'sem*(2)' library is present.
11318 h_sem=true
11319 echo " "
11320 case "$d_semctl$d_semget$d_semop" in
11321 *"$undef"*) h_sem=false;;
11322 esac
11323 case "$osname" in
11324 freebsd)
11325     case "`ipcs 2>&1`" in
11326     "SVID messages"*"not configured"*)
11327         echo "Your $osname does not have the sem*(2) configured." >&4
11328         h_sem=false
11329         val="$undef"
11330         set semctl d_semctl
11331         eval $setvar
11332         set semget d_semget
11333         eval $setvar
11334         set semop d_semop
11335         eval $setvar
11336         ;;
11337     esac
11338     ;;
11339 esac
11340 : we could also check for sys/ipc.h ...
11341 if $h_sem && $test `./findhdr sys/sem.h`; then
11342         echo "You have the full sem*(2) library." >&4
11343         val="$define"
11344 else
11345         echo "You don't have the full sem*(2) library." >&4
11346         val="$undef"
11347 fi
11348 set d_sem
11349 eval $setvar
11350
11351 : see whether sys/sem.h defines union semun
11352 echo " "
11353 $cat > try.c <<'END'
11354 #include <sys/types.h>
11355 #include <sys/ipc.h>
11356 #include <sys/sem.h>
11357 int main () { union semun semun; semun.buf = 0; }
11358 END
11359 set try
11360 if eval $compile; then
11361     echo "You have union semun in <sys/sem.h>." >&4
11362     val="$define"
11363 else
11364     echo "You do not have union semun in <sys/sem.h>." >&4
11365     val="$undef"
11366 fi
11367 $rm -f try try.c try.h
11368 set d_union_semun
11369 eval $setvar
11370
11371 : see how to do semctl IPC_STAT
11372 case "$d_sem" in
11373 $define)
11374     : see whether semctl IPC_STAT can use union semun
11375     echo " "
11376     $cat > try.h <<END
11377 #ifndef S_IRUSR
11378 #   ifdef S_IREAD
11379 #       define S_IRUSR S_IREAD
11380 #       define S_IWUSR S_IWRITE
11381 #       define S_IXUSR S_IEXEC
11382 #   else
11383 #       define S_IRUSR 0400
11384 #       define S_IWUSR 0200
11385 #       define S_IXUSR 0100
11386 #   endif
11387 #   define S_IRGRP (S_IRUSR>>3)
11388 #   define S_IWGRP (S_IWUSR>>3)
11389 #   define S_IXGRP (S_IXUSR>>3)
11390 #   define S_IROTH (S_IRUSR>>6)
11391 #   define S_IWOTH (S_IWUSR>>6)
11392 #   define S_IXOTH (S_IXUSR>>6)
11393 #endif
11394 #ifndef S_IRWXU
11395 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11396 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11397 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11398 #endif
11399 END
11400
11401     $cat > try.c <<END
11402 #include <sys/types.h>
11403 #include <sys/ipc.h>
11404 #include <sys/sem.h>
11405 #include <sys/stat.h>
11406 #include <stdio.h>
11407 #include <errno.h>
11408 #include "try.h"
11409 #ifndef errno
11410 extern int errno;
11411 #endif
11412 #$d_union_semun HAS_UNION_SEMUN
11413 int main() {
11414     union semun
11415 #ifndef HAS_UNION_SEMUN
11416     {
11417         int val;
11418         struct semid_ds *buf;
11419         unsigned short *array;
11420     }
11421 #endif
11422     arg;
11423     int sem, st;
11424
11425 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11426     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11427     if (sem > -1) {
11428         struct semid_ds argbuf;
11429         arg.buf = &argbuf;
11430 #       ifdef IPC_STAT
11431         st = semctl(sem, 0, IPC_STAT, arg);
11432         if (st == 0)
11433             printf("semun\n");
11434         else
11435 #       endif /* IPC_STAT */
11436             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11437 #       ifdef IPC_RMID
11438         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11439 #       endif /* IPC_RMID */
11440             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11441     } else
11442 #endif /* IPC_PRIVATE && ... */
11443         printf("semget failed: errno = %d\n", errno);
11444   return 0;
11445 }
11446 END
11447     val="$undef"
11448     set try
11449     if eval $compile; then
11450         xxx=`./try`
11451         case "$xxx" in
11452         semun) val="$define" ;;
11453         esac
11454     fi
11455     $rm -f try try.c
11456     set d_semctl_semun
11457     eval $setvar
11458     case "$d_semctl_semun" in
11459     $define)
11460         echo "You can use union semun for semctl IPC_STAT." >&4
11461         also='also'
11462         ;;
11463     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11464         also=''
11465         ;;
11466     esac
11467
11468     : see whether semctl IPC_STAT can use struct semid_ds pointer
11469     $cat > try.c <<'END'
11470 #include <sys/types.h>
11471 #include <sys/ipc.h>
11472 #include <sys/sem.h>
11473 #include <sys/stat.h>
11474 #include "try.h"
11475 #include <stdio.h>
11476 #include <errno.h>
11477 #ifndef errno
11478 extern int errno;
11479 #endif
11480 int main() {
11481     struct semid_ds arg;
11482     int sem, st;
11483
11484 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11485     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11486     if (sem > -1) {
11487 #       ifdef IPC_STAT
11488         st = semctl(sem, 0, IPC_STAT, &arg);
11489         if (st == 0)
11490             printf("semid_ds\n");
11491         else
11492 #       endif /* IPC_STAT */
11493             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11494 #       ifdef IPC_RMID
11495         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11496 #       endif /* IPC_RMID */
11497             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11498     } else
11499 #endif /* IPC_PRIVATE && ... */
11500         printf("semget failed: errno = %d\n", errno);
11501
11502     return 0;
11503 }
11504 END
11505     val="$undef"
11506     set try
11507     if eval $compile; then
11508         xxx=`./try`
11509         case "$xxx" in
11510         semid_ds) val="$define" ;;
11511         esac
11512     fi
11513     $rm -f try try.c
11514     set d_semctl_semid_ds
11515     eval $setvar
11516     case "$d_semctl_semid_ds" in
11517     $define)
11518         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11519         ;;
11520     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11521         ;;
11522     esac
11523     $rm -f try.h
11524     ;;
11525 *)  val="$undef"
11526
11527     # We do not have the full sem*(2) library, so assume we can not
11528     # use either.
11529
11530     set d_semctl_semun
11531     eval $setvar
11532
11533     set d_semctl_semid_ds
11534     eval $setvar
11535     ;;
11536 esac
11537
11538 : see if sendmsg exists
11539 set sendmsg d_sendmsg
11540 eval $inlibc
11541
11542 : see if setegid exists
11543 set setegid d_setegid
11544 eval $inlibc
11545
11546 : see if seteuid exists
11547 set seteuid d_seteuid
11548 eval $inlibc
11549
11550 : see if setgrent exists
11551 set setgrent d_setgrent
11552 eval $inlibc
11553
11554 : see if sethostent exists
11555 set sethostent d_sethent
11556 eval $inlibc
11557
11558 : see if setitimer exists
11559 set setitimer d_setitimer
11560 eval $inlibc
11561
11562 : see if setlinebuf exists
11563 set setlinebuf d_setlinebuf
11564 eval $inlibc
11565
11566 : see if setlocale exists
11567 set setlocale d_setlocale
11568 eval $inlibc
11569
11570 : see if setnetent exists
11571 set setnetent d_setnent
11572 eval $inlibc
11573
11574 : see if setprotoent exists
11575 set setprotoent d_setpent
11576 eval $inlibc
11577
11578 : see if setpgid exists
11579 set setpgid d_setpgid
11580 eval $inlibc
11581
11582 : see if setpgrp2 exists
11583 set setpgrp2 d_setpgrp2
11584 eval $inlibc
11585
11586 : see if setpriority exists
11587 set setpriority d_setprior
11588 eval $inlibc
11589
11590 : see if setproctitle exists
11591 set setproctitle d_setproctitle
11592 eval $inlibc
11593
11594 : see if setpwent exists
11595 set setpwent d_setpwent
11596 eval $inlibc
11597
11598 : see if setregid exists
11599 set setregid d_setregid
11600 eval $inlibc
11601 set setresgid d_setresgid
11602 eval $inlibc
11603
11604 : see if setreuid exists
11605 set setreuid d_setreuid
11606 eval $inlibc
11607 set setresuid d_setresuid
11608 eval $inlibc
11609
11610 : see if setrgid exists
11611 set setrgid d_setrgid
11612 eval $inlibc
11613
11614 : see if setruid exists
11615 set setruid d_setruid
11616 eval $inlibc
11617
11618 : see if setservent exists
11619 set setservent d_setsent
11620 eval $inlibc
11621
11622 : see if setsid exists
11623 set setsid d_setsid
11624 eval $inlibc
11625
11626 : see if setvbuf exists
11627 set setvbuf d_setvbuf
11628 eval $inlibc
11629
11630 : see if sfio.h is available
11631 set sfio.h i_sfio
11632 eval $inhdr
11633
11634
11635 : see if sfio library is available
11636 case "$i_sfio" in
11637 $define)
11638         val=''
11639         set sfreserve val
11640         eval $inlibc
11641         ;;
11642 *)
11643         val="$undef"
11644         ;;
11645 esac
11646 : Ok, but do we want to use it.
11647 case "$val" in
11648 $define)
11649         case "$usesfio" in
11650         true|$define|[yY]*) dflt='y';;
11651         *) dflt='n';;
11652         esac
11653         echo "$package can use the sfio library, but it is experimental."
11654         case "$useperlio" in
11655         "$undef")
11656             echo "For sfio also the PerlIO abstraction layer is needed."
11657             echo "Earlier you said you wouldn't want that."
11658             ;;
11659         esac
11660         rp="You seem to have sfio available, do you want to try using it?"
11661         . ./myread
11662         case "$ans" in
11663         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11664                 useperlio="$define"
11665                 val="$define"
11666                 ;;
11667         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11668                 val="$undef"
11669                 ;;
11670         esac
11671         ;;
11672 *)      case "$usesfio" in
11673         true|$define|[yY]*)
11674                 echo "Sorry, cannot find sfio on this machine." >&4
11675                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11676                 val="$undef"
11677                 ;;
11678         esac
11679         ;;
11680 esac
11681 set d_sfio
11682 eval $setvar
11683 case "$d_sfio" in
11684 $define) usesfio='true';;
11685 *) usesfio='false';;
11686 esac
11687 case "$d_sfio" in
11688 $define) ;;
11689 *)      : Remove sfio from list of libraries to use
11690         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11691         shift
11692         libs="$*"
11693         echo "libs = $libs" >&4
11694 ;;
11695 esac
11696
11697
11698 : see if shmctl exists
11699 set shmctl d_shmctl
11700 eval $inlibc
11701
11702 : see if shmget exists
11703 set shmget d_shmget
11704 eval $inlibc
11705
11706 : see if shmat exists
11707 set shmat d_shmat
11708 eval $inlibc
11709 : see what shmat returns
11710 case "$d_shmat" in
11711 "$define")
11712         $cat >shmat.c <<'END'
11713 #include <sys/shm.h>
11714 void *shmat();
11715 END
11716         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11717                 shmattype='void *'
11718         else
11719                 shmattype='char *'
11720         fi
11721         echo "and it returns ($shmattype)." >&4
11722         : see if a prototype for shmat is available
11723         xxx=`./findhdr sys/shm.h`
11724         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11725         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11726                 val="$define"
11727         else
11728                 val="$undef"
11729         fi
11730         $rm -f shmat.[co]
11731         ;;
11732 *)
11733         val="$undef"
11734         ;;
11735 esac
11736 set d_shmatprototype
11737 eval $setvar
11738
11739 : see if shmdt exists
11740 set shmdt d_shmdt
11741 eval $inlibc
11742
11743 : see how much of the 'shm*(2)' library is present.
11744 h_shm=true
11745 echo " "
11746 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11747 *"$undef"*) h_shm=false;;
11748 esac
11749 case "$osname" in
11750 freebsd)
11751     case "`ipcs 2>&1`" in
11752     "SVID shared memory"*"not configured"*)
11753         echo "Your $osname does not have the shm*(2) configured." >&4
11754         h_shm=false
11755         val="$undef"
11756         set shmctl d_shmctl
11757         evat $setvar
11758         set shmget d_shmget
11759         evat $setvar
11760         set shmat d_shmat
11761         evat $setvar
11762         set shmdt d_shmdt
11763         evat $setvar
11764         ;;
11765     esac
11766     ;;
11767 esac
11768 : we could also check for sys/ipc.h ...
11769 if $h_shm && $test `./findhdr sys/shm.h`; then
11770         echo "You have the full shm*(2) library." >&4
11771         val="$define"
11772 else
11773         echo "You don't have the full shm*(2) library." >&4
11774         val="$undef"
11775 fi
11776 set d_shm
11777 eval $setvar
11778
11779 echo " "
11780 : see if we have sigaction
11781 if set sigaction val -f d_sigaction; eval $csym; $val; then
11782         echo 'sigaction() found.' >&4
11783         $cat > try.c <<'EOP'
11784 #include <stdio.h>
11785 #include <sys/types.h>
11786 #include <signal.h>
11787 int main()
11788 {
11789     struct sigaction act, oact;
11790     act.sa_flags = 0;
11791     oact.sa_handler = 0;
11792     /* so that act and oact are used */
11793     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11794 }
11795 EOP
11796         set try
11797         if eval $compile_ok; then
11798                 val="$define"
11799         else
11800                 echo "But you don't seem to have a useable struct sigaction." >&4
11801                 val="$undef"
11802         fi
11803 else
11804         echo 'sigaction NOT found.' >&4
11805         val="$undef"
11806 fi
11807 set d_sigaction; eval $setvar
11808 $rm -f try try$_o try.c
11809
11810 : see if sigprocmask exists
11811 set sigprocmask d_sigprocmask
11812 eval $inlibc
11813
11814 : see if sigsetjmp exists
11815 echo " "
11816 case "$d_sigsetjmp" in
11817 '')
11818         $cat >try.c <<'EOP'
11819 #include <setjmp.h>
11820 sigjmp_buf env;
11821 int set = 1;
11822 int main()
11823 {
11824         if (sigsetjmp(env,1))
11825                 exit(set);
11826         set = 0;
11827         siglongjmp(env, 1);
11828         exit(1);
11829 }
11830 EOP
11831         set try
11832         if eval $compile; then
11833                 if ./try >/dev/null 2>&1; then
11834                         echo "POSIX sigsetjmp found." >&4
11835                         val="$define"
11836                 else
11837                         $cat >&4 <<EOM
11838 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11839 I'll ignore them.
11840 EOM
11841                         val="$undef"
11842                 fi
11843         else
11844                 echo "sigsetjmp not found." >&4
11845                 val="$undef"
11846         fi
11847         ;;
11848 *) val="$d_sigsetjmp"
11849         case "$d_sigsetjmp" in
11850         $define) echo "POSIX sigsetjmp found." >&4;;
11851         $undef) echo "sigsetjmp not found." >&4;;
11852         esac
11853         ;;
11854 esac
11855 set d_sigsetjmp
11856 eval $setvar
11857 $rm -f try.c try
11858
11859 : see if sockatmark exists
11860 set sockatmark d_sockatmark
11861 eval $inlibc
11862
11863 : see if socks5_init exists
11864 set socks5_init d_socks5_init
11865 eval $inlibc
11866
11867 : see if sys/stat.h is available
11868 set sys/stat.h i_sysstat
11869 eval $inhdr
11870
11871
11872 : see if stat knows about block sizes
11873 echo " "
11874 echo "Checking to see if your struct stat has st_blocks field..." >&4
11875 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11876 eval $hasfield
11877
11878
11879 : see if this is a sys/vfs.h system
11880 set sys/vfs.h i_sysvfs
11881 eval $inhdr
11882
11883
11884 : see if this is a sys/statfs.h system
11885 set sys/statfs.h i_sysstatfs
11886 eval $inhdr
11887
11888
11889 echo " "
11890 echo "Checking to see if your system supports struct statfs..." >&4
11891 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
11892 eval $hasstruct
11893 case "$d_statfs_s" in
11894 "$define")      echo "Yes, it does."   ;;
11895 *)              echo "No, it doesn't." ;;
11896 esac
11897
11898
11899
11900 : see if struct statfs knows about f_flags
11901 case "$d_statfs_s" in
11902 define) 
11903         echo " "
11904         echo "Checking to see if your struct statfs has f_flags field..." >&4
11905         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
11906         eval $hasfield
11907         ;;
11908 *)      val="$undef"
11909         set d_statfs_f_flags
11910         eval $setvar
11911         ;;
11912 esac
11913 case "$d_statfs_f_flags" in
11914 "$define")      echo "Yes, it does."   ;;
11915 *)              echo "No, it doesn't." ;;
11916 esac
11917
11918 : see if _ptr and _cnt from stdio act std
11919 echo " "
11920
11921 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11922         echo "(Looks like you have stdio.h from BSD.)"
11923         case "$stdio_ptr" in
11924         '') stdio_ptr='((fp)->_p)'
11925                 ptr_lval=$define
11926                 ;;
11927         *)      ptr_lval=$d_stdio_ptr_lval;;
11928         esac
11929         case "$stdio_cnt" in
11930         '') stdio_cnt='((fp)->_r)'
11931                 cnt_lval=$define
11932                 ;;
11933         *)      cnt_lval=$d_stdio_cnt_lval;;
11934         esac
11935         case "$stdio_base" in
11936         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11937         esac
11938         case "$stdio_bufsiz" in
11939         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11940         esac
11941 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11942         echo "(Looks like you have stdio.h from Linux.)"
11943         case "$stdio_ptr" in
11944         '') stdio_ptr='((fp)->_IO_read_ptr)'
11945                 ptr_lval=$define
11946                 ;;
11947         *)      ptr_lval=$d_stdio_ptr_lval;;
11948         esac
11949         case "$stdio_cnt" in
11950         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11951                 cnt_lval=$undef
11952                 ;;
11953         *)      cnt_lval=$d_stdio_cnt_lval;;
11954         esac
11955         case "$stdio_base" in
11956         '') stdio_base='((fp)->_IO_read_base)';;
11957         esac
11958         case "$stdio_bufsiz" in
11959         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11960         esac
11961 else
11962         case "$stdio_ptr" in
11963         '') stdio_ptr='((fp)->_ptr)'
11964                 ptr_lval=$define
11965                 ;;
11966         *)      ptr_lval=$d_stdio_ptr_lval;;
11967         esac
11968         case "$stdio_cnt" in
11969         '') stdio_cnt='((fp)->_cnt)'
11970                 cnt_lval=$define
11971                 ;;
11972         *)      cnt_lval=$d_stdio_cnt_lval;;
11973         esac
11974         case "$stdio_base" in
11975         '') stdio_base='((fp)->_base)';;
11976         esac
11977         case "$stdio_bufsiz" in
11978         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11979         esac
11980 fi
11981
11982 : test whether _ptr and _cnt really work
11983 echo "Checking how std your stdio is..." >&4
11984 $cat >try.c <<EOP
11985 #include <stdio.h>
11986 #define FILE_ptr(fp)    $stdio_ptr
11987 #define FILE_cnt(fp)    $stdio_cnt
11988 int main() {
11989         FILE *fp = fopen("try.c", "r");
11990         char c = getc(fp);
11991         if (
11992                 18 <= FILE_cnt(fp) &&
11993                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11994         )
11995                 exit(0);
11996         exit(1);
11997 }
11998 EOP
11999 val="$undef"
12000 set try
12001 if eval $compile; then
12002         if ./try; then
12003                 echo "Your stdio acts pretty std."
12004                 val="$define"
12005         else
12006                 echo "Your stdio isn't very std."
12007         fi
12008 else
12009         echo "Your stdio doesn't appear very std."
12010 fi
12011 $rm -f try.c try
12012 set d_stdstdio
12013 eval $setvar
12014
12015 : Can _ptr be used as an lvalue?
12016 case "$d_stdstdio$ptr_lval" in
12017 $define$define) val=$define ;;
12018 *) val=$undef ;;
12019 esac
12020 set d_stdio_ptr_lval
12021 eval $setvar
12022
12023 : Can _cnt be used as an lvalue?
12024 case "$d_stdstdio$cnt_lval" in
12025 $define$define) val=$define ;;
12026 *) val=$undef ;;
12027 esac
12028 set d_stdio_cnt_lval
12029 eval $setvar
12030
12031
12032 : test whether setting _ptr sets _cnt as a side effect
12033 d_stdio_ptr_lval_sets_cnt="$undef"
12034 d_stdio_ptr_lval_nochange_cnt="$undef"
12035 case "$d_stdio_ptr_lval$d_stdstdio" in
12036 $define$define)
12037         echo "Checking to see what happens if we set the stdio ptr..." >&4
12038 $cat >try.c <<EOP
12039 #include <stdio.h>
12040 /* Can we scream? */
12041 /* Eat dust sed :-) */
12042 /* In the buffer space, no one can hear you scream. */
12043 #define FILE_ptr(fp)    $stdio_ptr
12044 #define FILE_cnt(fp)    $stdio_cnt
12045 #include <sys/types.h>
12046 int main() {
12047         FILE *fp = fopen("try.c", "r");
12048         int c;
12049         char *ptr;
12050         size_t cnt;
12051         if (!fp) {
12052             puts("Fail even to read");
12053             exit(1);
12054         }
12055         c = getc(fp); /* Read away the first # */
12056         if (c == EOF) {
12057             puts("Fail even to read");
12058             exit(1);
12059         }
12060         if (!(
12061                 18 <= FILE_cnt(fp) &&
12062                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12063         )) {
12064                 puts("Fail even to read");
12065                 exit (1);
12066         }
12067         ptr = (char*) FILE_ptr(fp);
12068         cnt = (size_t)FILE_cnt(fp);
12069
12070         FILE_ptr(fp) += 42;
12071
12072         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12073                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12074                 exit (1);
12075         }
12076         if (FILE_cnt(fp) <= 20) {
12077                 printf ("Fail (<20 chars to test)");
12078                 exit (1);
12079         }
12080         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12081                 puts("Fail compare");
12082                 exit (1);
12083         }
12084         if (cnt == FILE_cnt(fp)) {
12085                 puts("Pass_unchanged");
12086                 exit (0);
12087         }       
12088         if (FILE_cnt(fp) == (cnt - 42)) {
12089                 puts("Pass_changed");
12090                 exit (0);
12091         }
12092         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12093         return 1;
12094
12095 }
12096 EOP
12097         set try
12098         if eval $compile; then
12099                 case `./try$exe_ext` in
12100                 Pass_changed)
12101                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12102                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12103                 Pass_unchanged)
12104                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12105                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12106                 Fail*)
12107                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12108                 *)
12109                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12110         esac
12111         else
12112                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12113         fi
12114         $rm -f try.c try
12115         ;;
12116 esac
12117
12118 : see if _base is also standard
12119 val="$undef"
12120 case "$d_stdstdio" in
12121 $define)
12122         $cat >try.c <<EOP
12123 #include <stdio.h>
12124 #define FILE_base(fp)   $stdio_base
12125 #define FILE_bufsiz(fp) $stdio_bufsiz
12126 int main() {
12127         FILE *fp = fopen("try.c", "r");
12128         char c = getc(fp);
12129         if (
12130                 19 <= FILE_bufsiz(fp) &&
12131                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12132         )
12133                 exit(0);
12134         exit(1);
12135 }
12136 EOP
12137         set try
12138         if eval $compile; then
12139                 if ./try; then
12140                         echo "And its _base field acts std."
12141                         val="$define"
12142                 else
12143                         echo "But its _base field isn't std."
12144                 fi
12145         else
12146                 echo "However, it seems to be lacking the _base field."
12147         fi
12148         $rm -f try.c try
12149         ;;
12150 esac
12151 set d_stdiobase
12152 eval $setvar
12153
12154 $cat >&4 <<EOM
12155 Checking how to access stdio streams by file descriptor number...
12156 EOM
12157 case "$stdio_stream_array" in
12158 '')     $cat >try.c <<EOCP
12159 #include <stdio.h>
12160 int main() {
12161   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12162     printf("yes\n");
12163 }
12164 EOCP
12165         for s in _iob __iob __sF
12166         do
12167                 set try -DSTDIO_STREAM_ARRAY=$s
12168                 if eval $compile; then
12169                         case "`./try$exe_ext`" in
12170                         yes)    stdio_stream_array=$s; break ;;
12171                         esac
12172                 fi
12173         done
12174         $rm -f try.* try$exe_ext
12175 esac
12176 case "$stdio_stream_array" in
12177 '')     $cat >&4 <<EOM
12178 I can't figure out how to access stdio streams by file descriptor number.
12179 EOM
12180         d_stdio_stream_array="$undef"
12181         ;;
12182 *)      $cat >&4 <<EOM
12183 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12184 EOM
12185         d_stdio_stream_array="$define"
12186         ;;
12187 esac
12188
12189 : see if strcoll exists
12190 set strcoll d_strcoll
12191 eval $inlibc
12192
12193 : check for structure copying
12194 echo " "
12195 echo "Checking to see if your C compiler can copy structs..." >&4
12196 $cat >try.c <<'EOCP'
12197 int main()
12198 {
12199         struct blurfl {
12200                 int dyick;
12201         } foo, bar;
12202
12203         foo = bar;
12204 }
12205 EOCP
12206 if $cc -c try.c >/dev/null 2>&1 ; then
12207         val="$define"
12208         echo "Yup, it can."
12209 else
12210         val="$undef"
12211         echo "Nope, it can't."
12212 fi
12213 set d_strctcpy
12214 eval $setvar
12215 $rm -f try.*
12216
12217 : see if strerror and/or sys_errlist[] exist
12218 echo " "
12219 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12220     if set strerror val -f d_strerror; eval $csym; $val; then
12221                 echo 'strerror() found.' >&4
12222                 d_strerror="$define"
12223                 d_strerrm='strerror(e)'
12224                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12225                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12226                         d_syserrlst="$define"
12227                 else
12228                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12229                         d_syserrlst="$undef"
12230                 fi
12231     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12232                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12233                 echo 'strerror() found in string header.' >&4
12234                 d_strerror="$define"
12235                 d_strerrm='strerror(e)'
12236                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12237                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12238                                 d_syserrlst="$define"
12239                 else
12240                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12241                         d_syserrlst="$undef"
12242                 fi
12243     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12244                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12245                 d_strerror="$undef"
12246                 d_syserrlst="$define"
12247                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12248     else
12249                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12250                 d_strerror="$undef"
12251                 d_syserrlst="$undef"
12252                 d_strerrm='"unknown"'
12253     fi
12254 fi
12255
12256 : see if strftime exists
12257 set strftime d_strftime
12258 eval $inlibc
12259
12260 : see if strtod exists
12261 set strtod d_strtod
12262 eval $inlibc
12263
12264 : see if strtol exists
12265 set strtol d_strtol
12266 eval $inlibc
12267
12268 : see if strtold exists
12269 set strtold d_strtold
12270 eval $inlibc
12271
12272 : see if strtoll exists
12273 set strtoll d_strtoll
12274 eval $inlibc
12275
12276 case "$d_longlong-$d_strtoll" in
12277 "$define-$define")
12278         $cat <<EOM
12279 Checking whether your strtoll() works okay...
12280 EOM
12281         $cat >try.c <<'EOCP'
12282 #include <errno.h>
12283 #ifdef __hpux
12284 #define strtoll __strtoll
12285 #endif
12286 #ifdef __EMX__
12287 #define strtoll _strtoll
12288 #endif
12289 #include <stdio.h>
12290 extern long long int strtoll(char *s, char **, int); 
12291 static int bad = 0;
12292 int check(char *s, long long ell, int een) {
12293         long long gll;
12294         errno = 0;
12295         gll = strtoll(s, 0, 10);
12296         if (!((gll == ell) && (errno == een)))
12297                 bad++;
12298 }
12299 int main() {
12300         check(" 1",                                      1LL, 0);
12301         check(" 0",                                      0LL, 0);
12302         check("-1",                                     -1LL, 0);
12303         check("-9223372036854775808", -9223372036854775808LL, 0);
12304         check("-9223372036854775808", -9223372036854775808LL, 0);
12305         check(" 9223372036854775807",  9223372036854775807LL, 0);
12306         check("-9223372036854775808", -9223372036854775808LL, 0);
12307         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12308         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12309         if (!bad)
12310                 printf("ok\n");
12311 }
12312 EOCP
12313         set try
12314         if eval $compile; then
12315                 yyy=`./try`
12316                 case "$yyy" in
12317                 ok) echo "Your strtoll() seems to be working okay." ;;
12318                 *) cat <<EOM >&4
12319 Your strtoll() doesn't seem to be working okay.
12320 EOM
12321                    d_strtoll="$undef"
12322                    ;;
12323                 esac
12324         else
12325                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12326                 d_strtoll="$undef"
12327         fi
12328         ;;
12329 esac
12330
12331 : see if strtoq exists
12332 set strtoq d_strtoq
12333 eval $inlibc
12334
12335 : see if strtoul exists
12336 set strtoul d_strtoul
12337 eval $inlibc
12338
12339 case "$d_strtoul" in
12340 "$define")
12341         $cat <<EOM
12342 Checking whether your strtoul() works okay...
12343 EOM
12344         $cat >try.c <<'EOCP'
12345 #include <errno.h>
12346 #include <stdio.h>
12347 extern unsigned long int strtoul(char *s, char **, int); 
12348 static int bad = 0;
12349 void check(char *s, unsigned long eul, int een) {
12350         unsigned long gul;
12351         errno = 0;
12352         gul = strtoul(s, 0, 10);
12353         if (!((gul == eul) && (errno == een)))
12354                 bad++;
12355 }
12356 int main() {
12357         check(" 1", 1L, 0);
12358         check(" 0", 0L, 0);
12359 EOCP
12360         case "$longsize" in
12361         8)
12362             $cat >>try.c <<'EOCP'
12363         check("18446744073709551615", 18446744073709551615UL, 0);
12364         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12365 #if 0 /* strtoul() for /^-/ strings is undefined. */
12366         check("-1", 18446744073709551615UL, 0);
12367         check("-18446744073709551614", 2, 0);
12368         check("-18446744073709551615", 1, 0);
12369         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12370         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12371 #endif
12372 EOCP
12373                 ;;
12374         4)
12375                     $cat >>try.c <<'EOCP'
12376         check("4294967295", 4294967295UL, 0);
12377         check("4294967296", 4294967295UL, ERANGE);
12378 #if 0 /* strtoul() for /^-/ strings is undefined. */
12379         check("-1", 4294967295UL, 0);
12380         check("-4294967294", 2, 0);
12381         check("-4294967295", 1, 0);
12382         check("-4294967296", 4294967295UL, ERANGE);
12383         check("-4294967297", 4294967295UL, ERANGE);
12384 #endif
12385 EOCP
12386                 ;;
12387         *)
12388 : Should we write these tests to be more portable by sprintf-ing
12389 : ~0 and then manipulating that char string as input for strtol?
12390                 ;;
12391         esac
12392         $cat >>try.c <<'EOCP'
12393         if (!bad)
12394                 printf("ok\n");
12395         return 0;
12396 }
12397 EOCP
12398         set try
12399         if eval $compile; then
12400                 case "`./try`" in
12401                 ok) echo "Your strtoul() seems to be working okay." ;;
12402                 *) cat <<EOM >&4
12403 Your strtoul() doesn't seem to be working okay.
12404 EOM
12405                    d_strtoul="$undef"
12406                    ;;
12407                 esac
12408         fi
12409         ;;
12410 esac
12411
12412 : see if strtoull exists
12413 set strtoull d_strtoull
12414 eval $inlibc
12415
12416 case "$d_longlong-$d_strtoull" in
12417 "$define-$define")
12418         $cat <<EOM
12419 Checking whether your strtoull() works okay...
12420 EOM
12421         $cat >try.c <<'EOCP'
12422 #include <errno.h>
12423 #ifdef __hpux
12424 #define strtoull __strtoull
12425 #endif
12426 #include <stdio.h>
12427 extern unsigned long long int strtoull(char *s, char **, int); 
12428 static int bad = 0;
12429 int check(char *s, long long eull, int een) {
12430         long long gull;
12431         errno = 0;
12432         gull = strtoull(s, 0, 10);
12433         if (!((gull == eull) && (errno == een)))
12434                 bad++;
12435 }
12436 int main() {
12437         check(" 1",                                        1LL, 0);
12438         check(" 0",                                        0LL, 0);
12439         check("18446744073709551615",  18446744073709551615ULL, 0);
12440         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12441 #if 0 /* strtoull() for /^-/ strings is undefined. */
12442         check("-1",                    18446744073709551615ULL, 0);
12443         check("-18446744073709551614",                     2LL, 0);
12444         check("-18446744073709551615",                     1LL, 0);
12445         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12446         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12447 #endif
12448         if (!bad)
12449                 printf("ok\n");
12450 }
12451 EOCP
12452         set try
12453         if eval $compile; then
12454                 case "`./try`" in
12455                 ok) echo "Your strtoull() seems to be working okay." ;;
12456                 *) cat <<EOM >&4
12457 Your strtoull() doesn't seem to be working okay.
12458 EOM
12459                    d_strtoull="$undef"
12460                    ;;
12461                 esac
12462         fi
12463         ;;
12464 esac
12465
12466 : see if strtouq exists
12467 set strtouq d_strtouq
12468 eval $inlibc
12469
12470 case "$d_strtouq" in
12471 "$define")
12472         $cat <<EOM
12473 Checking whether your strtouq() works okay...
12474 EOM
12475         $cat >try.c <<'EOCP'
12476 #include <errno.h>
12477 #include <stdio.h>
12478 extern unsigned long long int strtouq(char *s, char **, int); 
12479 static int bad = 0;
12480 void check(char *s, unsigned long long eull, int een) {
12481         unsigned long long gull;
12482         errno = 0;
12483         gull = strtouq(s, 0, 10);
12484         if (!((gull == eull) && (errno == een)))
12485                 bad++;
12486 }
12487 int main() {
12488         check(" 1",                                        1LL, 0);
12489         check(" 0",                                        0LL, 0);
12490         check("18446744073709551615",  18446744073709551615ULL, 0);
12491         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12492 #if 0 /* strtouq() for /^-/ strings is undefined. */
12493         check("-1",                    18446744073709551615ULL, 0);
12494         check("-18446744073709551614",                     2LL, 0);
12495         check("-18446744073709551615",                     1LL, 0);
12496         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12497         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12498 #endif
12499         if (!bad)
12500                 printf("ok\n");
12501         return 0;
12502 }
12503 EOCP
12504         set try
12505         if eval $compile; then
12506                 case "`./try`" in
12507                 ok) echo "Your strtouq() seems to be working okay." ;;
12508                 *) cat <<EOM >&4
12509 Your strtouq() doesn't seem to be working okay.
12510 EOM
12511                    d_strtouq="$undef"
12512                    ;;
12513                 esac
12514         fi
12515         ;;
12516 esac
12517
12518 : see if strxfrm exists
12519 set strxfrm d_strxfrm
12520 eval $inlibc
12521
12522 : see if symlink exists
12523 set symlink d_symlink
12524 eval $inlibc
12525
12526 : see if syscall exists
12527 set syscall d_syscall
12528 eval $inlibc
12529
12530 : see if sysconf exists
12531 set sysconf d_sysconf
12532 eval $inlibc
12533
12534 : see if system exists
12535 set system d_system
12536 eval $inlibc
12537
12538 : see if tcgetpgrp exists
12539 set tcgetpgrp d_tcgetpgrp
12540 eval $inlibc
12541
12542 : see if tcsetpgrp exists
12543 set tcsetpgrp d_tcsetpgrp
12544 eval $inlibc
12545
12546 : see if prototype for telldir is available
12547 echo " "
12548 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12549 eval $hasproto
12550
12551 : see if this is a sys/times.h system
12552 set sys/times.h i_systimes
12553 eval $inhdr
12554
12555 : see if times exists
12556 echo " "
12557 if set times val -f d_times; eval $csym; $val; then
12558         echo 'times() found.' >&4
12559         d_times="$define"
12560         inc=''
12561         case "$i_systimes" in
12562         "$define") inc='sys/times.h';;
12563         esac
12564         rp="What is the type returned by times() on this system?"
12565         set clock_t clocktype long stdio.h sys/types.h $inc
12566         eval $typedef_ask
12567 else
12568         echo 'times() NOT found, hope that will do.' >&4
12569         d_times="$undef"
12570         clocktype='int'
12571 fi
12572
12573 : see if truncate exists
12574 set truncate d_truncate
12575 eval $inlibc
12576
12577 : see if tzname[] exists
12578 echo " "
12579 if set tzname val -a d_tzname; eval $csym; $val; then
12580         val="$define"
12581         echo 'tzname[] found.' >&4
12582 else
12583         val="$undef"
12584         echo 'tzname[] NOT found.' >&4
12585 fi
12586 set d_tzname
12587 eval $setvar
12588
12589 case "$crosscompile" in
12590 ''|[nN]*) crosscompile="$undef" ;;
12591 esac
12592
12593 case "$osname" in
12594 next|rhapsody|darwin) multiarch="$define" ;;
12595 esac
12596 case "$multiarch" in
12597 ''|[nN]*) multiarch="$undef" ;;
12598 esac
12599
12600 : check for ordering of bytes in a long
12601 echo " "
12602 case "$crosscompile$multiarch" in
12603 *$define*)
12604         $cat <<EOM
12605 You seem to be either cross-compiling or doing a multiarchitecture build,
12606 skipping the byteorder check.
12607
12608 EOM
12609         byteorder='0xffff'
12610         ;;
12611 *)
12612         case "$byteorder" in
12613         '')
12614                 $cat <<'EOM'
12615 In the following, larger digits indicate more significance.  A big-endian
12616 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12617 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12618 machines may have weird orders like 3412.  A Cray will report 87654321,
12619 an Alpha will report 12345678. If the test program works the default is
12620 probably right.
12621 I'm now running the test program...
12622 EOM
12623                 $cat >try.c <<'EOCP'
12624 #include <stdio.h>
12625 int main()
12626 {
12627         int i;
12628         union {
12629                 unsigned long l;
12630                 char c[sizeof(long)];
12631         } u;
12632
12633         if (sizeof(long) > 4)
12634                 u.l = (0x08070605L << 32) | 0x04030201L;
12635         else
12636                 u.l = 0x04030201L;
12637         for (i = 0; i < sizeof(long); i++)
12638                 printf("%c", u.c[i]+'0');
12639         printf("\n");
12640         exit(0);
12641 }
12642 EOCP
12643                 xxx_prompt=y
12644                 set try
12645                 if eval $compile && ./try > /dev/null; then
12646                         dflt=`./try`
12647                         case "$dflt" in
12648                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12649                                 echo "(The test program ran ok.)"
12650                                 echo "byteorder=$dflt"
12651                                 xxx_prompt=n
12652                         ;;
12653                         ????|????????) echo "(The test program ran ok.)" ;;
12654                         *) echo "(The test program didn't run right for some reason.)" ;;
12655                         esac
12656                 else
12657                         dflt='4321'
12658                         cat <<'EOM'
12659 (I can't seem to compile the test program.  Guessing big-endian...)
12660 EOM
12661                 fi
12662                 case "$xxx_prompt" in
12663                 y)
12664                         rp="What is the order of bytes in a long?"
12665                         . ./myread
12666                         byteorder="$ans"
12667                         ;;
12668                 *)      byteorder=$dflt
12669                         ;;
12670                 esac
12671                 ;;
12672         esac
12673         $rm -f try.c try
12674         ;;
12675 esac
12676
12677
12678 $cat <<EOM
12679
12680 Checking to see whether you can access character data unalignedly...
12681 EOM
12682 $cat >try.c <<EOCP
12683 #include <stdio.h>
12684 #define U32 $u32type
12685 #define BYTEORDER $byteorder
12686 int main() {
12687 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12688     U8 buf[] = "\0\0\0\1\0\0\0\0";
12689     U32 *up;
12690     int i;
12691
12692     if (sizeof(U32) != 4) {
12693         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12694         exit(1);
12695     }
12696
12697     fflush(stdout);
12698
12699     for (i = 0; i < 4; i++) {
12700         up = (U32*)(buf + i);
12701         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12702                (*up == 1 << (8*(3-i)))  /* little-endian */
12703               )
12704            )
12705         {
12706             printf("read failed (%x)\n", *up);
12707             exit(2);
12708         }
12709     }
12710
12711     /* write test */
12712     for (i = 0; i < 4; i++) {
12713         up = (U32*)(buf + i);
12714         *up = 0xBeef;
12715         if (*up != 0xBeef) {
12716             printf("write failed (%x)\n", *up);
12717             exit(3);
12718         }
12719     }
12720
12721     exit(0);
12722 #else
12723     printf("1\n");
12724     exit(1);
12725 #endif
12726     return 0;
12727 }
12728 EOCP
12729 set try
12730 if eval $compile_ok; then
12731         echo "(This test may dump core.)" >&4
12732         ./try >&2 >/dev/null
12733         case "$?" in
12734         0)      cat >&4 <<EOM
12735 You can access character data pretty unalignedly.
12736 EOM
12737                 d_u32align="$undef"
12738                 ;;
12739         *)      cat >&4 <<EOM
12740 It seems that you must access character data in an aligned manner.
12741 EOM
12742                 d_u32align="$define"
12743                 ;;
12744         esac
12745         $rm -f core core.try.* try.core
12746 else
12747         rp='Can you access character data at unaligned addresses?'
12748         dflt='n'
12749         . ./myread
12750         case "$ans" in
12751         [yY]*)  d_u32align="$undef"  ;;
12752         *)      d_u32align="$define" ;;
12753         esac
12754 fi
12755
12756 : see if ualarm exists
12757 set ualarm d_ualarm
12758 eval $inlibc
12759
12760 : see if umask exists
12761 set umask d_umask
12762 eval $inlibc
12763
12764 : see if usleep exists
12765 set usleep d_usleep
12766 eval $inlibc
12767
12768 : see if ustat exists
12769 set ustat d_ustat
12770 eval $inlibc
12771
12772 : backward compatibility for d_hvfork
12773 if test X$d_hvfork != X; then
12774         d_vfork="$d_hvfork"
12775         d_hvfork=''
12776 fi
12777 : see if there is a vfork
12778 val=''
12779 set vfork val
12780 eval $inlibc
12781
12782 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12783 : perl on Solaris 2.x, and probably elsewhere.
12784 case "$val" in
12785 $define)
12786         echo " "
12787         case "$usevfork" in
12788         false) dflt='n';;
12789         *) dflt='y';;
12790         esac
12791         cat <<'EOM'
12792  
12793 Perl can only use a vfork() that doesn't suffer from strict
12794 restrictions on calling functions or modifying global data in
12795 the child.  For example, glibc-2.1 contains such a vfork()
12796 that is unsuitable.  If your system provides a proper fork()
12797 call, chances are that you do NOT want perl to use vfork().
12798
12799 EOM
12800         rp="Do you still want to use vfork()?"
12801         . ./myread
12802         case "$ans" in
12803         y|Y) ;;
12804         *)
12805                 echo "Ok, we won't use vfork()."
12806                 val="$undef"
12807                 ;;
12808         esac
12809         ;;
12810 esac
12811 set d_vfork
12812 eval $setvar
12813 case "$d_vfork" in
12814 $define) usevfork='true';;
12815 *) usevfork='false';;
12816 esac
12817
12818 : see if this is an sysdir system
12819 set sys/dir.h i_sysdir
12820 eval $inhdr
12821
12822 : see if this is an sysndir system
12823 set sys/ndir.h i_sysndir
12824 eval $inhdr
12825
12826 : see if closedir exists
12827 set closedir d_closedir
12828 eval $inlibc
12829
12830 case "$d_closedir" in
12831 "$define")
12832         echo " "
12833         echo "Checking whether closedir() returns a status..." >&4
12834         cat > closedir.c <<EOM
12835 #$i_dirent I_DIRENT             /**/
12836 #$i_sysdir I_SYS_DIR            /**/
12837 #$i_sysndir I_SYS_NDIR          /**/
12838 #$i_systypes I_SYS_TYPES        /**/
12839
12840 #if defined(I_SYS_TYPES)
12841 #include <sys/types.h>
12842 #endif
12843 #if defined(I_DIRENT)
12844 #include <dirent.h>
12845 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12846 #include <sys/dir.h>
12847 #endif
12848 #else
12849 #ifdef I_SYS_NDIR
12850 #include <sys/ndir.h>
12851 #else
12852 #ifdef I_SYS_DIR
12853 #ifdef hp9000s500
12854 #include <ndir.h>       /* may be wrong in the future */
12855 #else
12856 #include <sys/dir.h>
12857 #endif
12858 #endif
12859 #endif
12860 #endif 
12861 int main() { return closedir(opendir(".")); }
12862 EOM
12863         set closedir
12864         if eval $compile_ok; then
12865                 if ./closedir > /dev/null 2>&1 ; then
12866                         echo "Yes, it does."
12867                         val="$undef"
12868                 else
12869                         echo "No, it doesn't."
12870                         val="$define"
12871                 fi
12872         else
12873                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12874                 val="$define"
12875         fi
12876         ;;
12877 *)
12878         val="$undef";
12879         ;;
12880 esac
12881 set d_void_closedir
12882 eval $setvar
12883 $rm -f closedir*
12884 : see if there is a wait4
12885 set wait4 d_wait4
12886 eval $inlibc
12887
12888 : see if waitpid exists
12889 set waitpid d_waitpid
12890 eval $inlibc
12891
12892 : see if wcstombs exists
12893 set wcstombs d_wcstombs
12894 eval $inlibc
12895
12896 : see if wctomb exists
12897 set wctomb d_wctomb
12898 eval $inlibc
12899
12900 : see if writev exists
12901 set writev d_writev
12902 eval $inlibc
12903
12904 : preserve RCS keywords in files with variable substitution, grrr
12905 Date='$Date'
12906 Id='$Id'
12907 Log='$Log'
12908 RCSfile='$RCSfile'
12909 Revision='$Revision'
12910
12911 : check for alignment requirements
12912 echo " "
12913 case "$crosscompile$multiarch" in
12914 *$define*)
12915         $cat <<EOM
12916 You seem to be either cross-compiling or doing a multiarchitecture build,
12917 skipping the memory alignment check.
12918
12919 EOM
12920         case "$alignbytes" in
12921         '') alignbytes=8 ;;
12922         esac
12923         ;;
12924 *)
12925         case "$alignbytes" in
12926         '') echo "Checking alignment constraints..." >&4
12927                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12928                         $cat >try.c <<'EOCP'
12929 typedef long double NV;
12930 EOCP
12931                 else
12932                         $cat >try.c <<'EOCP'
12933 typedef double NV;
12934 EOCP
12935                 fi
12936                 $cat >>try.c <<'EOCP'
12937 #include <stdio.h>
12938 struct foobar {
12939         char foo;
12940         NV bar;
12941 } try_algn;
12942 int main()
12943 {
12944     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12945     return(0);
12946 }
12947 EOCP
12948                 set try
12949                 if eval $compile_ok; then
12950                         dflt=`./try`
12951                 else
12952                         dflt='8'
12953                         echo "(I can't seem to compile the test program...)"
12954                 fi
12955                 ;;
12956         *) dflt="$alignbytes"
12957                 ;;
12958         esac
12959         rp="Doubles must be aligned on a how-many-byte boundary?"
12960         . ./myread
12961         alignbytes="$ans"
12962         $rm -f try.c try
12963         ;;
12964 esac
12965
12966
12967 : set the base revision
12968 baserev=5.0
12969
12970 : how do we catenate cpp tokens here?
12971 echo " "
12972 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12973 $cat >cpp_stuff.c <<'EOCP'
12974 #define RCAT(a,b)a/**/b
12975 #define ACAT(a,b)a ## b
12976 RCAT(Rei,ser)
12977 ACAT(Cir,cus)
12978 EOCP
12979 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12980 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12981         echo "Oh!  Smells like ANSI's been here." >&4
12982         echo "We can catify or stringify, separately or together!"
12983         cpp_stuff=42
12984 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12985         echo "Ah, yes!  The good old days!" >&4
12986         echo "However, in the good old days we don't know how to stringify and"
12987         echo "catify at the same time."
12988         cpp_stuff=1
12989 else
12990         $cat >&4 <<EOM
12991 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12992 to have to edit the values of CAT[2-5] in config.h...
12993 EOM
12994         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12995 fi
12996 $rm -f cpp_stuff.*
12997
12998 : see if this is a db.h system
12999 set db.h i_db
13000 eval $inhdr
13001
13002 case "$i_db" in
13003 $define)
13004         : Check db version.
13005         echo " "
13006         echo "Checking Berkeley DB version ..." >&4
13007         $cat >try.c <<EOCP
13008 #$d_const HASCONST
13009 #ifndef HASCONST
13010 #define const
13011 #endif
13012 #include <sys/types.h>
13013 #include <stdio.h>
13014 #include <db.h>
13015 int main()
13016 {
13017 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13018     int Major, Minor, Patch ;
13019     unsigned long Version ;
13020     (void)db_version(&Major, &Minor, &Patch) ;
13021     printf("You have Berkeley DB Version 2 or greater\n");
13022
13023     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13024                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13025     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13026                 Major, Minor, Patch) ;
13027
13028     /* check that db.h & libdb are compatible */
13029     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13030         printf("db.h and libdb are incompatible\n") ;
13031         exit(3);        
13032     }
13033
13034     printf("db.h and libdb are compatible\n") ;
13035
13036     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13037                 + DB_VERSION_PATCH ;
13038
13039     /* needs to be >= 2.3.4 */
13040     if (Version < 2003004) {
13041     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13042         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
13043         exit(2);        
13044     }
13045
13046     exit(0);
13047 #else
13048 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13049     printf("You have Berkeley DB Version 1\n");
13050     exit(0);    /* DB version < 2: the coast is clear. */
13051 #else
13052     exit(1);    /* <db.h> not Berkeley DB? */
13053 #endif
13054 #endif
13055 }
13056 EOCP
13057         set try
13058         if eval $compile_ok && ./try; then
13059                 echo 'Looks OK.' >&4
13060         else
13061                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13062                 i_db=$undef
13063                 case " $libs " in
13064                 *"-ldb "*)
13065                         : Remove db from list of libraries to use
13066                         echo "Removing unusable -ldb from library list" >&4
13067                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13068                         shift
13069                         libs="$*"
13070                         echo "libs = $libs" >&4
13071                         ;;
13072                 esac
13073         fi
13074         $rm -f try.*
13075         ;;
13076 esac
13077
13078 case "$i_db" in
13079 define)
13080         : Check the return type needed for hash 
13081         echo " "
13082         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13083         $cat >try.c <<EOCP
13084 #$d_const HASCONST
13085 #ifndef HASCONST
13086 #define const
13087 #endif
13088 #include <sys/types.h>
13089 #include <db.h>
13090
13091 #ifndef DB_VERSION_MAJOR
13092 u_int32_t hash_cb (ptr, size)
13093 const void *ptr;
13094 size_t size;
13095 {
13096 }
13097 HASHINFO info;
13098 int main()
13099 {
13100         info.hash = hash_cb;
13101 }
13102 #endif
13103 EOCP
13104         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13105                 if $contains warning try.out >>/dev/null 2>&1 ; then
13106                         db_hashtype='int'
13107                 else
13108                         db_hashtype='u_int32_t'
13109                 fi
13110         else
13111                 : XXX Maybe we should just give up here.
13112                 db_hashtype=u_int32_t
13113                 $cat try.out >&4
13114                 echo "Help:  I can't seem to compile the db test program." >&4
13115                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13116         fi
13117         $rm -f try.*
13118         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13119         ;;
13120 *)      db_hashtype=u_int32_t
13121         ;;
13122 esac
13123 case "$i_db" in
13124 define)
13125         : Check the return type needed for prefix 
13126         echo " "
13127         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13128         cat >try.c <<EOCP
13129 #$d_const HASCONST
13130 #ifndef HASCONST
13131 #define const
13132 #endif
13133 #include <sys/types.h>
13134 #include <db.h>
13135
13136 #ifndef DB_VERSION_MAJOR
13137 size_t prefix_cb (key1, key2)
13138 const DBT *key1;
13139 const DBT *key2;
13140 {
13141 }
13142 BTREEINFO info;
13143 int main()
13144 {
13145         info.prefix = prefix_cb;
13146 }
13147 #endif
13148 EOCP
13149         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13150                 if $contains warning try.out >>/dev/null 2>&1 ; then
13151                         db_prefixtype='int'
13152                 else
13153                         db_prefixtype='size_t'
13154                 fi
13155         else
13156                 db_prefixtype='size_t'
13157                 : XXX Maybe we should just give up here.
13158                 $cat try.out >&4
13159                 echo "Help:  I can't seem to compile the db test program." >&4
13160                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13161         fi
13162         $rm -f try.*
13163         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13164         ;;
13165 *)      db_prefixtype='size_t'
13166         ;;
13167 esac
13168
13169
13170 : How can we generate normalized random numbers ?
13171 echo " "
13172 echo "Looking for a random number function..." >&4
13173 case "$randfunc" in
13174 '')
13175         if set drand48 val -f; eval $csym; $val; then
13176                 dflt="drand48"
13177                 echo "Good, found drand48()." >&4
13178         elif set random val -f; eval $csym; $val; then
13179                 dflt="random"
13180                 echo "OK, found random()." >&4
13181         else
13182                 dflt="rand"
13183                 echo "Yick, looks like I have to use rand()." >&4
13184         fi
13185         echo " "
13186         ;;
13187 *)
13188         dflt="$randfunc"
13189         ;;
13190 esac
13191 cont=true
13192
13193 case "$ccflags" in
13194 *-Dmy_rand=*|*-Dmy_srand=*)
13195         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13196         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13197         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13198         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13199         ;;
13200 esac
13201
13202 while $test "$cont"; do
13203         rp="Use which function to generate random numbers?"
13204         . ./myread
13205         if $test "$ans" = "$dflt"; then
13206                 : null
13207         else
13208                 randbits=''
13209         fi
13210         randfunc="$ans"
13211         if set $ans val -f; eval $csym; $val; then
13212                 cont=''
13213         else
13214                 dflt=y
13215                 rp="I cannot find function $ans. Use that name anyway?"
13216                 . ./myread
13217                 dflt=rand
13218                 case "$ans" in
13219                         [yY]*) cont='';;
13220                 esac
13221         fi
13222         case "$cont" in
13223         '')
13224                 case "$randfunc" in
13225                 drand48)
13226                         drand01="drand48()"
13227                         seedfunc="srand48"
13228                         randbits=48
13229                         randseedtype=long
13230                         ;;
13231                 rand|random)
13232                         case "$randbits" in
13233                         '')
13234 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13235                                 $cat >try.c <<EOCP
13236 #$i_unistd I_UNISTD
13237 #$i_stdlib I_STDLIB
13238 #include <stdio.h>
13239 #ifdef I_UNISTD
13240 #  include <unistd.h>
13241 #endif
13242 #ifdef I_STDLIB
13243 #  include <stdlib.h>
13244 #endif
13245 int main()
13246 {
13247         register int i;
13248         register unsigned long tmp;
13249         register unsigned long max = 0L;
13250
13251         for (i = 1000; i; i--) {
13252                 tmp = (unsigned long) $randfunc();
13253                 if (tmp > max) max = tmp;
13254         }
13255         for (i = 0; max; i++)
13256                 max /= 2;
13257         printf("%d\n",i);
13258 }
13259 EOCP
13260                                 set try
13261                                 if eval $compile_ok; then
13262                                         dflt=`try`
13263                                 else
13264                                         dflt='?'
13265                                         echo "(I can't seem to compile the test program...)"
13266                                 fi
13267                                 ;;
13268                         *)
13269                                 dflt="$randbits"
13270                                 ;;
13271                         esac
13272                         rp="How many bits does your $randfunc() function produce?"
13273                         . ./myread
13274                         randbits="$ans"
13275                         $rm -f try.c try
13276                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13277                         seedfunc="s$randfunc"
13278                         randseedtype=unsigned
13279                         ;;
13280                 *)
13281                         dflt="31"
13282                         rp="How many bits does your $randfunc() function produce?"
13283                         . ./myread
13284                         randbits="$ans"
13285                         seedfunc="s$randfunc"
13286                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13287                         if set $seedfunc val -f; eval $csym; $val; then
13288                                 echo "(Using $seedfunc() to seed random generator)"
13289                         else
13290                                 echo "(Warning: no $seedfunc() to seed random generator)"
13291                                 seedfunc=rand
13292                         fi
13293                         randseedtype=unsigned
13294                         ;;
13295                 esac
13296                 ;;
13297         esac
13298 done
13299
13300 echo " "
13301 echo "Determining whether or not we are on an EBCDIC system..." >&4
13302 $cat >tebcdic.c <<'EOM'
13303 int main()
13304 {
13305   if ('M'==0xd4) return 0;
13306   return 1;
13307 }
13308 EOM
13309
13310 val=$undef
13311 set tebcdic
13312 if eval $compile_ok; then
13313         if ./tebcdic; then
13314                 echo "You seem to speak EBCDIC." >&4
13315                 val="$define"
13316         else
13317                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13318         fi
13319 else
13320         echo "I'm unable to compile the test program." >&4
13321         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13322 fi
13323 $rm -f tebcdic.c tebcdic
13324 set ebcdic
13325 eval $setvar
13326
13327 echo " "
13328 $cat >&4 <<EOM
13329 Checking how to flush all pending stdio output...
13330 EOM
13331 # I only know how to find the first 32 possibly open files on SunOS.
13332 # See also hints/sunos_4_1.sh and util.c  --AD
13333 case "$osname" in
13334 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13335 esac
13336 $cat >>try.c <<EOCP
13337 #include <stdio.h>
13338 #$i_unistd I_UNISTD
13339 #ifdef I_UNISTD
13340 # include <unistd.h>
13341 #endif
13342 #$d_sysconf HAS_SYSCONF
13343 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13344 #ifdef HAS_STDIO_STREAM_ARRAY
13345 # define STDIO_STREAM_ARRAY $stdio_stream_array
13346 #endif
13347 int main() {
13348   FILE* p = fopen("try.out", "w");
13349 #ifdef TRY_FPUTC
13350   fputc('x', p);
13351 #else
13352 # ifdef TRY_FPRINTF
13353   fprintf(p, "x");
13354 # endif
13355 #endif
13356 #ifdef TRY_FFLUSH_NULL
13357   fflush(NULL);
13358 #endif
13359 #ifdef TRY_FFLUSH_ALL
13360   {
13361     long open_max = -1;
13362 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13363     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13364 # else
13365 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13366     open_max = sysconf(_SC_OPEN_MAX);
13367 #  else
13368 #   ifdef FOPEN_MAX
13369     open_max = FOPEN_MAX;
13370 #   else
13371 #    ifdef OPEN_MAX
13372     open_max = OPEN_MAX;
13373 #    else
13374 #     ifdef _NFILE
13375     open_max = _NFILE;
13376 #     endif
13377 #    endif
13378 #   endif
13379 #  endif
13380 # endif 
13381 # ifdef HAS_STDIO_STREAM_ARRAY
13382     if (open_max > 0) {
13383       long i;
13384       for (i = 0; i < open_max; i++)
13385             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13386                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13387                 STDIO_STREAM_ARRAY[i]._flag)
13388                 fflush(&STDIO_STREAM_ARRAY[i]);
13389     }   
13390   }
13391 # endif
13392 #endif
13393   _exit(42);
13394 }
13395 EOCP
13396 : first we have to find out how _not_ to flush
13397 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13398     output=''
13399     set try -DTRY_FPUTC
13400     if eval $compile; then
13401             $rm -f try.out
13402             ./try$exe_ext 2>/dev/null
13403             if $test ! -s try.out -a "X$?" = X42; then
13404                 output=-DTRY_FPUTC
13405             fi
13406     fi
13407     case "$output" in
13408     '')
13409             set try -DTRY_FPRINTF
13410             $rm -f try.out
13411             if eval $compile; then
13412                     $rm -f try.out
13413                     ./try$exe_ext 2>/dev/null
13414                     if $test ! -s try.out -a "X$?" = X42; then
13415                         output=-DTRY_FPRINTF
13416                     fi
13417             fi
13418         ;;
13419     esac
13420 fi
13421 : check for fflush NULL behaviour
13422 case "$fflushNULL" in
13423 '')     set try -DTRY_FFLUSH_NULL $output
13424         if eval $compile; then
13425                 $rm -f try.out
13426                 ./try$exe_ext 2>/dev/null
13427                 code="$?"
13428                 if $test -s try.out -a "X$code" = X42; then
13429                         fflushNULL="`$cat try.out`"
13430                 else
13431                         if $test "X$code" != X42; then
13432                                 $cat >&4 <<EOM
13433 (If this test failed, don't worry, we'll try another method shortly.)
13434 EOM
13435                         fi
13436                 fi
13437         fi
13438         $rm -f core try.core core.try.*
13439         case "$fflushNULL" in
13440         x)      $cat >&4 <<EOM
13441 Your fflush(NULL) works okay for output streams.
13442 Let's see if it clobbers input pipes...
13443 EOM
13444 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13445 # bug that improperly flushes the input end of pipes.  So we avoid the
13446 # autoflush on fork/system/exec support for now. :-(
13447 $cat >tryp.c <<EOCP
13448 #include <stdio.h>
13449 int
13450 main(int argc, char **argv)
13451 {
13452     char buf[1024];
13453     int i;
13454     char *bp = buf;
13455     while (1) {
13456         while ((i = getc(stdin)) != -1
13457                && (*bp++ = i) != '\n'
13458                && bp < &buf[1024])
13459         /* DO NOTHING */ ;
13460         *bp = '\0';
13461         fprintf(stdout, "%s", buf);
13462         fflush(NULL);
13463         if (i == -1)
13464             return 0;
13465         bp = buf;
13466     }
13467 }
13468 EOCP
13469                 fflushNULL="$define"
13470                 set tryp
13471                 if eval $compile; then
13472                     $rm -f tryp.out
13473                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13474                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13475                        $cat >&4 <<EOM
13476 fflush(NULL) seems to behave okay with input streams.
13477 EOM
13478                         fflushNULL="$define"
13479                     else
13480                         $cat >&4 <<EOM
13481 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13482 EOM
13483                         fflushNULL="$undef"
13484                     fi
13485                 fi
13486                 $rm -f core tryp.c tryp.core core.tryp.*
13487                 ;;
13488         '')     $cat >&4 <<EOM
13489 Your fflush(NULL) isn't working (contrary to ANSI C).
13490 EOM
13491                 fflushNULL="$undef"
13492                 ;;
13493         *)      $cat >&4 <<EOM
13494 Cannot figure out whether your fflush(NULL) works or not.
13495 I'm assuming it doesn't (contrary to ANSI C).
13496 EOM
13497                 fflushNULL="$undef"
13498                 ;;
13499         esac
13500         ;;
13501 $define|true|[yY]*)
13502         fflushNULL="$define"
13503         ;;
13504 *)
13505         fflushNULL="$undef"
13506         ;;
13507 esac
13508 : check explicit looping only if NULL did not work, and if the pipe
13509 : bug does not show up on an explicit flush too
13510 case "$fflushNULL" in
13511 "$undef")
13512         $cat >tryp.c <<EOCP
13513 #include <stdio.h>
13514 int
13515 main(int argc, char **argv)
13516 {
13517     char buf[1024];
13518     int i;
13519     char *bp = buf;
13520     while (1) {
13521         while ((i = getc(stdin)) != -1
13522                && (*bp++ = i) != '\n'
13523                && bp < &buf[1024])
13524         /* DO NOTHING */ ;
13525         *bp = '\0';
13526         fprintf(stdout, "%s", buf);
13527         fflush(stdin);
13528         if (i == -1)
13529             return 0;
13530         bp = buf;
13531     }
13532 }
13533 EOCP
13534         set tryp
13535         if eval $compile; then
13536             $rm -f tryp.out
13537             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13538             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13539                $cat >&4 <<EOM
13540 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13541 EOM
13542                 : now check for fflushall behaviour
13543                 case "$fflushall" in
13544                 '')     set try -DTRY_FFLUSH_ALL $output
13545                         if eval $compile; then
13546                                 $cat >&4 <<EOM
13547 (Now testing the other method--but note that this also may fail.)
13548 EOM
13549                                 $rm -f try.out
13550                                 ./try$exe_ext 2>/dev/null
13551                                 if $test -s try.out -a "X$?" = X42; then
13552                                         fflushall="`$cat try.out`"
13553                                 fi
13554                         fi
13555                         $rm -f core try.core core.try.*
13556                         case "$fflushall" in
13557                         x)      $cat >&4 <<EOM
13558 Whew. Flushing explicitly all the stdio streams works.
13559 EOM
13560                                 fflushall="$define"
13561                                 ;;
13562                         '')     $cat >&4 <<EOM
13563 Sigh. Flushing explicitly all the stdio streams doesn't work.
13564 EOM
13565                                 fflushall="$undef"
13566                                 ;;
13567                         *)      $cat >&4 <<EOM
13568 Cannot figure out whether flushing stdio streams explicitly works or not.
13569 I'm assuming it doesn't.
13570 EOM
13571                                 fflushall="$undef"
13572                                 ;;
13573                         esac
13574                         ;;
13575                 "$define"|true|[yY]*)
13576                         fflushall="$define"
13577                         ;;
13578                 *)
13579                         fflushall="$undef"
13580                         ;;
13581                 esac
13582             else
13583                 $cat >&4 <<EOM
13584 All is futile.  Even fflush(stdin) clobbers input pipes!
13585 EOM
13586                 fflushall="$undef"
13587             fi
13588         else
13589             fflushall="$undef"
13590         fi
13591         $rm -f core tryp.c tryp.core core.tryp.*
13592         ;;
13593 *)      fflushall="$undef"
13594         ;;
13595 esac
13596
13597 case "$fflushNULL$fflushall" in
13598 undefundef)
13599         $cat <<EOM
13600 OK, I give up.  I cannot figure out how to flush pending stdio output.
13601 We won't be flushing handles at all before fork/exec/popen.
13602 EOM
13603         ;;
13604 esac
13605 $rm -f try.* try$exe_ext
13606
13607 : Store the full pathname to the ar program for use in the C program
13608 : Respect a hint or command line value for full_ar.
13609 case "$full_ar" in
13610 '') full_ar=$ar ;;
13611 esac
13612
13613 : Store the full pathname to the sed program for use in the C program
13614 full_sed=$sed
13615
13616 : see what type gids are declared as in the kernel
13617 echo " "
13618 echo "Looking for the type for group ids returned by getgid()."
13619 set gid_t gidtype xxx stdio.h sys/types.h
13620 eval $typedef
13621 case "$gidtype" in
13622 xxx)
13623         xxx=`./findhdr sys/user.h`
13624         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13625         case $1 in
13626         unsigned) dflt="$1 $2" ;;
13627         *) dflt="$1" ;;
13628         esac
13629         ;;
13630 *) dflt="$gidtype";;
13631 esac
13632 case "$gidtype" in
13633 gid_t) echo "gid_t found." ;;
13634 *)      rp="What is the type for group ids returned by getgid()?"
13635         . ./myread
13636         gidtype="$ans"
13637         ;;
13638 esac
13639
13640 echo " "
13641 case "$gidtype" in
13642 *_t) zzz="$gidtype"     ;;
13643 *)   zzz="gid"          ;;
13644 esac
13645 echo "Checking the size of $zzz..." >&4 
13646 cat > try.c <<EOCP
13647 #include <sys/types.h>
13648 #include <stdio.h>
13649 int main() {
13650     printf("%d\n", (int)sizeof($gidtype));
13651     exit(0);
13652 }
13653 EOCP
13654 set try
13655 if eval $compile_ok; then
13656         yyy=`./try`
13657         case "$yyy" in
13658         '')     gidsize=4
13659                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13660                 ;;
13661         *)      gidsize=$yyy
13662                 echo "Your $zzz is $gidsize bytes long."
13663                 ;;
13664         esac
13665 else
13666         gidsize=4
13667         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13668 fi
13669
13670
13671 echo " "
13672 case "$gidtype" in
13673 *_t) zzz="$gidtype"     ;;
13674 *)   zzz="gid"          ;;
13675 esac
13676 echo "Checking the sign of $zzz..." >&4 
13677 cat > try.c <<EOCP
13678 #include <sys/types.h>
13679 #include <stdio.h>
13680 int main() {
13681         $gidtype foo = -1;
13682         if (foo < 0)
13683                 printf("-1\n");
13684         else
13685                 printf("1\n");
13686 }
13687 EOCP
13688 set try
13689 if eval $compile; then
13690         yyy=`./try`
13691         case "$yyy" in
13692         '')     gidsign=1
13693                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13694                 ;;
13695         *)      gidsign=$yyy
13696                 case "$gidsign" in
13697                  1) echo "Your $zzz is unsigned." ;;
13698                 -1) echo "Your $zzz is signed."   ;;
13699                 esac
13700                 ;;
13701         esac
13702 else
13703         gidsign=1
13704         echo "(I can't compile the test program--guessing unsigned.)" >&4
13705 fi
13706
13707
13708 echo " "
13709
13710 if $test X"$quadtype" != X; then
13711
13712 echo "Checking how to print 64-bit integers..." >&4
13713
13714 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13715         $cat >try.c <<'EOCP'
13716 #include <sys/types.h>
13717 #include <stdio.h>
13718 int main() {
13719   int q = 12345678901;
13720   printf("%ld\n", q);
13721 }
13722 EOCP
13723         set try
13724         if eval $compile; then
13725                 yyy=`./try$exe_ext`
13726                 case "$yyy" in
13727                 12345678901)
13728                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13729                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13730                         echo "We will use %d."
13731                         ;;
13732                 esac
13733         fi
13734 fi
13735
13736 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13737         $cat >try.c <<'EOCP'
13738 #include <sys/types.h>
13739 #include <stdio.h>
13740 int main() {
13741   long q = 12345678901;
13742   printf("%ld\n", q);
13743 }
13744 EOCP
13745         set try
13746         if eval $compile; then
13747                 yyy=`./try$exe_ext`
13748                 case "$yyy" in
13749                 12345678901)
13750                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13751                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13752                         echo "We will use %ld."
13753                         ;;
13754                 esac
13755         fi
13756 fi
13757
13758 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13759         $cat >try.c <<'EOCP'
13760 #include <sys/types.h>
13761 #include <inttypes.h>
13762 #include <stdio.h>
13763 int main() {
13764   int64_t q = 12345678901;
13765   printf("%" PRId64 "\n", q);
13766 }
13767 EOCP
13768         set try
13769         if eval $compile; then
13770                 yyy=`./try$exe_ext`
13771                 case "$yyy" in
13772                 12345678901)
13773                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13774                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13775                         echo "We will use the C9X style."
13776                         ;;
13777                 esac
13778         fi
13779 fi
13780
13781 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13782         $cat >try.c <<'EOCP'
13783 #include <sys/types.h>
13784 #include <stdio.h>
13785 int main() {
13786   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13787   printf("%lld\n", q);
13788 }
13789 EOCP
13790         set try
13791         if eval $compile; then
13792                 yyy=`./try$exe_ext`
13793                 case "$yyy" in
13794                 12345678901)
13795                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13796                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13797                         echo "We will use the %lld style."
13798                         ;;
13799                 esac
13800         fi
13801 fi
13802
13803 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13804         $cat >try.c <<EOCP
13805 #include <sys/types.h>
13806 #include <stdio.h>
13807 int main() {
13808   $quadtype q = 12345678901;
13809   printf("%Ld\n", q);
13810 }
13811 EOCP
13812         set try
13813         if eval $compile; then
13814                 yyy=`./try$exe_ext`
13815                 case "$yyy" in
13816                 12345678901)
13817                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13818                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13819                         echo "We will use %Ld."
13820                         ;;
13821                 esac
13822         fi
13823 fi
13824
13825 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13826         $cat >try.c <<EOCP
13827 #include <sys/types.h>
13828 #include <stdio.h>
13829 int main() {
13830   $quadtype q = 12345678901;
13831   printf("%qd\n", q);
13832 }
13833 EOCP
13834         set try
13835         if eval $compile; then
13836                 yyy=`./try$exe_ext`
13837                 case "$yyy" in
13838                 12345678901)
13839                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13840                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13841                         echo "We will use %qd."
13842                         ;;
13843                 esac
13844         fi
13845 fi
13846
13847 if $test X"$sPRId64" = X; then
13848         echo "Cannot figure out how to print 64-bit integers." >&4
13849 fi
13850
13851 $rm -f try try.*
13852
13853 fi
13854
13855 case "$sPRId64" in
13856 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13857         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13858         ;;
13859 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13860         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13861         ;;
13862 esac
13863
13864
13865 echo " "
13866 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13867
13868 if $test X"$ivsize" = X8; then
13869         ivdformat="$sPRId64"
13870         uvuformat="$sPRIu64"
13871         uvoformat="$sPRIo64"
13872         uvxformat="$sPRIx64"
13873         uvXUformat="$sPRIXU64"
13874 else
13875         if $test X"$ivsize" = X"$longsize"; then
13876                 ivdformat='"ld"'
13877                 uvuformat='"lu"'
13878                 uvoformat='"lo"'
13879                 uvxformat='"lx"'
13880                 uvXUformat='"lX"'
13881         else
13882                 if $test X"$ivsize" = X"$intsize"; then
13883                         ivdformat='"d"'
13884                         uvuformat='"u"'
13885                         uvoformat='"o"'
13886                         uvxformat='"x"'
13887                         uvXUformat='"X"'
13888                 else
13889                         : far out
13890                         if $test X"$ivsize" = X"$shortsize"; then
13891                                 ivdformat='"hd"'
13892                                 uvuformat='"hu"'
13893                                 uvoformat='"ho"'
13894                                 uvxformat='"hx"'
13895                                 uvXUformat='"hX"'
13896                         fi
13897                 fi
13898         fi
13899 fi
13900
13901 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13902         nveformat="$sPRIeldbl"
13903         nvfformat="$sPRIfldbl"
13904         nvgformat="$sPRIgldbl"
13905         nvEUformat="$sPRIEUldbl"
13906         nvFUformat="$sPRIFUldbl"
13907         nvGUformat="$sPRIGUldbl"
13908 else
13909         nveformat='"e"'
13910         nvfformat='"f"'
13911         nvgformat='"g"'
13912         nvEUformat='"E"'
13913         nvFUformat='"F"'
13914         nvGUformat='"G"'
13915 fi
13916
13917 case "$ivdformat" in
13918 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13919     exit 1
13920     ;;
13921 esac
13922
13923
13924 echo " "
13925 $echo "Checking the format string to be used for gids..." >&4
13926
13927 case "$gidsign" in
13928 -1)     if $test X"$gidsize" = X"$ivsize"; then
13929                 gidformat="$ivdformat"
13930         else
13931                 if $test X"$gidsize" = X"$longsize"; then
13932                         gidformat='"ld"'
13933                 else
13934                         if $test X"$gidsize" = X"$intsize"; then
13935                                 gidformat='"d"'
13936                         else
13937                                 if $test X"$gidsize" = X"$shortsize"; then
13938                                         gidformat='"hd"'
13939                                 fi
13940                         fi
13941                 fi
13942         fi
13943         ;;
13944 *)      if $test X"$gidsize" = X"$uvsize"; then
13945                 gidformat="$uvuformat"
13946         else
13947                 if $test X"$gidsize" = X"$longsize"; then
13948                         gidformat='"lu"'
13949                 else
13950                         if $test X"$gidsize" = X"$intsize"; then
13951                                 gidformat='"u"'
13952                         else
13953                                 if $test X"$gidsize" = X"$shortsize"; then
13954                                         gidformat='"hu"'
13955                                 fi
13956                         fi
13957                 fi
13958         fi
13959         ;;
13960 esac
13961
13962 : see if getgroups exists
13963 set getgroups d_getgrps
13964 eval $inlibc
13965
13966 : see if setgroups exists
13967 set setgroups d_setgrps
13968 eval $inlibc
13969
13970
13971 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13972 echo " "
13973 case "$d_getgrps$d_setgrps" in
13974 *define*)
13975         case "$groupstype" in
13976         '') dflt="$gidtype" ;;
13977         *)  dflt="$groupstype" ;;
13978         esac
13979         $cat <<EOM
13980 What type of pointer is the second argument to getgroups() and setgroups()?
13981 Usually this is the same as group ids, $gidtype, but not always.
13982
13983 EOM
13984         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13985         . ./myread
13986         groupstype="$ans"
13987         ;;
13988 *)  groupstype="$gidtype";;
13989 esac
13990
13991 echo " "
13992 echo "Checking if your $make program sets \$(MAKE)..." >&4
13993 case "$make_set_make" in
13994 '')
13995         $sed 's/^X //' > testmake.mak << 'EOF'
13996 Xall:
13997 X       @echo 'maketemp="$(MAKE)"'
13998 EOF
13999         case "`$make -f testmake.mak 2>/dev/null`" in
14000         *maketemp=*) make_set_make='#' ;;
14001         *)      make_set_make="MAKE=$make" ;;
14002         esac
14003         $rm -f testmake.mak
14004         ;;
14005 esac
14006 case "$make_set_make" in
14007 '#') echo "Yup, it does.";;
14008 *) echo "Nope, it doesn't.";;
14009 esac
14010
14011 : see what type is used for mode_t
14012 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14013 set mode_t modetype int stdio.h sys/types.h
14014 eval $typedef_ask
14015
14016 : see if stdarg is available
14017 echo " "
14018 if $test `./findhdr stdarg.h`; then
14019         echo "<stdarg.h> found." >&4
14020         valstd="$define"
14021 else
14022         echo "<stdarg.h> NOT found." >&4
14023         valstd="$undef"
14024 fi
14025
14026 : see if varags is available
14027 echo " "
14028 if $test `./findhdr varargs.h`; then
14029         echo "<varargs.h> found." >&4
14030 else
14031         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14032 fi
14033
14034 : set up the varargs testing programs
14035 $cat > varargs.c <<EOP
14036 #ifdef I_STDARG
14037 #include <stdarg.h>
14038 #endif
14039 #ifdef I_VARARGS
14040 #include <varargs.h>
14041 #endif
14042
14043 #ifdef I_STDARG
14044 int f(char *p, ...)
14045 #else
14046 int f(va_alist)
14047 va_dcl
14048 #endif
14049 {
14050         va_list ap;
14051 #ifndef I_STDARG
14052         char *p;
14053 #endif
14054 #ifdef I_STDARG
14055         va_start(ap,p);
14056 #else
14057         va_start(ap);
14058         p = va_arg(ap, char *);
14059 #endif
14060         va_end(ap);
14061 }
14062 EOP
14063 $cat > varargs <<EOP
14064 $startsh
14065 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14066         echo "true"
14067 else
14068         echo "false"
14069 fi
14070 $rm -f varargs$_o
14071 EOP
14072 chmod +x varargs
14073
14074 : now check which varargs header should be included
14075 echo " "
14076 i_varhdr=''
14077 case "$valstd" in
14078 "$define")
14079         if `./varargs I_STDARG`; then
14080                 val='stdarg.h'
14081         elif `./varargs I_VARARGS`; then
14082                 val='varargs.h'
14083         fi
14084         ;;
14085 *)
14086         if `./varargs I_VARARGS`; then
14087                 val='varargs.h'
14088         fi
14089         ;;
14090 esac
14091 case "$val" in
14092 '')
14093 echo "I could not find the definition for va_dcl... You have problems..." >&4
14094         val="$undef"; set i_stdarg; eval $setvar
14095         val="$undef"; set i_varargs; eval $setvar
14096         ;;
14097 *) 
14098         set i_varhdr
14099         eval $setvar
14100         case "$i_varhdr" in
14101         stdarg.h)
14102                 val="$define"; set i_stdarg; eval $setvar
14103                 val="$undef"; set i_varargs; eval $setvar
14104                 ;;
14105         varargs.h)
14106                 val="$undef"; set i_stdarg; eval $setvar
14107                 val="$define"; set i_varargs; eval $setvar
14108                 ;;
14109         esac
14110         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14111 esac
14112 $rm -f varargs*
14113
14114 : see if we need va_copy
14115 echo " "
14116 case "$i_stdarg" in
14117 "$define")
14118         $cat >try.c <<EOCP
14119 #include <stdarg.h>
14120 #include <stdio.h>
14121 #$i_stdlib I_STDLIB
14122 #ifdef I_STDLIB
14123 #include <stdlib.h>
14124 #endif
14125 #include <signal.h>
14126
14127 int
14128 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14129 {
14130   return vfprintf(f, fmt, *valp);
14131 }
14132  
14133 int    
14134 myvfprintf(FILE *f, const  char *fmt, va_list val)
14135 {
14136   return ivfprintf(f, fmt, &val);
14137 }
14138       
14139 int
14140 myprintf(char *fmt, ...) 
14141 {
14142   va_list val;
14143   va_start(val, fmt);
14144   return myvfprintf(stdout, fmt, val); 
14145 }         
14146
14147 int
14148 main(int ac, char **av)
14149 {
14150   signal(SIGSEGV, exit);
14151
14152   myprintf("%s%cs all right, then\n", "that", '\'');                            
14153   exit(0);      
14154 }
14155 EOCP
14156         set try
14157         if eval $compile && ./try 2>&1 >/dev/null; then
14158                 case "`./try`" in
14159                 "that's all right, then")
14160                         okay=yes
14161                         ;;
14162                 esac
14163         fi
14164         case "$okay" in
14165         yes)    echo "It seems that you don't need va_copy()." >&4
14166                 need_va_copy="$undef"
14167                 ;;
14168         *)      echo "It seems that va_copy() or similar will be needed." >&4
14169                 need_va_copy="$define"
14170                 ;;
14171         esac
14172         $rm -f try.* core core.* *.core *.core.*
14173         ;;
14174 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14175         ;;
14176 esac
14177
14178 : define a fucntion to check prototypes
14179 $cat > protochk <<EOSH
14180 $startsh
14181 cc="$cc"
14182 optimize="$optimize"
14183 ccflags="$ccflags"
14184 prototype="$prototype"
14185 define="$define"
14186 rm=$rm
14187 EOSH
14188
14189 $cat >> protochk <<'EOSH'
14190
14191 $rm -f try.c
14192 foo="$1"
14193 shift
14194 while test $# -ge 2; do
14195         case "$1" in
14196                 $define) echo "#include <$2>" >> try.c ;;
14197                 literal) echo "$2" >> try.c ;;
14198         esac
14199     shift 2
14200 done
14201 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14202 cat >> try.c <<'EOCP'
14203 #ifdef CAN_PROTOTYPE
14204 #define _(args) args
14205 #else
14206 #define _(args) ()
14207 #endif
14208 EOCP
14209 echo "$foo" >> try.c
14210 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14211 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14212 status=$?
14213 $rm -f try.[co]
14214 exit $status
14215 EOSH
14216 chmod +x protochk
14217 $eunicefix protochk
14218
14219 : see what type is used for size_t
14220 rp="What is the type used for the length parameter for string functions?"
14221 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14222 eval $typedef_ask
14223
14224 : check for type of arguments to gethostbyaddr. 
14225 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14226         case "$d_gethbyaddr" in
14227         $define)
14228                 $cat <<EOM
14229
14230 Checking to see what type of arguments are accepted by gethostbyaddr().
14231 EOM
14232                 hdrs="$define sys/types.h
14233                         $d_socket sys/socket.h 
14234                         $i_niin netinet/in.h 
14235                         $i_netdb netdb.h
14236                         $i_unistd unistd.h"
14237                 : The first arg can 'char *' or 'void *'
14238                 : The second arg is some of integral type
14239                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14240                         for yyy in size_t long int; do
14241                                 case "$netdb_host_type" in
14242                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14243                                         if ./protochk "$try" $hdrs; then
14244                                                 echo "Your system accepts $xxx for the first arg."
14245                                                 echo "...and $yyy for the second arg."
14246                                                 netdb_host_type="$xxx"
14247                                                 netdb_hlen_type="$yyy"
14248                                         fi
14249                                         ;;
14250                                 esac
14251                         done
14252                 done
14253                 : In case none of those worked, prompt the user.
14254                 case "$netdb_host_type" in
14255                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14256                         dflt='char *'
14257                         . ./myread
14258                         netdb_host_type=$ans
14259                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14260                         dflt="$sizetype"
14261                         . ./myread
14262                         netdb_hlen_type=$ans
14263                         ;;
14264                 esac
14265                 ;;
14266         *)      : no gethostbyaddr, so pick harmless defaults
14267                 netdb_host_type='char *'
14268                 netdb_hlen_type="$sizetype"
14269                 ;;
14270         esac
14271         # Remove the "const" if needed. -- but then we'll have a 
14272         # prototype clash!
14273         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14274 fi
14275
14276 : check for type of argument to gethostbyname. 
14277 if test "X$netdb_name_type" = X ; then
14278         case "$d_gethbyname" in
14279         $define)
14280                 $cat <<EOM
14281
14282 Checking to see what type of argument is accepted by gethostbyname().
14283 EOM
14284                 hdrs="$define sys/types.h
14285                         $d_socket sys/socket.h 
14286                         $i_niin netinet/in.h 
14287                         $i_netdb netdb.h
14288                         $i_unistd unistd.h"
14289                 for xxx in "const char *" "char *"; do
14290                         case "$netdb_name_type" in
14291                         '')     try="extern struct hostent *gethostbyname($xxx);"
14292                                 if ./protochk "$try" $hdrs; then
14293                                         echo "Your system accepts $xxx."
14294                                         netdb_name_type="$xxx"
14295                                 fi
14296                                 ;;
14297                         esac
14298                 done
14299                 : In case none of those worked, prompt the user.
14300                 case "$netdb_name_type" in
14301                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14302                         dflt='char *'
14303                         . ./myread
14304                         netdb_name_type=$ans
14305                         ;;
14306                 esac
14307                 ;;
14308         *)      : no gethostbyname, so pick harmless default
14309                 netdb_name_type='char *'
14310                 ;;
14311         esac
14312 fi
14313
14314 : check for type of 1st argument to getnetbyaddr. 
14315 if test "X$netdb_net_type" = X ; then
14316         case "$d_getnbyaddr" in
14317         $define)
14318                 $cat <<EOM
14319
14320 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14321 EOM
14322                 hdrs="$define sys/types.h
14323                         $d_socket sys/socket.h 
14324                         $i_niin netinet/in.h 
14325                         $i_netdb netdb.h
14326                         $i_unistd unistd.h"
14327                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14328                         case "$netdb_net_type" in
14329                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14330                                 if ./protochk "$try" $hdrs; then
14331                                         echo "Your system accepts $xxx."
14332                                         netdb_net_type="$xxx"
14333                                 fi
14334                                 ;;
14335                         esac
14336                 done
14337                 : In case none of those worked, prompt the user.
14338                 case "$netdb_net_type" in
14339                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14340                         dflt='long'
14341                         . ./myread
14342                         netdb_net_type=$ans
14343                         ;;
14344                 esac
14345                 ;;
14346         *)      : no getnetbyaddr, so pick harmless default
14347                 netdb_net_type='long'
14348                 ;;
14349         esac
14350 fi
14351 : locate the preferred pager for this system
14352 case "$pager" in
14353 '')
14354         dflt=''
14355         case "$pg" in
14356         /*) dflt=$pg;;
14357         [a-zA-Z]:/*) dflt=$pg;;
14358         esac
14359         case "$more" in
14360         /*) dflt=$more;;
14361         [a-zA-Z]:/*) dflt=$more;;
14362         esac
14363         case "$less" in
14364         /*) dflt=$less;;
14365         [a-zA-Z]:/*) dflt=$less;;
14366         esac
14367         case "$dflt" in
14368         '') dflt=/usr/ucb/more;;
14369         esac
14370         ;;
14371 *) dflt="$pager";;
14372 esac
14373 echo " "
14374 fn=f/
14375 rp='What pager is used on your system?'
14376 . ./getfile
14377 pager="$ans"
14378
14379 : see what type pids are declared as in the kernel
14380 rp="What is the type of process ids on this system?"
14381 set pid_t pidtype int stdio.h sys/types.h
14382 eval $typedef_ask
14383
14384 : Find earliest binary compatible site_perl subdirectory perl can use.
14385 case "$bincompat5005" in
14386 "$define") xs_apiversion='5.005' ;;
14387 *) xs_apiversion=$version ;;   # The current site_perl version.
14388 esac
14389 : Find earliest pure perl site_perl subdirectory perl can use.
14390 : The versioned directories started at 5.005.
14391 pm_apiversion='5.005'
14392
14393 : see if ar generates random libraries by itself
14394 echo " "
14395 echo "Checking how to generate random libraries on your machine..." >&4
14396 echo 'int bar1() { return bar2(); }' > bar1.c
14397 echo 'int bar2() { return 2; }' > bar2.c
14398 $cat > foo.c <<'EOP'
14399 int main() { printf("%d\n", bar1()); exit(0); }
14400 EOP
14401 $cc $ccflags -c bar1.c >/dev/null 2>&1
14402 $cc $ccflags -c bar2.c >/dev/null 2>&1
14403 $cc $ccflags -c foo.c >/dev/null 2>&1
14404 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14405 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14406         ./foobar >/dev/null 2>&1; then
14407         echo "$ar appears to generate random libraries itself."
14408         orderlib=false
14409         ranlib=":"
14410 elif $ar ts bar$_a >/dev/null 2>&1 &&
14411         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14412         ./foobar >/dev/null 2>&1; then
14413                 echo "a table of contents needs to be added with '$ar ts'."
14414                 orderlib=false
14415                 ranlib="$ar ts"
14416 else
14417         case "$ranlib" in
14418         :) ranlib='';;
14419         '')
14420                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14421                 $test -f $ranlib || ranlib=''
14422                 ;;
14423         esac
14424         if $test -n "$ranlib"; then
14425                 echo "your system has '$ranlib'; we'll use that."
14426                 orderlib=false
14427         else
14428                 echo "your system doesn't seem to support random libraries"
14429                 echo "so we'll use lorder and tsort to order the libraries."
14430                 orderlib=true
14431                 ranlib=":"
14432         fi
14433 fi
14434 $rm -f foo* bar* 
14435
14436 : check for type of arguments to select. 
14437 case "$selecttype" in
14438 '') case "$d_select" in
14439         $define)
14440                 echo " "
14441                 $cat <<EOM
14442 Checking to see what type of arguments are accepted by select().
14443 EOM
14444                 hdrs="$define sys/types.h
14445                         $i_systime sys/time.h 
14446                         $i_sysselct sys/select.h
14447                         $d_socket sys/socket.h"
14448                 : The first arg can be int, unsigned, or size_t
14449                 : The last arg may or may not be 'const'
14450                 val=''
14451                 : void pointer has been seen but using that
14452                 : breaks the selectminbits test
14453                 for xxx in 'fd_set *' 'int *'; do
14454                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14455                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14456                                         case "$val" in
14457                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14458                                                 if ./protochk "$try" $hdrs; then
14459                                                         echo "Your system accepts $xxx."
14460                                                         val="$xxx"
14461                                                 fi
14462                                                 ;;
14463                                         esac
14464                                 done
14465                         done
14466                 done
14467                 case "$val" in
14468                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14469                         case "$d_fd_set" in
14470                                 $define) dflt="fd_set *" ;;
14471                                 *)              dflt="int *" ;;
14472                         esac
14473                         . ./myread
14474                         val=$ans
14475                         ;;
14476                 esac
14477                 selecttype="$val"
14478                 ;;
14479         *)      : no select, so pick a harmless default
14480                 selecttype='int *'
14481                 ;;
14482         esac
14483         ;;
14484 esac
14485
14486 : check for the select 'width'
14487 case "$selectminbits" in
14488 '') case "$d_select" in
14489         $define)
14490                 $cat <<EOM
14491
14492 Checking to see on how many bits at a time your select() operates...
14493 EOM
14494                 $cat >try.c <<EOCP
14495 #include <sys/types.h>
14496 #$i_time I_TIME
14497 #$i_systime I_SYS_TIME
14498 #$i_systimek I_SYS_TIME_KERNEL
14499 #ifdef I_TIME
14500 #   include <time.h>
14501 #endif
14502 #ifdef I_SYS_TIME
14503 #   ifdef I_SYS_TIME_KERNEL
14504 #       define KERNEL
14505 #   endif
14506 #   include <sys/time.h>
14507 #   ifdef I_SYS_TIME_KERNEL
14508 #       undef KERNEL
14509 #   endif
14510 #endif
14511 #$i_sysselct I_SYS_SELECT
14512 #ifdef I_SYS_SELECT
14513 #include <sys/select.h>
14514 #endif
14515 #$d_socket HAS_SOCKET
14516 #ifdef HAS_SOCKET
14517 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14518 #endif
14519 #include <stdio.h>
14520 $selecttype b;
14521 #define S sizeof(*(b))
14522 #define MINBITS 64
14523 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14524 #define NBITS  (NBYTES * 8)
14525 int main() {
14526     char s[NBYTES];
14527     struct timeval t;
14528     int i;
14529     FILE* fp;
14530     int fd;
14531
14532     fclose(stdin);
14533     fp = fopen("try.c", "r");
14534     if (fp == 0)
14535       exit(1);
14536     fd = fileno(fp);
14537     if (fd < 0)
14538       exit(2);
14539     b = ($selecttype)s;
14540     for (i = 0; i < NBITS; i++)
14541         FD_SET(i, b);
14542     t.tv_sec  = 0;
14543     t.tv_usec = 0;
14544     select(fd + 1, b, 0, 0, &t);
14545     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14546     printf("%d\n", i + 1);
14547     return 0;
14548 }
14549 EOCP
14550                 set try
14551                 if eval $compile_ok; then
14552                         selectminbits=`./try`
14553                         case "$selectminbits" in
14554                         '')     cat >&4 <<EOM
14555 Cannot figure out on how many bits at a time your select() operates.
14556 I'll play safe and guess it is 32 bits.
14557 EOM
14558                                 selectminbits=32
14559                                 bits="32 bits"
14560                                 ;;
14561                         1)      bits="1 bit" ;;
14562                         *)      bits="$selectminbits bits" ;;
14563                         esac
14564                         echo "Your select() operates on $bits at a time." >&4
14565                 else
14566                         rp='What is the minimum number of bits your select() operates on?'
14567                         case "$byteorder" in
14568                         1234|12345678)  dflt=32 ;;
14569                         *)              dflt=1  ;;
14570                         esac
14571                         . ./myread
14572                         val=$ans
14573                         selectminbits="$val"
14574                 fi
14575                 $rm -f try.* try
14576                 ;;
14577         *)      : no select, so pick a harmless default
14578                 selectminbits='32'
14579                 ;;
14580         esac
14581         ;;
14582 esac
14583
14584 : Trace out the files included by signal.h, then look for SIGxxx names.
14585 : Remove SIGARRAYSIZE used by HPUX.
14586 : Remove SIGSTKSIZE used by Linux.
14587 : Remove SIGSTKSZ used by Posix.
14588 : Remove SIGTYP void lines used by OS2.
14589 : Some cpps, like os390, dont give the file name anywhere
14590 if [ "X$fieldn" = X ]; then
14591         : Just make some guesses.  We check them later.
14592         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14593 else
14594         xxx=`echo '#include <signal.h>' |
14595         $cppstdin $cppminus $cppflags 2>/dev/null |
14596         $grep '^[       ]*#.*include' | 
14597         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14598 fi
14599 : Check this list of files to be sure we have parsed the cpp output ok.
14600 : This will also avoid potentially non-existent files, such 
14601 : as ../foo/bar.h
14602 xxxfiles=''
14603 for xx in $xxx /dev/null ; do
14604         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14605 done
14606 : If we have found no files, at least try signal.h
14607 case "$xxxfiles" in
14608 '')     xxxfiles=`./findhdr signal.h` ;;
14609 esac
14610 xxx=`awk '
14611 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14612         print substr($2, 4, 20)
14613 }
14614 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14615         print substr($3, 4, 20)
14616 }' $xxxfiles`
14617 : Append some common names just in case the awk scan failed.
14618 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14619 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14620 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14621 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14622 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14623
14624 : generate a few handy files for later
14625 $cat > signal.c <<'EOCP'
14626 #include <sys/types.h>
14627 #include <signal.h>
14628 #include <stdio.h>
14629 int main() {
14630
14631 /* Strange style to avoid deeply-nested #if/#else/#endif */
14632 #ifndef NSIG
14633 #  ifdef _NSIG
14634 #    define NSIG (_NSIG)
14635 #  endif
14636 #endif
14637
14638 #ifndef NSIG
14639 #  ifdef SIGMAX
14640 #    define NSIG (SIGMAX+1)
14641 #  endif
14642 #endif
14643
14644 #ifndef NSIG
14645 #  ifdef SIG_MAX
14646 #    define NSIG (SIG_MAX+1)
14647 #  endif
14648 #endif
14649
14650 #ifndef NSIG
14651 #  ifdef MAXSIG
14652 #    define NSIG (MAXSIG+1)
14653 #  endif
14654 #endif
14655
14656 #ifndef NSIG
14657 #  ifdef MAX_SIG
14658 #    define NSIG (MAX_SIG+1)
14659 #  endif
14660 #endif
14661
14662 #ifndef NSIG
14663 #  ifdef SIGARRAYSIZE
14664 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14665 #  endif
14666 #endif
14667
14668 #ifndef NSIG
14669 #  ifdef _sys_nsig
14670 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14671 #  endif
14672 #endif
14673
14674 /* Default to some arbitrary number that's big enough to get most
14675    of the common signals.
14676 */
14677 #ifndef NSIG
14678 #    define NSIG 50
14679 #endif
14680
14681 printf("NSIG %d\n", NSIG);
14682
14683 #ifndef JUST_NSIG
14684
14685 EOCP
14686
14687 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14688 {
14689         printf "#ifdef SIG"; printf $1; printf "\n"
14690         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14691         printf $1; printf ");\n"
14692         printf "#endif\n"
14693 }
14694 END {
14695         printf "#endif /* JUST_NSIG */\n";
14696         printf "exit(0);\n}\n";
14697 }
14698 ' >>signal.c
14699 $cat >signal.awk <<'EOP'
14700 BEGIN { ndups = 0 }
14701 $1 ~ /^NSIG$/ { nsig = $2 }
14702 ($1 !~ /^NSIG$/) && (NF == 2) {
14703     if ($2 > maxsig) { maxsig = $2 }
14704     if (sig_name[$2]) {
14705         dup_name[ndups] = $1
14706         dup_num[ndups] = $2
14707         ndups++ 
14708     }
14709     else {
14710         sig_name[$2] = $1
14711         sig_num[$2] = $2
14712     }
14713 }
14714 END { 
14715     if (nsig == 0) {
14716         nsig = maxsig + 1
14717     }
14718     printf("NSIG %d\n", nsig);
14719     for (n = 1; n < nsig; n++) {
14720         if (sig_name[n]) {
14721             printf("%s %d\n", sig_name[n], sig_num[n])
14722         }
14723         else {
14724             printf("NUM%d %d\n", n, n) 
14725         }
14726     }
14727     for (n = 0; n < ndups; n++) {
14728         printf("%s %d\n", dup_name[n], dup_num[n])
14729     }
14730 }
14731 EOP
14732 $cat >signal_cmd <<EOS
14733 $startsh
14734 if $test -s signal.lst; then
14735     echo "Using your existing signal.lst file"
14736         exit 0
14737 fi
14738 xxx="$xxx"
14739 EOS
14740 $cat >>signal_cmd <<'EOS'
14741
14742 set signal
14743 if eval $compile_ok; then
14744         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14745 else
14746         echo "(I can't seem be able to compile the whole test program)" >&4
14747         echo "(I'll try it in little pieces.)" >&4
14748         set signal -DJUST_NSIG
14749         if eval $compile_ok; then
14750                 ./signal$_exe > signal.nsg
14751                 $cat signal.nsg
14752         else
14753                 echo "I can't seem to figure out how many signals you have." >&4
14754                 echo "Guessing 50." >&4
14755                 echo 'NSIG 50' > signal.nsg
14756         fi
14757         : Now look at all the signal names, one at a time.
14758         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14759                 $cat > signal.c <<EOCP
14760 #include <sys/types.h>
14761 #include <signal.h>
14762 #include <stdio.h>
14763 int main() {
14764 printf("$xx %d\n", SIG${xx});
14765 return 0;
14766 }
14767 EOCP
14768                 set signal
14769                 if eval $compile; then
14770                         echo "SIG${xx} found."
14771                         ./signal$_exe  >> signal.ls1
14772                 else
14773                         echo "SIG${xx} NOT found."
14774                 fi
14775         done
14776         if $test -s signal.ls1; then
14777                 $cat signal.nsg signal.ls1 |
14778                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14779         fi
14780
14781 fi
14782 if $test -s signal.lst; then
14783         :
14784 else
14785         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14786         echo 'kill -l' >signal
14787         set X `csh -f <signal`
14788         $rm -f signal
14789         shift
14790         case $# in
14791         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14792         esac
14793         echo $@ | $tr ' ' $trnl | \
14794             $awk '{ printf "%s %d\n", $1, ++s; }
14795                   END { printf "NSIG %d\n", ++s }' >signal.lst
14796 fi
14797 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14798 EOS
14799 chmod a+x signal_cmd
14800 $eunicefix signal_cmd
14801
14802 : generate list of signal names
14803 echo " "
14804 case "$sig_name_init" in
14805 '') doinit=yes ;;
14806 *)  case "$sig_num_init" in
14807     ''|*,*) doinit=yes ;;
14808     esac ;;
14809 esac
14810 case "$doinit" in
14811 yes)
14812         echo "Generating a list of signal names and numbers..." >&4
14813         . ./signal_cmd
14814         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14815         sig_name=`$awk 'BEGIN { printf "ZERO " }
14816                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14817         sig_num=`$awk  'BEGIN { printf "0 " }
14818                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14819         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14820                              !/^NSIG/   { printf "\"%s\", ", $1 }
14821                              END        { printf "0\n" }' signal.lst`
14822         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14823                              !/^NSIG/   { printf "%d, ", $2}
14824                              END        { printf "0\n"}' signal.lst`
14825         ;;
14826 esac
14827 echo "The following $sig_count signals are available:"
14828 echo " "
14829 echo $sig_name | $awk \
14830 'BEGIN { linelen = 0 }
14831 {
14832         for (i = 1; i <= NF; i++) {
14833                 name = "SIG" $i " "
14834                 linelen = linelen + length(name)
14835                 if (linelen > 70) {
14836                         printf "\n"
14837                         linelen = length(name)
14838                 }
14839                 printf "%s", name
14840         }
14841         printf "\n"
14842 }'
14843 sig_size=`echo $sig_name | awk '{print NF}'`
14844 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14845
14846 echo " "
14847 case "$sizetype" in
14848 *_t) zzz="$sizetype"    ;;
14849 *)   zzz="filesize"     ;;
14850 esac
14851 echo "Checking the size of $zzz..." >&4 
14852 cat > try.c <<EOCP
14853 #include <sys/types.h>
14854 #include <stdio.h>
14855 int main() {
14856     printf("%d\n", (int)sizeof($sizetype));
14857     exit(0);
14858 }
14859 EOCP
14860 set try
14861 if eval $compile_ok; then
14862         yyy=`./try`
14863         case "$yyy" in
14864         '')     sizesize=4
14865                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14866                 ;;
14867         *)      sizesize=$yyy
14868                 echo "Your $zzz size is $sizesize bytes."
14869                 ;;
14870         esac
14871 else
14872         sizesize=4
14873         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14874 fi
14875
14876
14877 : check for socklen_t
14878 echo " "
14879 echo "Checking to see if you have socklen_t..." >&4
14880 $cat >try.c <<EOCP
14881 #include <sys/types.h>
14882 #$d_socket HAS_SOCKET
14883 #ifdef HAS_SOCKET
14884 #include <sys/socket.h>
14885 #endif
14886 int main() { socklen_t x = 16; }
14887 EOCP
14888 set try
14889 if eval $compile; then
14890         val="$define"
14891         echo "You have socklen_t."
14892 else
14893         val="$undef"
14894         echo "You do not have socklen_t."
14895         case "$sizetype" in
14896         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14897         esac
14898 fi
14899 $rm -f try try.*
14900 set d_socklen_t
14901 eval $setvar
14902
14903 : see if this is a socks.h system
14904 set socks.h i_socks
14905 eval $inhdr
14906
14907 : check for type of the size argument to socket calls
14908 case "$d_socket" in
14909 "$define")
14910         $cat <<EOM
14911
14912 Checking to see what type is the last argument of accept().
14913 EOM
14914         yyy=''
14915         case "$d_socklen_t" in
14916         "$define") yyy="$yyy socklen_t"
14917         esac
14918         yyy="$yyy $sizetype int long unsigned"
14919         for xxx in $yyy; do
14920                 case "$socksizetype" in
14921                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14922                         case "$usesocks" in
14923                         "$define")
14924                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14925                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14926                                         socksizetype="$xxx"
14927                                 fi
14928                                 ;;
14929                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14930                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14931                                         socksizetype="$xxx"
14932                                 fi
14933                                 ;;
14934                         esac
14935                         ;;
14936                 esac
14937         done
14938 : In case none of those worked, prompt the user.
14939         case "$socksizetype" in
14940         '')     rp='What is the type for socket address structure sizes?'
14941                 dflt='int'
14942                 . ./myread
14943                 socksizetype=$ans
14944                 ;;
14945         esac
14946         ;;
14947 *)      : no sockets, so pick relatively harmless default
14948         socksizetype='int'
14949         ;;
14950 esac
14951
14952 : see what type is used for signed size_t
14953 set ssize_t ssizetype int stdio.h sys/types.h
14954 eval $typedef
14955 dflt="$ssizetype"
14956 $cat > ssize.c <<EOM
14957 #include <stdio.h>
14958 #include <sys/types.h>
14959 #define Size_t $sizetype
14960 #define SSize_t $dflt
14961 int main()
14962 {
14963         if (sizeof(Size_t) == sizeof(SSize_t))
14964                 printf("$dflt\n");
14965         else if (sizeof(Size_t) == sizeof(int))
14966                 printf("int\n");
14967         else 
14968                 printf("long\n");
14969         exit(0);
14970 }
14971 EOM
14972 echo " "
14973 set ssize
14974 if eval $compile_ok && ./ssize > /dev/null; then
14975         ssizetype=`./ssize`
14976         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14977 else
14978         $cat >&4 <<EOM
14979 Help! I can't compile and run the ssize_t test program: please enlighten me!
14980 (This is probably a misconfiguration in your system or libraries, and
14981 you really ought to fix it.  Still, I'll try anyway.)
14982
14983 I need a type that is the same size as $sizetype, but is guaranteed to
14984 be signed.  Common values are ssize_t, int and long.
14985
14986 EOM
14987         rp="What signed type is the same size as $sizetype?"
14988         . ./myread
14989         ssizetype="$ans"
14990 fi
14991 $rm -f ssize ssize.*
14992
14993 : see what type of char stdio uses.
14994 echo " "
14995 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14996 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14997         echo "Your stdio uses unsigned chars." >&4
14998         stdchar="unsigned char"
14999 else
15000         echo "Your stdio uses signed chars." >&4
15001         stdchar="char"
15002 fi
15003 $rm -f stdioh
15004
15005
15006
15007 : see if time exists
15008 echo " "
15009 if test "X$d_time" = X -o X"$timetype" = X; then
15010     if set time val -f d_time; eval $csym; $val; then
15011                 echo 'time() found.' >&4
15012                 val="$define"
15013                 rp="What is the type returned by time() on this system?"
15014                 set time_t timetype long stdio.h sys/types.h
15015                 eval $typedef_ask
15016     else
15017                 echo 'time() not found, hope that will do.' >&4
15018                 val="$undef"
15019                 timetype='int';
15020     fi
15021     set d_time
15022     eval $setvar
15023 fi
15024
15025 : see what type uids are declared as in the kernel
15026 echo " "
15027 echo "Looking for the type for user ids returned by getuid()."
15028 set uid_t uidtype xxx stdio.h sys/types.h
15029 eval $typedef
15030 case "$uidtype" in
15031 xxx)
15032         xxx=`./findhdr sys/user.h`
15033         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15034         case $1 in
15035         unsigned) dflt="$1 $2" ;;
15036         *) dflt="$1" ;;
15037         esac
15038         ;;
15039 *) dflt="$uidtype";;
15040 esac
15041 case "$uidtype" in
15042 uid_t)  echo "uid_t found." ;;
15043 *)      rp="What is the type for user ids returned by getuid()?"
15044         . ./myread
15045         uidtype="$ans"
15046         ;;
15047 esac
15048
15049 echo " "
15050 case "$uidtype" in
15051 *_t) zzz="$uidtype"     ;;
15052 *)   zzz="uid"          ;;
15053 esac
15054 echo "Checking the size of $zzz..." >&4 
15055 cat > try.c <<EOCP
15056 #include <sys/types.h>
15057 #include <stdio.h>
15058 int main() {
15059     printf("%d\n", (int)sizeof($uidtype));
15060     exit(0);
15061 }
15062 EOCP
15063 set try
15064 if eval $compile_ok; then
15065         yyy=`./try`
15066         case "$yyy" in
15067         '')     uidsize=4
15068                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15069                 ;;
15070         *)      uidsize=$yyy
15071                 echo "Your $zzz is $uidsize bytes long."
15072                 ;;
15073         esac
15074 else
15075         uidsize=4
15076         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15077 fi
15078
15079 echo " "
15080 case "$uidtype" in
15081 *_t) zzz="$uidtype"     ;;
15082 *)   zzz="uid"          ;;
15083 esac
15084 echo "Checking the sign of $zzz..." >&4
15085 cat > try.c <<EOCP
15086 #include <sys/types.h>
15087 #include <stdio.h>
15088 int main() {
15089         $uidtype foo = -1;
15090         if (foo < 0)
15091                 printf("-1\n");
15092         else
15093                 printf("1\n");
15094 }
15095 EOCP
15096 set try
15097 if eval $compile; then
15098         yyy=`./try`
15099         case "$yyy" in
15100         '')     uidsign=1
15101                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15102                 ;;
15103         *)      uidsign=$yyy
15104                 case "$uidsign" in
15105                  1) echo "Your $zzz is unsigned." ;;
15106                 -1) echo "Your $zzz is signed."   ;;
15107                 esac
15108                 ;;
15109         esac
15110 else
15111         uidsign=1
15112         echo "(I can't compile the test program--guessing unsigned.)" >&4
15113 fi
15114
15115
15116
15117 echo " "
15118 $echo "Checking the format string to be used for uids..." >&4
15119
15120 case "$uidsign" in
15121 -1)     if $test X"$uidsize" = X"$ivsize"; then
15122                 uidformat="$ivdformat"
15123         else
15124                 if $test X"$uidsize" = X"$longsize"; then
15125                         uidformat='"ld"'
15126                 else
15127                         if $test X"$uidsize" = X"$intsize"; then
15128                                 uidformat='"d"'
15129                         else
15130                                 if $test X"$uidsize" = X"$shortsize"; then
15131                                         uidformat='"hd"'
15132                                 fi
15133                         fi
15134                 fi
15135         fi
15136         ;;
15137 *)      if $test X"$uidsize" = X"$uvsize"; then
15138                 uidformat="$uvuformat"
15139         else
15140                 if $test X"$uidsize" = X"$longsize"; then
15141                         uidformat='"lu"'
15142                 else
15143                         if $test X"$uidsize" = X"$intsize"; then
15144                                 uidformat='"u"'
15145                         else
15146                                 if $test X"$uidsize" = X"$shortsize"; then
15147                                         uidformat='"hu"'
15148                                 fi
15149                         fi
15150                 fi
15151         fi
15152         ;;
15153 esac
15154
15155 : determine compiler compiler
15156 case "$yacc" in
15157 '')
15158         dflt=yacc;;
15159 *)
15160         dflt="$yacc";;
15161 esac
15162 echo " "
15163 comp='yacc'
15164 if $test -f "$byacc"; then
15165         dflt="$byacc"
15166         comp="byacc or $comp"
15167 fi
15168 if $test -f "$bison"; then
15169         comp="$comp or bison -y"
15170 fi
15171 rp="Which compiler compiler ($comp) shall I use?"
15172 . ./myread
15173 yacc="$ans"
15174 case "$yacc" in
15175 *bis*)
15176         case "$yacc" in
15177         *-y*) ;;
15178         *)
15179                 yacc="$yacc -y"
15180                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15181                 ;;
15182         esac
15183         ;;
15184 esac
15185
15186 : see if dbm.h is available
15187 : see if dbmclose exists
15188 set dbmclose d_dbmclose
15189 eval $inlibc
15190
15191 case "$d_dbmclose" in
15192 $define)
15193         set dbm.h i_dbm
15194         eval $inhdr
15195         case "$i_dbm" in
15196         $define)
15197                 val="$undef"
15198                 set i_rpcsvcdbm
15199                 eval $setvar
15200                 ;;
15201         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15202                 eval $inhdr
15203                 ;;
15204         esac
15205         ;;
15206 *)      echo "We won't be including <dbm.h>"
15207         val="$undef"
15208         set i_dbm
15209         eval $setvar
15210         val="$undef"
15211         set i_rpcsvcdbm
15212         eval $setvar
15213         ;;
15214 esac
15215
15216 : see if this is a sys/file.h system
15217 val=''
15218 set sys/file.h val
15219 eval $inhdr
15220
15221 : do we need to include sys/file.h ?
15222 case "$val" in
15223 "$define")
15224         echo " "
15225         if $h_sysfile; then
15226                 val="$define"
15227                 echo "We'll be including <sys/file.h>." >&4
15228         else
15229                 val="$undef"
15230                 echo "We won't be including <sys/file.h>." >&4
15231         fi
15232         ;;
15233 *)
15234         h_sysfile=false
15235         ;;
15236 esac
15237 set i_sysfile
15238 eval $setvar
15239
15240 : see if fcntl.h is there
15241 val=''
15242 set fcntl.h val
15243 eval $inhdr
15244
15245 : see if we can include fcntl.h
15246 case "$val" in
15247 "$define")
15248         echo " "
15249         if $h_fcntl; then
15250                 val="$define"
15251                 echo "We'll be including <fcntl.h>." >&4
15252         else
15253                 val="$undef"
15254                 if $h_sysfile; then
15255         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15256                 else
15257                         echo "We won't be including <fcntl.h>." >&4
15258                 fi
15259         fi
15260         ;;
15261 *)
15262         h_fcntl=false
15263         val="$undef"
15264         ;;
15265 esac
15266 set i_fcntl
15267 eval $setvar
15268
15269 : see if this is a iconv.h system
15270 set iconv.h i_iconv
15271 eval $inhdr
15272
15273 : see if this is a ieeefp.h system
15274 set ieeefp.h i_ieeefp
15275 eval $inhdr
15276
15277 : see if this is a libutil.h system
15278 set libutil.h i_libutil
15279 eval $inhdr
15280
15281 : see if locale.h is available
15282 set locale.h i_locale
15283 eval $inhdr
15284
15285 : see if mach cthreads are available
15286 if test "X$usethreads" = "X$define"; then
15287         set mach/cthreads.h i_machcthr
15288         eval $inhdr
15289 else
15290         i_machcthr="$undef"
15291 fi
15292
15293
15294
15295 : see if this is a math.h system
15296 set math.h i_math
15297 eval $inhdr
15298
15299 : see if this is a mntent.h system
15300 set mntent.h i_mntent
15301 eval $inhdr
15302
15303 : see if ndbm.h is available
15304 set ndbm.h t_ndbm
15305 eval $inhdr
15306 case "$t_ndbm" in
15307 $define)
15308         : see if dbm_open exists
15309         set dbm_open d_dbm_open
15310         eval $inlibc
15311         case "$d_dbm_open" in
15312         $undef)
15313                 t_ndbm="$undef"
15314                 echo "We won't be including <ndbm.h>"
15315                 ;;
15316         esac
15317         ;;
15318 esac
15319 val="$t_ndbm"
15320 set i_ndbm
15321 eval $setvar
15322
15323 : see if net/errno.h is available
15324 val=''
15325 set net/errno.h val
15326 eval $inhdr
15327
15328 : Unfortunately, it causes problems on some systems.  Arrgh.
15329 case "$val" in
15330 $define)
15331         cat > try.c <<'EOM'
15332 #include <stdio.h>
15333 #include <errno.h>
15334 #include <net/errno.h>
15335 int func()
15336 {
15337         return ENOTSOCK;
15338 }
15339 EOM
15340         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15341                 echo "We'll be including <net/errno.h>." >&4
15342         else
15343                 echo "We won't be including <net/errno.h>." >&4
15344                 val="$undef"
15345         fi
15346         $rm -f try.* try
15347         ;;
15348 esac
15349 set i_neterrno
15350 eval $setvar
15351
15352 : see if netinet/tcp.h is available
15353 set netinet/tcp.h i_netinettcp
15354 eval $inhdr
15355
15356 : see if this is a poll.h system
15357 set poll.h i_poll
15358 eval $inhdr
15359
15360 : see if this is a prot.h system
15361 set prot.h i_prot
15362 eval $inhdr
15363
15364 echo " "
15365 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15366 $cat <<'EOSH' > Cppsym.know
15367 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15368 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15369 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15370 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15371 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15372 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15373 bull c cadmus clipper CMU COFF COMPILER_VERSION
15374 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15375 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15376 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15377 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15378 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15379 H3050R H3050RX hbullx20 hcx host_mips
15380 hp200 hp300 hp700 HP700 hp800 hp9000
15381 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15382 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15383 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15384 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15385 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15386 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15387 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15388 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15389 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15390 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15391 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15392 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15393 MATH_HAS_NO_SIDE_EFFECTS
15394 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15395 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15396 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15397 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15398 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15399 NetBSD news1500 news1700 news1800 news1900 news3700
15400 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15401 ns32016 ns32332 ns32k nsc32000
15402 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15403 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15404 pc532 pdp11 PGC PIC plexus PORTAR posix
15405 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15406 POSIX_C_SOURCE POSIX_SOURCE POWER
15407 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15408 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15409 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15410 sony sony_news sonyrisc sparc sparclite spectrum
15411 stardent stdc STDC_EXT stratos sun sun3 sun386
15412 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15413 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15414 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15415 sysV68 sysV88 Tek4132 Tek4300 titan
15416 TM3200 TM5400 TM5600
15417 tower tower32 tower32_200 tower32_600 tower32_700
15418 tower32_800 tower32_850 tss
15419 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15420 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15421 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15422 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15423 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15424 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15425 z8000
15426 EOSH
15427 # Maybe put other stuff here too.
15428 cat <<EOSH >>Cppsym.know
15429 $osname
15430 EOSH
15431 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15432 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15433 $cat Cppsym.know > Cppsym.c
15434 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15435 $rm -f Cppsym.a Cppsym.b Cppsym.c
15436 cat <<EOSH > Cppsym
15437 $startsh
15438 if $test \$# -gt 0; then
15439     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15440     if $test -s Cppsym.got; then
15441         $rm -f Cppsym.got
15442         exit 0
15443     fi
15444     $rm -f Cppsym.got
15445     exit 1
15446 else
15447     $tr " " "$trnl" | ./Cppsym.try
15448     exit 0
15449 fi
15450 EOSH
15451 chmod +x Cppsym
15452 $eunicefix Cppsym
15453 cat <<EOSH > Cppsym.try
15454 $startsh
15455 cat <<'EOCP' > try.c
15456 #include <stdio.h>
15457 int main() {
15458 EOCP
15459 $awk \\
15460 EOSH
15461 cat <<'EOSH' >> Cppsym.try
15462 'length($1) > 0 {
15463     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
15464     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
15465     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
15466     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
15467 }'       >> try.c
15468 echo '}' >> try.c
15469 EOSH
15470 cat <<EOSH >> Cppsym.try
15471 ccflags="$ccflags"
15472 case "$osname-$gccversion" in
15473 irix-) ccflags="\$ccflags -woff 1178" ;;
15474 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15475 esac
15476 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15477 EOSH
15478 chmod +x Cppsym.try
15479 $eunicefix Cppsym.try
15480 ./Cppsym < Cppsym.know > Cppsym.true
15481 : now check the C compiler for additional symbols
15482 postprocess_cc_v=''
15483 case "$osname" in
15484 aix) postprocess_cc_v="|$tr , ' '" ;;
15485 esac
15486 $cat >ccsym <<EOS
15487 $startsh
15488 $cat >tmp.c <<EOF
15489 extern int foo;
15490 EOF
15491 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15492 do
15493         case "\$i" in
15494         -D*) echo "\$i" | $sed 's/^-D//';;
15495         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15496         esac
15497 done
15498 $rm -f try.c
15499 EOS
15500 postprocess_cc_v=''
15501 chmod +x ccsym
15502 $eunicefix ccsym
15503 ./ccsym > ccsym1.raw
15504 if $test -s ccsym1.raw; then
15505        $sort ccsym1.raw | $uniq >ccsym.raw
15506 else
15507        mv ccsym1.raw ccsym.raw
15508 fi
15509
15510 $awk '/\=/ { print $0; next }
15511         { print $0"=1" }' ccsym.raw >ccsym.list
15512 $awk '/\=/ { print $0; next }
15513         { print $0"=1" }' Cppsym.true >ccsym.true
15514 $comm -13 ccsym.true ccsym.list >ccsym.own
15515 $comm -12 ccsym.true ccsym.list >ccsym.com
15516 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15517 also=''
15518 if $test -z ccsym.raw; then
15519         echo "Your C compiler doesn't seem to define any symbols!" >&4
15520         echo " "
15521         echo "However, your C preprocessor defines the following symbols:"
15522         $cat Cppsym.true
15523         ccsymbols=''
15524         cppsymbols=`$cat Cppsym.true`
15525         cppsymbols=`echo $cppsymbols`
15526         cppccsymbols="$cppsymbols"
15527 else
15528         if $test -s ccsym.com; then
15529                 echo "Your C compiler and pre-processor define these symbols:"
15530                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15531                 also='also '
15532                 symbols='ones'
15533                 cppccsymbols=`$cat ccsym.com`
15534                 cppccsymbols=`echo $cppccsymbols`
15535                 $test "$silent" || sleep 1
15536         fi
15537         if $test -s ccsym.cpp; then
15538                 $test "$also" && echo " "
15539                 echo "Your C pre-processor ${also}defines the following symbols:"
15540                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15541                 also='further '
15542                 cppsymbols=`$cat ccsym.cpp`
15543                 cppsymbols=`echo $cppsymbols`
15544                 $test "$silent" || sleep 1
15545         fi
15546         if $test -s ccsym.own; then
15547                 $test "$also" && echo " "
15548                 echo "Your C compiler ${also}defines the following cpp symbols:"
15549                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15550                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15551                 ccsymbols=`$cat ccsym.own`
15552                 ccsymbols=`echo $ccsymbols`
15553                 $test "$silent" || sleep 1
15554         fi
15555 fi
15556 $rm -f ccsym* Cppsym.*
15557
15558 : see if this is a termio system
15559 val="$undef"
15560 val2="$undef"
15561 val3="$undef"
15562 if $test `./findhdr termios.h`; then
15563         set tcsetattr i_termios
15564         eval $inlibc
15565         val3="$i_termios"
15566 fi
15567 echo " "
15568 case "$val3" in
15569 "$define") echo "You have POSIX termios.h... good!" >&4;;
15570 *) if ./Cppsym pyr; then
15571                 case "`/bin/universe`" in
15572                 ucb) if $test `./findhdr sgtty.h`; then
15573                                 val2="$define"
15574                                 echo "<sgtty.h> found." >&4
15575                         else
15576                                 echo "System is pyramid with BSD universe."
15577                                 echo "<sgtty.h> not found--you could have problems." >&4
15578                         fi;;
15579                 *) if $test `./findhdr termio.h`; then
15580                                 val="$define"
15581                                 echo "<termio.h> found." >&4
15582                         else
15583                                 echo "System is pyramid with USG universe."
15584                                 echo "<termio.h> not found--you could have problems." >&4
15585                         fi;;
15586                 esac
15587         elif ./usg; then
15588                 if $test `./findhdr termio.h`; then
15589                         echo "<termio.h> found." >&4
15590                         val="$define"
15591                 elif $test `./findhdr sgtty.h`; then
15592                         echo "<sgtty.h> found." >&4
15593                         val2="$define"
15594                 else
15595 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15596                 fi
15597         else
15598                 if $test `./findhdr sgtty.h`; then
15599                         echo "<sgtty.h> found." >&4
15600                         val2="$define"
15601                 elif $test `./findhdr termio.h`; then
15602                         echo "<termio.h> found." >&4
15603                         val="$define"
15604                 else
15605 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15606                 fi
15607         fi;;
15608 esac
15609 set i_termio; eval $setvar
15610 val=$val2; set i_sgtty; eval $setvar
15611 val=$val3; set i_termios; eval $setvar
15612
15613 : see if this is a shadow.h system
15614 set shadow.h i_shadow
15615 eval $inhdr
15616
15617 : see if stddef is available
15618 set stddef.h i_stddef
15619 eval $inhdr
15620
15621 : see if this is a sunmath.h system
15622 set sunmath.h i_sunmath
15623 eval $inhdr
15624
15625 : see if sys/access.h is available
15626 set sys/access.h i_sysaccess
15627 eval $inhdr
15628
15629 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15630 set sys/filio.h i_sysfilio
15631 eval $inhdr
15632 echo " "
15633 if $test `./findhdr sys/ioctl.h`; then
15634         val="$define"
15635         echo '<sys/ioctl.h> found.' >&4
15636 else
15637         val="$undef"
15638         if $test $i_sysfilio = "$define"; then
15639             echo '<sys/ioctl.h> NOT found.' >&4
15640         else
15641                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15642                 $test $i_termio = "$define" && xxx="termio.h"
15643                 $test $i_termios = "$define" && xxx="termios.h"
15644 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15645         fi
15646 fi
15647 set i_sysioctl
15648 eval $setvar
15649
15650 : see if socket ioctl defs are in sys/sockio.h
15651 echo " "
15652 xxx=`./findhdr sys/sockio.h`
15653 if $test "$xxx"; then
15654         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15655                 val="$define"
15656                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15657         else
15658                 val="$undef"
15659                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15660         fi
15661 else
15662         val="$undef"
15663         $cat <<EOM
15664 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15665 EOM
15666 fi
15667 set i_syssockio
15668 eval $setvar
15669
15670
15671 : see if this is a syslog.h system
15672 set syslog.h i_syslog
15673 eval $inhdr
15674
15675
15676 : see if this is a sys/mode.h system
15677 set sys/mode.h i_sysmode
15678 eval $inhdr
15679
15680 : see if sys/resource.h has to be included
15681 set sys/resource.h i_sysresrc
15682 eval $inhdr
15683
15684 : see if sys/security.h is available
15685 set sys/security.h i_syssecrt
15686 eval $inhdr
15687
15688 : see if this is a sys/statvfs.h system
15689 set sys/statvfs.h i_sysstatvfs
15690 eval $inhdr
15691
15692 : see if this is a sys/un.h system
15693 set sys/un.h i_sysun
15694 eval $inhdr
15695
15696
15697 : see if this is a sys/utsname.h system
15698 set sys/utsname.h i_sysutsname
15699 eval $inhdr
15700
15701 : see if this is a syswait system
15702 set sys/wait.h i_syswait
15703 eval $inhdr
15704
15705 : see if this is a ustat.h system
15706 set ustat.h i_ustat
15707 eval $inhdr
15708
15709 : see if this is an utime system
15710 set utime.h i_utime
15711 eval $inhdr
15712
15713 : see if this is a values.h system
15714 set values.h i_values
15715 eval $inhdr
15716
15717 : see if this is a vfork system
15718 case "$d_vfork" in
15719 "$define")
15720         set vfork.h i_vfork
15721         eval $inhdr
15722         ;;
15723 *)
15724         i_vfork="$undef"
15725         ;;
15726 esac
15727
15728 : see if gdbm.h is available
15729 set gdbm.h t_gdbm
15730 eval $inhdr
15731 case "$t_gdbm" in
15732 $define)
15733         : see if gdbm_open exists
15734         set gdbm_open d_gdbm_open
15735         eval $inlibc
15736         case "$d_gdbm_open" in
15737         $undef)
15738                 t_gdbm="$undef"
15739                 echo "We won't be including <gdbm.h>"
15740                 ;;
15741         esac
15742         ;;
15743 esac
15744 val="$t_gdbm"
15745 set i_gdbm
15746 eval $setvar
15747
15748 echo " "
15749 echo "Looking for extensions..." >&4
15750 : If we are using the old config.sh, known_extensions may contain
15751 : old or inaccurate or duplicate values.
15752 known_extensions=''
15753 nonxs_extensions=''
15754 : We do not use find because it might not be available.
15755 : We do not just use MANIFEST because the user may have dropped
15756 : some additional extensions into the source tree and expect them
15757 : to be built.
15758
15759 : Function to recursively find available extensions, ignoring DynaLoader
15760 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15761 find_extensions='
15762     for xxx in *; do
15763        case "$xxx" in
15764            DynaLoader|dynaload) ;;
15765            *)
15766            if $test -f $xxx/$xxx.xs; then
15767                known_extensions="$known_extensions $1$xxx";
15768            elif $test -f $xxx/Makefile.PL; then
15769                nonxs_extensions="$nonxs_extensions $1$xxx";
15770            else
15771                if $test -d $xxx -a $# -lt 10; then
15772                    set $1$xxx/ $*;
15773                    cd $xxx;
15774                    eval $find_extensions;
15775                    cd ..;
15776                    shift;
15777                fi;
15778            fi
15779            ;;
15780        esac;
15781     done'
15782 tdir=`pwd`
15783 cd $rsrc/ext
15784 set X
15785 shift
15786 eval $find_extensions
15787 set X $nonxs_extensions
15788 shift
15789 nonxs_extensions="$*"
15790 set X $known_extensions
15791 shift
15792 known_extensions="$*"
15793 cd $tdir
15794
15795 : Now see which are supported on this system.
15796 avail_ext=''
15797 for xxx in $known_extensions ; do
15798         case "$xxx" in
15799         DB_File|db_file)
15800                 case "$i_db" in
15801                 $define) avail_ext="$avail_ext $xxx" ;;
15802                 esac
15803                 ;;
15804         GDBM_File|gdbm_fil)
15805                 case "$i_gdbm" in 
15806                 $define) avail_ext="$avail_ext $xxx" ;;
15807                 esac
15808                 ;;
15809         NDBM_File|ndbm_fil)
15810                 case "$i_ndbm" in
15811                 $define)
15812                     case "$osname-$use64bitint" in
15813                     hpux-define)
15814                         case "$libs" in
15815                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15816                         esac
15817                         ;;
15818                     *) avail_ext="$avail_ext $xxx" ;;
15819                     esac
15820                     ;;
15821                 esac
15822                 ;;
15823         ODBM_File|odbm_fil) 
15824                 case "${i_dbm}${i_rpcsvcdbm}" in
15825                 *"${define}"*)
15826                     case "$osname-$use64bitint" in
15827                     hpux-define)
15828                         case "$libs" in
15829                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15830                         esac
15831                         ;;
15832                     *) avail_ext="$avail_ext $xxx" ;;
15833                     esac
15834                     ;;
15835                 esac
15836                 ;;
15837         POSIX|posix)
15838                 case "$useposix" in
15839                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15840                 esac
15841                 ;;
15842         Opcode|opcode)
15843                 case "$useopcode" in
15844                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15845                 esac
15846                 ;;
15847         Socket|socket)
15848                 case "$d_socket" in 
15849                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15850                 esac
15851                 ;;
15852         Sys/Syslog|sys/syslog)
15853                 : XXX syslog requires socket
15854                 case "$d_socket" in 
15855                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15856                 esac
15857                 ;;
15858         Thread|thread)
15859                 case "$usethreads" in 
15860                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15861                 esac
15862                 ;;
15863         IPC/SysV|ipc/sysv)
15864                 : XXX Do we need a useipcsysv variable here
15865                 case "${d_msg}${d_sem}${d_shm}" in 
15866                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15867                 esac
15868                 ;;
15869         *)      avail_ext="$avail_ext $xxx"
15870                 ;;
15871         esac
15872 done
15873
15874 set X $avail_ext
15875 shift
15876 avail_ext="$*"
15877
15878 : Now see which nonxs extensions are supported on this system.
15879 : For now assume all are.
15880 nonxs_ext=''
15881 for xxx in $nonxs_extensions ; do
15882         case "$xxx" in
15883         *)      nonxs_ext="$nonxs_ext $xxx"
15884                 ;;
15885         esac
15886 done
15887
15888 set X $nonxs_ext
15889 shift
15890 nonxs_ext="$*"
15891
15892 case $usedl in
15893 $define)
15894         $cat <<EOM
15895 A number of extensions are supplied with $package.  You may choose to
15896 compile these extensions for dynamic loading (the default), compile
15897 them into the $package executable (static loading), or not include
15898 them at all.  Answer "none" to include no extensions.
15899 Note that DynaLoader is always built and need not be mentioned here.
15900
15901 EOM
15902         case "$dynamic_ext" in
15903         '') dflt="$avail_ext" ;;
15904         *)      dflt="$dynamic_ext"
15905                 # Perhaps we are reusing an old out-of-date config.sh.
15906                 case "$hint" in
15907                 previous)
15908                         if test X"$dynamic_ext" != X"$avail_ext"; then
15909                                 $cat <<EOM
15910 NOTICE:  Your previous config.sh list may be incorrect. 
15911 The extensions now available to you are 
15912         ${avail_ext}
15913 but the default list from your previous config.sh is
15914         ${dynamic_ext} 
15915
15916 EOM
15917                         fi
15918                         ;;
15919                 esac
15920                 ;;
15921         esac
15922         case "$dflt" in
15923         '')     dflt=none;;
15924         esac
15925         rp="What extensions do you wish to load dynamically?"
15926         . ./myread
15927         case "$ans" in
15928         none) dynamic_ext=' ' ;;
15929         *) dynamic_ext="$ans" ;;
15930         esac
15931
15932         case "$static_ext" in
15933         '')
15934                 : Exclude those already listed in dynamic linking
15935                 dflt=''
15936                 for xxx in $avail_ext; do
15937                         case " $dynamic_ext " in
15938                         *" $xxx "*) ;;
15939                         *) dflt="$dflt $xxx" ;;
15940                         esac
15941                 done
15942                 set X $dflt
15943                 shift
15944                 dflt="$*"
15945                 ;;
15946         *)  dflt="$static_ext" 
15947                 ;;
15948         esac
15949
15950         case "$dflt" in
15951         '')     dflt=none;;
15952         esac
15953         rp="What extensions do you wish to load statically?"
15954         . ./myread
15955         case "$ans" in
15956         none) static_ext=' ' ;;
15957         *) static_ext="$ans" ;;
15958         esac
15959         ;;
15960 *)
15961         $cat <<EOM
15962 A number of extensions are supplied with $package.  Answer "none" 
15963 to include no extensions. 
15964 Note that DynaLoader is always built and need not be mentioned here.
15965
15966 EOM
15967         case "$static_ext" in
15968         '') dflt="$avail_ext" ;;
15969         *)      dflt="$static_ext"
15970                 # Perhaps we are reusing an old out-of-date config.sh.
15971                 case "$hint" in
15972                 previous)
15973                         if test X"$static_ext" != X"$avail_ext"; then
15974                                 $cat <<EOM
15975 NOTICE:  Your previous config.sh list may be incorrect. 
15976 The extensions now available to you are 
15977         ${avail_ext}
15978 but the default list from your previous config.sh is
15979         ${static_ext} 
15980
15981 EOM
15982                         fi
15983                         ;;
15984                 esac
15985                 ;;
15986         esac
15987         : Exclude those that are not xs extensions
15988         case "$dflt" in
15989         '')     dflt=none;;
15990         esac
15991         rp="What extensions do you wish to include?"
15992         . ./myread
15993         case "$ans" in
15994         none) static_ext=' ' ;;
15995         *) static_ext="$ans" ;;
15996         esac
15997         ;;
15998 esac
15999
16000 set X $dynamic_ext $static_ext $nonxs_ext
16001 shift
16002 extensions="$*"
16003
16004 : Remove libraries needed only for extensions
16005 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16006 : The exception is SunOS 4.x, which needs them.
16007 case "${osname}X${osvers}" in
16008 sunos*X4*)
16009     perllibs="$libs"
16010     ;;
16011 *) case "$usedl" in
16012     $define|true|[yY]*)
16013             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16014             shift
16015             perllibs="$*"
16016             ;;
16017     *)  perllibs="$libs"
16018             ;;
16019     esac
16020     ;;
16021 esac
16022
16023 : Remove build directory name from cppstdin so it can be used from
16024 : either the present location or the final installed location.
16025 echo " "
16026 : Get out of the UU directory to get correct path name.
16027 cd ..
16028 case "$cppstdin" in
16029 `pwd`/cppstdin)
16030         echo "Stripping down cppstdin path name"
16031         cppstdin=cppstdin
16032         ;;
16033 esac
16034 cd UU
16035
16036 : end of configuration questions
16037 echo " "
16038 echo "End of configuration questions."
16039 echo " "
16040
16041 : back to where it started
16042 if test -d ../UU; then
16043         cd ..
16044 fi
16045
16046 : configuration may be patched via a 'config.over' file
16047 if $test -f config.over; then
16048         echo " "
16049         dflt=y
16050         rp='I see a config.over file.  Do you wish to load it?'
16051         . UU/myread
16052         case "$ans" in
16053         n*) echo "OK, I'll ignore it.";;
16054         *)      . ./config.over
16055                 echo "Configuration override changes have been loaded."
16056                 ;;
16057         esac
16058 fi
16059
16060 : in case they want portability, strip down executable paths
16061 case "$d_portable" in
16062 "$define")
16063         echo " "
16064         echo "Stripping down executable paths..." >&4
16065         for file in $loclist $trylist; do
16066                 eval temp=\$$file
16067                 eval $file=`basename $temp`
16068         done
16069         ;;
16070 esac
16071
16072 : create config.sh file
16073 echo " "
16074 echo "Creating config.sh..." >&4
16075 $spitshell <<EOT >config.sh
16076 $startsh
16077 #
16078 # This file was produced by running the Configure script. It holds all the
16079 # definitions figured out by Configure. Should you modify one of these values,
16080 # do not forget to propagate your changes by running "Configure -der". You may
16081 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16082 #
16083
16084 # Package name      : $package
16085 # Source directory  : $src
16086 # Configuration time: $cf_time
16087 # Configured by     : $cf_by
16088 # Target system     : $myuname
16089
16090 Author='$Author'
16091 Date='$Date'
16092 Header='$Header'
16093 Id='$Id'
16094 Locker='$Locker'
16095 Log='$Log'
16096 Mcc='$Mcc'
16097 RCSfile='$RCSfile'
16098 Revision='$Revision'
16099 Source='$Source'
16100 State='$State'
16101 _a='$_a'
16102 _exe='$_exe'
16103 _o='$_o'
16104 afs='$afs'
16105 afsroot='$afsroot'
16106 alignbytes='$alignbytes'
16107 ansi2knr='$ansi2knr'
16108 aphostname='$aphostname'
16109 api_revision='$api_revision'
16110 api_subversion='$api_subversion'
16111 api_version='$api_version'
16112 api_versionstring='$api_versionstring'
16113 ar='$ar'
16114 archlib='$archlib'
16115 archlibexp='$archlibexp'
16116 archname64='$archname64'
16117 archname='$archname'
16118 archobjs='$archobjs'
16119 awk='$awk'
16120 baserev='$baserev'
16121 bash='$bash'
16122 bin='$bin'
16123 bincompat5005='$bincompat5005'
16124 binexp='$binexp'
16125 bison='$bison'
16126 byacc='$byacc'
16127 byteorder='$byteorder'
16128 c='$c'
16129 castflags='$castflags'
16130 cat='$cat'
16131 cc='$cc'
16132 cccdlflags='$cccdlflags'
16133 ccdlflags='$ccdlflags'
16134 ccflags='$ccflags'
16135 ccflags_uselargefiles='$ccflags_uselargefiles'
16136 ccname='$ccname'
16137 ccsymbols='$ccsymbols'
16138 ccversion='$ccversion'
16139 cf_by='$cf_by'
16140 cf_email='$cf_email'
16141 cf_time='$cf_time'
16142 charsize='$charsize'
16143 chgrp='$chgrp'
16144 chmod='$chmod'
16145 chown='$chown'
16146 clocktype='$clocktype'
16147 comm='$comm'
16148 compress='$compress'
16149 contains='$contains'
16150 cp='$cp'
16151 cpio='$cpio'
16152 cpp='$cpp'
16153 cpp_stuff='$cpp_stuff'
16154 cppccsymbols='$cppccsymbols'
16155 cppflags='$cppflags'
16156 cpplast='$cpplast'
16157 cppminus='$cppminus'
16158 cpprun='$cpprun'
16159 cppstdin='$cppstdin'
16160 cppsymbols='$cppsymbols'
16161 crosscompile='$crosscompile'
16162 cryptlib='$cryptlib'
16163 csh='$csh'
16164 d_Gconvert='$d_Gconvert'
16165 d_PRIEUldbl='$d_PRIEUldbl'
16166 d_PRIFUldbl='$d_PRIFUldbl'
16167 d_PRIGUldbl='$d_PRIGUldbl'
16168 d_PRIXU64='$d_PRIXU64'
16169 d_PRId64='$d_PRId64'
16170 d_PRIeldbl='$d_PRIeldbl'
16171 d_PRIfldbl='$d_PRIfldbl'
16172 d_PRIgldbl='$d_PRIgldbl'
16173 d_PRIi64='$d_PRIi64'
16174 d_PRIo64='$d_PRIo64'
16175 d_PRIu64='$d_PRIu64'
16176 d_PRIx64='$d_PRIx64'
16177 d_SCNfldbl='$d_SCNfldbl'
16178 d__fwalk='$d__fwalk'
16179 d_access='$d_access'
16180 d_accessx='$d_accessx'
16181 d_alarm='$d_alarm'
16182 d_archlib='$d_archlib'
16183 d_atolf='$d_atolf'
16184 d_atoll='$d_atoll'
16185 d_attribut='$d_attribut'
16186 d_bcmp='$d_bcmp'
16187 d_bcopy='$d_bcopy'
16188 d_bincompat5005='$d_bincompat5005'
16189 d_bsd='$d_bsd'
16190 d_bsdgetpgrp='$d_bsdgetpgrp'
16191 d_bsdsetpgrp='$d_bsdsetpgrp'
16192 d_bzero='$d_bzero'
16193 d_casti32='$d_casti32'
16194 d_castneg='$d_castneg'
16195 d_charvspr='$d_charvspr'
16196 d_chown='$d_chown'
16197 d_chroot='$d_chroot'
16198 d_chsize='$d_chsize'
16199 d_closedir='$d_closedir'
16200 d_cmsghdr_s='$d_cmsghdr_s'
16201 d_const='$d_const'
16202 d_crypt='$d_crypt'
16203 d_csh='$d_csh'
16204 d_cuserid='$d_cuserid'
16205 d_dbl_dig='$d_dbl_dig'
16206 d_difftime='$d_difftime'
16207 d_dirnamlen='$d_dirnamlen'
16208 d_dlerror='$d_dlerror'
16209 d_dlopen='$d_dlopen'
16210 d_dlsymun='$d_dlsymun'
16211 d_dosuid='$d_dosuid'
16212 d_drand48proto='$d_drand48proto'
16213 d_dup2='$d_dup2'
16214 d_eaccess='$d_eaccess'
16215 d_endgrent='$d_endgrent'
16216 d_endhent='$d_endhent'
16217 d_endnent='$d_endnent'
16218 d_endpent='$d_endpent'
16219 d_endpwent='$d_endpwent'
16220 d_endsent='$d_endsent'
16221 d_eofnblk='$d_eofnblk'
16222 d_eunice='$d_eunice'
16223 d_fchmod='$d_fchmod'
16224 d_fchown='$d_fchown'
16225 d_fcntl='$d_fcntl'
16226 d_fcntl_can_lock='$d_fcntl_can_lock'
16227 d_fd_macros='$d_fd_macros'
16228 d_fd_set='$d_fd_set'
16229 d_fds_bits='$d_fds_bits'
16230 d_fgetpos='$d_fgetpos'
16231 d_flexfnam='$d_flexfnam'
16232 d_flock='$d_flock'
16233 d_fork='$d_fork'
16234 d_fpathconf='$d_fpathconf'
16235 d_fpos64_t='$d_fpos64_t'
16236 d_frexpl='$d_frexpl'
16237 d_fs_data_s='$d_fs_data_s'
16238 d_fseeko='$d_fseeko'
16239 d_fsetpos='$d_fsetpos'
16240 d_fstatfs='$d_fstatfs'
16241 d_fstatvfs='$d_fstatvfs'
16242 d_fsync='$d_fsync'
16243 d_ftello='$d_ftello'
16244 d_ftime='$d_ftime'
16245 d_getcwd='$d_getcwd'
16246 d_getespwnam='$d_getespwnam'
16247 d_getfsstat='$d_getfsstat'
16248 d_getgrent='$d_getgrent'
16249 d_getgrps='$d_getgrps'
16250 d_gethbyaddr='$d_gethbyaddr'
16251 d_gethbyname='$d_gethbyname'
16252 d_gethent='$d_gethent'
16253 d_gethname='$d_gethname'
16254 d_gethostprotos='$d_gethostprotos'
16255 d_getitimer='$d_getitimer'
16256 d_getlogin='$d_getlogin'
16257 d_getmnt='$d_getmnt'
16258 d_getmntent='$d_getmntent'
16259 d_getnbyaddr='$d_getnbyaddr'
16260 d_getnbyname='$d_getnbyname'
16261 d_getnent='$d_getnent'
16262 d_getnetprotos='$d_getnetprotos'
16263 d_getpagsz='$d_getpagsz'
16264 d_getpbyname='$d_getpbyname'
16265 d_getpbynumber='$d_getpbynumber'
16266 d_getpent='$d_getpent'
16267 d_getpgid='$d_getpgid'
16268 d_getpgrp2='$d_getpgrp2'
16269 d_getpgrp='$d_getpgrp'
16270 d_getppid='$d_getppid'
16271 d_getprior='$d_getprior'
16272 d_getprotoprotos='$d_getprotoprotos'
16273 d_getprpwnam='$d_getprpwnam'
16274 d_getpwent='$d_getpwent'
16275 d_getsbyname='$d_getsbyname'
16276 d_getsbyport='$d_getsbyport'
16277 d_getsent='$d_getsent'
16278 d_getservprotos='$d_getservprotos'
16279 d_getspnam='$d_getspnam'
16280 d_gettimeod='$d_gettimeod'
16281 d_gnulibc='$d_gnulibc'
16282 d_grpasswd='$d_grpasswd'
16283 d_hasmntopt='$d_hasmntopt'
16284 d_htonl='$d_htonl'
16285 d_iconv='$d_iconv'
16286 d_index='$d_index'
16287 d_inetaton='$d_inetaton'
16288 d_int64_t='$d_int64_t'
16289 d_isascii='$d_isascii'
16290 d_isnan='$d_isnan'
16291 d_isnanl='$d_isnanl'
16292 d_killpg='$d_killpg'
16293 d_lchown='$d_lchown'
16294 d_ldbl_dig='$d_ldbl_dig'
16295 d_link='$d_link'
16296 d_locconv='$d_locconv'
16297 d_lockf='$d_lockf'
16298 d_longdbl='$d_longdbl'
16299 d_longlong='$d_longlong'
16300 d_lseekproto='$d_lseekproto'
16301 d_lstat='$d_lstat'
16302 d_madvise='$d_madvise'
16303 d_mblen='$d_mblen'
16304 d_mbstowcs='$d_mbstowcs'
16305 d_mbtowc='$d_mbtowc'
16306 d_memchr='$d_memchr'
16307 d_memcmp='$d_memcmp'
16308 d_memcpy='$d_memcpy'
16309 d_memmove='$d_memmove'
16310 d_memset='$d_memset'
16311 d_mkdir='$d_mkdir'
16312 d_mkdtemp='$d_mkdtemp'
16313 d_mkfifo='$d_mkfifo'
16314 d_mkstemp='$d_mkstemp'
16315 d_mkstemps='$d_mkstemps'
16316 d_mktime='$d_mktime'
16317 d_mmap='$d_mmap'
16318 d_modfl='$d_modfl'
16319 d_mprotect='$d_mprotect'
16320 d_msg='$d_msg'
16321 d_msg_ctrunc='$d_msg_ctrunc'
16322 d_msg_dontroute='$d_msg_dontroute'
16323 d_msg_oob='$d_msg_oob'
16324 d_msg_peek='$d_msg_peek'
16325 d_msg_proxy='$d_msg_proxy'
16326 d_msgctl='$d_msgctl'
16327 d_msgget='$d_msgget'
16328 d_msghdr_s='$d_msghdr_s'
16329 d_msgrcv='$d_msgrcv'
16330 d_msgsnd='$d_msgsnd'
16331 d_msync='$d_msync'
16332 d_munmap='$d_munmap'
16333 d_mymalloc='$d_mymalloc'
16334 d_nice='$d_nice'
16335 d_nv_preserves_uv='$d_nv_preserves_uv'
16336 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16337 d_off64_t='$d_off64_t'
16338 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16339 d_oldpthreads='$d_oldpthreads'
16340 d_oldsock='$d_oldsock'
16341 d_open3='$d_open3'
16342 d_pathconf='$d_pathconf'
16343 d_pause='$d_pause'
16344 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16345 d_phostname='$d_phostname'
16346 d_pipe='$d_pipe'
16347 d_poll='$d_poll'
16348 d_portable='$d_portable'
16349 d_pthread_yield='$d_pthread_yield'
16350 d_pwage='$d_pwage'
16351 d_pwchange='$d_pwchange'
16352 d_pwclass='$d_pwclass'
16353 d_pwcomment='$d_pwcomment'
16354 d_pwexpire='$d_pwexpire'
16355 d_pwgecos='$d_pwgecos'
16356 d_pwpasswd='$d_pwpasswd'
16357 d_pwquota='$d_pwquota'
16358 d_qgcvt='$d_qgcvt'
16359 d_quad='$d_quad'
16360 d_readdir='$d_readdir'
16361 d_readlink='$d_readlink'
16362 d_readv='$d_readv'
16363 d_recvmsg='$d_recvmsg'
16364 d_rename='$d_rename'
16365 d_rewinddir='$d_rewinddir'
16366 d_rmdir='$d_rmdir'
16367 d_safebcpy='$d_safebcpy'
16368 d_safemcpy='$d_safemcpy'
16369 d_sanemcmp='$d_sanemcmp'
16370 d_sbrkproto='$d_sbrkproto'
16371 d_sched_yield='$d_sched_yield'
16372 d_scm_rights='$d_scm_rights'
16373 d_seekdir='$d_seekdir'
16374 d_select='$d_select'
16375 d_sem='$d_sem'
16376 d_semctl='$d_semctl'
16377 d_semctl_semid_ds='$d_semctl_semid_ds'
16378 d_semctl_semun='$d_semctl_semun'
16379 d_semget='$d_semget'
16380 d_semop='$d_semop'
16381 d_sendmsg='$d_sendmsg'
16382 d_setegid='$d_setegid'
16383 d_seteuid='$d_seteuid'
16384 d_setgrent='$d_setgrent'
16385 d_setgrps='$d_setgrps'
16386 d_sethent='$d_sethent'
16387 d_setitimer='$d_setitimer'
16388 d_setlinebuf='$d_setlinebuf'
16389 d_setlocale='$d_setlocale'
16390 d_setnent='$d_setnent'
16391 d_setpent='$d_setpent'
16392 d_setpgid='$d_setpgid'
16393 d_setpgrp2='$d_setpgrp2'
16394 d_setpgrp='$d_setpgrp'
16395 d_setprior='$d_setprior'
16396 d_setproctitle='$d_setproctitle'
16397 d_setpwent='$d_setpwent'
16398 d_setregid='$d_setregid'
16399 d_setresgid='$d_setresgid'
16400 d_setresuid='$d_setresuid'
16401 d_setreuid='$d_setreuid'
16402 d_setrgid='$d_setrgid'
16403 d_setruid='$d_setruid'
16404 d_setsent='$d_setsent'
16405 d_setsid='$d_setsid'
16406 d_setvbuf='$d_setvbuf'
16407 d_sfio='$d_sfio'
16408 d_shm='$d_shm'
16409 d_shmat='$d_shmat'
16410 d_shmatprototype='$d_shmatprototype'
16411 d_shmctl='$d_shmctl'
16412 d_shmdt='$d_shmdt'
16413 d_shmget='$d_shmget'
16414 d_sigaction='$d_sigaction'
16415 d_sigprocmask='$d_sigprocmask'
16416 d_sigsetjmp='$d_sigsetjmp'
16417 d_sockatmark='$d_sockatmark'
16418 d_socket='$d_socket'
16419 d_socklen_t='$d_socklen_t'
16420 d_sockpair='$d_sockpair'
16421 d_socks5_init='$d_socks5_init'
16422 d_sqrtl='$d_sqrtl'
16423 d_statblks='$d_statblks'
16424 d_statfs_f_flags='$d_statfs_f_flags'
16425 d_statfs_s='$d_statfs_s'
16426 d_statvfs='$d_statvfs'
16427 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16428 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16429 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16430 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16431 d_stdio_stream_array='$d_stdio_stream_array'
16432 d_stdiobase='$d_stdiobase'
16433 d_stdstdio='$d_stdstdio'
16434 d_strchr='$d_strchr'
16435 d_strcoll='$d_strcoll'
16436 d_strctcpy='$d_strctcpy'
16437 d_strerrm='$d_strerrm'
16438 d_strerror='$d_strerror'
16439 d_strftime='$d_strftime'
16440 d_strtod='$d_strtod'
16441 d_strtol='$d_strtol'
16442 d_strtold='$d_strtold'
16443 d_strtoll='$d_strtoll'
16444 d_strtoq='$d_strtoq'
16445 d_strtoul='$d_strtoul'
16446 d_strtoull='$d_strtoull'
16447 d_strtouq='$d_strtouq'
16448 d_strxfrm='$d_strxfrm'
16449 d_suidsafe='$d_suidsafe'
16450 d_symlink='$d_symlink'
16451 d_syscall='$d_syscall'
16452 d_sysconf='$d_sysconf'
16453 d_sysernlst='$d_sysernlst'
16454 d_syserrlst='$d_syserrlst'
16455 d_system='$d_system'
16456 d_tcgetpgrp='$d_tcgetpgrp'
16457 d_tcsetpgrp='$d_tcsetpgrp'
16458 d_telldir='$d_telldir'
16459 d_telldirproto='$d_telldirproto'
16460 d_time='$d_time'
16461 d_times='$d_times'
16462 d_truncate='$d_truncate'
16463 d_tzname='$d_tzname'
16464 d_u32align='$d_u32align'
16465 d_ualarm='$d_ualarm'
16466 d_umask='$d_umask'
16467 d_uname='$d_uname'
16468 d_union_semun='$d_union_semun'
16469 d_usleep='$d_usleep'
16470 d_ustat='$d_ustat'
16471 d_vendorarch='$d_vendorarch'
16472 d_vendorbin='$d_vendorbin'
16473 d_vendorlib='$d_vendorlib'
16474 d_vfork='$d_vfork'
16475 d_void_closedir='$d_void_closedir'
16476 d_voidsig='$d_voidsig'
16477 d_voidtty='$d_voidtty'
16478 d_volatile='$d_volatile'
16479 d_vprintf='$d_vprintf'
16480 d_wait4='$d_wait4'
16481 d_waitpid='$d_waitpid'
16482 d_wcstombs='$d_wcstombs'
16483 d_wctomb='$d_wctomb'
16484 d_writev='$d_writev'
16485 d_xenix='$d_xenix'
16486 date='$date'
16487 db_hashtype='$db_hashtype'
16488 db_prefixtype='$db_prefixtype'
16489 defvoidused='$defvoidused'
16490 direntrytype='$direntrytype'
16491 dlext='$dlext'
16492 dlsrc='$dlsrc'
16493 doublesize='$doublesize'
16494 drand01='$drand01'
16495 dynamic_ext='$dynamic_ext'
16496 eagain='$eagain'
16497 ebcdic='$ebcdic'
16498 echo='$echo'
16499 egrep='$egrep'
16500 emacs='$emacs'
16501 eunicefix='$eunicefix'
16502 exe_ext='$exe_ext'
16503 expr='$expr'
16504 extensions='$extensions'
16505 fflushNULL='$fflushNULL'
16506 fflushall='$fflushall'
16507 find='$find'
16508 firstmakefile='$firstmakefile'
16509 flex='$flex'
16510 fpossize='$fpossize'
16511 fpostype='$fpostype'
16512 freetype='$freetype'
16513 full_ar='$full_ar'
16514 full_csh='$full_csh'
16515 full_sed='$full_sed'
16516 gccosandvers='$gccosandvers'
16517 gccversion='$gccversion'
16518 gidformat='$gidformat'
16519 gidsign='$gidsign'
16520 gidsize='$gidsize'
16521 gidtype='$gidtype'
16522 glibpth='$glibpth'
16523 grep='$grep'
16524 groupcat='$groupcat'
16525 groupstype='$groupstype'
16526 gzip='$gzip'
16527 h_fcntl='$h_fcntl'
16528 h_sysfile='$h_sysfile'
16529 hint='$hint'
16530 hostcat='$hostcat'
16531 i16size='$i16size'
16532 i16type='$i16type'
16533 i32size='$i32size'
16534 i32type='$i32type'
16535 i64size='$i64size'
16536 i64type='$i64type'
16537 i8size='$i8size'
16538 i8type='$i8type'
16539 i_arpainet='$i_arpainet'
16540 i_bsdioctl='$i_bsdioctl'
16541 i_db='$i_db'
16542 i_dbm='$i_dbm'
16543 i_dirent='$i_dirent'
16544 i_dld='$i_dld'
16545 i_dlfcn='$i_dlfcn'
16546 i_fcntl='$i_fcntl'
16547 i_float='$i_float'
16548 i_gdbm='$i_gdbm'
16549 i_grp='$i_grp'
16550 i_iconv='$i_iconv'
16551 i_ieeefp='$i_ieeefp'
16552 i_inttypes='$i_inttypes'
16553 i_libutil='$i_libutil'
16554 i_limits='$i_limits'
16555 i_locale='$i_locale'
16556 i_machcthr='$i_machcthr'
16557 i_malloc='$i_malloc'
16558 i_math='$i_math'
16559 i_memory='$i_memory'
16560 i_mntent='$i_mntent'
16561 i_ndbm='$i_ndbm'
16562 i_netdb='$i_netdb'
16563 i_neterrno='$i_neterrno'
16564 i_netinettcp='$i_netinettcp'
16565 i_niin='$i_niin'
16566 i_poll='$i_poll'
16567 i_prot='$i_prot'
16568 i_pthread='$i_pthread'
16569 i_pwd='$i_pwd'
16570 i_rpcsvcdbm='$i_rpcsvcdbm'
16571 i_sfio='$i_sfio'
16572 i_sgtty='$i_sgtty'
16573 i_shadow='$i_shadow'
16574 i_socks='$i_socks'
16575 i_stdarg='$i_stdarg'
16576 i_stddef='$i_stddef'
16577 i_stdlib='$i_stdlib'
16578 i_string='$i_string'
16579 i_sunmath='$i_sunmath'
16580 i_sysaccess='$i_sysaccess'
16581 i_sysdir='$i_sysdir'
16582 i_sysfile='$i_sysfile'
16583 i_sysfilio='$i_sysfilio'
16584 i_sysin='$i_sysin'
16585 i_sysioctl='$i_sysioctl'
16586 i_syslog='$i_syslog'
16587 i_sysmman='$i_sysmman'
16588 i_sysmode='$i_sysmode'
16589 i_sysmount='$i_sysmount'
16590 i_sysndir='$i_sysndir'
16591 i_sysparam='$i_sysparam'
16592 i_sysresrc='$i_sysresrc'
16593 i_syssecrt='$i_syssecrt'
16594 i_sysselct='$i_sysselct'
16595 i_syssockio='$i_syssockio'
16596 i_sysstat='$i_sysstat'
16597 i_sysstatfs='$i_sysstatfs'
16598 i_sysstatvfs='$i_sysstatvfs'
16599 i_systime='$i_systime'
16600 i_systimek='$i_systimek'
16601 i_systimes='$i_systimes'
16602 i_systypes='$i_systypes'
16603 i_sysuio='$i_sysuio'
16604 i_sysun='$i_sysun'
16605 i_sysutsname='$i_sysutsname'
16606 i_sysvfs='$i_sysvfs'
16607 i_syswait='$i_syswait'
16608 i_termio='$i_termio'
16609 i_termios='$i_termios'
16610 i_time='$i_time'
16611 i_unistd='$i_unistd'
16612 i_ustat='$i_ustat'
16613 i_utime='$i_utime'
16614 i_values='$i_values'
16615 i_varargs='$i_varargs'
16616 i_varhdr='$i_varhdr'
16617 i_vfork='$i_vfork'
16618 ignore_versioned_solibs='$ignore_versioned_solibs'
16619 inc_version_list='$inc_version_list'
16620 inc_version_list_init='$inc_version_list_init'
16621 incpath='$incpath'
16622 inews='$inews'
16623 installarchlib='$installarchlib'
16624 installbin='$installbin'
16625 installman1dir='$installman1dir'
16626 installman3dir='$installman3dir'
16627 installprefix='$installprefix'
16628 installprefixexp='$installprefixexp'
16629 installprivlib='$installprivlib'
16630 installscript='$installscript'
16631 installsitearch='$installsitearch'
16632 installsitebin='$installsitebin'
16633 installsitelib='$installsitelib'
16634 installstyle='$installstyle'
16635 installusrbinperl='$installusrbinperl'
16636 installvendorarch='$installvendorarch'
16637 installvendorbin='$installvendorbin'
16638 installvendorlib='$installvendorlib'
16639 intsize='$intsize'
16640 issymlink='$issymlink'
16641 ivdformat='$ivdformat'
16642 ivsize='$ivsize'
16643 ivtype='$ivtype'
16644 known_extensions='$known_extensions'
16645 ksh='$ksh'
16646 ld='$ld'
16647 lddlflags='$lddlflags'
16648 ldflags='$ldflags'
16649 ldflags_uselargefiles='$ldflags_uselargefiles'
16650 ldlibpthname='$ldlibpthname'
16651 less='$less'
16652 lib_ext='$lib_ext'
16653 libc='$libc'
16654 libperl='$libperl'
16655 libpth='$libpth'
16656 libs='$libs'
16657 libsdirs='$libsdirs'
16658 libsfiles='$libsfiles'
16659 libsfound='$libsfound'
16660 libspath='$libspath'
16661 libswanted='$libswanted'
16662 libswanted_uselargefiles='$libswanted_uselargefiles'
16663 line='$line'
16664 lint='$lint'
16665 lkflags='$lkflags'
16666 ln='$ln'
16667 lns='$lns'
16668 locincpth='$locincpth'
16669 loclibpth='$loclibpth'
16670 longdblsize='$longdblsize'
16671 longlongsize='$longlongsize'
16672 longsize='$longsize'
16673 lp='$lp'
16674 lpr='$lpr'
16675 ls='$ls'
16676 lseeksize='$lseeksize'
16677 lseektype='$lseektype'
16678 mail='$mail'
16679 mailx='$mailx'
16680 make='$make'
16681 make_set_make='$make_set_make'
16682 mallocobj='$mallocobj'
16683 mallocsrc='$mallocsrc'
16684 malloctype='$malloctype'
16685 man1dir='$man1dir'
16686 man1direxp='$man1direxp'
16687 man1ext='$man1ext'
16688 man3dir='$man3dir'
16689 man3direxp='$man3direxp'
16690 man3ext='$man3ext'
16691 mips_type='$mips_type'
16692 mkdir='$mkdir'
16693 mmaptype='$mmaptype'
16694 modetype='$modetype'
16695 more='$more'
16696 multiarch='$multiarch'
16697 mv='$mv'
16698 myarchname='$myarchname'
16699 mydomain='$mydomain'
16700 myhostname='$myhostname'
16701 myuname='$myuname'
16702 n='$n'
16703 need_va_copy='$need_va_copy'
16704 netdb_hlen_type='$netdb_hlen_type'
16705 netdb_host_type='$netdb_host_type'
16706 netdb_name_type='$netdb_name_type'
16707 netdb_net_type='$netdb_net_type'
16708 nm='$nm'
16709 nm_opt='$nm_opt'
16710 nm_so_opt='$nm_so_opt'
16711 nonxs_ext='$nonxs_ext'
16712 nroff='$nroff'
16713 nvEUformat='$nvEUformat'
16714 nvFUformat='$nvFUformat'
16715 nvGUformat='$nvGUformat'
16716 nveformat='$nveformat'
16717 nvfformat='$nvfformat'
16718 nvgformat='$nvgformat'
16719 nvsize='$nvsize'
16720 nvtype='$nvtype'
16721 o_nonblock='$o_nonblock'
16722 obj_ext='$obj_ext'
16723 old_pthread_create_joinable='$old_pthread_create_joinable'
16724 optimize='$optimize'
16725 orderlib='$orderlib'
16726 osname='$osname'
16727 osvers='$osvers'
16728 otherlibdirs='$otherlibdirs'
16729 package='$package'
16730 pager='$pager'
16731 passcat='$passcat'
16732 patchlevel='$patchlevel'
16733 path_sep='$path_sep'
16734 perl5='$perl5'
16735 perl='$perl'
16736 perl_patchlevel='$perl_patchlevel'
16737 perladmin='$perladmin'
16738 perllibs='$perllibs'
16739 perlpath='$perlpath'
16740 pg='$pg'
16741 phostname='$phostname'
16742 pidtype='$pidtype'
16743 plibpth='$plibpth'
16744 pm_apiversion='$pm_apiversion'
16745 pmake='$pmake'
16746 pr='$pr'
16747 prefix='$prefix'
16748 prefixexp='$prefixexp'
16749 privlib='$privlib'
16750 privlibexp='$privlibexp'
16751 prototype='$prototype'
16752 ptrsize='$ptrsize'
16753 quadkind='$quadkind'
16754 quadtype='$quadtype'
16755 randbits='$randbits'
16756 randfunc='$randfunc'
16757 randseedtype='$randseedtype'
16758 ranlib='$ranlib'
16759 rd_nodata='$rd_nodata'
16760 revision='$revision'
16761 rm='$rm'
16762 rmail='$rmail'
16763 runnm='$runnm'
16764 sPRIEUldbl='$sPRIEUldbl'
16765 sPRIFUldbl='$sPRIFUldbl'
16766 sPRIGUldbl='$sPRIGUldbl'
16767 sPRIXU64='$sPRIXU64'
16768 sPRId64='$sPRId64'
16769 sPRIeldbl='$sPRIeldbl'
16770 sPRIfldbl='$sPRIfldbl'
16771 sPRIgldbl='$sPRIgldbl'
16772 sPRIi64='$sPRIi64'
16773 sPRIo64='$sPRIo64'
16774 sPRIu64='$sPRIu64'
16775 sPRIx64='$sPRIx64'
16776 sSCNfldbl='$sSCNfldbl'
16777 sched_yield='$sched_yield'
16778 scriptdir='$scriptdir'
16779 scriptdirexp='$scriptdirexp'
16780 sed='$sed'
16781 seedfunc='$seedfunc'
16782 selectminbits='$selectminbits'
16783 selecttype='$selecttype'
16784 sendmail='$sendmail'
16785 sh='$sh'
16786 shar='$shar'
16787 sharpbang='$sharpbang'
16788 shmattype='$shmattype'
16789 shortsize='$shortsize'
16790 shrpenv='$shrpenv'
16791 shsharp='$shsharp'
16792 sig_count='$sig_count'
16793 sig_name='$sig_name'
16794 sig_name_init='$sig_name_init'
16795 sig_num='$sig_num'
16796 sig_num_init='$sig_num_init'
16797 sig_size='$sig_size'
16798 signal_t='$signal_t'
16799 sitearch='$sitearch'
16800 sitearchexp='$sitearchexp'
16801 sitebin='$sitebin'
16802 sitebinexp='$sitebinexp'
16803 sitelib='$sitelib'
16804 sitelib_stem='$sitelib_stem'
16805 sitelibexp='$sitelibexp'
16806 siteprefix='$siteprefix'
16807 siteprefixexp='$siteprefixexp'
16808 sizesize='$sizesize'
16809 sizetype='$sizetype'
16810 sleep='$sleep'
16811 smail='$smail'
16812 so='$so'
16813 sockethdr='$sockethdr'
16814 socketlib='$socketlib'
16815 socksizetype='$socksizetype'
16816 sort='$sort'
16817 spackage='$spackage'
16818 spitshell='$spitshell'
16819 src='$src'
16820 ssizetype='$ssizetype'
16821 startperl='$startperl'
16822 startsh='$startsh'
16823 static_ext='$static_ext'
16824 stdchar='$stdchar'
16825 stdio_base='$stdio_base'
16826 stdio_bufsiz='$stdio_bufsiz'
16827 stdio_cnt='$stdio_cnt'
16828 stdio_filbuf='$stdio_filbuf'
16829 stdio_ptr='$stdio_ptr'
16830 stdio_stream_array='$stdio_stream_array'
16831 strings='$strings'
16832 submit='$submit'
16833 subversion='$subversion'
16834 sysman='$sysman'
16835 tail='$tail'
16836 tar='$tar'
16837 tbl='$tbl'
16838 tee='$tee'
16839 test='$test'
16840 timeincl='$timeincl'
16841 timetype='$timetype'
16842 touch='$touch'
16843 tr='$tr'
16844 trnl='$trnl'
16845 troff='$troff'
16846 u16size='$u16size'
16847 u16type='$u16type'
16848 u32size='$u32size'
16849 u32type='$u32type'
16850 u64size='$u64size'
16851 u64type='$u64type'
16852 u8size='$u8size'
16853 u8type='$u8type'
16854 uidformat='$uidformat'
16855 uidsign='$uidsign'
16856 uidsize='$uidsize'
16857 uidtype='$uidtype'
16858 uname='$uname'
16859 uniq='$uniq'
16860 uquadtype='$uquadtype'
16861 use5005threads='$use5005threads'
16862 use64bitall='$use64bitall'
16863 use64bitint='$use64bitint'
16864 usedl='$usedl'
16865 useithreads='$useithreads'
16866 uselargefiles='$uselargefiles'
16867 uselongdouble='$uselongdouble'
16868 usemorebits='$usemorebits'
16869 usemultiplicity='$usemultiplicity'
16870 usemymalloc='$usemymalloc'
16871 usenm='$usenm'
16872 useopcode='$useopcode'
16873 useperlio='$useperlio'
16874 useposix='$useposix'
16875 usesfio='$usesfio'
16876 useshrplib='$useshrplib'
16877 usesocks='$usesocks'
16878 usethreads='$usethreads'
16879 usevendorprefix='$usevendorprefix'
16880 usevfork='$usevfork'
16881 usrinc='$usrinc'
16882 uuname='$uuname'
16883 uvXUformat='$uvXUformat'
16884 uvoformat='$uvoformat'
16885 uvsize='$uvsize'
16886 uvtype='$uvtype'
16887 uvuformat='$uvuformat'
16888 uvxformat='$uvxformat'
16889 vendorarch='$vendorarch'
16890 vendorarchexp='$vendorarchexp'
16891 vendorbin='$vendorbin'
16892 vendorbinexp='$vendorbinexp'
16893 vendorlib='$vendorlib'
16894 vendorlib_stem='$vendorlib_stem'
16895 vendorlibexp='$vendorlibexp'
16896 vendorprefix='$vendorprefix'
16897 vendorprefixexp='$vendorprefixexp'
16898 version='$version'
16899 versiononly='$versiononly'
16900 vi='$vi'
16901 voidflags='$voidflags'
16902 xlibpth='$xlibpth'
16903 xs_apiversion='$xs_apiversion'
16904 yacc='$yacc'
16905 yaccflags='$yaccflags'
16906 zcat='$zcat'
16907 zip='$zip'
16908 EOT
16909
16910 : Add in command line options if available
16911 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16912
16913 : add special variables
16914 $test -f $src/patchlevel.h && \
16915 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16916 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
16917 echo "PERL_CONFIG_SH=true" >>config.sh
16918
16919 : propagate old symbols
16920 if $test -f UU/config.sh; then
16921         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16922         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16923         $sort | $uniq -u >UU/oldsyms
16924         set X `cat UU/oldsyms`
16925         shift
16926         case $# in
16927         0) ;;
16928         *)
16929                 cat <<EOM
16930 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16931 EOM
16932                 echo "# Variables propagated from previous config.sh file." >>config.sh
16933                 for sym in `cat UU/oldsyms`; do
16934                         echo "    Propagating $hint variable "'$'"$sym..."
16935                         eval 'tmp="$'"${sym}"'"'
16936                         echo "$tmp" | \
16937                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16938                 done
16939                 ;;
16940         esac
16941 fi
16942
16943 : Finish up by extracting the .SH files
16944 case "$alldone" in
16945 exit)
16946         $rm -rf UU
16947         echo "Done."
16948         exit 0
16949         ;;
16950 cont)
16951         ;;
16952 '')
16953         dflt=''
16954         nostick=true
16955         $cat <<EOM
16956
16957 If you'd like to make any changes to the config.sh file before I begin
16958 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16959
16960 EOM
16961         rp="Press return or use a shell escape to edit config.sh:"
16962         . UU/myread
16963         nostick=''
16964         case "$ans" in
16965         '') ;;
16966         *) : in case they cannot read
16967                 sh 1>&4 -c "$ans";;
16968         esac
16969         ;;
16970 esac
16971
16972 : if this fails, just run all the .SH files by hand
16973 . ./config.sh
16974
16975 echo " "
16976 exec 1>&4
16977 . ./UU/extract
16978
16979 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16980         dflt=y
16981         case "$silent" in
16982         true) ;;
16983         *)
16984                 $cat <<EOM
16985
16986 Now you need to generate make dependencies by running "$make depend".
16987 You might prefer to run it in background: "$make depend > makedepend.out &"
16988 It can take a while, so you might not want to run it right now.
16989
16990 EOM
16991                 ;;
16992         esac
16993         rp="Run $make depend now?"
16994         . UU/myread
16995         case "$ans" in
16996         y*)
16997                 $make depend && echo "Now you must run '$make'."
16998                 ;;
16999         *)
17000                 echo "You must run '$make depend' then '$make'."
17001                 ;;
17002         esac
17003 elif test -f [Mm]akefile; then
17004         echo " "
17005         echo "Now you must run a $make."
17006 else
17007         echo "Done."
17008 fi
17009
17010 if $test -f Policy.sh; then
17011     $cat <<EOM
17012
17013 If you compile $package on a different machine or from a different object
17014 directory, copy the Policy.sh file from this object directory to the
17015 new one before you run Configure -- this will help you with most of
17016 the policy defaults.
17017
17018 EOM
17019 fi
17020 if $test -f config.msg; then
17021     echo "Hmm.  I also noted the following information while running:"
17022     echo " "
17023     $cat config.msg >&4
17024     $rm -f config.msg
17025 fi
17026 $rm -f kit*isdone ark*isdone
17027 $rm -rf UU
17028
17029 : End of Configure
17030