I wonder how many $CONFIGs still lurk in the shadows.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jun 12 02:31:11 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_dbminitproto=''
337 d_difftime=''
338 d_dlerror=''
339 d_dlopen=''
340 d_dlsymun=''
341 d_dosuid=''
342 d_suidsafe=''
343 d_drand48proto=''
344 d_dup2=''
345 d_eaccess=''
346 d_endgrent=''
347 d_endhent=''
348 d_endnent=''
349 d_endpent=''
350 d_endpwent=''
351 d_endsent=''
352 d_fchmod=''
353 d_fchown=''
354 d_fcntl=''
355 d_fcntl_can_lock=''
356 d_fd_macros=''
357 d_fd_set=''
358 d_fds_bits=''
359 d_fgetpos=''
360 d_flexfnam=''
361 d_flock=''
362 d_flockproto=''
363 d_fork=''
364 d_fpos64_t=''
365 d_frexpl=''
366 d_fs_data_s=''
367 d_fseeko=''
368 d_fsetpos=''
369 d_fstatfs=''
370 d_fsync=''
371 d_ftello=''
372 d_ftime=''
373 d_gettimeod=''
374 d_Gconvert=''
375 d_getcwd=''
376 d_getespwnam=''
377 d_getfsstat=''
378 d_getgrent=''
379 d_getgrps=''
380 d_gethbyaddr=''
381 d_gethbyname=''
382 d_gethent=''
383 aphostname=''
384 d_gethname=''
385 d_phostname=''
386 d_uname=''
387 d_gethostprotos=''
388 d_getitimer=''
389 d_getlogin=''
390 d_getmnt=''
391 d_getmntent=''
392 d_getnbyaddr=''
393 d_getnbyname=''
394 d_getnent=''
395 d_getnetprotos=''
396 d_getpagsz=''
397 d_getpent=''
398 d_getpgid=''
399 d_getpgrp2=''
400 d_bsdgetpgrp=''
401 d_getpgrp=''
402 d_getppid=''
403 d_getprior=''
404 d_getpbyname=''
405 d_getpbynumber=''
406 d_getprotoprotos=''
407 d_getprpwnam=''
408 d_getpwent=''
409 d_getsent=''
410 d_getservprotos=''
411 d_getspnam=''
412 d_getsbyname=''
413 d_getsbyport=''
414 d_gnulibc=''
415 d_hasmntopt=''
416 d_htonl=''
417 d_iconv=''
418 d_inetaton=''
419 d_int64_t=''
420 d_isascii=''
421 d_isnan=''
422 d_isnanl=''
423 d_killpg=''
424 d_lchown=''
425 d_ldbl_dig=''
426 d_link=''
427 d_locconv=''
428 d_lockf=''
429 d_longdbl=''
430 longdblsize=''
431 d_longlong=''
432 longlongsize=''
433 d_lseekproto=''
434 d_lstat=''
435 d_madvise=''
436 d_mblen=''
437 d_mbstowcs=''
438 d_mbtowc=''
439 d_memchr=''
440 d_memcmp=''
441 d_memcpy=''
442 d_memmove=''
443 d_memset=''
444 d_mkdir=''
445 d_mkdtemp=''
446 d_mkfifo=''
447 d_mkstemp=''
448 d_mkstemps=''
449 d_mktime=''
450 d_mmap=''
451 mmaptype=''
452 d_modfl=''
453 d_modfl_pow32_bug=''
454 d_mprotect=''
455 d_msg=''
456 d_msgctl=''
457 d_msgget=''
458 d_msghdr_s=''
459 d_msgrcv=''
460 d_msgsnd=''
461 d_msync=''
462 d_munmap=''
463 d_nice=''
464 d_off64_t=''
465 d_open3=''
466 d_fpathconf=''
467 d_pathconf=''
468 d_pause=''
469 d_pipe=''
470 d_poll=''
471 d_portable=''
472 d_old_pthread_create_joinable=''
473 old_pthread_create_joinable=''
474 d_pthread_yield=''
475 d_sched_yield=''
476 sched_yield=''
477 d_qgcvt=''
478 d_readdir=''
479 d_rewinddir=''
480 d_seekdir=''
481 d_telldir=''
482 d_readlink=''
483 d_readv=''
484 d_realpath=''
485 d_recvmsg=''
486 d_rename=''
487 d_rmdir=''
488 d_safebcpy=''
489 d_safemcpy=''
490 d_sanemcmp=''
491 d_sbrkproto=''
492 d_select=''
493 d_sem=''
494 d_semctl=''
495 d_semget=''
496 d_semop=''
497 d_sendmsg=''
498 d_setegid=''
499 d_seteuid=''
500 d_setgrent=''
501 d_setgrps=''
502 d_sethent=''
503 d_setitimer=''
504 d_setlinebuf=''
505 d_setlocale=''
506 d_setnent=''
507 d_setpent=''
508 d_setpgid=''
509 d_setpgrp2=''
510 d_bsdsetpgrp=''
511 d_setpgrp=''
512 d_setprior=''
513 d_setproctitle=''
514 d_setpwent=''
515 d_setregid=''
516 d_setresgid=''
517 d_setresuid=''
518 d_setreuid=''
519 d_setrgid=''
520 d_setruid=''
521 d_setsent=''
522 d_setsid=''
523 d_setvbuf=''
524 d_sfio=''
525 usesfio=''
526 d_shm=''
527 d_shmat=''
528 d_shmatprototype=''
529 shmattype=''
530 d_shmctl=''
531 d_shmdt=''
532 d_shmget=''
533 d_sigaction=''
534 d_sigprocmask=''
535 d_sigsetjmp=''
536 d_sockatmark=''
537 d_sockatmarkproto=''
538 d_msg_ctrunc=''
539 d_msg_dontroute=''
540 d_msg_oob=''
541 d_msg_peek=''
542 d_msg_proxy=''
543 d_oldsock=''
544 d_scm_rights=''
545 d_socket=''
546 d_sockpair=''
547 sockethdr=''
548 socketlib=''
549 d_socklen_t=''
550 d_socks5_init=''
551 d_sqrtl=''
552 d_sresgproto=''
553 d_sresuproto=''
554 d_statblks=''
555 d_statfs_f_flags=''
556 d_statfs_s=''
557 d_fstatvfs=''
558 d_statvfs=''
559 d_stdio_cnt_lval=''
560 d_stdio_ptr_lval=''
561 d_stdio_ptr_lval_nochange_cnt=''
562 d_stdio_ptr_lval_sets_cnt=''
563 d_stdiobase=''
564 d_stdstdio=''
565 stdio_base=''
566 stdio_bufsiz=''
567 stdio_cnt=''
568 stdio_filbuf=''
569 stdio_ptr=''
570 d_index=''
571 d_strchr=''
572 d_strcoll=''
573 d_strctcpy=''
574 d_strerrm=''
575 d_strerror=''
576 d_sysernlst=''
577 d_syserrlst=''
578 d_strftime=''
579 d_strtod=''
580 d_strtol=''
581 d_strtold=''
582 d_strtoll=''
583 d_strtoq=''
584 d_strtoul=''
585 d_strtoull=''
586 d_strtouq=''
587 d_strxfrm=''
588 d_symlink=''
589 d_syscall=''
590 d_syscallproto=''
591 d_sysconf=''
592 d_system=''
593 d_tcgetpgrp=''
594 d_tcsetpgrp=''
595 d_telldirproto=''
596 d_time=''
597 timetype=''
598 clocktype=''
599 d_times=''
600 d_truncate=''
601 d_tzname=''
602 d_u32align=''
603 d_ualarm=''
604 d_umask=''
605 d_semctl_semid_ds=''
606 d_semctl_semun=''
607 d_union_semun=''
608 d_usleep=''
609 d_usleepproto=''
610 d_ustat=''
611 d_vfork=''
612 usevfork=''
613 d_voidsig=''
614 signal_t=''
615 d_volatile=''
616 d_charvspr=''
617 d_vprintf=''
618 d_wait4=''
619 d_waitpid=''
620 d_wcstombs=''
621 d_wctomb=''
622 d_writev=''
623 dlext=''
624 cccdlflags=''
625 ccdlflags=''
626 dlsrc=''
627 ld=''
628 lddlflags=''
629 usedl=''
630 doublesize=''
631 ebcdic=''
632 fflushNULL=''
633 fflushall=''
634 fpossize=''
635 fpostype=''
636 gccosandvers=''
637 gccversion=''
638 gidformat=''
639 gidsign=''
640 gidsize=''
641 gidtype=''
642 groupstype=''
643 h_fcntl=''
644 h_sysfile=''
645 i_arpainet=''
646 db_hashtype=''
647 db_prefixtype=''
648 db_version_major=''
649 db_version_minor=''
650 db_version_patch=''
651 i_db=''
652 i_dbm=''
653 i_rpcsvcdbm=''
654 d_dirnamlen=''
655 direntrytype=''
656 i_dirent=''
657 i_dld=''
658 i_dlfcn=''
659 i_fcntl=''
660 i_float=''
661 i_gdbm=''
662 d_grpasswd=''
663 i_grp=''
664 i_iconv=''
665 i_ieeefp=''
666 i_inttypes=''
667 i_libutil=''
668 i_limits=''
669 i_locale=''
670 i_machcthr=''
671 i_malloc=''
672 i_math=''
673 i_memory=''
674 i_mntent=''
675 i_ndbm=''
676 i_netdb=''
677 i_neterrno=''
678 i_netinettcp=''
679 i_niin=''
680 i_sysin=''
681 i_poll=''
682 i_prot=''
683 i_pthread=''
684 d_pwage=''
685 d_pwchange=''
686 d_pwclass=''
687 d_pwcomment=''
688 d_pwexpire=''
689 d_pwgecos=''
690 d_pwpasswd=''
691 d_pwquota=''
692 i_pwd=''
693 i_sfio=''
694 i_shadow=''
695 i_socks=''
696 i_stddef=''
697 i_stdlib=''
698 i_string=''
699 strings=''
700 i_sunmath=''
701 i_sysaccess=''
702 i_sysdir=''
703 i_sysfile=''
704 d_voidtty=''
705 i_bsdioctl=''
706 i_sysfilio=''
707 i_sysioctl=''
708 i_syssockio=''
709 i_syslog=''
710 i_sysmman=''
711 i_sysmode=''
712 i_sysmount=''
713 i_sysndir=''
714 i_sysparam=''
715 i_sysresrc=''
716 i_syssecrt=''
717 i_sysselct=''
718 i_sysstat=''
719 i_sysstatfs=''
720 i_sysstatvfs=''
721 i_systimes=''
722 i_systypes=''
723 i_sysuio=''
724 i_sysun=''
725 i_sysutsname=''
726 i_sysvfs=''
727 i_syswait=''
728 i_sgtty=''
729 i_termio=''
730 i_termios=''
731 i_systime=''
732 i_systimek=''
733 i_time=''
734 timeincl=''
735 i_unistd=''
736 i_ustat=''
737 i_utime=''
738 i_values=''
739 i_stdarg=''
740 i_varargs=''
741 i_varhdr=''
742 i_vfork=''
743 inc_version_list=''
744 inc_version_list_init=''
745 installprefix=''
746 installprefixexp=''
747 installstyle=''
748 installusrbinperl=''
749 intsize=''
750 longsize=''
751 shortsize=''
752 issymlink=''
753 libc=''
754 ldlibpthname=''
755 libperl=''
756 shrpenv=''
757 useshrplib=''
758 glibpth=''
759 libpth=''
760 loclibpth=''
761 plibpth=''
762 xlibpth=''
763 ignore_versioned_solibs=''
764 libs=''
765 libsdirs=''
766 libsfiles=''
767 libsfound=''
768 libspath=''
769 lns=''
770 d_PRIEUldbl=''
771 d_PRIFUldbl=''
772 d_PRIGUldbl=''
773 d_PRIeldbl=''
774 d_PRIfldbl=''
775 d_PRIgldbl=''
776 d_SCNfldbl=''
777 sPRIEUldbl=''
778 sPRIFUldbl=''
779 sPRIGUldbl=''
780 sPRIeldbl=''
781 sPRIfldbl=''
782 sPRIgldbl=''
783 sSCNfldbl=''
784 lseeksize=''
785 lseektype=''
786 make_set_make=''
787 d_mymalloc=''
788 freetype=''
789 mallocobj=''
790 mallocsrc=''
791 malloctype=''
792 usemymalloc=''
793 installman1dir=''
794 man1dir=''
795 man1direxp=''
796 man1ext=''
797 installman3dir=''
798 man3dir=''
799 man3direxp=''
800 man3ext=''
801 modetype=''
802 multiarch=''
803 mydomain=''
804 myhostname=''
805 phostname=''
806 c=''
807 n=''
808 d_eofnblk=''
809 eagain=''
810 o_nonblock=''
811 rd_nodata=''
812 need_va_copy=''
813 netdb_hlen_type=''
814 netdb_host_type=''
815 netdb_name_type=''
816 netdb_net_type=''
817 groupcat=''
818 hostcat=''
819 passcat=''
820 orderlib=''
821 ranlib=''
822 d_perl_otherlibdirs=''
823 otherlibdirs=''
824 package=''
825 spackage=''
826 pager=''
827 api_revision=''
828 api_subversion=''
829 api_version=''
830 api_versionstring=''
831 patchlevel=''
832 perl_patchlevel=''
833 revision=''
834 subversion=''
835 version=''
836 perl5=''
837 perladmin=''
838 perlpath=''
839 d_nv_preserves_uv=''
840 d_nv_preserves_uv_bits=''
841 i16size=''
842 i16type=''
843 i32size=''
844 i32type=''
845 i64size=''
846 i64type=''
847 i8size=''
848 i8type=''
849 ivsize=''
850 ivtype=''
851 nvsize=''
852 nvtype=''
853 u16size=''
854 u16type=''
855 u32size=''
856 u32type=''
857 u64size=''
858 u64type=''
859 u8size=''
860 u8type=''
861 uvsize=''
862 uvtype=''
863 ivdformat=''
864 nvEUformat=''
865 nvFUformat=''
866 nvGUformat=''
867 nveformat=''
868 nvfformat=''
869 nvgformat=''
870 uvXUformat=''
871 uvoformat=''
872 uvuformat=''
873 uvxformat=''
874 pidtype=''
875 prefix=''
876 prefixexp=''
877 installprivlib=''
878 privlib=''
879 privlibexp=''
880 prototype=''
881 ptrsize=''
882 d_PRIXU64=''
883 d_PRId64=''
884 d_PRIi64=''
885 d_PRIo64=''
886 d_PRIu64=''
887 d_PRIx64=''
888 sPRIXU64=''
889 sPRId64=''
890 sPRIi64=''
891 sPRIo64=''
892 sPRIu64=''
893 sPRIx64=''
894 d_quad=''
895 quadkind=''
896 quadtype=''
897 uquadtype=''
898 drand01=''
899 randbits=''
900 randfunc=''
901 randseedtype=''
902 seedfunc=''
903 installscript=''
904 scriptdir=''
905 scriptdirexp=''
906 selectminbits=''
907 selecttype=''
908 sh=''
909 sig_count=''
910 sig_name=''
911 sig_name_init=''
912 sig_num=''
913 sig_num_init=''
914 sig_size=''
915 installsitearch=''
916 sitearch=''
917 sitearchexp=''
918 installsitebin=''
919 sitebin=''
920 sitebinexp=''
921 installsitelib=''
922 sitelib=''
923 sitelib_stem=''
924 sitelibexp=''
925 siteprefix=''
926 siteprefixexp=''
927 sizesize=''
928 sizetype=''
929 so=''
930 socksizetype=''
931 sharpbang=''
932 shsharp=''
933 spitshell=''
934 src=''
935 ssizetype=''
936 startperl=''
937 startsh=''
938 stdchar=''
939 d_stdio_stream_array=''
940 stdio_stream_array=''
941 sysman=''
942 trnl=''
943 uidformat=''
944 uidsign=''
945 uidsize=''
946 uidtype=''
947 archname64=''
948 use64bitall=''
949 use64bitint=''
950 ccflags_uselargefiles=''
951 ldflags_uselargefiles=''
952 libswanted_uselargefiles=''
953 uselargefiles=''
954 uselongdouble=''
955 usemorebits=''
956 usemultiplicity=''
957 nm_opt=''
958 nm_so_opt=''
959 runnm=''
960 usenm=''
961 useperlio=''
962 usesocks=''
963 d_oldpthreads=''
964 use5005threads=''
965 useithreads=''
966 usethreads=''
967 incpath=''
968 mips_type=''
969 usrinc=''
970 d_vendorarch=''
971 installvendorarch=''
972 vendorarch=''
973 vendorarchexp=''
974 d_vendorbin=''
975 installvendorbin=''
976 vendorbin=''
977 vendorbinexp=''
978 d_vendorlib=''
979 installvendorlib=''
980 vendorlib=''
981 vendorlib_stem=''
982 vendorlibexp=''
983 usevendorprefix=''
984 vendorprefix=''
985 vendorprefixexp=''
986 versiononly=''
987 defvoidused=''
988 voidflags=''
989 pm_apiversion=''
990 xs_apiversion=''
991 yacc=''
992 yaccflags=''
993 CONFIG=''
994
995 define='define'
996 undef='undef'
997 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
998 rmlist=''
999
1000 : We must find out about Eunice early
1001 eunicefix=':'
1002 if test -f /etc/unixtovms; then
1003         eunicefix=/etc/unixtovms
1004 fi
1005 if test -f /etc/unixtovms.exe; then
1006         eunicefix=/etc/unixtovms.exe
1007 fi
1008
1009 i_whoami=''
1010 ccname=''
1011 ccversion=''
1012 perllibs=''
1013 : set useposix=false in your hint file to disable the POSIX extension.
1014 useposix=true
1015 : set useopcode=false in your hint file to disable the Opcode extension.
1016 useopcode=true
1017 : Trailing extension.  Override this in a hint file, if needed.
1018 _exe=''
1019 : Extra object files, if any, needed on this platform.
1020 archobjs=''
1021 archname=''
1022 : Possible local include directories to search.
1023 : Set locincpth to "" in a hint file to defeat local include searches.
1024 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1025 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1026 :
1027 : no include file wanted by default
1028 inclwanted=''
1029
1030 groupstype=''
1031 : change the next line if compiling for Xenix/286 on Xenix/386
1032 xlibpth='/usr/lib/386 /lib/386'
1033 : Possible local library directories to search.
1034 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1035 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1036
1037 : general looking path for locating libraries
1038 glibpth="/lib /usr/lib $xlibpth"
1039 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1040 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1041 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1042
1043 : Private path used by Configure to find libraries.  Its value
1044 : is prepended to libpth. This variable takes care of special
1045 : machines, like the mips.  Usually, it should be empty.
1046 plibpth=''
1047
1048 : default library list
1049 libswanted=''
1050 : some systems want to use only the non-versioned libso:s
1051 ignore_versioned_solibs=''
1052 archname64=''
1053 ccflags_uselargefiles=''
1054 ldflags_uselargefiles=''
1055 libswanted_uselargefiles=''
1056 : set usemultiplicity on the Configure command line to enable multiplicity.
1057 : set usesocks on the Configure command line to enable socks.
1058 : set usethreads on the Configure command line to enable threads.
1059 : full support for void wanted by default
1060 defvoidused=15
1061
1062 : List of libraries we want.
1063 : If anyone needs -lnet, put it in a hint file.
1064 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1065 libswanted="$libswanted dld ld sun m c cposix posix"
1066 libswanted="$libswanted ndir dir crypt sec"
1067 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1068 : We probably want to search /usr/shlib before most other libraries.
1069 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1070 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1071 glibpth="/usr/shlib $glibpth"
1072 : Do not use vfork unless overridden by a hint file.
1073 usevfork=false
1074
1075 : Find the basic shell for Bourne shell scripts
1076 case "$sh" in
1077 '')
1078         case "$SYSTYPE" in
1079         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1080         *) xxx='/bin/sh';;
1081         esac
1082         if test -f "$xxx"; then
1083                 sh="$xxx"
1084         else
1085                 : Build up a list and do a single loop so we can 'break' out.
1086                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1087                 for xxx in sh bash ksh pdksh ash; do
1088                         for p in $pth; do
1089                                 try="$try ${p}/${xxx}"
1090                         done
1091                 done
1092                 for xxx in $try; do
1093                         if test -f "$xxx"; then
1094                                 sh="$xxx";
1095                                 break
1096                         elif test -f "$xxx.exe"; then
1097                                 sh="$xxx";
1098                                 break
1099                         fi
1100                 done
1101         fi
1102         ;;
1103 esac
1104
1105 case "$sh" in
1106 '')     cat <<EOM >&2
1107 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1108
1109 Usually it's in /bin/sh.  How did you even get this far?
1110 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1111 we'll try to straighten this all out.
1112 EOM
1113         exit 1
1114         ;;
1115 esac
1116
1117 : see if sh knows # comments
1118 if `$sh -c '#' >/dev/null 2>&1`; then
1119         shsharp=true
1120         spitshell=cat
1121         xcat=/bin/cat
1122         test -f $xcat || xcat=/usr/bin/cat
1123         echo "#!$xcat" >try
1124         $eunicefix try
1125         chmod +x try
1126         ./try > today
1127         if test -s today; then
1128                 sharpbang='#!'
1129         else
1130                 echo "#! $xcat" > try
1131                 $eunicefix try
1132                 chmod +x try
1133                 ./try > today
1134                 if test -s today; then
1135                         sharpbang='#! '
1136                 else
1137                         sharpbang=': use '
1138                 fi
1139         fi
1140 else
1141         echo " "
1142         echo "Your $sh doesn't grok # comments--I will strip them later on."
1143         shsharp=false
1144         cd ..
1145         echo "exec grep -v '^[  ]*#'" >spitshell
1146         chmod +x spitshell
1147         $eunicefix spitshell
1148         spitshell=`pwd`/spitshell
1149         cd UU
1150         echo "I presume that if # doesn't work, #! won't work either!"
1151         sharpbang=': use '
1152 fi
1153 rm -f try today
1154
1155 : figure out how to guarantee sh startup
1156 case "$startsh" in
1157 '') startsh=${sharpbang}${sh} ;;
1158 *)
1159 esac
1160 cat >try <<EOSS
1161 $startsh
1162 set abc
1163 test "$?abc" != 1
1164 EOSS
1165
1166 chmod +x try
1167 $eunicefix try
1168 if ./try; then
1169         : echo "Yup, it does."
1170 else
1171         echo "Hmm... '$startsh' does not guarantee sh startup..."
1172         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1173 fi
1174 rm -f try
1175
1176
1177 : Save command line options in file UU/cmdline.opt for later use in
1178 : generating config.sh.
1179 cat > cmdline.opt <<EOSH
1180 # Configure command line arguments.
1181 config_arg0='$0'
1182 config_args='$*'
1183 config_argc=$#
1184 EOSH
1185 argn=1
1186 for arg in "$@"; do
1187         cat >>cmdline.opt <<EOSH
1188 config_arg$argn='$arg'
1189 EOSH
1190         argn=`expr $argn + 1`
1191 done
1192
1193 : produce awk script to parse command line options
1194 cat >options.awk <<'EOF'
1195 BEGIN {
1196         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1197
1198         len = length(optstr);
1199         for (i = 1; i <= len; i++) {
1200                 c = substr(optstr, i, 1);
1201                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1202                 if (a == ":") {
1203                         arg[c] = 1;
1204                         i++;
1205                 }
1206                 opt[c] = 1;
1207         }
1208 }
1209 {
1210         expect = 0;
1211         str = $0;
1212         if (substr(str, 1, 1) != "-") {
1213                 printf("'%s'\n", str);
1214                 next;
1215         }
1216         len = length($0);
1217         for (i = 2; i <= len; i++) {
1218                 c = substr(str, i, 1);
1219                 if (!opt[c]) {
1220                         printf("-%s\n", substr(str, i));
1221                         next;
1222                 }
1223                 printf("-%s\n", c);
1224                 if (arg[c]) {
1225                         if (i < len)
1226                                 printf("'%s'\n", substr(str, i + 1));
1227                         else
1228                                 expect = 1;
1229                         next;
1230                 }
1231         }
1232 }
1233 END {
1234         if (expect)
1235                 print "?";
1236 }
1237 EOF
1238
1239 : process the command line options
1240 set X `for arg in "$@"; do echo "X$arg"; done |
1241         sed -e s/X// | awk -f options.awk`
1242 eval "set $*"
1243 shift
1244 rm -f options.awk
1245
1246 : set up default values
1247 fastread=''
1248 reuseval=false
1249 config_sh=''
1250 alldone=''
1251 error=''
1252 silent=''
1253 extractsh=''
1254 override=''
1255 knowitall=''
1256 rm -f optdef.sh posthint.sh
1257 cat >optdef.sh <<EOS
1258 $startsh
1259 EOS
1260
1261
1262 : option parsing
1263 while test $# -gt 0; do
1264         case "$1" in
1265         -d) shift; fastread=yes;;
1266         -e) shift; alldone=cont;;
1267         -f)
1268                 shift
1269                 cd ..
1270                 if test -r "$1"; then
1271                         config_sh="$1"
1272                 else
1273                         echo "$me: cannot read config file $1." >&2
1274                         error=true
1275                 fi
1276                 cd UU
1277                 shift;;
1278         -h) shift; error=true;;
1279         -r) shift; reuseval=true;;
1280         -s) shift; silent=true; realsilent=true;;
1281         -E) shift; alldone=exit;;
1282         -K) shift; knowitall=true;;
1283         -O) shift; override=true;;
1284         -S) shift; silent=true; extractsh=true;;
1285         -D)
1286                 shift
1287                 case "$1" in
1288                 *=)
1289                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1290                         echo "$me: ignoring -D $1" >&2
1291                         ;;
1292                 *=*) echo "$1" | \
1293                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1294                 *) echo "$1='define'" >> optdef.sh;;
1295                 esac
1296                 shift
1297                 ;;
1298         -U)
1299                 shift
1300                 case "$1" in
1301                 *=) echo "$1" >> optdef.sh;;
1302                 *=*)
1303                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1304                         echo "$me: ignoring -U $1" >&2
1305                         ;;
1306                 *) echo "$1='undef'" >> optdef.sh;;
1307                 esac
1308                 shift
1309                 ;;
1310         -A)
1311             shift
1312             xxx=''
1313             yyy="$1"
1314             zzz=''
1315             uuu=undef
1316             case "$yyy" in
1317             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1318                  case "$zzz" in
1319                  *:*) zzz='' ;;
1320                  *)   xxx=append
1321                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1322                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1323                  esac
1324                  ;;
1325             esac
1326             case "$xxx" in
1327             '')  case "$yyy" in
1328                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1329                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1330                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1331                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1332                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1333                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1334                  esac
1335                  ;;       
1336             esac
1337             case "$xxx" in
1338             append)
1339                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1340             clear)
1341                 echo "$yyy=''"                  >> posthint.sh ;;
1342             define)
1343                 case "$zzz" in
1344                 '') zzz=define ;;
1345                 esac
1346                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1347             eval)
1348                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1349             prepend)
1350                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1351             undef)
1352                 case "$zzz" in
1353                 '') zzz="$uuu" ;;
1354                 esac
1355                 echo "$yyy=$zzz"                >> posthint.sh ;;
1356             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1357             esac
1358             shift
1359             ;;
1360         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1361             exit 0;;
1362         --) break;;
1363         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1364         *) break;;
1365         esac
1366 done
1367
1368 case "$error" in
1369 true)
1370         cat >&2 <<EOM
1371 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1372                  [-U symbol] [-U symbol=] [-A command:symbol...]
1373   -d : use defaults for all answers.
1374   -e : go on without questioning past the production of config.sh.
1375   -f : specify an alternate default configuration file.
1376   -h : print this help message and exit (with an error status).
1377   -r : reuse C symbols value if possible (skips costly nm extraction).
1378   -s : silent mode, only echoes questions and essential information.
1379   -D : define symbol to have some value:
1380          -D symbol         symbol gets the value 'define'
1381          -D symbol=value   symbol gets the value 'value'
1382   -E : stop at the end of questions, after having produced config.sh.
1383   -K : do not use unless you know what you are doing.
1384   -O : let -D and -U override definitions from loaded configuration file.
1385   -S : perform variable substitutions on all .SH files (can mix with -f)
1386   -U : undefine symbol:
1387          -U symbol    symbol gets the value 'undef'
1388          -U symbol=   symbol gets completely empty
1389   -A : manipulate symbol after the platform specific hints have been applied:
1390          -A symbol=value                append " "value to symbol
1391          -A append:symbol=value         append value to symbol
1392          -A define:symbol=value         define symbol to have value
1393          -A clear:symbol                define symbol to be ''
1394          -A define:symbol               define symbol to be 'define'
1395          -A eval:symbol=value           define symbol to be eval of value
1396          -A prepend:symbol=value        prepend value to symbol
1397          -A undef:symbol                define symbol to be 'undef'
1398          -A undef:symbol=               define symbol to be ''
1399   -V : print version number and exit (with a zero status).
1400 EOM
1401         exit 1
1402         ;;
1403 esac
1404
1405 : Sanity checks
1406 case "$fastread$alldone" in
1407 yescont|yesexit) ;;
1408 *)
1409         case "$extractsh" in
1410         true) ;;
1411         *)
1412                 if test ! -t 0; then
1413                         echo "Say 'sh Configure', not 'sh <Configure'"
1414                         exit 1
1415                 fi
1416                 ;;
1417         esac
1418         ;;
1419 esac
1420
1421 exec 4>&1
1422 case "$silent" in
1423 true) exec 1>/dev/null;;
1424 esac
1425
1426 : run the defines and the undefines, if any, but leave the file out there...
1427 touch optdef.sh
1428 . ./optdef.sh
1429 : create the posthint manipulation script and leave the file out there...
1430 touch posthint.sh
1431
1432 : set package name
1433 package=perl5
1434 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1435 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1436 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1437 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1438 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1439 esac
1440
1441 : Some greps do not return status, grrr.
1442 echo "grimblepritz" >grimble
1443 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1444         contains=contains
1445 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1446         contains=grep
1447 else
1448         contains=contains
1449 fi
1450 rm -f grimble
1451 : the following should work in any shell
1452 case "$contains" in
1453 contains*)
1454         echo " "
1455         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1456         cat >contains <<'EOSS'
1457 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1458 EOSS
1459 chmod +x contains
1460 esac
1461
1462 : Find the path to the source tree
1463 case "$src" in
1464 '') case "$0" in
1465     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1466          case "$src" in
1467          /*)    ;;
1468          .)     ;;
1469          *)     src=`cd ../$src && pwd` ;;
1470          esac
1471          ;;
1472     *)   src='.';;
1473     esac;;
1474 esac
1475 case "$src" in
1476 '')     src=/
1477         rsrc=/
1478         ;;
1479 /*) rsrc="$src";;
1480 *) rsrc="../$src";;
1481 esac
1482 if test -f $rsrc/Configure && \
1483         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1484 then
1485    : found it, so we are ok.
1486 else
1487         rsrc=''
1488         for src in . .. ../.. ../../.. ../../../..; do
1489                 if test -f ../$src/Configure && \
1490                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1491                 then
1492                         rsrc=../$src
1493                         break
1494                 fi
1495         done
1496 fi
1497 case "$rsrc" in
1498 '')
1499         cat <<EOM >&4
1500
1501 Sorry, I can't seem to locate the source dir for $package.  Please start
1502 Configure with an explicit path -- i.e. /some/path/Configure.
1503
1504 EOM
1505         exit 1
1506         ;;
1507 ../.)   rsrc='..';;
1508 *)
1509         echo " "
1510         echo "Sources for $package found in \"$src\"." >&4
1511         ;;
1512 esac
1513
1514 : script used to extract .SH files with variable substitutions
1515 cat >extract <<'EOS'
1516 PERL_CONFIG_SH=true
1517 echo "Doing variable substitutions on .SH files..."
1518 if test -f MANIFEST; then
1519         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1520 else
1521         echo "(Looking for .SH files under the source directory.)"
1522         set x `(cd $src; find . -name "*.SH" -print)`
1523 fi
1524 shift
1525 case $# in
1526 0) set x `(cd $src; echo *.SH)`; shift;;
1527 esac
1528 if test ! -f $src/$1; then
1529         shift
1530 fi
1531 mkdir_p='
1532 name=$1;
1533 create="";
1534 while test $name; do
1535         if test ! -d "$name"; then
1536                 create="$name $create";
1537                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1538                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1539         else
1540                 name="";
1541         fi;
1542 done;
1543 for file in $create; do
1544         mkdir $file;
1545 done
1546 '
1547 for file in $*; do
1548         case "$src" in
1549         ".")
1550                 case "$file" in
1551                 */*)
1552                         dir=`expr X$file : 'X\(.*\)/'`
1553                         file=`expr X$file : 'X.*/\(.*\)'`
1554                         (cd $dir && . ./$file)
1555                         ;;
1556                 *)
1557                         . ./$file
1558                         ;;
1559                 esac
1560                 ;;
1561         *)
1562                 case "$file" in
1563                 */*)
1564                         dir=`expr X$file : 'X\(.*\)/'`
1565                         file=`expr X$file : 'X.*/\(.*\)'`
1566                         (set x $dir; shift; eval $mkdir_p)
1567                         sh <$src/$dir/$file
1568                         ;;
1569                 *)
1570                         sh <$src/$file
1571                         ;;
1572                 esac
1573                 ;;
1574         esac
1575 done
1576 if test -f $src/config_h.SH; then
1577         if test ! -f config.h; then
1578         : oops, they left it out of MANIFEST, probably, so do it anyway.
1579         . $src/config_h.SH
1580         fi
1581 fi
1582 EOS
1583
1584 : extract files and exit if asked to do so
1585 case "$extractsh" in
1586 true)
1587         case "$realsilent" in
1588         true) ;;
1589         *) exec 1>&4;;
1590         esac
1591         case "$config_sh" in
1592         '') config_sh='config.sh';;
1593         esac
1594         echo " "
1595         echo "Fetching answers from $config_sh..."
1596         cd ..
1597         . $config_sh
1598         test "$override" && . ./optdef.sh
1599         echo " "
1600         . UU/extract
1601         rm -rf UU
1602         echo "Extraction done."
1603         exit 0
1604         ;;
1605 esac
1606
1607 : Eunice requires " " instead of "", can you believe it
1608 echo " "
1609 : Here we go...
1610 echo "Beginning of configuration questions for $package."
1611
1612 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1613
1614 : first determine how to suppress newline on echo command
1615 echo " "
1616 echo "Checking echo to see how to suppress newlines..."
1617 (echo "hi there\c" ; echo " ") >.echotmp
1618 if $contains c .echotmp >/dev/null 2>&1 ; then
1619         echo "...using -n."
1620         n='-n'
1621         c=''
1622 else
1623         cat <<'EOM'
1624 ...using \c
1625 EOM
1626         n=''
1627         c='\c'
1628 fi
1629 echo $n "The star should be here-->$c"
1630 echo '*'
1631 rm -f .echotmp
1632
1633 : Now test for existence of everything in MANIFEST
1634 echo " "
1635 if test -f $rsrc/MANIFEST; then
1636         echo "First let's make sure your kit is complete.  Checking..." >&4
1637         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1638         rm -f missing
1639         tmppwd=`pwd`
1640         for filelist in x??; do
1641                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1642         done
1643         if test -s missing; then
1644                 cat missing >&4
1645                 cat >&4 <<'EOM'
1646
1647 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1648
1649 You have the option of continuing the configuration process, despite the
1650 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1651 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1652 and contact the author (perlbug@perl.org).
1653
1654 EOM
1655                 echo $n "Continue? [n] $c" >&4
1656                 read ans
1657                 case "$ans" in
1658                 y*)
1659                         echo "Continuing..." >&4
1660                         rm -f missing
1661                         ;;
1662                 *)
1663                         echo "ABORTING..." >&4
1664                         kill $$
1665                         ;;
1666                 esac
1667         else
1668                 echo "Looks good..."
1669         fi
1670 else
1671         echo "There is no MANIFEST file.  I hope your kit is complete !"
1672 fi
1673 rm -f missing x??
1674
1675 echo " "
1676 : Find the appropriate value for a newline for tr
1677 if test -n "$DJGPP"; then
1678        trnl='\012'
1679 fi
1680 if test X"$trnl" = X; then
1681         case "`echo foo|tr '\n' x 2>/dev/null`" in
1682         foox) trnl='\n' ;;
1683         esac
1684 fi
1685 if test X"$trnl" = X; then
1686         case "`echo foo|tr '\012' x 2>/dev/null`" in
1687         foox) trnl='\012' ;;
1688         esac
1689 fi
1690 if test X"$trnl" = X; then
1691         cat <<EOM >&2
1692
1693 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1694
1695 EOM
1696         exit 1
1697 fi
1698
1699 : compute the number of columns on the terminal for proper question formatting
1700 case "$COLUMNS" in
1701 '') COLUMNS='80';;
1702 esac
1703
1704 : set up the echo used in my read
1705 myecho="case \"\$xxxm\" in
1706 '') echo $n \"\$rp $c\" >&4;;
1707 *) case \"\$rp\" in
1708         '') echo $n \"[\$xxxm] $c\";;
1709         *)
1710                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1711                         echo \"\$rp\" >&4
1712                         echo $n \"[\$xxxm] $c\" >&4
1713                 else
1714                         echo $n \"\$rp [\$xxxm] $c\" >&4
1715                 fi
1716                 ;;
1717         esac;;
1718 esac"
1719
1720 : now set up to do reads with possible shell escape and default assignment
1721 cat <<EOSC >myread
1722 $startsh
1723 xxxm=\$dflt
1724 $myecho
1725 ans='!'
1726 case "\$fastread" in
1727 yes) case "\$dflt" in
1728         '') ;;
1729         *) ans='';
1730                 case "\$silent-\$rp" in
1731                 true-) ;;
1732                 *) echo " " >&4;;
1733                 esac;;
1734         esac;;
1735 *) case "\$silent" in
1736         true) case "\$rp" in
1737                 '') ans='';;
1738                 esac;;
1739         esac;;
1740 esac
1741 while expr "X\$ans" : "X!" >/dev/null; do
1742         read answ
1743         set x \$xxxm
1744         shift
1745         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1746         case  "\$answ" in
1747         "!")
1748                 sh 1>&4
1749                 echo " "
1750                 $myecho
1751                 ;;
1752         !*)
1753                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1754                 shift
1755                 sh 1>&4 -c "\$*"
1756                 echo " "
1757                 $myecho
1758                 ;;
1759         "\$ans")
1760                 case "\$ans" in
1761                 \\&*)
1762                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1763                         shift
1764                         case "\$1" in
1765                         -d)
1766                                 fastread=yes
1767                                 echo "(OK, I'll run with -d after this question.)" >&4
1768                                 ;;
1769                         -*)
1770                                 echo "*** Sorry, \$1 not supported yet." >&4
1771                                 ;;
1772                         esac
1773                         $myecho
1774                         ans=!
1775                         ;;
1776                 esac;;
1777         *)
1778                 case "\$aok" in
1779                 y)
1780                         echo "*** Substitution done -- please confirm."
1781                         xxxm="\$ans"
1782                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1783                         xxxm="\$ans"
1784                         ans=!
1785                         ;;
1786                 *)
1787                         echo "*** Error -- try again."
1788                         ans=!
1789                         ;;
1790                 esac
1791                 $myecho
1792                 ;;
1793         esac
1794         case "\$ans\$xxxm\$nostick" in
1795         '')
1796                 ans=!
1797                 $myecho
1798                 ;;
1799         esac
1800 done
1801 case "\$ans" in
1802 '') ans="\$xxxm";;
1803 esac
1804 EOSC
1805
1806 : create .config dir to save info across Configure sessions
1807 test -d ../.config || mkdir ../.config
1808 cat >../.config/README <<EOF
1809 This directory created by Configure to save information that should
1810 persist across sessions for $package.
1811
1812 You may safely delete it if you wish.
1813 EOF
1814
1815 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1816 case "$usedevel" in
1817 $define|true|[yY]*) ;;
1818 *) case "$xversion" in
1819    *[13579])
1820         cat >&4 <<EOH
1821 *** WHOA THERE!!! ***
1822
1823     This is an UNSTABLE DEVELOPMENT release.
1824     The version of this $package distribution is $xversion, that is, odd,
1825     (as opposed to even) and that signifies a development release.
1826     If you want a maintenance release, you want an even-numbered version.
1827
1828     Do ***NOT*** install this into production use.
1829     Data corruption and crashes are possible.
1830
1831     It is most seriously suggested that you do not continue any further
1832     unless you want to help in developing and debugging Perl.
1833
1834     If you *still* want to build perl, you can answer 'y' now,
1835     or pass -Dusedevel to Configure.
1836
1837 EOH
1838         rp='Do you really want to continue?'
1839         dflt='n'
1840         . ./myread
1841         case "$ans" in
1842         [yY]) echo >&4 "Okay, continuing."
1843               usedevel="$define" ;;
1844         *) echo >&4 "Okay, bye."
1845            exit 1
1846            ;;
1847         esac
1848         ;;
1849     esac
1850     ;;
1851 esac
1852 case "$usedevel" in
1853 $define|true|[yY]*)
1854         case "$versiononly" in
1855         '') versiononly="$define" ;;
1856         esac
1857         case "$installusrbinperl" in
1858         '') installusrbinperl="$undef" ;;
1859         esac
1860         ;;
1861 esac
1862
1863 : general instructions
1864 needman=true
1865 firsttime=true
1866 user=`(logname) 2>/dev/null`
1867 case "$user" in
1868 '') user=`whoami 2>&1`;;
1869 esac
1870 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1871         firsttime=false
1872         echo " "
1873         rp='Would you like to see the instructions?'
1874         dflt=n
1875         . ./myread
1876         case "$ans" in
1877         [yY]*) ;;
1878         *) needman=false;;
1879         esac
1880 fi
1881 if $needman; then
1882         cat <<EOH
1883
1884 This installation shell script will examine your system and ask you questions
1885 to determine how the perl5 package should be installed. If you get
1886 stuck on a question, you may use a ! shell escape to start a subshell or
1887 execute a command.  Many of the questions will have default answers in square
1888 brackets; typing carriage return will give you the default.
1889
1890 On some of the questions which ask for file or directory names you are allowed
1891 to use the ~name construct to specify the login directory belonging to "name",
1892 even if you don't have a shell which knows about that.  Questions where this is
1893 allowed will be marked "(~name ok)".
1894
1895 EOH
1896         rp=''
1897         dflt='Type carriage return to continue'
1898         . ./myread
1899         cat <<'EOH'
1900
1901 The prompter used in this script allows you to use shell variables and
1902 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1903 in the default answer, as if the default line was a set of arguments given to a
1904 script shell.  This means you may also use $* to repeat the whole default line,
1905 so you do not have to re-type everything to add something to the default.
1906
1907 Everytime there is a substitution, you will have to confirm.  If there is an
1908 error (e.g. an unmatched backtick), the default answer will remain unchanged
1909 and you will be prompted again.
1910
1911 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1912 the questions and use the computed defaults (or the previous answers if there
1913 was already a config.sh file). Type 'Configure -h' for a list of options.
1914 You may also start interactively and then answer '& -d' at any prompt to turn
1915 on the non-interactive behaviour for the remainder of the execution.
1916
1917 EOH
1918         . ./myread
1919         cat <<EOH
1920
1921 Much effort has been expended to ensure that this shell script will run on any
1922 Unix system.  If despite that it blows up on yours, your best bet is to edit
1923 Configure and run it again.  If you can't run Configure for some reason,
1924 you'll have to generate a config.sh file by hand.  Whatever problems you
1925 have, let me (perlbug@perl.org) know how I blew it.
1926
1927 This installation script affects things in two ways:
1928
1929 1) it may do direct variable substitutions on some of the files included
1930    in this kit.
1931 2) it builds a config.h file for inclusion in C programs.  You may edit
1932    any of these files as the need arises after running this script.
1933
1934 If you make a mistake on a question, there is no easy way to back up to it
1935 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1936 files.  Configure will offer to let you do this before it runs the SH files.
1937
1938 EOH
1939         dflt='Type carriage return to continue'
1940         . ./myread
1941         case "$firsttime" in
1942         true) echo $user >>../.config/instruct;;
1943         esac
1944 fi
1945
1946 : find out where common programs are
1947 echo " "
1948 echo "Locating common programs..." >&4
1949 cat <<EOSC >loc
1950 $startsh
1951 case \$# in
1952 0) exit 1;;
1953 esac
1954 thing=\$1
1955 shift
1956 dflt=\$1
1957 shift
1958 for dir in \$*; do
1959         case "\$thing" in
1960         .)
1961         if test -d \$dir/\$thing; then
1962                 echo \$dir
1963                 exit 0
1964         fi
1965         ;;
1966         *)
1967         for thisthing in \$dir/\$thing; do
1968                 : just loop through to pick last item
1969         done
1970         if test -f \$thisthing; then
1971                 echo \$thisthing
1972                 exit 0
1973         elif test -f \$dir/\$thing.exe; then
1974                 if test -n "$DJGPP"; then
1975                         echo \$dir/\$thing.exe
1976                 else
1977                         : on Eunice apparently
1978                         echo \$dir/\$thing
1979                 fi
1980                 exit 0
1981         fi
1982         ;;
1983         esac
1984 done
1985 echo \$dflt
1986 exit 1
1987 EOSC
1988 chmod +x loc
1989 $eunicefix loc
1990 loclist="
1991 awk
1992 cat
1993 comm
1994 cp
1995 echo
1996 expr
1997 grep
1998 ls
1999 make
2000 mkdir
2001 rm
2002 sed
2003 sort
2004 touch
2005 tr
2006 uniq
2007 "
2008 trylist="
2009 Mcc
2010 ar
2011 bison
2012 byacc
2013 cpp
2014 csh
2015 date
2016 egrep
2017 gzip
2018 less
2019 ln
2020 more
2021 nm
2022 nroff
2023 pg
2024 test
2025 uname
2026 zip
2027 "
2028 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2029 pth="$pth /lib /usr/lib"
2030 for file in $loclist; do
2031         eval xxx=\$$file
2032         case "$xxx" in
2033         /*|?:[\\/]*)
2034                 if test -f "$xxx"; then
2035                         : ok
2036                 else
2037                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2038                         xxx=`./loc $file $file $pth`
2039                 fi
2040                 ;;
2041         '') xxx=`./loc $file $file $pth`;;
2042         *) xxx=`./loc $xxx $xxx $pth`;;
2043         esac
2044         eval $file=$xxx
2045         eval _$file=$xxx
2046         case "$xxx" in
2047         /*)
2048                 echo $file is in $xxx.
2049                 ;;
2050         ?:[\\/]*)
2051                 echo $file is in $xxx.
2052                 ;;
2053         *)
2054                 echo "I don't know where '$file' is, and my life depends on it." >&4
2055                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2056                 exit 1
2057                 ;;
2058         esac
2059 done
2060 echo " "
2061 echo "Don't worry if any of the following aren't found..."
2062 say=offhand
2063 for file in $trylist; do
2064         eval xxx=\$$file
2065         case "$xxx" in
2066         /*|?:[\\/]*)
2067                 if test -f "$xxx"; then
2068                         : ok
2069                 else
2070                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2071                         xxx=`./loc $file $file $pth`
2072                 fi
2073                 ;;
2074         '') xxx=`./loc $file $file $pth`;;
2075         *) xxx=`./loc $xxx $xxx $pth`;;
2076         esac
2077         eval $file=$xxx
2078         eval _$file=$xxx
2079         case "$xxx" in
2080         /*)
2081                 echo $file is in $xxx.
2082                 ;;
2083         ?:[\\/]*)
2084                 echo $file is in $xxx.
2085                 ;;
2086         *)
2087                 echo "I don't see $file out there, $say."
2088                 say=either
2089                 ;;
2090         esac
2091 done
2092 case "$egrep" in
2093 egrep)
2094         echo "Substituting grep for egrep."
2095         egrep=$grep
2096         ;;
2097 esac
2098 case "$ln" in
2099 ln)
2100         echo "Substituting cp for ln."
2101         ln=$cp
2102         ;;
2103 esac
2104 case "$test" in
2105 test)
2106         echo "Hopefully test is built into your sh."
2107         ;;
2108 *)
2109         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2110                 echo "Using the test built into your sh."
2111                 test=test
2112                 _test=test
2113         fi
2114         ;;
2115 esac
2116 case "$echo" in
2117 echo)
2118         echo "Hopefully echo is built into your sh."
2119         ;;
2120 '') ;;
2121 *)
2122         echo " "
2123 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2124         $echo $n "hi there$c" >foo1
2125         echo $n "hi there$c" >foo2
2126         if cmp foo1 foo2 >/dev/null 2>&1; then
2127                 echo "They are compatible.  In fact, they may be identical."
2128         else
2129                 case "$n" in
2130                 '-n') n='' c='\c';;
2131                 *) n='-n' c='';;
2132                 esac
2133                 cat <<FOO
2134 They are not compatible!  You are probably running ksh on a non-USG system.
2135 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2136 have echo built in and we may have to run some Bourne shell scripts.  That
2137 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2138
2139 FOO
2140                 $echo $n "The star should be here-->$c"
2141                 $echo "*"
2142         fi
2143         $rm -f foo1 foo2
2144         ;;
2145 esac
2146
2147 cat <<EOS >checkcc
2148 $startsh
2149 EOS
2150 cat <<'EOSC' >>checkcc
2151 case "$cc" in
2152 '') ;;
2153 *)  $rm -f try try.*
2154     $cat >try.c <<EOM
2155 int main(int argc, char *argv[]) {
2156   return 0;
2157 }
2158 EOM
2159     if $cc -o try $ccflags $ldflags try.c; then
2160        :
2161     else
2162         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2163         despair=yes
2164         trygcc=yes
2165         case "$cc" in
2166         *gcc*) trygcc=no ;;
2167         esac
2168         case "`$cc -v -c try.c 2>&1`" in
2169         *gcc*) trygcc=no ;;
2170         esac
2171         if $test X"$trygcc" = Xyes; then
2172             if gcc -o try -c try.c; then
2173                 echo " "
2174                 echo "You seem to have a working gcc, though." >&4
2175                 rp="Would you like to use it?"
2176                 dflt=y
2177                 if $test -f myread; then
2178                     . ./myread
2179                 else
2180                     if $test -f UU/myread; then
2181                         . ./UU/myread
2182                     else
2183                         echo "Cannot find myread, sorry.  Aborting." >&2
2184                         exit 1
2185                     fi
2186                 fi  
2187                 case "$ans" in
2188                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2189                 esac
2190             fi
2191         fi
2192         if $test X"$despair" = Xyes; then
2193             $cat >&4 <<EOM
2194 You need to find a working C compiler.
2195 Either (purchase and) install the C compiler supplied by your OS vendor,
2196 or for a free C compiler try http://gcc.gnu.org/
2197 I cannot continue any further, aborting.
2198 EOM
2199             exit 1
2200         fi
2201     fi
2202     $rm -f try try.*
2203     ;;
2204 esac
2205 EOSC
2206
2207 : determine whether symbolic links are supported
2208 echo " "
2209 $touch blurfl
2210 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2211         echo "Symbolic links are supported." >&4
2212         lns="$ln -s"
2213 else
2214         echo "Symbolic links are NOT supported." >&4
2215         lns="$ln"
2216 fi
2217 $rm -f blurfl sym
2218
2219 : determine whether symbolic links are supported
2220 echo " "
2221 case "$lns" in
2222 *"ln -s")
2223         echo "Checking how to test for symbolic links..." >&4
2224         $lns blurfl sym
2225         if $test "X$issymlink" = X; then
2226                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2227                 if test $? = 0; then
2228                         issymlink="test -h"
2229                 fi              
2230         fi
2231         if $test "X$issymlink" = X; then
2232                 if  $test -h >/dev/null 2>&1; then
2233                         issymlink="$test -h"
2234                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2235                 fi              
2236         fi
2237         if $test "X$issymlink" = X; then
2238                 if $test -L sym 2>/dev/null; then
2239                         issymlink="$test -L"
2240                 fi
2241         fi
2242         if $test "X$issymlink" != X; then
2243                 echo "You can test for symbolic links with '$issymlink'." >&4
2244         else
2245                 echo "I do not know how you can test for symbolic links." >&4
2246         fi
2247         $rm -f blurfl sym
2248         ;;
2249 *)      echo "No symbolic links, so not testing for their testing..." >&4
2250         ;;
2251 esac
2252 echo " "
2253
2254
2255 case "$mksymlinks" in
2256 $define|true|[yY]*)
2257         case "$src" in
2258         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2259                 exit 1
2260                 ;;
2261         *)      case "$lns:$issymlink" in
2262                 *"ln -s:"*"test -"?)
2263                         echo "Creating the symbolic links..." >&4
2264                         echo "(First creating the subdirectories...)" >&4
2265                         cd ..
2266                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2267                                 read directory
2268                                 test -z "$directory" && break
2269                                 mkdir -p $directory
2270                         done
2271                         # Sanity check 1.
2272                         if test ! -d t/base; then
2273                                 echo "Failed to create the subdirectories.  Aborting." >&4
2274                                 exit 1
2275                         fi
2276                         echo "(Then creating the symlinks...)" >&4
2277                         awk '{print $1}' $src/MANIFEST | while true; do
2278                                 read filename
2279                                 test -z "$filename" && break
2280                                 if test -f $filename; then
2281                                         if $issymlink $filename; then
2282                                                 rm -f $filename
2283                                         fi
2284                                 fi
2285                                 if test -f $filename; then
2286                                         echo "$filename already exists, not symlinking."
2287                                 else
2288                                         ln -s $src/$filename $filename
2289                                 fi
2290                         done
2291                         # Sanity check 2.
2292                         if test ! -f t/base/commonsense.t; then
2293                                 echo "Failed to create the symlinks.  Aborting." >&4
2294                                 exit 1
2295                         fi
2296                         cd UU
2297                         ;;
2298                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2299                         ;;
2300                 esac
2301                 ;;
2302         esac
2303         ;;
2304 esac
2305
2306 : see whether [:lower:] and [:upper:] are supported character classes
2307 echo " "
2308 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2309 ABYZ)
2310         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2311         up='[:upper:]'
2312         low='[:lower:]'
2313         ;;
2314 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2315         # (0xc9 and 0xd1), therefore that is a nice testing point.
2316         if test "X$up" = X -o "X$low" = X; then
2317             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2318             ij) up='[A-Z]'
2319                 low='[a-z]'
2320                 ;;
2321             esac
2322         fi
2323         if test "X$up" = X -o "X$low" = X; then
2324             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2325             ij) up='A-Z'
2326                 low='a-z'
2327                 ;;
2328             esac
2329         fi
2330         if test "X$up" = X -o "X$low" = X; then
2331             case "`echo IJ | od -x 2>/dev/null`" in
2332             *C9D1*|*c9d1*)
2333                 echo "Hey, this might be EBCDIC." >&4
2334                 if test "X$up" = X -o "X$low" = X; then
2335                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2336                     ij) up='[A-IJ-RS-Z]'
2337                         low='[a-ij-rs-z]'
2338                         ;;
2339                     esac
2340                 fi
2341                 if test "X$up" = X -o "X$low" = X; then
2342                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2343                     ij) up='A-IJ-RS-Z'
2344                         low='a-ij-rs-z'
2345                         ;;
2346                     esac
2347                 fi
2348                 ;;
2349             esac
2350         fi
2351 esac
2352 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2353 ij)
2354     echo "Using $up and $low to convert case." >&4
2355     ;;
2356 *)
2357     echo "I don't know how to translate letters from upper to lower case." >&4
2358     echo "Your tr is not acting any way I know of." >&4
2359     exit 1
2360     ;;
2361 esac
2362 : set up the translation script tr, must be called with ./tr of course
2363 cat >tr <<EOSC
2364 $startsh
2365 case "\$1\$2" in
2366 '[A-Z][a-z]') exec $tr '$up' '$low';;
2367 '[a-z][A-Z]') exec $tr '$low' '$up';;
2368 esac
2369 exec $tr "\$@"
2370 EOSC
2371 chmod +x tr
2372 $eunicefix tr
2373
2374 : Try to determine whether config.sh was made on this system
2375 case "$config_sh" in
2376 '')
2377 myuname=`$uname -a 2>/dev/null`
2378 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2379 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2380 # because the A-Z/a-z are not consecutive.
2381 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2382         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2383 newmyuname="$myuname"
2384 dflt=n
2385 case "$knowitall" in
2386 '')
2387         if test -f ../config.sh; then
2388                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2389                         eval "`grep myuname= ../config.sh`"
2390                 fi
2391                 if test "X$myuname" = "X$newmyuname"; then
2392                         dflt=y
2393                 fi
2394         fi
2395         ;;
2396 *) dflt=y;;
2397 esac
2398
2399 : Get old answers from old config file if Configure was run on the
2400 : same system, otherwise use the hints.
2401 hint=default
2402 cd ..
2403 if test -f config.sh; then
2404         echo " "
2405         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2406         . UU/myread
2407         case "$ans" in
2408         n*|N*) echo "OK, I'll ignore it."
2409                 mv config.sh config.sh.old
2410                 myuname="$newmyuname"
2411                 ;;
2412         *)  echo "Fetching default answers from your old config.sh file..." >&4
2413                 tmp_n="$n"
2414                 tmp_c="$c"
2415                 tmp_sh="$sh"
2416                 . ./config.sh
2417                 cp config.sh UU
2418                 n="$tmp_n"
2419                 c="$tmp_c"
2420                 : Older versions did not always set $sh.  Catch re-use of such
2421                 : an old config.sh.
2422                 case "$sh" in
2423                 '') sh="$tmp_sh" ;;
2424                 esac
2425                 hint=previous
2426                 ;;
2427         esac
2428 fi
2429 . ./UU/checkcc
2430 if test ! -f config.sh; then
2431         $cat <<EOM
2432
2433 First time through, eh?  I have some defaults handy for some systems
2434 that need some extra help getting the Configure answers right:
2435
2436 EOM
2437         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2438         dflt=''
2439         : Half the following guesses are probably wrong... If you have better
2440         : tests or hints, please send them to perlbug@perl.org
2441         : The metaconfig authors would also appreciate a copy...
2442         $test -f /irix && osname=irix
2443         $test -f /xenix && osname=sco_xenix
2444         $test -f /dynix && osname=dynix
2445         $test -f /dnix && osname=dnix
2446         $test -f /lynx.os && osname=lynxos
2447         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2448         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2449         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2450         $test -f /bin/mips && /bin/mips && osname=mips
2451         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2452                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2453         $test -d /usr/apollo/bin && osname=apollo
2454         $test -f /etc/saf/_sactab && osname=svr4
2455         $test -d /usr/include/minix && osname=minix
2456         if $test -d /MachTen -o -d /MachTen_Folder; then
2457                 osname=machten
2458                 if $test -x /sbin/version; then
2459                         osvers=`/sbin/version | $awk '{print $2}' |
2460                         $sed -e 's/[A-Za-z]$//'`
2461                 elif $test -x /usr/etc/version; then
2462                         osvers=`/usr/etc/version | $awk '{print $2}' |
2463                         $sed -e 's/[A-Za-z]$//'`
2464                 else
2465                         osvers="$2.$3"
2466                 fi
2467         fi
2468
2469         $test -f /sys/posix.dll &&
2470                 $test -f /usr/bin/what &&
2471                 set X `/usr/bin/what /sys/posix.dll` &&
2472                 $test "$3" = UWIN &&
2473                 osname=uwin &&
2474                 osvers="$5"
2475
2476         if $test -f $uname; then
2477                 set X $myuname
2478                 shift
2479
2480                 case "$5" in
2481                 fps*) osname=fps ;;
2482                 mips*)
2483                         case "$4" in
2484                         umips) osname=umips ;;
2485                         *) osname=mips ;;
2486                         esac;;
2487                 [23]100) osname=mips ;;
2488                 next*) osname=next ;;
2489                 i386*)
2490                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2491                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2492                                 osname='sco'
2493                                 osvers=$tmp
2494                         elif $test -f /etc/kconfig; then
2495                                 osname=isc
2496                                 if test "$lns" = "$ln -s"; then
2497                                         osvers=4
2498                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2499                                         osvers=3
2500                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2501                                         osvers=2
2502                                 fi
2503                         fi
2504                         tmp=''
2505                         ;;
2506                 pc*)
2507                         if test -n "$DJGPP"; then
2508                                 osname=dos
2509                                 osvers=djgpp
2510                         fi
2511                         ;;
2512                 esac
2513
2514                 case "$1" in
2515                 aix) osname=aix
2516                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2517                         case "$tmp" in
2518                         'not found') osvers="$4"."$3" ;;
2519                         '<3240'|'<>3240') osvers=3.2.0 ;;
2520                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2521                         '=3250'|'>3250') osvers=3.2.5 ;;
2522                         *) osvers=$tmp;;
2523                         esac
2524                         ;;
2525                 bsd386) osname=bsd386
2526                         osvers=`$uname -r`
2527                         ;;
2528                 cygwin*) osname=cygwin
2529                         osvers="$3"
2530                         ;;
2531                 *dc.osx) osname=dcosx
2532                         osvers="$3"
2533                         ;;
2534                 dnix) osname=dnix
2535                         osvers="$3"
2536                         ;;
2537                 domainos) osname=apollo
2538                         osvers="$3"
2539                         ;;
2540                 dgux) osname=dgux 
2541                         osvers="$3"
2542                         ;;
2543                 dynixptx*) osname=dynixptx
2544                         osvers=`echo "$4"|sed 's/^v//'`
2545                         ;;
2546                 freebsd) osname=freebsd 
2547                         osvers="$3" ;;
2548                 genix) osname=genix ;;
2549                 hp*) osname=hpux 
2550                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2551                         ;;
2552                 irix*) osname=irix
2553                         case "$3" in
2554                         4*) osvers=4 ;;
2555                         5*) osvers=5 ;;
2556                         *)      osvers="$3" ;;
2557                         esac
2558                         ;;
2559                 linux) osname=linux
2560                         case "$3" in
2561                         *)      osvers="$3" ;;
2562                         esac
2563                         ;;
2564                 MiNT) osname=mint
2565                         ;;
2566                 netbsd*) osname=netbsd
2567                         osvers="$3"
2568                         ;;
2569                 news-os) osvers="$3"
2570                         case "$3" in
2571                         4*) osname=newsos4 ;;
2572                         *) osname=newsos ;;
2573                         esac
2574                         ;;
2575                 next*) osname=next ;;
2576                 nonstop-ux) osname=nonstopux ;;
2577                 POSIX-BC | posix-bc ) osname=posix-bc
2578                         osvers="$3"
2579                         ;;
2580                 powerux | power_ux | powermax_os | powermaxos | \
2581                 powerunix | power_unix) osname=powerux
2582                         osvers="$3"
2583                         ;;
2584                 qnx) osname=qnx
2585                         osvers="$4"
2586                         ;;
2587                 solaris) osname=solaris
2588                         case "$3" in
2589                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2590                         *)      osvers="$3" ;;
2591                         esac
2592                         ;;
2593                 sunos) osname=sunos
2594                         case "$3" in
2595                         5*) osname=solaris
2596                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2597                         *)      osvers="$3" ;;
2598                         esac
2599                         ;;
2600                 titanos) osname=titanos
2601                         case "$3" in
2602                         1*) osvers=1 ;;
2603                         2*) osvers=2 ;;
2604                         3*) osvers=3 ;;
2605                         4*) osvers=4 ;;
2606                         *)      osvers="$3" ;;
2607                         esac
2608                         ;;
2609                 ultrix) osname=ultrix
2610                         osvers="$3"
2611                         ;;
2612                 osf1|mls+)      case "$5" in
2613                                 alpha)
2614                                         osname=dec_osf
2615                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2616                                         case "$osvers" in
2617                                         [1-9].[0-9]*) ;;
2618                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2619                                         esac
2620                                         ;;
2621                         hp*)    osname=hp_osf1  ;;
2622                         mips)   osname=mips_osf1 ;;
2623                         esac
2624                         ;;
2625                 unixware) osname=svr5
2626                         osvers="$4"
2627                         ;;
2628                 uts) osname=uts
2629                         osvers="$3"
2630                         ;;
2631                 $2) case "$osname" in
2632                         *isc*) ;;
2633                         *freebsd*) ;;
2634                         svr*)
2635                                 : svr4.x or possibly later
2636                                 case "svr$3" in 
2637                                 ${osname}*)
2638                                         osname=svr$3
2639                                         osvers=$4
2640                                         ;;
2641                                 esac
2642                                 case "$osname" in
2643                                 svr4.0)
2644                                         : Check for ESIX
2645                                         if test -f /stand/boot ; then
2646                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2647                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2648                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2649                                                         if test -n "$isesix"; then
2650                                                                 osname=esix4
2651                                                         fi
2652                                                 fi
2653                                         fi
2654                                         ;;
2655                                 esac
2656                                 ;;
2657                         *)      if test -f /etc/systemid; then
2658                                         osname=sco
2659                                         set `echo $3 | $sed 's/\./ /g'` $4
2660                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2661                                                 osvers=$1.$2.$3
2662                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2663                                                 osvers=$1.$2
2664                                         elif $test -f $src/hints/sco_$1.sh; then
2665                                                 osvers=$1
2666                                         fi
2667                                 else
2668                                         case "$osname" in
2669                                         '') : Still unknown.  Probably a generic Sys V.
2670                                                 osname="sysv"
2671                                                 osvers="$3"
2672                                                 ;;
2673                                         esac
2674                                 fi
2675                                 ;;
2676                         esac
2677                         ;;
2678                 *)      case "$osname" in
2679                         '') : Still unknown.  Probably a generic BSD.
2680                                 osname="$1"
2681                                 osvers="$3"
2682                                 ;;
2683                         esac
2684                         ;;
2685                 esac
2686         else
2687                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2688                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2689                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2690                                 osname=news_os
2691                         fi
2692                         $rm -f UU/kernel.what
2693                 elif test -d c:/.; then
2694                         set X $myuname
2695                         osname=os2
2696                         osvers="$5"
2697                 fi
2698         fi
2699         
2700         : Now look for a hint file osname_osvers, unless one has been
2701         : specified already.
2702         case "$hintfile" in
2703         ''|' ')
2704                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2705                 : Also try without trailing minor version numbers.
2706                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2707                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2708                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2709                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2710                 case "$file" in
2711                 '') dflt=none ;;
2712                 *)  case "$osvers" in
2713                         '') dflt=$file
2714                                 ;;
2715                         *)  if $test -f $src/hints/$file.sh ; then
2716                                         dflt=$file
2717                                 elif $test -f $src/hints/$xfile.sh ; then
2718                                         dflt=$xfile
2719                                 elif $test -f $src/hints/$xxfile.sh ; then
2720                                         dflt=$xxfile
2721                                 elif $test -f $src/hints/$xxxfile.sh ; then
2722                                         dflt=$xxxfile
2723                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2724                                         dflt=$xxxxfile
2725                                 elif $test -f "$src/hints/${osname}.sh" ; then
2726                                         dflt="${osname}"
2727                                 else
2728                                         dflt=none
2729                                 fi
2730                                 ;;
2731                         esac
2732                         ;;
2733                 esac
2734                 if $test -f Policy.sh ; then
2735                         case "$dflt" in
2736                         *Policy*) ;;
2737                         none) dflt="Policy" ;;
2738                         *) dflt="Policy $dflt" ;;
2739                         esac
2740                 fi
2741                 ;;
2742         *)
2743                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2744                 ;;
2745         esac
2746
2747         if $test -f Policy.sh ; then
2748                 $cat <<EOM
2749
2750 There's also a Policy hint file available, which should make the
2751 site-specific (policy) questions easier to answer.
2752 EOM
2753
2754         fi
2755
2756         $cat <<EOM
2757
2758 You may give one or more space-separated answers, or "none" if appropriate.
2759 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2760 is a good thing.  DO NOT give a wrong version or a wrong OS.
2761
2762 EOM
2763
2764         rp="Which of these apply, if any?"
2765         . UU/myread
2766         tans=$ans
2767         for file in $tans; do
2768                 if $test X$file = XPolicy -a -f Policy.sh; then
2769                         . Policy.sh
2770                         $cat Policy.sh >> UU/config.sh
2771                 elif $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$tans = X -o X$tans = Xnone ; then
2775                         : nothing
2776                 else
2777                         : Give one chance to correct a possible typo.
2778                         echo "$file.sh does not exist"
2779                         dflt=$file
2780                         rp="hint to use instead?"
2781                         . UU/myread
2782                         for file in $ans; do
2783                                 if $test -f "$src/hints/$file.sh"; then
2784                                         . $src/hints/$file.sh
2785                                         $cat $src/hints/$file.sh >> UU/config.sh
2786                                 elif $test X$ans = X -o X$ans = Xnone ; then
2787                                         : nothing
2788                                 else
2789                                         echo "$file.sh does not exist -- ignored."
2790                                 fi
2791                         done
2792                 fi
2793         done
2794
2795         hint=recommended
2796         : Remember our hint file for later.
2797         if $test -f "$src/hints/$file.sh" ; then
2798                 hintfile="$file"
2799         else
2800                 hintfile=''
2801         fi
2802 fi
2803 cd UU
2804 ;;
2805 *)
2806         echo " "
2807         echo "Fetching default answers from $config_sh..." >&4
2808         tmp_n="$n"
2809         tmp_c="$c"
2810         cd ..
2811         cp $config_sh config.sh 2>/dev/null
2812         chmod +w config.sh
2813         . ./config.sh
2814         cd UU
2815         cp ../config.sh .
2816         n="$tmp_n"
2817         c="$tmp_c"
2818         hint=previous
2819         ;;
2820 esac
2821 test "$override" && . ./optdef.sh
2822
2823 : Restore computed paths
2824 for file in $loclist $trylist; do
2825         eval $file="\$_$file"
2826 done
2827
2828 cat << EOM
2829
2830 Configure uses the operating system name and version to set some defaults.
2831 The default value is probably right if the name rings a bell. Otherwise,
2832 since spelling matters for me, either accept the default or answer "none"
2833 to leave it blank.
2834
2835 EOM
2836 case "$osname" in
2837         ''|' ')
2838                 case "$hintfile" in
2839                 ''|' '|none) dflt=none ;;
2840                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2841                 esac
2842                 ;;
2843         *) dflt="$osname" ;;
2844 esac
2845 rp="Operating system name?"
2846 . ./myread
2847 case "$ans" in
2848 none)  osname='' ;;
2849 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2850 esac
2851 echo " "
2852 case "$osvers" in
2853         ''|' ')
2854                 case "$hintfile" in
2855                 ''|' '|none) dflt=none ;;
2856                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2857                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2858                         case "$dflt" in
2859                         ''|' ') dflt=none ;;
2860                         esac
2861                         ;;
2862                 esac
2863                 ;;
2864         *) dflt="$osvers" ;;
2865 esac
2866 rp="Operating system version?"
2867 . ./myread
2868 case "$ans" in
2869 none)  osvers='' ;;
2870 *) osvers="$ans" ;;
2871 esac
2872
2873
2874 . ./posthint.sh
2875
2876 : who configured the system
2877 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2878 cf_by=`(logname) 2>/dev/null`
2879 case "$cf_by" in
2880 "")
2881         cf_by=`(whoami) 2>/dev/null`
2882         case "$cf_by" in
2883         "") cf_by=unknown ;;
2884         esac ;;
2885 esac
2886
2887 : set up the script used to warn in case of inconsistency
2888 cat <<EOS >whoa
2889 $startsh
2890 EOS
2891 cat <<'EOSC' >>whoa
2892 dflt=y
2893 echo " "
2894 echo "*** WHOA THERE!!! ***" >&4
2895 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2896 rp="    Keep the $hint value?"
2897 . ./myread
2898 case "$ans" in
2899 y) td=$was; tu=$was;;
2900 esac
2901 EOSC
2902
2903 : function used to set $1 to $val
2904 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2905 case "$val$was" in
2906 $define$undef) . ./whoa; eval "$var=\$td";;
2907 $undef$define) . ./whoa; eval "$var=\$tu";;
2908 *) eval "$var=$val";;
2909 esac'
2910
2911 case "$usethreads" in
2912 $define|true|[yY]*)     dflt='y';;
2913 *) dflt='n';;
2914 esac
2915 cat <<EOM
2916
2917 Perl can be built to take advantage of threads on some systems.
2918 To do so, Configure can be run with -Dusethreads.
2919
2920 Note that threading is a highly experimental feature, and
2921 some known race conditions still remain.  If you choose to try
2922 it, be very sure to not actually deploy it for production
2923 purposes.  README.threads has more details, and is required
2924 reading if you enable threads.
2925
2926 If this doesn't make any sense to you, just accept the default '$dflt'.
2927 EOM
2928 rp='Build a threading Perl?'
2929 . ./myread
2930 case "$ans" in
2931 y|Y)    val="$define" ;;
2932 *)      val="$undef" ;;
2933 esac
2934 set usethreads
2935 eval $setvar
2936
2937 case "$usethreads" in
2938 $define)
2939         $cat <<EOM
2940
2941 As of 5.5.640, Perl has two different internal threading implementations,
2942 the 5.005 version (5005threads) and an interpreter-based version
2943 (ithreads) that has one interpreter per thread.  Both are very 
2944 experimental.  This arrangement exists to help developers work out
2945 which one is better.
2946
2947 If you're a casual user, you probably don't want interpreter-threads
2948 at this time.  There doesn't yet exist a way to create threads from
2949 within Perl in this model, i.e., "use Thread;" will NOT work.
2950 EOM
2951         : Default to ithreads unless overridden on command line or with
2952         : old config.sh
2953         dflt='y'
2954         case "$use5005threads" in
2955                 $define|true|[yY]*) dflt='n';;
2956         esac
2957         case "$useithreads" in
2958                 $undef|false|[nN]*) dflt='n';;
2959         esac
2960         rp='Use interpreter-based ithreads?'
2961         . ./myread
2962         case "$ans" in
2963         y|Y)    val="$define" ;;
2964         *)      val="$undef" ;;
2965         esac
2966         set useithreads
2967         eval $setvar
2968         : Now set use5005threads to the opposite value.
2969         case "$useithreads" in
2970         $define) val="$undef" ;;
2971         *) val="$define" ;;
2972         esac
2973         set use5005threads
2974         eval $setvar
2975         ;;
2976 *)
2977         useithreads="$undef"
2978         use5005threads="$undef"
2979         ;;
2980 esac
2981
2982 case "$useithreads$use5005threads" in
2983 "$define$define")
2984         $cat >&4 <<EOM
2985
2986 You cannot have both the ithreads and the 5.005 threads enabled
2987 at the same time.  Disabling the 5.005 threads since they are
2988 much less stable than the ithreads.
2989
2990 EOM
2991         use5005threads="$undef"
2992         ;;
2993 esac
2994
2995 case "$d_oldpthreads" in
2996 '')     : Configure tests would be welcome here.  For now, assume undef.
2997         val="$undef" ;;
2998 *)      val="$d_oldpthreads" ;;
2999 esac
3000 set d_oldpthreads
3001 eval $setvar
3002
3003
3004 case "$usethreads" in
3005 "$define"|true|[yY]*)
3006 : Look for a hint-file generated 'call-back-unit'.  If the
3007 : user has specified that a threading perl is to be built,
3008 : we may need to set or change some other defaults.
3009         if $test -f usethreads.cbu; then
3010                 echo "Your platform has some specific hints for threaded builds, using them..."
3011                 . ./usethreads.cbu
3012         else
3013                 $cat <<EOM
3014 (Your platform doesn't have any specific hints for threaded builds.
3015  Assuming POSIX threads, then.)
3016 EOM
3017         fi
3018         ;;
3019 esac
3020
3021 cat <<EOM
3022
3023 Perl can be built so that multiple Perl interpreters can coexist
3024 within the same Perl executable.
3025 EOM
3026
3027 case "$useithreads" in
3028 $define)
3029         cat <<EOM
3030 This multiple interpreter support is required for interpreter-based threads.
3031 EOM
3032         val="$define"
3033         ;;
3034 *)      case "$usemultiplicity" in
3035         $define|true|[yY]*)     dflt='y';;
3036         *) dflt='n';;
3037         esac
3038         echo " "
3039         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3040         rp='Build Perl for multiplicity?'
3041         . ./myread
3042         case "$ans" in
3043         y|Y)    val="$define" ;;
3044         *)      val="$undef" ;;
3045         esac
3046         ;;
3047 esac
3048 set usemultiplicity
3049 eval $setvar
3050
3051 : make some quick guesses about what we are up against
3052 echo " "
3053 $echo $n "Hmm...  $c"
3054 echo exit 1 >bsd
3055 echo exit 1 >usg
3056 echo exit 1 >v7
3057 echo exit 1 >osf1
3058 echo exit 1 >eunice
3059 echo exit 1 >xenix
3060 echo exit 1 >venix
3061 echo exit 1 >os2
3062 d_bsd="$undef"
3063 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3064 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3065 then
3066         echo "Looks kind of like an OSF/1 system, but we'll see..."
3067         echo exit 0 >osf1
3068 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3069         xxx=`./loc addbib blurfl $pth`
3070         if $test -f $xxx; then
3071         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3072                 echo exit 0 >bsd
3073                 echo exit 0 >usg
3074         else
3075                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3076                         echo "Looks kind of like an extended USG system, but we'll see..."
3077                 else
3078                         echo "Looks kind of like a USG system, but we'll see..."
3079                 fi
3080                 echo exit 0 >usg
3081         fi
3082 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3083         echo "Looks kind of like a BSD system, but we'll see..."
3084         d_bsd="$define"
3085         echo exit 0 >bsd
3086 else
3087         echo "Looks kind of like a Version 7 system, but we'll see..."
3088         echo exit 0 >v7
3089 fi
3090 case "$eunicefix" in
3091 *unixtovms*)
3092         $cat <<'EOI'
3093 There is, however, a strange, musty smell in the air that reminds me of
3094 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3095 EOI
3096         echo exit 0 >eunice
3097         d_eunice="$define"
3098 : it so happens the Eunice I know will not run shell scripts in Unix format
3099         ;;
3100 *)
3101         echo " "
3102         echo "Congratulations.  You aren't running Eunice."
3103         d_eunice="$undef"
3104         ;;
3105 esac
3106 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3107 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3108 : semicolon as a patch separator
3109 case "$p_" in
3110 :) ;;
3111 *)
3112         $cat <<'EOI'
3113 I have the feeling something is not exactly right, however...don't tell me...
3114 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3115 (Or you may be running DOS with DJGPP.)
3116 EOI
3117         echo exit 0 >os2
3118         ;;
3119 esac
3120 if test -f /xenix; then
3121         echo "Actually, this looks more like a XENIX system..."
3122         echo exit 0 >xenix
3123         d_xenix="$define"
3124 else
3125         echo " "
3126         echo "It's not Xenix..."
3127         d_xenix="$undef"
3128 fi
3129 chmod +x xenix
3130 $eunicefix xenix
3131 if test -f /venix; then
3132         echo "Actually, this looks more like a VENIX system..."
3133         echo exit 0 >venix
3134 else
3135         echo " "
3136         if ./xenix; then
3137                 : null
3138         else
3139                 echo "Nor is it Venix..."
3140         fi
3141 fi
3142 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3143 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3144 $rm -f foo
3145
3146 case "$cc" in
3147 '') dflt=cc;;
3148 *) dflt="$cc";;
3149 esac
3150 rp="Use which C compiler?"
3151 . ./myread
3152 cc="$ans"
3153 : Look for a hint-file generated 'call-back-unit'.  Now that the
3154 : user has specified the compiler, we may need to set or change some
3155 : other defaults.
3156 if $test -f cc.cbu; then
3157     . ./cc.cbu
3158 fi
3159 . ./checkcc
3160
3161 echo " "
3162 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3163 $cat >gccvers.c <<EOM
3164 #include <stdio.h>
3165 int main() {
3166 #ifdef __GNUC__
3167 #ifdef __VERSION__
3168         printf("%s\n", __VERSION__);
3169 #else
3170         printf("%s\n", "1");
3171 #endif
3172 #endif
3173         exit(0);
3174 }
3175 EOM
3176 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3177         gccversion=`./gccvers`
3178         case "$gccversion" in
3179         '') echo "You are not using GNU cc." ;;
3180         *)  echo "You are using GNU cc $gccversion."
3181             ccname=gcc  
3182             ;;
3183         esac
3184 else
3185         echo " "
3186         echo "*** WHOA THERE!!! ***" >&4
3187         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3188         case "$knowitall" in
3189         '')
3190         echo "    You'd better start hunting for one and let me know about it." >&4
3191                 exit 1
3192                 ;;
3193         esac
3194 fi
3195 $rm -f gccvers*
3196 case "$gccversion" in
3197 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3198 esac
3199 case "$gccversion" in
3200 '') gccosandvers='' ;;
3201 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3202    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3203    gccshortvers=''
3204    case "$gccosandvers" in
3205    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3206    $osname$osvers) ;; # looking good
3207    $osname*) cat <<EOM >&4
3208
3209 *** WHOA THERE!!! ***
3210
3211     Your gcc has not been compiled for the exact release of
3212     your operating system ($gccosandvers versus $osname$osvers).
3213
3214     In general it is a good idea to keep gcc synchronized with
3215     the operating system because otherwise serious problems
3216     may ensue when trying to compile software, like Perl.
3217
3218     I'm trying to be optimistic here, though, and will continue.
3219     If later during the configuration and build icky compilation
3220     problems appear (headerfile conflicts being the most common
3221     manifestation), I suggest reinstalling the gcc to match
3222     your operating system release.
3223
3224 EOM
3225       ;;
3226    *) gccosandvers='' ;; # failed to parse, better be silent
3227    esac
3228    ;;
3229 esac
3230 case "$ccname" in
3231 '') ccname="$cc" ;;
3232 esac
3233
3234 case "$gccversion" in
3235 '') ;;
3236 *)  case "$ccflags" in
3237     *-Wall*) ;;
3238     *) ccflags="$ccflags -Wall" ;;
3239     esac
3240     ;;
3241 esac
3242
3243 : see how we invoke the C preprocessor
3244 echo " "
3245 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3246 cat <<'EOT' >testcpp.c
3247 #define ABC abc
3248 #define XYZ xyz
3249 ABC.XYZ
3250 EOT
3251 cd ..
3252 if test ! -f cppstdin; then
3253         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3254                 # AIX cc -E doesn't show the absolute headerfile
3255                 # locations but we'll cheat by using the -M flag.
3256                 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
3257         else
3258                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3259         fi
3260 else
3261         echo "Keeping your $hint cppstdin wrapper."
3262 fi
3263 chmod 755 cppstdin
3264 wrapper=`pwd`/cppstdin
3265 ok='false'
3266 cd UU
3267
3268 if $test "X$cppstdin" != "X" && \
3269         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3270         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3271 then
3272         echo "You used to use $cppstdin $cppminus so we'll use that again."
3273         case "$cpprun" in
3274         '') echo "But let's see if we can live without a wrapper..." ;;
3275         *)
3276                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3277                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3278                 then
3279                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3280                         ok='true'
3281                 else
3282                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3283                 fi
3284                 ;;
3285         esac
3286 else
3287         case "$cppstdin" in
3288         '') ;;
3289         *)
3290                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3291                 ;;
3292         esac
3293 fi
3294
3295 if $ok; then
3296         : nothing
3297 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3298         $cc -E <testcpp.c >testcpp.out 2>&1; \
3299         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3300         echo "Yup, it does."
3301         x_cpp="$cc -E"
3302         x_minus='';
3303 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3304         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3305         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3306         echo "Yup, it does."
3307         x_cpp="$cc -E"
3308         x_minus='-';
3309 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3310         $cc -P <testcpp.c >testcpp.out 2>&1; \
3311         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3312         echo "Yipee, that works!"
3313         x_cpp="$cc -P"
3314         x_minus='';
3315 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3316         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3317         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3318         echo "At long last!"
3319         x_cpp="$cc -P"
3320         x_minus='-';
3321 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3322         $cpp <testcpp.c >testcpp.out 2>&1; \
3323         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324         echo "It works!"
3325         x_cpp="$cpp"
3326         x_minus='';
3327 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3328         $cpp - <testcpp.c >testcpp.out 2>&1; \
3329         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3330         echo "Hooray, it works!  I was beginning to wonder."
3331         x_cpp="$cpp"
3332         x_minus='-';
3333 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3334         $wrapper <testcpp.c >testcpp.out 2>&1; \
3335         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3336         x_cpp="$wrapper"
3337         x_minus=''
3338         echo "Eureka!"
3339 else
3340         dflt=''
3341         rp="No dice.  I can't find a C preprocessor.  Name one:"
3342         . ./myread
3343         x_cpp="$ans"
3344         x_minus=''
3345         $x_cpp <testcpp.c >testcpp.out 2>&1
3346         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3347                 echo "OK, that will do." >&4
3348         else
3349 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3350                 exit 1
3351         fi
3352 fi
3353
3354 case "$ok" in
3355 false)
3356         cppstdin="$x_cpp"
3357         cppminus="$x_minus"
3358         cpprun="$x_cpp"
3359         cpplast="$x_minus"
3360         set X $x_cpp
3361         shift
3362         case "$1" in
3363         "$cpp")
3364                 echo "Perhaps can we force $cc -E using a wrapper..."
3365                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3366                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3367                 then
3368                         echo "Yup, we can."
3369                         cppstdin="$wrapper"
3370                         cppminus='';
3371                 else
3372                         echo "Nope, we'll have to live without it..."
3373                 fi
3374                 ;;
3375         esac
3376         case "$cpprun" in
3377         "$wrapper")
3378                 cpprun=''
3379                 cpplast=''
3380                 ;;
3381         esac
3382         ;;
3383 esac
3384
3385 case "$cppstdin" in
3386 "$wrapper"|'cppstdin') ;;
3387 *) $rm -f $wrapper;;
3388 esac
3389 $rm -f testcpp.c testcpp.out
3390
3391 : decide how portable to be.  Allow command line overrides.
3392 case "$d_portable" in
3393 "$undef") ;;
3394 *)      d_portable="$define" ;;
3395 esac
3396
3397 : set up shell script to do ~ expansion
3398 cat >filexp <<EOSS
3399 $startsh
3400 : expand filename
3401 case "\$1" in
3402  ~/*|~)
3403         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3404         ;;
3405  ~*)
3406         if $test -f /bin/csh; then
3407                 /bin/csh -f -c "glob \$1"
3408                 failed=\$?
3409                 echo ""
3410                 exit \$failed
3411         else
3412                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3413                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3414                 if $test ! -d "\$dir"; then
3415                         me=\`basename \$0\`
3416                         echo "\$me: can't locate home directory for: \$name" >&2
3417                         exit 1
3418                 fi
3419                 case "\$1" in
3420                 */*)
3421                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3422                         ;;
3423                 *)
3424                         echo \$dir
3425                         ;;
3426                 esac
3427         fi
3428         ;;
3429 *)
3430         echo \$1
3431         ;;
3432 esac
3433 EOSS
3434 chmod +x filexp
3435 $eunicefix filexp
3436
3437 : now set up to get a file name
3438 cat <<EOS >getfile
3439 $startsh
3440 EOS
3441 cat <<'EOSC' >>getfile
3442 tilde=''
3443 fullpath=''
3444 already=''
3445 skip=''
3446 none_ok=''
3447 exp_file=''
3448 nopath_ok=''
3449 orig_rp="$rp"
3450 orig_dflt="$dflt"
3451 case "$gfpth" in
3452 '') gfpth='.' ;;
3453 esac
3454
3455 case "$fn" in
3456 *\(*)
3457         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3458         fn=`echo $fn | sed 's/(.*)//'`
3459         ;;
3460 esac
3461
3462 case "$fn" in
3463 *:*)
3464         loc_file=`expr $fn : '.*:\(.*\)'`
3465         fn=`expr $fn : '\(.*\):.*'`
3466         ;;
3467 esac
3468
3469 case "$fn" in
3470 *~*) tilde=true;;
3471 esac
3472 case "$fn" in
3473 */*) fullpath=true;;
3474 esac
3475 case "$fn" in
3476 *+*) skip=true;;
3477 esac
3478 case "$fn" in
3479 *n*) none_ok=true;;
3480 esac
3481 case "$fn" in
3482 *e*) exp_file=true;;
3483 esac
3484 case "$fn" in
3485 *p*) nopath_ok=true;;
3486 esac
3487
3488 case "$fn" in
3489 *f*) type='File';;
3490 *d*) type='Directory';;
3491 *l*) type='Locate';;
3492 esac
3493
3494 what="$type"
3495 case "$what" in
3496 Locate) what='File';;
3497 esac
3498
3499 case "$exp_file" in
3500 '')
3501         case "$d_portable" in
3502         "$define") ;;
3503         *) exp_file=true;;
3504         esac
3505         ;;
3506 esac
3507
3508 cd ..
3509 while test "$type"; do
3510         redo=''
3511         rp="$orig_rp"
3512         dflt="$orig_dflt"
3513         case "$tilde" in
3514         true) rp="$rp (~name ok)";;
3515         esac
3516         . UU/myread
3517         if test -f UU/getfile.ok && \
3518                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3519         then
3520                 value="$ans"
3521                 ansexp="$ans"
3522                 break
3523         fi
3524         case "$ans" in
3525         none)
3526                 value=''
3527                 ansexp=''
3528                 case "$none_ok" in
3529                 true) type='';;
3530                 esac
3531                 ;;
3532         *)
3533                 case "$tilde" in
3534                 '') value="$ans"
3535                         ansexp="$ans";;
3536                 *)
3537                         value=`UU/filexp $ans`
3538                         case $? in
3539                         0)
3540                                 if test "$ans" != "$value"; then
3541                                         echo "(That expands to $value on this system.)"
3542                                 fi
3543                                 ;;
3544                         *) value="$ans";;
3545                         esac
3546                         ansexp="$value"
3547                         case "$exp_file" in
3548                         '') value="$ans";;
3549                         esac
3550                         ;;
3551                 esac
3552                 case "$fullpath" in
3553                 true)
3554                         case "$ansexp" in
3555                         /*) value="$ansexp" ;;
3556                         [a-zA-Z]:/*) value="$ansexp" ;;
3557                         *)
3558                                 redo=true
3559                                 case "$already" in
3560                                 true)
3561                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3562                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3563                                         ;;
3564                                 *)
3565                                 echo "Please give a full path name, starting with slash." >&4
3566                                         case "$tilde" in
3567                                         true)
3568                                 echo "Note that using ~name is ok provided it expands well." >&4
3569                                                 already=true
3570                                                 ;;
3571                                         esac
3572                                 esac
3573                                 ;;
3574                         esac
3575                         ;;
3576                 esac
3577                 case "$redo" in
3578                 '')
3579                         case "$type" in
3580                         File)
3581                                 for fp in $gfpth; do
3582                                         if test "X$fp" = X.; then
3583                                             pf="$ansexp"
3584                                         else    
3585                                             pf="$fp/$ansexp"
3586                                         fi
3587                                         if test -f "$pf"; then
3588                                                 type=''
3589                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3590                                         then
3591                                                 echo "($value is not a plain file, but that's ok.)"
3592                                                 type=''
3593                                         fi
3594                                         if test X"$type" = X; then
3595                                             value="$pf"
3596                                             break
3597                                         fi
3598                                 done
3599                                 ;;
3600                         Directory)
3601                                 for fp in $gfpth; do
3602                                         if test "X$fp" = X.; then
3603                                             dir="$ans"
3604                                             direxp="$ansexp"
3605                                         else    
3606                                             dir="$fp/$ansexp"
3607                                             direxp="$fp/$ansexp"
3608                                         fi
3609                                         if test -d "$direxp"; then
3610                                                 type=''
3611                                                 value="$dir"
3612                                                 break
3613                                         fi
3614                                 done
3615                                 ;;
3616                         Locate)
3617                                 if test -d "$ansexp"; then
3618                                         echo "(Looking for $loc_file in directory $value.)"
3619                                         value="$value/$loc_file"
3620                                         ansexp="$ansexp/$loc_file"
3621                                 fi
3622                                 if test -f "$ansexp"; then
3623                                         type=''
3624                                 fi
3625                                 case "$nopath_ok" in
3626                                 true)   case "$value" in
3627                                         */*) ;;
3628                                         *)      echo "Assuming $value will be in people's path."
3629                                                 type=''
3630                                                 ;;
3631                                         esac
3632                                         ;;
3633                                 esac
3634                                 ;;
3635                         esac
3636
3637                         case "$skip" in
3638                         true) type='';
3639                         esac
3640
3641                         case "$type" in
3642                         '') ;;
3643                         *)
3644                                 if test "$fastread" = yes; then
3645                                         dflt=y
3646                                 else
3647                                         dflt=n
3648                                 fi
3649                                 rp="$what $value doesn't exist.  Use that name anyway?"
3650                                 . UU/myread
3651                                 dflt=''
3652                                 case "$ans" in
3653                                 y*) type='';;
3654                                 *) echo " ";;
3655                                 esac
3656                                 ;;
3657                         esac
3658                         ;;
3659                 esac
3660                 ;;
3661         esac
3662 done
3663 cd UU
3664 ans="$value"
3665 rp="$orig_rp"
3666 dflt="$orig_dflt"
3667 rm -f getfile.ok
3668 test "X$gfpthkeep" != Xy && gfpth=""
3669 EOSC
3670
3671 : What should the include directory be ?
3672 echo " "
3673 $echo $n "Hmm...  $c"
3674 dflt='/usr/include'
3675 incpath=''
3676 mips_type=''
3677 if $test -f /bin/mips && /bin/mips; then
3678         echo "Looks like a MIPS system..."
3679         $cat >usr.c <<'EOCP'
3680 #ifdef SYSTYPE_BSD43
3681 /bsd43
3682 #endif
3683 EOCP
3684         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3685                 dflt='/bsd43/usr/include'
3686                 incpath='/bsd43'
3687                 mips_type='BSD 4.3'
3688         else
3689                 mips_type='System V'
3690         fi
3691         $rm -f usr.c usr.out
3692         echo "and you're compiling with the $mips_type compiler and libraries."
3693         xxx_prompt=y
3694         echo "exit 0" >mips
3695 else
3696         echo "Doesn't look like a MIPS system."
3697         xxx_prompt=n
3698         echo "exit 1" >mips
3699 fi
3700 chmod +x mips
3701 $eunicefix mips
3702 case "$usrinc" in
3703 '') ;;
3704 *) dflt="$usrinc";;
3705 esac
3706 case "$xxx_prompt" in
3707 y)      fn=d/
3708         echo " "
3709         rp='Where are the include files you want to use?'
3710         . ./getfile
3711         usrinc="$ans"
3712         ;;
3713 *)      usrinc="$dflt"
3714         ;;
3715 esac
3716
3717 : Set private lib path
3718 case "$plibpth" in
3719 '') if ./mips; then
3720                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3721         fi;;
3722 esac
3723 case "$libpth" in
3724 ' ') dlist='';;
3725 '') dlist="$loclibpth $plibpth $glibpth";;
3726 *) dlist="$libpth";;
3727 esac
3728
3729 : Now check and see which directories actually exist, avoiding duplicates
3730 libpth=''
3731 for xxx in $dlist
3732 do
3733     if $test -d $xxx; then
3734                 case " $libpth " in
3735                 *" $xxx "*) ;;
3736                 *) libpth="$libpth $xxx";;
3737                 esac
3738     fi
3739 done
3740 $cat <<'EOM'
3741
3742 Some systems have incompatible or broken versions of libraries.  Among
3743 the directories listed in the question below, please remove any you
3744 know not to be holding relevant libraries, and add any that are needed.
3745 Say "none" for none.
3746
3747 EOM
3748 case "$libpth" in
3749 '') dflt='none';;
3750 *)
3751         set X $libpth
3752         shift
3753         dflt=${1+"$@"}
3754         ;;
3755 esac
3756 rp="Directories to use for library searches?"
3757 . ./myread
3758 case "$ans" in
3759 none) libpth=' ';;
3760 *) libpth="$ans";;
3761 esac
3762
3763 : compute shared library extension
3764 case "$so" in
3765 '')
3766         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3767                 dflt='sl'
3768         else
3769                 dflt='so'
3770         fi
3771         ;;
3772 *) dflt="$so";;
3773 esac
3774 $cat <<EOM
3775
3776 On some systems, shared libraries may be available.  Answer 'none' if
3777 you want to suppress searching of shared libraries for the remainder
3778 of this configuration.
3779
3780 EOM
3781 rp='What is the file extension used for shared libraries?'
3782 . ./myread
3783 so="$ans"
3784
3785 : Define several unixisms.
3786 : Hints files or command line option can be used to override them.
3787 : The convoluted testing is in case hints files set either the old
3788 : or the new name.
3789 case "$_exe" in
3790 '')     case "$exe_ext" in
3791     '') ;;
3792         *)      _exe="$exe_ext" ;;
3793         esac
3794         ;;
3795 esac
3796 case "$_a" in
3797 '')     case "$lib_ext" in
3798     '') _a='.a';;
3799         *)      _a="$lib_ext" ;;
3800         esac
3801         ;;
3802 esac
3803 case "$_o" in
3804 '') case "$obj_ext" in
3805         '')     _o='.o';;
3806         *)      _o="$obj_ext";;
3807         esac
3808         ;;
3809 esac
3810 case "$p_" in
3811 '') case "$path_sep" in
3812         '')     p_=':';;
3813         *)      p_="$path_sep";;
3814         esac
3815         ;;
3816 esac
3817 exe_ext=$_exe
3818 lib_ext=$_a
3819 obj_ext=$_o
3820 path_sep=$p_
3821
3822 : Which makefile gets called first.  This is used by make depend.
3823 case "$firstmakefile" in
3824 '') firstmakefile='makefile';;
3825 esac
3826
3827 case "$usesocks" in
3828 $define|true|[yY]*)     dflt='y';;
3829 *) dflt='n';;
3830 esac
3831 cat <<EOM
3832
3833 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3834 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3835 to use the PerlIO abstraction layer, this will be implicitly selected.
3836
3837 If this doesn't make any sense to you, just accept the default '$dflt'.
3838 EOM
3839 rp='Build Perl for SOCKS?'
3840 . ./myread
3841 case "$ans" in
3842 y|Y)    val="$define" ;;     
3843 *)      val="$undef" ;;
3844 esac
3845 set usesocks
3846 eval $setvar
3847
3848 case "$usesocks" in
3849 $define|true|[yY]*) useperlio="$define";;
3850 esac
3851
3852 : Looking for optional libraries
3853 echo " "
3854 echo "Checking for optional libraries..." >&4
3855 case "$libs" in
3856 ' '|'') dflt='';;
3857 *) dflt="$libs";;
3858 esac
3859 case "$libswanted" in
3860 '') libswanted='c_s';;
3861 esac
3862 case "$usesocks" in
3863 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3864 esac
3865 libsfound=''
3866 libsfiles=''
3867 libsdirs=''
3868 libspath=''
3869 for thisdir in $libpth $xlibpth; do
3870   test -d $thisdir && libspath="$libspath $thisdir"
3871 done
3872 for thislib in $libswanted; do
3873         for thisdir in $libspath; do
3874             xxx=''
3875             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3876                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3877                 $test -f "$xxx" && eval $libscheck
3878                 $test -f "$xxx" && libstyle=shared
3879             fi
3880             if test ! -f "$xxx"; then
3881                 xxx=$thisdir/lib$thislib.$so
3882                 $test -f "$xxx" && eval $libscheck
3883                 $test -f "$xxx" && libstyle=shared
3884             fi  
3885             if test ! -f "$xxx"; then
3886                 xxx=$thisdir/lib$thislib$_a
3887                 $test -f "$xxx" && eval $libscheck
3888                 $test -f "$xxx" && libstyle=static
3889             fi
3890             if test ! -f "$xxx"; then
3891                 xxx=$thisdir/$thislib$_a
3892                 $test -f "$xxx" && eval $libscheck
3893                 $test -f "$xxx" && libstyle=static
3894             fi
3895             if test ! -f "$xxx"; then
3896                 xxx=$thisdir/lib${thislib}_s$_a
3897                 $test -f "$xxx" && eval $libscheck
3898                 $test -f "$xxx" && libstyle=static
3899                 $test -f "$xxx" && thislib=${thislib}_s
3900             fi
3901             if test ! -f "$xxx"; then
3902                 xxx=$thisdir/Slib$thislib$_a
3903                 $test -f "$xxx" && eval $libscheck
3904                 $test -f "$xxx" && libstyle=static
3905             fi
3906             if $test -f "$xxx"; then
3907                 case "$libstyle" in
3908                 shared) echo "Found -l$thislib (shared)." ;;
3909                 static) echo "Found -l$thislib." ;;
3910                 *)      echo "Found -l$thislib ($libstyle)." ;;
3911                 esac
3912                 case " $dflt " in
3913                 *"-l$thislib "*);;
3914                 *) dflt="$dflt -l$thislib"
3915                    libsfound="$libsfound $xxx"
3916                    yyy=`basename $xxx`
3917                    libsfiles="$libsfiles $yyy"
3918                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3919                    case " $libsdirs " in
3920                    *" $yyy "*) ;;
3921                    *) libsdirs="$libsdirs $yyy" ;;
3922                    esac
3923                    ;;
3924                 esac
3925                 break
3926             fi  
3927         done
3928         if $test ! -f "$xxx"; then
3929             echo "No -l$thislib."
3930         fi
3931 done
3932 set X $dflt
3933 shift
3934 dflt="$*"
3935 case "$libs" in
3936 '') dflt="$dflt";;
3937 *) dflt="$libs";;
3938 esac
3939 case "$dflt" in
3940 ' '|'') dflt='none';;
3941 esac
3942
3943 $cat <<EOM
3944
3945 In order to compile $package on your machine, a number of libraries
3946 are usually needed.  Include any other special libraries here as well.
3947 Say "none" for none.  The default list is almost always right.
3948 EOM
3949
3950 echo " "
3951 rp="What libraries to use?"
3952 . ./myread
3953 case "$ans" in
3954 none) libs=' ';;
3955 *) libs="$ans";;
3956 esac
3957
3958 : determine optimization, if desired, or use for debug flag also
3959 case "$optimize" in
3960 ' '|$undef) dflt='none';;
3961 '') dflt='-O';;
3962 *) dflt="$optimize";;
3963 esac
3964 $cat <<EOH
3965
3966 By default, $package compiles with the -O flag to use the optimizer.
3967 Alternately, you might want to use the symbolic debugger, which uses
3968 the -g flag (on traditional Unix systems).  Either flag can be
3969 specified here.  To use neither flag, specify the word "none".
3970
3971 EOH
3972 rp="What optimizer/debugger flag should be used?"
3973 . ./myread
3974 optimize="$ans"
3975 case "$optimize" in
3976 'none') optimize=" ";;
3977 esac
3978
3979 dflt=''
3980 : We will not override a previous value, but we might want to
3981 : augment a hint file
3982 case "$hint" in
3983 default|recommended)
3984         case "$gccversion" in
3985         1*) dflt='-fpcc-struct-return' ;;
3986         esac
3987         case "$optimize" in
3988         *-g*) dflt="$dflt -DDEBUGGING";;
3989         esac
3990         case "$gccversion" in
3991         2*) if test -d /etc/conf/kconfig.d &&
3992                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3993                 then
3994                         dflt="$dflt -posix"
3995                 fi
3996                 ;;
3997         esac
3998         case "$gccversion" in
3999         1*) ;;
4000         2.[0-8]*) ;;
4001         ?*)     echo " "
4002                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4003                 echo 'int main(void) { return 0; }' > gcctest.c
4004                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4005                         echo "Yes, it does." 2>&1
4006                         case "$ccflags" in
4007                         *strict-aliasing*) 
4008                                 echo "Leaving current flags $ccflags alone." 2>&1
4009                                 ;;
4010                         *) dflt="$dflt -fno-strict-aliasing" ;;
4011                         esac
4012                 else
4013                         echo "Nope, it doesn't, but that's ok." 2>&1
4014                 fi
4015                 ;;
4016         esac
4017         ;;
4018 esac
4019
4020 case "$mips_type" in
4021 *BSD*|'') inclwanted="$locincpth $usrinc";;
4022 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4023 esac
4024 for thisincl in $inclwanted; do
4025         if $test -d $thisincl; then
4026                 if $test x$thisincl != x$usrinc; then
4027                         case "$dflt" in
4028                         *" -I$thisincl "*);;
4029                         *) dflt="$dflt -I$thisincl ";;
4030                         esac
4031                 fi
4032         fi
4033 done
4034
4035 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4036         xxx=true;
4037 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4038         xxx=true;
4039 else
4040         xxx=false;
4041 fi;
4042 if $xxx; then
4043         case "$dflt" in
4044         *$2*);;
4045         *) dflt="$dflt -D$2";;
4046         esac;
4047 fi'
4048
4049 set signal.h LANGUAGE_C; eval $inctest
4050
4051 case "$usesocks" in
4052 $define)
4053         ccflags="$ccflags -DSOCKS"
4054         ;;
4055 esac
4056
4057 case "$hint" in
4058 default|recommended) dflt="$ccflags $dflt" ;;
4059 *) dflt="$ccflags";;
4060 esac
4061
4062 case "$dflt" in
4063 ''|' ') dflt=none;;
4064 esac
4065
4066 $cat <<EOH
4067
4068 Your C compiler may want other flags.  For this question you should include
4069 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4070 but you should NOT include libraries or ld flags like -lwhatever.  If you
4071 want $package to honor its debug switch, you should include -DDEBUGGING here.
4072 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4073
4074 To use no flags, specify the word "none".
4075
4076 EOH
4077 set X $dflt
4078 shift
4079 dflt=${1+"$@"}
4080 rp="Any additional cc flags?"
4081 . ./myread
4082 case "$ans" in
4083 none) ccflags='';;
4084 *) ccflags="$ans";;
4085 esac
4086
4087 : the following weeds options from ccflags that are of no interest to cpp
4088 case "$cppflags" in
4089 '') cppflags="$ccflags" ;;
4090 *)  cppflags="$cppflags $ccflags" ;;
4091 esac
4092 case "$gccversion" in
4093 1*) cppflags="$cppflags -D__GNUC__"
4094 esac
4095 case "$mips_type" in
4096 '');;
4097 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4098 esac
4099 case "$cppflags" in
4100 '');;
4101 *)
4102         echo " "
4103         echo "Let me guess what the preprocessor flags are..." >&4
4104         set X $cppflags
4105         shift
4106         cppflags=''
4107         $cat >cpp.c <<'EOM'
4108 #define BLURFL foo
4109
4110 BLURFL xx LFRULB
4111 EOM
4112         previous=''
4113         for flag in $*
4114         do
4115                 case "$flag" in
4116                 -*) ftry="$flag";;
4117                 *) ftry="$previous $flag";;
4118                 esac
4119                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4120                         >cpp1.out 2>/dev/null && \
4121                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4122                         >cpp2.out 2>/dev/null && \
4123                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4124                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4125                 then
4126                         cppflags="$cppflags $ftry"
4127                         previous=''
4128                 else
4129                         previous="$flag"
4130                 fi
4131         done
4132         set X $cppflags
4133         shift
4134         cppflags=${1+"$@"}
4135         case "$cppflags" in
4136         *-*)  echo "They appear to be: $cppflags";;
4137         esac
4138         $rm -f cpp.c cpp?.out
4139         ;;
4140 esac
4141
4142 : flags used in final linking phase
4143 case "$ldflags" in
4144 '') if ./venix; then
4145                 dflt='-i -z'
4146         else
4147                 dflt=''
4148         fi
4149         case "$ccflags" in
4150         *-posix*) dflt="$dflt -posix" ;;
4151         esac
4152         ;;
4153 *) dflt="$ldflags";;
4154 esac
4155
4156 : Try to guess additional flags to pick up local libraries.
4157 for thislibdir in $libpth; do
4158         case " $loclibpth " in
4159         *" $thislibdir "*)
4160                 case "$dflt " in 
4161                 *"-L$thislibdir "*) ;;
4162                 *)  dflt="$dflt -L$thislibdir" ;;
4163                 esac
4164                 ;;
4165         esac
4166 done
4167
4168 case "$dflt" in
4169 '') dflt='none' ;;
4170 esac
4171
4172 $cat <<EOH
4173
4174 Your C linker may need flags.  For this question you should
4175 include -L/whatever and any other flags used by the C linker, but you
4176 should NOT include libraries like -lwhatever.
4177
4178 Make sure you include the appropriate -L/path flags if your C linker
4179 does not normally search all of the directories you specified above,
4180 namely
4181         $libpth
4182 To use no flags, specify the word "none".
4183
4184 EOH
4185
4186 rp="Any additional ld flags (NOT including libraries)?"
4187 . ./myread
4188 case "$ans" in
4189 none) ldflags='';;
4190 *) ldflags="$ans";;
4191 esac
4192 rmlist="$rmlist pdp11"
4193
4194 : coherency check
4195 echo " "
4196 echo "Checking your choice of C compiler and flags for coherency..." >&4
4197 $cat > try.c <<'EOF'
4198 #include <stdio.h>
4199 int main() { printf("Ok\n"); exit(0); }
4200 EOF
4201 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4202 shift
4203 $cat >try.msg <<'EOM'
4204 I've tried to compile and run the following simple program:
4205
4206 EOM
4207 $cat try.c >> try.msg
4208
4209 $cat >> try.msg <<EOM
4210
4211 I used the command:
4212
4213         $*
4214         ./try
4215
4216 and I got the following output:
4217
4218 EOM
4219 dflt=y
4220 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4221         if $sh -c './try' >>try.msg 2>&1; then
4222                 xxx=`./try`
4223                 case "$xxx" in
4224                 "Ok") dflt=n ;;
4225                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4226                         case " $libs " in
4227                         *" -lsfio "*)
4228                                 cat >> try.msg <<'EOQS'
4229 If $libs contains -lsfio, and sfio is mis-configured, then it
4230 sometimes (apparently) runs and exits with a 0 status, but with no
4231 output!  It may have to do with sfio's use of _exit vs. exit.
4232
4233 EOQS
4234                                 rp="You have a big problem.  Shall I abort Configure"
4235                                 dflt=y
4236                                 ;;
4237                         esac
4238                         ;;
4239                 esac
4240         else
4241                 echo "The program compiled OK, but exited with status $?." >>try.msg
4242                 rp="You have a problem.  Shall I abort Configure"
4243                 dflt=y
4244         fi
4245 else
4246         echo "I can't compile the test program." >>try.msg
4247         rp="You have a BIG problem.  Shall I abort Configure"
4248         dflt=y
4249 fi
4250 case "$dflt" in
4251 y)
4252         $cat try.msg >&4
4253         case "$knowitall" in
4254         '')
4255                 echo "(The supplied flags or libraries might be incorrect.)"
4256                 ;;
4257         *) dflt=n;;
4258         esac
4259         echo " "
4260         . ./myread
4261         case "$ans" in
4262         n*|N*) ;;
4263         *)      echo "Ok.  Stopping Configure." >&4
4264                 exit 1
4265                 ;;
4266         esac
4267         ;;
4268 n) echo "OK, that should do.";;
4269 esac
4270 $rm -f try try.* core
4271
4272 : define an is-a-typedef? function
4273 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4274 case "$inclist" in
4275 "") inclist="sys/types.h";;
4276 esac;
4277 eval "varval=\$$var";
4278 case "$varval" in
4279 "")
4280         $rm -f temp.c;
4281         for inc in $inclist; do
4282                 echo "#include <$inc>" >>temp.c;
4283         done;
4284         echo "#ifdef $type" >> temp.c;
4285         echo "printf(\"We have $type\");" >> temp.c;
4286         echo "#endif" >> temp.c;
4287         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4288         if $contains $type temp.E >/dev/null 2>&1; then
4289                 eval "$var=\$type";
4290         else
4291                 eval "$var=\$def";
4292         fi;
4293         $rm -f temp.?;;
4294 *) eval "$var=\$varval";;
4295 esac'
4296
4297 : define an is-a-typedef? function that prompts if the type is not available.
4298 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4299 case "$inclist" in
4300 "") inclist="sys/types.h";;
4301 esac;
4302 eval "varval=\$$var";
4303 case "$varval" in
4304 "")
4305         $rm -f temp.c;
4306         for inc in $inclist; do
4307                 echo "#include <$inc>" >>temp.c;
4308         done;
4309         echo "#ifdef $type" >> temp.c;
4310         echo "printf(\"We have $type\");" >> temp.c;
4311         echo "#endif" >> temp.c;
4312         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4313         echo " " ;
4314         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4315         if $contains $type temp.E >/dev/null 2>&1; then
4316                 echo "$type found." >&4;
4317                 eval "$var=\$type";
4318         else
4319                 echo "$type NOT found." >&4;
4320                 dflt="$def";
4321                 . ./myread ;
4322                 eval "$var=\$ans";
4323         fi;
4324         $rm -f temp.?;;
4325 *) eval "$var=\$varval";;
4326 esac'
4327
4328 : define a shorthand compile call
4329 compile='
4330 mc_file=$1;
4331 shift;
4332 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4333 : define a shorthand compile call for compilations that should be ok.
4334 compile_ok='
4335 mc_file=$1;
4336 shift;
4337 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4338
4339 : check for lengths of integral types
4340 echo " "
4341 case "$intsize" in
4342 '')
4343         echo "Checking to see how big your integers are..." >&4
4344         $cat >intsize.c <<'EOCP'
4345 #include <stdio.h>
4346 int main()
4347 {
4348         printf("intsize=%d;\n", (int)sizeof(int));
4349         printf("longsize=%d;\n", (int)sizeof(long));
4350         printf("shortsize=%d;\n", (int)sizeof(short));
4351         exit(0);
4352 }
4353 EOCP
4354         set intsize
4355         if eval $compile_ok && ./intsize > /dev/null; then
4356                 eval `./intsize`
4357                 echo "Your integers are $intsize bytes long."
4358                 echo "Your long integers are $longsize bytes long."
4359                 echo "Your short integers are $shortsize bytes long."
4360         else
4361                 $cat >&4 <<EOM
4362 !
4363 Help! I can't compile and run the intsize test program: please enlighten me!
4364 (This is probably a misconfiguration in your system or libraries, and
4365 you really ought to fix it.  Still, I'll try anyway.)
4366 !
4367 EOM
4368                 dflt=4
4369                 rp="What is the size of an integer (in bytes)?"
4370                 . ./myread
4371                 intsize="$ans"
4372                 dflt=$intsize
4373                 rp="What is the size of a long integer (in bytes)?"
4374                 . ./myread
4375                 longsize="$ans"
4376                 dflt=2
4377                 rp="What is the size of a short integer (in bytes)?"
4378                 . ./myread
4379                 shortsize="$ans"
4380         fi
4381         ;;
4382 esac
4383 $rm -f intsize intsize.*
4384
4385 : see what type lseek is declared as in the kernel
4386 rp="What is the type used for lseek's offset on this system?"
4387 set off_t lseektype long stdio.h sys/types.h
4388 eval $typedef_ask
4389
4390 echo " "
4391 echo "Checking to see how big your file offsets are..." >&4
4392 $cat >try.c <<EOCP
4393 #include <sys/types.h>
4394 #include <stdio.h>
4395 int main()
4396 {
4397     printf("%d\n", (int)sizeof($lseektype));
4398     return(0); 
4399 }
4400 EOCP
4401 set try
4402 if eval $compile_ok; then
4403         lseeksize=`./try`
4404         echo "Your file offsets are $lseeksize bytes long."
4405 else
4406         dflt=$longsize
4407         echo " "
4408         echo "(I can't seem to compile the test program.  Guessing...)"
4409         rp="What is the size of your file offsets (in bytes)?"
4410         . ./myread
4411         lseeksize="$ans"
4412 fi
4413 $rm -f try.c try
4414
4415 : see what type file positions are declared as in the library
4416 rp="What is the type for file position used by fsetpos()?"
4417 set fpos_t fpostype long stdio.h sys/types.h
4418 eval $typedef_ask
4419
4420 echo " "
4421 case "$fpostype" in
4422 *_t) zzz="$fpostype"    ;;
4423 *)   zzz="fpos_t"       ;;
4424 esac
4425 echo "Checking the size of $zzz..." >&4 
4426 cat > try.c <<EOCP
4427 #include <sys/types.h>
4428 #include <stdio.h>
4429 int main() {
4430     printf("%d\n", (int)sizeof($fpostype));
4431     exit(0);
4432 }
4433 EOCP
4434 set try
4435 if eval $compile_ok; then
4436         yyy=`./try`
4437         case "$yyy" in
4438         '')     fpossize=4
4439                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4440                 ;;
4441         *)      fpossize=$yyy
4442                 echo "Your $zzz is $fpossize bytes long."
4443                 ;;
4444         esac
4445 else
4446         dflt="$longsize"
4447         echo " " >&4
4448         echo "(I can't compile the test program.  Guessing...)" >&4
4449         rp="What is the size of your file positions (in bytes)?"
4450         . ./myread
4451         fpossize="$ans"
4452 fi
4453
4454
4455
4456 # Backward compatibility (uselfs is deprecated).
4457 case "$uselfs" in
4458 "$define"|true|[yY]*)
4459         cat <<EOM >&4
4460
4461 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4462 EOM
4463         uselargefiles="$define"
4464         ;;
4465 esac                          
4466
4467 case "$lseeksize:$fpossize" in
4468 8:8) cat <<EOM
4469
4470 You can have files larger than 2 gigabytes.
4471 EOM
4472    val="$define" ;;
4473 *)    case "$uselargefiles" in
4474    "$undef"|false|[nN]*) dflt='n' ;;
4475    *)   dflt='y' ;;
4476    esac
4477    cat <<EOM
4478
4479 Perl can be built to understand large files (files larger than 2 gigabytes)
4480 on some systems.  To do so, Configure can be run with -Duselargefiles.
4481
4482 If this doesn't make any sense to you, just accept the default '$dflt'.
4483 EOM
4484    rp='Try to understand large files, if available?'
4485    . ./myread
4486    case "$ans" in
4487    y|Y)         val="$define" ;;
4488    *)           val="$undef"  ;;
4489    esac
4490    ;;
4491 esac
4492 set uselargefiles
4493 eval $setvar
4494 case "$uselargefiles" in
4495 "$define")
4496 : Look for a hint-file generated 'call-back-unit'.  If the
4497 : user has specified that a large files perl is to be built,
4498 : we may need to set or change some other defaults.
4499         if $test -f uselargefiles.cbu; then
4500                 echo "Your platform has some specific hints for large file builds, using them..."
4501                 . ./uselargefiles.cbu
4502                 echo " "
4503                 echo "Rechecking to see how big your file offsets are..." >&4
4504                 $cat >try.c <<EOCP
4505 #include <sys/types.h>
4506 #include <stdio.h>
4507 int main()
4508 {
4509     printf("%d\n", (int)sizeof($lseektype));
4510     return(0); 
4511 }
4512 EOCP
4513                 set try
4514                 if eval $compile_ok; then
4515                         lseeksize=`./try`
4516                         $echo "Your file offsets are now $lseeksize bytes long."
4517                 else
4518                         dflt="$lseeksize"
4519                         echo " "
4520                         echo "(I can't seem to compile the test program.  Guessing...)"
4521                         rp="What is the size of your file offsets (in bytes)?"
4522                         . ./myread
4523                         lseeksize="$ans"
4524                 fi
4525                 case "$fpostype" in
4526                 *_t) zzz="$fpostype"    ;;
4527                 *)   zzz="fpos_t"       ;;
4528                 esac
4529                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4530                 $cat > try.c <<EOCP
4531 #include <sys/types.h>
4532 #include <stdio.h>
4533 int main() {
4534     printf("%d\n", (int)sizeof($fpostype));
4535     exit(0);
4536 }
4537 EOCP
4538                 set try
4539                 if eval $compile_ok; then
4540                         yyy=`./try`
4541                         dflt="$lseeksize"
4542                         case "$yyy" in
4543                         '')     echo " "
4544                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4545                                 ;;
4546                         *)      fpossize=$yyy
4547                                 echo " $fpossize bytes." >&4
4548                                 ;;
4549                         esac
4550                 else
4551                         dflt="$fpossize"
4552                         echo " "
4553                         echo "(I can't compile the test program.  Guessing...)" >&4
4554                         rp="What is the size of your file positions (in bytes)?"
4555                         . ./myread
4556                         fpossize="$ans"
4557                 fi
4558                 $rm -f try.c try
4559         fi
4560         ;;
4561 esac
4562
4563
4564 case "$usemorebits" in
4565 "$define"|true|[yY]*)
4566         use64bitint="$define"
4567         uselongdouble="$define"
4568         usemorebits="$define"
4569         ;;
4570 *)      usemorebits="$undef"
4571         ;;
4572 esac
4573
4574 : check for void type
4575 echo " "
4576 echo "Checking to see how well your C compiler groks the void type..." >&4
4577 case "$voidflags" in
4578 '')
4579         $cat >try.c <<'EOCP'
4580 #if TRY & 1
4581 void sub() {
4582 #else
4583 sub() {
4584 #endif
4585         extern void moo();      /* function returning void */
4586         void (*goo)();          /* ptr to func returning void */
4587 #if TRY & 8
4588         void *hue;              /* generic ptr */
4589 #endif
4590 #if TRY & 2
4591         void (*foo[10])();
4592 #endif
4593
4594 #if TRY & 4
4595         if(goo == moo) {
4596                 exit(0);
4597         }
4598 #endif
4599         exit(0);
4600 }
4601 int main() { sub(); }
4602 EOCP
4603         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4604                 voidflags=$defvoidused
4605         echo "Good.  It appears to support void to the level $package wants.">&4
4606                 if $contains warning .out >/dev/null 2>&1; then
4607                         echo "However, you might get some warnings that look like this:"
4608                         $cat .out
4609                 fi
4610         else
4611 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4612                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4613                         echo "It supports 1..."
4614                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4615                                 echo "It also supports 2..."
4616                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4617                                         voidflags=7
4618                                         echo "And it supports 4 but not 8 definitely."
4619                                 else
4620                                         echo "It doesn't support 4..."
4621                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4622                                                 voidflags=11
4623                                                 echo "But it supports 8."
4624                                         else
4625                                                 voidflags=3
4626                                                 echo "Neither does it support 8."
4627                                         fi
4628                                 fi
4629                         else
4630                                 echo "It does not support 2..."
4631                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4632                                         voidflags=13
4633                                         echo "But it supports 4 and 8."
4634                                 else
4635                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4636                                                 voidflags=5
4637                                                 echo "And it supports 4 but has not heard about 8."
4638                                         else
4639                                                 echo "However it supports 8 but not 4."
4640                                         fi
4641                                 fi
4642                         fi
4643                 else
4644                         echo "There is no support at all for void."
4645                         voidflags=0
4646                 fi
4647         fi
4648 esac
4649 case "$voidflags" in
4650 "$defvoidused") ;;
4651 *)      $cat >&4 <<'EOM'
4652   Support flag bits are:
4653     1: basic void declarations.
4654     2: arrays of pointers to functions returning void.
4655     4: operations between pointers to and addresses of void functions.
4656     8: generic void pointers.
4657 EOM
4658         dflt="$voidflags";
4659         rp="Your void support flags add up to what?"
4660         . ./myread
4661         voidflags="$ans"
4662         ;;
4663 esac
4664 $rm -f try.* .out
4665
4666 : check for length of pointer
4667 echo " "
4668 case "$ptrsize" in
4669 '')
4670         echo "Checking to see how big your pointers are..." >&4
4671         if test "$voidflags" -gt 7; then
4672                 echo '#define VOID_PTR char *' > try.c
4673         else
4674                 echo '#define VOID_PTR void *' > try.c
4675         fi
4676         $cat >>try.c <<'EOCP'
4677 #include <stdio.h>
4678 int main()
4679 {
4680     printf("%d\n", (int)sizeof(VOID_PTR));
4681     exit(0);
4682 }
4683 EOCP
4684         set try
4685         if eval $compile_ok; then
4686                 ptrsize=`./try`
4687                 echo "Your pointers are $ptrsize bytes long."
4688         else
4689                 dflt='4'
4690                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4691                 rp="What is the size of a pointer (in bytes)?"
4692                 . ./myread
4693                 ptrsize="$ans"
4694         fi
4695         ;;
4696 esac
4697 $rm -f try.c try
4698
4699 : check for long long
4700 echo " "
4701 echo "Checking to see if you have long long..." >&4
4702 echo 'int main() { long long x = 7; return 0; }' > try.c
4703 set try
4704 if eval $compile; then
4705         val="$define"
4706         echo "You have long long."
4707 else
4708         val="$undef"
4709         echo "You do not have long long."
4710 fi
4711 $rm try.*
4712 set d_longlong
4713 eval $setvar
4714
4715 : check for length of long long
4716 case "${d_longlong}${longlongsize}" in
4717 $define)
4718         echo " "
4719         echo "Checking to see how big your long longs are..." >&4
4720         $cat >try.c <<'EOCP'
4721 #include <stdio.h>
4722 int main()
4723 {
4724     printf("%d\n", (int)sizeof(long long));
4725     return(0);
4726 }
4727 EOCP
4728         set try
4729         if eval $compile_ok; then
4730                 longlongsize=`./try$exe_ext`
4731                 echo "Your long longs are $longlongsize bytes long."
4732         else
4733                 dflt='8'
4734                 echo " "
4735                 echo "(I can't seem to compile the test program.  Guessing...)"
4736                 rp="What is the size of a long long (in bytes)?"
4737                 . ./myread
4738                 longlongsize="$ans"
4739         fi
4740         if $test "X$longsize" = "X$longlongsize"; then
4741                 echo "(That isn't any different from an ordinary long.)"
4742         fi      
4743         ;;
4744 esac
4745 $rm -f try.* try
4746
4747 : determine filename position in cpp output
4748 echo " "
4749 echo "Computing filename position in cpp output for #include directives..." >&4
4750 echo '#include <stdio.h>' > foo.c
4751 $cat >fieldn <<EOF
4752 $startsh
4753 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4754 $grep '^[       ]*#.*stdio\.h' | \
4755 while read cline; do
4756         pos=1
4757         set \$cline
4758         while $test \$# -gt 0; do
4759                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4760                         echo "\$pos"
4761                         exit 0
4762                 fi
4763                 shift
4764                 pos=\`expr \$pos + 1\`
4765         done
4766 done
4767 EOF
4768 chmod +x fieldn
4769 fieldn=`./fieldn`
4770 $rm -f foo.c fieldn
4771 case $fieldn in
4772 '') pos='???';;
4773 1) pos=first;;
4774 2) pos=second;;
4775 3) pos=third;;
4776 *) pos="${fieldn}th";;
4777 esac
4778 echo "Your cpp writes the filename in the $pos field of the line."
4779
4780 : locate header file
4781 $cat >findhdr <<EOF
4782 $startsh
4783 wanted=\$1
4784 name=''
4785 for usrincdir in $usrinc
4786 do
4787         if test -f \$usrincdir/\$wanted; then
4788                 echo "\$usrincdir/\$wanted"
4789                 exit 0
4790         fi
4791 done
4792 awkprg='{ print \$$fieldn }'
4793 echo "#include <\$wanted>" > foo\$\$.c
4794 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4795 $grep "^[       ]*#.*\$wanted" | \
4796 while read cline; do
4797         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4798         case "\$name" in
4799         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4800         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4801         *) exit 2;;
4802         esac;
4803 done;
4804 #
4805 # status = 0: grep returned 0 lines, case statement not executed
4806 # status = 1: headerfile found
4807 # status = 2: while loop executed, no headerfile found
4808 #
4809 status=\$?
4810 $rm -f foo\$\$.c;
4811 if test \$status -eq 1; then
4812         exit 0;
4813 fi
4814 exit 1
4815 EOF
4816 chmod +x findhdr
4817
4818 : define an alternate in-header-list? function
4819 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4820 cont=true; xxf="echo \"<\$1> found.\" >&4";
4821 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4822 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4823 esac;
4824 case $# in 4) instead=instead;; *) instead="at last";; esac;
4825 while $test "$cont"; do
4826         xxx=`./findhdr $1`
4827         var=$2; eval "was=\$$2";
4828         if $test "$xxx" && $test -r "$xxx";
4829         then eval $xxf;
4830         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4831                 cont="";
4832         else eval $xxnf;
4833         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4834         set $yyy; shift; shift; yyy=$@;
4835         case $# in 0) cont="";;
4836         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4837                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4838         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4839                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4840         esac;
4841 done;
4842 while $test "$yyy";
4843 do set $yyy; var=$2; eval "was=\$$2";
4844         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4845         set $yyy; shift; shift; yyy=$@;
4846 done'
4847
4848 : see if inttypes.h is available
4849 : we want a real compile instead of Inhdr because some systems
4850 : have an inttypes.h which includes non-existent headers
4851 echo " "
4852 $cat >try.c <<EOCP
4853 #include <inttypes.h>
4854 int main() {
4855         static int32_t foo32 = 0x12345678;
4856 }
4857 EOCP
4858 set try
4859 if eval $compile; then
4860         echo "<inttypes.h> found." >&4
4861         val="$define"
4862 else
4863         echo "<inttypes.h> NOT found." >&4
4864         val="$undef"
4865 fi
4866 $rm -f try.c try
4867 set i_inttypes
4868 eval $setvar
4869
4870 : check for int64_t
4871 echo " "
4872 echo "Checking to see if you have int64_t..." >&4
4873 $cat >try.c <<EOCP
4874 #include <sys/types.h>
4875 #$i_inttypes I_INTTYPES
4876 #ifdef I_INTTYPES
4877 #include <inttypes.h>
4878 #endif
4879 int main() { int64_t x = 7; }
4880 EOCP
4881 set try
4882 if eval $compile; then
4883         val="$define"
4884         echo "You have int64_t."
4885 else
4886         val="$undef"
4887         echo "You do not have int64_t."
4888 fi
4889 $rm -f try try.*
4890 set d_int64_t
4891 eval $setvar
4892
4893
4894 echo " "
4895 echo "Checking which 64-bit integer type we could use..." >&4
4896
4897 case "$intsize" in
4898 8) val=int
4899    set quadtype
4900    eval $setvar
4901    val='"unsigned int"'
4902    set uquadtype
4903    eval $setvar
4904    quadkind=1
4905    ;;
4906 *) case "$longsize" in
4907    8) val=long
4908       set quadtype
4909       eval $setvar
4910       val='"unsigned long"'
4911       set uquadtype
4912       eval $setvar
4913       quadkind=2
4914       ;;
4915    *) case "$d_longlong:$longlongsize" in
4916       define:8)
4917         val='"long long"'
4918         set quadtype
4919         eval $setvar
4920         val='"unsigned long long"'
4921         set uquadtype
4922         eval $setvar
4923         quadkind=3
4924         ;;
4925       *) case "$d_int64_t" in
4926          define)
4927            val=int64_t
4928            set quadtype
4929            eval $setvar
4930            val=uint64_t
4931            set uquadtype
4932            eval $setvar
4933            quadkind=4
4934            ;;
4935          esac
4936          ;;
4937       esac
4938       ;;
4939    esac
4940    ;;
4941 esac
4942
4943 case "$quadtype" in
4944 '')     echo "Alas, no 64-bit integer types in sight." >&4
4945         d_quad="$undef"
4946         ;;
4947 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4948         d_quad="$define"
4949         ;;
4950 esac
4951
4952
4953 case "$uselonglong" in
4954 "$define"|true|[yY]*)
4955         cat <<EOM >&4
4956
4957 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4958 EOM
4959         use64bitint="$define"
4960         ;;
4961 esac                          
4962 case "$use64bits" in
4963 "$define"|true|[yY]*)
4964         cat <<EOM >&4
4965
4966 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4967 EOM
4968         use64bitint="$define"
4969         ;;
4970 esac                          
4971 case "$use64bitints" in
4972 "$define"|true|[yY]*)
4973         cat <<EOM >&4
4974
4975 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4976 EOM
4977         use64bitint="$define"
4978         ;;
4979 esac                          
4980 case "$use64bitsint" in
4981 "$define"|true|[yY]*)
4982         cat <<EOM >&4
4983
4984 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4985 EOM
4986         use64bitint="$define"
4987         ;;
4988 esac                          
4989 case "$uselonglongs" in
4990 "$define"|true|[yY]*)
4991         cat <<EOM >&4
4992
4993 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4994 EOM
4995         use64bitint="$define"
4996         ;;
4997 esac                          
4998 case "$use64bitsall" in
4999 "$define"|true|[yY]*)
5000         cat <<EOM >&4
5001
5002 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5003 EOM
5004         use64bitall="$define"
5005         ;;
5006 esac                          
5007
5008 case "$ccflags" in
5009 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5010 esac
5011 case "$use64bitall" in
5012 "$define"|true|[yY]*) use64bitint="$define" ;;
5013 esac
5014
5015 case "$longsize" in
5016 8) cat <<EOM
5017
5018 You have natively 64-bit long integers.
5019 EOM
5020    val="$define"
5021    ;;
5022 *) case "$use64bitint" in
5023    "$define"|true|[yY]*) dflt='y';;
5024    *) dflt='n';;
5025    esac
5026    case "$d_quad" in
5027    "$define") ;;
5028    *) dflt='n' ;;
5029    esac
5030    cat <<EOM
5031
5032 Perl can be built to take advantage of 64-bit integer types
5033 on some systems.  To do so, Configure can be run with -Duse64bitint.
5034 Choosing this option will most probably introduce binary incompatibilities.
5035
5036 If this doesn't make any sense to you, just accept the default '$dflt'.
5037 (The default has been chosen based on your configuration.)
5038 EOM
5039    rp='Try to use 64-bit integers, if available?'
5040    . ./myread
5041    case "$ans" in
5042    [yY]*) val="$define" ;;
5043    *)     val="$undef"  ;;
5044    esac
5045    ;;
5046 esac
5047 set use64bitint
5048 eval $setvar
5049
5050 case "$use64bitall" in
5051 "$define"|true|[yY]*) dflt='y' ;;
5052 *) case "$longsize" in
5053    8) dflt='y' ;;
5054    *) dflt='n' ;;
5055    esac
5056    ;;
5057 esac    
5058 cat <<EOM
5059
5060 You may also choose to try maximal 64-bitness.  It means using as much
5061 64-bitness as possible on the platform.  This in turn means even more
5062 binary incompatibilities.  On the other hand, your platform may not
5063 have any more 64-bitness available than what you already have chosen.
5064
5065 If this doesn't make any sense to you, just accept the default '$dflt'.
5066 (The default has been chosen based on your configuration.)
5067 EOM
5068 rp='Try to use maximal 64-bit support, if available?'
5069 . ./myread
5070 case "$ans" in
5071 [yY]*) val="$define" ;;
5072 *)     val="$undef"  ;;
5073 esac
5074 set use64bitall
5075 eval $setvar
5076 case "$use64bitall" in
5077 "$define")
5078         case "$use64bitint" in
5079         "$undef")
5080                 cat <<EOM
5081
5082 Since you have chosen a maximally 64-bit build, I'm also turning on
5083 the use of 64-bit integers.
5084 EOM
5085                 use64bitint="$define" ;;
5086         esac
5087         ;;
5088 esac
5089
5090 case "$use64bitall" in
5091 "$define"|true|[yY]*)
5092         case "$ptrsize" in
5093         4)      cat <<EOM >&4
5094
5095 *** You have chosen a maximally 64-bit build, but your pointers
5096 *** are only 4 bytes wide, disabling maximal 64-bitness.
5097
5098 EOM
5099                 use64bitall="$undef"
5100                 case "$use64bitint" in
5101                 "$define"|true|[yY]*) ;;
5102                 *)      cat <<EOM >&4
5103
5104 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5105
5106 EOM
5107                         use64bitint="$define"
5108                         ;;
5109                 esac
5110                 ;;
5111         esac
5112         ;;
5113 esac
5114
5115 case "$use64bitint" in
5116 "$define"|true|[yY]*)
5117 : Look for a hint-file generated 'call-back-unit'.  If the
5118 : user has specified that a 64-bit perl is to be built,
5119 : we may need to set or change some other defaults.
5120         if $test -f use64bitint.cbu; then
5121                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5122                 . ./use64bitint.cbu
5123         fi
5124         case "$longsize" in
5125         4) case "$archname64" in
5126            '') archname64=64int ;;
5127            esac
5128            ;;
5129         esac
5130         ;;
5131 esac
5132
5133 case "$use64bitall" in
5134 "$define"|true|[yY]*)
5135 : Look for a hint-file generated 'call-back-unit'.  If the
5136 : user has specified that a maximally 64-bit perl is to be built,
5137 : we may need to set or change some other defaults.
5138         if $test -f use64bitall.cbu; then
5139                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5140                 . ./use64bitall.cbu
5141         fi
5142         case "$longsize" in
5143         4) case "$archname64" in
5144            ''|64int) archname64=64all ;;
5145            esac
5146            ;;
5147         esac
5148         ;;
5149 esac
5150
5151 echo " "
5152 echo "Checking for GNU C Library..." >&4
5153 cat >gnulibc.c <<EOM
5154 #include <stdio.h>
5155 int main()
5156 {
5157 #ifdef __GLIBC__
5158     exit(0);
5159 #else
5160     exit(1);
5161 #endif
5162 }
5163 EOM
5164 set gnulibc
5165 if eval $compile_ok && ./gnulibc; then
5166         val="$define"
5167         echo "You are using the GNU C Library"
5168 else
5169         val="$undef"
5170         echo "You are not using the GNU C Library"
5171 fi
5172 $rm -f gnulibc*
5173 set d_gnulibc
5174 eval $setvar
5175
5176 : see if nm is to be used to determine whether a symbol is defined or not
5177 case "$usenm" in
5178 '')
5179         dflt=''
5180         case "$d_gnulibc" in
5181         "$define")
5182                 echo " "
5183                 echo "nm probably won't work on the GNU C Library." >&4
5184                 dflt=n
5185                 ;;
5186         esac
5187         case "$dflt" in
5188         '') 
5189                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5190                         echo " "
5191                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5192                         echo "'nm' won't be sufficient on this sytem." >&4
5193                         dflt=n
5194                 fi
5195                 ;;
5196         esac
5197         case "$dflt" in
5198         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5199                 if $test $dflt -gt 20; then
5200                         dflt=y
5201                 else
5202                         dflt=n
5203                 fi
5204                 ;;
5205         esac
5206         ;;
5207 *)
5208         case "$usenm" in
5209         true|$define) dflt=y;;
5210         *) dflt=n;;
5211         esac
5212         ;;
5213 esac
5214 $cat <<EOM
5215
5216 I can use $nm to extract the symbols from your C libraries. This
5217 is a time consuming task which may generate huge output on the disk (up
5218 to 3 megabytes) but that should make the symbols extraction faster. The
5219 alternative is to skip the 'nm' extraction part and to compile a small
5220 test program instead to determine whether each symbol is present. If
5221 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5222 this may be the best solution.
5223
5224 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5225
5226 EOM
5227 rp="Shall I use $nm to extract C symbols from the libraries?"
5228 . ./myread
5229 case "$ans" in
5230 [Nn]*) usenm=false;;
5231 *) usenm=true;;
5232 esac
5233
5234 runnm=$usenm
5235 case "$reuseval" in
5236 true) runnm=false;;
5237 esac
5238
5239 : nm options which may be necessary
5240 case "$nm_opt" in
5241 '') if $test -f /mach_boot; then
5242                 nm_opt=''       # Mach
5243         elif $test -d /usr/ccs/lib; then
5244                 nm_opt='-p'     # Solaris (and SunOS?)
5245         elif $test -f /dgux; then
5246                 nm_opt='-p'     # DG-UX
5247         elif $test -f /lib64/rld; then
5248                 nm_opt='-p'     # 64-bit Irix
5249         else
5250                 nm_opt=''
5251         fi;;
5252 esac
5253
5254 : nm options which may be necessary for shared libraries but illegal
5255 : for archive libraries.  Thank you, Linux.
5256 case "$nm_so_opt" in
5257 '')     case "$myuname" in
5258         *linux*)
5259                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5260                         nm_so_opt='--dynamic'
5261                 fi
5262                 ;;
5263         esac
5264         ;;
5265 esac
5266
5267 case "$runnm" in
5268 true)
5269 : get list of predefined functions in a handy place
5270 echo " "
5271 case "$libc" in
5272 '') libc=unknown
5273         case "$libs" in
5274         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5275         esac
5276         ;;
5277 esac
5278 libnames='';
5279 case "$libs" in
5280 '') ;;
5281 *)  for thislib in $libs; do
5282         case "$thislib" in
5283         -lc|-lc_s)
5284                 : Handle C library specially below.
5285                 ;;
5286         -l*)
5287                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5288                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5289                         :
5290                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5291                         :
5292                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5293                         :
5294                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5295                         :
5296                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5297                         :
5298                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5299                         :
5300                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5301                         :
5302                 else
5303                         try=''
5304                 fi
5305                 libnames="$libnames $try"
5306                 ;;
5307         *) libnames="$libnames $thislib" ;;
5308         esac
5309         done
5310         ;;
5311 esac
5312 xxx=normal
5313 case "$libc" in
5314 unknown)
5315         set /lib/libc.$so
5316         for xxx in $libpth; do
5317                 $test -r $1 || set $xxx/libc.$so
5318                 : The messy sed command sorts on library version numbers.
5319                 $test -r $1 || \
5320                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5321                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5322                                 h
5323                                 s/[0-9][0-9]*/0000&/g
5324                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5325                                 G
5326                                 s/\n/ /' | \
5327                          $sort | $sed -e 's/^.* //'`
5328                 eval set \$$#
5329         done
5330         $test -r $1 || set /usr/ccs/lib/libc.$so
5331         $test -r $1 || set /lib/libsys_s$_a
5332         ;;
5333 *)
5334         set blurfl
5335         ;;
5336 esac
5337 if $test -r "$1"; then
5338         echo "Your (shared) C library seems to be in $1."
5339         libc="$1"
5340 elif $test -r /lib/libc && $test -r /lib/clib; then
5341         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5342         xxx=apollo
5343         libc='/lib/clib /lib/libc'
5344         if $test -r /lib/syslib; then
5345                 echo "(Your math library is in /lib/syslib.)"
5346                 libc="$libc /lib/syslib"
5347         fi
5348 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5349         echo "Your C library seems to be in $libc, as you said before."
5350 elif $test -r $incpath/usr/lib/libc$_a; then
5351         libc=$incpath/usr/lib/libc$_a;
5352         echo "Your C library seems to be in $libc.  That's fine."
5353 elif $test -r /lib/libc$_a; then
5354         libc=/lib/libc$_a;
5355         echo "Your C library seems to be in $libc.  You're normal."
5356 else
5357         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5358                 :
5359         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5360                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5361         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5362                 :
5363         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5364                 :
5365         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5366                 :
5367         else
5368                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5369         fi
5370         if $test -r "$tans"; then
5371                 echo "Your C library seems to be in $tans, of all places."
5372                 libc=$tans
5373         else
5374                 libc='blurfl'
5375         fi
5376 fi
5377 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5378         dflt="$libc"
5379         cat <<EOM
5380
5381 If the guess above is wrong (which it might be if you're using a strange
5382 compiler, or your machine supports multiple models), you can override it here.
5383
5384 EOM
5385 else
5386         dflt=''
5387         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5388         cat >&4 <<EOM
5389 I can't seem to find your C library.  I've looked in the following places:
5390
5391 EOM
5392         $sed 's/^/      /' libpath
5393         cat <<EOM
5394
5395 None of these seems to contain your C library. I need to get its name...
5396
5397 EOM
5398 fi
5399 fn=f
5400 rp='Where is your C library?'
5401 . ./getfile
5402 libc="$ans"
5403
5404 echo " "
5405 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5406 set X `cat libnames`
5407 shift
5408 xxx=files
5409 case $# in 1) xxx=file; esac
5410 echo "Extracting names from the following $xxx for later perusal:" >&4
5411 echo " "
5412 $sed 's/^/      /' libnames >&4
5413 echo " "
5414 $echo $n "This may take a while...$c" >&4
5415
5416 for file in $*; do
5417         case $file in
5418         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5419         *) $nm $nm_opt $file 2>/dev/null;;
5420         esac
5421 done >libc.tmp
5422
5423 $echo $n ".$c"
5424 $grep fprintf libc.tmp > libc.ptf
5425 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5426 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5427 xxx='[ADTSIW]'
5428 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5429         eval $xscan;\
5430         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5431                 eval $xrun
5432 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5433         eval $xscan;\
5434         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5435                 eval $xrun
5436 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5437         eval $xscan;\
5438         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5439                 eval $xrun
5440 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5441         eval $xscan;\
5442         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5443                 eval $xrun
5444 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5445         eval $xscan;\
5446         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5447                 eval $xrun
5448 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5449         eval $xscan;\
5450         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5451                 eval $xrun
5452 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5453                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5454         eval $xscan;\
5455         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5456                 eval $xrun
5457 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5458         eval $xscan;\
5459         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5460                 eval $xrun
5461 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5462         eval $xscan;\
5463         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5464                 eval $xrun
5465 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5466         eval $xscan;\
5467         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5468                 eval $xrun
5469 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5470         eval $xscan;\
5471         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5472                 eval $xrun
5473 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5474         eval $xscan;\
5475         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5476                 eval $xrun
5477 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5478         eval $xscan;\
5479         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5480                 eval $xrun
5481 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5482         eval $xscan;\
5483         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5484                 eval $xrun
5485 else
5486         $nm -p $* 2>/dev/null >libc.tmp
5487         $grep fprintf libc.tmp > libc.ptf
5488         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5489                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5490         then
5491                 nm_opt='-p'
5492                 eval $xrun
5493         else
5494                 echo " "
5495                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5496                 com=''
5497                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5498                         for thisname in $libnames $libc; do
5499                                 $ar t $thisname >>libc.tmp
5500                         done
5501                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5502                         echo "Ok." >&4
5503                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5504                         # Repeat libc to extract forwarders to DLL entries too
5505                         for thisname in $libnames $libc; do
5506                                 $ar tv $thisname >>libc.tmp
5507                                 # Revision 50 of EMX has bug in $ar.
5508                                 # it will not extract forwarders to DLL entries
5509                                 # Use emximp which will extract exactly them.
5510                                 emximp -o tmp.imp $thisname \
5511                                     2>/dev/null && \
5512                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5513                                     < tmp.imp >>libc.tmp
5514                                 $rm tmp.imp
5515                         done
5516                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5517                         echo "Ok." >&4
5518                 else
5519                         echo "$ar didn't seem to work right." >&4
5520                         echo "Maybe this is a Cray...trying bld instead..." >&4
5521                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5522                         then
5523                                 for thisname in $libnames; do
5524                                         bld t $libnames | \
5525                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5526                                         $ar t $thisname >>libc.tmp
5527                                 done
5528                                 echo "Ok." >&4
5529                         else
5530                                 echo "That didn't work either.  Giving up." >&4
5531                                 exit 1
5532                         fi
5533                 fi
5534         fi
5535 fi
5536 nm_extract="$com"
5537 if $test -f /lib/syscalls.exp; then
5538         echo " "
5539         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5540         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5541 fi
5542 ;;
5543 esac
5544 $rm -f libnames libpath
5545
5546 : is a C symbol defined?
5547 csym='tlook=$1;
5548 case "$3" in
5549 -v) tf=libc.tmp; tc=""; tdc="";;
5550 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5551 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5552 esac;
5553 tx=yes;
5554 case "$reuseval-$4" in
5555 true-) ;;
5556 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5557 esac;
5558 case "$tx" in
5559 yes)
5560         case "$runnm" in
5561         true)
5562                 if $contains $tlook $tf >/dev/null 2>&1;
5563                 then tval=true;
5564                 else tval=false;
5565                 fi;;
5566         *)
5567                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5568                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5569                 then tval=true;
5570                 else tval=false;
5571                 fi;
5572                 $rm -f t t.c;;
5573         esac;;
5574 *)
5575         case "$tval" in
5576         $define) tval=true;;
5577         *) tval=false;;
5578         esac;;
5579 esac;
5580 eval "$2=$tval"'
5581
5582 : define an is-in-libc? function
5583 inlibc='echo " "; td=$define; tu=$undef;
5584 sym=$1; var=$2; eval "was=\$$2";
5585 tx=yes;
5586 case "$reuseval$was" in
5587 true) ;;
5588 true*) tx=no;;
5589 esac;
5590 case "$tx" in
5591 yes)
5592         set $sym tres -f;
5593         eval $csym;
5594         case "$tres" in
5595         true)
5596                 echo "$sym() found." >&4;
5597                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5598         *)
5599                 echo "$sym() NOT found." >&4;
5600                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5601         esac;;
5602 *)
5603         case "$was" in
5604         $define) echo "$sym() found." >&4;;
5605         *) echo "$sym() NOT found." >&4;;
5606         esac;;
5607 esac'
5608
5609 : see if sqrtl exists
5610 set sqrtl d_sqrtl
5611 eval $inlibc
5612
5613 case "$ccflags" in
5614 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5615 esac
5616
5617 case "$uselongdouble" in
5618 $define|true|[yY]*)     dflt='y';;
5619 *) dflt='n';;
5620 esac
5621 cat <<EOM
5622
5623 Perl can be built to take advantage of long doubles which
5624 (if available) may give more accuracy and range for floating point numbers.
5625
5626 If this doesn't make any sense to you, just accept the default '$dflt'.
5627 EOM
5628 rp='Try to use long doubles if available?'
5629 . ./myread
5630 case "$ans" in
5631 y|Y)    val="$define"   ;;
5632 *)      val="$undef"    ;;
5633 esac
5634 set uselongdouble
5635 eval $setvar
5636
5637 case "$uselongdouble" in
5638 true|[yY]*) uselongdouble="$define" ;;
5639 esac
5640
5641 case "$uselongdouble" in
5642 $define)
5643 : Look for a hint-file generated 'call-back-unit'.  If the
5644 : user has specified that long doubles should be used,
5645 : we may need to set or change some other defaults.
5646         if $test -f uselongdouble.cbu; then
5647                 echo "Your platform has some specific hints for long doubles, using them..."
5648                 . ./uselongdouble.cbu
5649         else
5650                 $cat <<EOM
5651 (Your platform doesn't have any specific hints for long doubles.)
5652 EOM
5653         fi
5654         ;;
5655 esac
5656
5657 case "$uselongdouble:$d_sqrtl" in
5658 $define:$undef)
5659                 $cat <<EOM >&4
5660
5661 *** You requested the use of long doubles but you do not seem to have
5662 *** the mathematic functions for long doubles.  I'm disabling the use
5663 *** of long doubles.
5664
5665 EOM
5666         uselongdouble=$undef
5667         ;;
5668 esac
5669
5670 : check for length of double
5671 echo " "
5672 case "$doublesize" in
5673 '')
5674         echo "Checking to see how big your double precision numbers are..." >&4
5675         $cat >try.c <<'EOCP'
5676 #include <stdio.h>
5677 int main()
5678 {
5679     printf("%d\n", (int)sizeof(double));
5680     exit(0);
5681 }
5682 EOCP
5683         set try
5684         if eval $compile_ok; then
5685                 doublesize=`./try`
5686                 echo "Your double is $doublesize bytes long."
5687         else
5688                 dflt='8'
5689                 echo "(I can't seem to compile the test program.  Guessing...)"
5690                 rp="What is the size of a double precision number (in bytes)?"
5691                 . ./myread
5692                 doublesize="$ans"
5693         fi
5694         ;;
5695 esac
5696 $rm -f try.c try
5697
5698 : check for long doubles
5699 echo " "
5700 echo "Checking to see if you have long double..." >&4
5701 echo 'int main() { long double x = 7.0; }' > try.c
5702 set try
5703 if eval $compile; then
5704         val="$define"
5705         echo "You have long double."
5706 else
5707         val="$undef"
5708         echo "You do not have long double."
5709 fi
5710 $rm try.*
5711 set d_longdbl
5712 eval $setvar
5713
5714 : check for length of long double
5715 case "${d_longdbl}${longdblsize}" in
5716 $define)
5717         echo " "
5718         echo "Checking to see how big your long doubles are..." >&4
5719         $cat >try.c <<'EOCP'
5720 #include <stdio.h>
5721 int main()
5722 {
5723         printf("%d\n", sizeof(long double));
5724 }
5725 EOCP
5726         set try
5727         set try
5728         if eval $compile; then
5729                 longdblsize=`./try$exe_ext`
5730                 echo "Your long doubles are $longdblsize bytes long."
5731         else
5732                 dflt='8'
5733                 echo " "
5734                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5735                 rp="What is the size of a long double (in bytes)?"
5736                 . ./myread
5737                 longdblsize="$ans"
5738         fi
5739         if $test "X$doublesize" = "X$longdblsize"; then
5740                 echo "(That isn't any different from an ordinary double.)"
5741         fi      
5742         ;;
5743 esac
5744 $rm -f try.* try
5745
5746 case "$useperlio" in
5747 $define|true|[yY]*|'')  dflt='y';;
5748 *) dflt='n';;
5749 esac
5750 cat <<EOM
5751
5752 Previous version of $package used the standard IO mechanisms as
5753 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5754 alternate IO mechanisms via the PerlIO abstraction layer, but the
5755 stdio mechanism is still available if needed.  The abstraction layer
5756 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5757 Using PerlIO with sfio may cause problems with some extension modules.
5758
5759 If this doesn't make any sense to you, just accept the default '$dflt'.
5760 EOM
5761 rp='Use the PerlIO abstraction layer?'
5762 . ./myread
5763 case "$ans" in
5764 y|Y) 
5765         val="$define"
5766         ;;
5767 *)      
5768         echo "Ok, doing things the stdio way."
5769         val="$undef"
5770         ;;
5771 esac
5772 set useperlio
5773 eval $setvar 
5774
5775 case "$usesocks" in
5776 $define|true|[yY]*)
5777         case "$useperlio" in
5778         $define|true|[yY]*) ;;
5779         *)      cat >&4 <<EOM
5780
5781 You are using the SOCKS proxy protocol library which means that you
5782 should also use the PerlIO layer.  You may be headed for trouble.
5783
5784 EOM
5785                 ;;
5786         esac
5787         ;;
5788 esac
5789
5790         
5791 : determine the architecture name
5792 echo " "
5793 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5794         tarch=`arch`"-$osname"
5795 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5796         if uname -m > tmparch 2>&1 ; then
5797                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5798                         -e 's/$/'"-$osname/" tmparch`
5799         else
5800                 tarch="$osname"
5801         fi
5802         $rm -f tmparch
5803 else
5804         tarch="$osname"
5805 fi
5806 case "$myarchname" in
5807 ''|"$tarch") ;;
5808 *)
5809         echo "(Your architecture name used to be $myarchname.)"
5810         archname=''
5811         ;;
5812 esac
5813 myarchname="$tarch"
5814 case "$archname" in
5815 '') dflt="$tarch";;
5816 *) dflt="$archname";;
5817 esac
5818 rp='What is your architecture name'
5819 . ./myread
5820 archname="$ans"
5821 case "$usethreads" in
5822 $define)
5823         echo "Threads selected." >&4
5824         case "$archname" in
5825         *-thread*) echo "...and architecture name already has -thread." >&4
5826                 ;;
5827         *)      archname="$archname-thread"
5828                 echo "...setting architecture name to $archname." >&4
5829                 ;;
5830         esac
5831         ;;
5832 esac
5833 case "$usemultiplicity" in
5834 $define)
5835         echo "Multiplicity selected." >&4
5836         case "$archname" in
5837         *-multi*) echo "...and architecture name already has -multi." >&4
5838                 ;;
5839         *)      archname="$archname-multi"
5840                 echo "...setting architecture name to $archname." >&4
5841                 ;;
5842         esac
5843         ;;
5844 esac
5845 case "$use64bitint$use64bitall" in
5846 *"$define"*)
5847         case "$archname64" in
5848         '')
5849                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5850                 ;;
5851         *)
5852                 case "$use64bitint" in
5853                 "$define") echo "64 bit integers selected." >&4 ;;
5854                 esac
5855                 case "$use64bitall" in
5856                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5857                 esac
5858                 case "$archname" in
5859                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5860                         ;;
5861                 *)      archname="$archname-$archname64"
5862                         echo "...setting architecture name to $archname." >&4
5863                         ;;
5864                 esac
5865                 ;;
5866         esac
5867 esac
5868 case "$uselongdouble" in
5869 $define)
5870         echo "Long doubles selected." >&4
5871         case "$longdblsize" in
5872         $doublesize)
5873                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5874                 ;;
5875         *)
5876                 case "$archname" in
5877                 *-ld*) echo "...and architecture name already has -ld." >&4
5878                         ;;
5879                 *)      archname="$archname-ld"
5880                         echo "...setting architecture name to $archname." >&4
5881                         ;;
5882                 esac
5883                 ;;
5884         esac
5885         ;;
5886 esac
5887 case "$useperlio" in
5888 $define)
5889         echo "Perlio selected." >&4
5890         ;;
5891 *)
5892         echo "Perlio not selected, using stdio." >&4
5893         case "$archname" in
5894         *-stdio*) echo "...and architecture name already has -stdio." >&4
5895                 ;;
5896         *)      archname="$archname-stdio"
5897                 echo "...setting architecture name to $archname." >&4
5898                 ;;
5899         esac
5900         ;;
5901 esac
5902
5903 : determine root of directory hierarchy where package will be installed.
5904 case "$prefix" in
5905 '')
5906         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5907         ;;
5908 *)
5909         dflt="$prefix"
5910         ;;
5911 esac
5912 $cat <<EOM
5913
5914 By default, $package will be installed in $dflt/bin, manual pages
5915 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5916 installation directories. Typically this is something like /usr/local.
5917 If you wish to have binaries under /usr/bin but other parts of the
5918 installation under /usr/local, that's ok: you will be prompted
5919 separately for each of the installation directories, the prefix being
5920 only used to set the defaults.
5921
5922 EOM
5923 fn=d~
5924 rp='Installation prefix to use?'
5925 . ./getfile
5926 oldprefix=''
5927 case "$prefix" in
5928 '') ;;
5929 *)
5930         case "$ans" in
5931         "$prefix") ;;
5932         *) oldprefix="$prefix";;
5933         esac
5934         ;;
5935 esac
5936 prefix="$ans"
5937 prefixexp="$ansexp"
5938
5939 case "$afsroot" in
5940 '')     afsroot=/afs ;;
5941 *)      afsroot=$afsroot ;;
5942 esac
5943
5944 : is AFS running?
5945 echo " "
5946 case "$afs" in
5947 $define|true)   afs=true ;;
5948 $undef|false)   afs=false ;;
5949 *)      if test -d $afsroot; then
5950                 afs=true
5951         else
5952                 afs=false
5953         fi
5954         ;;
5955 esac
5956 if $afs; then
5957         echo "AFS may be running... I'll be extra cautious then..." >&4
5958 else
5959         echo "AFS does not seem to be running..." >&4
5960 fi
5961
5962 : determine installation prefix for where package is to be installed.
5963 if $afs; then 
5964 $cat <<EOM
5965
5966 Since you are running AFS, I need to distinguish the directory in which
5967 files will reside from the directory in which they are installed (and from
5968 which they are presumably copied to the former directory by occult means).
5969
5970 EOM
5971         case "$installprefix" in
5972         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5973         *) dflt="$installprefix";;
5974         esac
5975 else
5976 $cat <<EOM
5977
5978 In some special cases, particularly when building $package for distribution,
5979 it is convenient to distinguish between the directory in which files should 
5980 be installed from the directory ($prefix) in which they 
5981 will eventually reside.  For most users, these two directories are the same.
5982
5983 EOM
5984         case "$installprefix" in
5985         '') dflt=$prefix ;;
5986         *) dflt=$installprefix;;
5987         esac
5988 fi
5989 fn=d~
5990 rp='What installation prefix should I use for installing files?'
5991 . ./getfile
5992 installprefix="$ans"
5993 installprefixexp="$ansexp"
5994
5995 : set the prefixit variable, to compute a suitable default value
5996 prefixit='case "$3" in
5997 ""|none)
5998         case "$oldprefix" in
5999         "") eval "$1=\"\$$2\"";;
6000         *)
6001                 case "$3" in
6002                 "") eval "$1=";;
6003                 none)
6004                         eval "tp=\"\$$2\"";
6005                         case "$tp" in
6006                         ""|" ") eval "$1=\"\$$2\"";;
6007                         *) eval "$1=";;
6008                         esac;;
6009                 esac;;
6010         esac;;
6011 *)
6012         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6013         case "$tp" in
6014         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6015         /*-$oldprefix/*|\~*-$oldprefix/*)
6016                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6017         *) eval "$1=\"\$$2\"";;
6018         esac;;
6019 esac'
6020
6021
6022 : get the patchlevel
6023 echo " "
6024 echo "Getting the current patchlevel..." >&4
6025 if $test -r $rsrc/patchlevel.h;then
6026         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6027         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6028         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6029         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6030         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6031         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6032        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6033 else
6034         revision=0
6035         patchlevel=0
6036         subversion=0
6037         api_revision=0
6038         api_version=0
6039         api_subversion=0
6040         perl_patchlevel=0
6041         $echo "(You do not have patchlevel.h.  Eek.)"
6042 fi
6043 if $test -r $rsrc/.patch ; then  
6044         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6045                 perl_patchlevel=`cat $rsrc/.patch`
6046         fi
6047 fi
6048 case "$perl_patchlevel" in
6049 0)  ;;
6050 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6051 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6052 esac
6053 case "$osname" in
6054 dos|vms)
6055         : XXX Should be a Configure test for double-dots in filenames.
6056         version=`echo $revision $patchlevel $subversion | \
6057                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6058         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6059                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6060         ;;
6061 *)
6062         version=`echo $revision $patchlevel $subversion | \
6063                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6064         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6065                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6066         ;;
6067 esac
6068 : Special case the 5.005_xx maintenance series, which used 5.005
6069 : without any subversion label as a subdirectory in $sitelib
6070 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6071         api_versionstring='5.005'
6072 fi
6073
6074 : determine installation style
6075 : For now, try to deduce it from prefix unless it is already set.
6076 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6077 case "$installstyle" in
6078 '')     case "$prefix" in
6079                 *perl*) dflt='lib';;
6080                 *) dflt='lib/perl5' ;;
6081         esac
6082         ;;
6083 *)      dflt="$installstyle" ;;
6084 esac
6085 : Probably not worth prompting for this since we prompt for all
6086 : the directories individually, and the prompt would be too long and
6087 : confusing anyway.
6088 installstyle=$dflt
6089
6090 : determine where private library files go
6091 : Usual default is /usr/local/lib/perl5/$version.
6092 : Also allow things like /opt/perl/lib/$version, since 
6093 : /opt/perl/lib/perl5... would be redundant.
6094 : The default "style" setting is made in installstyle.U
6095 case "$installstyle" in
6096 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6097 *)       set dflt privlib lib/$version ;;
6098 esac
6099 eval $prefixit
6100 $cat <<EOM
6101
6102 There are some auxiliary files for $package that need to be put into a
6103 private library directory that is accessible by everyone.
6104
6105 EOM
6106 fn=d~+
6107 rp='Pathname where the private library files will reside?'
6108 . ./getfile
6109 privlib="$ans"
6110 privlibexp="$ansexp"
6111 : Change installation prefix, if necessary.
6112 if $test X"$prefix" != X"$installprefix"; then
6113         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6114 else
6115         installprivlib="$privlibexp"
6116 fi
6117
6118 : set the prefixup variable, to restore leading tilda escape
6119 prefixup='case "$prefixexp" in
6120 "$prefix") ;;
6121 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6122 esac'
6123
6124 : determine where public architecture dependent libraries go
6125 set archlib archlib
6126 eval $prefixit
6127 : privlib default is /usr/local/lib/$package/$version
6128 : archlib default is /usr/local/lib/$package/$version/$archname
6129 : privlib may have an optional trailing /share.
6130 tdflt=`echo $privlib | $sed 's,/share$,,'`
6131 tdflt=$tdflt/$archname
6132 case "$archlib" in
6133 '')     dflt=$tdflt
6134         ;;
6135 *)      dflt="$archlib"
6136     ;;
6137 esac
6138 $cat <<EOM
6139
6140 $spackage contains architecture-dependent library files.  If you are
6141 sharing libraries in a heterogeneous environment, you might store
6142 these files in a separate location.  Otherwise, you can just include
6143 them with the rest of the public library files.
6144
6145 EOM
6146 fn=d+~
6147 rp='Where do you want to put the public architecture-dependent libraries?'
6148 . ./getfile
6149 archlib="$ans"
6150 archlibexp="$ansexp"
6151 if $test X"$archlib" = X"$privlib"; then
6152         d_archlib="$undef"
6153 else
6154         d_archlib="$define"
6155 fi
6156 : Change installation prefix, if necessary.
6157 if $test X"$prefix" != X"$installprefix"; then
6158         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6159 else
6160         installarchlib="$archlibexp"
6161 fi
6162
6163
6164 : Binary compatibility with 5.005 is not possible for builds
6165 : with advanced features
6166 case "$usethreads$usemultiplicity" in
6167 *define*)
6168         bincompat5005="$undef"
6169         d_bincompat5005="$undef"
6170         ;;
6171 *)      $cat <<EOM
6172
6173 This version of Perl can be compiled for binary compatibility with 5.005.
6174 If you decide to do so, you will be able to continue using most of the
6175 extensions that were compiled for Perl 5.005.
6176
6177 EOM
6178         case "$bincompat5005$d_bincompat5005" in
6179         *"$undef"*) dflt=n ;;
6180         *) dflt=y ;;
6181         esac
6182         rp='Binary compatibility with Perl 5.005?'
6183         . ./myread
6184         case "$ans" in
6185         y*) val="$define" ;;
6186         *)  val="$undef" ;;
6187         esac
6188         set d_bincompat5005
6189         eval $setvar
6190         case "$d_bincompat5005" in
6191         "$define")
6192                 bincompat5005="$define"
6193                 ;;
6194         *)      bincompat5005="$undef"
6195                 d_bincompat5005="$undef"
6196                 ;;
6197         esac
6198         ;;
6199 esac
6200
6201
6202 : see if setuid scripts can be secure
6203 $cat <<EOM
6204
6205 Some kernels have a bug that prevents setuid #! scripts from being
6206 secure.  Some sites have disabled setuid #! scripts because of this.
6207
6208 First let's decide if your kernel supports secure setuid #! scripts.
6209 (If setuid #! scripts would be secure but have been disabled anyway,
6210 don't say that they are secure if asked.)
6211
6212 EOM
6213
6214 val="$undef"
6215 if $test -d /dev/fd; then
6216         echo "#!$ls" >reflect
6217         chmod +x,u+s reflect
6218         ./reflect >flect 2>&1
6219         if $contains "/dev/fd" flect >/dev/null; then
6220                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6221                 val="$define"
6222         else
6223                 $cat <<EOM
6224 If you are not sure if they are secure, I can check but I'll need a
6225 username and password different from the one you are using right now.
6226 If you don't have such a username or don't want me to test, simply
6227 enter 'none'.
6228
6229 EOM
6230                 rp='Other username to test security of setuid scripts with?'
6231                 dflt='none'
6232                 . ./myread
6233                 case "$ans" in
6234                 n|none)
6235                         case "$d_suidsafe" in
6236                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6237                                 dflt=n;;
6238                         "$undef")
6239                                 echo "Well, the $hint value is *not* secure." >&4
6240                                 dflt=n;;
6241                         *)      echo "Well, the $hint value *is* secure." >&4
6242                                 dflt=y;;
6243                         esac
6244                         ;;
6245                 *)
6246                         $rm -f reflect flect
6247                         echo "#!$ls" >reflect
6248                         chmod +x,u+s reflect
6249                         echo >flect
6250                         chmod a+w flect
6251                         echo '"su" will (probably) prompt you for '"$ans's password."
6252                         su $ans -c './reflect >flect'
6253                         if $contains "/dev/fd" flect >/dev/null; then
6254                                 echo "Okay, it looks like setuid scripts are secure." >&4
6255                                 dflt=y
6256                         else
6257                                 echo "I don't think setuid scripts are secure." >&4
6258                                 dflt=n
6259                         fi
6260                         ;;
6261                 esac
6262                 rp='Does your kernel have *secure* setuid scripts?'
6263                 . ./myread
6264                 case "$ans" in
6265                 [yY]*)  val="$define";;
6266                 *)      val="$undef";;
6267                 esac
6268         fi
6269 else
6270         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6271         echo "(That's for file descriptors, not floppy disks.)"
6272         val="$undef"
6273 fi
6274 set d_suidsafe
6275 eval $setvar
6276
6277 $rm -f reflect flect
6278
6279 : now see if they want to do setuid emulation
6280 echo " "
6281 val="$undef"
6282 case "$d_suidsafe" in
6283 "$define")
6284         val="$undef"
6285         echo "No need to emulate SUID scripts since they are secure here." >& 4
6286         ;;
6287 *)
6288         $cat <<EOM
6289 Some systems have disabled setuid scripts, especially systems where
6290 setuid scripts cannot be secure.  On systems where setuid scripts have
6291 been disabled, the setuid/setgid bits on scripts are currently
6292 useless.  It is possible for $package to detect those bits and emulate
6293 setuid/setgid in a secure fashion.  This emulation will only work if
6294 setuid scripts have been disabled in your kernel.
6295
6296 EOM
6297         case "$d_dosuid" in
6298         "$define") dflt=y ;;
6299         *) dflt=n ;;
6300         esac
6301         rp="Do you want to do setuid/setgid emulation?"
6302         . ./myread
6303         case "$ans" in
6304         [yY]*)  val="$define";;
6305         *)      val="$undef";;
6306         esac
6307         ;;
6308 esac
6309 set d_dosuid
6310 eval $setvar
6311
6312 : see if this is a malloc.h system
6313 set malloc.h i_malloc
6314 eval $inhdr
6315
6316 : see if stdlib is available
6317 set stdlib.h i_stdlib
6318 eval $inhdr
6319
6320 : determine which malloc to compile in
6321 echo " "
6322 case "$usemymalloc" in
6323 [yY]*|true|$define)     dflt='y' ;;
6324 [nN]*|false|$undef)     dflt='n' ;;
6325 *)      case "$ptrsize" in
6326         4) dflt='y' ;;
6327         *) dflt='n' ;;
6328         esac
6329         ;;
6330 esac
6331 rp="Do you wish to attempt to use the malloc that comes with $package?"
6332 . ./myread
6333 usemymalloc="$ans"
6334 case "$ans" in
6335 y*|true)
6336         usemymalloc='y'
6337         mallocsrc='malloc.c'
6338         mallocobj="malloc$_o"
6339         d_mymalloc="$define"
6340         case "$libs" in
6341         *-lmalloc*)
6342                 : Remove malloc from list of libraries to use
6343                 echo "Removing unneeded -lmalloc from library list" >&4
6344                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6345                 shift
6346                 libs="$*"
6347                 echo "libs = $libs" >&4
6348                 ;;
6349         esac
6350         ;;
6351 *)
6352         usemymalloc='n'
6353         mallocsrc=''
6354         mallocobj=''
6355         d_mymalloc="$undef"
6356         ;;
6357 esac
6358
6359 : compute the return types of malloc and free
6360 echo " "
6361 $cat >malloc.c <<END
6362 #$i_malloc I_MALLOC
6363 #$i_stdlib I_STDLIB
6364 #include <stdio.h>
6365 #include <sys/types.h>
6366 #ifdef I_MALLOC
6367 #include <malloc.h>
6368 #endif
6369 #ifdef I_STDLIB
6370 #include <stdlib.h>
6371 #endif
6372 #ifdef TRY_MALLOC
6373 void *malloc();
6374 #endif
6375 #ifdef TRY_FREE
6376 void free();
6377 #endif
6378 END
6379 case "$malloctype" in
6380 '')
6381         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6382                 malloctype='void *'
6383         else
6384                 malloctype='char *'
6385         fi
6386         ;;
6387 esac
6388 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6389
6390 case "$freetype" in
6391 '')
6392         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6393                 freetype='void'
6394         else
6395                 freetype='int'
6396         fi
6397         ;;
6398 esac
6399 echo "Your system uses $freetype free(), it would seem." >&4
6400 $rm -f malloc.[co]
6401 $cat <<EOM
6402
6403 After $package is installed, you may wish to install various
6404 add-on modules and utilities.  Typically, these add-ons will
6405 be installed under $prefix with the rest
6406 of this package.  However, you may wish to install such add-ons
6407 elsewhere under a different prefix.
6408
6409 If you do not wish to put everything under a single prefix, that's
6410 ok.  You will be prompted for the individual locations; this siteprefix
6411 is only used to suggest the defaults.
6412
6413 The default should be fine for most people.
6414
6415 EOM
6416 fn=d~+
6417 rp='Installation prefix to use for add-on modules and utilities?'
6418 : XXX Here might be another good place for an installstyle setting.
6419 case "$siteprefix" in
6420 '') dflt=$prefix ;;
6421 *)  dflt=$siteprefix ;;
6422 esac
6423 . ./getfile
6424 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6425 oldsiteprefix=''
6426 case "$siteprefix" in
6427 '') ;;
6428 *)      case "$ans" in
6429         "$prefix") ;;
6430         *) oldsiteprefix="$prefix";;
6431         esac
6432         ;;
6433 esac
6434 siteprefix="$ans"
6435 siteprefixexp="$ansexp"
6436
6437 : determine where site specific libraries go.
6438 : Usual default is /usr/local/lib/perl5/site_perl/$version
6439 : The default "style" setting is made in installstyle.U
6440 : XXX No longer works with Prefixit stuff.
6441 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6442 case "$sitelib" in
6443 '') case "$installstyle" in
6444         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6445         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6446         esac
6447         ;;
6448 *)      dflt="$sitelib"
6449         ;;
6450 esac
6451 $cat <<EOM
6452
6453 The installation process will create a directory for
6454 site-specific extensions and modules.  Most users find it convenient
6455 to place all site-specific files in this directory rather than in the
6456 main distribution directory.
6457
6458 EOM
6459 fn=d~+
6460 rp='Pathname for the site-specific library files?'
6461 . ./getfile
6462 sitelib="$ans"
6463 sitelibexp="$ansexp"
6464 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6465 : Change installation prefix, if necessary.
6466 if $test X"$prefix" != X"$installprefix"; then
6467         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6468 else
6469         installsitelib="$sitelibexp"
6470 fi
6471
6472 : determine where site specific architecture-dependent libraries go.
6473 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6474 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6475 : sitelib may have an optional trailing /share.
6476 case "$sitearch" in
6477 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6478         dflt="$dflt/$archname"
6479         ;;
6480 *)      dflt="$sitearch"
6481         ;;
6482 esac
6483 set sitearch sitearch none
6484 eval $prefixit
6485 $cat <<EOM
6486
6487 The installation process will also create a directory for
6488 architecture-dependent site-specific extensions and modules.
6489
6490 EOM
6491 fn=d~+
6492 rp='Pathname for the site-specific architecture-dependent library files?'
6493 . ./getfile
6494 sitearch="$ans"
6495 sitearchexp="$ansexp"
6496 : Change installation prefix, if necessary.
6497 if $test X"$prefix" != X"$installprefix"; then
6498         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6499 else
6500         installsitearch="$sitearchexp"
6501 fi
6502
6503 $cat <<EOM
6504
6505 The installation process will also create a directory for
6506 vendor-supplied add-ons.  Vendors who supply perl with their system
6507 may find it convenient to place all vendor-supplied files in this
6508 directory rather than in the main distribution directory.  This will
6509 ease upgrades between binary-compatible maintenance versions of perl.
6510
6511 Of course you may also use these directories in whatever way you see
6512 fit.  For example, you might use them to access modules shared over a
6513 company-wide network.
6514
6515 The default answer should be fine for most people.
6516 This causes further questions about vendor add-ons to be skipped
6517 and no vendor-specific directories will be configured for perl.
6518
6519 EOM
6520 rp='Do you want to configure vendor-specific add-on directories?'
6521 case "$usevendorprefix" in
6522 define|true|[yY]*) dflt=y ;;
6523 *)      : User may have set vendorprefix directly on Configure command line.
6524         case "$vendorprefix" in
6525         ''|' ') dflt=n ;;
6526         *)      dflt=y ;;
6527         esac
6528         ;;
6529 esac
6530 . ./myread
6531 case "$ans" in
6532 [yY]*)  fn=d~+
6533         rp='Installation prefix to use for vendor-supplied add-ons?'
6534         case "$vendorprefix" in
6535         '') dflt='' ;;
6536         *)  dflt=$vendorprefix ;;
6537         esac
6538         . ./getfile
6539         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6540         oldvendorprefix=''
6541         case "$vendorprefix" in
6542         '') ;;
6543         *)      case "$ans" in
6544                 "$prefix") ;;
6545                 *) oldvendorprefix="$prefix";;
6546                 esac
6547                 ;;
6548         esac
6549         usevendorprefix="$define"
6550         vendorprefix="$ans"
6551         vendorprefixexp="$ansexp"
6552         ;;
6553 *)      usevendorprefix="$undef"
6554         vendorprefix=''
6555         vendorprefixexp=''
6556         ;;
6557 esac
6558
6559 case "$vendorprefix" in
6560 '')     d_vendorlib="$undef"
6561         vendorlib=''
6562         vendorlibexp=''
6563         ;;
6564 *)      d_vendorlib="$define"
6565         : determine where vendor-supplied modules go.
6566         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6567         case "$vendorlib" in
6568         '')
6569                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6570                 case "$installstyle" in
6571                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6572                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6573                 esac
6574                 ;;
6575         *)      dflt="$vendorlib"
6576                 ;;
6577         esac
6578         fn=d~+
6579         rp='Pathname for the vendor-supplied library files?'
6580         . ./getfile
6581         vendorlib="$ans"
6582         vendorlibexp="$ansexp"
6583         ;;
6584 esac
6585 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6586 : Change installation prefix, if necessary.
6587 if $test X"$prefix" != X"$installprefix"; then
6588         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6589 else
6590         installvendorlib="$vendorlibexp"
6591 fi
6592
6593 case "$vendorprefix" in
6594 '')     d_vendorarch="$undef"
6595         vendorarch=''
6596         vendorarchexp=''
6597         ;;
6598 *)      d_vendorarch="$define"
6599         : determine where vendor-supplied architecture-dependent libraries go.
6600         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6601         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6602         : vendorlib may have an optional trailing /share.
6603         case "$vendorarch" in
6604         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6605                 dflt="$dflt/$archname"
6606                 ;;
6607         *)      dflt="$vendorarch" ;;
6608         esac
6609         fn=d~+
6610         rp='Pathname for vendor-supplied architecture-dependent files?'
6611         . ./getfile
6612         vendorarch="$ans"
6613         vendorarchexp="$ansexp"
6614         ;;
6615 esac
6616 : Change installation prefix, if necessary.
6617 if $test X"$prefix" != X"$installprefix"; then
6618         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6619 else
6620         installvendorarch="$vendorarchexp"
6621 fi
6622
6623 : Final catch-all directories to search
6624 $cat <<EOM
6625
6626 Lastly, you can have perl look in other directories for extensions and
6627 modules in addition to those already specified.
6628 These directories will be searched after 
6629         $sitearch 
6630         $sitelib 
6631 EOM
6632 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6633 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6634 echo ' '
6635 case "$otherlibdirs" in
6636 ''|' ') dflt='none' ;;
6637 *)      dflt="$otherlibdirs" ;;
6638 esac
6639 $cat <<EOM
6640 Enter a colon-separated set of extra paths to include in perl's @INC
6641 search path, or enter 'none' for no extra paths.
6642
6643 EOM
6644
6645 rp='Colon-separated list of additional directories for perl to search?'
6646 . ./myread
6647 case "$ans" in
6648 ' '|''|none)    otherlibdirs=' ' ;;     
6649 *)      otherlibdirs="$ans" ;;
6650 esac
6651 case "$otherlibdirs" in
6652 ' ') val=$undef ;;
6653 *)      val=$define ;;
6654 esac
6655 set d_perl_otherlibdirs
6656 eval $setvar
6657
6658 : Cruising for prototypes
6659 echo " "
6660 echo "Checking out function prototypes..." >&4
6661 $cat >prototype.c <<'EOCP'
6662 int main(int argc, char *argv[]) {
6663         exit(0);}
6664 EOCP
6665 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6666         echo "Your C compiler appears to support function prototypes."
6667         val="$define"
6668 else
6669         echo "Your C compiler doesn't seem to understand function prototypes."
6670         val="$undef"
6671 fi
6672 set prototype
6673 eval $setvar
6674 $rm -f prototype*
6675
6676 case "$prototype" in
6677 "$define") ;;
6678 *)      ansi2knr='ansi2knr'
6679         echo " "
6680         cat <<EOM >&4
6681
6682 $me:  FATAL ERROR:
6683 This version of $package can only be compiled by a compiler that 
6684 understands function prototypes.  Unfortunately, your C compiler 
6685         $cc $ccflags
6686 doesn't seem to understand them.  Sorry about that.
6687
6688 If GNU cc is available for your system, perhaps you could try that instead.  
6689
6690 Eventually, we hope to support building Perl with pre-ANSI compilers.
6691 If you would like to help in that effort, please contact <perlbug@perl.org>.
6692
6693 Aborting Configure now.
6694 EOM
6695         exit 2
6696         ;;
6697 esac
6698
6699 : determine where public executables go
6700 echo " "
6701 set dflt bin bin
6702 eval $prefixit
6703 fn=d~
6704 rp='Pathname where the public executables will reside?'
6705 . ./getfile
6706 if $test "X$ansexp" != "X$binexp"; then
6707         installbin=''
6708 fi
6709 bin="$ans"
6710 binexp="$ansexp"
6711 : Change installation prefix, if necessary.
6712 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6713 if $test X"$prefix" != X"$installprefix"; then
6714         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6715 else
6716         installbin="$binexp"
6717 fi
6718
6719 : Find perl5.005 or later.
6720 echo "Looking for a previously installed perl5.005 or later... "
6721 case "$perl5" in
6722 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6723                 : Check if this perl is recent and can load a simple module
6724                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6725                         perl5=$tdir/perl
6726                         break;
6727                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6728                         perl5=$tdir/perl5
6729                         break;
6730                 fi
6731         done
6732         ;;
6733 *)      perl5="$perl5"
6734         ;;
6735 esac
6736 case "$perl5" in
6737 '')     echo "None found.  That's ok.";;
6738 *)      echo "Using $perl5." ;;
6739 esac
6740
6741 : Determine list of previous versions to include in @INC
6742 $cat > getverlist <<EOPL
6743 #!$perl5 -w
6744 use File::Basename;
6745 \$api_versionstring = "$api_versionstring";
6746 \$version = "$version";
6747 \$stem = "$sitelib_stem";
6748 \$archname = "$archname";
6749 EOPL
6750         $cat >> getverlist <<'EOPL'
6751 # Can't have leading @ because metaconfig interprets it as a command!
6752 ;@inc_version_list=();
6753 # XXX Redo to do opendir/readdir? 
6754 if (-d $stem) {
6755     chdir($stem);
6756     ;@candidates = glob("5.*");
6757 }
6758 else {
6759     ;@candidates = ();
6760 }
6761
6762 # XXX ToDo:  These comparisons must be reworked when two-digit
6763 # subversions come along, so that 5.7.10 compares as greater than
6764 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6765 # widespread that we can use the built-in version vectors rather
6766 # than reinventing them here.  For 5.6.0, however, we must
6767 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6768 foreach $d (@candidates) {
6769     if ($d lt $version) {
6770         if ($d ge $api_versionstring) {
6771             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6772         }
6773         elsif ($d ge "5.005") {
6774             unshift(@inc_version_list, grep { -d } $d);
6775         }
6776     }
6777     else {
6778         # Skip newer version.  I.e. don't look in
6779         # 5.7.0 if we're installing 5.6.1.
6780     }
6781 }
6782
6783 if (@inc_version_list) {
6784     print join(' ', @inc_version_list);
6785 }
6786 else {
6787     # Blank space to preserve value for next Configure run.
6788     print " ";
6789 }
6790 EOPL
6791 chmod +x getverlist
6792 case "$inc_version_list" in
6793 '')     if test -x "$perl5$exe_ext"; then
6794                 dflt=`$perl5 getverlist`
6795         else
6796                 dflt='none'
6797         fi
6798         ;;
6799 $undef) dflt='none' ;;
6800 *)  eval dflt=\"$inc_version_list\" ;;
6801 esac
6802 case "$dflt" in
6803 ''|' ') dflt=none ;;
6804 esac
6805 case "$dflt" in
6806 5.005) case "$bincompat5005" in
6807        $define|true|[yY]*) ;;
6808        *) dflt=none ;;
6809        esac
6810        ;;
6811 esac
6812 $cat <<'EOM'
6813
6814 In order to ease the process of upgrading, this version of perl 
6815 can be configured to use modules built and installed with earlier 
6816 versions of perl that were installed under $prefix.  Specify here
6817 the list of earlier versions that this version of perl should check.
6818 If Configure detected no earlier versions of perl installed under
6819 $prefix, then the list will be empty.  Answer 'none' to tell perl
6820 to not search earlier versions.
6821
6822 The default should almost always be sensible, so if you're not sure,
6823 just accept the default.
6824 EOM
6825
6826 rp='List of earlier versions to include in @INC?'
6827 . ./myread
6828 case "$ans" in
6829 [Nn]one|''|' ') inc_version_list=' ' ;;
6830 *) inc_version_list="$ans" ;;
6831 esac
6832 case "$inc_version_list" in
6833 ''|' ') 
6834         inc_version_list_init='0';;
6835 *)      inc_version_list_init=`echo $inc_version_list |
6836                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6837         ;;
6838 esac
6839 $rm -f getverlist
6840
6841 : determine whether to install perl also as /usr/bin/perl
6842
6843 echo " "
6844 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6845         $cat <<EOM
6846 Many scripts expect perl to be installed as /usr/bin/perl.
6847 I can install the perl you are about to compile also as /usr/bin/perl
6848 (in addition to $installbin/perl).
6849 EOM
6850         case "$installusrbinperl" in
6851         "$undef"|[nN]*) dflt='n';;
6852         *)              dflt='y';;
6853         esac
6854         rp="Do you want to install perl as /usr/bin/perl?"
6855         . ./myread
6856         case "$ans" in
6857         [yY]*)  val="$define";;
6858         *)      val="$undef" ;;
6859         esac
6860 else
6861         val="$undef"
6862 fi
6863 set installusrbinperl
6864 eval $setvar
6865
6866 : see if dld is available
6867 set dld.h i_dld
6868 eval $inhdr
6869
6870 : see if dlopen exists
6871 xxx_runnm="$runnm"
6872 runnm=false
6873 set dlopen d_dlopen
6874 eval $inlibc
6875 runnm="$xxx_runnm"
6876
6877 : determine which dynamic loading, if any, to compile in
6878 echo " "
6879 dldir="ext/DynaLoader"
6880 case "$usedl" in
6881 $define|y|true)
6882         dflt='y'
6883         usedl="$define"
6884         ;;
6885 $undef|n|false)
6886         dflt='n'
6887         usedl="$undef"
6888         ;;
6889 *) 
6890         dflt='n'
6891         case "$d_dlopen" in
6892             $define) dflt='y' ;;
6893         esac
6894         case "$i_dld" in
6895             $define) dflt='y' ;;
6896         esac
6897         : Does a dl_xxx.xs file exist for this operating system
6898         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6899         ;;
6900 esac
6901 rp="Do you wish to use dynamic loading?"
6902 . ./myread
6903 usedl="$ans"
6904 case "$ans" in
6905 y*) usedl="$define"
6906         case "$dlsrc" in
6907         '')
6908                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6909                         dflt="$dldir/dl_${osname}.xs"
6910                 elif $test "$d_dlopen" = "$define" ; then
6911                         dflt="$dldir/dl_dlopen.xs"
6912                 elif $test "$i_dld" = "$define" ; then
6913                         dflt="$dldir/dl_dld.xs"
6914                 else
6915                         dflt=''
6916                 fi
6917                 ;;
6918         *)      dflt="$dldir/$dlsrc"
6919                 ;;
6920         esac
6921     echo "The following dynamic loading files are available:"
6922         : Can not go over to $dldir because getfile has path hard-coded in.
6923         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6924         rp="Source file to use for dynamic loading"
6925         fn="fne"
6926         gfpth="$src"
6927         . ./getfile
6928         usedl="$define"
6929         : emulate basename
6930         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6931
6932         $cat << EOM
6933
6934 Some systems may require passing special flags to $cc -c to
6935 compile modules that will be used to create a shared library.
6936 To use no flags, say "none".
6937
6938 EOM
6939     case "$cccdlflags" in
6940     '') case "$gccversion" in
6941                 '') case "$osname" in
6942                         hpux)   dflt='+z' ;;
6943                         next)   dflt='none' ;;
6944                         irix*)  dflt='-KPIC' ;;
6945                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6946                         sunos)  dflt='-pic' ;;
6947                         *)      dflt='none' ;;
6948                     esac
6949                         ;;
6950                 *)  case "$osname" in
6951                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6952                         *)      dflt='-fpic' ;;
6953                     esac ;;
6954             esac ;;
6955         ' ') dflt='none' ;;
6956     *)  dflt="$cccdlflags" ;;
6957     esac
6958     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6959     . ./myread
6960     case "$ans" in
6961     none) cccdlflags=' ' ;;
6962     *) cccdlflags="$ans" ;;
6963     esac
6964
6965     cat << EOM
6966
6967 Some systems use ld to create libraries that can be dynamically loaded,
6968 while other systems (such as those using ELF) use $cc.
6969
6970 EOM
6971         case "$ld" in
6972         '')     $cat >try.c <<'EOM'
6973 /* Test for whether ELF binaries are produced */
6974 #include <fcntl.h>
6975 #include <stdlib.h>
6976 int main() {
6977         char b[4];
6978         int i = open("a.out",O_RDONLY);
6979         if(i == -1) 
6980                 exit(1); /* fail */
6981         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6982                 exit(0); /* succeed (yes, it's ELF) */
6983         else
6984                 exit(1); /* fail */
6985 }
6986 EOM
6987                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6988                         cat <<EOM
6989 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6990 EOM
6991                         dflt="$cc"
6992                 else
6993                         echo "I'll use ld to build dynamic libraries."
6994                         dflt='ld'
6995                 fi
6996                 rm -f try.c a.out
6997                 ;;
6998         *)      dflt="$ld"
6999                 ;;
7000         esac
7001
7002     rp="What command should be used to create dynamic libraries?"
7003     . ./myread
7004         ld="$ans"
7005
7006     cat << EOM
7007
7008 Some systems may require passing special flags to $ld to create a
7009 library that can be dynamically loaded.  If your ld flags include
7010 -L/other/path options to locate libraries outside your loader's normal
7011 search path, you may need to specify those -L options here as well.  To
7012 use no flags, say "none".
7013
7014 EOM
7015     case "$lddlflags" in
7016     '') case "$osname" in
7017                         beos) dflt='-nostart' ;;
7018                         hpux) dflt='-b';
7019                               case "$gccversion" in
7020                               '') dflt="$dflt +vnocompatwarnings" ;;
7021                               esac
7022                               ;;        
7023                         linux|irix*)    dflt='-shared' ;;
7024                         next)  dflt='none' ;;
7025                         solaris) dflt='-G' ;;
7026                         sunos) dflt='-assert nodefinitions' ;;
7027                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7028                 *)     dflt='none' ;;
7029                         esac
7030                         ;;
7031     *) dflt="$lddlflags" ;;
7032     esac
7033
7034         : Try to guess additional flags to pick up local libraries.
7035         : Be careful not to append to a plain 'none'
7036         case "$dflt" in
7037         none) dflt='' ;;
7038         esac
7039         for thisflag in $ldflags; do
7040                 case "$thisflag" in
7041                 -L*|-R*)
7042                         case " $dflt " in
7043                         *" $thisflag "*) ;;
7044                         *) dflt="$dflt $thisflag" ;;
7045                         esac
7046                         ;;
7047                 esac
7048         done
7049
7050         case "$dflt" in
7051         ''|' ') dflt='none' ;;
7052         esac
7053
7054     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7055     . ./myread
7056     case "$ans" in
7057     none) lddlflags=' ' ;;
7058     *) lddlflags="$ans" ;;
7059     esac
7060
7061         cat <<EOM
7062
7063 Some systems may require passing special flags to $cc to indicate that
7064 the resulting executable will use dynamic linking.  To use no flags,
7065 say "none".
7066
7067 EOM
7068     case "$ccdlflags" in
7069     '') case "$osname" in
7070                 hpux)   dflt='-Wl,-E' ;;
7071                 linux)  dflt='-rdynamic' ;;
7072                 next)   dflt='none' ;;
7073                 sunos)  dflt='none' ;;
7074                 *)      dflt='none' ;;
7075             esac ;;
7076     ' ')  dflt='none' ;;
7077     *)  dflt="$ccdlflags" ;;
7078     esac
7079     rp="Any special flags to pass to $cc to use dynamic linking?"
7080     . ./myread
7081     case "$ans" in
7082     none) ccdlflags=' ' ;;
7083     *) ccdlflags="$ans" ;;
7084     esac
7085     ;;
7086 *)  usedl="$undef"
7087         ld='ld'
7088     dlsrc='dl_none.xs'
7089     lddlflags=''
7090     ccdlflags=''
7091     ;;
7092 esac
7093
7094 also=''
7095 case "$usedl" in
7096 $undef)
7097         # No dynamic loading being used, so don't bother even to prompt.
7098         useshrplib='false'
7099         ;;
7100 *)      case "$useshrplib" in
7101         '')     case "$osname" in
7102                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7103                         dflt=y
7104                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7105                         ;;
7106                 next*)
7107                         case "$osvers" in
7108                         4*)     dflt=y
7109                                 also='Building a shared libperl is needed for MAB support.'
7110                                 ;;
7111                         *)      dflt=n
7112                                 ;;
7113                         esac
7114                         ;;
7115                 *)      dflt=n
7116                         ;;
7117                 esac
7118                 ;;
7119         $define|true|[Yy]*)
7120                 dflt=y
7121                 ;;
7122         *)      dflt=n
7123                 ;;
7124         esac
7125         $cat << EOM
7126
7127 The perl executable is normally obtained by linking perlmain.c with
7128 libperl${_a}, any static extensions (usually just DynaLoader), and
7129 any other libraries needed on this system (such as -lm, etc.).  Since
7130 your system supports dynamic loading, it is probably possible to build
7131 a shared libperl.$so.  If you will have more than one executable linked
7132 to libperl.$so, this will significantly reduce the size of each
7133 executable, but it may have a noticeable affect on performance.  The
7134 default is probably sensible for your system.
7135 $also
7136
7137 EOM
7138         rp="Build a shared libperl.$so (y/n)"
7139         . ./myread
7140         case "$ans" in
7141         true|$define|[Yy]*)
7142                 useshrplib='true'  ;;
7143         *)      useshrplib='false' ;;
7144         esac
7145         ;;
7146 esac
7147
7148 case "$useshrplib" in
7149 true)
7150         case "$libperl" in
7151         '')
7152                 # Figure out a good name for libperl.so.  Since it gets stored in
7153                 # a version-specific architecture-dependent library, the version
7154                 # number isn't really that important, except for making cc/ld happy.
7155                 #
7156                 # A name such as libperl.so.3.1
7157                 majmin="libperl.$so.$patchlevel.$subversion"
7158                 # A name such as libperl.so.301
7159                 majonly=`echo $patchlevel $subversion |
7160                         $awk '{printf "%d%02d", $1, $2}'`
7161                 majonly=libperl.$so.$majonly
7162                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7163                 # rely on figuring it out from the naming of libc.
7164                 case "${osname}${osvers}" in
7165                 next4*)
7166                         dflt=libperl.5.$so
7167                         # XXX How handle the --version stuff for MAB?
7168                         ;;
7169                 linux*)  # ld won't link with a bare -lperl otherwise.
7170                         dflt=libperl.$so
7171                         ;;
7172                 cygwin*) # include version
7173                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7174                         ;;
7175                 *)      # Try to guess based on whether libc has major.minor.
7176                         case "$libc" in
7177                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7178                         *libc.$so.[0-9]*) dflt=$majonly ;;
7179                         *)      dflt=libperl.$so ;;
7180                         esac
7181                         ;;
7182                 esac
7183                 ;;
7184         *)      dflt=$libperl
7185                 ;;
7186         esac
7187         cat << EOM
7188
7189 I need to select a good name for the shared libperl.  If your system uses
7190 library names with major and minor numbers, then you might want something
7191 like $majmin.  Alternatively, if your system uses a single version
7192 number for shared libraries, then you might want to use $majonly.
7193 Or, your system might be quite happy with a simple libperl.$so.
7194
7195 Since the shared libperl will get installed into a version-specific
7196 architecture-dependent directory, the version number of the shared perl
7197 library probably isn't important, so the default should be o.k.
7198
7199 EOM
7200         rp='What name do you want to give to the shared libperl?'
7201         . ./myread
7202         libperl=$ans
7203         echo "Ok, I'll use $libperl"
7204         ;;
7205 *)
7206         libperl="libperl${_a}"
7207         ;;
7208 esac
7209
7210 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7211 case "$shrpdir" in
7212 '') ;;
7213 *)      $cat >&4 <<EOM
7214 WARNING:  Use of the shrpdir variable for the installation location of
7215 the shared $libperl is not supported.  It was never documented and
7216 will not work in this version.  Let me (perlbug@perl.org)
7217 know of any problems this may cause.
7218
7219 EOM
7220         case "$shrpdir" in
7221         "$archlibexp/CORE")
7222                 $cat >&4 <<EOM
7223 But your current setting of $shrpdir is
7224 the default anyway, so it's harmless.
7225 EOM
7226                 ;;
7227         *)
7228                 $cat >&4 <<EOM
7229 Further, your current attempted setting of $shrpdir
7230 conflicts with the value of $archlibexp/CORE
7231 that installperl will use.
7232 EOM
7233                 ;;
7234         esac
7235         ;;
7236 esac
7237
7238 # How will the perl executable find the installed shared $libperl?
7239 # Add $xxx to ccdlflags.
7240 # If we can't figure out a command-line option, use $shrpenv to
7241 # set env LD_RUN_PATH.  The main perl makefile uses this.
7242 shrpdir=$archlibexp/CORE
7243 xxx=''
7244 tmp_shrpenv=''
7245 if "$useshrplib"; then
7246     case "$osname" in 
7247         aix)
7248                 # We'll set it in Makefile.SH...
7249                 ;;
7250         solaris|netbsd)
7251                 xxx="-R $shrpdir"
7252                 ;;
7253         freebsd)
7254                 xxx="-Wl,-R$shrpdir"
7255                 ;;
7256         linux|irix*|dec_osf)
7257                 xxx="-Wl,-rpath,$shrpdir"
7258                 ;;
7259         next)
7260                 # next doesn't like the default...
7261                 ;;
7262         beos)
7263                 # beos doesn't like the default, either.
7264                 ;;
7265         hpux*)
7266                 # hpux doesn't like the default, either.
7267                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7268                 ;;
7269         *)
7270                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7271                 ;;
7272         esac
7273         case "$xxx" in
7274         '') ;;
7275         *)      
7276                 # Only add $xxx if it isn't already in ccdlflags.
7277                 case " $ccdlflags " in
7278                 *" $xxx "*)     ;;
7279                 *)      ccdlflags="$ccdlflags $xxx"
7280                         cat <<EOM >&4
7281
7282 Adding $xxx to the flags
7283 passed to $ld so that the perl executable will find the 
7284 installed shared $libperl.
7285
7286 EOM
7287                         ;;
7288                 esac
7289                 ;;
7290         esac
7291 fi
7292 # Fix ccdlflags in AIX for building external extensions.
7293 # (For building Perl itself bare -bE:perl.exp is needed,
7294 #  Makefile.SH takes care of this.)
7295 case "$osname" in
7296 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7297 esac
7298 # Respect a hint or command-line value.
7299 case "$shrpenv" in
7300 '') shrpenv="$tmp_shrpenv" ;;
7301 esac
7302 case "$ldlibpthname" in
7303 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7304 none)   ldlibpthname='' ;;
7305 esac
7306
7307 : determine where manual pages are on this system
7308 echo " "
7309 case "$sysman" in
7310 '') 
7311         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7312         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7313         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7314         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7315         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7316         sysman=`./loc . /usr/man/man1 $syspath`
7317         ;;
7318 esac
7319 if $test -d "$sysman"; then
7320         echo "System manual is in $sysman." >&4
7321 else
7322         echo "Could not find manual pages in source form." >&4
7323 fi
7324
7325 : determine where manual pages go
7326 set man1dir man1dir none
7327 eval $prefixit
7328 $cat <<EOM
7329
7330 $spackage has manual pages available in source form.
7331 EOM
7332 case "$nroff" in
7333 nroff)
7334         echo "However, you don't have nroff, so they're probably useless to you."
7335         case "$man1dir" in
7336         '') man1dir="none";;
7337         esac;;
7338 esac
7339 echo "If you don't want the manual sources installed, answer 'none'."
7340 case "$man1dir" in
7341 ' ') dflt=none
7342         ;;
7343 '')
7344         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7345         lookpath="$lookpath $prefixexp/man/p_man/man1"
7346         lookpath="$lookpath $prefixexp/man/u_man/man1"
7347         lookpath="$lookpath $prefixexp/man/man.1"
7348         case "$sysman" in
7349         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7350         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7351         esac
7352         set dflt
7353         eval $prefixup
7354         ;;
7355 *)  dflt="$man1dir"
7356         ;;
7357 esac
7358 echo " "
7359 fn=dn+~
7360 rp="Where do the main $spackage manual pages (source) go?"
7361 . ./getfile
7362 if $test "X$man1direxp" != "X$ansexp"; then
7363         installman1dir=''
7364 fi
7365 man1dir="$ans"
7366 man1direxp="$ansexp"
7367 case "$man1dir" in
7368 '')     man1dir=' '
7369         installman1dir='';;
7370 esac
7371
7372 : Change installation prefix, if necessary.
7373 if $test X"$prefix" != X"$installprefix"; then
7374         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7375 else
7376         installman1dir="$man1direxp"
7377 fi
7378
7379 : What suffix to use on installed man pages
7380
7381 case "$man1dir" in
7382 ' ')
7383         man1ext='0'
7384         ;;
7385 *)
7386         rp="What suffix should be used for the main $spackage man pages?"
7387         case "$man1ext" in
7388         '')     case "$man1dir" in
7389                 *1)  dflt=1 ;;
7390                 *1p) dflt=1p ;;
7391                 *1pm) dflt=1pm ;;
7392                 *l) dflt=l;;
7393                 *n) dflt=n;;
7394                 *o) dflt=o;;
7395                 *p) dflt=p;;
7396                 *C) dflt=C;;
7397                 *L) dflt=L;;
7398                 *L1) dflt=L1;;
7399                 *) dflt=1;;
7400                 esac
7401                 ;;
7402         *)      dflt="$man1ext";;
7403         esac
7404         . ./myread
7405         man1ext="$ans"
7406         ;;
7407 esac
7408
7409 : see if we can have long filenames
7410 echo " "
7411 first=123456789abcdef
7412 $rm -f $first
7413 if (echo hi >$first) 2>/dev/null; then
7414         if $test -f 123456789abcde; then
7415                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7416                 val="$undef"
7417         else
7418                 echo 'You can have filenames longer than 14 characters.'>&4
7419                 val="$define"
7420         fi
7421 else
7422         $cat <<'EOM'
7423 You can't have filenames longer than 14 chars.
7424 You can't even think about them!
7425 EOM
7426         val="$undef"
7427 fi 
7428 set d_flexfnam
7429 eval $setvar
7430 $rm -rf 123456789abcde*
7431
7432 : determine where library module manual pages go
7433 set man3dir man3dir none
7434 eval $prefixit
7435 $cat <<EOM
7436
7437 $spackage has manual pages for many of the library modules.
7438 EOM
7439
7440 case "$nroff" in
7441 nroff)
7442         $cat <<'EOM'
7443 However, you don't have nroff, so they're probably useless to you.
7444 EOM
7445         case "$man3dir" in
7446         '') man3dir="none";;
7447         esac;;
7448 esac
7449
7450 case "$d_flexfnam" in
7451 undef)
7452         $cat <<'EOM'
7453 However, your system can't handle the long file names like File::Basename.3. 
7454 EOM
7455         case "$man3dir" in
7456         '') man3dir="none";;
7457         esac;;
7458 esac
7459
7460 echo "If you don't want the manual sources installed, answer 'none'."
7461 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7462 case "$man3dir" in
7463 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7464         if $test -d "$privlib/man/man3"; then
7465                 cat <<EOM >&4
7466
7467 WARNING:  Previous versions of perl installed man3 pages into
7468 $privlib/man/man3.  This version will suggest a 
7469 new default of $dflt.  
7470 EOM
7471                 tdflt=$dflt
7472                 dflt='n'
7473                 rp='Do you wish to preserve the old behavior?(y/n)'
7474                 . ./myread
7475                 case "$ans" in
7476                 y*) dflt="$privlib/man/man3" ;;
7477                 *)  dflt=$tdflt ;;
7478                 esac
7479     fi
7480         ;;
7481 *)      dflt="$man3dir" ;;
7482 esac
7483 case "$dflt" in
7484 ' ') dflt=none ;;
7485 esac
7486 echo " "
7487 fn=dn+~
7488 rp="Where do the $package library man pages (source) go?"
7489 . ./getfile
7490 man3dir="$ans"
7491 man3direxp="$ansexp"
7492 case "$man3dir" in
7493 '')     man3dir=' '
7494         installman3dir='';;
7495 esac
7496
7497 : Change installation prefix, if necessary.
7498 if $test X"$prefix" != X"$installprefix"; then
7499         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7500 else
7501         installman3dir="$man3direxp"
7502 fi
7503
7504 : What suffix to use on installed man pages
7505 case "$man3dir" in
7506 ' ')
7507         man3ext='0'
7508         ;;
7509 *)
7510         rp="What suffix should be used for the $package library man pages?"
7511         case "$man3ext" in
7512         '')     case "$man3dir" in
7513                 *3)  dflt=3 ;;
7514                 *3p) dflt=3p ;;
7515                 *3pm) dflt=3pm ;;
7516                 *l) dflt=l;;
7517                 *n) dflt=n;;
7518                 *o) dflt=o;;
7519                 *p) dflt=p;;
7520                 *C) dflt=C;;
7521                 *L) dflt=L;;
7522                 *L3) dflt=L3;;
7523                 *) dflt=3;;
7524                 esac
7525                 ;;
7526         *)      dflt="$man3ext";;
7527         esac
7528         . ./myread
7529         man3ext="$ans"
7530         ;;
7531 esac
7532
7533 : see if we have to deal with yellow pages, now NIS.
7534 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7535         if $test -f /usr/etc/nibindd; then
7536                 echo " "
7537                 echo "I'm fairly confident you're on a NeXT."
7538                 echo " "
7539                 rp='Do you get the hosts file via NetInfo?'
7540                 dflt=y
7541                 case "$hostcat" in
7542                 nidump*) ;;
7543                 '') ;;
7544                 *) dflt=n;;
7545                 esac
7546                 . ./myread
7547                 case "$ans" in
7548                 y*) hostcat='nidump hosts .';;
7549                 *)      case "$hostcat" in
7550                         nidump*) hostcat='';;
7551                         esac
7552                         ;;
7553                 esac
7554         fi
7555         case "$hostcat" in
7556         nidump*) ;;
7557         *)
7558                 case "$hostcat" in
7559                 *ypcat*) dflt=y;;
7560                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7561                                 dflt=y
7562                         else
7563                                 dflt=n
7564                         fi;;
7565                 *) dflt=n;;
7566                 esac
7567                 echo " "
7568                 rp='Are you getting the hosts file via yellow pages?'
7569                 . ./myread
7570                 case "$ans" in
7571                 y*) hostcat='ypcat hosts';;
7572                 *) hostcat='cat /etc/hosts';;
7573                 esac
7574                 ;;
7575         esac
7576 fi
7577 case "$hostcat" in
7578 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7579 esac
7580 case "$groupcat" in
7581 '') test -f /etc/group && groupcat='cat /etc/group';;
7582 esac
7583 case "$passcat" in
7584 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7585 esac
7586
7587 : now get the host name
7588 echo " "
7589 echo "Figuring out host name..." >&4
7590 case "$myhostname" in
7591 '') cont=true
7592         echo 'Maybe "hostname" will work...'
7593         if tans=`sh -c hostname 2>&1` ; then
7594                 myhostname=$tans
7595                 phostname=hostname
7596                 cont=''
7597         fi
7598         ;;
7599 *) cont='';;
7600 esac
7601 if $test "$cont"; then
7602         if ./xenix; then
7603                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7604                 if tans=`cat /etc/systemid 2>&1` ; then
7605                         myhostname=$tans
7606                         phostname='cat /etc/systemid'
7607                         echo "Whadyaknow.  Xenix always was a bit strange..."
7608                         cont=''
7609                 fi
7610         elif $test -r /etc/systemid; then
7611                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7612         fi
7613 fi
7614 if $test "$cont"; then
7615         echo 'No, maybe "uuname -l" will work...'
7616         if tans=`sh -c 'uuname -l' 2>&1` ; then
7617                 myhostname=$tans
7618                 phostname='uuname -l'
7619         else
7620                 echo 'Strange.  Maybe "uname -n" will work...'
7621                 if tans=`sh -c 'uname -n' 2>&1` ; then
7622                         myhostname=$tans
7623                         phostname='uname -n'
7624                 else
7625                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7626                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7627                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7628                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7629                         else
7630                                 case "$myhostname" in
7631                                 '') echo "Does this machine have an identity crisis or something?"
7632                                         phostname='';;
7633                                 *)
7634                                         echo "Well, you said $myhostname before..."
7635                                         phostname='echo $myhostname';;
7636                                 esac
7637                         fi
7638                 fi
7639         fi
7640 fi
7641 : you do not want to know about this
7642 set $myhostname
7643 myhostname=$1
7644
7645 : verify guess
7646 if $test "$myhostname" ; then
7647         dflt=y
7648         rp='Your host name appears to be "'$myhostname'".'" Right?"
7649         . ./myread
7650         case "$ans" in
7651         y*) ;;
7652         *) myhostname='';;
7653         esac
7654 fi
7655
7656 : bad guess or no guess
7657 while $test "X$myhostname" = X ; do
7658         dflt=''
7659         rp="Please type the (one word) name of your host:"
7660         . ./myread
7661         myhostname="$ans"
7662 done
7663
7664 : translate upper to lower if necessary
7665 case "$myhostname" in
7666 *[A-Z]*)
7667         echo "(Normalizing case in your host name)"
7668         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7669         ;;
7670 esac
7671
7672 case "$myhostname" in
7673 *.*)
7674         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7675         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7676         echo "(Trimming domain name from host name--host name is now $myhostname)"
7677         ;;
7678 *) case "$mydomain" in
7679         '')
7680                 {
7681                         test "X$hostcat" = "Xypcat hosts" &&
7682                         ypmatch "$myhostname" hosts 2>/dev/null |\
7683                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7684                         $test -s hosts
7685                 } || {
7686                         test "X$hostcat" != "X" &&
7687                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7688                                         /[       ]$myhostname[  . ]/p" > hosts
7689                 }
7690                 tmp_re="[       . ]"
7691                 if $test -f hosts; then
7692                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7693                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7694                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7695                                 hosts | $sort | $uniq | \
7696                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7697                         case `$echo X$dflt` in
7698                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7699                                 dflt=.
7700                                 ;;
7701                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7702                                 ;;
7703                         esac
7704                 else
7705                         echo "(I cannot locate a hosts database anywhere)"
7706                         dflt=.
7707                 fi
7708                 case "$dflt" in
7709                 .)
7710                         tans=`./loc resolv.conf X /etc /usr/etc`
7711                         if $test -f "$tans"; then
7712                                 echo "(Attempting domain name extraction from $tans)"
7713                                 dflt=.`$sed -n -e 's/   / /g' \
7714                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7715                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7716                                 case "$dflt" in
7717                                 .) dflt=.`$sed -n -e 's/        / /g' \
7718                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7719                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7720                                         ;;
7721                                 esac
7722                         fi
7723                         ;;
7724                 esac
7725                 case "$dflt" in
7726                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7727                         dflt=.`sh -c domainname 2>/dev/null`
7728                         case "$dflt" in
7729                         '') dflt='.';;
7730                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7731                         esac
7732                         ;;
7733                 esac
7734                 case "$dflt$osname" in
7735                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7736                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7737                         ;;
7738                 esac
7739                 case "$dflt" in
7740                 .) echo "(Lost all hope -- silly guess then)"
7741                         dflt='.uucp'
7742                         ;;
7743                 esac
7744                 $rm -f hosts
7745                 ;;
7746         *) dflt="$mydomain";;
7747         esac;;
7748 esac
7749 echo " "
7750 rp="What is your domain name?"
7751 . ./myread
7752 tans="$ans"
7753 case "$ans" in
7754 '') ;;
7755 .*) ;;
7756 *) tans=".$tans";;
7757 esac
7758 mydomain="$tans"
7759
7760 : translate upper to lower if necessary
7761 case "$mydomain" in
7762 *[A-Z]*)
7763         echo "(Normalizing case in your domain name)"
7764         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7765         ;;
7766 esac
7767
7768 : a little sanity check here
7769 case "$phostname" in
7770 '') ;;
7771 *)
7772         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7773         $myhostname$mydomain|$myhostname) ;;
7774         *)
7775                 case "$phostname" in
7776                 sed*)
7777                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7778                         ;;
7779                 *)
7780                         echo "(That doesn't agree with your $phostname command, by the way.)"
7781                         ;;
7782                 esac
7783         ;;
7784         esac
7785         ;;
7786 esac
7787
7788 $cat <<EOM
7789
7790 I need to get your e-mail address in Internet format if possible, i.e.
7791 something like user@host.domain. Please answer accurately since I have
7792 no easy means to double check it. The default value provided below
7793 is most probably close to reality but may not be valid from outside
7794 your organization...
7795
7796 EOM
7797 cont=x
7798 while test "$cont"; do
7799         case "$cf_email" in
7800         '') dflt="$cf_by@$myhostname$mydomain";;
7801         *) dflt="$cf_email";;
7802         esac
7803         rp='What is your e-mail address?'
7804         . ./myread
7805         cf_email="$ans"
7806         case "$cf_email" in
7807         *@*.*) cont='' ;;
7808         *)
7809                 rp='Address does not look like an Internet one.  Use it anyway?'
7810                 case "$fastread" in
7811                 yes) dflt=y ;;
7812                 *) dflt=n ;;
7813                 esac
7814                 . ./myread
7815                 case "$ans" in
7816                 y*) cont='' ;;
7817                 *) echo " " ;;
7818                 esac
7819                 ;;
7820         esac
7821 done
7822
7823 $cat <<EOM
7824
7825 If you or somebody else will be maintaining perl at your site, please
7826 fill in the correct e-mail address here so that they may be contacted
7827 if necessary. Currently, the "perlbug" program included with perl
7828 will send mail to this address in addition to perlbug@perl.org. You may
7829 enter "none" for no administrator.
7830
7831 EOM
7832 case "$perladmin" in
7833 '') dflt="$cf_email";;
7834 *) dflt="$perladmin";;
7835 esac
7836 rp='Perl administrator e-mail address'
7837 . ./myread
7838 perladmin="$ans"
7839
7840 : determine whether to only install version-specific parts.
7841 echo " "
7842 $cat <<EOM
7843 Do you want to install only the version-specific parts of the perl
7844 distribution?  Usually you do *not* want to do this.
7845 EOM
7846 case "$versiononly" in
7847 "$define"|[Yy]*|true) dflt='y' ;;
7848 *) dflt='n';
7849 esac
7850 rp="Do you want to install only the version-specific parts of perl?"
7851 . ./myread
7852 case "$ans" in
7853 [yY]*)  val="$define";;
7854 *)      val="$undef" ;;
7855 esac
7856 set versiononly
7857 eval $setvar
7858
7859 : figure out how to guarantee perl startup
7860 case "$startperl" in
7861 '')
7862         case "$sharpbang" in
7863         *!)
7864                 $cat <<EOH
7865
7866 I can use the #! construct to start perl on your system. This will
7867 make startup of perl scripts faster, but may cause problems if you
7868 want to share those scripts and perl is not in a standard place
7869 ($binexp/perl) on all your platforms. The alternative is to force
7870 a shell by starting the script with a single ':' character.
7871
7872 EOH
7873                 case "$versiononly" in
7874                 "$define")      dflt="$binexp/perl$version";;  
7875                 *)              dflt="$binexp/perl";;
7876                 esac
7877                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7878                 . ./myread
7879                 case "$ans" in
7880                 none)   startperl=": # use perl";;
7881                 *)      startperl="#!$ans"
7882                         if $test 30 -lt `echo "$ans" | wc -c`; then
7883                                 $cat >&4 <<EOM
7884
7885 WARNING:  Some systems limit the #! command to 32 characters.
7886 If you experience difficulty running Perl scripts with #!, try
7887 installing Perl in a directory with a shorter pathname.
7888
7889 EOM
7890                         fi ;;
7891                 esac
7892                 ;;
7893         *) startperl=": # use perl"
7894                 ;;
7895         esac
7896         ;;
7897 esac
7898 echo "I'll use $startperl to start perl scripts."
7899
7900 : figure best path for perl in scripts
7901 case "$perlpath" in
7902 '')
7903         perlpath="$binexp/perl"
7904         case "$startperl" in
7905         *!*) ;;
7906         *)
7907                 $cat <<EOH
7908
7909 I will use the "eval 'exec'" idiom to start Perl on your system.
7910 I can use the full path of your Perl binary for this purpose, but
7911 doing so may cause problems if you want to share those scripts and
7912 Perl is not always in a standard place ($binexp/perl).
7913
7914 EOH
7915                 dflt="$binexp/perl"
7916                 rp="What path shall I use in \"eval 'exec'\"?"
7917                 . ./myread
7918                 perlpath="$ans"
7919                 ;;
7920         esac
7921         ;;
7922 esac
7923 case "$startperl" in
7924 *!*)    ;;
7925 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7926 esac
7927
7928 : determine where public executable scripts go
7929 set scriptdir scriptdir
7930 eval $prefixit
7931 case "$scriptdir" in
7932 '')
7933         dflt="$bin"
7934         : guess some guesses
7935         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7936         $test -d /usr/share/bin     && dflt=/usr/share/bin
7937         $test -d /usr/local/script  && dflt=/usr/local/script
7938         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7939         $test -d $prefixexp/script  && dflt=$prefixexp/script
7940         set dflt
7941         eval $prefixup
7942         ;;
7943 *)  dflt="$scriptdir"
7944         ;;
7945 esac
7946 $cat <<EOM
7947  
7948 Some installations have a separate directory just for executable scripts so
7949 that they can mount it across multiple architectures but keep the scripts in
7950 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7951 Or you might just lump your scripts in with all your other executables.
7952  
7953 EOM
7954 fn=d~
7955 rp='Where do you keep publicly executable scripts?'
7956 . ./getfile
7957 if $test "X$ansexp" != "X$scriptdirexp"; then
7958         installscript=''
7959 fi
7960 scriptdir="$ans"
7961 scriptdirexp="$ansexp"
7962 : Change installation prefix, if necessary.
7963 if $test X"$prefix" != X"$installprefix"; then
7964         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7965 else
7966         installscript="$scriptdirexp"
7967 fi
7968
7969 : determine where add-on public executables go
7970 case "$sitebin" in
7971 '')     dflt=$siteprefix/bin ;;
7972 *)      dflt=$sitebin ;;
7973 esac
7974 fn=d~
7975 rp='Pathname where the add-on public executables should be installed?'
7976 . ./getfile
7977 sitebin="$ans"
7978 sitebinexp="$ansexp"
7979 : Change installation prefix, if necessary.
7980 if $test X"$prefix" != X"$installprefix"; then
7981         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7982 else
7983         installsitebin="$sitebinexp"
7984 fi
7985
7986 case "$vendorprefix" in
7987 '')     d_vendorbin="$undef"
7988         vendorbin=''
7989         vendorbinexp=''
7990         ;;
7991 *)      d_vendorbin="$define"
7992         : determine where vendor-supplied executables go.
7993         case "$vendorbin" in
7994         '') dflt=$vendorprefix/bin ;;
7995         *)      dflt="$vendorbin" ;;
7996         esac
7997         fn=d~+
7998         rp='Pathname for the vendor-supplied executables directory?'
7999         . ./getfile
8000         vendorbin="$ans"
8001         vendorbinexp="$ansexp"
8002         ;;
8003 esac
8004 : Change installation prefix, if necessary.
8005 if $test X"$prefix" != X"$installprefix"; then
8006         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8007 else
8008         installvendorbin="$vendorbinexp"
8009 fi
8010
8011 : see if qgcvt exists
8012 set qgcvt d_qgcvt
8013 eval $inlibc
8014
8015 echo " "
8016
8017 if $test X"$d_longdbl" = X"$define"; then
8018
8019 echo "Checking how to print long doubles..." >&4
8020
8021 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8022         $cat >try.c <<'EOCP'
8023 #include <sys/types.h>
8024 #include <stdio.h>
8025 int main() {
8026   double d = 123.456;
8027   printf("%.3f\n", d);
8028 }
8029 EOCP
8030         set try
8031         if eval $compile; then
8032                 yyy=`./try$exe_ext`
8033                 case "$yyy" in
8034                 123.456)
8035                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8036                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8037                         echo "We will use %f."
8038                         ;;
8039                 esac
8040         fi
8041 fi
8042
8043 if $test X"$sPRIfldbl" = X; then
8044         $cat >try.c <<'EOCP'
8045 #include <sys/types.h>
8046 #include <stdio.h>
8047 int main() {
8048   long double d = 123.456;
8049   printf("%.3Lf\n", d);
8050 }
8051 EOCP
8052         set try
8053         if eval $compile; then
8054                 yyy=`./try$exe_ext`
8055                 case "$yyy" in
8056                 123.456)
8057                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8058                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8059                         echo "We will use %Lf."
8060                         ;;
8061                 esac
8062         fi
8063 fi
8064
8065 if $test X"$sPRIfldbl" = X; then
8066         $cat >try.c <<'EOCP'
8067 #include <sys/types.h>
8068 #include <stdio.h>
8069 int main() {
8070   long double d = 123.456;
8071   printf("%.3llf\n", d);
8072 }
8073 EOCP
8074         set try
8075         if eval $compile; then
8076                 yyy=`./try$exe_ext`
8077                 case "$yyy" in
8078                 123.456)
8079                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8080                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8081                         echo "We will use %llf."
8082                         ;;
8083                 esac
8084         fi
8085 fi
8086
8087 if $test X"$sPRIfldbl" = X; then
8088         $cat >try.c <<'EOCP'
8089 #include <sys/types.h>
8090 #include <stdio.h>
8091 int main() {
8092   long double d = 123.456;
8093   printf("%.3lf\n", d);
8094 }
8095 EOCP
8096         set try
8097         if eval $compile; then
8098                 yyy=`./try$exe_ext`
8099                 case "$yyy" in
8100                 123.456)
8101                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8102                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8103                         echo "We will use %lf."
8104                         ;;
8105                 esac
8106         fi
8107 fi
8108
8109 if $test X"$sPRIfldbl" = X; then
8110         echo "Cannot figure out how to print long doubles." >&4
8111 else
8112         sSCNfldbl=$sPRIfldbl    # expect consistency
8113 fi
8114
8115 $rm -f try try.*
8116
8117 fi # d_longdbl
8118
8119 case "$sPRIfldbl" in
8120 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8121         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8122         d_SCNfldbl="$undef";
8123         ;;
8124 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8125         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8126         d_SCNfldbl="$define";
8127         ;;
8128 esac
8129
8130 : Check how to convert floats to strings.
8131 echo " "
8132 echo "Checking for an efficient way to convert floats to strings."
8133 echo " " > try.c
8134 case "$uselongdouble" in
8135 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8136 esac
8137 case "$d_longdbl" in
8138 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8139 esac
8140 case "$d_PRIgldbl" in
8141 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8142 esac
8143 $cat >>try.c <<EOP
8144 #ifdef TRY_gconvert
8145 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8146 char *myname = "gconvert";
8147 #endif
8148 #ifdef TRY_gcvt
8149 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8150 char *myname = "gcvt";
8151 #endif
8152 #ifdef TRY_qgcvt
8153 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8154 char *myname = "qgcvt";
8155 #define DOUBLETYPE long double
8156 #endif
8157 #ifdef TRY_sprintf
8158 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8159 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8160 #else
8161 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8162 #endif
8163 char *myname = "sprintf";
8164 #endif
8165
8166 #ifndef DOUBLETYPE
8167 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8168 #define DOUBLETYPE long double
8169 #else
8170 #define DOUBLETYPE double
8171 #endif
8172 #endif
8173
8174 #include <stdio.h>
8175
8176 #define I_STDLIB $i_stdlib
8177 #ifdef I_STDLIB
8178 #include <stdlib.h>
8179 #endif
8180
8181 int
8182 checkit(expect, got)
8183 char *expect;
8184 char *got;
8185 {
8186     if (strcmp(expect, got)) {
8187                 printf("%s oddity:  Expected %s, got %s\n",
8188                         myname, expect, got);
8189                 exit(1);
8190         }
8191 }
8192
8193 int main()
8194
8195         char buf[64]; 
8196         buf[63] = '\0';
8197
8198         /* This must be 1st test on (which?) platform */
8199         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8200         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8201         checkit("0.1", buf);
8202
8203         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8204         checkit("1", buf);
8205
8206         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8207         checkit("1.1", buf);
8208
8209         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8210         checkit("1.01", buf);
8211
8212         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8213         checkit("1.001", buf);
8214
8215         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8216         checkit("1.0001", buf);
8217
8218         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8219         checkit("1.00001", buf);
8220
8221         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8222         checkit("1.000001", buf);
8223
8224         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8225         checkit("0", buf);
8226
8227         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8228         checkit("-1", buf);
8229
8230         /* Some Linux gcvt's give 1.e+5 here. */
8231         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8232         checkit("100000", buf);
8233         
8234         /* Some Linux gcvt's give -1.e+5 here. */
8235         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8236         checkit("-100000", buf);
8237
8238         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8239         checkit("123.456", buf);
8240
8241         exit(0);
8242 }
8243 EOP
8244 case "$d_Gconvert" in
8245 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8246 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8247 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8248 *) xxx_list='gconvert gcvt sprintf' ;;
8249 esac
8250
8251 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8252 "$define$define$define")
8253     # for long doubles prefer first qgcvt, then sprintf
8254     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8255     xxx_list="sprintf $xxx_list"
8256     case "$d_qgcvt" in
8257     "$define") xxx_list="qgcvt $xxx_list" ;;
8258     esac
8259     ;;
8260 esac
8261
8262 for xxx_convert in $xxx_list; do
8263         echo "Trying $xxx_convert..."
8264         $rm -f try try$_o
8265         set try -DTRY_$xxx_convert
8266         if eval $compile; then
8267                 echo "$xxx_convert() found." >&4
8268                 if ./try; then
8269                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8270                         break;
8271                 else
8272                         echo "...But $xxx_convert didn't work as I expected."
8273                 fi
8274         else
8275                 echo "$xxx_convert NOT found." >&4
8276         fi
8277 done
8278         
8279 case "$xxx_convert" in
8280 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8281 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8282 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8283 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8284    "$define$define$define")
8285       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8286    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8287    esac
8288    ;;  
8289 esac
8290
8291 : see if _fwalk exists
8292 set fwalk d__fwalk
8293 eval $inlibc
8294
8295 : Initialize h_fcntl
8296 h_fcntl=false
8297
8298 : Initialize h_sysfile
8299 h_sysfile=false
8300
8301 : access call always available on UNIX
8302 set access d_access
8303 eval $inlibc
8304
8305 : locate the flags for 'access()'
8306 case "$d_access" in
8307 "$define")
8308         echo " "
8309         $cat >access.c <<'EOCP'
8310 #include <sys/types.h>
8311 #ifdef I_FCNTL
8312 #include <fcntl.h>
8313 #endif
8314 #ifdef I_SYS_FILE
8315 #include <sys/file.h>
8316 #endif
8317 #ifdef I_UNISTD
8318 #include <unistd.h>
8319 #endif
8320 int main() {
8321         exit(R_OK);
8322 }
8323 EOCP
8324         : check sys/file.h first, no particular reason here
8325         if $test `./findhdr sys/file.h` && \
8326                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8327                 h_sysfile=true;
8328                 echo "<sys/file.h> defines the *_OK access constants." >&4
8329         elif $test `./findhdr fcntl.h` && \
8330                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8331                 h_fcntl=true;
8332                 echo "<fcntl.h> defines the *_OK access constants." >&4
8333         elif $test `./findhdr unistd.h` && \
8334                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8335                 echo "<unistd.h> defines the *_OK access constants." >&4
8336         else
8337                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8338         fi
8339         ;;
8340 esac
8341 $rm -f access*
8342
8343 : see if accessx exists
8344 set accessx d_accessx
8345 eval $inlibc
8346
8347 : see if alarm exists
8348 set alarm d_alarm
8349 eval $inlibc
8350
8351 : see if atolf exists
8352 set atolf d_atolf
8353 eval $inlibc
8354
8355 : see if atoll exists
8356 set atoll d_atoll
8357 eval $inlibc
8358
8359 : Look for GNU-cc style attribute checking
8360 echo " "
8361 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8362 $cat >attrib.c <<'EOCP'
8363 #include <stdio.h>
8364 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8365 EOCP
8366 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8367         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8368                 echo "Your C compiler doesn't fully support __attribute__."
8369                 val="$undef"
8370         else
8371                 echo "Your C compiler supports __attribute__."
8372                 val="$define"
8373         fi
8374 else
8375         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8376         val="$undef"
8377 fi
8378 set d_attribut
8379 eval $setvar
8380 $rm -f attrib*
8381
8382 : see if bcmp exists
8383 set bcmp d_bcmp
8384 eval $inlibc
8385
8386 : see if bcopy exists
8387 set bcopy d_bcopy
8388 eval $inlibc
8389
8390 : see if this is a unistd.h system
8391 set unistd.h i_unistd
8392 eval $inhdr
8393
8394 : see if getpgrp exists
8395 set getpgrp d_getpgrp
8396 eval $inlibc
8397
8398 case "$d_getpgrp" in
8399 "$define")
8400         echo " "
8401         echo "Checking to see which flavor of getpgrp is in use..."
8402         $cat >set.c <<EOP
8403 #$i_unistd I_UNISTD
8404 #include <sys/types.h>
8405 #ifdef I_UNISTD
8406 #  include <unistd.h>
8407 #endif
8408 int main()
8409 {
8410         if (getuid() == 0) {
8411                 printf("(I see you are running Configure as super-user...)\n");
8412                 setuid(1);
8413         }
8414 #ifdef TRY_BSD_PGRP
8415         if (getpgrp(1) == 0)
8416                 exit(0);
8417 #else
8418         if (getpgrp() > 0)
8419                 exit(0);
8420 #endif
8421         exit(1);
8422 }
8423 EOP
8424         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8425                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8426                 val="$define"
8427         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8428                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8429                 val="$undef"
8430         else
8431                 echo "I can't seem to compile and run the test program."
8432                 if ./usg; then
8433                         xxx="a USG one, i.e. you use getpgrp()."
8434                 else
8435                         # SVR4 systems can appear rather BSD-ish.
8436                         case "$i_unistd" in
8437                         $undef)
8438                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8439                                 val="$define"
8440                                 ;;
8441                         $define)
8442                                 xxx="probably a USG one, i.e. you use getpgrp()."
8443                                 val="$undef"
8444                                 ;;
8445                         esac
8446                 fi
8447                 echo "Assuming your getpgrp is $xxx" >&4
8448         fi
8449         ;;
8450 *) val="$undef";;
8451 esac
8452 set d_bsdgetpgrp
8453 eval $setvar
8454 $rm -f set set.c
8455
8456 : see if setpgrp exists
8457 set setpgrp d_setpgrp
8458 eval $inlibc
8459
8460 case "$d_setpgrp" in
8461 "$define")
8462         echo " "
8463         echo "Checking to see which flavor of setpgrp is in use..."
8464         $cat >set.c <<EOP
8465 #$i_unistd I_UNISTD
8466 #include <sys/types.h>
8467 #ifdef I_UNISTD
8468 #  include <unistd.h>
8469 #endif
8470 int main()
8471 {
8472         if (getuid() == 0) {
8473                 printf("(I see you are running Configure as super-user...)\n");
8474                 setuid(1);
8475         }
8476 #ifdef TRY_BSD_PGRP
8477         if (-1 == setpgrp(1, 1))
8478                 exit(0);
8479 #else
8480         if (setpgrp() != -1)
8481                 exit(0);
8482 #endif
8483         exit(1);
8484 }
8485 EOP
8486         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8487                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8488                 val="$define"
8489         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8490                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8491                 val="$undef"
8492         else
8493                 echo "(I can't seem to compile and run the test program.)"
8494                 if ./usg; then
8495                         xxx="a USG one, i.e. you use setpgrp()."
8496                 else
8497                         # SVR4 systems can appear rather BSD-ish.
8498                         case "$i_unistd" in
8499                         $undef)
8500                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8501                                 val="$define"
8502                                 ;;
8503                         $define)
8504                                 xxx="probably a USG one, i.e. you use setpgrp()."
8505                                 val="$undef"
8506                                 ;;
8507                         esac
8508                 fi
8509                 echo "Assuming your setpgrp is $xxx" >&4
8510         fi
8511         ;;
8512 *) val="$undef";;
8513 esac
8514 set d_bsdsetpgrp
8515 eval $setvar
8516 $rm -f set set.c
8517 : see if bzero exists
8518 set bzero d_bzero
8519 eval $inlibc
8520
8521 : see if signal is declared as pointer to function returning int or void
8522 echo " "
8523 xxx=`./findhdr signal.h`
8524 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8525 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8526         echo "You have int (*signal())() instead of void." >&4
8527         val="$undef"
8528 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8529         echo "You have void (*signal())()." >&4
8530         val="$define"
8531 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8532         echo "You have int (*signal())() instead of void." >&4
8533         val="$undef"
8534 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8535         echo "You have void (*signal())()." >&4
8536         val="$define"
8537 else
8538         case "$d_voidsig" in
8539         '')
8540         echo "I can't determine whether signal handler returns void or int..." >&4
8541                 dflt=void
8542                 rp="What type does your signal handler return?"
8543                 . ./myread
8544                 case "$ans" in
8545                 v*) val="$define";;
8546                 *) val="$undef";;
8547                 esac;;
8548         "$define")
8549                 echo "As you already told me, signal handler returns void." >&4
8550                 val="$define"
8551                 ;;
8552         *)      echo "As you already told me, signal handler returns int." >&4
8553                 val="$undef"
8554                 ;;
8555         esac
8556 fi
8557 set d_voidsig
8558 eval $setvar
8559 case "$d_voidsig" in
8560 "$define") signal_t="void";;
8561 *) signal_t="int";;
8562 esac
8563 $rm -f $$.tmp
8564
8565 : check for ability to cast large floats to 32-bit ints.
8566 echo " "
8567 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8568 if $test "$intsize" -ge 4; then
8569         xxx=int
8570 else
8571         xxx=long
8572 fi
8573 $cat >try.c <<EOCP
8574 #include <stdio.h>
8575 #include <sys/types.h>
8576 #include <signal.h>
8577 $signal_t blech(s) int s; { exit(3); }
8578 int main()
8579 {
8580         $xxx i32;
8581         double f, g;
8582         int result = 0;
8583         char str[16];
8584         signal(SIGFPE, blech);
8585
8586         /* Don't let compiler optimize the test away.  Store the number 
8587            in a writable string for gcc to pass to sscanf under HP/UX.
8588         */
8589         sprintf(str, "2147483647");
8590         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8591         g = 10 * f;
8592         i32  = ($xxx) g;
8593
8594         /* x86 processors will probably give 0x8000 0000, which is a
8595        sign change.  We don't want that.  We want to mimic SPARC
8596            behavior here, which is to preserve the sign and give
8597            back 0x7fff ffff.
8598         */
8599         if (i32 != ($xxx) f)
8600                 result |= 1;
8601         exit(result);
8602 }
8603 EOCP
8604 set try
8605 if eval $compile_ok; then
8606         ./try
8607         yyy=$?
8608 else
8609         echo "(I can't seem to compile the test program--assuming it can't)"
8610         yyy=1
8611 fi
8612 case "$yyy" in
8613 0)      val="$define"
8614         echo "Yup, it can."
8615         ;;
8616 *)      val="$undef"
8617         echo "Nope, it can't."
8618         ;;
8619 esac
8620 set d_casti32
8621 eval $setvar
8622 $rm -f try try.*
8623
8624 : check for ability to cast negative floats to unsigned
8625 echo " "
8626 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8627 $cat >try.c <<EOCP
8628 #include <stdio.h>
8629 #include <sys/types.h>
8630 #include <signal.h>
8631 $signal_t blech(s) int s; { exit(7); }
8632 $signal_t blech_in_list(s) int s; { exit(4); }
8633 unsigned long dummy_long(p) unsigned long p; { return p; }
8634 unsigned int dummy_int(p) unsigned int p; { return p; }
8635 unsigned short dummy_short(p) unsigned short p; { return p; }
8636 int main()
8637 {
8638         double f;
8639         unsigned long along;
8640         unsigned int aint;
8641         unsigned short ashort;
8642         int result = 0;
8643         char str[16];
8644         
8645         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8646            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8647            optimized the whole file away
8648         */
8649         /* Store the number in a writable string for gcc to pass to 
8650            sscanf under HP/UX.
8651         */
8652         sprintf(str, "-123");
8653         sscanf(str, "%lf", &f);  /* f = -123.; */
8654
8655         signal(SIGFPE, blech);
8656         along = (unsigned long)f;
8657         aint = (unsigned int)f;
8658         ashort = (unsigned short)f;
8659         if (along != (unsigned long)-123)
8660                 result |= 1;
8661         if (aint != (unsigned int)-123)
8662                 result |= 1;
8663         if (ashort != (unsigned short)-123)
8664                 result |= 1;
8665         sprintf(str, "1073741824.");
8666         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8667         f = f + f;
8668         along = 0;
8669         along = (unsigned long)f;
8670         if (along != 0x80000000)
8671                 result |= 2;
8672         f -= 1.;
8673         along = 0;
8674         along = (unsigned long)f;
8675         if (along != 0x7fffffff)
8676                 result |= 1;
8677         f += 2.;
8678         along = 0;
8679         along = (unsigned long)f;
8680         if (along != 0x80000001)
8681                 result |= 2;
8682         if (result)
8683                 exit(result);
8684         signal(SIGFPE, blech_in_list);
8685         sprintf(str, "123.");
8686         sscanf(str, "%lf", &f);  /* f = 123.; */
8687         along = dummy_long((unsigned long)f);
8688         aint = dummy_int((unsigned int)f);
8689         ashort = dummy_short((unsigned short)f);
8690         if (along != (unsigned long)123)
8691                 result |= 4;
8692         if (aint != (unsigned int)123)
8693                 result |= 4;
8694         if (ashort != (unsigned short)123)
8695                 result |= 4;
8696         exit(result);
8697
8698 }
8699 EOCP
8700 set try
8701 if eval $compile_ok; then
8702         ./try
8703         castflags=$?
8704 else
8705         echo "(I can't seem to compile the test program--assuming it can't)"
8706         castflags=7
8707 fi
8708 case "$castflags" in
8709 0)      val="$define"
8710         echo "Yup, it can."
8711         ;;
8712 *)      val="$undef"
8713         echo "Nope, it can't."
8714         ;;
8715 esac
8716 set d_castneg
8717 eval $setvar
8718 $rm -f try.*
8719
8720 : see if vprintf exists
8721 echo " "
8722 if set vprintf val -f d_vprintf; eval $csym; $val; then
8723         echo 'vprintf() found.' >&4
8724         val="$define"
8725         $cat >vprintf.c <<'EOF'
8726 #include <varargs.h>
8727
8728 int main() { xxx("foo"); }
8729
8730 xxx(va_alist)
8731 va_dcl
8732 {
8733         va_list args;
8734         char buf[10];
8735
8736         va_start(args);
8737         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8738 }
8739 EOF
8740         set vprintf
8741         if eval $compile && ./vprintf; then
8742                 echo "Your vsprintf() returns (int)." >&4
8743                 val2="$undef"
8744         else
8745                 echo "Your vsprintf() returns (char*)." >&4
8746                 val2="$define"
8747         fi
8748 else
8749         echo 'vprintf() NOT found.' >&4
8750                 val="$undef"
8751                 val2="$undef"
8752 fi
8753 set d_vprintf
8754 eval $setvar
8755 val=$val2
8756 set d_charvspr
8757 eval $setvar
8758
8759 : see if chown exists
8760 set chown d_chown
8761 eval $inlibc
8762
8763 : see if chroot exists
8764 set chroot d_chroot
8765 eval $inlibc
8766
8767 : see if chsize exists
8768 set chsize d_chsize
8769 eval $inlibc
8770
8771 hasstruct='varname=$1; struct=$2; shift; shift;
8772 while $test $# -ge 2; do
8773         case "$1" in
8774         $define) echo "#include <$2>";;
8775         esac ;
8776     shift 2;
8777 done > try.c;
8778 echo "int main () { struct $struct foo; }" >> try.c;
8779 set try;
8780 if eval $compile; then
8781         val="$define";
8782 else
8783         val="$undef";
8784 fi;
8785 set $varname;
8786 eval $setvar;
8787 $rm -f try.c try.o'
8788
8789 : see if sys/types.h has to be included
8790 set sys/types.h i_systypes
8791 eval $inhdr
8792
8793 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8794 while $test $# -ge 2; do
8795         case "$1" in
8796         $define) echo "#include <$2>";;
8797         esac ;
8798     shift 2;
8799 done > try.c;
8800 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8801 set try;
8802 if eval $compile; then
8803         val="$define";
8804 else
8805         val="$undef";
8806 fi;
8807 set $varname;
8808 eval $setvar;
8809 $rm -f try.c try.o'
8810
8811 socketlib=''
8812 sockethdr=''
8813 : see whether socket exists
8814 echo " "
8815 $echo $n "Hmm... $c" >&4
8816 if set socket val -f d_socket; eval $csym; $val; then
8817         echo "Looks like you have Berkeley networking support." >&4
8818         d_socket="$define"
8819         if set setsockopt val -f; eval $csym; $val; then
8820                 d_oldsock="$undef"
8821         else
8822                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8823                 d_oldsock="$define"
8824         fi
8825 else
8826         if $contains socklib libc.list >/dev/null 2>&1; then
8827                 echo "Looks like you have Berkeley networking support." >&4
8828                 d_socket="$define"
8829                 : we will have to assume that it supports the 4.2 BSD interface
8830                 d_oldsock="$undef"
8831         else
8832                 echo "You don't have Berkeley networking in libc$_a..." >&4
8833                 if test "X$d_socket" = "X$define"; then
8834                    echo "...but you seem to believe that you have sockets." >&4
8835                 else
8836                         for net in net socket
8837                         do
8838                                 if test -f /usr/lib/lib$net$_a; then
8839                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8840                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8841                                         if $contains socket libc.list >/dev/null 2>&1; then
8842                                                 d_socket="$define"
8843                                                 socketlib="-l$net"
8844                                                 case "$net" in
8845                                                 net)
8846                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8847                                                         sockethdr="-I/usr/netinclude"
8848                                                         ;;
8849                                                 esac
8850                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8851                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8852                                                         d_oldsock="$undef"
8853                                                 else
8854                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8855                                                         d_oldsock="$define"
8856                                                 fi
8857                                                 break
8858                                         fi
8859                                 fi
8860                         done
8861                         if test "X$d_socket" != "X$define"; then
8862                            echo "or anywhere else I see." >&4
8863                            d_socket="$undef"
8864                            d_oldsock="$undef"
8865                         fi
8866                 fi
8867         fi
8868 fi
8869
8870 : see if socketpair exists
8871 set socketpair d_sockpair
8872 eval $inlibc
8873
8874
8875 echo " "
8876 echo "Checking the availability of certain socket constants..." >& 4
8877 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8878         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8879         $cat >try.c <<EOF
8880 #include <sys/types.h>
8881 #include <sys/socket.h>
8882 int main() {
8883     int i = $ENUM;
8884 }
8885 EOF
8886         val="$undef"
8887         set try; if eval $compile; then
8888                 val="$define"
8889         fi
8890         set d_${enum}; eval $setvar
8891         $rm -f try.c try
8892 done
8893
8894 : see if this is a sys/uio.h system
8895 set sys/uio.h i_sysuio
8896 eval $inhdr
8897
8898
8899 echo " "
8900 echo "Checking to see if your system supports struct cmsghdr..." >&4
8901 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8902 eval $hasstruct
8903 case "$d_cmsghdr_s" in
8904 "$define")      echo "Yes, it does."   ;;
8905 *)              echo "No, it doesn't." ;;
8906 esac
8907
8908
8909 : check for const keyword
8910 echo " "
8911 echo 'Checking to see if your C compiler knows about "const"...' >&4
8912 $cat >const.c <<'EOCP'
8913 typedef struct spug { int drokk; } spug;
8914 int main()
8915 {
8916         const char *foo;
8917         const spug y;
8918 }
8919 EOCP
8920 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8921         val="$define"
8922         echo "Yup, it does."
8923 else
8924         val="$undef"
8925         echo "Nope, it doesn't."
8926 fi
8927 set d_const
8928 eval $setvar
8929
8930 : see if crypt exists
8931 echo " "
8932 if set crypt val -f d_crypt; eval $csym; $val; then
8933         echo 'crypt() found.' >&4
8934         val="$define"
8935         cryptlib=''
8936 else
8937         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8938         if $test -z "$cryptlib"; then
8939                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8940         else
8941                 cryptlib=-lcrypt
8942         fi
8943         if $test -z "$cryptlib"; then
8944                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8945         else
8946                 cryptlib=-lcrypt
8947         fi
8948         if $test -z "$cryptlib"; then
8949                 cryptlib=`./loc libcrypt$_a "" $libpth`
8950         else
8951                 cryptlib=-lcrypt
8952         fi
8953         if $test -z "$cryptlib"; then
8954                 echo 'crypt() NOT found.' >&4
8955                 val="$undef"
8956         else
8957                 val="$define"
8958         fi
8959 fi
8960 set d_crypt
8961 eval $setvar
8962
8963 : get csh whereabouts
8964 case "$csh" in
8965 'csh') val="$undef" ;;
8966 *) val="$define" ;;
8967 esac
8968 set d_csh
8969 eval $setvar
8970 : Respect a hint or command line value for full_csh.
8971 case "$full_csh" in
8972 '') full_csh=$csh ;;
8973 esac
8974
8975 : see if cuserid exists
8976 set cuserid d_cuserid
8977 eval $inlibc
8978
8979 : see if this is a limits.h system
8980 set limits.h i_limits
8981 eval $inhdr
8982
8983 : see if this is a float.h system
8984 set float.h i_float
8985 eval $inhdr
8986
8987 : See if number of significant digits in a double precision number is known
8988 echo " "
8989 $cat >dbl_dig.c <<EOM
8990 #$i_limits I_LIMITS
8991 #$i_float I_FLOAT
8992 #ifdef I_LIMITS
8993 #include <limits.h>
8994 #endif
8995 #ifdef I_FLOAT
8996 #include <float.h>
8997 #endif
8998 #ifdef DBL_DIG
8999 printf("Contains DBL_DIG");
9000 #endif
9001 EOM
9002 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9003 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9004         echo "DBL_DIG found." >&4
9005         val="$define"
9006 else
9007         echo "DBL_DIG NOT found." >&4
9008         val="$undef"
9009 fi
9010 $rm -f dbl_dig.?
9011 set d_dbl_dig
9012 eval $setvar
9013
9014 hasproto='varname=$1; func=$2; shift; shift;
9015 while $test $# -ge 2; do
9016         case "$1" in
9017         $define) echo "#include <$2>";;
9018         esac ;
9019     shift 2;
9020 done > try.c;
9021 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9022 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9023         echo "$func() prototype found.";
9024         val="$define";
9025 else
9026         echo "$func() prototype NOT found.";
9027         val="$undef";
9028 fi;
9029 set $varname;
9030 eval $setvar;
9031 $rm -f try.c tryout.c'
9032
9033 : see if dbm.h is available
9034 : see if dbmclose exists
9035 set dbmclose d_dbmclose
9036 eval $inlibc
9037
9038 case "$d_dbmclose" in
9039 $define)
9040         set dbm.h i_dbm
9041         eval $inhdr
9042         case "$i_dbm" in
9043         $define)
9044                 val="$undef"
9045                 set i_rpcsvcdbm
9046                 eval $setvar
9047                 ;;
9048         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9049                 eval $inhdr
9050                 ;;
9051         esac
9052         ;;
9053 *)      echo "We won't be including <dbm.h>"
9054         val="$undef"
9055         set i_dbm
9056         eval $setvar
9057         val="$undef"
9058         set i_rpcsvcdbm
9059         eval $setvar
9060         ;;
9061 esac
9062
9063 : see if prototype for dbminit is available
9064 echo " "
9065 set d_dbminitproto dbminit $i_dbm dbm.h
9066 eval $hasproto
9067
9068 : see if difftime exists
9069 set difftime d_difftime
9070 eval $inlibc
9071
9072 : see if this is a dirent system
9073 echo " "
9074 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9075         val="$define"
9076         echo "<dirent.h> found." >&4
9077 else
9078         val="$undef"
9079         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9080                 echo "<sys/dir.h> found." >&4
9081                 echo " "
9082         else
9083                 xinc=`./findhdr sys/ndir.h`
9084         fi
9085         echo "<dirent.h> NOT found." >&4
9086 fi
9087 set i_dirent
9088 eval $setvar
9089
9090 : Look for type of directory structure.
9091 echo " "
9092 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9093
9094 case "$direntrytype" in
9095 ''|' ')
9096         case "$i_dirent" in
9097         $define) guess1='struct dirent' ;;
9098         *) guess1='struct direct'  ;;
9099         esac
9100         ;;
9101 *)      guess1="$direntrytype"
9102         ;;
9103 esac
9104
9105 case "$guess1" in
9106 'struct dirent') guess2='struct direct' ;;
9107 *) guess2='struct dirent' ;;
9108 esac
9109                 
9110 if $contains "$guess1" try.c >/dev/null 2>&1; then
9111         direntrytype="$guess1"
9112         echo "Your directory entries are $direntrytype." >&4
9113 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9114         direntrytype="$guess2"
9115         echo "Your directory entries seem to be $direntrytype." >&4
9116 else
9117         echo "I don't recognize your system's directory entries." >&4
9118         rp="What type is used for directory entries on this system?"
9119         dflt="$guess1"
9120         . ./myread
9121         direntrytype="$ans"
9122 fi
9123 $rm -f try.c
9124
9125
9126 : see if the directory entry stores field length
9127 echo " "
9128 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9129 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9130         echo "Good, your directory entry keeps length information in d_namlen." >&4
9131         val="$define"
9132 else
9133         echo "Your directory entry does not know about the d_namlen field." >&4
9134         val="$undef"
9135 fi
9136 set d_dirnamlen
9137 eval $setvar
9138 $rm -f try.c
9139
9140 : see if dlerror exists
9141 xxx_runnm="$runnm"
9142 runnm=false
9143 set dlerror d_dlerror
9144 eval $inlibc
9145 runnm="$xxx_runnm"
9146
9147 : see if dlfcn is available
9148 set dlfcn.h i_dlfcn
9149 eval $inhdr
9150
9151 case "$usedl" in
9152 $define|y|true)
9153         $cat << EOM
9154
9155 On a few systems, the dynamically loaded modules that perl generates and uses
9156 will need a different extension than shared libs. The default will probably
9157 be appropriate.
9158
9159 EOM
9160         case "$dlext" in
9161         '')     dflt="$so" ;;
9162         *)      dflt="$dlext" ;;
9163         esac
9164         rp='What is the extension of dynamically loaded modules'
9165         . ./myread
9166         dlext="$ans"
9167         ;;
9168 *)
9169         dlext="none"
9170         ;;
9171 esac
9172
9173 : Check if dlsym need a leading underscore
9174 echo " "
9175 val="$undef"
9176
9177 case "$dlsrc" in
9178 dl_dlopen.xs)
9179         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9180         $cat >dyna.c <<'EOM'
9181 fred () { }
9182 EOM
9183
9184 $cat >fred.c<<EOM
9185
9186 #include <stdio.h>
9187 #$i_dlfcn I_DLFCN
9188 #ifdef I_DLFCN
9189 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9190 #else
9191 #include <sys/types.h>
9192 #include <nlist.h>
9193 #include <link.h>
9194 #endif
9195
9196 extern int fred() ;
9197
9198 int main()
9199 {
9200     void * handle ;
9201     void * symbol ;
9202 #ifndef RTLD_LAZY
9203     int mode = 1 ;
9204 #else
9205     int mode = RTLD_LAZY ;
9206 #endif
9207     handle = dlopen("./dyna.$dlext", mode) ;
9208     if (handle == NULL) {
9209         printf ("1\n") ;
9210         fflush (stdout) ;
9211         exit(0);
9212     }
9213     symbol = dlsym(handle, "fred") ;
9214     if (symbol == NULL) {
9215         /* try putting a leading underscore */
9216         symbol = dlsym(handle, "_fred") ;
9217         if (symbol == NULL) {
9218             printf ("2\n") ;
9219             fflush (stdout) ;
9220             exit(0);
9221         }
9222         printf ("3\n") ;
9223     }
9224     else
9225         printf ("4\n") ;
9226     fflush (stdout) ;
9227     exit(0);
9228 }
9229 EOM
9230         : Call the object file tmp-dyna.o in case dlext=o.
9231         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9232                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9233                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9234                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9235                 xxx=`./fred`
9236                 case $xxx in
9237                 1)      echo "Test program failed using dlopen." >&4
9238                         echo "Perhaps you should not use dynamic loading." >&4;;
9239                 2)      echo "Test program failed using dlsym." >&4
9240                         echo "Perhaps you should not use dynamic loading." >&4;;
9241                 3)      echo "dlsym needs a leading underscore" >&4
9242                         val="$define" ;;
9243                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9244                 esac
9245         else
9246                 echo "I can't compile and run the test program." >&4
9247                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9248         fi
9249         ;;
9250 esac
9251                 
9252 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9253
9254 set d_dlsymun
9255 eval $setvar
9256
9257 : see if prototype for drand48 is available
9258 echo " "
9259 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9260 eval $hasproto
9261
9262 : see if dup2 exists
9263 set dup2 d_dup2
9264 eval $inlibc
9265
9266 : see if eaccess exists
9267 set eaccess d_eaccess
9268 eval $inlibc
9269
9270 : see if endgrent exists
9271 set endgrent d_endgrent
9272 eval $inlibc
9273
9274 : see if endhostent exists
9275 set endhostent d_endhent
9276 eval $inlibc
9277
9278 : see if endnetent exists
9279 set endnetent d_endnent
9280 eval $inlibc
9281
9282 : see if endprotoent exists
9283 set endprotoent d_endpent
9284 eval $inlibc
9285
9286 : see if endpwent exists
9287 set endpwent d_endpwent
9288 eval $inlibc
9289
9290 : see if endservent exists
9291 set endservent d_endsent
9292 eval $inlibc
9293
9294 : Locate the flags for 'open()'
9295 echo " "
9296 $cat >open3.c <<'EOCP'
9297 #include <sys/types.h>
9298 #ifdef I_FCNTL
9299 #include <fcntl.h>
9300 #endif
9301 #ifdef I_SYS_FILE
9302 #include <sys/file.h>
9303 #endif
9304 int main() {
9305         if(O_RDONLY);
9306 #ifdef O_TRUNC
9307         exit(0);
9308 #else
9309         exit(1);
9310 #endif
9311 }
9312 EOCP
9313 : check sys/file.h first to get FREAD on Sun
9314 if $test `./findhdr sys/file.h` && \
9315                 set open3 -DI_SYS_FILE && eval $compile; then
9316         h_sysfile=true;
9317         echo "<sys/file.h> defines the O_* constants..." >&4
9318         if ./open3; then
9319                 echo "and you have the 3 argument form of open()." >&4
9320                 val="$define"
9321         else
9322                 echo "but not the 3 argument form of open().  Oh, well." >&4
9323                 val="$undef"
9324         fi
9325 elif $test `./findhdr fcntl.h` && \
9326                 set open3 -DI_FCNTL && eval $compile; then
9327         h_fcntl=true;
9328         echo "<fcntl.h> defines the O_* constants..." >&4
9329         if ./open3; then
9330                 echo "and you have the 3 argument form of open()." >&4
9331                 val="$define"
9332         else
9333                 echo "but not the 3 argument form of open().  Oh, well." >&4
9334                 val="$undef"
9335         fi
9336 else
9337         val="$undef"
9338         echo "I can't find the O_* constant definitions!  You got problems." >&4
9339 fi
9340 set d_open3
9341 eval $setvar
9342 $rm -f open3*
9343
9344 : see which of string.h or strings.h is needed
9345 echo " "
9346 strings=`./findhdr string.h`
9347 if $test "$strings" && $test -r "$strings"; then
9348         echo "Using <string.h> instead of <strings.h>." >&4
9349         val="$define"
9350 else
9351         val="$undef"
9352         strings=`./findhdr strings.h`
9353         if $test "$strings" && $test -r "$strings"; then
9354                 echo "Using <strings.h> instead of <string.h>." >&4
9355         else
9356                 echo "No string header found -- You'll surely have problems." >&4
9357         fi
9358 fi
9359 set i_string
9360 eval $setvar
9361 case "$i_string" in
9362 "$undef") strings=`./findhdr strings.h`;;
9363 *)        strings=`./findhdr string.h`;;
9364 esac
9365
9366 : check for non-blocking I/O stuff
9367 case "$h_sysfile" in
9368 true) echo "#include <sys/file.h>" > head.c;;
9369 *)
9370        case "$h_fcntl" in
9371        true) echo "#include <fcntl.h>" > head.c;;
9372        *) echo "#include <sys/fcntl.h>" > head.c;;
9373        esac
9374        ;;
9375 esac
9376 echo " "
9377 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9378 case "$o_nonblock" in
9379 '')
9380         $cat head.c > try.c
9381         $cat >>try.c <<'EOCP'
9382 #include <stdio.h>
9383 int main() {
9384 #ifdef O_NONBLOCK
9385         printf("O_NONBLOCK\n");
9386         exit(0);
9387 #endif
9388 #ifdef O_NDELAY
9389         printf("O_NDELAY\n");
9390         exit(0);
9391 #endif
9392 #ifdef FNDELAY
9393         printf("FNDELAY\n");
9394         exit(0);
9395 #endif
9396         exit(0);
9397 }
9398 EOCP
9399         set try
9400         if eval $compile_ok; then
9401                 o_nonblock=`./try`
9402                 case "$o_nonblock" in
9403                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9404                 *) echo "Seems like we can use $o_nonblock.";;
9405                 esac
9406         else
9407                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9408         fi
9409         ;;
9410 *) echo "Using $hint value $o_nonblock.";;
9411 esac
9412 $rm -f try try.* .out core
9413
9414 echo " "
9415 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9416 case "$eagain" in
9417 '')
9418         $cat head.c > try.c
9419         $cat >>try.c <<EOCP
9420 #include <errno.h>
9421 #include <sys/types.h>
9422 #include <signal.h>
9423 #include <stdio.h> 
9424 #define MY_O_NONBLOCK $o_nonblock
9425 #ifndef errno  /* XXX need better Configure test */
9426 extern int errno;
9427 #endif
9428 #$i_unistd I_UNISTD
9429 #ifdef I_UNISTD
9430 #include <unistd.h>
9431 #endif
9432 #$i_string I_STRING
9433 #ifdef I_STRING
9434 #include <string.h>
9435 #else
9436 #include <strings.h>
9437 #endif
9438 $signal_t blech(x) int x; { exit(3); }
9439 EOCP
9440         $cat >> try.c <<'EOCP'
9441 int main()
9442 {
9443         int pd[2];
9444         int pu[2];
9445         char buf[1];
9446         char string[100];
9447
9448         pipe(pd);       /* Down: child -> parent */
9449         pipe(pu);       /* Up: parent -> child */
9450         if (0 != fork()) {
9451                 int ret;
9452                 close(pd[1]);   /* Parent reads from pd[0] */
9453                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9454 #ifdef F_SETFL
9455                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9456                         exit(1);
9457 #else
9458                 exit(4);
9459 #endif
9460                 signal(SIGALRM, blech);
9461                 alarm(5);
9462                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9463                         exit(2);
9464                 sprintf(string, "%d\n", ret);
9465                 write(2, string, strlen(string));
9466                 alarm(0);
9467 #ifdef EAGAIN
9468                 if (errno == EAGAIN) {
9469                         printf("EAGAIN\n");
9470                         goto ok;
9471                 }
9472 #endif
9473 #ifdef EWOULDBLOCK
9474                 if (errno == EWOULDBLOCK)
9475                         printf("EWOULDBLOCK\n");
9476 #endif
9477         ok:
9478                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9479                 sleep(2);                               /* Give it time to close our pipe */
9480                 alarm(5);
9481                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9482                 alarm(0);
9483                 sprintf(string, "%d\n", ret);
9484                 write(3, string, strlen(string));
9485                 exit(0);
9486         }
9487
9488         close(pd[0]);                   /* We write to pd[1] */
9489         close(pu[1]);                   /* We read from pu[0] */
9490         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9491         close(pd[1]);                   /* Pipe pd is now fully closed! */
9492         exit(0);                                /* Bye bye, thank you for playing! */
9493 }
9494 EOCP
9495         set try
9496         if eval $compile_ok; then
9497                 echo "$startsh" >mtry
9498                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9499                 chmod +x mtry
9500                 ./mtry >/dev/null 2>&1
9501                 case $? in
9502                 0) eagain=`$cat try.out`;;
9503                 1) echo "Could not perform non-blocking setting!";;
9504                 2) echo "I did a successful read() for something that was not there!";;
9505                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9506                 4) echo "Could not find F_SETFL!";;
9507                 *) echo "Something terribly wrong happened during testing.";;
9508                 esac
9509                 rd_nodata=`$cat try.ret`
9510                 echo "A read() system call with no data present returns $rd_nodata."
9511                 case "$rd_nodata" in
9512                 0|-1) ;;
9513                 *)
9514                         echo "(That's peculiar, fixing that to be -1.)"
9515                         rd_nodata=-1
9516                         ;;
9517                 esac
9518                 case "$eagain" in
9519                 '')
9520                         echo "Forcing errno EAGAIN on read() with no data available."
9521                         eagain=EAGAIN
9522                         ;;
9523                 *)
9524                         echo "Your read() sets errno to $eagain when no data is available."
9525                         ;;
9526                 esac
9527                 status=`$cat try.err`
9528                 case "$status" in
9529                 0) echo "And it correctly returns 0 to signal EOF.";;
9530                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9531                 *) echo "However, your read() returns '$status' on EOF??";;
9532                 esac
9533                 val="$define"
9534                 if test "$status" = "$rd_nodata"; then
9535                         echo "WARNING: you can't distinguish between EOF and no data!"
9536                         val="$undef"
9537                 fi
9538         else
9539                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9540                 eagain=EAGAIN
9541         fi
9542         set d_eofnblk
9543         eval $setvar
9544         ;;
9545 *)
9546         echo "Using $hint value $eagain."
9547         echo "Your read() returns $rd_nodata when no data is present."
9548         case "$d_eofnblk" in
9549         "$define") echo "And you can see EOF because read() returns 0.";;
9550         "$undef") echo "But you can't see EOF status from read() returned value.";;
9551         *)
9552                 echo "(Assuming you can't see EOF status from read anyway.)"
9553                 d_eofnblk=$undef
9554                 ;;
9555         esac
9556         ;;
9557 esac
9558 $rm -f try try.* .out core head.c mtry
9559
9560 : see if fchmod exists
9561 set fchmod d_fchmod
9562 eval $inlibc
9563
9564 : see if fchown exists
9565 set fchown d_fchown
9566 eval $inlibc
9567
9568 : see if this is an fcntl system
9569 set fcntl d_fcntl
9570 eval $inlibc
9571
9572 echo " "
9573 : See if fcntl-based locking works.
9574 $cat >try.c <<'EOCP'
9575 #include <stdlib.h>
9576 #include <unistd.h>
9577 #include <fcntl.h>
9578 int main() {
9579 #if defined(F_SETLK) && defined(F_SETLKW)
9580      struct flock flock;
9581      int retval, fd;
9582      fd = open("try.c", O_RDONLY);
9583      flock.l_type = F_RDLCK;
9584      flock.l_whence = SEEK_SET;
9585      flock.l_start = flock.l_len = 0;
9586      retval = fcntl(fd, F_SETLK, &flock);
9587      close(fd);
9588      (retval < 0 ? exit(2) : exit(0));
9589 #else
9590      exit(2);
9591 #endif
9592 }
9593 EOCP
9594 echo "Checking if fcntl-based file locking works... "
9595 case "$d_fcntl" in
9596 "$define")
9597         set try
9598         if eval $compile_ok; then
9599                 if ./try; then
9600                         echo "Yes, it seems to work."
9601                         val="$define"
9602                 else
9603                         echo "Nope, it didn't work."
9604                         val="$undef"
9605                 fi
9606         else
9607                 echo "I'm unable to compile the test program, so I'll assume not."
9608                 val="$undef"
9609         fi
9610         ;;
9611 *) val="$undef";
9612         echo "Nope, since you don't even have fcntl()."
9613         ;;
9614 esac
9615 set d_fcntl_can_lock
9616 eval $setvar
9617 $rm -f try*
9618
9619
9620 : see if sys/select.h has to be included
9621 set sys/select.h i_sysselct
9622 eval $inhdr
9623
9624 : see if we should include time.h, sys/time.h, or both
9625 echo " "
9626 if test "X$timeincl" = X; then
9627         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9628         $echo $n "I'm now running the test program...$c"
9629         $cat >try.c <<'EOCP'
9630 #include <sys/types.h>
9631 #ifdef I_TIME
9632 #include <time.h>
9633 #endif
9634 #ifdef I_SYSTIME
9635 #ifdef SYSTIMEKERNEL
9636 #define KERNEL
9637 #endif
9638 #include <sys/time.h>
9639 #endif
9640 #ifdef I_SYSSELECT
9641 #include <sys/select.h>
9642 #endif
9643 int main()
9644 {
9645         struct tm foo;
9646 #ifdef S_TIMEVAL
9647         struct timeval bar;
9648 #endif
9649 #ifdef S_TIMEZONE
9650         struct timezone tzp;
9651 #endif
9652         if (foo.tm_sec == foo.tm_sec)
9653                 exit(0);
9654 #ifdef S_TIMEVAL
9655         if (bar.tv_sec == bar.tv_sec)
9656                 exit(0);
9657 #endif
9658         exit(1);
9659 }
9660 EOCP
9661         flags=''
9662         for s_timezone in '-DS_TIMEZONE' ''; do
9663         sysselect=''
9664         for s_timeval in '-DS_TIMEVAL' ''; do
9665         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9666         for i_time in '' '-DI_TIME'; do
9667         for i_systime in '-DI_SYSTIME' ''; do
9668                 case "$flags" in
9669                 '') $echo $n ".$c"
9670                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9671                         if eval $compile; then
9672                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9673                                 shift
9674                                 flags="$*"
9675                                 echo " "
9676                                 $echo $n "Succeeded with $flags$c"
9677                         fi
9678                         ;;
9679                 esac
9680         done
9681         done
9682         done
9683         done
9684         done
9685         timeincl=''
9686         echo " "
9687         case "$flags" in
9688         *SYSTIMEKERNEL*) i_systimek="$define"
9689                 timeincl=`./findhdr sys/time.h`
9690                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9691         *) i_systimek="$undef";;
9692         esac
9693         case "$flags" in
9694         *I_TIME*) i_time="$define"
9695                 timeincl=`./findhdr time.h`" $timeincl"
9696                 echo "We'll include <time.h>." >&4;;
9697         *) i_time="$undef";;
9698         esac
9699         case "$flags" in
9700         *I_SYSTIME*) i_systime="$define"
9701                 timeincl=`./findhdr sys/time.h`" $timeincl"
9702                 echo "We'll include <sys/time.h>." >&4;;
9703         *) i_systime="$undef";;
9704         esac
9705         $rm -f try.c try
9706 fi
9707
9708 : check for fd_set items
9709 $cat <<EOM
9710
9711 Checking to see how well your C compiler handles fd_set and friends ...
9712 EOM
9713 $cat >fd_set.c <<EOCP
9714 #$i_systime I_SYS_TIME
9715 #$i_sysselct I_SYS_SELECT
9716 #$d_socket HAS_SOCKET
9717 #include <sys/types.h>
9718 #ifdef HAS_SOCKET
9719 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9720 #endif
9721 #ifdef I_SYS_TIME
9722 #include <sys/time.h>
9723 #endif
9724 #ifdef I_SYS_SELECT
9725 #include <sys/select.h>
9726 #endif
9727 int main() {
9728         fd_set fds;
9729
9730 #ifdef TRYBITS
9731         if(fds.fds_bits);
9732 #endif
9733
9734 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9735         exit(0);
9736 #else
9737         exit(1);
9738 #endif
9739 }
9740 EOCP
9741 set fd_set -DTRYBITS
9742 if eval $compile; then
9743         d_fds_bits="$define"
9744         d_fd_set="$define"
9745         echo "Well, your system knows about the normal fd_set typedef..." >&4
9746         if ./fd_set; then
9747                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9748                 d_fd_macros="$define"
9749         else
9750                 $cat >&4 <<'EOM'
9751 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9752 EOM
9753                 d_fd_macros="$undef"
9754         fi
9755 else
9756         $cat <<'EOM'
9757 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9758 EOM
9759         set fd_set
9760         if eval $compile; then
9761                 d_fds_bits="$undef"
9762                 d_fd_set="$define"
9763                 echo "Well, your system has some sort of fd_set available..." >&4
9764                 if ./fd_set; then
9765                         echo "and you have the normal fd_set macros." >&4
9766                         d_fd_macros="$define"
9767                 else
9768                         $cat <<'EOM'
9769 but not the normal fd_set macros!  Gross!  More work for me...
9770 EOM
9771                         d_fd_macros="$undef"
9772                 fi
9773         else
9774         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9775                 d_fd_set="$undef"
9776                 d_fds_bits="$undef"
9777                 d_fd_macros="$undef"
9778         fi
9779 fi
9780 $rm -f fd_set*
9781
9782 : see if fgetpos exists
9783 set fgetpos d_fgetpos
9784 eval $inlibc
9785
9786 : see if flock exists
9787 set flock d_flock
9788 eval $inlibc
9789
9790 : see if this is a sys/file.h system
9791 val=''
9792 set sys/file.h val
9793 eval $inhdr
9794
9795 : do we need to include sys/file.h ?
9796 case "$val" in
9797 "$define")
9798         echo " "
9799         if $h_sysfile; then
9800                 val="$define"
9801                 echo "We'll be including <sys/file.h>." >&4
9802         else
9803                 val="$undef"
9804                 echo "We won't be including <sys/file.h>." >&4
9805         fi
9806         ;;
9807 *)
9808         h_sysfile=false
9809         ;;
9810 esac
9811 set i_sysfile
9812 eval $setvar
9813
9814 : see if prototype for flock is available
9815 echo " "
9816 set d_flockproto flock $i_sysfile sys/file.h
9817 eval $hasproto
9818
9819 : see if fork exists
9820 set fork d_fork
9821 eval $inlibc
9822
9823 : see if pathconf exists
9824 set pathconf d_pathconf
9825 eval $inlibc
9826
9827 : see if fpathconf exists
9828 set fpathconf d_fpathconf
9829 eval $inlibc
9830
9831
9832 : check for fpos64_t
9833 echo " "
9834 echo "Checking to see if you have fpos64_t..." >&4
9835 $cat >try.c <<EOCP
9836 #include <stdio.h>
9837 int main() { fpos64_t x = 7; }
9838 EOCP
9839 set try
9840 if eval $compile; then
9841         val="$define"
9842         echo "You have fpos64_t."
9843 else
9844         val="$undef"
9845         echo "You do not have fpos64_t."
9846         case "$fpossize" in
9847         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9848         esac
9849 fi
9850 $rm -f try.* try
9851 set d_fpos64_t
9852 eval $setvar
9853
9854 : see if frexpl exists
9855 set frexpl d_frexpl
9856 eval $inlibc
9857
9858 : see if this is a sys/param system
9859 set sys/param.h i_sysparam
9860 eval $inhdr
9861
9862 : see if this is a sys/mount.h system
9863 set sys/mount.h i_sysmount
9864 eval $inhdr
9865
9866
9867 echo " "
9868 echo "Checking to see if your system supports struct fs_data..." >&4
9869 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9870 eval $hasstruct
9871 case "$d_fs_data_s" in
9872 "$define")      echo "Yes, it does."   ;;
9873 *)              echo "No, it doesn't." ;;
9874 esac
9875
9876 : see if fseeko exists
9877 set fseeko d_fseeko
9878 eval $inlibc
9879 case "$longsize" in
9880 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9881 esac
9882
9883 : see if fsetpos exists
9884 set fsetpos d_fsetpos
9885 eval $inlibc
9886
9887
9888 : see if fstatfs exists
9889 set fstatfs d_fstatfs
9890 eval $inlibc
9891
9892
9893 : see if statvfs exists
9894 set statvfs d_statvfs
9895 eval $inlibc
9896
9897 : see if fstatvfs exists
9898 set fstatvfs d_fstatvfs
9899 eval $inlibc
9900
9901
9902 : see if fsync exists
9903 set fsync d_fsync
9904 eval $inlibc
9905
9906 : see if ftello exists
9907 set ftello d_ftello
9908 eval $inlibc
9909 case "$longsize" in
9910 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9911 esac
9912
9913 : see if getcwd exists
9914 set getcwd d_getcwd
9915 eval $inlibc
9916
9917 : see if getespwnam exists
9918 set getespwnam d_getespwnam
9919 eval $inlibc
9920
9921
9922 : see if getfsstat exists
9923 set getfsstat d_getfsstat
9924 eval $inlibc
9925
9926 : see if getgrent exists
9927 set getgrent d_getgrent
9928 eval $inlibc
9929
9930 : see if gethostbyaddr exists
9931 set gethostbyaddr d_gethbyaddr
9932 eval $inlibc
9933
9934 : see if gethostbyname exists
9935 set gethostbyname d_gethbyname
9936 eval $inlibc
9937
9938 : see if gethostent exists
9939 set gethostent d_gethent
9940 eval $inlibc
9941
9942 : see how we will look up host name
9943 echo " "
9944 call=''
9945 if set gethostname val -f d_gethname; eval $csym; $val; then
9946         echo 'gethostname() found.' >&4
9947         d_gethname="$define"
9948         call=gethostname
9949 fi
9950 if set uname val -f d_uname; eval $csym; $val; then
9951         if ./xenix; then
9952                 $cat <<'EOM'
9953 uname() was found, but you're running xenix, and older versions of xenix
9954 have a broken uname(). If you don't really know whether your xenix is old
9955 enough to have a broken system call, use the default answer.
9956
9957 EOM
9958                 dflt=y
9959                 case "$d_uname" in
9960                 "$define") dflt=n;;
9961                 esac
9962                 rp='Is your uname() broken?'
9963                 . ./myread
9964                 case "$ans" in
9965                 n*) d_uname="$define"; call=uname;;
9966                 esac
9967         else
9968                 echo 'uname() found.' >&4
9969                 d_uname="$define"
9970                 case "$call" in
9971                 '') call=uname ;;
9972                 esac
9973         fi
9974 fi
9975 case "$d_gethname" in
9976 '') d_gethname="$undef";;
9977 esac
9978 case "$d_uname" in
9979 '') d_uname="$undef";;
9980 esac
9981 case "$d_uname$d_gethname" in
9982 *define*)
9983         dflt=n
9984         cat <<EOM
9985  
9986 Every now and then someone has a $call() that lies about the hostname
9987 but can't be fixed for political or economic reasons.  If you wish, I can
9988 pretend $call() isn't there and maybe compute hostname at run-time
9989 thanks to the '$phostname' command.
9990
9991 EOM
9992         rp="Shall I ignore $call() from now on?"
9993         . ./myread
9994         case "$ans" in
9995         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9996         esac;;
9997 esac
9998 case "$phostname" in
9999 '') aphostname='';;
10000 *) case "$aphostname" in
10001         /*) ;;
10002         *) set X $phostname
10003                 shift
10004                 file=$1
10005                 shift
10006                 file=`./loc $file $file $pth`
10007                 aphostname=`echo $file $*`
10008                 ;;
10009         esac
10010         ;;
10011 esac
10012 case "$d_uname$d_gethname" in
10013 *define*) ;;
10014 *)
10015         case "$phostname" in
10016         '')
10017                 echo "There will be no way for $package to get your hostname." >&4;;
10018         *)
10019         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10020                 ;;
10021         esac;;
10022 esac
10023 case "$d_phostname" in
10024 '') d_phostname="$undef";;
10025 esac
10026
10027 : see if this is a netdb.h system
10028 set netdb.h i_netdb
10029 eval $inhdr
10030
10031 : see if prototypes for various gethostxxx netdb.h functions are available
10032 echo " "
10033 set d_gethostprotos gethostent $i_netdb netdb.h
10034 eval $hasproto
10035
10036 : see if getitimer exists
10037 set getitimer d_getitimer
10038 eval $inlibc
10039
10040 : see if getlogin exists
10041 set getlogin d_getlogin
10042 eval $inlibc
10043
10044 : see if getmnt exists
10045 set getmnt d_getmnt
10046 eval $inlibc
10047
10048 : see if getmntent exists
10049 set getmntent d_getmntent
10050 eval $inlibc
10051
10052 : see if getnetbyaddr exists
10053 set getnetbyaddr d_getnbyaddr
10054 eval $inlibc
10055
10056 : see if getnetbyname exists
10057 set getnetbyname d_getnbyname
10058 eval $inlibc
10059
10060 : see if getnetent exists
10061 set getnetent d_getnent
10062 eval $inlibc
10063
10064 : see if prototypes for various getnetxxx netdb.h functions are available
10065 echo " "
10066 set d_getnetprotos getnetent $i_netdb netdb.h
10067 eval $hasproto
10068
10069 : see if getpagesize exists
10070 set getpagesize d_getpagsz
10071 eval $inlibc
10072
10073
10074 : see if getprotobyname exists
10075 set getprotobyname d_getpbyname
10076 eval $inlibc
10077
10078 : see if getprotobynumber exists
10079 set getprotobynumber d_getpbynumber
10080 eval $inlibc
10081
10082 : see if getprotoent exists
10083 set getprotoent d_getpent
10084 eval $inlibc
10085
10086 : see if getpgid exists
10087 set getpgid d_getpgid
10088 eval $inlibc
10089
10090 : see if getpgrp2 exists
10091 set getpgrp2 d_getpgrp2
10092 eval $inlibc
10093
10094 : see if getppid exists
10095 set getppid d_getppid
10096 eval $inlibc
10097
10098 : see if getpriority exists
10099 set getpriority d_getprior
10100 eval $inlibc
10101
10102 : see if prototypes for various getprotoxxx netdb.h functions are available
10103 echo " "
10104 set d_getprotoprotos getprotoent $i_netdb netdb.h
10105 eval $hasproto
10106
10107 : see if getprpwnam exists
10108 set getprpwnam d_getprpwnam
10109 eval $inlibc
10110
10111 : see if getpwent exists
10112 set getpwent d_getpwent
10113 eval $inlibc
10114
10115
10116 : see if getservbyname exists
10117 set getservbyname d_getsbyname
10118 eval $inlibc
10119
10120 : see if getservbyport exists
10121 set getservbyport d_getsbyport
10122 eval $inlibc
10123
10124 : see if getservent exists
10125 set getservent d_getsent
10126 eval $inlibc
10127
10128 : see if prototypes for various getservxxx netdb.h functions are available
10129 echo " "
10130 set d_getservprotos getservent $i_netdb netdb.h
10131 eval $hasproto
10132
10133 : see if getspnam exists
10134 set getspnam d_getspnam
10135 eval $inlibc
10136
10137 : see if gettimeofday or ftime exists
10138 set gettimeofday d_gettimeod
10139 eval $inlibc
10140 case "$d_gettimeod" in
10141 "$undef")
10142         set ftime d_ftime 
10143         eval $inlibc
10144         ;;
10145 *)
10146         val="$undef"; set d_ftime; eval $setvar
10147         ;;
10148 esac
10149 case "$d_gettimeod$d_ftime" in
10150 "$undef$undef")
10151         echo " "
10152         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10153         ;;
10154 esac
10155
10156 : see if this is an grp system
10157 set grp.h i_grp
10158 eval $inhdr
10159
10160 case "$i_grp" in
10161 $define)
10162         xxx=`./findhdr grp.h`
10163         $cppstdin $cppflags $cppminus < $xxx >$$.h
10164
10165         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10166                 val="$define"
10167         else
10168                 val="$undef"
10169         fi
10170         set d_grpasswd
10171         eval $setvar
10172
10173         $rm -f $$.h
10174         ;;
10175 *)
10176         val="$undef";
10177         set d_grpasswd; eval $setvar
10178         ;;
10179 esac
10180
10181 : see if hasmntopt exists
10182 set hasmntopt d_hasmntopt
10183 eval $inlibc
10184
10185 : see if this is a netinet/in.h or sys/in.h system
10186 set netinet/in.h i_niin sys/in.h i_sysin
10187 eval $inhdr
10188
10189 : see if arpa/inet.h has to be included
10190 set arpa/inet.h i_arpainet
10191 eval $inhdr
10192
10193 : see if htonl --and friends-- exists
10194 val=''
10195 set htonl val
10196 eval $inlibc
10197
10198 : Maybe they are macros.
10199 case "$val" in
10200 $undef)
10201         $cat >htonl.c <<EOM
10202 #include <stdio.h>
10203 #include <sys/types.h>
10204 #$i_niin I_NETINET_IN
10205 #$i_sysin I_SYS_IN
10206 #$i_arpainet I_ARPA_INET
10207 #ifdef I_NETINET_IN
10208 #include <netinet/in.h>
10209 #endif
10210 #ifdef I_SYS_IN
10211 #include <sys/in.h>
10212 #endif
10213 #ifdef I_ARPA_INET
10214 #include <arpa/inet.h>
10215 #endif
10216 #ifdef htonl
10217 printf("Defined as a macro.");
10218 #endif
10219 EOM
10220         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10221         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10222                 val="$define"
10223                 echo "But it seems to be defined as a macro." >&4
10224         fi
10225         $rm -f htonl.?
10226         ;;
10227 esac
10228 set d_htonl
10229 eval $setvar
10230
10231 : see if iconv exists
10232 set iconv d_iconv
10233 eval $inlibc
10234
10235 : index or strchr
10236 echo " "
10237 if set index val -f; eval $csym; $val; then
10238         if set strchr val -f d_strchr; eval $csym; $val; then
10239                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10240                         val="$define"
10241                         vali="$undef"
10242                         echo "strchr() found." >&4
10243                 else
10244                         val="$undef"
10245                         vali="$define"
10246                         echo "index() found." >&4
10247                 fi
10248         else
10249                 val="$undef"
10250                 vali="$define"
10251                 echo "index() found." >&4
10252         fi
10253 else
10254         if set strchr val -f d_strchr; eval $csym; $val; then
10255                 val="$define"
10256                 vali="$undef"
10257                 echo "strchr() found." >&4
10258         else
10259                 echo "No index() or strchr() found!" >&4
10260                 val="$undef"
10261                 vali="$undef"
10262         fi
10263 fi
10264 set d_strchr; eval $setvar
10265 val="$vali"
10266 set d_index; eval $setvar
10267
10268 : check whether inet_aton exists
10269 set inet_aton d_inetaton
10270 eval $inlibc
10271
10272 : Look for isascii
10273 echo " "
10274 $cat >isascii.c <<'EOCP'
10275 #include <stdio.h>
10276 #include <ctype.h>
10277 int main() {
10278         int c = 'A';
10279         if (isascii(c))
10280                 exit(0);
10281         else
10282                 exit(1);
10283 }
10284 EOCP
10285 set isascii
10286 if eval $compile; then
10287         echo "isascii() found." >&4
10288         val="$define"
10289 else
10290         echo "isascii() NOT found." >&4
10291         val="$undef"
10292 fi
10293 set d_isascii
10294 eval $setvar
10295 $rm -f isascii*
10296
10297 : see if isnan exists
10298 set isnan d_isnan
10299 eval $inlibc
10300
10301 : see if isnanl exists
10302 set isnanl d_isnanl
10303 eval $inlibc
10304
10305 : see if killpg exists
10306 set killpg d_killpg
10307 eval $inlibc
10308
10309 : see if lchown exists
10310 echo " "
10311 $cat > try.c <<'EOCP'
10312 /* System header to define __stub macros and hopefully few prototypes,
10313     which can conflict with char lchown(); below.  */
10314 #include <assert.h>
10315 /* Override any gcc2 internal prototype to avoid an error.  */
10316 /* We use char because int might match the return type of a gcc2
10317    builtin and then its argument prototype would still apply.  */
10318 char lchown();
10319 int main() {
10320     /*  The GNU C library defines this for functions which it implements
10321         to always fail with ENOSYS.  Some functions are actually named
10322         something starting with __ and the normal name is an alias.  */
10323 #if defined (__stub_lchown) || defined (__stub___lchown)
10324 choke me
10325 #else
10326 lchown();
10327 #endif
10328 ; return 0; }
10329 EOCP
10330 set try
10331 if eval $compile; then
10332     $echo "lchown() found." >&4
10333     val="$define"
10334 else
10335     $echo "lchown() NOT found." >&4
10336     val="$undef"
10337 fi
10338 set d_lchown
10339 eval $setvar
10340
10341 : See if number of significant digits in a double precision number is known
10342 echo " "
10343 $cat >ldbl_dig.c <<EOM
10344 #$i_limits I_LIMITS
10345 #$i_float I_FLOAT
10346 #ifdef I_LIMITS
10347 #include <limits.h>
10348 #endif
10349 #ifdef I_FLOAT
10350 #include <float.h>
10351 #endif
10352 #ifdef LDBL_DIG
10353 printf("Contains LDBL_DIG");
10354 #endif
10355 EOM
10356 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10357 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10358         echo "LDBL_DIG found." >&4
10359         val="$define"
10360 else
10361         echo "LDBL_DIG NOT found." >&4
10362         val="$undef"
10363 fi
10364 $rm -f ldbl_dig.?
10365 set d_ldbl_dig
10366 eval $setvar
10367
10368 : see if link exists
10369 set link d_link
10370 eval $inlibc
10371
10372 : see if localeconv exists
10373 set localeconv d_locconv
10374 eval $inlibc
10375
10376 : see if lockf exists
10377 set lockf d_lockf
10378 eval $inlibc
10379
10380 : see if prototype for lseek is available
10381 echo " "
10382 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10383 eval $hasproto
10384
10385 : see if lstat exists
10386 set lstat d_lstat
10387 eval $inlibc
10388
10389 : see if madvise exists
10390 set madvise d_madvise
10391 eval $inlibc
10392
10393 : see if mblen exists
10394 set mblen d_mblen
10395 eval $inlibc
10396
10397 : see if mbstowcs exists
10398 set mbstowcs d_mbstowcs
10399 eval $inlibc
10400
10401 : see if mbtowc exists
10402 set mbtowc d_mbtowc
10403 eval $inlibc
10404
10405 : see if memchr exists
10406 set memchr d_memchr
10407 eval $inlibc
10408
10409 : see if memcmp exists
10410 set memcmp d_memcmp
10411 eval $inlibc
10412
10413 : see if memcpy exists
10414 set memcpy d_memcpy
10415 eval $inlibc
10416
10417 : see if memmove exists
10418 set memmove d_memmove
10419 eval $inlibc
10420
10421 : see if memset exists
10422 set memset d_memset
10423 eval $inlibc
10424
10425 : see if mkdir exists
10426 set mkdir d_mkdir
10427 eval $inlibc
10428
10429 : see if mkdtemp exists
10430 set mkdtemp d_mkdtemp
10431 eval $inlibc
10432
10433 : see if mkfifo exists
10434 set mkfifo d_mkfifo
10435 eval $inlibc
10436
10437 : see if mkstemp exists
10438 set mkstemp d_mkstemp
10439 eval $inlibc
10440
10441 : see if mkstemps exists
10442 set mkstemps d_mkstemps
10443 eval $inlibc
10444
10445 : see if mktime exists
10446 set mktime d_mktime
10447 eval $inlibc
10448
10449 : see if this is a sys/mman.h system
10450 set sys/mman.h i_sysmman
10451 eval $inhdr
10452
10453 : see if mmap exists
10454 set mmap d_mmap
10455 eval $inlibc
10456 : see what shmat returns
10457 : default to something harmless
10458 mmaptype='void *'
10459 case "$i_sysmman$d_mmap" in
10460 "$define$define")
10461         $cat >mmap.c <<'END'
10462 #include <sys/mman.h>
10463 void *mmap();
10464 END
10465         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10466                 mmaptype='void *'
10467         else
10468                 mmaptype='caddr_t'
10469         fi
10470         echo "and it returns ($mmaptype)." >&4
10471         ;;
10472 esac
10473
10474
10475
10476 : see if modfl exists
10477 set modfl d_modfl
10478 eval $inlibc
10479
10480 d_modfl_pow32_bug="$undef"
10481
10482 case "$d_longdbl$d_modfl" in
10483 $define$define)
10484         $cat <<EOM
10485 Checking to see whether your modfl() is okay for large values...
10486 EOM
10487 $cat >try.c <<EOCP
10488 #include <math.h> 
10489 #include <stdio.h>
10490 int main() {
10491     long double nv = 4294967303.15;
10492     long double v, w;
10493     v = modfl(nv, &w);         
10494 #ifdef __GLIBC__
10495     printf("glibc");
10496 #endif
10497     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10498     return 0;
10499 }
10500 EOCP
10501         case "$osname:$gccversion" in
10502         aix:)   saveccflags="$ccflags"
10503                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10504         esac
10505         set try
10506         if eval $compile; then
10507                 foo=`./try`
10508                 case "$foo" in
10509                 *" 4294967303.150000 1.150000 4294967302.000000")
10510                         echo >&4 "Your modfl() is broken for large values."
10511                         d_modfl_pow32_bug="$define"
10512                         case "$foo" in
10513                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10514                         ;;
10515                         esac
10516                         ;;
10517                 *" 4294967303.150000 0.150000 4294967303.000000")
10518                         echo >&4 "Your modfl() seems okay for large values."
10519                         ;;
10520                 *)      echo >&4 "I don't understand your modfl() at all."
10521                         d_modfl="$undef"
10522                         ;;
10523                 esac
10524                 $rm -f try.* try core core.try.*
10525         else
10526                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10527                 d_modfl="$undef"
10528         fi
10529         case "$osname:$gccversion" in
10530         aix:)   $ccflags="saveccflags" ;; # restore
10531         esac
10532         ;;
10533 esac
10534
10535 : see if mprotect exists
10536 set mprotect d_mprotect
10537 eval $inlibc
10538
10539 : see if msgctl exists
10540 set msgctl d_msgctl
10541 eval $inlibc
10542
10543 : see if msgget exists
10544 set msgget d_msgget
10545 eval $inlibc
10546
10547 : see if msgsnd exists
10548 set msgsnd d_msgsnd
10549 eval $inlibc
10550
10551 : see if msgrcv exists
10552 set msgrcv d_msgrcv
10553 eval $inlibc
10554
10555 : see how much of the 'msg*(2)' library is present.
10556 h_msg=true
10557 echo " "
10558 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10559 *"$undef"*) h_msg=false;;
10560 esac
10561 case "$osname" in
10562 freebsd)
10563     case "`ipcs 2>&1`" in
10564     "SVID messages"*"not configured"*)
10565         echo "Your $osname does not have the msg*(2) configured." >&4
10566         h_msg=false
10567         val="$undef"
10568         set msgctl d_msgctl
10569         eval $setvar
10570         set msgget d_msgget
10571         eval $setvar
10572         set msgsnd d_msgsnd
10573         eval $setvar
10574         set msgrcv d_msgrcv
10575         eval $setvar
10576         ;;
10577     esac
10578     ;;
10579 esac
10580 : we could also check for sys/ipc.h ...
10581 if $h_msg && $test `./findhdr sys/msg.h`; then
10582         echo "You have the full msg*(2) library." >&4
10583         val="$define"
10584 else
10585         echo "You don't have the full msg*(2) library." >&4
10586         val="$undef"
10587 fi
10588 set d_msg
10589 eval $setvar
10590
10591
10592 echo " "
10593 echo "Checking to see if your system supports struct msghdr..." >&4
10594 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10595 eval $hasstruct
10596 case "$d_msghdr_s" in
10597 "$define")      echo "Yes, it does."   ;;
10598 *)              echo "No, it doesn't." ;;
10599 esac
10600
10601
10602 : see if msync exists
10603 set msync d_msync
10604 eval $inlibc
10605
10606 : see if munmap exists
10607 set munmap d_munmap
10608 eval $inlibc
10609
10610 : see if nice exists
10611 set nice d_nice
10612 eval $inlibc
10613
10614 : check for length of character
10615 echo " "
10616 case "$charsize" in
10617 '')
10618         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10619         $cat >try.c <<'EOCP'
10620 #include <stdio.h>
10621 int main()
10622 {
10623     printf("%d\n", (int)sizeof(char));
10624     exit(0);
10625 }
10626 EOCP
10627         set try
10628         if eval $compile_ok; then
10629                 dflt=`./try`
10630         else
10631                 dflt='1'
10632                 echo "(I can't seem to compile the test program.  Guessing...)"
10633         fi
10634         ;;
10635 *)
10636         dflt="$charsize"
10637         ;;
10638 esac
10639 rp="What is the size of a character (in bytes)?"
10640 . ./myread
10641 charsize="$ans"
10642 $rm -f try.c try
10643
10644 : check for volatile keyword
10645 echo " "
10646 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10647 $cat >try.c <<'EOCP'
10648 int main()
10649 {
10650         typedef struct _goo_struct goo_struct;
10651         goo_struct * volatile goo = ((goo_struct *)0);
10652         struct _goo_struct {
10653                 long long_int;
10654                 int reg_int;
10655                 char char_var;
10656         };
10657         typedef unsigned short foo_t;
10658         char *volatile foo;
10659         volatile int bar;
10660         volatile foo_t blech;
10661         foo = foo;
10662 }
10663 EOCP
10664 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10665         val="$define"
10666         echo "Yup, it does."
10667 else
10668         val="$undef"
10669         echo "Nope, it doesn't."
10670 fi
10671 set d_volatile
10672 eval $setvar
10673 $rm -f try.*
10674
10675
10676 echo " "
10677 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10678
10679 case "$use64bitint:$d_quad:$quadtype" in
10680 define:define:?*)
10681         ivtype="$quadtype"
10682         uvtype="$uquadtype"
10683         ivsize=8
10684         uvsize=8
10685         ;;
10686 *)      ivtype="long"
10687         uvtype="unsigned long"
10688         ivsize=$longsize
10689         uvsize=$longsize
10690         ;;
10691 esac
10692
10693 case "$uselongdouble:$d_longdbl" in
10694 define:define)
10695         nvtype="long double"
10696         nvsize=$longdblsize
10697         ;;
10698 *)      nvtype=double
10699         nvsize=$doublesize
10700         ;;
10701 esac
10702
10703 $echo "(IV will be "$ivtype", $ivsize bytes)"
10704 $echo "(UV will be "$uvtype", $uvsize bytes)"
10705 $echo "(NV will be "$nvtype", $nvsize bytes)"
10706
10707 $cat >try.c <<EOCP
10708 #$i_inttypes I_INTTYPES
10709 #ifdef I_INTTYPES
10710 #include <inttypes.h>
10711 #endif
10712 #include <stdio.h>
10713 int main() {
10714 #ifdef INT8
10715    int8_t i =  INT8_MAX;
10716   uint8_t u = UINT8_MAX;
10717   printf("int8_t\n");
10718 #endif
10719 #ifdef INT16
10720    int16_t i =  INT16_MAX;
10721   uint16_t i = UINT16_MAX;
10722   printf("int16_t\n");
10723 #endif
10724 #ifdef INT32
10725    int32_t i =  INT32_MAX;
10726   uint32_t u = UINT32_MAX;
10727   printf("int32_t\n");
10728 #endif
10729 }
10730 EOCP
10731
10732 case "$i8type" in
10733 '')     case "$charsize" in
10734         1)      i8type=char
10735                 u8type="unsigned char"
10736                 i8size=$charsize
10737                 u8size=$charsize
10738                 ;;
10739         esac
10740         ;;
10741 esac
10742 case "$i8type" in
10743 '')     set try -DINT8
10744         if eval $compile; then
10745                 case "`./try$exe_ext`" in
10746                 int8_t) i8type=int8_t
10747                         u8type=uint8_t
10748                         i8size=1
10749                         u8size=1
10750                         ;;
10751                 esac
10752         fi
10753         ;;
10754 esac
10755 case "$i8type" in
10756 '')     if $test $charsize -ge 1; then
10757                 i8type=char
10758                 u8type="unsigned char"
10759                 i8size=$charsize
10760                 u8size=$charsize
10761         fi
10762         ;;
10763 esac
10764
10765 case "$i16type" in
10766 '')     case "$shortsize" in
10767         2)      i16type=short
10768                 u16type="unsigned short"
10769                 i16size=$shortsize
10770                 u16size=$shortsize
10771                 ;;
10772         esac
10773         ;;
10774 esac
10775 case "$i16type" in
10776 '')     set try -DINT16
10777         if eval $compile; then
10778                 case "`./try$exe_ext`" in
10779                 int16_t)
10780                         i16type=int16_t
10781                         u16type=uint16_t
10782                         i16size=2
10783                         u16size=2
10784                         ;;
10785                 esac
10786         fi
10787         ;;
10788 esac
10789 case "$i16type" in
10790 '')     if $test $shortsize -ge 2; then
10791                 i16type=short
10792                 u16type="unsigned short"
10793                 i16size=$shortsize
10794                 u16size=$shortsize
10795         fi
10796         ;;
10797 esac
10798
10799 case "$i32type" in
10800 '')     case "$longsize" in
10801         4)      i32type=long
10802                 u32type="unsigned long"
10803                 i32size=$longsize
10804                 u32size=$longsize
10805                 ;;
10806         *)      case "$intsize" in
10807                 4)      i32type=int
10808                         u32type="unsigned int"
10809                         i32size=$intsize
10810                         u32size=$intsize
10811                         ;;
10812                 esac
10813                 ;;
10814         esac
10815         ;;
10816 esac
10817 case "$i32type" in
10818 '')     set try -DINT32
10819         if eval $compile; then
10820                 case "`./try$exe_ext`" in
10821                 int32_t)
10822                         i32type=int32_t
10823                         u32type=uint32_t
10824                         i32size=4
10825                         u32size=4
10826                         ;;
10827                 esac
10828         fi
10829         ;;
10830 esac
10831 case "$i32type" in
10832 '')     if $test $intsize -ge 4; then
10833                 i32type=int
10834                 u32type="unsigned int"
10835                 i32size=$intsize
10836                 u32size=$intsize
10837         fi
10838         ;;
10839 esac
10840
10841 case "$i64type" in
10842 '')     case "$d_quad:$quadtype" in
10843         define:?*)
10844                 i64type="$quadtype"
10845                 u64type="$uquadtype"
10846                 i64size=8
10847                 u64size=8
10848                 ;;
10849         esac
10850         ;;
10851 esac
10852
10853 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10854 : volatile so that the compiler has to store it out to memory.
10855 if test X"$d_volatile" = X"$define"; then
10856         volatile=volatile
10857 fi
10858 $cat <<EOP >try.c
10859 #include <stdio.h>
10860 #include <sys/types.h>
10861 #include <signal.h>
10862 #ifdef SIGFPE
10863 $volatile int bletched = 0;
10864 $signal_t blech(s) int s; { bletched = 1; }
10865 #endif
10866 int main() {
10867     $uvtype u = 0;
10868     $nvtype d;
10869     int     n = 8 * $uvsize;
10870     int     i;
10871 #ifdef SIGFPE
10872     signal(SIGFPE, blech);
10873 #endif
10874
10875     for (i = 0; i < n; i++) {
10876       u = u << 1 | ($uvtype)1;
10877       d = ($nvtype)u;
10878       if (($uvtype)d != u)
10879         break;
10880       if (d <= 0)
10881         break;
10882       d = ($nvtype)(u - 1);
10883       if (($uvtype)d != (u - 1))
10884         break;
10885 #ifdef SIGFPE
10886       if (bletched) {
10887         break;
10888 #endif
10889       } 
10890     }
10891     printf("%d\n", ((i == n) ? -n : i));
10892     exit(0);
10893 }
10894 EOP
10895 set try
10896
10897 d_nv_preserves_uv="$undef"
10898 if eval $compile; then
10899         d_nv_preserves_uv_bits="`./try$exe_ext`"
10900 fi
10901 case "$d_nv_preserves_uv_bits" in
10902 \-[1-9]*)       
10903         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10904         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10905         d_nv_preserves_uv="$define"
10906         ;;
10907 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10908         d_nv_preserves_uv="$undef" ;;
10909 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10910         d_nv_preserves_uv_bits="$undef" ;;
10911 esac
10912
10913 $rm -f try.* try
10914
10915
10916 : check for off64_t
10917 echo " "
10918 echo "Checking to see if you have off64_t..." >&4
10919 $cat >try.c <<EOCP
10920 #include <sys/types.h>
10921 #include <unistd.h>
10922 int main() { off64_t x = 7; }
10923 EOCP
10924 set try
10925 if eval $compile; then
10926         val="$define"
10927         echo "You have off64_t."
10928 else
10929         val="$undef"
10930         echo "You do not have off64_t."
10931         case "$lseeksize" in
10932         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10933         esac
10934 fi
10935 $rm -f try.* try
10936 set d_off64_t
10937 eval $setvar
10938
10939 : see if POSIX threads are available
10940 set pthread.h i_pthread
10941 eval $inhdr
10942
10943
10944
10945
10946 : how to create joinable pthreads
10947 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10948         echo " "
10949         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10950         $cat >try.c <<'EOCP'
10951 #include <pthread.h>
10952 int main() {
10953     int detachstate = JOINABLE;
10954 }
10955 EOCP
10956         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10957         if eval $compile; then
10958                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10959                 val="$undef" # Yes, undef.
10960                 set d_old_pthread_create_joinable
10961                 eval $setvar
10962                 val=""
10963                 set old_pthread_create_joinable
10964                 eval $setvar
10965         else
10966                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10967                 if eval $compile; then
10968                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10969                         val="$define"
10970                         set d_old_pthread_create_joinable
10971                         eval $setvar
10972                         val=PTHREAD_CREATE_UNDETACHED
10973                         set old_pthread_create_joinable
10974                         eval $setvar
10975                 else            
10976                         set try -DJOINABLE=__UNDETACHED
10977                         if eval $compile; then
10978                                 echo "You seem to use __UNDETACHED." >&4
10979                                 val="$define"
10980                                 set d_old_pthread_create_joinable
10981                                 eval $setvar
10982                                 val=__UNDETACHED
10983                                 set old_pthread_create_joinable
10984                                 eval $setvar
10985                         else
10986                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10987                                 val="$define"
10988                                 set d_old_pthread_create_joinable
10989                                 eval $setvar
10990                                 val=0
10991                                 set old_pthread_create_joinable
10992                                 eval $setvar
10993                         fi
10994                 fi
10995         fi
10996         $rm -f try try.*
10997 else
10998     d_old_pthread_create_joinable="$undef"
10999     old_pthread_create_joinable=""
11000 fi
11001
11002 : see if pause exists
11003 set pause d_pause
11004 eval $inlibc
11005
11006 : see if pipe exists
11007 set pipe d_pipe
11008 eval $inlibc
11009
11010 : see if poll exists
11011 set poll d_poll
11012 eval $inlibc
11013
11014
11015 : see whether the various POSIXish _yields exist
11016 $cat >try.c <<EOP
11017 #include <pthread.h>
11018 #include <stdio.h>
11019 int main() {
11020 #ifdef SCHED_YIELD
11021         sched_yield();
11022 #else
11023 #ifdef PTHREAD_YIELD
11024         pthread_yield();
11025 #else
11026 #ifdef PTHREAD_YIELD_NULL
11027         pthread_yield(NULL);
11028 #endif
11029 #endif
11030 #endif
11031 }
11032 EOP
11033 : see if sched_yield exists
11034 set try -DSCHED_YIELD
11035 if eval $compile; then
11036     val="$define"
11037     sched_yield='sched_yield()'
11038 else
11039     val="$undef"
11040 fi
11041 case "$usethreads" in
11042 $define)
11043         case "$val" in
11044         $define) echo 'sched_yield() found.' >&4        ;;
11045         *)       echo 'sched_yield() NOT found.' >&4    ;;
11046         esac
11047 esac
11048 set d_sched_yield
11049 eval $setvar
11050
11051 : see if pthread_yield exists
11052 set try -DPTHREAD_YIELD
11053 if eval $compile; then
11054     val="$define"
11055     case "$sched_yield" in
11056     '') sched_yield='pthread_yield()' ;;
11057     esac
11058 else
11059     set try -DPTHREAD_YIELD_NULL
11060     if eval $compile; then
11061         val="$define"
11062         case "$sched_yield" in
11063         '') sched_yield='pthread_yield(NULL)' ;;
11064         esac
11065     else
11066         val="$undef"
11067     fi
11068 fi
11069 case "$usethreads" in
11070 $define)
11071         case "$val" in
11072         $define) echo 'pthread_yield() found.' >&4      ;;
11073         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11074         esac
11075         ;;
11076 esac
11077 set d_pthread_yield
11078 eval $setvar
11079
11080 case "$sched_yield" in
11081 '') sched_yield=undef ;;
11082 esac
11083
11084 $rm -f try try.*
11085
11086 : see if this is a pwd.h system
11087 set pwd.h i_pwd
11088 eval $inhdr
11089
11090 case "$i_pwd" in
11091 $define)
11092         xxx=`./findhdr pwd.h`
11093         $cppstdin $cppflags $cppminus < $xxx >$$.h
11094
11095         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11096                 val="$define"
11097         else
11098                 val="$undef"
11099         fi
11100         set d_pwquota
11101         eval $setvar
11102
11103         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11104                 val="$define"
11105         else
11106                 val="$undef"
11107         fi
11108         set d_pwage
11109         eval $setvar
11110
11111         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11112                 val="$define"
11113         else
11114                 val="$undef"
11115         fi
11116         set d_pwchange
11117         eval $setvar
11118
11119         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11120                 val="$define"
11121         else
11122                 val="$undef"
11123         fi
11124         set d_pwclass
11125         eval $setvar
11126
11127         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11128                 val="$define"
11129         else
11130                 val="$undef"
11131         fi
11132         set d_pwexpire
11133         eval $setvar
11134
11135         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11136                 val="$define"
11137         else
11138                 val="$undef"
11139         fi
11140         set d_pwcomment
11141         eval $setvar
11142
11143         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11144                 val="$define"
11145         else
11146                 val="$undef"
11147         fi
11148         set d_pwgecos
11149         eval $setvar
11150
11151         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11152                 val="$define"
11153         else
11154                 val="$undef"
11155         fi
11156         set d_pwpasswd
11157         eval $setvar
11158
11159         $rm -f $$.h
11160         ;;
11161 *)
11162         val="$undef"; 
11163         set d_pwquota; eval $setvar
11164         set d_pwage; eval $setvar
11165         set d_pwchange; eval $setvar
11166         set d_pwclass; eval $setvar
11167         set d_pwexpire; eval $setvar
11168         set d_pwcomment; eval $setvar
11169         set d_pwgecos; eval $setvar
11170         set d_pwpasswd; eval $setvar
11171         ;;
11172 esac
11173
11174 : see if readdir and friends exist
11175 set readdir d_readdir
11176 eval $inlibc
11177 set seekdir d_seekdir
11178 eval $inlibc
11179 set telldir d_telldir
11180 eval $inlibc
11181 set rewinddir d_rewinddir
11182 eval $inlibc
11183
11184 : see if readlink exists
11185 set readlink d_readlink
11186 eval $inlibc
11187
11188 : see if readv exists
11189 set readv d_readv
11190 eval $inlibc
11191
11192 : see if realpath exists
11193 set realpath d_realpath
11194 eval $inlibc
11195
11196 : see if recvmsg exists
11197 set recvmsg d_recvmsg
11198 eval $inlibc
11199
11200 : see if rename exists
11201 set rename d_rename
11202 eval $inlibc
11203
11204 : see if rmdir exists
11205 set rmdir d_rmdir
11206 eval $inlibc
11207
11208 : see if memory.h is available.
11209 val=''
11210 set memory.h val
11211 eval $inhdr
11212
11213 : See if it conflicts with string.h
11214 case "$val" in
11215 $define)
11216         case "$strings" in
11217         '') ;;
11218         *)
11219                 $cppstdin $cppflags $cppminus < $strings > mem.h
11220                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11221                         echo " "
11222                         echo "We won't be including <memory.h>."
11223                         val="$undef"
11224                 fi
11225                 $rm -f mem.h
11226                 ;;
11227         esac
11228 esac
11229 set i_memory
11230 eval $setvar
11231
11232 : can bcopy handle overlapping blocks?
11233 val="$undef"
11234 case "$d_bcopy" in
11235 "$define")
11236         echo " "
11237         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11238         $cat >try.c <<EOCP
11239 #$i_memory I_MEMORY
11240 #$i_stdlib I_STDLIB
11241 #$i_string I_STRING
11242 #$i_unistd I_UNISTD
11243 EOCP
11244         $cat >>try.c <<'EOCP'
11245 #include <stdio.h>
11246 #ifdef I_MEMORY
11247 #  include <memory.h>
11248 #endif
11249 #ifdef I_STDLIB
11250 #  include <stdlib.h>
11251 #endif
11252 #ifdef I_STRING
11253 #  include <string.h>
11254 #else
11255 #  include <strings.h>
11256 #endif
11257 #ifdef I_UNISTD
11258 #  include <unistd.h>  /* Needed for NetBSD */
11259 #endif
11260 int main()
11261 {
11262 char buf[128], abc[128];
11263 char *b;
11264 int len;
11265 int off;
11266 int align;
11267
11268 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11269
11270 for (align = 7; align >= 0; align--) {
11271         for (len = 36; len; len--) {
11272                 b = buf+align;
11273                 bcopy(abc, b, len);
11274                 for (off = 1; off <= len; off++) {
11275                         bcopy(b, b+off, len);
11276                         bcopy(b+off, b, len);
11277                         if (bcmp(b, abc, len))
11278                                 exit(1);
11279                 }
11280         }
11281 }
11282 exit(0);
11283 }
11284 EOCP
11285         set try
11286         if eval $compile_ok; then
11287                 if ./try 2>/dev/null; then
11288                         echo "Yes, it can."
11289                         val="$define"
11290                 else
11291                         echo "It can't, sorry."
11292                         case "$d_memmove" in
11293                         "$define") echo "But that's Ok since you have memmove()." ;;
11294                         esac
11295                 fi
11296         else
11297                 echo "(I can't compile the test program, so we'll assume not...)"
11298                 case "$d_memmove" in
11299                 "$define") echo "But that's Ok since you have memmove()." ;;
11300                 esac
11301         fi
11302         ;;
11303 esac
11304 $rm -f try.* try core
11305 set d_safebcpy
11306 eval $setvar
11307
11308 : can memcpy handle overlapping blocks?
11309 val="$undef"
11310 case "$d_memcpy" in
11311 "$define")
11312         echo " "
11313         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11314         $cat >try.c <<EOCP
11315 #$i_memory I_MEMORY
11316 #$i_stdlib I_STDLIB
11317 #$i_string I_STRING
11318 #$i_unistd I_UNISTD
11319 EOCP
11320         $cat >>try.c <<'EOCP'
11321 #include <stdio.h>
11322 #ifdef I_MEMORY
11323 #  include <memory.h>
11324 #endif
11325 #ifdef I_STDLIB
11326 #  include <stdlib.h>
11327 #endif
11328 #ifdef I_STRING
11329 #  include <string.h>
11330 #else
11331 #  include <strings.h>
11332 #endif
11333 #ifdef I_UNISTD
11334 #  include <unistd.h>  /* Needed for NetBSD */
11335 #endif
11336 int main()
11337 {
11338 char buf[128], abc[128];
11339 char *b;
11340 int len;
11341 int off;
11342 int align;
11343
11344 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11345    try to store the string in read-only memory. */
11346 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11347
11348 for (align = 7; align >= 0; align--) {
11349         for (len = 36; len; len--) {
11350                 b = buf+align;
11351                 memcpy(b, abc, len);
11352                 for (off = 1; off <= len; off++) {
11353                         memcpy(b+off, b, len);
11354                         memcpy(b, b+off, len);
11355                         if (memcmp(b, abc, len))
11356                                 exit(1);
11357                 }
11358         }
11359 }
11360 exit(0);
11361 }
11362 EOCP
11363         set try
11364         if eval $compile_ok; then
11365                 if ./try 2>/dev/null; then
11366                         echo "Yes, it can."
11367                         val="$define"
11368                 else
11369                         echo "It can't, sorry."
11370                         case "$d_memmove" in
11371                         "$define") echo "But that's Ok since you have memmove()." ;;
11372                         esac
11373                 fi
11374         else
11375                 echo "(I can't compile the test program, so we'll assume not...)"
11376                 case "$d_memmove" in
11377                 "$define") echo "But that's Ok since you have memmove()." ;;
11378                 esac
11379         fi
11380         ;;
11381 esac
11382 $rm -f try.* try core
11383 set d_safemcpy
11384 eval $setvar
11385
11386 : can memcmp be trusted to compare relative magnitude?
11387 val="$undef"
11388 case "$d_memcmp" in
11389 "$define")
11390         echo " "
11391         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11392         $cat >try.c <<EOCP
11393 #$i_memory I_MEMORY
11394 #$i_stdlib I_STDLIB
11395 #$i_string I_STRING
11396 #$i_unistd I_UNISTD
11397 EOCP
11398         $cat >>try.c <<'EOCP'
11399 #include <stdio.h>
11400 #ifdef I_MEMORY
11401 #  include <memory.h>
11402 #endif
11403 #ifdef I_STDLIB
11404 #  include <stdlib.h>
11405 #endif
11406 #ifdef I_STRING
11407 #  include <string.h>
11408 #else
11409 #  include <strings.h>
11410 #endif
11411 #ifdef I_UNISTD
11412 #  include <unistd.h>  /* Needed for NetBSD */
11413 #endif
11414 int main()
11415 {
11416 char a = -1;
11417 char b = 0;
11418 if ((a < b) && memcmp(&a, &b, 1) < 0)
11419         exit(1);
11420 exit(0);
11421 }
11422 EOCP
11423         set try
11424         if eval $compile_ok; then
11425                 if ./try 2>/dev/null; then
11426                         echo "Yes, it can."
11427                         val="$define"
11428                 else
11429                         echo "No, it can't (it uses signed chars)."
11430                 fi
11431         else
11432                 echo "(I can't compile the test program, so we'll assume not...)"
11433         fi
11434         ;;
11435 esac
11436 $rm -f try.* try core
11437 set d_sanemcmp
11438 eval $setvar
11439
11440 : see if prototype for sbrk is available
11441 echo " "
11442 set d_sbrkproto sbrk $i_unistd unistd.h
11443 eval $hasproto
11444
11445 : see if select exists
11446 set select d_select
11447 eval $inlibc
11448
11449 : see if semctl exists
11450 set semctl d_semctl
11451 eval $inlibc
11452
11453 : see if semget exists
11454 set semget d_semget
11455 eval $inlibc
11456
11457 : see if semop exists
11458 set semop d_semop
11459 eval $inlibc
11460
11461 : see how much of the 'sem*(2)' library is present.
11462 h_sem=true
11463 echo " "
11464 case "$d_semctl$d_semget$d_semop" in
11465 *"$undef"*) h_sem=false;;
11466 esac
11467 case "$osname" in
11468 freebsd)
11469     case "`ipcs 2>&1`" in
11470     "SVID messages"*"not configured"*)
11471         echo "Your $osname does not have the sem*(2) configured." >&4
11472         h_sem=false
11473         val="$undef"
11474         set semctl d_semctl
11475         eval $setvar
11476         set semget d_semget
11477         eval $setvar
11478         set semop d_semop
11479         eval $setvar
11480         ;;
11481     esac
11482     ;;
11483 esac
11484 : we could also check for sys/ipc.h ...
11485 if $h_sem && $test `./findhdr sys/sem.h`; then
11486         echo "You have the full sem*(2) library." >&4
11487         val="$define"
11488 else
11489         echo "You don't have the full sem*(2) library." >&4
11490         val="$undef"
11491 fi
11492 set d_sem
11493 eval $setvar
11494
11495 : see whether sys/sem.h defines union semun
11496 echo " "
11497 $cat > try.c <<'END'
11498 #include <sys/types.h>
11499 #include <sys/ipc.h>
11500 #include <sys/sem.h>
11501 int main () { union semun semun; semun.buf = 0; }
11502 END
11503 set try
11504 if eval $compile; then
11505     echo "You have union semun in <sys/sem.h>." >&4
11506     val="$define"
11507 else
11508     echo "You do not have union semun in <sys/sem.h>." >&4
11509     val="$undef"
11510 fi
11511 $rm -f try try.c try.h
11512 set d_union_semun
11513 eval $setvar
11514
11515 : see how to do semctl IPC_STAT
11516 case "$d_sem" in
11517 $define)
11518     : see whether semctl IPC_STAT can use union semun
11519     echo " "
11520     $cat > try.h <<END
11521 #ifndef S_IRUSR
11522 #   ifdef S_IREAD
11523 #       define S_IRUSR S_IREAD
11524 #       define S_IWUSR S_IWRITE
11525 #       define S_IXUSR S_IEXEC
11526 #   else
11527 #       define S_IRUSR 0400
11528 #       define S_IWUSR 0200
11529 #       define S_IXUSR 0100
11530 #   endif
11531 #   define S_IRGRP (S_IRUSR>>3)
11532 #   define S_IWGRP (S_IWUSR>>3)
11533 #   define S_IXGRP (S_IXUSR>>3)
11534 #   define S_IROTH (S_IRUSR>>6)
11535 #   define S_IWOTH (S_IWUSR>>6)
11536 #   define S_IXOTH (S_IXUSR>>6)
11537 #endif
11538 #ifndef S_IRWXU
11539 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11540 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11541 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11542 #endif
11543 END
11544
11545     $cat > try.c <<END
11546 #include <sys/types.h>
11547 #include <sys/ipc.h>
11548 #include <sys/sem.h>
11549 #include <sys/stat.h>
11550 #include <stdio.h>
11551 #include <errno.h>
11552 #include "try.h"
11553 #ifndef errno
11554 extern int errno;
11555 #endif
11556 #$d_union_semun HAS_UNION_SEMUN
11557 int main() {
11558     union semun
11559 #ifndef HAS_UNION_SEMUN
11560     {
11561         int val;
11562         struct semid_ds *buf;
11563         unsigned short *array;
11564     }
11565 #endif
11566     arg;
11567     int sem, st;
11568
11569 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11570     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11571     if (sem > -1) {
11572         struct semid_ds argbuf;
11573         arg.buf = &argbuf;
11574 #       ifdef IPC_STAT
11575         st = semctl(sem, 0, IPC_STAT, arg);
11576         if (st == 0)
11577             printf("semun\n");
11578         else
11579 #       endif /* IPC_STAT */
11580             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11581 #       ifdef IPC_RMID
11582         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11583 #       endif /* IPC_RMID */
11584             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11585     } else
11586 #endif /* IPC_PRIVATE && ... */
11587         printf("semget failed: errno = %d\n", errno);
11588   return 0;
11589 }
11590 END
11591     val="$undef"
11592     set try
11593     if eval $compile; then
11594         xxx=`./try`
11595         case "$xxx" in
11596         semun) val="$define" ;;
11597         esac
11598     fi
11599     $rm -f try try.c
11600     set d_semctl_semun
11601     eval $setvar
11602     case "$d_semctl_semun" in
11603     $define)
11604         echo "You can use union semun for semctl IPC_STAT." >&4
11605         also='also'
11606         ;;
11607     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11608         also=''
11609         ;;
11610     esac
11611
11612     : see whether semctl IPC_STAT can use struct semid_ds pointer
11613     $cat > try.c <<'END'
11614 #include <sys/types.h>
11615 #include <sys/ipc.h>
11616 #include <sys/sem.h>
11617 #include <sys/stat.h>
11618 #include "try.h"
11619 #include <stdio.h>
11620 #include <errno.h>
11621 #ifndef errno
11622 extern int errno;
11623 #endif
11624 int main() {
11625     struct semid_ds arg;
11626     int sem, st;
11627
11628 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11629     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11630     if (sem > -1) {
11631 #       ifdef IPC_STAT
11632         st = semctl(sem, 0, IPC_STAT, &arg);
11633         if (st == 0)
11634             printf("semid_ds\n");
11635         else
11636 #       endif /* IPC_STAT */
11637             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11638 #       ifdef IPC_RMID
11639         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11640 #       endif /* IPC_RMID */
11641             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11642     } else
11643 #endif /* IPC_PRIVATE && ... */
11644         printf("semget failed: errno = %d\n", errno);
11645
11646     return 0;
11647 }
11648 END
11649     val="$undef"
11650     set try
11651     if eval $compile; then
11652         xxx=`./try`
11653         case "$xxx" in
11654         semid_ds) val="$define" ;;
11655         esac
11656     fi
11657     $rm -f try try.c
11658     set d_semctl_semid_ds
11659     eval $setvar
11660     case "$d_semctl_semid_ds" in
11661     $define)
11662         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11663         ;;
11664     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11665         ;;
11666     esac
11667     $rm -f try.h
11668     ;;
11669 *)  val="$undef"
11670
11671     # We do not have the full sem*(2) library, so assume we can not
11672     # use either.
11673
11674     set d_semctl_semun
11675     eval $setvar
11676
11677     set d_semctl_semid_ds
11678     eval $setvar
11679     ;;
11680 esac
11681
11682 : see if sendmsg exists
11683 set sendmsg d_sendmsg
11684 eval $inlibc
11685
11686 : see if setegid exists
11687 set setegid d_setegid
11688 eval $inlibc
11689
11690 : see if seteuid exists
11691 set seteuid d_seteuid
11692 eval $inlibc
11693
11694 : see if setgrent exists
11695 set setgrent d_setgrent
11696 eval $inlibc
11697
11698 : see if sethostent exists
11699 set sethostent d_sethent
11700 eval $inlibc
11701
11702 : see if setitimer exists
11703 set setitimer d_setitimer
11704 eval $inlibc
11705
11706 : see if setlinebuf exists
11707 set setlinebuf d_setlinebuf
11708 eval $inlibc
11709
11710 : see if setlocale exists
11711 set setlocale d_setlocale
11712 eval $inlibc
11713
11714 : see if setnetent exists
11715 set setnetent d_setnent
11716 eval $inlibc
11717
11718 : see if setprotoent exists
11719 set setprotoent d_setpent
11720 eval $inlibc
11721
11722 : see if setpgid exists
11723 set setpgid d_setpgid
11724 eval $inlibc
11725
11726 : see if setpgrp2 exists
11727 set setpgrp2 d_setpgrp2
11728 eval $inlibc
11729
11730 : see if setpriority exists
11731 set setpriority d_setprior
11732 eval $inlibc
11733
11734 : see if setproctitle exists
11735 set setproctitle d_setproctitle
11736 eval $inlibc
11737
11738 : see if setpwent exists
11739 set setpwent d_setpwent
11740 eval $inlibc
11741
11742 : see if setregid exists
11743 set setregid d_setregid
11744 eval $inlibc
11745 set setresgid d_setresgid
11746 eval $inlibc
11747
11748 : see if setreuid exists
11749 set setreuid d_setreuid
11750 eval $inlibc
11751 set setresuid d_setresuid
11752 eval $inlibc
11753
11754 : see if setrgid exists
11755 set setrgid d_setrgid
11756 eval $inlibc
11757
11758 : see if setruid exists
11759 set setruid d_setruid
11760 eval $inlibc
11761
11762 : see if setservent exists
11763 set setservent d_setsent
11764 eval $inlibc
11765
11766 : see if setsid exists
11767 set setsid d_setsid
11768 eval $inlibc
11769
11770 : see if setvbuf exists
11771 set setvbuf d_setvbuf
11772 eval $inlibc
11773
11774 : see if sfio.h is available
11775 set sfio.h i_sfio
11776 eval $inhdr
11777
11778
11779 : see if sfio library is available
11780 case "$i_sfio" in
11781 $define)
11782         val=''
11783         set sfreserve val
11784         eval $inlibc
11785         ;;
11786 *)
11787         val="$undef"
11788         ;;
11789 esac
11790 : Ok, but do we want to use it.
11791 case "$val" in
11792 $define)
11793         case "$usesfio" in
11794         true|$define|[yY]*) dflt='y';;
11795         *) dflt='n';;
11796         esac
11797         echo "$package can use the sfio library, but it is experimental."
11798         case "$useperlio" in
11799         "$undef")
11800             echo "For sfio also the PerlIO abstraction layer is needed."
11801             echo "Earlier you said you wouldn't want that."
11802             ;;
11803         esac
11804         rp="You seem to have sfio available, do you want to try using it?"
11805         . ./myread
11806         case "$ans" in
11807         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11808                 useperlio="$define"
11809                 val="$define"
11810                 ;;
11811         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11812                 val="$undef"
11813                 ;;
11814         esac
11815         ;;
11816 *)      case "$usesfio" in
11817         true|$define|[yY]*)
11818                 echo "Sorry, cannot find sfio on this machine." >&4
11819                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11820                 val="$undef"
11821                 ;;
11822         esac
11823         ;;
11824 esac
11825 set d_sfio
11826 eval $setvar
11827 case "$d_sfio" in
11828 $define) usesfio='true';;
11829 *) usesfio='false';;
11830 esac
11831 case "$d_sfio" in
11832 $define) ;;
11833 *)      : Remove sfio from list of libraries to use
11834         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11835         shift
11836         libs="$*"
11837         echo "libs = $libs" >&4
11838 ;;
11839 esac
11840
11841
11842 : see if shmctl exists
11843 set shmctl d_shmctl
11844 eval $inlibc
11845
11846 : see if shmget exists
11847 set shmget d_shmget
11848 eval $inlibc
11849
11850 : see if shmat exists
11851 set shmat d_shmat
11852 eval $inlibc
11853 : see what shmat returns
11854 case "$d_shmat" in
11855 "$define")
11856         $cat >shmat.c <<'END'
11857 #include <sys/shm.h>
11858 void *shmat();
11859 END
11860         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11861                 shmattype='void *'
11862         else
11863                 shmattype='char *'
11864         fi
11865         echo "and it returns ($shmattype)." >&4
11866         : see if a prototype for shmat is available
11867         xxx=`./findhdr sys/shm.h`
11868         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11869         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11870                 val="$define"
11871         else
11872                 val="$undef"
11873         fi
11874         $rm -f shmat.[co]
11875         ;;
11876 *)
11877         val="$undef"
11878         ;;
11879 esac
11880 set d_shmatprototype
11881 eval $setvar
11882
11883 : see if shmdt exists
11884 set shmdt d_shmdt
11885 eval $inlibc
11886
11887 : see how much of the 'shm*(2)' library is present.
11888 h_shm=true
11889 echo " "
11890 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11891 *"$undef"*) h_shm=false;;
11892 esac
11893 case "$osname" in
11894 freebsd)
11895     case "`ipcs 2>&1`" in
11896     "SVID shared memory"*"not configured"*)
11897         echo "Your $osname does not have the shm*(2) configured." >&4
11898         h_shm=false
11899         val="$undef"
11900         set shmctl d_shmctl
11901         evat $setvar
11902         set shmget d_shmget
11903         evat $setvar
11904         set shmat d_shmat
11905         evat $setvar
11906         set shmdt d_shmdt
11907         evat $setvar
11908         ;;
11909     esac
11910     ;;
11911 esac
11912 : we could also check for sys/ipc.h ...
11913 if $h_shm && $test `./findhdr sys/shm.h`; then
11914         echo "You have the full shm*(2) library." >&4
11915         val="$define"
11916 else
11917         echo "You don't have the full shm*(2) library." >&4
11918         val="$undef"
11919 fi
11920 set d_shm
11921 eval $setvar
11922
11923 echo " "
11924 : see if we have sigaction
11925 if set sigaction val -f d_sigaction; eval $csym; $val; then
11926         echo 'sigaction() found.' >&4
11927         $cat > try.c <<'EOP'
11928 #include <stdio.h>
11929 #include <sys/types.h>
11930 #include <signal.h>
11931 int main()
11932 {
11933     struct sigaction act, oact;
11934     act.sa_flags = 0;
11935     oact.sa_handler = 0;
11936     /* so that act and oact are used */
11937     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11938 }
11939 EOP
11940         set try
11941         if eval $compile_ok; then
11942                 val="$define"
11943         else
11944                 echo "But you don't seem to have a useable struct sigaction." >&4
11945                 val="$undef"
11946         fi
11947 else
11948         echo 'sigaction NOT found.' >&4
11949         val="$undef"
11950 fi
11951 set d_sigaction; eval $setvar
11952 $rm -f try try$_o try.c
11953
11954 : see if sigprocmask exists
11955 set sigprocmask d_sigprocmask
11956 eval $inlibc
11957
11958 : see if sigsetjmp exists
11959 echo " "
11960 case "$d_sigsetjmp" in
11961 '')
11962         $cat >try.c <<'EOP'
11963 #include <setjmp.h>
11964 sigjmp_buf env;
11965 int set = 1;
11966 int main()
11967 {
11968         if (sigsetjmp(env,1))
11969                 exit(set);
11970         set = 0;
11971         siglongjmp(env, 1);
11972         exit(1);
11973 }
11974 EOP
11975         set try
11976         if eval $compile; then
11977                 if ./try >/dev/null 2>&1; then
11978                         echo "POSIX sigsetjmp found." >&4
11979                         val="$define"
11980                 else
11981                         $cat >&4 <<EOM
11982 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11983 I'll ignore them.
11984 EOM
11985                         val="$undef"
11986                 fi
11987         else
11988                 echo "sigsetjmp not found." >&4
11989                 val="$undef"
11990         fi
11991         ;;
11992 *) val="$d_sigsetjmp"
11993         case "$d_sigsetjmp" in
11994         $define) echo "POSIX sigsetjmp found." >&4;;
11995         $undef) echo "sigsetjmp not found." >&4;;
11996         esac
11997         ;;
11998 esac
11999 set d_sigsetjmp
12000 eval $setvar
12001 $rm -f try.c try
12002
12003 : see if sockatmark exists
12004 set sockatmark d_sockatmark
12005 eval $inlibc
12006
12007 : see if prototype for sockatmark is available
12008 echo " "
12009 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12010 eval $hasproto
12011
12012 : see if socks5_init exists
12013 set socks5_init d_socks5_init
12014 eval $inlibc
12015
12016 : see if prototype for setresgid is available
12017 echo " "
12018 set d_sresgproto setresgid $i_unistd unistd.h
12019 eval $hasproto
12020
12021 : see if prototype for setresuid is available
12022 echo " "
12023 set d_sresuproto setresuid $i_unistd unistd.h
12024 eval $hasproto
12025
12026 : see if sys/stat.h is available
12027 set sys/stat.h i_sysstat
12028 eval $inhdr
12029
12030
12031 : see if stat knows about block sizes
12032 echo " "
12033 echo "Checking to see if your struct stat has st_blocks field..." >&4
12034 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12035 eval $hasfield
12036
12037
12038 : see if this is a sys/vfs.h system
12039 set sys/vfs.h i_sysvfs
12040 eval $inhdr
12041
12042
12043 : see if this is a sys/statfs.h system
12044 set sys/statfs.h i_sysstatfs
12045 eval $inhdr
12046
12047
12048 echo " "
12049 echo "Checking to see if your system supports struct statfs..." >&4
12050 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
12051 eval $hasstruct
12052 case "$d_statfs_s" in
12053 "$define")      echo "Yes, it does."   ;;
12054 *)              echo "No, it doesn't." ;;
12055 esac
12056
12057
12058
12059 : see if struct statfs knows about f_flags
12060 case "$d_statfs_s" in
12061 define) 
12062         echo " "
12063         echo "Checking to see if your struct statfs has f_flags field..." >&4
12064         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
12065         eval $hasfield
12066         ;;
12067 *)      val="$undef"
12068         set d_statfs_f_flags
12069         eval $setvar
12070         ;;
12071 esac
12072 case "$d_statfs_f_flags" in
12073 "$define")      echo "Yes, it does."   ;;
12074 *)              echo "No, it doesn't." ;;
12075 esac
12076
12077 : see if _ptr and _cnt from stdio act std
12078 echo " "
12079
12080 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12081         echo "(Looks like you have stdio.h from BSD.)"
12082         case "$stdio_ptr" in
12083         '') stdio_ptr='((fp)->_p)'
12084                 ptr_lval=$define
12085                 ;;
12086         *)      ptr_lval=$d_stdio_ptr_lval;;
12087         esac
12088         case "$stdio_cnt" in
12089         '') stdio_cnt='((fp)->_r)'
12090                 cnt_lval=$define
12091                 ;;
12092         *)      cnt_lval=$d_stdio_cnt_lval;;
12093         esac
12094         case "$stdio_base" in
12095         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12096         esac
12097         case "$stdio_bufsiz" in
12098         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12099         esac
12100 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12101         echo "(Looks like you have stdio.h from Linux.)"
12102         case "$stdio_ptr" in
12103         '') stdio_ptr='((fp)->_IO_read_ptr)'
12104                 ptr_lval=$define
12105                 ;;
12106         *)      ptr_lval=$d_stdio_ptr_lval;;
12107         esac
12108         case "$stdio_cnt" in
12109         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12110                 cnt_lval=$undef
12111                 ;;
12112         *)      cnt_lval=$d_stdio_cnt_lval;;
12113         esac
12114         case "$stdio_base" in
12115         '') stdio_base='((fp)->_IO_read_base)';;
12116         esac
12117         case "$stdio_bufsiz" in
12118         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12119         esac
12120 else
12121         case "$stdio_ptr" in
12122         '') stdio_ptr='((fp)->_ptr)'
12123                 ptr_lval=$define
12124                 ;;
12125         *)      ptr_lval=$d_stdio_ptr_lval;;
12126         esac
12127         case "$stdio_cnt" in
12128         '') stdio_cnt='((fp)->_cnt)'
12129                 cnt_lval=$define
12130                 ;;
12131         *)      cnt_lval=$d_stdio_cnt_lval;;
12132         esac
12133         case "$stdio_base" in
12134         '') stdio_base='((fp)->_base)';;
12135         esac
12136         case "$stdio_bufsiz" in
12137         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12138         esac
12139 fi
12140
12141 : test whether _ptr and _cnt really work
12142 echo "Checking how std your stdio is..." >&4
12143 $cat >try.c <<EOP
12144 #include <stdio.h>
12145 #define FILE_ptr(fp)    $stdio_ptr
12146 #define FILE_cnt(fp)    $stdio_cnt
12147 int main() {
12148         FILE *fp = fopen("try.c", "r");
12149         char c = getc(fp);
12150         if (
12151                 18 <= FILE_cnt(fp) &&
12152                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12153         )
12154                 exit(0);
12155         exit(1);
12156 }
12157 EOP
12158 val="$undef"
12159 set try
12160 if eval $compile; then
12161         if ./try; then
12162                 echo "Your stdio acts pretty std."
12163                 val="$define"
12164         else
12165                 echo "Your stdio isn't very std."
12166         fi
12167 else
12168         echo "Your stdio doesn't appear very std."
12169 fi
12170 $rm -f try.c try
12171 set d_stdstdio
12172 eval $setvar
12173
12174 : Can _ptr be used as an lvalue?
12175 case "$d_stdstdio$ptr_lval" in
12176 $define$define) val=$define ;;
12177 *) val=$undef ;;
12178 esac
12179 set d_stdio_ptr_lval
12180 eval $setvar
12181
12182 : Can _cnt be used as an lvalue?
12183 case "$d_stdstdio$cnt_lval" in
12184 $define$define) val=$define ;;
12185 *) val=$undef ;;
12186 esac
12187 set d_stdio_cnt_lval
12188 eval $setvar
12189
12190
12191 : test whether setting _ptr sets _cnt as a side effect
12192 d_stdio_ptr_lval_sets_cnt="$undef"
12193 d_stdio_ptr_lval_nochange_cnt="$undef"
12194 case "$d_stdio_ptr_lval$d_stdstdio" in
12195 $define$define)
12196         echo "Checking to see what happens if we set the stdio ptr..." >&4
12197 $cat >try.c <<EOP
12198 #include <stdio.h>
12199 /* Can we scream? */
12200 /* Eat dust sed :-) */
12201 /* In the buffer space, no one can hear you scream. */
12202 #define FILE_ptr(fp)    $stdio_ptr
12203 #define FILE_cnt(fp)    $stdio_cnt
12204 #include <sys/types.h>
12205 int main() {
12206         FILE *fp = fopen("try.c", "r");
12207         int c;
12208         char *ptr;
12209         size_t cnt;
12210         if (!fp) {
12211             puts("Fail even to read");
12212             exit(1);
12213         }
12214         c = getc(fp); /* Read away the first # */
12215         if (c == EOF) {
12216             puts("Fail even to read");
12217             exit(1);
12218         }
12219         if (!(
12220                 18 <= FILE_cnt(fp) &&
12221                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12222         )) {
12223                 puts("Fail even to read");
12224                 exit (1);
12225         }
12226         ptr = (char*) FILE_ptr(fp);
12227         cnt = (size_t)FILE_cnt(fp);
12228
12229         FILE_ptr(fp) += 42;
12230
12231         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12232                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12233                 exit (1);
12234         }
12235         if (FILE_cnt(fp) <= 20) {
12236                 printf ("Fail (<20 chars to test)");
12237                 exit (1);
12238         }
12239         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12240                 puts("Fail compare");
12241                 exit (1);
12242         }
12243         if (cnt == FILE_cnt(fp)) {
12244                 puts("Pass_unchanged");
12245                 exit (0);
12246         }       
12247         if (FILE_cnt(fp) == (cnt - 42)) {
12248                 puts("Pass_changed");
12249                 exit (0);
12250         }
12251         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12252         return 1;
12253
12254 }
12255 EOP
12256         set try
12257         if eval $compile; then
12258                 case `./try$exe_ext` in
12259                 Pass_changed)
12260                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12261                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12262                 Pass_unchanged)
12263                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12264                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12265                 Fail*)
12266                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12267                 *)
12268                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12269         esac
12270         else
12271                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12272         fi
12273         $rm -f try.c try
12274         ;;
12275 esac
12276
12277 : see if _base is also standard
12278 val="$undef"
12279 case "$d_stdstdio" in
12280 $define)
12281         $cat >try.c <<EOP
12282 #include <stdio.h>
12283 #define FILE_base(fp)   $stdio_base
12284 #define FILE_bufsiz(fp) $stdio_bufsiz
12285 int main() {
12286         FILE *fp = fopen("try.c", "r");
12287         char c = getc(fp);
12288         if (
12289                 19 <= FILE_bufsiz(fp) &&
12290                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12291         )
12292                 exit(0);
12293         exit(1);
12294 }
12295 EOP
12296         set try
12297         if eval $compile; then
12298                 if ./try; then
12299                         echo "And its _base field acts std."
12300                         val="$define"
12301                 else
12302                         echo "But its _base field isn't std."
12303                 fi
12304         else
12305                 echo "However, it seems to be lacking the _base field."
12306         fi
12307         $rm -f try.c try
12308         ;;
12309 esac
12310 set d_stdiobase
12311 eval $setvar
12312
12313 $cat >&4 <<EOM
12314 Checking how to access stdio streams by file descriptor number...
12315 EOM
12316 case "$stdio_stream_array" in
12317 '')     $cat >try.c <<EOCP
12318 #include <stdio.h>
12319 int main() {
12320   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12321     printf("yes\n");
12322 }
12323 EOCP
12324         for s in _iob __iob __sF
12325         do
12326                 set try -DSTDIO_STREAM_ARRAY=$s
12327                 if eval $compile; then
12328                         case "`./try$exe_ext`" in
12329                         yes)    stdio_stream_array=$s; break ;;
12330                         esac
12331                 fi
12332         done
12333         $rm -f try.* try$exe_ext
12334 esac
12335 case "$stdio_stream_array" in
12336 '')     $cat >&4 <<EOM
12337 I can't figure out how to access stdio streams by file descriptor number.
12338 EOM
12339         d_stdio_stream_array="$undef"
12340         ;;
12341 *)      $cat >&4 <<EOM
12342 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12343 EOM
12344         d_stdio_stream_array="$define"
12345         ;;
12346 esac
12347
12348 : see if strcoll exists
12349 set strcoll d_strcoll
12350 eval $inlibc
12351
12352 : check for structure copying
12353 echo " "
12354 echo "Checking to see if your C compiler can copy structs..." >&4
12355 $cat >try.c <<'EOCP'
12356 int main()
12357 {
12358         struct blurfl {
12359                 int dyick;
12360         } foo, bar;
12361
12362         foo = bar;
12363 }
12364 EOCP
12365 if $cc -c try.c >/dev/null 2>&1 ; then
12366         val="$define"
12367         echo "Yup, it can."
12368 else
12369         val="$undef"
12370         echo "Nope, it can't."
12371 fi
12372 set d_strctcpy
12373 eval $setvar
12374 $rm -f try.*
12375
12376 : see if strerror and/or sys_errlist[] exist
12377 echo " "
12378 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12379     if set strerror val -f d_strerror; eval $csym; $val; then
12380                 echo 'strerror() found.' >&4
12381                 d_strerror="$define"
12382                 d_strerrm='strerror(e)'
12383                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12384                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12385                         d_syserrlst="$define"
12386                 else
12387                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12388                         d_syserrlst="$undef"
12389                 fi
12390     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12391                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12392                 echo 'strerror() found in string header.' >&4
12393                 d_strerror="$define"
12394                 d_strerrm='strerror(e)'
12395                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12396                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12397                                 d_syserrlst="$define"
12398                 else
12399                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12400                         d_syserrlst="$undef"
12401                 fi
12402     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12403                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12404                 d_strerror="$undef"
12405                 d_syserrlst="$define"
12406                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12407     else
12408                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12409                 d_strerror="$undef"
12410                 d_syserrlst="$undef"
12411                 d_strerrm='"unknown"'
12412     fi
12413 fi
12414
12415 : see if strftime exists
12416 set strftime d_strftime
12417 eval $inlibc
12418
12419 : see if strtod exists
12420 set strtod d_strtod
12421 eval $inlibc
12422
12423 : see if strtol exists
12424 set strtol d_strtol
12425 eval $inlibc
12426
12427 : see if strtold exists
12428 set strtold d_strtold
12429 eval $inlibc
12430
12431 : see if strtoll exists
12432 set strtoll d_strtoll
12433 eval $inlibc
12434
12435 case "$d_longlong-$d_strtoll" in
12436 "$define-$define")
12437         $cat <<EOM
12438 Checking whether your strtoll() works okay...
12439 EOM
12440         $cat >try.c <<'EOCP'
12441 #include <errno.h>
12442 #ifdef __hpux
12443 #define strtoll __strtoll
12444 #endif
12445 #ifdef __EMX__
12446 #define strtoll _strtoll
12447 #endif
12448 #include <stdio.h>
12449 extern long long int strtoll(char *s, char **, int); 
12450 static int bad = 0;
12451 int check(char *s, long long ell, int een) {
12452         long long gll;
12453         errno = 0;
12454         gll = strtoll(s, 0, 10);
12455         if (!((gll == ell) && (errno == een)))
12456                 bad++;
12457 }
12458 int main() {
12459         check(" 1",                                      1LL, 0);
12460         check(" 0",                                      0LL, 0);
12461         check("-1",                                     -1LL, 0);
12462         check("-9223372036854775808", -9223372036854775808LL, 0);
12463         check("-9223372036854775808", -9223372036854775808LL, 0);
12464         check(" 9223372036854775807",  9223372036854775807LL, 0);
12465         check("-9223372036854775808", -9223372036854775808LL, 0);
12466         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12467         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12468         if (!bad)
12469                 printf("ok\n");
12470 }
12471 EOCP
12472         set try
12473         if eval $compile; then
12474                 yyy=`./try`
12475                 case "$yyy" in
12476                 ok) echo "Your strtoll() seems to be working okay." ;;
12477                 *) cat <<EOM >&4
12478 Your strtoll() doesn't seem to be working okay.
12479 EOM
12480                    d_strtoll="$undef"
12481                    ;;
12482                 esac
12483         else
12484                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12485                 d_strtoll="$undef"
12486         fi
12487         ;;
12488 esac
12489
12490 : see if strtoq exists
12491 set strtoq d_strtoq
12492 eval $inlibc
12493
12494 : see if strtoul exists
12495 set strtoul d_strtoul
12496 eval $inlibc
12497
12498 case "$d_strtoul" in
12499 "$define")
12500         $cat <<EOM
12501 Checking whether your strtoul() works okay...
12502 EOM
12503         $cat >try.c <<'EOCP'
12504 #include <errno.h>
12505 #include <stdio.h>
12506 extern unsigned long int strtoul(char *s, char **, int); 
12507 static int bad = 0;
12508 void check(char *s, unsigned long eul, int een) {
12509         unsigned long gul;
12510         errno = 0;
12511         gul = strtoul(s, 0, 10);
12512         if (!((gul == eul) && (errno == een)))
12513                 bad++;
12514 }
12515 int main() {
12516         check(" 1", 1L, 0);
12517         check(" 0", 0L, 0);
12518 EOCP
12519         case "$longsize" in
12520         8)
12521             $cat >>try.c <<'EOCP'
12522         check("18446744073709551615", 18446744073709551615UL, 0);
12523         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12524 #if 0 /* strtoul() for /^-/ strings is undefined. */
12525         check("-1", 18446744073709551615UL, 0);
12526         check("-18446744073709551614", 2, 0);
12527         check("-18446744073709551615", 1, 0);
12528         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12529         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12530 #endif
12531 EOCP
12532                 ;;
12533         4)
12534                     $cat >>try.c <<'EOCP'
12535         check("4294967295", 4294967295UL, 0);
12536         check("4294967296", 4294967295UL, ERANGE);
12537 #if 0 /* strtoul() for /^-/ strings is undefined. */
12538         check("-1", 4294967295UL, 0);
12539         check("-4294967294", 2, 0);
12540         check("-4294967295", 1, 0);
12541         check("-4294967296", 4294967295UL, ERANGE);
12542         check("-4294967297", 4294967295UL, ERANGE);
12543 #endif
12544 EOCP
12545                 ;;
12546         *)
12547 : Should we write these tests to be more portable by sprintf-ing
12548 : ~0 and then manipulating that char string as input for strtol?
12549                 ;;
12550         esac
12551         $cat >>try.c <<'EOCP'
12552         if (!bad)
12553                 printf("ok\n");
12554         return 0;
12555 }
12556 EOCP
12557         set try
12558         if eval $compile; then
12559                 case "`./try`" in
12560                 ok) echo "Your strtoul() seems to be working okay." ;;
12561                 *) cat <<EOM >&4
12562 Your strtoul() doesn't seem to be working okay.
12563 EOM
12564                    d_strtoul="$undef"
12565                    ;;
12566                 esac
12567         fi
12568         ;;
12569 esac
12570
12571 : see if strtoull exists
12572 set strtoull d_strtoull
12573 eval $inlibc
12574
12575 case "$d_longlong-$d_strtoull" in
12576 "$define-$define")
12577         $cat <<EOM
12578 Checking whether your strtoull() works okay...
12579 EOM
12580         $cat >try.c <<'EOCP'
12581 #include <errno.h>
12582 #ifdef __hpux
12583 #define strtoull __strtoull
12584 #endif
12585 #include <stdio.h>
12586 extern unsigned long long int strtoull(char *s, char **, int); 
12587 static int bad = 0;
12588 int check(char *s, long long eull, int een) {
12589         long long gull;
12590         errno = 0;
12591         gull = strtoull(s, 0, 10);
12592         if (!((gull == eull) && (errno == een)))
12593                 bad++;
12594 }
12595 int main() {
12596         check(" 1",                                        1LL, 0);
12597         check(" 0",                                        0LL, 0);
12598         check("18446744073709551615",  18446744073709551615ULL, 0);
12599         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12600 #if 0 /* strtoull() for /^-/ strings is undefined. */
12601         check("-1",                    18446744073709551615ULL, 0);
12602         check("-18446744073709551614",                     2LL, 0);
12603         check("-18446744073709551615",                     1LL, 0);
12604         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12605         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12606 #endif
12607         if (!bad)
12608                 printf("ok\n");
12609 }
12610 EOCP
12611         set try
12612         if eval $compile; then
12613                 case "`./try`" in
12614                 ok) echo "Your strtoull() seems to be working okay." ;;
12615                 *) cat <<EOM >&4
12616 Your strtoull() doesn't seem to be working okay.
12617 EOM
12618                    d_strtoull="$undef"
12619                    ;;
12620                 esac
12621         fi
12622         ;;
12623 esac
12624
12625 : see if strtouq exists
12626 set strtouq d_strtouq
12627 eval $inlibc
12628
12629 case "$d_strtouq" in
12630 "$define")
12631         $cat <<EOM
12632 Checking whether your strtouq() works okay...
12633 EOM
12634         $cat >try.c <<'EOCP'
12635 #include <errno.h>
12636 #include <stdio.h>
12637 extern unsigned long long int strtouq(char *s, char **, int); 
12638 static int bad = 0;
12639 void check(char *s, unsigned long long eull, int een) {
12640         unsigned long long gull;
12641         errno = 0;
12642         gull = strtouq(s, 0, 10);
12643         if (!((gull == eull) && (errno == een)))
12644                 bad++;
12645 }
12646 int main() {
12647         check(" 1",                                        1LL, 0);
12648         check(" 0",                                        0LL, 0);
12649         check("18446744073709551615",  18446744073709551615ULL, 0);
12650         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12651 #if 0 /* strtouq() for /^-/ strings is undefined. */
12652         check("-1",                    18446744073709551615ULL, 0);
12653         check("-18446744073709551614",                     2LL, 0);
12654         check("-18446744073709551615",                     1LL, 0);
12655         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12656         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12657 #endif
12658         if (!bad)
12659                 printf("ok\n");
12660         return 0;
12661 }
12662 EOCP
12663         set try
12664         if eval $compile; then
12665                 case "`./try`" in
12666                 ok) echo "Your strtouq() seems to be working okay." ;;
12667                 *) cat <<EOM >&4
12668 Your strtouq() doesn't seem to be working okay.
12669 EOM
12670                    d_strtouq="$undef"
12671                    ;;
12672                 esac
12673         fi
12674         ;;
12675 esac
12676
12677 : see if strxfrm exists
12678 set strxfrm d_strxfrm
12679 eval $inlibc
12680
12681 : see if symlink exists
12682 set symlink d_symlink
12683 eval $inlibc
12684
12685 : see if syscall exists
12686 set syscall d_syscall
12687 eval $inlibc
12688
12689 : see if prototype for syscall is available
12690 echo " "
12691 set d_syscallproto syscall $i_unistd unistd.h
12692 eval $hasproto
12693
12694 : see if sysconf exists
12695 set sysconf d_sysconf
12696 eval $inlibc
12697
12698 : see if system exists
12699 set system d_system
12700 eval $inlibc
12701
12702 : see if tcgetpgrp exists
12703 set tcgetpgrp d_tcgetpgrp
12704 eval $inlibc
12705
12706 : see if tcsetpgrp exists
12707 set tcsetpgrp d_tcsetpgrp
12708 eval $inlibc
12709
12710 : see if prototype for telldir is available
12711 echo " "
12712 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12713 eval $hasproto
12714
12715 : see if this is a sys/times.h system
12716 set sys/times.h i_systimes
12717 eval $inhdr
12718
12719 : see if times exists
12720 echo " "
12721 if set times val -f d_times; eval $csym; $val; then
12722         echo 'times() found.' >&4
12723         d_times="$define"
12724         inc=''
12725         case "$i_systimes" in
12726         "$define") inc='sys/times.h';;
12727         esac
12728         rp="What is the type returned by times() on this system?"
12729         set clock_t clocktype long stdio.h sys/types.h $inc
12730         eval $typedef_ask
12731 else
12732         echo 'times() NOT found, hope that will do.' >&4
12733         d_times="$undef"
12734         clocktype='int'
12735 fi
12736
12737 : see if truncate exists
12738 set truncate d_truncate
12739 eval $inlibc
12740
12741 : see if tzname[] exists
12742 echo " "
12743 if set tzname val -a d_tzname; eval $csym; $val; then
12744         val="$define"
12745         echo 'tzname[] found.' >&4
12746 else
12747         val="$undef"
12748         echo 'tzname[] NOT found.' >&4
12749 fi
12750 set d_tzname
12751 eval $setvar
12752
12753 case "$crosscompile" in
12754 ''|[nN]*) crosscompile="$undef" ;;
12755 esac
12756
12757 case "$osname" in
12758 next|rhapsody|darwin) multiarch="$define" ;;
12759 esac
12760 case "$multiarch" in
12761 ''|[nN]*) multiarch="$undef" ;;
12762 esac
12763
12764 : check for ordering of bytes in a long
12765 echo " "
12766 case "$crosscompile$multiarch" in
12767 *$define*)
12768         $cat <<EOM
12769 You seem to be either cross-compiling or doing a multiarchitecture build,
12770 skipping the byteorder check.
12771
12772 EOM
12773         byteorder='0xffff'
12774         ;;
12775 *)
12776         case "$byteorder" in
12777         '')
12778                 $cat <<'EOM'
12779 In the following, larger digits indicate more significance.  A big-endian
12780 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12781 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12782 machines may have weird orders like 3412.  A Cray will report 87654321,
12783 an Alpha will report 12345678. If the test program works the default is
12784 probably right.
12785 I'm now running the test program...
12786 EOM
12787                 $cat >try.c <<'EOCP'
12788 #include <stdio.h>
12789 int main()
12790 {
12791         int i;
12792         union {
12793                 unsigned long l;
12794                 char c[sizeof(long)];
12795         } u;
12796
12797         if (sizeof(long) > 4)
12798                 u.l = (0x08070605L << 32) | 0x04030201L;
12799         else
12800                 u.l = 0x04030201L;
12801         for (i = 0; i < sizeof(long); i++)
12802                 printf("%c", u.c[i]+'0');
12803         printf("\n");
12804         exit(0);
12805 }
12806 EOCP
12807                 xxx_prompt=y
12808                 set try
12809                 if eval $compile && ./try > /dev/null; then
12810                         dflt=`./try`
12811                         case "$dflt" in
12812                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12813                                 echo "(The test program ran ok.)"
12814                                 echo "byteorder=$dflt"
12815                                 xxx_prompt=n
12816                         ;;
12817                         ????|????????) echo "(The test program ran ok.)" ;;
12818                         *) echo "(The test program didn't run right for some reason.)" ;;
12819                         esac
12820                 else
12821                         dflt='4321'
12822                         cat <<'EOM'
12823 (I can't seem to compile the test program.  Guessing big-endian...)
12824 EOM
12825                 fi
12826                 case "$xxx_prompt" in
12827                 y)
12828                         rp="What is the order of bytes in a long?"
12829                         . ./myread
12830                         byteorder="$ans"
12831                         ;;
12832                 *)      byteorder=$dflt
12833                         ;;
12834                 esac
12835                 ;;
12836         esac
12837         $rm -f try.c try
12838         ;;
12839 esac
12840
12841
12842 $cat <<EOM
12843
12844 Checking to see whether you can access character data unalignedly...
12845 EOM
12846 $cat >try.c <<EOCP
12847 #include <stdio.h>
12848 #define U32 $u32type
12849 #define BYTEORDER $byteorder
12850 int main() {
12851 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12852     U8 buf[] = "\0\0\0\1\0\0\0\0";
12853     U32 *up;
12854     int i;
12855
12856     if (sizeof(U32) != 4) {
12857         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12858         exit(1);
12859     }
12860
12861     fflush(stdout);
12862
12863     for (i = 0; i < 4; i++) {
12864         up = (U32*)(buf + i);
12865         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12866                (*up == 1 << (8*(3-i)))  /* little-endian */
12867               )
12868            )
12869         {
12870             printf("read failed (%x)\n", *up);
12871             exit(2);
12872         }
12873     }
12874
12875     /* write test */
12876     for (i = 0; i < 4; i++) {
12877         up = (U32*)(buf + i);
12878         *up = 0xBeef;
12879         if (*up != 0xBeef) {
12880             printf("write failed (%x)\n", *up);
12881             exit(3);
12882         }
12883     }
12884
12885     exit(0);
12886 #else
12887     printf("1\n");
12888     exit(1);
12889 #endif
12890     return 0;
12891 }
12892 EOCP
12893 set try
12894 if eval $compile_ok; then
12895         echo "(Testign for character data alignment may dump core.)" >&4
12896         ./try 2>&1 >/dev/null
12897         case "$?" in
12898         0)      cat >&4 <<EOM
12899 You can access character data pretty unalignedly.
12900 EOM
12901                 d_u32align="$undef"
12902                 ;;
12903         *)      cat >&4 <<EOM
12904 It seems that you must access character data in an aligned manner.
12905 EOM
12906                 d_u32align="$define"
12907                 ;;
12908         esac
12909         $rm -f core core.try.* try.core
12910 else
12911         rp='Can you access character data at unaligned addresses?'
12912         dflt='n'
12913         . ./myread
12914         case "$ans" in
12915         [yY]*)  d_u32align="$undef"  ;;
12916         *)      d_u32align="$define" ;;
12917         esac
12918 fi
12919
12920 : see if ualarm exists
12921 set ualarm d_ualarm
12922 eval $inlibc
12923
12924 : see if umask exists
12925 set umask d_umask
12926 eval $inlibc
12927
12928 : see if usleep exists
12929 set usleep d_usleep
12930 eval $inlibc
12931
12932 : see if prototype for usleep is available
12933 echo " "
12934 set d_usleepproto usleep $i_unistd unistd.h
12935 eval $hasproto
12936
12937 : see if ustat exists
12938 set ustat d_ustat
12939 eval $inlibc
12940
12941 : backward compatibility for d_hvfork
12942 if test X$d_hvfork != X; then
12943         d_vfork="$d_hvfork"
12944         d_hvfork=''
12945 fi
12946 : see if there is a vfork
12947 val=''
12948 set vfork val
12949 eval $inlibc
12950
12951 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12952 : perl on Solaris 2.x, and probably elsewhere.
12953 case "$val" in
12954 $define)
12955         echo " "
12956         case "$usevfork" in
12957         false) dflt='n';;
12958         *) dflt='y';;
12959         esac
12960         cat <<'EOM'
12961  
12962 Perl can only use a vfork() that doesn't suffer from strict
12963 restrictions on calling functions or modifying global data in
12964 the child.  For example, glibc-2.1 contains such a vfork()
12965 that is unsuitable.  If your system provides a proper fork()
12966 call, chances are that you do NOT want perl to use vfork().
12967
12968 EOM
12969         rp="Do you still want to use vfork()?"
12970         . ./myread
12971         case "$ans" in
12972         y|Y) ;;
12973         *)
12974                 echo "Ok, we won't use vfork()."
12975                 val="$undef"
12976                 ;;
12977         esac
12978         ;;
12979 esac
12980 set d_vfork
12981 eval $setvar
12982 case "$d_vfork" in
12983 $define) usevfork='true';;
12984 *) usevfork='false';;
12985 esac
12986
12987 : see if this is an sysdir system
12988 set sys/dir.h i_sysdir
12989 eval $inhdr
12990
12991 : see if this is an sysndir system
12992 set sys/ndir.h i_sysndir
12993 eval $inhdr
12994
12995 : see if closedir exists
12996 set closedir d_closedir
12997 eval $inlibc
12998
12999 case "$d_closedir" in
13000 "$define")
13001         echo " "
13002         echo "Checking whether closedir() returns a status..." >&4
13003         cat > closedir.c <<EOM
13004 #$i_dirent I_DIRENT             /**/
13005 #$i_sysdir I_SYS_DIR            /**/
13006 #$i_sysndir I_SYS_NDIR          /**/
13007 #$i_systypes I_SYS_TYPES        /**/
13008
13009 #if defined(I_SYS_TYPES)
13010 #include <sys/types.h>
13011 #endif
13012 #if defined(I_DIRENT)
13013 #include <dirent.h>
13014 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13015 #include <sys/dir.h>
13016 #endif
13017 #else
13018 #ifdef I_SYS_NDIR
13019 #include <sys/ndir.h>
13020 #else
13021 #ifdef I_SYS_DIR
13022 #ifdef hp9000s500
13023 #include <ndir.h>       /* may be wrong in the future */
13024 #else
13025 #include <sys/dir.h>
13026 #endif
13027 #endif
13028 #endif
13029 #endif 
13030 int main() { return closedir(opendir(".")); }
13031 EOM
13032         set closedir
13033         if eval $compile_ok; then
13034                 if ./closedir > /dev/null 2>&1 ; then
13035                         echo "Yes, it does."
13036                         val="$undef"
13037                 else
13038                         echo "No, it doesn't."
13039                         val="$define"
13040                 fi
13041         else
13042                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13043                 val="$define"
13044         fi
13045         ;;
13046 *)
13047         val="$undef";
13048         ;;
13049 esac
13050 set d_void_closedir
13051 eval $setvar
13052 $rm -f closedir*
13053 : see if there is a wait4
13054 set wait4 d_wait4
13055 eval $inlibc
13056
13057 : see if waitpid exists
13058 set waitpid d_waitpid
13059 eval $inlibc
13060
13061 : see if wcstombs exists
13062 set wcstombs d_wcstombs
13063 eval $inlibc
13064
13065 : see if wctomb exists
13066 set wctomb d_wctomb
13067 eval $inlibc
13068
13069 : see if writev exists
13070 set writev d_writev
13071 eval $inlibc
13072
13073 : preserve RCS keywords in files with variable substitution, grrr
13074 Date='$Date'
13075 Id='$Id'
13076 Log='$Log'
13077 RCSfile='$RCSfile'
13078 Revision='$Revision'
13079
13080 : check for alignment requirements
13081 echo " "
13082 case "$crosscompile$multiarch" in
13083 *$define*)
13084         $cat <<EOM
13085 You seem to be either cross-compiling or doing a multiarchitecture build,
13086 skipping the memory alignment check.
13087
13088 EOM
13089         case "$alignbytes" in
13090         '') alignbytes=8 ;;
13091         esac
13092         ;;
13093 *)
13094         case "$alignbytes" in
13095         '') echo "Checking alignment constraints..." >&4
13096                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13097                         $cat >try.c <<'EOCP'
13098 typedef long double NV;
13099 EOCP
13100                 else
13101                         $cat >try.c <<'EOCP'
13102 typedef double NV;
13103 EOCP
13104                 fi
13105                 $cat >>try.c <<'EOCP'
13106 #include <stdio.h>
13107 struct foobar {
13108         char foo;
13109         NV bar;
13110 } try_algn;
13111 int main()
13112 {
13113     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13114     return(0);
13115 }
13116 EOCP
13117                 set try
13118                 if eval $compile_ok; then
13119                         dflt=`./try`
13120                 else
13121                         dflt='8'
13122                         echo "(I can't seem to compile the test program...)"
13123                 fi
13124                 ;;
13125         *) dflt="$alignbytes"
13126                 ;;
13127         esac
13128         rp="Doubles must be aligned on a how-many-byte boundary?"
13129         . ./myread
13130         alignbytes="$ans"
13131         $rm -f try.c try
13132         ;;
13133 esac
13134
13135
13136 : set the base revision
13137 baserev=5.0
13138
13139 : how do we catenate cpp tokens here?
13140 echo " "
13141 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13142 $cat >cpp_stuff.c <<'EOCP'
13143 #define RCAT(a,b)a/**/b
13144 #define ACAT(a,b)a ## b
13145 RCAT(Rei,ser)
13146 ACAT(Cir,cus)
13147 EOCP
13148 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13149 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13150         echo "Oh!  Smells like ANSI's been here." >&4
13151         echo "We can catify or stringify, separately or together!"
13152         cpp_stuff=42
13153 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13154         echo "Ah, yes!  The good old days!" >&4
13155         echo "However, in the good old days we don't know how to stringify and"
13156         echo "catify at the same time."
13157         cpp_stuff=1
13158 else
13159         $cat >&4 <<EOM
13160 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13161 to have to edit the values of CAT[2-5] in config.h...
13162 EOM
13163         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13164 fi
13165 $rm -f cpp_stuff.*
13166
13167 : see if this is a db.h system
13168 set db.h i_db
13169 eval $inhdr
13170
13171 case "$i_db" in
13172 $define)
13173         : Check db version.
13174         echo " "
13175         echo "Checking Berkeley DB version ..." >&4
13176         $cat >try.c <<EOCP
13177 #$d_const HASCONST
13178 #ifndef HASCONST
13179 #define const
13180 #endif
13181 #include <sys/types.h>
13182 #include <stdio.h>
13183 #include <db.h>
13184 int main(int argc, char *argv[])
13185 {
13186 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13187     int Major, Minor, Patch ;
13188     unsigned long Version ;
13189     (void)db_version(&Major, &Minor, &Patch) ;
13190     if (argc == 2) {
13191         printf("%d %d %d %d %d %d\n",
13192                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13193                Major, Minor, Patch);
13194         exit(0);
13195     }
13196     printf("You have Berkeley DB Version 2 or greater.\n");
13197
13198     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13199                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13200     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13201                 Major, Minor, Patch) ;
13202
13203     /* check that db.h & libdb are compatible */
13204     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13205         printf("db.h and libdb are incompatible.\n") ;
13206         exit(3);        
13207     }
13208
13209     printf("db.h and libdb are compatible.\n") ;
13210
13211     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13212                 + DB_VERSION_PATCH ;
13213
13214     /* needs to be >= 2.3.4 */
13215     if (Version < 2003004) {
13216     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13217         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13218         exit(2);        
13219     }
13220
13221     exit(0);
13222 #else
13223 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13224     if (argc == 2) {
13225         printf("1 0 0\n");
13226         exit(0);
13227     }
13228     printf("You have Berkeley DB Version 1.\n");
13229     exit(0);    /* DB version < 2: the coast is clear. */
13230 #else
13231     exit(1);    /* <db.h> not Berkeley DB? */
13232 #endif
13233 #endif
13234 }
13235 EOCP
13236         set try
13237         if eval $compile_ok && ./try; then
13238                 echo 'Looks OK.' >&4
13239                 set `./try 1`
13240                 db_version_major=$1
13241                 db_version_minor=$2
13242                 db_version_patch=$3
13243         else
13244                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13245                 i_db=$undef
13246                 case " $libs " in
13247                 *"-ldb "*)
13248                         : Remove db from list of libraries to use
13249                         echo "Removing unusable -ldb from library list" >&4
13250                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13251                         shift
13252                         libs="$*"
13253                         echo "libs = $libs" >&4
13254                         ;;
13255                 esac
13256         fi
13257         $rm -f try.*
13258         ;;
13259 esac
13260
13261 case "$i_db" in
13262 define)
13263         : Check the return type needed for hash 
13264         echo " "
13265         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13266         $cat >try.c <<EOCP
13267 #$d_const HASCONST
13268 #ifndef HASCONST
13269 #define const
13270 #endif
13271 #include <sys/types.h>
13272 #include <db.h>
13273
13274 #ifndef DB_VERSION_MAJOR
13275 u_int32_t hash_cb (ptr, size)
13276 const void *ptr;
13277 size_t size;
13278 {
13279 }
13280 HASHINFO info;
13281 int main()
13282 {
13283         info.hash = hash_cb;
13284 }
13285 #endif
13286 EOCP
13287         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13288                 if $contains warning try.out >>/dev/null 2>&1 ; then
13289                         db_hashtype='int'
13290                 else
13291                         db_hashtype='u_int32_t'
13292                 fi
13293         else
13294                 : XXX Maybe we should just give up here.
13295                 db_hashtype=u_int32_t
13296                 $cat try.out >&4
13297                 echo "Help:  I can't seem to compile the db test program." >&4
13298                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13299         fi
13300         $rm -f try.*
13301         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13302         ;;
13303 *)      db_hashtype=u_int32_t
13304         ;;
13305 esac
13306 case "$i_db" in
13307 define)
13308         : Check the return type needed for prefix 
13309         echo " "
13310         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13311         cat >try.c <<EOCP
13312 #$d_const HASCONST
13313 #ifndef HASCONST
13314 #define const
13315 #endif
13316 #include <sys/types.h>
13317 #include <db.h>
13318
13319 #ifndef DB_VERSION_MAJOR
13320 size_t prefix_cb (key1, key2)
13321 const DBT *key1;
13322 const DBT *key2;
13323 {
13324 }
13325 BTREEINFO info;
13326 int main()
13327 {
13328         info.prefix = prefix_cb;
13329 }
13330 #endif
13331 EOCP
13332         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13333                 if $contains warning try.out >>/dev/null 2>&1 ; then
13334                         db_prefixtype='int'
13335                 else
13336                         db_prefixtype='size_t'
13337                 fi
13338         else
13339                 db_prefixtype='size_t'
13340                 : XXX Maybe we should just give up here.
13341                 $cat try.out >&4
13342                 echo "Help:  I can't seem to compile the db test program." >&4
13343                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13344         fi
13345         $rm -f try.*
13346         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13347         ;;
13348 *)      db_prefixtype='size_t'
13349         ;;
13350 esac
13351
13352
13353 : How can we generate normalized random numbers ?
13354 echo " "
13355 echo "Looking for a random number function..." >&4
13356 case "$randfunc" in
13357 '')
13358         if set drand48 val -f; eval $csym; $val; then
13359                 dflt="drand48"
13360                 echo "Good, found drand48()." >&4
13361         elif set random val -f; eval $csym; $val; then
13362                 dflt="random"
13363                 echo "OK, found random()." >&4
13364         else
13365                 dflt="rand"
13366                 echo "Yick, looks like I have to use rand()." >&4
13367         fi
13368         echo " "
13369         ;;
13370 *)
13371         dflt="$randfunc"
13372         ;;
13373 esac
13374 cont=true
13375
13376 case "$ccflags" in
13377 *-Dmy_rand=*|*-Dmy_srand=*)
13378         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13379         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13380         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13381         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13382         ;;
13383 esac
13384
13385 while $test "$cont"; do
13386         rp="Use which function to generate random numbers?"
13387         . ./myread
13388         if $test "$ans" = "$dflt"; then
13389                 : null
13390         else
13391                 randbits=''
13392         fi
13393         randfunc="$ans"
13394         if set $ans val -f; eval $csym; $val; then
13395                 cont=''
13396         else
13397                 dflt=y
13398                 rp="I cannot find function $ans. Use that name anyway?"
13399                 . ./myread
13400                 dflt=rand
13401                 case "$ans" in
13402                         [yY]*) cont='';;
13403                 esac
13404         fi
13405         case "$cont" in
13406         '')
13407                 case "$randfunc" in
13408                 drand48)
13409                         drand01="drand48()"
13410                         seedfunc="srand48"
13411                         randbits=48
13412                         randseedtype=long
13413                         ;;
13414                 rand|random)
13415                         case "$randbits" in
13416                         '')
13417 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13418                                 $cat >try.c <<EOCP
13419 #$i_unistd I_UNISTD
13420 #$i_stdlib I_STDLIB
13421 #include <stdio.h>
13422 #ifdef I_UNISTD
13423 #  include <unistd.h>
13424 #endif
13425 #ifdef I_STDLIB
13426 #  include <stdlib.h>
13427 #endif
13428 int main()
13429 {
13430         register int i;
13431         register unsigned long tmp;
13432         register unsigned long max = 0L;
13433
13434         for (i = 1000; i; i--) {
13435                 tmp = (unsigned long) $randfunc();
13436                 if (tmp > max) max = tmp;
13437         }
13438         for (i = 0; max; i++)
13439                 max /= 2;
13440         printf("%d\n",i);
13441 }
13442 EOCP
13443                                 set try
13444                                 if eval $compile_ok; then
13445                                         dflt=`try`
13446                                 else
13447                                         dflt='?'
13448                                         echo "(I can't seem to compile the test program...)"
13449                                 fi
13450                                 ;;
13451                         *)
13452                                 dflt="$randbits"
13453                                 ;;
13454                         esac
13455                         rp="How many bits does your $randfunc() function produce?"
13456                         . ./myread
13457                         randbits="$ans"
13458                         $rm -f try.c try
13459                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13460                         seedfunc="s$randfunc"
13461                         randseedtype=unsigned
13462                         ;;
13463                 *)
13464                         dflt="31"
13465                         rp="How many bits does your $randfunc() function produce?"
13466                         . ./myread
13467                         randbits="$ans"
13468                         seedfunc="s$randfunc"
13469                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13470                         if set $seedfunc val -f; eval $csym; $val; then
13471                                 echo "(Using $seedfunc() to seed random generator)"
13472                         else
13473                                 echo "(Warning: no $seedfunc() to seed random generator)"
13474                                 seedfunc=rand
13475                         fi
13476                         randseedtype=unsigned
13477                         ;;
13478                 esac
13479                 ;;
13480         esac
13481 done
13482
13483 echo " "
13484 echo "Determining whether or not we are on an EBCDIC system..." >&4
13485 $cat >tebcdic.c <<'EOM'
13486 int main()
13487 {
13488   if ('M'==0xd4) return 0;
13489   return 1;
13490 }
13491 EOM
13492
13493 val=$undef
13494 set tebcdic
13495 if eval $compile_ok; then
13496         if ./tebcdic; then
13497                 echo "You seem to speak EBCDIC." >&4
13498                 val="$define"
13499         else
13500                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13501         fi
13502 else
13503         echo "I'm unable to compile the test program." >&4
13504         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13505 fi
13506 $rm -f tebcdic.c tebcdic
13507 set ebcdic
13508 eval $setvar
13509
13510 echo " "
13511 $cat >&4 <<EOM
13512 Checking how to flush all pending stdio output...
13513 EOM
13514 # I only know how to find the first 32 possibly open files on SunOS.
13515 # See also hints/sunos_4_1.sh and util.c  --AD
13516 case "$osname" in
13517 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13518 esac
13519 $cat >>try.c <<EOCP
13520 #include <stdio.h>
13521 #$i_unistd I_UNISTD
13522 #ifdef I_UNISTD
13523 # include <unistd.h>
13524 #endif
13525 #$d_sysconf HAS_SYSCONF
13526 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13527 #ifdef HAS_STDIO_STREAM_ARRAY
13528 # define STDIO_STREAM_ARRAY $stdio_stream_array
13529 #endif
13530 int main() {
13531   FILE* p = fopen("try.out", "w");
13532 #ifdef TRY_FPUTC
13533   fputc('x', p);
13534 #else
13535 # ifdef TRY_FPRINTF
13536   fprintf(p, "x");
13537 # endif
13538 #endif
13539 #ifdef TRY_FFLUSH_NULL
13540   fflush(NULL);
13541 #endif
13542 #ifdef TRY_FFLUSH_ALL
13543   {
13544     long open_max = -1;
13545 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13546     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13547 # else
13548 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13549     open_max = sysconf(_SC_OPEN_MAX);
13550 #  else
13551 #   ifdef FOPEN_MAX
13552     open_max = FOPEN_MAX;
13553 #   else
13554 #    ifdef OPEN_MAX
13555     open_max = OPEN_MAX;
13556 #    else
13557 #     ifdef _NFILE
13558     open_max = _NFILE;
13559 #     endif
13560 #    endif
13561 #   endif
13562 #  endif
13563 # endif 
13564 # ifdef HAS_STDIO_STREAM_ARRAY
13565     if (open_max > 0) {
13566       long i;
13567       for (i = 0; i < open_max; i++)
13568             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13569                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13570                 STDIO_STREAM_ARRAY[i]._flag)
13571                 fflush(&STDIO_STREAM_ARRAY[i]);
13572     }   
13573   }
13574 # endif
13575 #endif
13576   _exit(42);
13577 }
13578 EOCP
13579 : first we have to find out how _not_ to flush
13580 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13581     output=''
13582     set try -DTRY_FPUTC
13583     if eval $compile; then
13584             $rm -f try.out
13585             ./try$exe_ext 2>/dev/null
13586             if $test ! -s try.out -a "X$?" = X42; then
13587                 output=-DTRY_FPUTC
13588             fi
13589     fi
13590     case "$output" in
13591     '')
13592             set try -DTRY_FPRINTF
13593             $rm -f try.out
13594             if eval $compile; then
13595                     $rm -f try.out
13596                     ./try$exe_ext 2>/dev/null
13597                     if $test ! -s try.out -a "X$?" = X42; then
13598                         output=-DTRY_FPRINTF
13599                     fi
13600             fi
13601         ;;
13602     esac
13603 fi
13604 : check for fflush NULL behaviour
13605 case "$fflushNULL" in
13606 '')     set try -DTRY_FFLUSH_NULL $output
13607         if eval $compile; then
13608                 $rm -f try.out
13609                 ./try$exe_ext 2>/dev/null
13610                 code="$?"
13611                 if $test -s try.out -a "X$code" = X42; then
13612                         fflushNULL="`$cat try.out`"
13613                 else
13614                         if $test "X$code" != X42; then
13615                                 $cat >&4 <<EOM
13616 (If this test failed, don't worry, we'll try another method shortly.)
13617 EOM
13618                         fi
13619                 fi
13620         fi
13621         $rm -f core try.core core.try.*
13622         case "$fflushNULL" in
13623         x)      $cat >&4 <<EOM
13624 Your fflush(NULL) works okay for output streams.
13625 Let's see if it clobbers input pipes...
13626 EOM
13627 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13628 # bug that improperly flushes the input end of pipes.  So we avoid the
13629 # autoflush on fork/system/exec support for now. :-(
13630 $cat >tryp.c <<EOCP
13631 #include <stdio.h>
13632 int
13633 main(int argc, char **argv)
13634 {
13635     char buf[1024];
13636     int i;
13637     char *bp = buf;
13638     while (1) {
13639         while ((i = getc(stdin)) != -1
13640                && (*bp++ = i) != '\n'
13641                && bp < &buf[1024])
13642         /* DO NOTHING */ ;
13643         *bp = '\0';
13644         fprintf(stdout, "%s", buf);
13645         fflush(NULL);
13646         if (i == -1)
13647             return 0;
13648         bp = buf;
13649     }
13650 }
13651 EOCP
13652                 fflushNULL="$define"
13653                 set tryp
13654                 if eval $compile; then
13655                     $rm -f tryp.out
13656                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13657                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13658                        $cat >&4 <<EOM
13659 fflush(NULL) seems to behave okay with input streams.
13660 EOM
13661                         fflushNULL="$define"
13662                     else
13663                         $cat >&4 <<EOM
13664 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13665 EOM
13666                         fflushNULL="$undef"
13667                     fi
13668                 fi
13669                 $rm -f core tryp.c tryp.core core.tryp.*
13670                 ;;
13671         '')     $cat >&4 <<EOM
13672 Your fflush(NULL) isn't working (contrary to ANSI C).
13673 EOM
13674                 fflushNULL="$undef"
13675                 ;;
13676         *)      $cat >&4 <<EOM
13677 Cannot figure out whether your fflush(NULL) works or not.
13678 I'm assuming it doesn't (contrary to ANSI C).
13679 EOM
13680                 fflushNULL="$undef"
13681                 ;;
13682         esac
13683         ;;
13684 $define|true|[yY]*)
13685         fflushNULL="$define"
13686         ;;
13687 *)
13688         fflushNULL="$undef"
13689         ;;
13690 esac
13691 : check explicit looping only if NULL did not work, and if the pipe
13692 : bug does not show up on an explicit flush too
13693 case "$fflushNULL" in
13694 "$undef")
13695         $cat >tryp.c <<EOCP
13696 #include <stdio.h>
13697 int
13698 main(int argc, char **argv)
13699 {
13700     char buf[1024];
13701     int i;
13702     char *bp = buf;
13703     while (1) {
13704         while ((i = getc(stdin)) != -1
13705                && (*bp++ = i) != '\n'
13706                && bp < &buf[1024])
13707         /* DO NOTHING */ ;
13708         *bp = '\0';
13709         fprintf(stdout, "%s", buf);
13710         fflush(stdin);
13711         if (i == -1)
13712             return 0;
13713         bp = buf;
13714     }
13715 }
13716 EOCP
13717         set tryp
13718         if eval $compile; then
13719             $rm -f tryp.out
13720             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13721             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13722                $cat >&4 <<EOM
13723 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13724 EOM
13725                 : now check for fflushall behaviour
13726                 case "$fflushall" in
13727                 '')     set try -DTRY_FFLUSH_ALL $output
13728                         if eval $compile; then
13729                                 $cat >&4 <<EOM
13730 (Now testing the other method--but note that this also may fail.)
13731 EOM
13732                                 $rm -f try.out
13733                                 ./try$exe_ext 2>/dev/null
13734                                 if $test -s try.out -a "X$?" = X42; then
13735                                         fflushall="`$cat try.out`"
13736                                 fi
13737                         fi
13738                         $rm -f core try.core core.try.*
13739                         case "$fflushall" in
13740                         x)      $cat >&4 <<EOM
13741 Whew. Flushing explicitly all the stdio streams works.
13742 EOM
13743                                 fflushall="$define"
13744                                 ;;
13745                         '')     $cat >&4 <<EOM
13746 Sigh. Flushing explicitly all the stdio streams doesn't work.
13747 EOM
13748                                 fflushall="$undef"
13749                                 ;;
13750                         *)      $cat >&4 <<EOM
13751 Cannot figure out whether flushing stdio streams explicitly works or not.
13752 I'm assuming it doesn't.
13753 EOM
13754                                 fflushall="$undef"
13755                                 ;;
13756                         esac
13757                         ;;
13758                 "$define"|true|[yY]*)
13759                         fflushall="$define"
13760                         ;;
13761                 *)
13762                         fflushall="$undef"
13763                         ;;
13764                 esac
13765             else
13766                 $cat >&4 <<EOM
13767 All is futile.  Even fflush(stdin) clobbers input pipes!
13768 EOM
13769                 fflushall="$undef"
13770             fi
13771         else
13772             fflushall="$undef"
13773         fi
13774         $rm -f core tryp.c tryp.core core.tryp.*
13775         ;;
13776 *)      fflushall="$undef"
13777         ;;
13778 esac
13779
13780 case "$fflushNULL$fflushall" in
13781 undefundef)
13782         $cat <<EOM
13783 OK, I give up.  I cannot figure out how to flush pending stdio output.
13784 We won't be flushing handles at all before fork/exec/popen.
13785 EOM
13786         ;;
13787 esac
13788 $rm -f try.* try$exe_ext
13789
13790 : Store the full pathname to the ar program for use in the C program
13791 : Respect a hint or command line value for full_ar.
13792 case "$full_ar" in
13793 '') full_ar=$ar ;;
13794 esac
13795
13796 : Store the full pathname to the sed program for use in the C program
13797 full_sed=$sed
13798
13799 : see what type gids are declared as in the kernel
13800 echo " "
13801 echo "Looking for the type for group ids returned by getgid()."
13802 set gid_t gidtype xxx stdio.h sys/types.h
13803 eval $typedef
13804 case "$gidtype" in
13805 xxx)
13806         xxx=`./findhdr sys/user.h`
13807         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13808         case $1 in
13809         unsigned) dflt="$1 $2" ;;
13810         *) dflt="$1" ;;
13811         esac
13812         ;;
13813 *) dflt="$gidtype";;
13814 esac
13815 case "$gidtype" in
13816 gid_t) echo "gid_t found." ;;
13817 *)      rp="What is the type for group ids returned by getgid()?"
13818         . ./myread
13819         gidtype="$ans"
13820         ;;
13821 esac
13822
13823 echo " "
13824 case "$gidtype" in
13825 *_t) zzz="$gidtype"     ;;
13826 *)   zzz="gid"          ;;
13827 esac
13828 echo "Checking the size of $zzz..." >&4 
13829 cat > try.c <<EOCP
13830 #include <sys/types.h>
13831 #include <stdio.h>
13832 int main() {
13833     printf("%d\n", (int)sizeof($gidtype));
13834     exit(0);
13835 }
13836 EOCP
13837 set try
13838 if eval $compile_ok; then
13839         yyy=`./try`
13840         case "$yyy" in
13841         '')     gidsize=4
13842                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13843                 ;;
13844         *)      gidsize=$yyy
13845                 echo "Your $zzz is $gidsize bytes long."
13846                 ;;
13847         esac
13848 else
13849         gidsize=4
13850         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13851 fi
13852
13853
13854 echo " "
13855 case "$gidtype" in
13856 *_t) zzz="$gidtype"     ;;
13857 *)   zzz="gid"          ;;
13858 esac
13859 echo "Checking the sign of $zzz..." >&4 
13860 cat > try.c <<EOCP
13861 #include <sys/types.h>
13862 #include <stdio.h>
13863 int main() {
13864         $gidtype foo = -1;
13865         if (foo < 0)
13866                 printf("-1\n");
13867         else
13868                 printf("1\n");
13869 }
13870 EOCP
13871 set try
13872 if eval $compile; then
13873         yyy=`./try`
13874         case "$yyy" in
13875         '')     gidsign=1
13876                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13877                 ;;
13878         *)      gidsign=$yyy
13879                 case "$gidsign" in
13880                  1) echo "Your $zzz is unsigned." ;;
13881                 -1) echo "Your $zzz is signed."   ;;
13882                 esac
13883                 ;;
13884         esac
13885 else
13886         gidsign=1
13887         echo "(I can't compile the test program--guessing unsigned.)" >&4
13888 fi
13889
13890
13891 echo " "
13892
13893 if $test X"$quadtype" != X; then
13894
13895 echo "Checking how to print 64-bit integers..." >&4
13896
13897 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13898         $cat >try.c <<'EOCP'
13899 #include <sys/types.h>
13900 #include <stdio.h>
13901 int main() {
13902   int q = 12345678901;
13903   printf("%ld\n", q);
13904 }
13905 EOCP
13906         set try
13907         if eval $compile; then
13908                 yyy=`./try$exe_ext`
13909                 case "$yyy" in
13910                 12345678901)
13911                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13912                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13913                         echo "We will use %d."
13914                         ;;
13915                 esac
13916         fi
13917 fi
13918
13919 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13920         $cat >try.c <<'EOCP'
13921 #include <sys/types.h>
13922 #include <stdio.h>
13923 int main() {
13924   long q = 12345678901;
13925   printf("%ld\n", q);
13926 }
13927 EOCP
13928         set try
13929         if eval $compile; then
13930                 yyy=`./try$exe_ext`
13931                 case "$yyy" in
13932                 12345678901)
13933                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13934                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13935                         echo "We will use %ld."
13936                         ;;
13937                 esac
13938         fi
13939 fi
13940
13941 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13942         $cat >try.c <<'EOCP'
13943 #include <sys/types.h>
13944 #include <inttypes.h>
13945 #include <stdio.h>
13946 int main() {
13947   int64_t q = 12345678901;
13948   printf("%" PRId64 "\n", q);
13949 }
13950 EOCP
13951         set try
13952         if eval $compile; then
13953                 yyy=`./try$exe_ext`
13954                 case "$yyy" in
13955                 12345678901)
13956                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13957                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13958                         echo "We will use the C9X style."
13959                         ;;
13960                 esac
13961         fi
13962 fi
13963
13964 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13965         $cat >try.c <<EOCP
13966 #include <sys/types.h>
13967 #include <stdio.h>
13968 int main() {
13969   $quadtype q = 12345678901;
13970   printf("%Ld\n", q);
13971 }
13972 EOCP
13973         set try
13974         if eval $compile; then
13975                 yyy=`./try$exe_ext`
13976                 case "$yyy" in
13977                 12345678901)
13978                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13979                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13980                         echo "We will use %Ld."
13981                         ;;
13982                 esac
13983         fi
13984 fi
13985
13986 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13987         $cat >try.c <<'EOCP'
13988 #include <sys/types.h>
13989 #include <stdio.h>
13990 int main() {
13991   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13992   printf("%lld\n", q);
13993 }
13994 EOCP
13995         set try
13996         if eval $compile; then
13997                 yyy=`./try$exe_ext`
13998                 case "$yyy" in
13999                 12345678901)
14000                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14001                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14002                         echo "We will use the %lld style."
14003                         ;;
14004                 esac
14005         fi
14006 fi
14007
14008 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14009         $cat >try.c <<EOCP
14010 #include <sys/types.h>
14011 #include <stdio.h>
14012 int main() {
14013   $quadtype q = 12345678901;
14014   printf("%qd\n", q);
14015 }
14016 EOCP
14017         set try
14018         if eval $compile; then
14019                 yyy=`./try$exe_ext`
14020                 case "$yyy" in
14021                 12345678901)
14022                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14023                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14024                         echo "We will use %qd."
14025                         ;;
14026                 esac
14027         fi
14028 fi
14029
14030 if $test X"$sPRId64" = X; then
14031         echo "Cannot figure out how to print 64-bit integers." >&4
14032 fi
14033
14034 $rm -f try try.*
14035
14036 fi
14037
14038 case "$sPRId64" in
14039 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14040         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14041         ;;
14042 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14043         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14044         ;;
14045 esac
14046
14047
14048 echo " "
14049 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14050
14051 if $test X"$ivsize" = X8; then
14052         ivdformat="$sPRId64"
14053         uvuformat="$sPRIu64"
14054         uvoformat="$sPRIo64"
14055         uvxformat="$sPRIx64"
14056         uvXUformat="$sPRIXU64"
14057 else
14058         if $test X"$ivsize" = X"$longsize"; then
14059                 ivdformat='"ld"'
14060                 uvuformat='"lu"'
14061                 uvoformat='"lo"'
14062                 uvxformat='"lx"'
14063                 uvXUformat='"lX"'
14064         else
14065                 if $test X"$ivsize" = X"$intsize"; then
14066                         ivdformat='"d"'
14067                         uvuformat='"u"'
14068                         uvoformat='"o"'
14069                         uvxformat='"x"'
14070                         uvXUformat='"X"'
14071                 else
14072                         : far out
14073                         if $test X"$ivsize" = X"$shortsize"; then
14074                                 ivdformat='"hd"'
14075                                 uvuformat='"hu"'
14076                                 uvoformat='"ho"'
14077                                 uvxformat='"hx"'
14078                                 uvXUformat='"hX"'
14079                         fi
14080                 fi
14081         fi
14082 fi
14083
14084 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14085         nveformat="$sPRIeldbl"
14086         nvfformat="$sPRIfldbl"
14087         nvgformat="$sPRIgldbl"
14088         nvEUformat="$sPRIEUldbl"
14089         nvFUformat="$sPRIFUldbl"
14090         nvGUformat="$sPRIGUldbl"
14091 else
14092         nveformat='"e"'
14093         nvfformat='"f"'
14094         nvgformat='"g"'
14095         nvEUformat='"E"'
14096         nvFUformat='"F"'
14097         nvGUformat='"G"'
14098 fi
14099
14100 case "$ivdformat" in
14101 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14102     exit 1
14103     ;;
14104 esac
14105
14106
14107 echo " "
14108 $echo "Checking the format string to be used for gids..." >&4
14109
14110 case "$gidsign" in
14111 -1)     if $test X"$gidsize" = X"$ivsize"; then
14112                 gidformat="$ivdformat"
14113         else
14114                 if $test X"$gidsize" = X"$longsize"; then
14115                         gidformat='"ld"'
14116                 else
14117                         if $test X"$gidsize" = X"$intsize"; then
14118                                 gidformat='"d"'
14119                         else
14120                                 if $test X"$gidsize" = X"$shortsize"; then
14121                                         gidformat='"hd"'
14122                                 fi
14123                         fi
14124                 fi
14125         fi
14126         ;;
14127 *)      if $test X"$gidsize" = X"$uvsize"; then
14128                 gidformat="$uvuformat"
14129         else
14130                 if $test X"$gidsize" = X"$longsize"; then
14131                         gidformat='"lu"'
14132                 else
14133                         if $test X"$gidsize" = X"$intsize"; then
14134                                 gidformat='"u"'
14135                         else
14136                                 if $test X"$gidsize" = X"$shortsize"; then
14137                                         gidformat='"hu"'
14138                                 fi
14139                         fi
14140                 fi
14141         fi
14142         ;;
14143 esac
14144
14145 : see if getgroups exists
14146 set getgroups d_getgrps
14147 eval $inlibc
14148
14149 : see if setgroups exists
14150 set setgroups d_setgrps
14151 eval $inlibc
14152
14153
14154 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14155 echo " "
14156 case "$d_getgrps$d_setgrps" in
14157 *define*)
14158         case "$groupstype" in
14159         '') dflt="$gidtype" ;;
14160         *)  dflt="$groupstype" ;;
14161         esac
14162         $cat <<EOM
14163 What type of pointer is the second argument to getgroups() and setgroups()?
14164 Usually this is the same as group ids, $gidtype, but not always.
14165
14166 EOM
14167         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14168         . ./myread
14169         groupstype="$ans"
14170         ;;
14171 *)  groupstype="$gidtype";;
14172 esac
14173
14174 echo " "
14175 echo "Checking if your $make program sets \$(MAKE)..." >&4
14176 case "$make_set_make" in
14177 '')
14178         $sed 's/^X //' > testmake.mak << 'EOF'
14179 Xall:
14180 X       @echo 'maketemp="$(MAKE)"'
14181 EOF
14182         case "`$make -f testmake.mak 2>/dev/null`" in
14183         *maketemp=*) make_set_make='#' ;;
14184         *)      make_set_make="MAKE=$make" ;;
14185         esac
14186         $rm -f testmake.mak
14187         ;;
14188 esac
14189 case "$make_set_make" in
14190 '#') echo "Yup, it does.";;
14191 *) echo "Nope, it doesn't.";;
14192 esac
14193
14194 : see what type is used for mode_t
14195 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14196 set mode_t modetype int stdio.h sys/types.h
14197 eval $typedef_ask
14198
14199 : see if stdarg is available
14200 echo " "
14201 if $test `./findhdr stdarg.h`; then
14202         echo "<stdarg.h> found." >&4
14203         valstd="$define"
14204 else
14205         echo "<stdarg.h> NOT found." >&4
14206         valstd="$undef"
14207 fi
14208
14209 : see if varags is available
14210 echo " "
14211 if $test `./findhdr varargs.h`; then
14212         echo "<varargs.h> found." >&4
14213 else
14214         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14215 fi
14216
14217 : set up the varargs testing programs
14218 $cat > varargs.c <<EOP
14219 #ifdef I_STDARG
14220 #include <stdarg.h>
14221 #endif
14222 #ifdef I_VARARGS
14223 #include <varargs.h>
14224 #endif
14225
14226 #ifdef I_STDARG
14227 int f(char *p, ...)
14228 #else
14229 int f(va_alist)
14230 va_dcl
14231 #endif
14232 {
14233         va_list ap;
14234 #ifndef I_STDARG
14235         char *p;
14236 #endif
14237 #ifdef I_STDARG
14238         va_start(ap,p);
14239 #else
14240         va_start(ap);
14241         p = va_arg(ap, char *);
14242 #endif
14243         va_end(ap);
14244 }
14245 EOP
14246 $cat > varargs <<EOP
14247 $startsh
14248 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14249         echo "true"
14250 else
14251         echo "false"
14252 fi
14253 $rm -f varargs$_o
14254 EOP
14255 chmod +x varargs
14256
14257 : now check which varargs header should be included
14258 echo " "
14259 i_varhdr=''
14260 case "$valstd" in
14261 "$define")
14262         if `./varargs I_STDARG`; then
14263                 val='stdarg.h'
14264         elif `./varargs I_VARARGS`; then
14265                 val='varargs.h'
14266         fi
14267         ;;
14268 *)
14269         if `./varargs I_VARARGS`; then
14270                 val='varargs.h'
14271         fi
14272         ;;
14273 esac
14274 case "$val" in
14275 '')
14276 echo "I could not find the definition for va_dcl... You have problems..." >&4
14277         val="$undef"; set i_stdarg; eval $setvar
14278         val="$undef"; set i_varargs; eval $setvar
14279         ;;
14280 *) 
14281         set i_varhdr
14282         eval $setvar
14283         case "$i_varhdr" in
14284         stdarg.h)
14285                 val="$define"; set i_stdarg; eval $setvar
14286                 val="$undef"; set i_varargs; eval $setvar
14287                 ;;
14288         varargs.h)
14289                 val="$undef"; set i_stdarg; eval $setvar
14290                 val="$define"; set i_varargs; eval $setvar
14291                 ;;
14292         esac
14293         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14294 esac
14295 $rm -f varargs*
14296
14297 : see if we need va_copy
14298 echo " "
14299 case "$i_stdarg" in
14300 "$define")
14301         $cat >try.c <<EOCP
14302 #include <stdarg.h>
14303 #include <stdio.h>
14304 #$i_stdlib I_STDLIB
14305 #ifdef I_STDLIB
14306 #include <stdlib.h>
14307 #endif
14308 #include <signal.h>
14309
14310 int
14311 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14312 {
14313   return vfprintf(f, fmt, *valp);
14314 }
14315  
14316 int    
14317 myvfprintf(FILE *f, const  char *fmt, va_list val)
14318 {
14319   return ivfprintf(f, fmt, &val);
14320 }
14321       
14322 int
14323 myprintf(char *fmt, ...) 
14324 {
14325   va_list val;
14326   va_start(val, fmt);
14327   return myvfprintf(stdout, fmt, val); 
14328 }         
14329
14330 int
14331 main(int ac, char **av)
14332 {
14333   signal(SIGSEGV, exit);
14334
14335   myprintf("%s%cs all right, then\n", "that", '\'');                            
14336   exit(0);      
14337 }
14338 EOCP
14339         set try
14340         if eval $compile && ./try 2>&1 >/dev/null; then
14341                 case "`./try`" in
14342                 "that's all right, then")
14343                         okay=yes
14344                         ;;
14345                 esac
14346         fi
14347         case "$okay" in
14348         yes)    echo "It seems that you don't need va_copy()." >&4
14349                 need_va_copy="$undef"
14350                 ;;
14351         *)      echo "It seems that va_copy() or similar will be needed." >&4
14352                 need_va_copy="$define"
14353                 ;;
14354         esac
14355         $rm -f try.* core core.* *.core *.core.*
14356         ;;
14357 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14358         ;;
14359 esac
14360
14361 : define a fucntion to check prototypes
14362 $cat > protochk <<EOSH
14363 $startsh
14364 cc="$cc"
14365 optimize="$optimize"
14366 ccflags="$ccflags"
14367 prototype="$prototype"
14368 define="$define"
14369 rm=$rm
14370 EOSH
14371
14372 $cat >> protochk <<'EOSH'
14373
14374 $rm -f try.c
14375 foo="$1"
14376 shift
14377 while test $# -ge 2; do
14378         case "$1" in
14379                 $define) echo "#include <$2>" >> try.c ;;
14380                 literal) echo "$2" >> try.c ;;
14381         esac
14382     shift 2
14383 done
14384 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14385 cat >> try.c <<'EOCP'
14386 #ifdef CAN_PROTOTYPE
14387 #define _(args) args
14388 #else
14389 #define _(args) ()
14390 #endif
14391 EOCP
14392 echo "$foo" >> try.c
14393 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14394 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14395 status=$?
14396 $rm -f try.[co]
14397 exit $status
14398 EOSH
14399 chmod +x protochk
14400 $eunicefix protochk
14401
14402 : see what type is used for size_t
14403 rp="What is the type used for the length parameter for string functions?"
14404 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14405 eval $typedef_ask
14406
14407 : check for type of arguments to gethostbyaddr. 
14408 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14409         case "$d_gethbyaddr" in
14410         $define)
14411                 $cat <<EOM
14412
14413 Checking to see what type of arguments are accepted by gethostbyaddr().
14414 EOM
14415                 hdrs="$define sys/types.h
14416                         $d_socket sys/socket.h 
14417                         $i_niin netinet/in.h 
14418                         $i_netdb netdb.h
14419                         $i_unistd unistd.h"
14420                 : The first arg can 'char *' or 'void *'
14421                 : The second arg is some of integral type
14422                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14423                         for yyy in size_t long int; do
14424                                 case "$netdb_host_type" in
14425                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14426                                         if ./protochk "$try" $hdrs; then
14427                                                 echo "Your system accepts $xxx for the first arg."
14428                                                 echo "...and $yyy for the second arg."
14429                                                 netdb_host_type="$xxx"
14430                                                 netdb_hlen_type="$yyy"
14431                                         fi
14432                                         ;;
14433                                 esac
14434                         done
14435                 done
14436                 : In case none of those worked, prompt the user.
14437                 case "$netdb_host_type" in
14438                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14439                         dflt='char *'
14440                         . ./myread
14441                         netdb_host_type=$ans
14442                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14443                         dflt="$sizetype"
14444                         . ./myread
14445                         netdb_hlen_type=$ans
14446                         ;;
14447                 esac
14448                 ;;
14449         *)      : no gethostbyaddr, so pick harmless defaults
14450                 netdb_host_type='char *'
14451                 netdb_hlen_type="$sizetype"
14452                 ;;
14453         esac
14454         # Remove the "const" if needed. -- but then we'll have a 
14455         # prototype clash!
14456         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14457 fi
14458
14459 : check for type of argument to gethostbyname. 
14460 if test "X$netdb_name_type" = X ; then
14461         case "$d_gethbyname" in
14462         $define)
14463                 $cat <<EOM
14464
14465 Checking to see what type of argument is accepted by gethostbyname().
14466 EOM
14467                 hdrs="$define sys/types.h
14468                         $d_socket sys/socket.h 
14469                         $i_niin netinet/in.h 
14470                         $i_netdb netdb.h
14471                         $i_unistd unistd.h"
14472                 for xxx in "const char *" "char *"; do
14473                         case "$netdb_name_type" in
14474                         '')     try="extern struct hostent *gethostbyname($xxx);"
14475                                 if ./protochk "$try" $hdrs; then
14476                                         echo "Your system accepts $xxx."
14477                                         netdb_name_type="$xxx"
14478                                 fi
14479                                 ;;
14480                         esac
14481                 done
14482                 : In case none of those worked, prompt the user.
14483                 case "$netdb_name_type" in
14484                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14485                         dflt='char *'
14486                         . ./myread
14487                         netdb_name_type=$ans
14488                         ;;
14489                 esac
14490                 ;;
14491         *)      : no gethostbyname, so pick harmless default
14492                 netdb_name_type='char *'
14493                 ;;
14494         esac
14495 fi
14496
14497 : check for type of 1st argument to getnetbyaddr. 
14498 if test "X$netdb_net_type" = X ; then
14499         case "$d_getnbyaddr" in
14500         $define)
14501                 $cat <<EOM
14502
14503 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14504 EOM
14505                 hdrs="$define sys/types.h
14506                         $d_socket sys/socket.h 
14507                         $i_niin netinet/in.h 
14508                         $i_netdb netdb.h
14509                         $i_unistd unistd.h"
14510                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14511                         case "$netdb_net_type" in
14512                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14513                                 if ./protochk "$try" $hdrs; then
14514                                         echo "Your system accepts $xxx."
14515                                         netdb_net_type="$xxx"
14516                                 fi
14517                                 ;;
14518                         esac
14519                 done
14520                 : In case none of those worked, prompt the user.
14521                 case "$netdb_net_type" in
14522                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14523                         dflt='long'
14524                         . ./myread
14525                         netdb_net_type=$ans
14526                         ;;
14527                 esac
14528                 ;;
14529         *)      : no getnetbyaddr, so pick harmless default
14530                 netdb_net_type='long'
14531                 ;;
14532         esac
14533 fi
14534 : locate the preferred pager for this system
14535 case "$pager" in
14536 '')
14537         dflt=''
14538         case "$pg" in
14539         /*) dflt=$pg;;
14540         [a-zA-Z]:/*) dflt=$pg;;
14541         esac
14542         case "$more" in
14543         /*) dflt=$more;;
14544         [a-zA-Z]:/*) dflt=$more;;
14545         esac
14546         case "$less" in
14547         /*) dflt=$less;;
14548         [a-zA-Z]:/*) dflt=$less;;
14549         esac
14550         case "$dflt" in
14551         '') dflt=/usr/ucb/more;;
14552         esac
14553         ;;
14554 *) dflt="$pager";;
14555 esac
14556 echo " "
14557 fn=f/
14558 rp='What pager is used on your system?'
14559 . ./getfile
14560 pager="$ans"
14561
14562 : see what type pids are declared as in the kernel
14563 rp="What is the type of process ids on this system?"
14564 set pid_t pidtype int stdio.h sys/types.h
14565 eval $typedef_ask
14566
14567 : Find earliest binary compatible site_perl subdirectory perl can use.
14568 case "$bincompat5005" in
14569 "$define") xs_apiversion='5.005' ;;
14570 *) xs_apiversion=$version ;;   # The current site_perl version.
14571 esac
14572 : Find earliest pure perl site_perl subdirectory perl can use.
14573 : The versioned directories started at 5.005.
14574 pm_apiversion='5.005'
14575
14576 : see if ar generates random libraries by itself
14577 echo " "
14578 echo "Checking how to generate random libraries on your machine..." >&4
14579 echo 'int bar1() { return bar2(); }' > bar1.c
14580 echo 'int bar2() { return 2; }' > bar2.c
14581 $cat > foo.c <<'EOP'
14582 int main() { printf("%d\n", bar1()); exit(0); }
14583 EOP
14584 $cc $ccflags -c bar1.c >/dev/null 2>&1
14585 $cc $ccflags -c bar2.c >/dev/null 2>&1
14586 $cc $ccflags -c foo.c >/dev/null 2>&1
14587 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14588 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14589         ./foobar >/dev/null 2>&1; then
14590         echo "$ar appears to generate random libraries itself."
14591         orderlib=false
14592         ranlib=":"
14593 elif $ar ts bar$_a >/dev/null 2>&1 &&
14594         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14595         ./foobar >/dev/null 2>&1; then
14596                 echo "a table of contents needs to be added with '$ar ts'."
14597                 orderlib=false
14598                 ranlib="$ar ts"
14599 else
14600         case "$ranlib" in
14601         :) ranlib='';;
14602         '')
14603                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14604                 $test -f $ranlib || ranlib=''
14605                 ;;
14606         esac
14607         if $test -n "$ranlib"; then
14608                 echo "your system has '$ranlib'; we'll use that."
14609                 orderlib=false
14610         else
14611                 echo "your system doesn't seem to support random libraries"
14612                 echo "so we'll use lorder and tsort to order the libraries."
14613                 orderlib=true
14614                 ranlib=":"
14615         fi
14616 fi
14617 $rm -f foo* bar* 
14618
14619 : check for type of arguments to select. 
14620 case "$selecttype" in
14621 '') case "$d_select" in
14622         $define)
14623                 echo " "
14624                 $cat <<EOM
14625 Checking to see what type of arguments are accepted by select().
14626 EOM
14627                 hdrs="$define sys/types.h
14628                         $i_systime sys/time.h 
14629                         $i_sysselct sys/select.h
14630                         $d_socket sys/socket.h"
14631                 : The first arg can be int, unsigned, or size_t
14632                 : The last arg may or may not be 'const'
14633                 val=''
14634                 : void pointer has been seen but using that
14635                 : breaks the selectminbits test
14636                 for xxx in 'fd_set *' 'int *'; do
14637                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14638                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14639                                         case "$val" in
14640                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14641                                                 if ./protochk "$try" $hdrs; then
14642                                                         echo "Your system accepts $xxx."
14643                                                         val="$xxx"
14644                                                 fi
14645                                                 ;;
14646                                         esac
14647                                 done
14648                         done
14649                 done
14650                 case "$val" in
14651                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14652                         case "$d_fd_set" in
14653                                 $define) dflt="fd_set *" ;;
14654                                 *)              dflt="int *" ;;
14655                         esac
14656                         . ./myread
14657                         val=$ans
14658                         ;;
14659                 esac
14660                 selecttype="$val"
14661                 ;;
14662         *)      : no select, so pick a harmless default
14663                 selecttype='int *'
14664                 ;;
14665         esac
14666         ;;
14667 esac
14668
14669 : check for the select 'width'
14670 case "$selectminbits" in
14671 '') case "$d_select" in
14672         $define)
14673                 $cat <<EOM
14674
14675 Checking to see on how many bits at a time your select() operates...
14676 EOM
14677                 $cat >try.c <<EOCP
14678 #include <sys/types.h>
14679 #$i_time I_TIME
14680 #$i_systime I_SYS_TIME
14681 #$i_systimek I_SYS_TIME_KERNEL
14682 #ifdef I_TIME
14683 #   include <time.h>
14684 #endif
14685 #ifdef I_SYS_TIME
14686 #   ifdef I_SYS_TIME_KERNEL
14687 #       define KERNEL
14688 #   endif
14689 #   include <sys/time.h>
14690 #   ifdef I_SYS_TIME_KERNEL
14691 #       undef KERNEL
14692 #   endif
14693 #endif
14694 #$i_sysselct I_SYS_SELECT
14695 #ifdef I_SYS_SELECT
14696 #include <sys/select.h>
14697 #endif
14698 #$d_socket HAS_SOCKET
14699 #ifdef HAS_SOCKET
14700 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14701 #endif
14702 #include <stdio.h>
14703 $selecttype b;
14704 #define S sizeof(*(b))
14705 #define MINBITS 64
14706 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14707 #define NBITS  (NBYTES * 8)
14708 int main() {
14709     char s[NBYTES];
14710     struct timeval t;
14711     int i;
14712     FILE* fp;
14713     int fd;
14714
14715     fclose(stdin);
14716     fp = fopen("try.c", "r");
14717     if (fp == 0)
14718       exit(1);
14719     fd = fileno(fp);
14720     if (fd < 0)
14721       exit(2);
14722     b = ($selecttype)s;
14723     for (i = 0; i < NBITS; i++)
14724         FD_SET(i, b);
14725     t.tv_sec  = 0;
14726     t.tv_usec = 0;
14727     select(fd + 1, b, 0, 0, &t);
14728     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14729     printf("%d\n", i + 1);
14730     return 0;
14731 }
14732 EOCP
14733                 set try
14734                 if eval $compile_ok; then
14735                         selectminbits=`./try`
14736                         case "$selectminbits" in
14737                         '')     cat >&4 <<EOM
14738 Cannot figure out on how many bits at a time your select() operates.
14739 I'll play safe and guess it is 32 bits.
14740 EOM
14741                                 selectminbits=32
14742                                 bits="32 bits"
14743                                 ;;
14744                         1)      bits="1 bit" ;;
14745                         *)      bits="$selectminbits bits" ;;
14746                         esac
14747                         echo "Your select() operates on $bits at a time." >&4
14748                 else
14749                         rp='What is the minimum number of bits your select() operates on?'
14750                         case "$byteorder" in
14751                         1234|12345678)  dflt=32 ;;
14752                         *)              dflt=1  ;;
14753                         esac
14754                         . ./myread
14755                         val=$ans
14756                         selectminbits="$val"
14757                 fi
14758                 $rm -f try.* try
14759                 ;;
14760         *)      : no select, so pick a harmless default
14761                 selectminbits='32'
14762                 ;;
14763         esac
14764         ;;
14765 esac
14766
14767 : Trace out the files included by signal.h, then look for SIGxxx names.
14768 : Remove SIGARRAYSIZE used by HPUX.
14769 : Remove SIGSTKSIZE used by Linux.
14770 : Remove SIGSTKSZ used by Posix.
14771 : Remove SIGTYP void lines used by OS2.
14772 : Some cpps, like os390, dont give the file name anywhere
14773 if [ "X$fieldn" = X ]; then
14774         : Just make some guesses.  We check them later.
14775         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14776 else
14777         xxx=`echo '#include <signal.h>' |
14778         $cppstdin $cppminus $cppflags 2>/dev/null |
14779         $grep '^[       ]*#.*include' | 
14780         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14781 fi
14782 : Check this list of files to be sure we have parsed the cpp output ok.
14783 : This will also avoid potentially non-existent files, such 
14784 : as ../foo/bar.h
14785 xxxfiles=''
14786 for xx in $xxx /dev/null ; do
14787         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14788 done
14789 : If we have found no files, at least try signal.h
14790 case "$xxxfiles" in
14791 '')     xxxfiles=`./findhdr signal.h` ;;
14792 esac
14793 xxx=`awk '
14794 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14795         print substr($2, 4, 20)
14796 }
14797 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14798         print substr($3, 4, 20)
14799 }' $xxxfiles`
14800 : Append some common names just in case the awk scan failed.
14801 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14802 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14803 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14804 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14805 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14806
14807 : generate a few handy files for later
14808 $cat > signal.c <<'EOCP'
14809 #include <sys/types.h>
14810 #include <signal.h>
14811 #include <stdio.h>
14812 int main() {
14813
14814 /* Strange style to avoid deeply-nested #if/#else/#endif */
14815 #ifndef NSIG
14816 #  ifdef _NSIG
14817 #    define NSIG (_NSIG)
14818 #  endif
14819 #endif
14820
14821 #ifndef NSIG
14822 #  ifdef SIGMAX
14823 #    define NSIG (SIGMAX+1)
14824 #  endif
14825 #endif
14826
14827 #ifndef NSIG
14828 #  ifdef SIG_MAX
14829 #    define NSIG (SIG_MAX+1)
14830 #  endif
14831 #endif
14832
14833 #ifndef NSIG
14834 #  ifdef MAXSIG
14835 #    define NSIG (MAXSIG+1)
14836 #  endif
14837 #endif
14838
14839 #ifndef NSIG
14840 #  ifdef MAX_SIG
14841 #    define NSIG (MAX_SIG+1)
14842 #  endif
14843 #endif
14844
14845 #ifndef NSIG
14846 #  ifdef SIGARRAYSIZE
14847 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14848 #  endif
14849 #endif
14850
14851 #ifndef NSIG
14852 #  ifdef _sys_nsig
14853 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14854 #  endif
14855 #endif
14856
14857 /* Default to some arbitrary number that's big enough to get most
14858    of the common signals.
14859 */
14860 #ifndef NSIG
14861 #    define NSIG 50
14862 #endif
14863
14864 printf("NSIG %d\n", NSIG);
14865
14866 #ifndef JUST_NSIG
14867
14868 EOCP
14869
14870 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14871 {
14872         printf "#ifdef SIG"; printf $1; printf "\n"
14873         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14874         printf $1; printf ");\n"
14875         printf "#endif\n"
14876 }
14877 END {
14878         printf "#endif /* JUST_NSIG */\n";
14879         printf "exit(0);\n}\n";
14880 }
14881 ' >>signal.c
14882 $cat >signal.awk <<'EOP'
14883 BEGIN { ndups = 0 }
14884 $1 ~ /^NSIG$/ { nsig = $2 }
14885 ($1 !~ /^NSIG$/) && (NF == 2) {
14886     if ($2 > maxsig) { maxsig = $2 }
14887     if (sig_name[$2]) {
14888         dup_name[ndups] = $1
14889         dup_num[ndups] = $2
14890         ndups++ 
14891     }
14892     else {
14893         sig_name[$2] = $1
14894         sig_num[$2] = $2
14895     }
14896 }
14897 END { 
14898     if (nsig == 0) {
14899         nsig = maxsig + 1
14900     }
14901     printf("NSIG %d\n", nsig);
14902     for (n = 1; n < nsig; n++) {
14903         if (sig_name[n]) {
14904             printf("%s %d\n", sig_name[n], sig_num[n])
14905         }
14906         else {
14907             printf("NUM%d %d\n", n, n) 
14908         }
14909     }
14910     for (n = 0; n < ndups; n++) {
14911         printf("%s %d\n", dup_name[n], dup_num[n])
14912     }
14913 }
14914 EOP
14915 $cat >signal_cmd <<EOS
14916 $startsh
14917 if $test -s signal.lst; then
14918     echo "Using your existing signal.lst file"
14919         exit 0
14920 fi
14921 xxx="$xxx"
14922 EOS
14923 $cat >>signal_cmd <<'EOS'
14924
14925 set signal
14926 if eval $compile_ok; then
14927         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14928 else
14929         echo "(I can't seem be able to compile the whole test program)" >&4
14930         echo "(I'll try it in little pieces.)" >&4
14931         set signal -DJUST_NSIG
14932         if eval $compile_ok; then
14933                 ./signal$_exe > signal.nsg
14934                 $cat signal.nsg
14935         else
14936                 echo "I can't seem to figure out how many signals you have." >&4
14937                 echo "Guessing 50." >&4
14938                 echo 'NSIG 50' > signal.nsg
14939         fi
14940         : Now look at all the signal names, one at a time.
14941         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14942                 $cat > signal.c <<EOCP
14943 #include <sys/types.h>
14944 #include <signal.h>
14945 #include <stdio.h>
14946 int main() {
14947 printf("$xx %d\n", SIG${xx});
14948 return 0;
14949 }
14950 EOCP
14951                 set signal
14952                 if eval $compile; then
14953                         echo "SIG${xx} found."
14954                         ./signal$_exe  >> signal.ls1
14955                 else
14956                         echo "SIG${xx} NOT found."
14957                 fi
14958         done
14959         if $test -s signal.ls1; then
14960                 $cat signal.nsg signal.ls1 |
14961                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14962         fi
14963
14964 fi
14965 if $test -s signal.lst; then
14966         :
14967 else
14968         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14969         echo 'kill -l' >signal
14970         set X `csh -f <signal`
14971         $rm -f signal
14972         shift
14973         case $# in
14974         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14975         esac
14976         echo $@ | $tr ' ' $trnl | \
14977             $awk '{ printf "%s %d\n", $1, ++s; }
14978                   END { printf "NSIG %d\n", ++s }' >signal.lst
14979 fi
14980 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14981 EOS
14982 chmod a+x signal_cmd
14983 $eunicefix signal_cmd
14984
14985 : generate list of signal names
14986 echo " "
14987 case "$sig_name_init" in
14988 '') doinit=yes ;;
14989 *)  case "$sig_num_init" in
14990     ''|*,*) doinit=yes ;;
14991     esac ;;
14992 esac
14993 case "$doinit" in
14994 yes)
14995         echo "Generating a list of signal names and numbers..." >&4
14996         . ./signal_cmd
14997         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14998         sig_name=`$awk 'BEGIN { printf "ZERO " }
14999                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15000         sig_num=`$awk  'BEGIN { printf "0 " }
15001                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15002         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15003                              !/^NSIG/   { printf "\"%s\", ", $1 }
15004                              END        { printf "0\n" }' signal.lst`
15005         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15006                              !/^NSIG/   { printf "%d, ", $2}
15007                              END        { printf "0\n"}' signal.lst`
15008         ;;
15009 esac
15010 echo "The following $sig_count signals are available:"
15011 echo " "
15012 echo $sig_name | $awk \
15013 'BEGIN { linelen = 0 }
15014 {
15015         for (i = 1; i <= NF; i++) {
15016                 name = "SIG" $i " "
15017                 linelen = linelen + length(name)
15018                 if (linelen > 70) {
15019                         printf "\n"
15020                         linelen = length(name)
15021                 }
15022                 printf "%s", name
15023         }
15024         printf "\n"
15025 }'
15026 sig_size=`echo $sig_name | awk '{print NF}'`
15027 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15028
15029 echo " "
15030 case "$sizetype" in
15031 *_t) zzz="$sizetype"    ;;
15032 *)   zzz="filesize"     ;;
15033 esac
15034 echo "Checking the size of $zzz..." >&4 
15035 cat > try.c <<EOCP
15036 #include <sys/types.h>
15037 #include <stdio.h>
15038 int main() {
15039     printf("%d\n", (int)sizeof($sizetype));
15040     exit(0);
15041 }
15042 EOCP
15043 set try
15044 if eval $compile_ok; then
15045         yyy=`./try`
15046         case "$yyy" in
15047         '')     sizesize=4
15048                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15049                 ;;
15050         *)      sizesize=$yyy
15051                 echo "Your $zzz size is $sizesize bytes."
15052                 ;;
15053         esac
15054 else
15055         sizesize=4
15056         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15057 fi
15058
15059
15060 : check for socklen_t
15061 echo " "
15062 echo "Checking to see if you have socklen_t..." >&4
15063 $cat >try.c <<EOCP
15064 #include <sys/types.h>
15065 #$d_socket HAS_SOCKET
15066 #ifdef HAS_SOCKET
15067 #include <sys/socket.h>
15068 #endif
15069 int main() { socklen_t x = 16; }
15070 EOCP
15071 set try
15072 if eval $compile; then
15073         val="$define"
15074         echo "You have socklen_t."
15075 else
15076         val="$undef"
15077         echo "You do not have socklen_t."
15078         case "$sizetype" in
15079         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15080         esac
15081 fi
15082 $rm -f try try.*
15083 set d_socklen_t
15084 eval $setvar
15085
15086 : see if this is a socks.h system
15087 set socks.h i_socks
15088 eval $inhdr
15089
15090 : check for type of the size argument to socket calls
15091 case "$d_socket" in
15092 "$define")
15093         $cat <<EOM
15094
15095 Checking to see what type is the last argument of accept().
15096 EOM
15097         yyy=''
15098         case "$d_socklen_t" in
15099         "$define") yyy="$yyy socklen_t"
15100         esac
15101         yyy="$yyy $sizetype int long unsigned"
15102         for xxx in $yyy; do
15103                 case "$socksizetype" in
15104                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15105                         case "$usesocks" in
15106                         "$define")
15107                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15108                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15109                                         socksizetype="$xxx"
15110                                 fi
15111                                 ;;
15112                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15113                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15114                                         socksizetype="$xxx"
15115                                 fi
15116                                 ;;
15117                         esac
15118                         ;;
15119                 esac
15120         done
15121 : In case none of those worked, prompt the user.
15122         case "$socksizetype" in
15123         '')     rp='What is the type for socket address structure sizes?'
15124                 dflt='int'
15125                 . ./myread
15126                 socksizetype=$ans
15127                 ;;
15128         esac
15129         ;;
15130 *)      : no sockets, so pick relatively harmless default
15131         socksizetype='int'
15132         ;;
15133 esac
15134
15135 : see what type is used for signed size_t
15136 set ssize_t ssizetype int stdio.h sys/types.h
15137 eval $typedef
15138 dflt="$ssizetype"
15139 $cat > ssize.c <<EOM
15140 #include <stdio.h>
15141 #include <sys/types.h>
15142 #define Size_t $sizetype
15143 #define SSize_t $dflt
15144 int main()
15145 {
15146         if (sizeof(Size_t) == sizeof(SSize_t))
15147                 printf("$dflt\n");
15148         else if (sizeof(Size_t) == sizeof(int))
15149                 printf("int\n");
15150         else 
15151                 printf("long\n");
15152         exit(0);
15153 }
15154 EOM
15155 echo " "
15156 set ssize
15157 if eval $compile_ok && ./ssize > /dev/null; then
15158         ssizetype=`./ssize`
15159         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15160 else
15161         $cat >&4 <<EOM
15162 Help! I can't compile and run the ssize_t test program: please enlighten me!
15163 (This is probably a misconfiguration in your system or libraries, and
15164 you really ought to fix it.  Still, I'll try anyway.)
15165
15166 I need a type that is the same size as $sizetype, but is guaranteed to
15167 be signed.  Common values are ssize_t, int and long.
15168
15169 EOM
15170         rp="What signed type is the same size as $sizetype?"
15171         . ./myread
15172         ssizetype="$ans"
15173 fi
15174 $rm -f ssize ssize.*
15175
15176 : see what type of char stdio uses.
15177 echo " "
15178 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15179 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15180         echo "Your stdio uses unsigned chars." >&4
15181         stdchar="unsigned char"
15182 else
15183         echo "Your stdio uses signed chars." >&4
15184         stdchar="char"
15185 fi
15186 $rm -f stdioh
15187
15188
15189
15190 : see if time exists
15191 echo " "
15192 if test "X$d_time" = X -o X"$timetype" = X; then
15193     if set time val -f d_time; eval $csym; $val; then
15194                 echo 'time() found.' >&4
15195                 val="$define"
15196                 rp="What is the type returned by time() on this system?"
15197                 set time_t timetype long stdio.h sys/types.h
15198                 eval $typedef_ask
15199     else
15200                 echo 'time() not found, hope that will do.' >&4
15201                 val="$undef"
15202                 timetype='int';
15203     fi
15204     set d_time
15205     eval $setvar
15206 fi
15207
15208 : see what type uids are declared as in the kernel
15209 echo " "
15210 echo "Looking for the type for user ids returned by getuid()."
15211 set uid_t uidtype xxx stdio.h sys/types.h
15212 eval $typedef
15213 case "$uidtype" in
15214 xxx)
15215         xxx=`./findhdr sys/user.h`
15216         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15217         case $1 in
15218         unsigned) dflt="$1 $2" ;;
15219         *) dflt="$1" ;;
15220         esac
15221         ;;
15222 *) dflt="$uidtype";;
15223 esac
15224 case "$uidtype" in
15225 uid_t)  echo "uid_t found." ;;
15226 *)      rp="What is the type for user ids returned by getuid()?"
15227         . ./myread
15228         uidtype="$ans"
15229         ;;
15230 esac
15231
15232 echo " "
15233 case "$uidtype" in
15234 *_t) zzz="$uidtype"     ;;
15235 *)   zzz="uid"          ;;
15236 esac
15237 echo "Checking the size of $zzz..." >&4 
15238 cat > try.c <<EOCP
15239 #include <sys/types.h>
15240 #include <stdio.h>
15241 int main() {
15242     printf("%d\n", (int)sizeof($uidtype));
15243     exit(0);
15244 }
15245 EOCP
15246 set try
15247 if eval $compile_ok; then
15248         yyy=`./try`
15249         case "$yyy" in
15250         '')     uidsize=4
15251                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15252                 ;;
15253         *)      uidsize=$yyy
15254                 echo "Your $zzz is $uidsize bytes long."
15255                 ;;
15256         esac
15257 else
15258         uidsize=4
15259         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15260 fi
15261
15262 echo " "
15263 case "$uidtype" in
15264 *_t) zzz="$uidtype"     ;;
15265 *)   zzz="uid"          ;;
15266 esac
15267 echo "Checking the sign of $zzz..." >&4
15268 cat > try.c <<EOCP
15269 #include <sys/types.h>
15270 #include <stdio.h>
15271 int main() {
15272         $uidtype foo = -1;
15273         if (foo < 0)
15274                 printf("-1\n");
15275         else
15276                 printf("1\n");
15277 }
15278 EOCP
15279 set try
15280 if eval $compile; then
15281         yyy=`./try`
15282         case "$yyy" in
15283         '')     uidsign=1
15284                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15285                 ;;
15286         *)      uidsign=$yyy
15287                 case "$uidsign" in
15288                  1) echo "Your $zzz is unsigned." ;;
15289                 -1) echo "Your $zzz is signed."   ;;
15290                 esac
15291                 ;;
15292         esac
15293 else
15294         uidsign=1
15295         echo "(I can't compile the test program--guessing unsigned.)" >&4
15296 fi
15297
15298
15299
15300 echo " "
15301 $echo "Checking the format string to be used for uids..." >&4
15302
15303 case "$uidsign" in
15304 -1)     if $test X"$uidsize" = X"$ivsize"; then
15305                 uidformat="$ivdformat"
15306         else
15307                 if $test X"$uidsize" = X"$longsize"; then
15308                         uidformat='"ld"'
15309                 else
15310                         if $test X"$uidsize" = X"$intsize"; then
15311                                 uidformat='"d"'
15312                         else
15313                                 if $test X"$uidsize" = X"$shortsize"; then
15314                                         uidformat='"hd"'
15315                                 fi
15316                         fi
15317                 fi
15318         fi
15319         ;;
15320 *)      if $test X"$uidsize" = X"$uvsize"; then
15321                 uidformat="$uvuformat"
15322         else
15323                 if $test X"$uidsize" = X"$longsize"; then
15324                         uidformat='"lu"'
15325                 else
15326                         if $test X"$uidsize" = X"$intsize"; then
15327                                 uidformat='"u"'
15328                         else
15329                                 if $test X"$uidsize" = X"$shortsize"; then
15330                                         uidformat='"hu"'
15331                                 fi
15332                         fi
15333                 fi
15334         fi
15335         ;;
15336 esac
15337
15338 : determine compiler compiler
15339 case "$yacc" in
15340 '')
15341         dflt=yacc;;
15342 *)
15343         dflt="$yacc";;
15344 esac
15345 echo " "
15346 comp='yacc'
15347 if $test -f "$byacc"; then
15348         dflt="$byacc"
15349         comp="byacc or $comp"
15350 fi
15351 if $test -f "$bison"; then
15352         comp="$comp or bison -y"
15353 fi
15354 rp="Which compiler compiler ($comp) shall I use?"
15355 . ./myread
15356 yacc="$ans"
15357 case "$yacc" in
15358 *bis*)
15359         case "$yacc" in
15360         *-y*) ;;
15361         *)
15362                 yacc="$yacc -y"
15363                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15364                 ;;
15365         esac
15366         ;;
15367 esac
15368
15369 : see if fcntl.h is there
15370 val=''
15371 set fcntl.h val
15372 eval $inhdr
15373
15374 : see if we can include fcntl.h
15375 case "$val" in
15376 "$define")
15377         echo " "
15378         if $h_fcntl; then
15379                 val="$define"
15380                 echo "We'll be including <fcntl.h>." >&4
15381         else
15382                 val="$undef"
15383                 if $h_sysfile; then
15384         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15385                 else
15386                         echo "We won't be including <fcntl.h>." >&4
15387                 fi
15388         fi
15389         ;;
15390 *)
15391         h_fcntl=false
15392         val="$undef"
15393         ;;
15394 esac
15395 set i_fcntl
15396 eval $setvar
15397
15398 : see if this is a iconv.h system
15399 set iconv.h i_iconv
15400 eval $inhdr
15401
15402 : see if this is a ieeefp.h system
15403 set ieeefp.h i_ieeefp
15404 eval $inhdr
15405
15406 : see if this is a libutil.h system
15407 set libutil.h i_libutil
15408 eval $inhdr
15409
15410 : see if locale.h is available
15411 set locale.h i_locale
15412 eval $inhdr
15413
15414 : see if mach cthreads are available
15415 if test "X$usethreads" = "X$define"; then
15416         set mach/cthreads.h i_machcthr
15417         eval $inhdr
15418 else
15419         i_machcthr="$undef"
15420 fi
15421
15422
15423
15424 : see if this is a math.h system
15425 set math.h i_math
15426 eval $inhdr
15427
15428 : see if this is a mntent.h system
15429 set mntent.h i_mntent
15430 eval $inhdr
15431
15432 : see if ndbm.h is available
15433 set ndbm.h t_ndbm
15434 eval $inhdr
15435 case "$t_ndbm" in
15436 $define)
15437         : see if dbm_open exists
15438         set dbm_open d_dbm_open
15439         eval $inlibc
15440         case "$d_dbm_open" in
15441         $undef)
15442                 t_ndbm="$undef"
15443                 echo "We won't be including <ndbm.h>"
15444                 ;;
15445         esac
15446         ;;
15447 esac
15448 val="$t_ndbm"
15449 set i_ndbm
15450 eval $setvar
15451
15452 : see if net/errno.h is available
15453 val=''
15454 set net/errno.h val
15455 eval $inhdr
15456
15457 : Unfortunately, it causes problems on some systems.  Arrgh.
15458 case "$val" in
15459 $define)
15460         cat > try.c <<'EOM'
15461 #include <stdio.h>
15462 #include <errno.h>
15463 #include <net/errno.h>
15464 int func()
15465 {
15466         return ENOTSOCK;
15467 }
15468 EOM
15469         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15470                 echo "We'll be including <net/errno.h>." >&4
15471         else
15472                 echo "We won't be including <net/errno.h>." >&4
15473                 val="$undef"
15474         fi
15475         $rm -f try.* try
15476         ;;
15477 esac
15478 set i_neterrno
15479 eval $setvar
15480
15481 : see if netinet/tcp.h is available
15482 set netinet/tcp.h i_netinettcp
15483 eval $inhdr
15484
15485 : see if this is a poll.h system
15486 set poll.h i_poll
15487 eval $inhdr
15488
15489 : see if this is a prot.h system
15490 set prot.h i_prot
15491 eval $inhdr
15492
15493 echo " "
15494 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15495 $cat <<'EOSH' > Cppsym.know
15496 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15497 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15498 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15499 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15500 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15501 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15502 bull c cadmus clipper CMU COFF COMPILER_VERSION
15503 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15504 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15505 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15506 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15507 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15508 H3050R H3050RX hbullx20 hcx host_mips
15509 hp200 hp300 hp700 HP700 hp800 hp9000
15510 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15511 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15512 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15513 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15514 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15515 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15516 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15517 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15518 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15519 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15520 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15521 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15522 MATH_HAS_NO_SIDE_EFFECTS
15523 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15524 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15525 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15526 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15527 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15528 NetBSD news1500 news1700 news1800 news1900 news3700
15529 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15530 ns32016 ns32332 ns32k nsc32000
15531 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15532 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15533 pc532 pdp11 PGC PIC plexus PORTAR posix
15534 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15535 POSIX_C_SOURCE POSIX_SOURCE POWER
15536 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15537 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15538 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15539 sony sony_news sonyrisc sparc sparclite spectrum
15540 stardent stdc STDC_EXT stratos sun sun3 sun386
15541 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15542 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15543 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15544 sysV68 sysV88 Tek4132 Tek4300 titan
15545 TM3200 TM5400 TM5600
15546 tower tower32 tower32_200 tower32_600 tower32_700
15547 tower32_800 tower32_850 tss
15548 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15549 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15550 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15551 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15552 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15553 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15554 z8000
15555 EOSH
15556 # Maybe put other stuff here too.
15557 cat <<EOSH >>Cppsym.know
15558 $osname
15559 EOSH
15560 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15561 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15562 $cat Cppsym.know > Cppsym.c
15563 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15564 $rm -f Cppsym.a Cppsym.b Cppsym.c
15565 cat <<EOSH > Cppsym
15566 $startsh
15567 if $test \$# -gt 0; then
15568     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15569     if $test -s Cppsym.got; then
15570         $rm -f Cppsym.got
15571         exit 0
15572     fi
15573     $rm -f Cppsym.got
15574     exit 1
15575 else
15576     $tr " " "$trnl" | ./Cppsym.try
15577     exit 0
15578 fi
15579 EOSH
15580 chmod +x Cppsym
15581 $eunicefix Cppsym
15582 cat <<EOSH > Cppsym.try
15583 $startsh
15584 cat <<'EOCP' > try.c
15585 #include <stdio.h>
15586 int main() {
15587 EOCP
15588 $awk \\
15589 EOSH
15590 cat <<'EOSH' >> Cppsym.try
15591 'length($1) > 0 {
15592     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15593     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15594     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15595     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15596 }'       >> try.c
15597 echo 'return 0;}' >> try.c
15598 EOSH
15599 cat <<EOSH >> Cppsym.try
15600 ccflags="$ccflags"
15601 case "$osname-$gccversion" in
15602 irix-) ccflags="\$ccflags -woff 1178" ;;
15603 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15604 esac
15605 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15606 EOSH
15607 chmod +x Cppsym.try
15608 $eunicefix Cppsym.try
15609 ./Cppsym < Cppsym.know > Cppsym.true
15610 : now check the C compiler for additional symbols
15611 postprocess_cc_v=''
15612 case "$osname" in
15613 aix) postprocess_cc_v="|$tr , ' '" ;;
15614 esac
15615 $cat >ccsym <<EOS
15616 $startsh
15617 $cat >tmp.c <<EOF
15618 extern int foo;
15619 EOF
15620 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15621 do
15622         case "\$i" in
15623         -D*) echo "\$i" | $sed 's/^-D//';;
15624         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15625         esac
15626 done
15627 $rm -f try.c
15628 EOS
15629 postprocess_cc_v=''
15630 chmod +x ccsym
15631 $eunicefix ccsym
15632 ./ccsym > ccsym1.raw
15633 if $test -s ccsym1.raw; then
15634        $sort ccsym1.raw | $uniq >ccsym.raw
15635 else
15636        mv ccsym1.raw ccsym.raw
15637 fi
15638
15639 $awk '/\=/ { print $0; next }
15640         { print $0"=1" }' ccsym.raw >ccsym.list
15641 $awk '/\=/ { print $0; next }
15642         { print $0"=1" }' Cppsym.true >ccsym.true
15643 $comm -13 ccsym.true ccsym.list >ccsym.own
15644 $comm -12 ccsym.true ccsym.list >ccsym.com
15645 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15646 also=''
15647 if $test -z ccsym.raw; then
15648         echo "Your C compiler doesn't seem to define any symbols!" >&4
15649         echo " "
15650         echo "However, your C preprocessor defines the following symbols:"
15651         $cat Cppsym.true
15652         ccsymbols=''
15653         cppsymbols=`$cat Cppsym.true`
15654         cppsymbols=`echo $cppsymbols`
15655         cppccsymbols="$cppsymbols"
15656 else
15657         if $test -s ccsym.com; then
15658                 echo "Your C compiler and pre-processor define these symbols:"
15659                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15660                 also='also '
15661                 symbols='ones'
15662                 cppccsymbols=`$cat ccsym.com`
15663                 cppccsymbols=`echo $cppccsymbols`
15664                 $test "$silent" || sleep 1
15665         fi
15666         if $test -s ccsym.cpp; then
15667                 $test "$also" && echo " "
15668                 echo "Your C pre-processor ${also}defines the following symbols:"
15669                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15670                 also='further '
15671                 cppsymbols=`$cat ccsym.cpp`
15672                 cppsymbols=`echo $cppsymbols`
15673                 $test "$silent" || sleep 1
15674         fi
15675         if $test -s ccsym.own; then
15676                 $test "$also" && echo " "
15677                 echo "Your C compiler ${also}defines the following cpp symbols:"
15678                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15679                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15680                 ccsymbols=`$cat ccsym.own`
15681                 ccsymbols=`echo $ccsymbols`
15682                 $test "$silent" || sleep 1
15683         fi
15684 fi
15685 $rm -f ccsym* Cppsym.*
15686
15687 : see if this is a termio system
15688 val="$undef"
15689 val2="$undef"
15690 val3="$undef"
15691 if $test `./findhdr termios.h`; then
15692         set tcsetattr i_termios
15693         eval $inlibc
15694         val3="$i_termios"
15695 fi
15696 echo " "
15697 case "$val3" in
15698 "$define") echo "You have POSIX termios.h... good!" >&4;;
15699 *) if ./Cppsym pyr; then
15700                 case "`/bin/universe`" in
15701                 ucb) if $test `./findhdr sgtty.h`; then
15702                                 val2="$define"
15703                                 echo "<sgtty.h> found." >&4
15704                         else
15705                                 echo "System is pyramid with BSD universe."
15706                                 echo "<sgtty.h> not found--you could have problems." >&4
15707                         fi;;
15708                 *) if $test `./findhdr termio.h`; then
15709                                 val="$define"
15710                                 echo "<termio.h> found." >&4
15711                         else
15712                                 echo "System is pyramid with USG universe."
15713                                 echo "<termio.h> not found--you could have problems." >&4
15714                         fi;;
15715                 esac
15716         elif ./usg; then
15717                 if $test `./findhdr termio.h`; then
15718                         echo "<termio.h> found." >&4
15719                         val="$define"
15720                 elif $test `./findhdr sgtty.h`; then
15721                         echo "<sgtty.h> found." >&4
15722                         val2="$define"
15723                 else
15724 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15725                 fi
15726         else
15727                 if $test `./findhdr sgtty.h`; then
15728                         echo "<sgtty.h> found." >&4
15729                         val2="$define"
15730                 elif $test `./findhdr termio.h`; then
15731                         echo "<termio.h> found." >&4
15732                         val="$define"
15733                 else
15734 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15735                 fi
15736         fi;;
15737 esac
15738 set i_termio; eval $setvar
15739 val=$val2; set i_sgtty; eval $setvar
15740 val=$val3; set i_termios; eval $setvar
15741
15742 : see if this is a shadow.h system
15743 set shadow.h i_shadow
15744 eval $inhdr
15745
15746 : see if stddef is available
15747 set stddef.h i_stddef
15748 eval $inhdr
15749
15750 : see if this is a sunmath.h system
15751 set sunmath.h i_sunmath
15752 eval $inhdr
15753
15754 : see if sys/access.h is available
15755 set sys/access.h i_sysaccess
15756 eval $inhdr
15757
15758 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15759 set sys/filio.h i_sysfilio
15760 eval $inhdr
15761 echo " "
15762 if $test `./findhdr sys/ioctl.h`; then
15763         val="$define"
15764         echo '<sys/ioctl.h> found.' >&4
15765 else
15766         val="$undef"
15767         if $test $i_sysfilio = "$define"; then
15768             echo '<sys/ioctl.h> NOT found.' >&4
15769         else
15770                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15771                 $test $i_termio = "$define" && xxx="termio.h"
15772                 $test $i_termios = "$define" && xxx="termios.h"
15773 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15774         fi
15775 fi
15776 set i_sysioctl
15777 eval $setvar
15778
15779 : see if socket ioctl defs are in sys/sockio.h
15780 echo " "
15781 xxx=`./findhdr sys/sockio.h`
15782 if $test "$xxx"; then
15783         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15784                 val="$define"
15785                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15786         else
15787                 val="$undef"
15788                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15789         fi
15790 else
15791         val="$undef"
15792         $cat <<EOM
15793 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15794 EOM
15795 fi
15796 set i_syssockio
15797 eval $setvar
15798
15799
15800 : see if this is a syslog.h system
15801 set syslog.h i_syslog
15802 eval $inhdr
15803
15804
15805 : see if this is a sys/mode.h system
15806 set sys/mode.h i_sysmode
15807 eval $inhdr
15808
15809 : see if sys/resource.h has to be included
15810 set sys/resource.h i_sysresrc
15811 eval $inhdr
15812
15813 : see if sys/security.h is available
15814 set sys/security.h i_syssecrt
15815 eval $inhdr
15816
15817 : see if this is a sys/statvfs.h system
15818 set sys/statvfs.h i_sysstatvfs
15819 eval $inhdr
15820
15821 : see if this is a sys/un.h system
15822 set sys/un.h i_sysun
15823 eval $inhdr
15824
15825
15826 : see if this is a sys/utsname.h system
15827 set sys/utsname.h i_sysutsname
15828 eval $inhdr
15829
15830 : see if this is a syswait system
15831 set sys/wait.h i_syswait
15832 eval $inhdr
15833
15834 : see if this is a ustat.h system
15835 set ustat.h i_ustat
15836 eval $inhdr
15837
15838 : see if this is an utime system
15839 set utime.h i_utime
15840 eval $inhdr
15841
15842 : see if this is a values.h system
15843 set values.h i_values
15844 eval $inhdr
15845
15846 : see if this is a vfork system
15847 case "$d_vfork" in
15848 "$define")
15849         set vfork.h i_vfork
15850         eval $inhdr
15851         ;;
15852 *)
15853         i_vfork="$undef"
15854         ;;
15855 esac
15856
15857 : see if gdbm.h is available
15858 set gdbm.h t_gdbm
15859 eval $inhdr
15860 case "$t_gdbm" in
15861 $define)
15862         : see if gdbm_open exists
15863         set gdbm_open d_gdbm_open
15864         eval $inlibc
15865         case "$d_gdbm_open" in
15866         $undef)
15867                 t_gdbm="$undef"
15868                 echo "We won't be including <gdbm.h>"
15869                 ;;
15870         esac
15871         ;;
15872 esac
15873 val="$t_gdbm"
15874 set i_gdbm
15875 eval $setvar
15876
15877 echo " "
15878 echo "Looking for extensions..." >&4
15879 : If we are using the old config.sh, known_extensions may contain
15880 : old or inaccurate or duplicate values.
15881 known_extensions=''
15882 nonxs_extensions=''
15883 : We do not use find because it might not be available.
15884 : We do not just use MANIFEST because the user may have dropped
15885 : some additional extensions into the source tree and expect them
15886 : to be built.
15887
15888 : Function to recursively find available extensions, ignoring DynaLoader
15889 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15890 find_extensions='
15891     for xxx in *; do
15892        case "$xxx" in
15893            DynaLoader|dynaload) ;;
15894            *)
15895            if $test -f $xxx/$xxx.xs; then
15896                known_extensions="$known_extensions $1$xxx";
15897            elif $test -f $xxx/Makefile.PL; then
15898                nonxs_extensions="$nonxs_extensions $1$xxx";
15899            else
15900                if $test -d $xxx -a $# -lt 10; then
15901                    set $1$xxx/ $*;
15902                    cd $xxx;
15903                    eval $find_extensions;
15904                    cd ..;
15905                    shift;
15906                fi;
15907            fi
15908            ;;
15909        esac;
15910     done'
15911 tdir=`pwd`
15912 cd $rsrc/ext
15913 set X
15914 shift
15915 eval $find_extensions
15916 set X $nonxs_extensions
15917 shift
15918 nonxs_extensions="$*"
15919 set X $known_extensions
15920 shift
15921 known_extensions="$*"
15922 cd $tdir
15923
15924 : Now see which are supported on this system.
15925 avail_ext=''
15926 for xxx in $known_extensions ; do
15927         case "$xxx" in
15928         DB_File|db_file)
15929                 case "$i_db" in
15930                 $define) avail_ext="$avail_ext $xxx" ;;
15931                 esac
15932                 ;;
15933         GDBM_File|gdbm_fil)
15934                 case "$i_gdbm" in 
15935                 $define) avail_ext="$avail_ext $xxx" ;;
15936                 esac
15937                 ;;
15938         NDBM_File|ndbm_fil)
15939                 case "$i_ndbm" in
15940                 $define)
15941                     case "$osname-$use64bitint" in
15942                     hpux-define)
15943                         case "$libs" in
15944                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15945                         esac
15946                         ;;
15947                     *) avail_ext="$avail_ext $xxx" ;;
15948                     esac
15949                     ;;
15950                 esac
15951                 ;;
15952         ODBM_File|odbm_fil) 
15953                 case "${i_dbm}${i_rpcsvcdbm}" in
15954                 *"${define}"*)
15955                     case "$osname-$use64bitint" in
15956                     hpux-define)
15957                         case "$libs" in
15958                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15959                         esac
15960                         ;;
15961                     *) avail_ext="$avail_ext $xxx" ;;
15962                     esac
15963                     ;;
15964                 esac
15965                 ;;
15966         POSIX|posix)
15967                 case "$useposix" in
15968                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15969                 esac
15970                 ;;
15971         Opcode|opcode)
15972                 case "$useopcode" in
15973                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15974                 esac
15975                 ;;
15976         Socket|socket)
15977                 case "$d_socket" in 
15978                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15979                 esac
15980                 ;;
15981         Sys/Syslog|sys/syslog)
15982                 : XXX syslog requires socket
15983                 case "$d_socket" in 
15984                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15985                 esac
15986                 ;;
15987         Thread|thread)
15988                 case "$usethreads" in
15989                 true|$define|y)
15990                         case "$useithreads" in
15991                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
15992                         esac
15993                 esac
15994                 ;;
15995         IPC/SysV|ipc/sysv)
15996                 : XXX Do we need a useipcsysv variable here
15997                 case "${d_msg}${d_sem}${d_shm}" in 
15998                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15999                 esac
16000                 ;;
16001         *)      avail_ext="$avail_ext $xxx"
16002                 ;;
16003         esac
16004 done
16005
16006 set X $avail_ext
16007 shift
16008 avail_ext="$*"
16009
16010 : Now see which nonxs extensions are supported on this system.
16011 : For now assume all are.
16012 nonxs_ext=''
16013 for xxx in $nonxs_extensions ; do
16014         case "$xxx" in
16015         *)      nonxs_ext="$nonxs_ext $xxx"
16016                 ;;
16017         esac
16018 done
16019
16020 set X $nonxs_ext
16021 shift
16022 nonxs_ext="$*"
16023
16024 case $usedl in
16025 $define)
16026         $cat <<EOM
16027 A number of extensions are supplied with $package.  You may choose to
16028 compile these extensions for dynamic loading (the default), compile
16029 them into the $package executable (static loading), or not include
16030 them at all.  Answer "none" to include no extensions.
16031 Note that DynaLoader is always built and need not be mentioned here.
16032
16033 EOM
16034         case "$dynamic_ext" in
16035         '') dflt="$avail_ext" ;;
16036         *)      dflt="$dynamic_ext"
16037                 # Perhaps we are reusing an old out-of-date config.sh.
16038                 case "$hint" in
16039                 previous)
16040                         if test X"$dynamic_ext" != X"$avail_ext"; then
16041                                 $cat <<EOM
16042 NOTICE:  Your previous config.sh list may be incorrect. 
16043 The extensions now available to you are 
16044         ${avail_ext}
16045 but the default list from your previous config.sh is
16046         ${dynamic_ext} 
16047
16048 EOM
16049                         fi
16050                         ;;
16051                 esac
16052                 ;;
16053         esac
16054         case "$dflt" in
16055         '')     dflt=none;;
16056         esac
16057         rp="What extensions do you wish to load dynamically?"
16058         . ./myread
16059         case "$ans" in
16060         none) dynamic_ext=' ' ;;
16061         *) dynamic_ext="$ans" ;;
16062         esac
16063
16064         case "$static_ext" in
16065         '')
16066                 : Exclude those already listed in dynamic linking
16067                 dflt=''
16068                 for xxx in $avail_ext; do
16069                         case " $dynamic_ext " in
16070                         *" $xxx "*) ;;
16071                         *) dflt="$dflt $xxx" ;;
16072                         esac
16073                 done
16074                 set X $dflt
16075                 shift
16076                 dflt="$*"
16077                 ;;
16078         *)  dflt="$static_ext" 
16079                 ;;
16080         esac
16081
16082         case "$dflt" in
16083         '')     dflt=none;;
16084         esac
16085         rp="What extensions do you wish to load statically?"
16086         . ./myread
16087         case "$ans" in
16088         none) static_ext=' ' ;;
16089         *) static_ext="$ans" ;;
16090         esac
16091         ;;
16092 *)
16093         $cat <<EOM
16094 A number of extensions are supplied with $package.  Answer "none" 
16095 to include no extensions. 
16096 Note that DynaLoader is always built and need not be mentioned here.
16097
16098 EOM
16099         case "$static_ext" in
16100         '') dflt="$avail_ext" ;;
16101         *)      dflt="$static_ext"
16102                 # Perhaps we are reusing an old out-of-date config.sh.
16103                 case "$hint" in
16104                 previous)
16105                         if test X"$static_ext" != X"$avail_ext"; then
16106                                 $cat <<EOM
16107 NOTICE:  Your previous config.sh list may be incorrect. 
16108 The extensions now available to you are 
16109         ${avail_ext}
16110 but the default list from your previous config.sh is
16111         ${static_ext} 
16112
16113 EOM
16114                         fi
16115                         ;;
16116                 esac
16117                 ;;
16118         esac
16119         : Exclude those that are not xs extensions
16120         case "$dflt" in
16121         '')     dflt=none;;
16122         esac
16123         rp="What extensions do you wish to include?"
16124         . ./myread
16125         case "$ans" in
16126         none) static_ext=' ' ;;
16127         *) static_ext="$ans" ;;
16128         esac
16129         ;;
16130 esac
16131
16132 set X $dynamic_ext $static_ext $nonxs_ext
16133 shift
16134 extensions="$*"
16135
16136 : Remove libraries needed only for extensions
16137 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16138 : The exception is SunOS 4.x, which needs them.
16139 case "${osname}X${osvers}" in
16140 sunos*X4*)
16141     perllibs="$libs"
16142     ;;
16143 *) case "$usedl" in
16144     $define|true|[yY]*)
16145             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16146             shift
16147             perllibs="$*"
16148             ;;
16149     *)  perllibs="$libs"
16150             ;;
16151     esac
16152     ;;
16153 esac
16154
16155 : Remove build directory name from cppstdin so it can be used from
16156 : either the present location or the final installed location.
16157 echo " "
16158 : Get out of the UU directory to get correct path name.
16159 cd ..
16160 case "$cppstdin" in
16161 `pwd`/cppstdin)
16162         echo "Stripping down cppstdin path name"
16163         cppstdin=cppstdin
16164         ;;
16165 esac
16166 cd UU
16167
16168 : end of configuration questions
16169 echo " "
16170 echo "End of configuration questions."
16171 echo " "
16172
16173 : back to where it started
16174 if test -d ../UU; then
16175         cd ..
16176 fi
16177
16178 : configuration may be patched via a 'config.over' file
16179 if $test -f config.over; then
16180         echo " "
16181         dflt=y
16182         rp='I see a config.over file.  Do you wish to load it?'
16183         . UU/myread
16184         case "$ans" in
16185         n*) echo "OK, I'll ignore it.";;
16186         *)      . ./config.over
16187                 echo "Configuration override changes have been loaded."
16188                 ;;
16189         esac
16190 fi
16191
16192 : in case they want portability, strip down executable paths
16193 case "$d_portable" in
16194 "$define")
16195         echo " "
16196         echo "Stripping down executable paths..." >&4
16197         for file in $loclist $trylist; do
16198                 eval temp=\$$file
16199                 eval $file=`basename $temp`
16200         done
16201         ;;
16202 esac
16203
16204 : create config.sh file
16205 echo " "
16206 echo "Creating config.sh..." >&4
16207 $spitshell <<EOT >config.sh
16208 $startsh
16209 #
16210 # This file was produced by running the Configure script. It holds all the
16211 # definitions figured out by Configure. Should you modify one of these values,
16212 # do not forget to propagate your changes by running "Configure -der". You may
16213 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16214 #
16215
16216 # Package name      : $package
16217 # Source directory  : $src
16218 # Configuration time: $cf_time
16219 # Configured by     : $cf_by
16220 # Target system     : $myuname
16221
16222 Author='$Author'
16223 Date='$Date'
16224 Header='$Header'
16225 Id='$Id'
16226 Locker='$Locker'
16227 Log='$Log'
16228 Mcc='$Mcc'
16229 RCSfile='$RCSfile'
16230 Revision='$Revision'
16231 Source='$Source'
16232 State='$State'
16233 _a='$_a'
16234 _exe='$_exe'
16235 _o='$_o'
16236 afs='$afs'
16237 afsroot='$afsroot'
16238 alignbytes='$alignbytes'
16239 ansi2knr='$ansi2knr'
16240 aphostname='$aphostname'
16241 api_revision='$api_revision'
16242 api_subversion='$api_subversion'
16243 api_version='$api_version'
16244 api_versionstring='$api_versionstring'
16245 ar='$ar'
16246 archlib='$archlib'
16247 archlibexp='$archlibexp'
16248 archname64='$archname64'
16249 archname='$archname'
16250 archobjs='$archobjs'
16251 awk='$awk'
16252 baserev='$baserev'
16253 bash='$bash'
16254 bin='$bin'
16255 bincompat5005='$bincompat5005'
16256 binexp='$binexp'
16257 bison='$bison'
16258 byacc='$byacc'
16259 byteorder='$byteorder'
16260 c='$c'
16261 castflags='$castflags'
16262 cat='$cat'
16263 cc='$cc'
16264 cccdlflags='$cccdlflags'
16265 ccdlflags='$ccdlflags'
16266 ccflags='$ccflags'
16267 ccflags_uselargefiles='$ccflags_uselargefiles'
16268 ccname='$ccname'
16269 ccsymbols='$ccsymbols'
16270 ccversion='$ccversion'
16271 cf_by='$cf_by'
16272 cf_email='$cf_email'
16273 cf_time='$cf_time'
16274 charsize='$charsize'
16275 chgrp='$chgrp'
16276 chmod='$chmod'
16277 chown='$chown'
16278 clocktype='$clocktype'
16279 comm='$comm'
16280 compress='$compress'
16281 contains='$contains'
16282 cp='$cp'
16283 cpio='$cpio'
16284 cpp='$cpp'
16285 cpp_stuff='$cpp_stuff'
16286 cppccsymbols='$cppccsymbols'
16287 cppflags='$cppflags'
16288 cpplast='$cpplast'
16289 cppminus='$cppminus'
16290 cpprun='$cpprun'
16291 cppstdin='$cppstdin'
16292 cppsymbols='$cppsymbols'
16293 crosscompile='$crosscompile'
16294 cryptlib='$cryptlib'
16295 csh='$csh'
16296 d_Gconvert='$d_Gconvert'
16297 d_PRIEUldbl='$d_PRIEUldbl'
16298 d_PRIFUldbl='$d_PRIFUldbl'
16299 d_PRIGUldbl='$d_PRIGUldbl'
16300 d_PRIXU64='$d_PRIXU64'
16301 d_PRId64='$d_PRId64'
16302 d_PRIeldbl='$d_PRIeldbl'
16303 d_PRIfldbl='$d_PRIfldbl'
16304 d_PRIgldbl='$d_PRIgldbl'
16305 d_PRIi64='$d_PRIi64'
16306 d_PRIo64='$d_PRIo64'
16307 d_PRIu64='$d_PRIu64'
16308 d_PRIx64='$d_PRIx64'
16309 d_SCNfldbl='$d_SCNfldbl'
16310 d__fwalk='$d__fwalk'
16311 d_access='$d_access'
16312 d_accessx='$d_accessx'
16313 d_alarm='$d_alarm'
16314 d_archlib='$d_archlib'
16315 d_atolf='$d_atolf'
16316 d_atoll='$d_atoll'
16317 d_attribut='$d_attribut'
16318 d_bcmp='$d_bcmp'
16319 d_bcopy='$d_bcopy'
16320 d_bincompat5005='$d_bincompat5005'
16321 d_bsd='$d_bsd'
16322 d_bsdgetpgrp='$d_bsdgetpgrp'
16323 d_bsdsetpgrp='$d_bsdsetpgrp'
16324 d_bzero='$d_bzero'
16325 d_casti32='$d_casti32'
16326 d_castneg='$d_castneg'
16327 d_charvspr='$d_charvspr'
16328 d_chown='$d_chown'
16329 d_chroot='$d_chroot'
16330 d_chsize='$d_chsize'
16331 d_closedir='$d_closedir'
16332 d_cmsghdr_s='$d_cmsghdr_s'
16333 d_const='$d_const'
16334 d_crypt='$d_crypt'
16335 d_csh='$d_csh'
16336 d_cuserid='$d_cuserid'
16337 d_dbl_dig='$d_dbl_dig'
16338 d_dbminitproto='$d_dbminitproto'
16339 d_difftime='$d_difftime'
16340 d_dirnamlen='$d_dirnamlen'
16341 d_dlerror='$d_dlerror'
16342 d_dlopen='$d_dlopen'
16343 d_dlsymun='$d_dlsymun'
16344 d_dosuid='$d_dosuid'
16345 d_drand48proto='$d_drand48proto'
16346 d_dup2='$d_dup2'
16347 d_eaccess='$d_eaccess'
16348 d_endgrent='$d_endgrent'
16349 d_endhent='$d_endhent'
16350 d_endnent='$d_endnent'
16351 d_endpent='$d_endpent'
16352 d_endpwent='$d_endpwent'
16353 d_endsent='$d_endsent'
16354 d_eofnblk='$d_eofnblk'
16355 d_eunice='$d_eunice'
16356 d_fchmod='$d_fchmod'
16357 d_fchown='$d_fchown'
16358 d_fcntl='$d_fcntl'
16359 d_fcntl_can_lock='$d_fcntl_can_lock'
16360 d_fd_macros='$d_fd_macros'
16361 d_fd_set='$d_fd_set'
16362 d_fds_bits='$d_fds_bits'
16363 d_fgetpos='$d_fgetpos'
16364 d_flexfnam='$d_flexfnam'
16365 d_flock='$d_flock'
16366 d_flockproto='$d_flockproto'
16367 d_fork='$d_fork'
16368 d_fpathconf='$d_fpathconf'
16369 d_fpos64_t='$d_fpos64_t'
16370 d_frexpl='$d_frexpl'
16371 d_fs_data_s='$d_fs_data_s'
16372 d_fseeko='$d_fseeko'
16373 d_fsetpos='$d_fsetpos'
16374 d_fstatfs='$d_fstatfs'
16375 d_fstatvfs='$d_fstatvfs'
16376 d_fsync='$d_fsync'
16377 d_ftello='$d_ftello'
16378 d_ftime='$d_ftime'
16379 d_getcwd='$d_getcwd'
16380 d_getespwnam='$d_getespwnam'
16381 d_getfsstat='$d_getfsstat'
16382 d_getgrent='$d_getgrent'
16383 d_getgrps='$d_getgrps'
16384 d_gethbyaddr='$d_gethbyaddr'
16385 d_gethbyname='$d_gethbyname'
16386 d_gethent='$d_gethent'
16387 d_gethname='$d_gethname'
16388 d_gethostprotos='$d_gethostprotos'
16389 d_getitimer='$d_getitimer'
16390 d_getlogin='$d_getlogin'
16391 d_getmnt='$d_getmnt'
16392 d_getmntent='$d_getmntent'
16393 d_getnbyaddr='$d_getnbyaddr'
16394 d_getnbyname='$d_getnbyname'
16395 d_getnent='$d_getnent'
16396 d_getnetprotos='$d_getnetprotos'
16397 d_getpagsz='$d_getpagsz'
16398 d_getpbyname='$d_getpbyname'
16399 d_getpbynumber='$d_getpbynumber'
16400 d_getpent='$d_getpent'
16401 d_getpgid='$d_getpgid'
16402 d_getpgrp2='$d_getpgrp2'
16403 d_getpgrp='$d_getpgrp'
16404 d_getppid='$d_getppid'
16405 d_getprior='$d_getprior'
16406 d_getprotoprotos='$d_getprotoprotos'
16407 d_getprpwnam='$d_getprpwnam'
16408 d_getpwent='$d_getpwent'
16409 d_getsbyname='$d_getsbyname'
16410 d_getsbyport='$d_getsbyport'
16411 d_getsent='$d_getsent'
16412 d_getservprotos='$d_getservprotos'
16413 d_getspnam='$d_getspnam'
16414 d_gettimeod='$d_gettimeod'
16415 d_gnulibc='$d_gnulibc'
16416 d_grpasswd='$d_grpasswd'
16417 d_hasmntopt='$d_hasmntopt'
16418 d_htonl='$d_htonl'
16419 d_iconv='$d_iconv'
16420 d_index='$d_index'
16421 d_inetaton='$d_inetaton'
16422 d_int64_t='$d_int64_t'
16423 d_isascii='$d_isascii'
16424 d_isnan='$d_isnan'
16425 d_isnanl='$d_isnanl'
16426 d_killpg='$d_killpg'
16427 d_lchown='$d_lchown'
16428 d_ldbl_dig='$d_ldbl_dig'
16429 d_link='$d_link'
16430 d_locconv='$d_locconv'
16431 d_lockf='$d_lockf'
16432 d_longdbl='$d_longdbl'
16433 d_longlong='$d_longlong'
16434 d_lseekproto='$d_lseekproto'
16435 d_lstat='$d_lstat'
16436 d_madvise='$d_madvise'
16437 d_mblen='$d_mblen'
16438 d_mbstowcs='$d_mbstowcs'
16439 d_mbtowc='$d_mbtowc'
16440 d_memchr='$d_memchr'
16441 d_memcmp='$d_memcmp'
16442 d_memcpy='$d_memcpy'
16443 d_memmove='$d_memmove'
16444 d_memset='$d_memset'
16445 d_mkdir='$d_mkdir'
16446 d_mkdtemp='$d_mkdtemp'
16447 d_mkfifo='$d_mkfifo'
16448 d_mkstemp='$d_mkstemp'
16449 d_mkstemps='$d_mkstemps'
16450 d_mktime='$d_mktime'
16451 d_mmap='$d_mmap'
16452 d_modfl='$d_modfl'
16453 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16454 d_mprotect='$d_mprotect'
16455 d_msg='$d_msg'
16456 d_msg_ctrunc='$d_msg_ctrunc'
16457 d_msg_dontroute='$d_msg_dontroute'
16458 d_msg_oob='$d_msg_oob'
16459 d_msg_peek='$d_msg_peek'
16460 d_msg_proxy='$d_msg_proxy'
16461 d_msgctl='$d_msgctl'
16462 d_msgget='$d_msgget'
16463 d_msghdr_s='$d_msghdr_s'
16464 d_msgrcv='$d_msgrcv'
16465 d_msgsnd='$d_msgsnd'
16466 d_msync='$d_msync'
16467 d_munmap='$d_munmap'
16468 d_mymalloc='$d_mymalloc'
16469 d_nice='$d_nice'
16470 d_nv_preserves_uv='$d_nv_preserves_uv'
16471 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16472 d_off64_t='$d_off64_t'
16473 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16474 d_oldpthreads='$d_oldpthreads'
16475 d_oldsock='$d_oldsock'
16476 d_open3='$d_open3'
16477 d_pathconf='$d_pathconf'
16478 d_pause='$d_pause'
16479 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16480 d_phostname='$d_phostname'
16481 d_pipe='$d_pipe'
16482 d_poll='$d_poll'
16483 d_portable='$d_portable'
16484 d_pthread_yield='$d_pthread_yield'
16485 d_pwage='$d_pwage'
16486 d_pwchange='$d_pwchange'
16487 d_pwclass='$d_pwclass'
16488 d_pwcomment='$d_pwcomment'
16489 d_pwexpire='$d_pwexpire'
16490 d_pwgecos='$d_pwgecos'
16491 d_pwpasswd='$d_pwpasswd'
16492 d_pwquota='$d_pwquota'
16493 d_qgcvt='$d_qgcvt'
16494 d_quad='$d_quad'
16495 d_readdir='$d_readdir'
16496 d_readlink='$d_readlink'
16497 d_readv='$d_readv'
16498 d_realpath='$d_realpath'
16499 d_recvmsg='$d_recvmsg'
16500 d_rename='$d_rename'
16501 d_rewinddir='$d_rewinddir'
16502 d_rmdir='$d_rmdir'
16503 d_safebcpy='$d_safebcpy'
16504 d_safemcpy='$d_safemcpy'
16505 d_sanemcmp='$d_sanemcmp'
16506 d_sbrkproto='$d_sbrkproto'
16507 d_sched_yield='$d_sched_yield'
16508 d_scm_rights='$d_scm_rights'
16509 d_seekdir='$d_seekdir'
16510 d_select='$d_select'
16511 d_sem='$d_sem'
16512 d_semctl='$d_semctl'
16513 d_semctl_semid_ds='$d_semctl_semid_ds'
16514 d_semctl_semun='$d_semctl_semun'
16515 d_semget='$d_semget'
16516 d_semop='$d_semop'
16517 d_sendmsg='$d_sendmsg'
16518 d_setegid='$d_setegid'
16519 d_seteuid='$d_seteuid'
16520 d_setgrent='$d_setgrent'
16521 d_setgrps='$d_setgrps'
16522 d_sethent='$d_sethent'
16523 d_setitimer='$d_setitimer'
16524 d_setlinebuf='$d_setlinebuf'
16525 d_setlocale='$d_setlocale'
16526 d_setnent='$d_setnent'
16527 d_setpent='$d_setpent'
16528 d_setpgid='$d_setpgid'
16529 d_setpgrp2='$d_setpgrp2'
16530 d_setpgrp='$d_setpgrp'
16531 d_setprior='$d_setprior'
16532 d_setproctitle='$d_setproctitle'
16533 d_setpwent='$d_setpwent'
16534 d_setregid='$d_setregid'
16535 d_setresgid='$d_setresgid'
16536 d_setresuid='$d_setresuid'
16537 d_setreuid='$d_setreuid'
16538 d_setrgid='$d_setrgid'
16539 d_setruid='$d_setruid'
16540 d_setsent='$d_setsent'
16541 d_setsid='$d_setsid'
16542 d_setvbuf='$d_setvbuf'
16543 d_sfio='$d_sfio'
16544 d_shm='$d_shm'
16545 d_shmat='$d_shmat'
16546 d_shmatprototype='$d_shmatprototype'
16547 d_shmctl='$d_shmctl'
16548 d_shmdt='$d_shmdt'
16549 d_shmget='$d_shmget'
16550 d_sigaction='$d_sigaction'
16551 d_sigprocmask='$d_sigprocmask'
16552 d_sigsetjmp='$d_sigsetjmp'
16553 d_sockatmark='$d_sockatmark'
16554 d_sockatmarkproto='$d_sockatmarkproto'
16555 d_socket='$d_socket'
16556 d_socklen_t='$d_socklen_t'
16557 d_sockpair='$d_sockpair'
16558 d_socks5_init='$d_socks5_init'
16559 d_sqrtl='$d_sqrtl'
16560 d_sresgproto='$d_sresgproto'
16561 d_sresuproto='$d_sresuproto'
16562 d_statblks='$d_statblks'
16563 d_statfs_f_flags='$d_statfs_f_flags'
16564 d_statfs_s='$d_statfs_s'
16565 d_statvfs='$d_statvfs'
16566 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16567 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16568 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16569 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16570 d_stdio_stream_array='$d_stdio_stream_array'
16571 d_stdiobase='$d_stdiobase'
16572 d_stdstdio='$d_stdstdio'
16573 d_strchr='$d_strchr'
16574 d_strcoll='$d_strcoll'
16575 d_strctcpy='$d_strctcpy'
16576 d_strerrm='$d_strerrm'
16577 d_strerror='$d_strerror'
16578 d_strftime='$d_strftime'
16579 d_strtod='$d_strtod'
16580 d_strtol='$d_strtol'
16581 d_strtold='$d_strtold'
16582 d_strtoll='$d_strtoll'
16583 d_strtoq='$d_strtoq'
16584 d_strtoul='$d_strtoul'
16585 d_strtoull='$d_strtoull'
16586 d_strtouq='$d_strtouq'
16587 d_strxfrm='$d_strxfrm'
16588 d_suidsafe='$d_suidsafe'
16589 d_symlink='$d_symlink'
16590 d_syscall='$d_syscall'
16591 d_syscallproto='$d_syscallproto'
16592 d_sysconf='$d_sysconf'
16593 d_sysernlst='$d_sysernlst'
16594 d_syserrlst='$d_syserrlst'
16595 d_system='$d_system'
16596 d_tcgetpgrp='$d_tcgetpgrp'
16597 d_tcsetpgrp='$d_tcsetpgrp'
16598 d_telldir='$d_telldir'
16599 d_telldirproto='$d_telldirproto'
16600 d_time='$d_time'
16601 d_times='$d_times'
16602 d_truncate='$d_truncate'
16603 d_tzname='$d_tzname'
16604 d_u32align='$d_u32align'
16605 d_ualarm='$d_ualarm'
16606 d_umask='$d_umask'
16607 d_uname='$d_uname'
16608 d_union_semun='$d_union_semun'
16609 d_usleep='$d_usleep'
16610 d_usleepproto='$d_usleepproto'
16611 d_ustat='$d_ustat'
16612 d_vendorarch='$d_vendorarch'
16613 d_vendorbin='$d_vendorbin'
16614 d_vendorlib='$d_vendorlib'
16615 d_vfork='$d_vfork'
16616 d_void_closedir='$d_void_closedir'
16617 d_voidsig='$d_voidsig'
16618 d_voidtty='$d_voidtty'
16619 d_volatile='$d_volatile'
16620 d_vprintf='$d_vprintf'
16621 d_wait4='$d_wait4'
16622 d_waitpid='$d_waitpid'
16623 d_wcstombs='$d_wcstombs'
16624 d_wctomb='$d_wctomb'
16625 d_writev='$d_writev'
16626 d_xenix='$d_xenix'
16627 date='$date'
16628 db_hashtype='$db_hashtype'
16629 db_prefixtype='$db_prefixtype'
16630 db_version_major='$db_version_major'
16631 db_version_minor='$db_version_minor'
16632 db_version_patch='$db_version_patch'
16633 defvoidused='$defvoidused'
16634 direntrytype='$direntrytype'
16635 dlext='$dlext'
16636 dlsrc='$dlsrc'
16637 doublesize='$doublesize'
16638 drand01='$drand01'
16639 dynamic_ext='$dynamic_ext'
16640 eagain='$eagain'
16641 ebcdic='$ebcdic'
16642 echo='$echo'
16643 egrep='$egrep'
16644 emacs='$emacs'
16645 eunicefix='$eunicefix'
16646 exe_ext='$exe_ext'
16647 expr='$expr'
16648 extensions='$extensions'
16649 fflushNULL='$fflushNULL'
16650 fflushall='$fflushall'
16651 find='$find'
16652 firstmakefile='$firstmakefile'
16653 flex='$flex'
16654 fpossize='$fpossize'
16655 fpostype='$fpostype'
16656 freetype='$freetype'
16657 full_ar='$full_ar'
16658 full_csh='$full_csh'
16659 full_sed='$full_sed'
16660 gccosandvers='$gccosandvers'
16661 gccversion='$gccversion'
16662 gidformat='$gidformat'
16663 gidsign='$gidsign'
16664 gidsize='$gidsize'
16665 gidtype='$gidtype'
16666 glibpth='$glibpth'
16667 grep='$grep'
16668 groupcat='$groupcat'
16669 groupstype='$groupstype'
16670 gzip='$gzip'
16671 h_fcntl='$h_fcntl'
16672 h_sysfile='$h_sysfile'
16673 hint='$hint'
16674 hostcat='$hostcat'
16675 i16size='$i16size'
16676 i16type='$i16type'
16677 i32size='$i32size'
16678 i32type='$i32type'
16679 i64size='$i64size'
16680 i64type='$i64type'
16681 i8size='$i8size'
16682 i8type='$i8type'
16683 i_arpainet='$i_arpainet'
16684 i_bsdioctl='$i_bsdioctl'
16685 i_db='$i_db'
16686 i_dbm='$i_dbm'
16687 i_dirent='$i_dirent'
16688 i_dld='$i_dld'
16689 i_dlfcn='$i_dlfcn'
16690 i_fcntl='$i_fcntl'
16691 i_float='$i_float'
16692 i_gdbm='$i_gdbm'
16693 i_grp='$i_grp'
16694 i_iconv='$i_iconv'
16695 i_ieeefp='$i_ieeefp'
16696 i_inttypes='$i_inttypes'
16697 i_libutil='$i_libutil'
16698 i_limits='$i_limits'
16699 i_locale='$i_locale'
16700 i_machcthr='$i_machcthr'
16701 i_malloc='$i_malloc'
16702 i_math='$i_math'
16703 i_memory='$i_memory'
16704 i_mntent='$i_mntent'
16705 i_ndbm='$i_ndbm'
16706 i_netdb='$i_netdb'
16707 i_neterrno='$i_neterrno'
16708 i_netinettcp='$i_netinettcp'
16709 i_niin='$i_niin'
16710 i_poll='$i_poll'
16711 i_prot='$i_prot'
16712 i_pthread='$i_pthread'
16713 i_pwd='$i_pwd'
16714 i_rpcsvcdbm='$i_rpcsvcdbm'
16715 i_sfio='$i_sfio'
16716 i_sgtty='$i_sgtty'
16717 i_shadow='$i_shadow'
16718 i_socks='$i_socks'
16719 i_stdarg='$i_stdarg'
16720 i_stddef='$i_stddef'
16721 i_stdlib='$i_stdlib'
16722 i_string='$i_string'
16723 i_sunmath='$i_sunmath'
16724 i_sysaccess='$i_sysaccess'
16725 i_sysdir='$i_sysdir'
16726 i_sysfile='$i_sysfile'
16727 i_sysfilio='$i_sysfilio'
16728 i_sysin='$i_sysin'
16729 i_sysioctl='$i_sysioctl'
16730 i_syslog='$i_syslog'
16731 i_sysmman='$i_sysmman'
16732 i_sysmode='$i_sysmode'
16733 i_sysmount='$i_sysmount'
16734 i_sysndir='$i_sysndir'
16735 i_sysparam='$i_sysparam'
16736 i_sysresrc='$i_sysresrc'
16737 i_syssecrt='$i_syssecrt'
16738 i_sysselct='$i_sysselct'
16739 i_syssockio='$i_syssockio'
16740 i_sysstat='$i_sysstat'
16741 i_sysstatfs='$i_sysstatfs'
16742 i_sysstatvfs='$i_sysstatvfs'
16743 i_systime='$i_systime'
16744 i_systimek='$i_systimek'
16745 i_systimes='$i_systimes'
16746 i_systypes='$i_systypes'
16747 i_sysuio='$i_sysuio'
16748 i_sysun='$i_sysun'
16749 i_sysutsname='$i_sysutsname'
16750 i_sysvfs='$i_sysvfs'
16751 i_syswait='$i_syswait'
16752 i_termio='$i_termio'
16753 i_termios='$i_termios'
16754 i_time='$i_time'
16755 i_unistd='$i_unistd'
16756 i_ustat='$i_ustat'
16757 i_utime='$i_utime'
16758 i_values='$i_values'
16759 i_varargs='$i_varargs'
16760 i_varhdr='$i_varhdr'
16761 i_vfork='$i_vfork'
16762 ignore_versioned_solibs='$ignore_versioned_solibs'
16763 inc_version_list='$inc_version_list'
16764 inc_version_list_init='$inc_version_list_init'
16765 incpath='$incpath'
16766 inews='$inews'
16767 installarchlib='$installarchlib'
16768 installbin='$installbin'
16769 installman1dir='$installman1dir'
16770 installman3dir='$installman3dir'
16771 installprefix='$installprefix'
16772 installprefixexp='$installprefixexp'
16773 installprivlib='$installprivlib'
16774 installscript='$installscript'
16775 installsitearch='$installsitearch'
16776 installsitebin='$installsitebin'
16777 installsitelib='$installsitelib'
16778 installstyle='$installstyle'
16779 installusrbinperl='$installusrbinperl'
16780 installvendorarch='$installvendorarch'
16781 installvendorbin='$installvendorbin'
16782 installvendorlib='$installvendorlib'
16783 intsize='$intsize'
16784 issymlink='$issymlink'
16785 ivdformat='$ivdformat'
16786 ivsize='$ivsize'
16787 ivtype='$ivtype'
16788 known_extensions='$known_extensions'
16789 ksh='$ksh'
16790 ld='$ld'
16791 lddlflags='$lddlflags'
16792 ldflags='$ldflags'
16793 ldflags_uselargefiles='$ldflags_uselargefiles'
16794 ldlibpthname='$ldlibpthname'
16795 less='$less'
16796 lib_ext='$lib_ext'
16797 libc='$libc'
16798 libperl='$libperl'
16799 libpth='$libpth'
16800 libs='$libs'
16801 libsdirs='$libsdirs'
16802 libsfiles='$libsfiles'
16803 libsfound='$libsfound'
16804 libspath='$libspath'
16805 libswanted='$libswanted'
16806 libswanted_uselargefiles='$libswanted_uselargefiles'
16807 line='$line'
16808 lint='$lint'
16809 lkflags='$lkflags'
16810 ln='$ln'
16811 lns='$lns'
16812 locincpth='$locincpth'
16813 loclibpth='$loclibpth'
16814 longdblsize='$longdblsize'
16815 longlongsize='$longlongsize'
16816 longsize='$longsize'
16817 lp='$lp'
16818 lpr='$lpr'
16819 ls='$ls'
16820 lseeksize='$lseeksize'
16821 lseektype='$lseektype'
16822 mail='$mail'
16823 mailx='$mailx'
16824 make='$make'
16825 make_set_make='$make_set_make'
16826 mallocobj='$mallocobj'
16827 mallocsrc='$mallocsrc'
16828 malloctype='$malloctype'
16829 man1dir='$man1dir'
16830 man1direxp='$man1direxp'
16831 man1ext='$man1ext'
16832 man3dir='$man3dir'
16833 man3direxp='$man3direxp'
16834 man3ext='$man3ext'
16835 mips_type='$mips_type'
16836 mkdir='$mkdir'
16837 mmaptype='$mmaptype'
16838 modetype='$modetype'
16839 more='$more'
16840 multiarch='$multiarch'
16841 mv='$mv'
16842 myarchname='$myarchname'
16843 mydomain='$mydomain'
16844 myhostname='$myhostname'
16845 myuname='$myuname'
16846 n='$n'
16847 need_va_copy='$need_va_copy'
16848 netdb_hlen_type='$netdb_hlen_type'
16849 netdb_host_type='$netdb_host_type'
16850 netdb_name_type='$netdb_name_type'
16851 netdb_net_type='$netdb_net_type'
16852 nm='$nm'
16853 nm_opt='$nm_opt'
16854 nm_so_opt='$nm_so_opt'
16855 nonxs_ext='$nonxs_ext'
16856 nroff='$nroff'
16857 nvEUformat='$nvEUformat'
16858 nvFUformat='$nvFUformat'
16859 nvGUformat='$nvGUformat'
16860 nveformat='$nveformat'
16861 nvfformat='$nvfformat'
16862 nvgformat='$nvgformat'
16863 nvsize='$nvsize'
16864 nvtype='$nvtype'
16865 o_nonblock='$o_nonblock'
16866 obj_ext='$obj_ext'
16867 old_pthread_create_joinable='$old_pthread_create_joinable'
16868 optimize='$optimize'
16869 orderlib='$orderlib'
16870 osname='$osname'
16871 osvers='$osvers'
16872 otherlibdirs='$otherlibdirs'
16873 package='$package'
16874 pager='$pager'
16875 passcat='$passcat'
16876 patchlevel='$patchlevel'
16877 path_sep='$path_sep'
16878 perl5='$perl5'
16879 perl='$perl'
16880 perl_patchlevel='$perl_patchlevel'
16881 perladmin='$perladmin'
16882 perllibs='$perllibs'
16883 perlpath='$perlpath'
16884 pg='$pg'
16885 phostname='$phostname'
16886 pidtype='$pidtype'
16887 plibpth='$plibpth'
16888 pm_apiversion='$pm_apiversion'
16889 pmake='$pmake'
16890 pr='$pr'
16891 prefix='$prefix'
16892 prefixexp='$prefixexp'
16893 privlib='$privlib'
16894 privlibexp='$privlibexp'
16895 prototype='$prototype'
16896 ptrsize='$ptrsize'
16897 quadkind='$quadkind'
16898 quadtype='$quadtype'
16899 randbits='$randbits'
16900 randfunc='$randfunc'
16901 randseedtype='$randseedtype'
16902 ranlib='$ranlib'
16903 rd_nodata='$rd_nodata'
16904 revision='$revision'
16905 rm='$rm'
16906 rmail='$rmail'
16907 runnm='$runnm'
16908 sPRIEUldbl='$sPRIEUldbl'
16909 sPRIFUldbl='$sPRIFUldbl'
16910 sPRIGUldbl='$sPRIGUldbl'
16911 sPRIXU64='$sPRIXU64'
16912 sPRId64='$sPRId64'
16913 sPRIeldbl='$sPRIeldbl'
16914 sPRIfldbl='$sPRIfldbl'
16915 sPRIgldbl='$sPRIgldbl'
16916 sPRIi64='$sPRIi64'
16917 sPRIo64='$sPRIo64'
16918 sPRIu64='$sPRIu64'
16919 sPRIx64='$sPRIx64'
16920 sSCNfldbl='$sSCNfldbl'
16921 sched_yield='$sched_yield'
16922 scriptdir='$scriptdir'
16923 scriptdirexp='$scriptdirexp'
16924 sed='$sed'
16925 seedfunc='$seedfunc'
16926 selectminbits='$selectminbits'
16927 selecttype='$selecttype'
16928 sendmail='$sendmail'
16929 sh='$sh'
16930 shar='$shar'
16931 sharpbang='$sharpbang'
16932 shmattype='$shmattype'
16933 shortsize='$shortsize'
16934 shrpenv='$shrpenv'
16935 shsharp='$shsharp'
16936 sig_count='$sig_count'
16937 sig_name='$sig_name'
16938 sig_name_init='$sig_name_init'
16939 sig_num='$sig_num'
16940 sig_num_init='$sig_num_init'
16941 sig_size='$sig_size'
16942 signal_t='$signal_t'
16943 sitearch='$sitearch'
16944 sitearchexp='$sitearchexp'
16945 sitebin='$sitebin'
16946 sitebinexp='$sitebinexp'
16947 sitelib='$sitelib'
16948 sitelib_stem='$sitelib_stem'
16949 sitelibexp='$sitelibexp'
16950 siteprefix='$siteprefix'
16951 siteprefixexp='$siteprefixexp'
16952 sizesize='$sizesize'
16953 sizetype='$sizetype'
16954 sleep='$sleep'
16955 smail='$smail'
16956 so='$so'
16957 sockethdr='$sockethdr'
16958 socketlib='$socketlib'
16959 socksizetype='$socksizetype'
16960 sort='$sort'
16961 spackage='$spackage'
16962 spitshell='$spitshell'
16963 src='$src'
16964 ssizetype='$ssizetype'
16965 startperl='$startperl'
16966 startsh='$startsh'
16967 static_ext='$static_ext'
16968 stdchar='$stdchar'
16969 stdio_base='$stdio_base'
16970 stdio_bufsiz='$stdio_bufsiz'
16971 stdio_cnt='$stdio_cnt'
16972 stdio_filbuf='$stdio_filbuf'
16973 stdio_ptr='$stdio_ptr'
16974 stdio_stream_array='$stdio_stream_array'
16975 strings='$strings'
16976 submit='$submit'
16977 subversion='$subversion'
16978 sysman='$sysman'
16979 tail='$tail'
16980 tar='$tar'
16981 tbl='$tbl'
16982 tee='$tee'
16983 test='$test'
16984 timeincl='$timeincl'
16985 timetype='$timetype'
16986 touch='$touch'
16987 tr='$tr'
16988 trnl='$trnl'
16989 troff='$troff'
16990 u16size='$u16size'
16991 u16type='$u16type'
16992 u32size='$u32size'
16993 u32type='$u32type'
16994 u64size='$u64size'
16995 u64type='$u64type'
16996 u8size='$u8size'
16997 u8type='$u8type'
16998 uidformat='$uidformat'
16999 uidsign='$uidsign'
17000 uidsize='$uidsize'
17001 uidtype='$uidtype'
17002 uname='$uname'
17003 uniq='$uniq'
17004 uquadtype='$uquadtype'
17005 use5005threads='$use5005threads'
17006 use64bitall='$use64bitall'
17007 use64bitint='$use64bitint'
17008 usedl='$usedl'
17009 useithreads='$useithreads'
17010 uselargefiles='$uselargefiles'
17011 uselongdouble='$uselongdouble'
17012 usemorebits='$usemorebits'
17013 usemultiplicity='$usemultiplicity'
17014 usemymalloc='$usemymalloc'
17015 usenm='$usenm'
17016 useopcode='$useopcode'
17017 useperlio='$useperlio'
17018 useposix='$useposix'
17019 usesfio='$usesfio'
17020 useshrplib='$useshrplib'
17021 usesocks='$usesocks'
17022 usethreads='$usethreads'
17023 usevendorprefix='$usevendorprefix'
17024 usevfork='$usevfork'
17025 usrinc='$usrinc'
17026 uuname='$uuname'
17027 uvXUformat='$uvXUformat'
17028 uvoformat='$uvoformat'
17029 uvsize='$uvsize'
17030 uvtype='$uvtype'
17031 uvuformat='$uvuformat'
17032 uvxformat='$uvxformat'
17033 vendorarch='$vendorarch'
17034 vendorarchexp='$vendorarchexp'
17035 vendorbin='$vendorbin'
17036 vendorbinexp='$vendorbinexp'
17037 vendorlib='$vendorlib'
17038 vendorlib_stem='$vendorlib_stem'
17039 vendorlibexp='$vendorlibexp'
17040 vendorprefix='$vendorprefix'
17041 vendorprefixexp='$vendorprefixexp'
17042 version='$version'
17043 versiononly='$versiononly'
17044 vi='$vi'
17045 voidflags='$voidflags'
17046 xlibpth='$xlibpth'
17047 xs_apiversion='$xs_apiversion'
17048 yacc='$yacc'
17049 yaccflags='$yaccflags'
17050 zcat='$zcat'
17051 zip='$zip'
17052 EOT
17053
17054 : Add in command line options if available
17055 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17056
17057 : add special variables
17058 $test -f $src/patchlevel.h && \
17059 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17060 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17061 echo "PERL_CONFIG_SH=true" >>config.sh
17062
17063 : propagate old symbols
17064 if $test -f UU/config.sh; then
17065         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17066         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17067         $sort | $uniq -u >UU/oldsyms
17068         set X `cat UU/oldsyms`
17069         shift
17070         case $# in
17071         0) ;;
17072         *)
17073                 cat <<EOM
17074 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17075 EOM
17076                 echo "# Variables propagated from previous config.sh file." >>config.sh
17077                 for sym in `cat UU/oldsyms`; do
17078                         echo "    Propagating $hint variable "'$'"$sym..."
17079                         eval 'tmp="$'"${sym}"'"'
17080                         echo "$tmp" | \
17081                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17082                 done
17083                 ;;
17084         esac
17085 fi
17086
17087 : Finish up by extracting the .SH files
17088 case "$alldone" in
17089 exit)
17090         $rm -rf UU
17091         echo "Extraction done."
17092         exit 0
17093         ;;
17094 cont)
17095         ;;
17096 '')
17097         dflt=''
17098         nostick=true
17099         $cat <<EOM
17100
17101 If you'd like to make any changes to the config.sh file before I begin
17102 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17103
17104 EOM
17105         rp="Press return or use a shell escape to edit config.sh:"
17106         . UU/myread
17107         nostick=''
17108         case "$ans" in
17109         '') ;;
17110         *) : in case they cannot read
17111                 sh 1>&4 -c "$ans";;
17112         esac
17113         ;;
17114 esac
17115
17116 : if this fails, just run all the .SH files by hand
17117 . ./config.sh
17118
17119 echo " "
17120 exec 1>&4
17121 . ./UU/extract
17122
17123 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17124         dflt=y
17125         case "$silent" in
17126         true) ;;
17127         *)
17128                 $cat <<EOM
17129
17130 Now you need to generate make dependencies by running "$make depend".
17131 You might prefer to run it in background: "$make depend > makedepend.out &"
17132 It can take a while, so you might not want to run it right now.
17133
17134 EOM
17135                 ;;
17136         esac
17137         rp="Run $make depend now?"
17138         . UU/myread
17139         case "$ans" in
17140         y*)
17141                 $make depend && echo "Now you must run '$make'."
17142                 ;;
17143         *)
17144                 echo "You must run '$make depend' then '$make'."
17145                 ;;
17146         esac
17147 elif test -f [Mm]akefile; then
17148         echo " "
17149         echo "Now you must run a $make."
17150 else
17151         echo "Configure done."
17152 fi
17153
17154 if $test -f Policy.sh; then
17155     $cat <<EOM
17156
17157 If you compile $package on a different machine or from a different object
17158 directory, copy the Policy.sh file from this object directory to the
17159 new one before you run Configure -- this will help you with most of
17160 the policy defaults.
17161
17162 EOM
17163 fi
17164 if $test -f config.msg; then
17165     echo "Hmm.  I also noted the following information while running:"
17166     echo " "
17167     $cat config.msg >&4
17168     $rm -f config.msg
17169 fi
17170 $rm -f kit*isdone ark*isdone
17171 $rm -rf UU
17172
17173 : End of Configure
17174