A non-empty default is a good thing.
[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 Wed Jun 13 21:24:27 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 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 usereentrant=''
967 usethreads=''
968 incpath=''
969 mips_type=''
970 usrinc=''
971 d_vendorarch=''
972 installvendorarch=''
973 vendorarch=''
974 vendorarchexp=''
975 d_vendorbin=''
976 installvendorbin=''
977 vendorbin=''
978 vendorbinexp=''
979 d_vendorlib=''
980 installvendorlib=''
981 vendorlib=''
982 vendorlib_stem=''
983 vendorlibexp=''
984 usevendorprefix=''
985 vendorprefix=''
986 vendorprefixexp=''
987 versiononly=''
988 defvoidused=''
989 voidflags=''
990 pm_apiversion=''
991 xs_apiversion=''
992 yacc=''
993 yaccflags=''
994 CONFIG=''
995
996 define='define'
997 undef='undef'
998 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
999 rmlist=''
1000
1001 : We must find out about Eunice early
1002 eunicefix=':'
1003 if test -f /etc/unixtovms; then
1004         eunicefix=/etc/unixtovms
1005 fi
1006 if test -f /etc/unixtovms.exe; then
1007         eunicefix=/etc/unixtovms.exe
1008 fi
1009
1010 i_whoami=''
1011 ccname=''
1012 ccversion=''
1013 perllibs=''
1014 : set useposix=false in your hint file to disable the POSIX extension.
1015 useposix=true
1016 : set useopcode=false in your hint file to disable the Opcode extension.
1017 useopcode=true
1018 : Trailing extension.  Override this in a hint file, if needed.
1019 _exe=''
1020 : Extra object files, if any, needed on this platform.
1021 archobjs=''
1022 archname=''
1023 : Possible local include directories to search.
1024 : Set locincpth to "" in a hint file to defeat local include searches.
1025 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1026 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1027 :
1028 : no include file wanted by default
1029 inclwanted=''
1030
1031 groupstype=''
1032 : change the next line if compiling for Xenix/286 on Xenix/386
1033 xlibpth='/usr/lib/386 /lib/386'
1034 : Possible local library directories to search.
1035 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1036 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1037
1038 : general looking path for locating libraries
1039 glibpth="/lib /usr/lib $xlibpth"
1040 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1041 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1042 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1043
1044 : Private path used by Configure to find libraries.  Its value
1045 : is prepended to libpth. This variable takes care of special
1046 : machines, like the mips.  Usually, it should be empty.
1047 plibpth=''
1048
1049 : default library list
1050 libswanted=''
1051 : some systems want to use only the non-versioned libso:s
1052 ignore_versioned_solibs=''
1053 archname64=''
1054 ccflags_uselargefiles=''
1055 ldflags_uselargefiles=''
1056 libswanted_uselargefiles=''
1057 : set usemultiplicity on the Configure command line to enable multiplicity.
1058 : set usesocks on the Configure command line to enable socks.
1059 : set usethreads on the Configure command line to enable threads.
1060 :usereentrant='undef'
1061 : full support for void wanted by default
1062 defvoidused=15
1063
1064 : List of libraries we want.
1065 : If anyone needs -lnet, put it in a hint file.
1066 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1067 libswanted="$libswanted dld ld sun m c cposix posix"
1068 libswanted="$libswanted ndir dir crypt sec"
1069 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1070 : We probably want to search /usr/shlib before most other libraries.
1071 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1072 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1073 glibpth="/usr/shlib $glibpth"
1074 : Do not use vfork unless overridden by a hint file.
1075 usevfork=false
1076
1077 : Find the basic shell for Bourne shell scripts
1078 case "$sh" in
1079 '')
1080         case "$SYSTYPE" in
1081         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1082         *) xxx='/bin/sh';;
1083         esac
1084         if test -f "$xxx"; then
1085                 sh="$xxx"
1086         else
1087                 : Build up a list and do a single loop so we can 'break' out.
1088                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1089                 for xxx in sh bash ksh pdksh ash; do
1090                         for p in $pth; do
1091                                 try="$try ${p}/${xxx}"
1092                         done
1093                 done
1094                 for xxx in $try; do
1095                         if test -f "$xxx"; then
1096                                 sh="$xxx";
1097                                 break
1098                         elif test -f "$xxx.exe"; then
1099                                 sh="$xxx";
1100                                 break
1101                         fi
1102                 done
1103         fi
1104         ;;
1105 esac
1106
1107 case "$sh" in
1108 '')     cat <<EOM >&2
1109 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1110
1111 Usually it's in /bin/sh.  How did you even get this far?
1112 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1113 we'll try to straighten this all out.
1114 EOM
1115         exit 1
1116         ;;
1117 esac
1118
1119 : see if sh knows # comments
1120 if `$sh -c '#' >/dev/null 2>&1`; then
1121         shsharp=true
1122         spitshell=cat
1123         xcat=/bin/cat
1124         test -f $xcat || xcat=/usr/bin/cat
1125         echo "#!$xcat" >try
1126         $eunicefix try
1127         chmod +x try
1128         ./try > today
1129         if test -s today; then
1130                 sharpbang='#!'
1131         else
1132                 echo "#! $xcat" > try
1133                 $eunicefix try
1134                 chmod +x try
1135                 ./try > today
1136                 if test -s today; then
1137                         sharpbang='#! '
1138                 else
1139                         sharpbang=': use '
1140                 fi
1141         fi
1142 else
1143         echo " "
1144         echo "Your $sh doesn't grok # comments--I will strip them later on."
1145         shsharp=false
1146         cd ..
1147         echo "exec grep -v '^[  ]*#'" >spitshell
1148         chmod +x spitshell
1149         $eunicefix spitshell
1150         spitshell=`pwd`/spitshell
1151         cd UU
1152         echo "I presume that if # doesn't work, #! won't work either!"
1153         sharpbang=': use '
1154 fi
1155 rm -f try today
1156
1157 : figure out how to guarantee sh startup
1158 case "$startsh" in
1159 '') startsh=${sharpbang}${sh} ;;
1160 *)
1161 esac
1162 cat >try <<EOSS
1163 $startsh
1164 set abc
1165 test "$?abc" != 1
1166 EOSS
1167
1168 chmod +x try
1169 $eunicefix try
1170 if ./try; then
1171         : echo "Yup, it does."
1172 else
1173         echo "Hmm... '$startsh' does not guarantee sh startup..."
1174         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1175 fi
1176 rm -f try
1177
1178
1179 : Save command line options in file UU/cmdline.opt for later use in
1180 : generating config.sh.
1181 cat > cmdline.opt <<EOSH
1182 # Configure command line arguments.
1183 config_arg0='$0'
1184 config_args='$*'
1185 config_argc=$#
1186 EOSH
1187 argn=1
1188 for arg in "$@"; do
1189         cat >>cmdline.opt <<EOSH
1190 config_arg$argn='$arg'
1191 EOSH
1192         argn=`expr $argn + 1`
1193 done
1194
1195 : produce awk script to parse command line options
1196 cat >options.awk <<'EOF'
1197 BEGIN {
1198         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1199
1200         len = length(optstr);
1201         for (i = 1; i <= len; i++) {
1202                 c = substr(optstr, i, 1);
1203                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1204                 if (a == ":") {
1205                         arg[c] = 1;
1206                         i++;
1207                 }
1208                 opt[c] = 1;
1209         }
1210 }
1211 {
1212         expect = 0;
1213         str = $0;
1214         if (substr(str, 1, 1) != "-") {
1215                 printf("'%s'\n", str);
1216                 next;
1217         }
1218         len = length($0);
1219         for (i = 2; i <= len; i++) {
1220                 c = substr(str, i, 1);
1221                 if (!opt[c]) {
1222                         printf("-%s\n", substr(str, i));
1223                         next;
1224                 }
1225                 printf("-%s\n", c);
1226                 if (arg[c]) {
1227                         if (i < len)
1228                                 printf("'%s'\n", substr(str, i + 1));
1229                         else
1230                                 expect = 1;
1231                         next;
1232                 }
1233         }
1234 }
1235 END {
1236         if (expect)
1237                 print "?";
1238 }
1239 EOF
1240
1241 : process the command line options
1242 set X `for arg in "$@"; do echo "X$arg"; done |
1243         sed -e s/X// | awk -f options.awk`
1244 eval "set $*"
1245 shift
1246 rm -f options.awk
1247
1248 : set up default values
1249 fastread=''
1250 reuseval=false
1251 config_sh=''
1252 alldone=''
1253 error=''
1254 silent=''
1255 extractsh=''
1256 override=''
1257 knowitall=''
1258 rm -f optdef.sh posthint.sh
1259 cat >optdef.sh <<EOS
1260 $startsh
1261 EOS
1262
1263
1264 : option parsing
1265 while test $# -gt 0; do
1266         case "$1" in
1267         -d) shift; fastread=yes;;
1268         -e) shift; alldone=cont;;
1269         -f)
1270                 shift
1271                 cd ..
1272                 if test -r "$1"; then
1273                         config_sh="$1"
1274                 else
1275                         echo "$me: cannot read config file $1." >&2
1276                         error=true
1277                 fi
1278                 cd UU
1279                 shift;;
1280         -h) shift; error=true;;
1281         -r) shift; reuseval=true;;
1282         -s) shift; silent=true; realsilent=true;;
1283         -E) shift; alldone=exit;;
1284         -K) shift; knowitall=true;;
1285         -O) shift; override=true;;
1286         -S) shift; silent=true; extractsh=true;;
1287         -D)
1288                 shift
1289                 case "$1" in
1290                 *=)
1291                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1292                         echo "$me: ignoring -D $1" >&2
1293                         ;;
1294                 *=*) echo "$1" | \
1295                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1296                 *) echo "$1='define'" >> optdef.sh;;
1297                 esac
1298                 shift
1299                 ;;
1300         -U)
1301                 shift
1302                 case "$1" in
1303                 *=) echo "$1" >> optdef.sh;;
1304                 *=*)
1305                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1306                         echo "$me: ignoring -U $1" >&2
1307                         ;;
1308                 *) echo "$1='undef'" >> optdef.sh;;
1309                 esac
1310                 shift
1311                 ;;
1312         -A)
1313             shift
1314             xxx=''
1315             yyy="$1"
1316             zzz=''
1317             uuu=undef
1318             case "$yyy" in
1319             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1320                  case "$zzz" in
1321                  *:*) zzz='' ;;
1322                  *)   xxx=append
1323                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1324                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1325                  esac
1326                  ;;
1327             esac
1328             case "$xxx" in
1329             '')  case "$yyy" in
1330                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1331                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1332                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1333                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1334                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1335                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1336                  esac
1337                  ;;       
1338             esac
1339             case "$xxx" in
1340             append)
1341                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1342             clear)
1343                 echo "$yyy=''"                  >> posthint.sh ;;
1344             define)
1345                 case "$zzz" in
1346                 '') zzz=define ;;
1347                 esac
1348                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1349             eval)
1350                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1351             prepend)
1352                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1353             undef)
1354                 case "$zzz" in
1355                 '') zzz="$uuu" ;;
1356                 esac
1357                 echo "$yyy=$zzz"                >> posthint.sh ;;
1358             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1359             esac
1360             shift
1361             ;;
1362         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1363             exit 0;;
1364         --) break;;
1365         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1366         *) break;;
1367         esac
1368 done
1369
1370 case "$error" in
1371 true)
1372         cat >&2 <<EOM
1373 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1374                  [-U symbol] [-U symbol=] [-A command:symbol...]
1375   -d : use defaults for all answers.
1376   -e : go on without questioning past the production of config.sh.
1377   -f : specify an alternate default configuration file.
1378   -h : print this help message and exit (with an error status).
1379   -r : reuse C symbols value if possible (skips costly nm extraction).
1380   -s : silent mode, only echoes questions and essential information.
1381   -D : define symbol to have some value:
1382          -D symbol         symbol gets the value 'define'
1383          -D symbol=value   symbol gets the value 'value'
1384   -E : stop at the end of questions, after having produced config.sh.
1385   -K : do not use unless you know what you are doing.
1386   -O : let -D and -U override definitions from loaded configuration file.
1387   -S : perform variable substitutions on all .SH files (can mix with -f)
1388   -U : undefine symbol:
1389          -U symbol    symbol gets the value 'undef'
1390          -U symbol=   symbol gets completely empty
1391   -A : manipulate symbol after the platform specific hints have been applied:
1392          -A symbol=value                append " "value to symbol
1393          -A append:symbol=value         append value to symbol
1394          -A define:symbol=value         define symbol to have value
1395          -A clear:symbol                define symbol to be ''
1396          -A define:symbol               define symbol to be 'define'
1397          -A eval:symbol=value           define symbol to be eval of value
1398          -A prepend:symbol=value        prepend value to symbol
1399          -A undef:symbol                define symbol to be 'undef'
1400          -A undef:symbol=               define symbol to be ''
1401   -V : print version number and exit (with a zero status).
1402 EOM
1403         exit 1
1404         ;;
1405 esac
1406
1407 : Sanity checks
1408 case "$fastread$alldone" in
1409 yescont|yesexit) ;;
1410 *)
1411         case "$extractsh" in
1412         true) ;;
1413         *)
1414                 if test ! -t 0; then
1415                         echo "Say 'sh Configure', not 'sh <Configure'"
1416                         exit 1
1417                 fi
1418                 ;;
1419         esac
1420         ;;
1421 esac
1422
1423 exec 4>&1
1424 case "$silent" in
1425 true) exec 1>/dev/null;;
1426 esac
1427
1428 : run the defines and the undefines, if any, but leave the file out there...
1429 touch optdef.sh
1430 . ./optdef.sh
1431 : create the posthint manipulation script and leave the file out there...
1432 touch posthint.sh
1433
1434 : set package name
1435 package=perl5
1436 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1437 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1438 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1439 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1440 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1441 esac
1442
1443 : Some greps do not return status, grrr.
1444 echo "grimblepritz" >grimble
1445 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1446         contains=contains
1447 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1448         contains=grep
1449 else
1450         contains=contains
1451 fi
1452 rm -f grimble
1453 : the following should work in any shell
1454 case "$contains" in
1455 contains*)
1456         echo " "
1457         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1458         cat >contains <<'EOSS'
1459 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1460 EOSS
1461 chmod +x contains
1462 esac
1463
1464 : Find the path to the source tree
1465 case "$src" in
1466 '') case "$0" in
1467     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1468          case "$src" in
1469          /*)    ;;
1470          .)     ;;
1471          *)     src=`cd ../$src && pwd` ;;
1472          esac
1473          ;;
1474     *)   src='.';;
1475     esac;;
1476 esac
1477 case "$src" in
1478 '')     src=/
1479         rsrc=/
1480         ;;
1481 /*) rsrc="$src";;
1482 *) rsrc="../$src";;
1483 esac
1484 if test -f $rsrc/Configure && \
1485         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1486 then
1487    : found it, so we are ok.
1488 else
1489         rsrc=''
1490         for src in . .. ../.. ../../.. ../../../..; do
1491                 if test -f ../$src/Configure && \
1492                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1493                 then
1494                         rsrc=../$src
1495                         break
1496                 fi
1497         done
1498 fi
1499 case "$rsrc" in
1500 '')
1501         cat <<EOM >&4
1502
1503 Sorry, I can't seem to locate the source dir for $package.  Please start
1504 Configure with an explicit path -- i.e. /some/path/Configure.
1505
1506 EOM
1507         exit 1
1508         ;;
1509 ../.)   rsrc='..';;
1510 *)
1511         echo " "
1512         echo "Sources for $package found in \"$src\"." >&4
1513         ;;
1514 esac
1515
1516 : script used to extract .SH files with variable substitutions
1517 cat >extract <<'EOS'
1518 PERL_CONFIG_SH=true
1519 echo "Doing variable substitutions on .SH files..."
1520 if test -f MANIFEST; then
1521         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1522 else
1523         echo "(Looking for .SH files under the source directory.)"
1524         set x `(cd $src; find . -name "*.SH" -print)`
1525 fi
1526 shift
1527 case $# in
1528 0) set x `(cd $src; echo *.SH)`; shift;;
1529 esac
1530 if test ! -f $src/$1; then
1531         shift
1532 fi
1533 mkdir_p='
1534 name=$1;
1535 create="";
1536 while test $name; do
1537         if test ! -d "$name"; then
1538                 create="$name $create";
1539                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1540                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1541         else
1542                 name="";
1543         fi;
1544 done;
1545 for file in $create; do
1546         mkdir $file;
1547 done
1548 '
1549 for file in $*; do
1550         case "$src" in
1551         ".")
1552                 case "$file" in
1553                 */*)
1554                         dir=`expr X$file : 'X\(.*\)/'`
1555                         file=`expr X$file : 'X.*/\(.*\)'`
1556                         (cd $dir && . ./$file)
1557                         ;;
1558                 *)
1559                         . ./$file
1560                         ;;
1561                 esac
1562                 ;;
1563         *)
1564                 case "$file" in
1565                 */*)
1566                         dir=`expr X$file : 'X\(.*\)/'`
1567                         file=`expr X$file : 'X.*/\(.*\)'`
1568                         (set x $dir; shift; eval $mkdir_p)
1569                         sh <$src/$dir/$file
1570                         ;;
1571                 *)
1572                         sh <$src/$file
1573                         ;;
1574                 esac
1575                 ;;
1576         esac
1577 done
1578 if test -f $src/config_h.SH; then
1579         if test ! -f config.h; then
1580         : oops, they left it out of MANIFEST, probably, so do it anyway.
1581         . $src/config_h.SH
1582         fi
1583 fi
1584 EOS
1585
1586 : extract files and exit if asked to do so
1587 case "$extractsh" in
1588 true)
1589         case "$realsilent" in
1590         true) ;;
1591         *) exec 1>&4;;
1592         esac
1593         case "$config_sh" in
1594         '') config_sh='config.sh';;
1595         esac
1596         echo " "
1597         echo "Fetching answers from $config_sh..."
1598         cd ..
1599         . $config_sh
1600         test "$override" && . ./optdef.sh
1601         echo " "
1602         . UU/extract
1603         rm -rf UU
1604         echo "Extraction done."
1605         exit 0
1606         ;;
1607 esac
1608
1609 : Eunice requires " " instead of "", can you believe it
1610 echo " "
1611 : Here we go...
1612 echo "Beginning of configuration questions for $package."
1613
1614 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1615
1616 : first determine how to suppress newline on echo command
1617 echo " "
1618 echo "Checking echo to see how to suppress newlines..."
1619 (echo "hi there\c" ; echo " ") >.echotmp
1620 if $contains c .echotmp >/dev/null 2>&1 ; then
1621         echo "...using -n."
1622         n='-n'
1623         c=''
1624 else
1625         cat <<'EOM'
1626 ...using \c
1627 EOM
1628         n=''
1629         c='\c'
1630 fi
1631 echo $n "The star should be here-->$c"
1632 echo '*'
1633 rm -f .echotmp
1634
1635 : Now test for existence of everything in MANIFEST
1636 echo " "
1637 if test -f $rsrc/MANIFEST; then
1638         echo "First let's make sure your kit is complete.  Checking..." >&4
1639         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1640         rm -f missing
1641         tmppwd=`pwd`
1642         for filelist in x??; do
1643                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1644         done
1645         if test -s missing; then
1646                 cat missing >&4
1647                 cat >&4 <<'EOM'
1648
1649 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1650
1651 You have the option of continuing the configuration process, despite the
1652 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1653 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1654 and contact the author (perlbug@perl.org).
1655
1656 EOM
1657                 echo $n "Continue? [n] $c" >&4
1658                 read ans
1659                 case "$ans" in
1660                 y*)
1661                         echo "Continuing..." >&4
1662                         rm -f missing
1663                         ;;
1664                 *)
1665                         echo "ABORTING..." >&4
1666                         kill $$
1667                         ;;
1668                 esac
1669         else
1670                 echo "Looks good..."
1671         fi
1672 else
1673         echo "There is no MANIFEST file.  I hope your kit is complete !"
1674 fi
1675 rm -f missing x??
1676
1677 echo " "
1678 : Find the appropriate value for a newline for tr
1679 if test -n "$DJGPP"; then
1680        trnl='\012'
1681 fi
1682 if test X"$trnl" = X; then
1683         case "`echo foo|tr '\n' x 2>/dev/null`" in
1684         foox) trnl='\n' ;;
1685         esac
1686 fi
1687 if test X"$trnl" = X; then
1688         case "`echo foo|tr '\012' x 2>/dev/null`" in
1689         foox) trnl='\012' ;;
1690         esac
1691 fi
1692 if test X"$trnl" = X; then
1693         cat <<EOM >&2
1694
1695 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1696
1697 EOM
1698         exit 1
1699 fi
1700
1701 : compute the number of columns on the terminal for proper question formatting
1702 case "$COLUMNS" in
1703 '') COLUMNS='80';;
1704 esac
1705
1706 : set up the echo used in my read
1707 myecho="case \"\$xxxm\" in
1708 '') echo $n \"\$rp $c\" >&4;;
1709 *) case \"\$rp\" in
1710         '') echo $n \"[\$xxxm] $c\";;
1711         *)
1712                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1713                         echo \"\$rp\" >&4
1714                         echo $n \"[\$xxxm] $c\" >&4
1715                 else
1716                         echo $n \"\$rp [\$xxxm] $c\" >&4
1717                 fi
1718                 ;;
1719         esac;;
1720 esac"
1721
1722 : now set up to do reads with possible shell escape and default assignment
1723 cat <<EOSC >myread
1724 $startsh
1725 xxxm=\$dflt
1726 $myecho
1727 ans='!'
1728 case "\$fastread" in
1729 yes) case "\$dflt" in
1730         '') ;;
1731         *) ans='';
1732                 case "\$silent-\$rp" in
1733                 true-) ;;
1734                 *) echo " " >&4;;
1735                 esac;;
1736         esac;;
1737 *) case "\$silent" in
1738         true) case "\$rp" in
1739                 '') ans='';;
1740                 esac;;
1741         esac;;
1742 esac
1743 while expr "X\$ans" : "X!" >/dev/null; do
1744         read answ
1745         set x \$xxxm
1746         shift
1747         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1748         case  "\$answ" in
1749         "!")
1750                 sh 1>&4
1751                 echo " "
1752                 $myecho
1753                 ;;
1754         !*)
1755                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1756                 shift
1757                 sh 1>&4 -c "\$*"
1758                 echo " "
1759                 $myecho
1760                 ;;
1761         "\$ans")
1762                 case "\$ans" in
1763                 \\&*)
1764                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1765                         shift
1766                         case "\$1" in
1767                         -d)
1768                                 fastread=yes
1769                                 echo "(OK, I'll run with -d after this question.)" >&4
1770                                 ;;
1771                         -*)
1772                                 echo "*** Sorry, \$1 not supported yet." >&4
1773                                 ;;
1774                         esac
1775                         $myecho
1776                         ans=!
1777                         ;;
1778                 esac;;
1779         *)
1780                 case "\$aok" in
1781                 y)
1782                         echo "*** Substitution done -- please confirm."
1783                         xxxm="\$ans"
1784                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1785                         xxxm="\$ans"
1786                         ans=!
1787                         ;;
1788                 *)
1789                         echo "*** Error -- try again."
1790                         ans=!
1791                         ;;
1792                 esac
1793                 $myecho
1794                 ;;
1795         esac
1796         case "\$ans\$xxxm\$nostick" in
1797         '')
1798                 ans=!
1799                 $myecho
1800                 ;;
1801         esac
1802 done
1803 case "\$ans" in
1804 '') ans="\$xxxm";;
1805 esac
1806 EOSC
1807
1808 : create .config dir to save info across Configure sessions
1809 test -d ../.config || mkdir ../.config
1810 cat >../.config/README <<EOF
1811 This directory created by Configure to save information that should
1812 persist across sessions for $package.
1813
1814 You may safely delete it if you wish.
1815 EOF
1816
1817 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1818 case "$usedevel" in
1819 $define|true|[yY]*) ;;
1820 *) case "$xversion" in
1821    *[13579])
1822         cat >&4 <<EOH
1823 *** WHOA THERE!!! ***
1824
1825     This is an UNSTABLE DEVELOPMENT release.
1826     The version of this $package distribution is $xversion, that is, odd,
1827     (as opposed to even) and that signifies a development release.
1828     If you want a maintenance release, you want an even-numbered version.
1829
1830     Do ***NOT*** install this into production use.
1831     Data corruption and crashes are possible.
1832
1833     It is most seriously suggested that you do not continue any further
1834     unless you want to help in developing and debugging Perl.
1835
1836     If you *still* want to build perl, you can answer 'y' now,
1837     or pass -Dusedevel to Configure.
1838
1839 EOH
1840         rp='Do you really want to continue?'
1841         dflt='n'
1842         . ./myread
1843         case "$ans" in
1844         [yY]) echo >&4 "Okay, continuing."
1845               usedevel="$define" ;;
1846         *) echo >&4 "Okay, bye."
1847            exit 1
1848            ;;
1849         esac
1850         ;;
1851     esac
1852     ;;
1853 esac
1854 case "$usedevel" in
1855 $define|true|[yY]*)
1856         case "$versiononly" in
1857         '') versiononly="$define" ;;
1858         esac
1859         case "$installusrbinperl" in
1860         '') installusrbinperl="$undef" ;;
1861         esac
1862         ;;
1863 esac
1864
1865 : general instructions
1866 needman=true
1867 firsttime=true
1868 user=`(logname) 2>/dev/null`
1869 case "$user" in
1870 '') user=`whoami 2>&1`;;
1871 esac
1872 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1873         firsttime=false
1874         echo " "
1875         rp='Would you like to see the instructions?'
1876         dflt=n
1877         . ./myread
1878         case "$ans" in
1879         [yY]*) ;;
1880         *) needman=false;;
1881         esac
1882 fi
1883 if $needman; then
1884         cat <<EOH
1885
1886 This installation shell script will examine your system and ask you questions
1887 to determine how the perl5 package should be installed. If you get
1888 stuck on a question, you may use a ! shell escape to start a subshell or
1889 execute a command.  Many of the questions will have default answers in square
1890 brackets; typing carriage return will give you the default.
1891
1892 On some of the questions which ask for file or directory names you are allowed
1893 to use the ~name construct to specify the login directory belonging to "name",
1894 even if you don't have a shell which knows about that.  Questions where this is
1895 allowed will be marked "(~name ok)".
1896
1897 EOH
1898         rp=''
1899         dflt='Type carriage return to continue'
1900         . ./myread
1901         cat <<'EOH'
1902
1903 The prompter used in this script allows you to use shell variables and
1904 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1905 in the default answer, as if the default line was a set of arguments given to a
1906 script shell.  This means you may also use $* to repeat the whole default line,
1907 so you do not have to re-type everything to add something to the default.
1908
1909 Everytime there is a substitution, you will have to confirm.  If there is an
1910 error (e.g. an unmatched backtick), the default answer will remain unchanged
1911 and you will be prompted again.
1912
1913 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1914 the questions and use the computed defaults (or the previous answers if there
1915 was already a config.sh file). Type 'Configure -h' for a list of options.
1916 You may also start interactively and then answer '& -d' at any prompt to turn
1917 on the non-interactive behaviour for the remainder of the execution.
1918
1919 EOH
1920         . ./myread
1921         cat <<EOH
1922
1923 Much effort has been expended to ensure that this shell script will run on any
1924 Unix system.  If despite that it blows up on yours, your best bet is to edit
1925 Configure and run it again.  If you can't run Configure for some reason,
1926 you'll have to generate a config.sh file by hand.  Whatever problems you
1927 have, let me (perlbug@perl.org) know how I blew it.
1928
1929 This installation script affects things in two ways:
1930
1931 1) it may do direct variable substitutions on some of the files included
1932    in this kit.
1933 2) it builds a config.h file for inclusion in C programs.  You may edit
1934    any of these files as the need arises after running this script.
1935
1936 If you make a mistake on a question, there is no easy way to back up to it
1937 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1938 files.  Configure will offer to let you do this before it runs the SH files.
1939
1940 EOH
1941         dflt='Type carriage return to continue'
1942         . ./myread
1943         case "$firsttime" in
1944         true) echo $user >>../.config/instruct;;
1945         esac
1946 fi
1947
1948 : find out where common programs are
1949 echo " "
1950 echo "Locating common programs..." >&4
1951 cat <<EOSC >loc
1952 $startsh
1953 case \$# in
1954 0) exit 1;;
1955 esac
1956 thing=\$1
1957 shift
1958 dflt=\$1
1959 shift
1960 for dir in \$*; do
1961         case "\$thing" in
1962         .)
1963         if test -d \$dir/\$thing; then
1964                 echo \$dir
1965                 exit 0
1966         fi
1967         ;;
1968         *)
1969         for thisthing in \$dir/\$thing; do
1970                 : just loop through to pick last item
1971         done
1972         if test -f \$thisthing; then
1973                 echo \$thisthing
1974                 exit 0
1975         elif test -f \$dir/\$thing.exe; then
1976                 if test -n "$DJGPP"; then
1977                         echo \$dir/\$thing.exe
1978                 else
1979                         : on Eunice apparently
1980                         echo \$dir/\$thing
1981                 fi
1982                 exit 0
1983         fi
1984         ;;
1985         esac
1986 done
1987 echo \$dflt
1988 exit 1
1989 EOSC
1990 chmod +x loc
1991 $eunicefix loc
1992 loclist="
1993 awk
1994 cat
1995 comm
1996 cp
1997 echo
1998 expr
1999 grep
2000 ls
2001 make
2002 mkdir
2003 rm
2004 sed
2005 sort
2006 touch
2007 tr
2008 uniq
2009 "
2010 trylist="
2011 Mcc
2012 ar
2013 bison
2014 byacc
2015 cpp
2016 csh
2017 date
2018 egrep
2019 gzip
2020 less
2021 ln
2022 more
2023 nm
2024 nroff
2025 pg
2026 test
2027 uname
2028 zip
2029 "
2030 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2031 pth="$pth /lib /usr/lib"
2032 for file in $loclist; do
2033         eval xxx=\$$file
2034         case "$xxx" in
2035         /*|?:[\\/]*)
2036                 if test -f "$xxx"; then
2037                         : ok
2038                 else
2039                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2040                         xxx=`./loc $file $file $pth`
2041                 fi
2042                 ;;
2043         '') xxx=`./loc $file $file $pth`;;
2044         *) xxx=`./loc $xxx $xxx $pth`;;
2045         esac
2046         eval $file=$xxx
2047         eval _$file=$xxx
2048         case "$xxx" in
2049         /*)
2050                 echo $file is in $xxx.
2051                 ;;
2052         ?:[\\/]*)
2053                 echo $file is in $xxx.
2054                 ;;
2055         *)
2056                 echo "I don't know where '$file' is, and my life depends on it." >&4
2057                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2058                 exit 1
2059                 ;;
2060         esac
2061 done
2062 echo " "
2063 echo "Don't worry if any of the following aren't found..."
2064 say=offhand
2065 for file in $trylist; do
2066         eval xxx=\$$file
2067         case "$xxx" in
2068         /*|?:[\\/]*)
2069                 if test -f "$xxx"; then
2070                         : ok
2071                 else
2072                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2073                         xxx=`./loc $file $file $pth`
2074                 fi
2075                 ;;
2076         '') xxx=`./loc $file $file $pth`;;
2077         *) xxx=`./loc $xxx $xxx $pth`;;
2078         esac
2079         eval $file=$xxx
2080         eval _$file=$xxx
2081         case "$xxx" in
2082         /*)
2083                 echo $file is in $xxx.
2084                 ;;
2085         ?:[\\/]*)
2086                 echo $file is in $xxx.
2087                 ;;
2088         *)
2089                 echo "I don't see $file out there, $say."
2090                 say=either
2091                 ;;
2092         esac
2093 done
2094 case "$egrep" in
2095 egrep)
2096         echo "Substituting grep for egrep."
2097         egrep=$grep
2098         ;;
2099 esac
2100 case "$ln" in
2101 ln)
2102         echo "Substituting cp for ln."
2103         ln=$cp
2104         ;;
2105 esac
2106 case "$test" in
2107 test)
2108         echo "Hopefully test is built into your sh."
2109         ;;
2110 *)
2111         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2112                 echo "Using the test built into your sh."
2113                 test=test
2114                 _test=test
2115         fi
2116         ;;
2117 esac
2118 case "$echo" in
2119 echo)
2120         echo "Hopefully echo is built into your sh."
2121         ;;
2122 '') ;;
2123 *)
2124         echo " "
2125 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2126         $echo $n "hi there$c" >foo1
2127         echo $n "hi there$c" >foo2
2128         if cmp foo1 foo2 >/dev/null 2>&1; then
2129                 echo "They are compatible.  In fact, they may be identical."
2130         else
2131                 case "$n" in
2132                 '-n') n='' c='\c';;
2133                 *) n='-n' c='';;
2134                 esac
2135                 cat <<FOO
2136 They are not compatible!  You are probably running ksh on a non-USG system.
2137 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2138 have echo built in and we may have to run some Bourne shell scripts.  That
2139 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2140
2141 FOO
2142                 $echo $n "The star should be here-->$c"
2143                 $echo "*"
2144         fi
2145         $rm -f foo1 foo2
2146         ;;
2147 esac
2148
2149 cat <<EOS >checkcc
2150 $startsh
2151 EOS
2152 cat <<'EOSC' >>checkcc
2153 case "$cc" in
2154 '') ;;
2155 *)  $rm -f try try.*
2156     $cat >try.c <<EOM
2157 int main(int argc, char *argv[]) {
2158   return 0;
2159 }
2160 EOM
2161     if $cc -o try $ccflags $ldflags try.c; then
2162        :
2163     else
2164         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2165         despair=yes
2166         trygcc=yes
2167         case "$cc" in
2168         *gcc*) trygcc=no ;;
2169         esac
2170         case "`$cc -v -c try.c 2>&1`" in
2171         *gcc*) trygcc=no ;;
2172         esac
2173         if $test X"$trygcc" = Xyes; then
2174             if gcc -o try -c try.c; then
2175                 echo " "
2176                 echo "You seem to have a working gcc, though." >&4
2177                 rp="Would you like to use it?"
2178                 dflt=y
2179                 if $test -f myread; then
2180                     . ./myread
2181                 else
2182                     if $test -f UU/myread; then
2183                         . ./UU/myread
2184                     else
2185                         echo "Cannot find myread, sorry.  Aborting." >&2
2186                         exit 1
2187                     fi
2188                 fi  
2189                 case "$ans" in
2190                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2191                 esac
2192             fi
2193         fi
2194         if $test X"$despair" = Xyes; then
2195             $cat >&4 <<EOM
2196 You need to find a working C compiler.
2197 Either (purchase and) install the C compiler supplied by your OS vendor,
2198 or for a free C compiler try http://gcc.gnu.org/
2199 I cannot continue any further, aborting.
2200 EOM
2201             exit 1
2202         fi
2203     fi
2204     $rm -f try try.*
2205     ;;
2206 esac
2207 EOSC
2208
2209 : determine whether symbolic links are supported
2210 echo " "
2211 $touch blurfl
2212 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2213         echo "Symbolic links are supported." >&4
2214         lns="$ln -s"
2215 else
2216         echo "Symbolic links are NOT supported." >&4
2217         lns="$ln"
2218 fi
2219 $rm -f blurfl sym
2220
2221 : determine whether symbolic links are supported
2222 echo " "
2223 case "$lns" in
2224 *"ln -s")
2225         echo "Checking how to test for symbolic links..." >&4
2226         $lns blurfl sym
2227         if $test "X$issymlink" = X; then
2228                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2229                 if test $? = 0; then
2230                         issymlink="test -h"
2231                 fi              
2232         fi
2233         if $test "X$issymlink" = X; then
2234                 if  $test -h >/dev/null 2>&1; then
2235                         issymlink="$test -h"
2236                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2237                 fi              
2238         fi
2239         if $test "X$issymlink" = X; then
2240                 if $test -L sym 2>/dev/null; then
2241                         issymlink="$test -L"
2242                 fi
2243         fi
2244         if $test "X$issymlink" != X; then
2245                 echo "You can test for symbolic links with '$issymlink'." >&4
2246         else
2247                 echo "I do not know how you can test for symbolic links." >&4
2248         fi
2249         $rm -f blurfl sym
2250         ;;
2251 *)      echo "No symbolic links, so not testing for their testing..." >&4
2252         ;;
2253 esac
2254 echo " "
2255
2256
2257 case "$mksymlinks" in
2258 $define|true|[yY]*)
2259         case "$src" in
2260         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2261                 exit 1
2262                 ;;
2263         *)      case "$lns:$issymlink" in
2264                 *"ln -s:"*"test -"?)
2265                         echo "Creating the symbolic links..." >&4
2266                         echo "(First creating the subdirectories...)" >&4
2267                         cd ..
2268                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2269                                 read directory
2270                                 test -z "$directory" && break
2271                                 mkdir -p $directory
2272                         done
2273                         # Sanity check 1.
2274                         if test ! -d t/base; then
2275                                 echo "Failed to create the subdirectories.  Aborting." >&4
2276                                 exit 1
2277                         fi
2278                         echo "(Then creating the symlinks...)" >&4
2279                         awk '{print $1}' $src/MANIFEST | while true; do
2280                                 read filename
2281                                 test -z "$filename" && break
2282                                 if test -f $filename; then
2283                                         if $issymlink $filename; then
2284                                                 rm -f $filename
2285                                         fi
2286                                 fi
2287                                 if test -f $filename; then
2288                                         echo "$filename already exists, not symlinking."
2289                                 else
2290                                         ln -s $src/$filename $filename
2291                                 fi
2292                         done
2293                         # Sanity check 2.
2294                         if test ! -f t/base/commonsense.t; then
2295                                 echo "Failed to create the symlinks.  Aborting." >&4
2296                                 exit 1
2297                         fi
2298                         cd UU
2299                         ;;
2300                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2301                         ;;
2302                 esac
2303                 ;;
2304         esac
2305         ;;
2306 esac
2307
2308 : see whether [:lower:] and [:upper:] are supported character classes
2309 echo " "
2310 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2311 ABYZ)
2312         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2313         up='[:upper:]'
2314         low='[:lower:]'
2315         ;;
2316 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2317         # (0xc9 and 0xd1), therefore that is a nice testing point.
2318         if test "X$up" = X -o "X$low" = X; then
2319             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2320             ij) up='[A-Z]'
2321                 low='[a-z]'
2322                 ;;
2323             esac
2324         fi
2325         if test "X$up" = X -o "X$low" = X; then
2326             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2327             ij) up='A-Z'
2328                 low='a-z'
2329                 ;;
2330             esac
2331         fi
2332         if test "X$up" = X -o "X$low" = X; then
2333             case "`echo IJ | od -x 2>/dev/null`" in
2334             *C9D1*|*c9d1*)
2335                 echo "Hey, this might be EBCDIC." >&4
2336                 if test "X$up" = X -o "X$low" = X; then
2337                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2338                     ij) up='[A-IJ-RS-Z]'
2339                         low='[a-ij-rs-z]'
2340                         ;;
2341                     esac
2342                 fi
2343                 if test "X$up" = X -o "X$low" = X; then
2344                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2345                     ij) up='A-IJ-RS-Z'
2346                         low='a-ij-rs-z'
2347                         ;;
2348                     esac
2349                 fi
2350                 ;;
2351             esac
2352         fi
2353 esac
2354 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2355 ij)
2356     echo "Using $up and $low to convert case." >&4
2357     ;;
2358 *)
2359     echo "I don't know how to translate letters from upper to lower case." >&4
2360     echo "Your tr is not acting any way I know of." >&4
2361     exit 1
2362     ;;
2363 esac
2364 : set up the translation script tr, must be called with ./tr of course
2365 cat >tr <<EOSC
2366 $startsh
2367 case "\$1\$2" in
2368 '[A-Z][a-z]') exec $tr '$up' '$low';;
2369 '[a-z][A-Z]') exec $tr '$low' '$up';;
2370 esac
2371 exec $tr "\$@"
2372 EOSC
2373 chmod +x tr
2374 $eunicefix tr
2375
2376 : Try to determine whether config.sh was made on this system
2377 case "$config_sh" in
2378 '')
2379 myuname=`$uname -a 2>/dev/null`
2380 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2381 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2382 # because the A-Z/a-z are not consecutive.
2383 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2384         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2385 newmyuname="$myuname"
2386 dflt=n
2387 case "$knowitall" in
2388 '')
2389         if test -f ../config.sh; then
2390                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2391                         eval "`grep myuname= ../config.sh`"
2392                 fi
2393                 if test "X$myuname" = "X$newmyuname"; then
2394                         dflt=y
2395                 fi
2396         fi
2397         ;;
2398 *) dflt=y;;
2399 esac
2400
2401 : Get old answers from old config file if Configure was run on the
2402 : same system, otherwise use the hints.
2403 hint=default
2404 cd ..
2405 if test -f config.sh; then
2406         echo " "
2407         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2408         . UU/myread
2409         case "$ans" in
2410         n*|N*) echo "OK, I'll ignore it."
2411                 mv config.sh config.sh.old
2412                 myuname="$newmyuname"
2413                 ;;
2414         *)  echo "Fetching default answers from your old config.sh file..." >&4
2415                 tmp_n="$n"
2416                 tmp_c="$c"
2417                 tmp_sh="$sh"
2418                 . ./config.sh
2419                 cp config.sh UU
2420                 n="$tmp_n"
2421                 c="$tmp_c"
2422                 : Older versions did not always set $sh.  Catch re-use of such
2423                 : an old config.sh.
2424                 case "$sh" in
2425                 '') sh="$tmp_sh" ;;
2426                 esac
2427                 hint=previous
2428                 ;;
2429         esac
2430 fi
2431 . ./UU/checkcc
2432 if test ! -f config.sh; then
2433         $cat <<EOM
2434
2435 First time through, eh?  I have some defaults handy for some systems
2436 that need some extra help getting the Configure answers right:
2437
2438 EOM
2439         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2440         dflt=''
2441         : Half the following guesses are probably wrong... If you have better
2442         : tests or hints, please send them to perlbug@perl.org
2443         : The metaconfig authors would also appreciate a copy...
2444         $test -f /irix && osname=irix
2445         $test -f /xenix && osname=sco_xenix
2446         $test -f /dynix && osname=dynix
2447         $test -f /dnix && osname=dnix
2448         $test -f /lynx.os && osname=lynxos
2449         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2450         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2451         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2452         $test -f /bin/mips && /bin/mips && osname=mips
2453         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2454                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2455         $test -d /usr/apollo/bin && osname=apollo
2456         $test -f /etc/saf/_sactab && osname=svr4
2457         $test -d /usr/include/minix && osname=minix
2458         if $test -d /MachTen -o -d /MachTen_Folder; then
2459                 osname=machten
2460                 if $test -x /sbin/version; then
2461                         osvers=`/sbin/version | $awk '{print $2}' |
2462                         $sed -e 's/[A-Za-z]$//'`
2463                 elif $test -x /usr/etc/version; then
2464                         osvers=`/usr/etc/version | $awk '{print $2}' |
2465                         $sed -e 's/[A-Za-z]$//'`
2466                 else
2467                         osvers="$2.$3"
2468                 fi
2469         fi
2470
2471         $test -f /sys/posix.dll &&
2472                 $test -f /usr/bin/what &&
2473                 set X `/usr/bin/what /sys/posix.dll` &&
2474                 $test "$3" = UWIN &&
2475                 osname=uwin &&
2476                 osvers="$5"
2477
2478         if $test -f $uname; then
2479                 set X $myuname
2480                 shift
2481
2482                 case "$5" in
2483                 fps*) osname=fps ;;
2484                 mips*)
2485                         case "$4" in
2486                         umips) osname=umips ;;
2487                         *) osname=mips ;;
2488                         esac;;
2489                 [23]100) osname=mips ;;
2490                 next*) osname=next ;;
2491                 i386*)
2492                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2493                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2494                                 osname='sco'
2495                                 osvers=$tmp
2496                         elif $test -f /etc/kconfig; then
2497                                 osname=isc
2498                                 if test "$lns" = "$ln -s"; then
2499                                         osvers=4
2500                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2501                                         osvers=3
2502                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2503                                         osvers=2
2504                                 fi
2505                         fi
2506                         tmp=''
2507                         ;;
2508                 pc*)
2509                         if test -n "$DJGPP"; then
2510                                 osname=dos
2511                                 osvers=djgpp
2512                         fi
2513                         ;;
2514                 esac
2515
2516                 case "$1" in
2517                 aix) osname=aix
2518                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2519                         case "$tmp" in
2520                         'not found') osvers="$4"."$3" ;;
2521                         '<3240'|'<>3240') osvers=3.2.0 ;;
2522                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2523                         '=3250'|'>3250') osvers=3.2.5 ;;
2524                         *) osvers=$tmp;;
2525                         esac
2526                         ;;
2527                 bsd386) osname=bsd386
2528                         osvers=`$uname -r`
2529                         ;;
2530                 cygwin*) osname=cygwin
2531                         osvers="$3"
2532                         ;;
2533                 *dc.osx) osname=dcosx
2534                         osvers="$3"
2535                         ;;
2536                 dnix) osname=dnix
2537                         osvers="$3"
2538                         ;;
2539                 domainos) osname=apollo
2540                         osvers="$3"
2541                         ;;
2542                 dgux) osname=dgux 
2543                         osvers="$3"
2544                         ;;
2545                 dynixptx*) osname=dynixptx
2546                         osvers=`echo "$4"|sed 's/^v//'`
2547                         ;;
2548                 freebsd) osname=freebsd 
2549                         osvers="$3" ;;
2550                 genix) osname=genix ;;
2551                 hp*) osname=hpux 
2552                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2553                         ;;
2554                 irix*) osname=irix
2555                         case "$3" in
2556                         4*) osvers=4 ;;
2557                         5*) osvers=5 ;;
2558                         *)      osvers="$3" ;;
2559                         esac
2560                         ;;
2561                 linux) osname=linux
2562                         case "$3" in
2563                         *)      osvers="$3" ;;
2564                         esac
2565                         ;;
2566                 MiNT) osname=mint
2567                         ;;
2568                 netbsd*) osname=netbsd
2569                         osvers="$3"
2570                         ;;
2571                 news-os) osvers="$3"
2572                         case "$3" in
2573                         4*) osname=newsos4 ;;
2574                         *) osname=newsos ;;
2575                         esac
2576                         ;;
2577                 next*) osname=next ;;
2578                 nonstop-ux) osname=nonstopux ;;
2579                 POSIX-BC | posix-bc ) osname=posix-bc
2580                         osvers="$3"
2581                         ;;
2582                 powerux | power_ux | powermax_os | powermaxos | \
2583                 powerunix | power_unix) osname=powerux
2584                         osvers="$3"
2585                         ;;
2586                 qnx) osname=qnx
2587                         osvers="$4"
2588                         ;;
2589                 solaris) osname=solaris
2590                         case "$3" in
2591                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2592                         *)      osvers="$3" ;;
2593                         esac
2594                         ;;
2595                 sunos) osname=sunos
2596                         case "$3" in
2597                         5*) osname=solaris
2598                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2599                         *)      osvers="$3" ;;
2600                         esac
2601                         ;;
2602                 titanos) osname=titanos
2603                         case "$3" in
2604                         1*) osvers=1 ;;
2605                         2*) osvers=2 ;;
2606                         3*) osvers=3 ;;
2607                         4*) osvers=4 ;;
2608                         *)      osvers="$3" ;;
2609                         esac
2610                         ;;
2611                 ultrix) osname=ultrix
2612                         osvers="$3"
2613                         ;;
2614                 osf1|mls+)      case "$5" in
2615                                 alpha)
2616                                         osname=dec_osf
2617                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2618                                         case "$osvers" in
2619                                         [1-9].[0-9]*) ;;
2620                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2621                                         esac
2622                                         ;;
2623                         hp*)    osname=hp_osf1  ;;
2624                         mips)   osname=mips_osf1 ;;
2625                         esac
2626                         ;;
2627                 unixware) osname=svr5
2628                         osvers="$4"
2629                         ;;
2630                 uts) osname=uts
2631                         osvers="$3"
2632                         ;;
2633                 $2) case "$osname" in
2634                         *isc*) ;;
2635                         *freebsd*) ;;
2636                         svr*)
2637                                 : svr4.x or possibly later
2638                                 case "svr$3" in 
2639                                 ${osname}*)
2640                                         osname=svr$3
2641                                         osvers=$4
2642                                         ;;
2643                                 esac
2644                                 case "$osname" in
2645                                 svr4.0)
2646                                         : Check for ESIX
2647                                         if test -f /stand/boot ; then
2648                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2649                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2650                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2651                                                         if test -n "$isesix"; then
2652                                                                 osname=esix4
2653                                                         fi
2654                                                 fi
2655                                         fi
2656                                         ;;
2657                                 esac
2658                                 ;;
2659                         *)      if test -f /etc/systemid; then
2660                                         osname=sco
2661                                         set `echo $3 | $sed 's/\./ /g'` $4
2662                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2663                                                 osvers=$1.$2.$3
2664                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2665                                                 osvers=$1.$2
2666                                         elif $test -f $src/hints/sco_$1.sh; then
2667                                                 osvers=$1
2668                                         fi
2669                                 else
2670                                         case "$osname" in
2671                                         '') : Still unknown.  Probably a generic Sys V.
2672                                                 osname="sysv"
2673                                                 osvers="$3"
2674                                                 ;;
2675                                         esac
2676                                 fi
2677                                 ;;
2678                         esac
2679                         ;;
2680                 *)      case "$osname" in
2681                         '') : Still unknown.  Probably a generic BSD.
2682                                 osname="$1"
2683                                 osvers="$3"
2684                                 ;;
2685                         esac
2686                         ;;
2687                 esac
2688         else
2689                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2690                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2691                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2692                                 osname=news_os
2693                         fi
2694                         $rm -f UU/kernel.what
2695                 elif test -d c:/.; then
2696                         set X $myuname
2697                         osname=os2
2698                         osvers="$5"
2699                 fi
2700         fi
2701         
2702         : Now look for a hint file osname_osvers, unless one has been
2703         : specified already.
2704         case "$hintfile" in
2705         ''|' ')
2706                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2707                 : Also try without trailing minor version numbers.
2708                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2709                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2710                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2711                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2712                 case "$file" in
2713                 '') dflt=none ;;
2714                 *)  case "$osvers" in
2715                         '') dflt=$file
2716                                 ;;
2717                         *)  if $test -f $src/hints/$file.sh ; then
2718                                         dflt=$file
2719                                 elif $test -f $src/hints/$xfile.sh ; then
2720                                         dflt=$xfile
2721                                 elif $test -f $src/hints/$xxfile.sh ; then
2722                                         dflt=$xxfile
2723                                 elif $test -f $src/hints/$xxxfile.sh ; then
2724                                         dflt=$xxxfile
2725                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2726                                         dflt=$xxxxfile
2727                                 elif $test -f "$src/hints/${osname}.sh" ; then
2728                                         dflt="${osname}"
2729                                 else
2730                                         dflt=none
2731                                 fi
2732                                 ;;
2733                         esac
2734                         ;;
2735                 esac
2736                 if $test -f Policy.sh ; then
2737                         case "$dflt" in
2738                         *Policy*) ;;
2739                         none) dflt="Policy" ;;
2740                         *) dflt="Policy $dflt" ;;
2741                         esac
2742                 fi
2743                 ;;
2744         *)
2745                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2746                 ;;
2747         esac
2748
2749         if $test -f Policy.sh ; then
2750                 $cat <<EOM
2751
2752 There's also a Policy hint file available, which should make the
2753 site-specific (policy) questions easier to answer.
2754 EOM
2755
2756         fi
2757
2758         $cat <<EOM
2759
2760 You may give one or more space-separated answers, or "none" if appropriate.
2761 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2762 is a good thing.  DO NOT give a wrong version or a wrong OS.
2763
2764 EOM
2765
2766         rp="Which of these apply, if any?"
2767         . UU/myread
2768         tans=$ans
2769         for file in $tans; do
2770                 if $test X$file = XPolicy -a -f Policy.sh; then
2771                         . Policy.sh
2772                         $cat Policy.sh >> UU/config.sh
2773                 elif $test -f $src/hints/$file.sh; then
2774                         . $src/hints/$file.sh
2775                         $cat $src/hints/$file.sh >> UU/config.sh
2776                 elif $test X$tans = X -o X$tans = Xnone ; then
2777                         : nothing
2778                 else
2779                         : Give one chance to correct a possible typo.
2780                         echo "$file.sh does not exist"
2781                         dflt=$file
2782                         rp="hint to use instead?"
2783                         . UU/myread
2784                         for file in $ans; do
2785                                 if $test -f "$src/hints/$file.sh"; then
2786                                         . $src/hints/$file.sh
2787                                         $cat $src/hints/$file.sh >> UU/config.sh
2788                                 elif $test X$ans = X -o X$ans = Xnone ; then
2789                                         : nothing
2790                                 else
2791                                         echo "$file.sh does not exist -- ignored."
2792                                 fi
2793                         done
2794                 fi
2795         done
2796
2797         hint=recommended
2798         : Remember our hint file for later.
2799         if $test -f "$src/hints/$file.sh" ; then
2800                 hintfile="$file"
2801         else
2802                 hintfile=''
2803         fi
2804 fi
2805 cd UU
2806 ;;
2807 *)
2808         echo " "
2809         echo "Fetching default answers from $config_sh..." >&4
2810         tmp_n="$n"
2811         tmp_c="$c"
2812         cd ..
2813         cp $config_sh config.sh 2>/dev/null
2814         chmod +w config.sh
2815         . ./config.sh
2816         cd UU
2817         cp ../config.sh .
2818         n="$tmp_n"
2819         c="$tmp_c"
2820         hint=previous
2821         ;;
2822 esac
2823 test "$override" && . ./optdef.sh
2824
2825 : Restore computed paths
2826 for file in $loclist $trylist; do
2827         eval $file="\$_$file"
2828 done
2829
2830 cat << EOM
2831
2832 Configure uses the operating system name and version to set some defaults.
2833 The default value is probably right if the name rings a bell. Otherwise,
2834 since spelling matters for me, either accept the default or answer "none"
2835 to leave it blank.
2836
2837 EOM
2838 case "$osname" in
2839         ''|' ')
2840                 case "$hintfile" in
2841                 ''|' '|none) dflt=none ;;
2842                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2843                 esac
2844                 ;;
2845         *) dflt="$osname" ;;
2846 esac
2847 rp="Operating system name?"
2848 . ./myread
2849 case "$ans" in
2850 none)  osname='' ;;
2851 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2852 esac
2853 echo " "
2854 case "$osvers" in
2855         ''|' ')
2856                 case "$hintfile" in
2857                 ''|' '|none) dflt=none ;;
2858                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2859                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2860                         case "$dflt" in
2861                         ''|' ') dflt=none ;;
2862                         esac
2863                         ;;
2864                 esac
2865                 ;;
2866         *) dflt="$osvers" ;;
2867 esac
2868 rp="Operating system version?"
2869 . ./myread
2870 case "$ans" in
2871 none)  osvers='' ;;
2872 *) osvers="$ans" ;;
2873 esac
2874
2875
2876 . ./posthint.sh
2877
2878 : who configured the system
2879 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2880 cf_by=`(logname) 2>/dev/null`
2881 case "$cf_by" in
2882 "")
2883         cf_by=`(whoami) 2>/dev/null`
2884         case "$cf_by" in
2885         "") cf_by=unknown ;;
2886         esac ;;
2887 esac
2888
2889 : set up the script used to warn in case of inconsistency
2890 cat <<EOS >whoa
2891 $startsh
2892 EOS
2893 cat <<'EOSC' >>whoa
2894 dflt=y
2895 echo " "
2896 echo "*** WHOA THERE!!! ***" >&4
2897 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2898 rp="    Keep the $hint value?"
2899 . ./myread
2900 case "$ans" in
2901 y) td=$was; tu=$was;;
2902 esac
2903 EOSC
2904
2905 : function used to set $1 to $val
2906 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2907 case "$val$was" in
2908 $define$undef) . ./whoa; eval "$var=\$td";;
2909 $undef$define) . ./whoa; eval "$var=\$tu";;
2910 *) eval "$var=$val";;
2911 esac'
2912
2913 case "$usethreads" in
2914 $define|true|[yY]*)     dflt='y';;
2915 *) dflt='n';;
2916 esac
2917 cat <<EOM
2918
2919 Perl can be built to take advantage of threads on some systems.
2920 To do so, Configure can be run with -Dusethreads.
2921
2922 Note that threading is a highly experimental feature, and
2923 some known race conditions still remain.  If you choose to try
2924 it, be very sure to not actually deploy it for production
2925 purposes.  README.threads has more details, and is required
2926 reading if you enable threads.
2927
2928 If this doesn't make any sense to you, just accept the default '$dflt'.
2929 EOM
2930 rp='Build a threading Perl?'
2931 . ./myread
2932 case "$ans" in
2933 y|Y)    val="$define" ;;
2934 *)      val="$undef" ;;
2935 esac
2936 set usethreads
2937 eval $setvar
2938
2939 case "$usethreads" in
2940 $define)
2941         $cat <<EOM
2942
2943 As of 5.5.640, Perl has two different internal threading implementations,
2944 the 5.005 version (5005threads) and an interpreter-based version
2945 (ithreads) that has one interpreter per thread.  Both are very 
2946 experimental.  This arrangement exists to help developers work out
2947 which one is better.
2948
2949 If you're a casual user, you probably don't want interpreter-threads
2950 at this time.  There doesn't yet exist a way to create threads from
2951 within Perl in this model, i.e., "use Thread;" will NOT work.
2952 EOM
2953         : Default to ithreads unless overridden on command line or with
2954         : old config.sh
2955         dflt='y'
2956         case "$use5005threads" in
2957                 $define|true|[yY]*) dflt='n';;
2958         esac
2959         case "$useithreads" in
2960                 $undef|false|[nN]*) dflt='n';;
2961         esac
2962         rp='Use interpreter-based ithreads?'
2963         . ./myread
2964         case "$ans" in
2965         y|Y)    val="$define" ;;
2966         *)      val="$undef" ;;
2967         esac
2968         set useithreads
2969         eval $setvar
2970         : Now set use5005threads to the opposite value.
2971         case "$useithreads" in
2972         $define) val="$undef" ;;
2973         *) val="$define" ;;
2974         esac
2975         set use5005threads
2976         eval $setvar
2977         ;;
2978 *)
2979         useithreads="$undef"
2980         use5005threads="$undef"
2981         ;;
2982 esac
2983
2984 case "$useithreads$use5005threads" in
2985 "$define$define")
2986         $cat >&4 <<EOM
2987
2988 You cannot have both the ithreads and the 5.005 threads enabled
2989 at the same time.  Disabling the 5.005 threads since they are
2990 much less stable than the ithreads.
2991
2992 EOM
2993         use5005threads="$undef"
2994         ;;
2995 esac
2996
2997 case "$d_oldpthreads" in
2998 '')     : Configure tests would be welcome here.  For now, assume undef.
2999         val="$undef" ;;
3000 *)      val="$d_oldpthreads" ;;
3001 esac
3002 set d_oldpthreads
3003 eval $setvar
3004
3005
3006 case "$usethreads" in
3007 "$define"|true|[yY]*)
3008 : Look for a hint-file generated 'call-back-unit'.  If the
3009 : user has specified that a threading perl is to be built,
3010 : we may need to set or change some other defaults.
3011         if $test -f usethreads.cbu; then
3012                 echo "Your platform has some specific hints for threaded builds, using them..."
3013                 . ./usethreads.cbu
3014         else
3015                 $cat <<EOM
3016 (Your platform doesn't have any specific hints for threaded builds.
3017  Assuming POSIX threads, then.)
3018 EOM
3019         fi
3020         ;;
3021 esac
3022
3023 cat <<EOM
3024
3025 Perl can be built so that multiple Perl interpreters can coexist
3026 within the same Perl executable.
3027 EOM
3028
3029 case "$useithreads" in
3030 $define)
3031         cat <<EOM
3032 This multiple interpreter support is required for interpreter-based threads.
3033 EOM
3034         val="$define"
3035         ;;
3036 *)      case "$usemultiplicity" in
3037         $define|true|[yY]*)     dflt='y';;
3038         *) dflt='n';;
3039         esac
3040         echo " "
3041         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3042         rp='Build Perl for multiplicity?'
3043         . ./myread
3044         case "$ans" in
3045         y|Y)    val="$define" ;;
3046         *)      val="$undef" ;;
3047         esac
3048         ;;
3049 esac
3050 set usemultiplicity
3051 eval $setvar
3052
3053 : make some quick guesses about what we are up against
3054 echo " "
3055 $echo $n "Hmm...  $c"
3056 echo exit 1 >bsd
3057 echo exit 1 >usg
3058 echo exit 1 >v7
3059 echo exit 1 >osf1
3060 echo exit 1 >eunice
3061 echo exit 1 >xenix
3062 echo exit 1 >venix
3063 echo exit 1 >os2
3064 d_bsd="$undef"
3065 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3066 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3067 then
3068         echo "Looks kind of like an OSF/1 system, but we'll see..."
3069         echo exit 0 >osf1
3070 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3071         xxx=`./loc addbib blurfl $pth`
3072         if $test -f $xxx; then
3073         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3074                 echo exit 0 >bsd
3075                 echo exit 0 >usg
3076         else
3077                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3078                         echo "Looks kind of like an extended USG system, but we'll see..."
3079                 else
3080                         echo "Looks kind of like a USG system, but we'll see..."
3081                 fi
3082                 echo exit 0 >usg
3083         fi
3084 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3085         echo "Looks kind of like a BSD system, but we'll see..."
3086         d_bsd="$define"
3087         echo exit 0 >bsd
3088 else
3089         echo "Looks kind of like a Version 7 system, but we'll see..."
3090         echo exit 0 >v7
3091 fi
3092 case "$eunicefix" in
3093 *unixtovms*)
3094         $cat <<'EOI'
3095 There is, however, a strange, musty smell in the air that reminds me of
3096 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3097 EOI
3098         echo exit 0 >eunice
3099         d_eunice="$define"
3100 : it so happens the Eunice I know will not run shell scripts in Unix format
3101         ;;
3102 *)
3103         echo " "
3104         echo "Congratulations.  You aren't running Eunice."
3105         d_eunice="$undef"
3106         ;;
3107 esac
3108 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3109 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3110 : semicolon as a patch separator
3111 case "$p_" in
3112 :) ;;
3113 *)
3114         $cat <<'EOI'
3115 I have the feeling something is not exactly right, however...don't tell me...
3116 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3117 (Or you may be running DOS with DJGPP.)
3118 EOI
3119         echo exit 0 >os2
3120         ;;
3121 esac
3122 if test -f /xenix; then
3123         echo "Actually, this looks more like a XENIX system..."
3124         echo exit 0 >xenix
3125         d_xenix="$define"
3126 else
3127         echo " "
3128         echo "It's not Xenix..."
3129         d_xenix="$undef"
3130 fi
3131 chmod +x xenix
3132 $eunicefix xenix
3133 if test -f /venix; then
3134         echo "Actually, this looks more like a VENIX system..."
3135         echo exit 0 >venix
3136 else
3137         echo " "
3138         if ./xenix; then
3139                 : null
3140         else
3141                 echo "Nor is it Venix..."
3142         fi
3143 fi
3144 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3145 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3146 $rm -f foo
3147
3148 case "$cc" in
3149 '') dflt=cc;;
3150 *) dflt="$cc";;
3151 esac
3152 rp="Use which C compiler?"
3153 . ./myread
3154 cc="$ans"
3155 : Look for a hint-file generated 'call-back-unit'.  Now that the
3156 : user has specified the compiler, we may need to set or change some
3157 : other defaults.
3158 if $test -f cc.cbu; then
3159     . ./cc.cbu
3160 fi
3161 . ./checkcc
3162
3163 echo " "
3164 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3165 $cat >gccvers.c <<EOM
3166 #include <stdio.h>
3167 int main() {
3168 #ifdef __GNUC__
3169 #ifdef __VERSION__
3170         printf("%s\n", __VERSION__);
3171 #else
3172         printf("%s\n", "1");
3173 #endif
3174 #endif
3175         exit(0);
3176 }
3177 EOM
3178 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3179         gccversion=`./gccvers`
3180         case "$gccversion" in
3181         '') echo "You are not using GNU cc." ;;
3182         *)  echo "You are using GNU cc $gccversion."
3183             ccname=gcc  
3184             ;;
3185         esac
3186 else
3187         echo " "
3188         echo "*** WHOA THERE!!! ***" >&4
3189         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3190         case "$knowitall" in
3191         '')
3192         echo "    You'd better start hunting for one and let me know about it." >&4
3193                 exit 1
3194                 ;;
3195         esac
3196 fi
3197 $rm -f gccvers*
3198 case "$gccversion" in
3199 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3200 esac
3201 case "$gccversion" in
3202 '') gccosandvers='' ;;
3203 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3204    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3205    gccshortvers=''
3206    case "$gccosandvers" in
3207    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3208    $osname$osvers) ;; # looking good
3209    $osname*) cat <<EOM >&4
3210
3211 *** WHOA THERE!!! ***
3212
3213     Your gcc has not been compiled for the exact release of
3214     your operating system ($gccosandvers versus $osname$osvers).
3215
3216     In general it is a good idea to keep gcc synchronized with
3217     the operating system because otherwise serious problems
3218     may ensue when trying to compile software, like Perl.
3219
3220     I'm trying to be optimistic here, though, and will continue.
3221     If later during the configuration and build icky compilation
3222     problems appear (headerfile conflicts being the most common
3223     manifestation), I suggest reinstalling the gcc to match
3224     your operating system release.
3225
3226 EOM
3227       ;;
3228    *) gccosandvers='' ;; # failed to parse, better be silent
3229    esac
3230    ;;
3231 esac
3232 case "$ccname" in
3233 '') ccname="$cc" ;;
3234 esac
3235
3236 case "$gccversion" in
3237 '') ;;
3238 *)  case "$ccflags" in
3239     *-Wall*) ;;
3240     *) ccflags="$ccflags -Wall" ;;
3241     esac
3242     ;;
3243 esac
3244
3245 : see how we invoke the C preprocessor
3246 echo " "
3247 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3248 cat <<'EOT' >testcpp.c
3249 #define ABC abc
3250 #define XYZ xyz
3251 ABC.XYZ
3252 EOT
3253 cd ..
3254 if test ! -f cppstdin; then
3255         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3256                 # AIX cc -E doesn't show the absolute headerfile
3257                 # locations but we'll cheat by using the -M flag.
3258                 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
3259         else
3260                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3261         fi
3262 else
3263         echo "Keeping your $hint cppstdin wrapper."
3264 fi
3265 chmod 755 cppstdin
3266 wrapper=`pwd`/cppstdin
3267 ok='false'
3268 cd UU
3269
3270 if $test "X$cppstdin" != "X" && \
3271         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3272         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3273 then
3274         echo "You used to use $cppstdin $cppminus so we'll use that again."
3275         case "$cpprun" in
3276         '') echo "But let's see if we can live without a wrapper..." ;;
3277         *)
3278                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3279                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3280                 then
3281                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3282                         ok='true'
3283                 else
3284                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3285                 fi
3286                 ;;
3287         esac
3288 else
3289         case "$cppstdin" in
3290         '') ;;
3291         *)
3292                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3293                 ;;
3294         esac
3295 fi
3296
3297 if $ok; then
3298         : nothing
3299 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3300         $cc -E <testcpp.c >testcpp.out 2>&1; \
3301         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3302         echo "Yup, it does."
3303         x_cpp="$cc -E"
3304         x_minus='';
3305 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3306         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3307         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3308         echo "Yup, it does."
3309         x_cpp="$cc -E"
3310         x_minus='-';
3311 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3312         $cc -P <testcpp.c >testcpp.out 2>&1; \
3313         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3314         echo "Yipee, that works!"
3315         x_cpp="$cc -P"
3316         x_minus='';
3317 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3318         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3319         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3320         echo "At long last!"
3321         x_cpp="$cc -P"
3322         x_minus='-';
3323 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3324         $cpp <testcpp.c >testcpp.out 2>&1; \
3325         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3326         echo "It works!"
3327         x_cpp="$cpp"
3328         x_minus='';
3329 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3330         $cpp - <testcpp.c >testcpp.out 2>&1; \
3331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3332         echo "Hooray, it works!  I was beginning to wonder."
3333         x_cpp="$cpp"
3334         x_minus='-';
3335 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3336         $wrapper <testcpp.c >testcpp.out 2>&1; \
3337         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3338         x_cpp="$wrapper"
3339         x_minus=''
3340         echo "Eureka!"
3341 else
3342         dflt=''
3343         rp="No dice.  I can't find a C preprocessor.  Name one:"
3344         . ./myread
3345         x_cpp="$ans"
3346         x_minus=''
3347         $x_cpp <testcpp.c >testcpp.out 2>&1
3348         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3349                 echo "OK, that will do." >&4
3350         else
3351 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3352                 exit 1
3353         fi
3354 fi
3355
3356 case "$ok" in
3357 false)
3358         cppstdin="$x_cpp"
3359         cppminus="$x_minus"
3360         cpprun="$x_cpp"
3361         cpplast="$x_minus"
3362         set X $x_cpp
3363         shift
3364         case "$1" in
3365         "$cpp")
3366                 echo "Perhaps can we force $cc -E using a wrapper..."
3367                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3368                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3369                 then
3370                         echo "Yup, we can."
3371                         cppstdin="$wrapper"
3372                         cppminus='';
3373                 else
3374                         echo "Nope, we'll have to live without it..."
3375                 fi
3376                 ;;
3377         esac
3378         case "$cpprun" in
3379         "$wrapper")
3380                 cpprun=''
3381                 cpplast=''
3382                 ;;
3383         esac
3384         ;;
3385 esac
3386
3387 case "$cppstdin" in
3388 "$wrapper"|'cppstdin') ;;
3389 *) $rm -f $wrapper;;
3390 esac
3391 $rm -f testcpp.c testcpp.out
3392
3393 : decide how portable to be.  Allow command line overrides.
3394 case "$d_portable" in
3395 "$undef") ;;
3396 *)      d_portable="$define" ;;
3397 esac
3398
3399 : set up shell script to do ~ expansion
3400 cat >filexp <<EOSS
3401 $startsh
3402 : expand filename
3403 case "\$1" in
3404  ~/*|~)
3405         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3406         ;;
3407  ~*)
3408         if $test -f /bin/csh; then
3409                 /bin/csh -f -c "glob \$1"
3410                 failed=\$?
3411                 echo ""
3412                 exit \$failed
3413         else
3414                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3415                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3416                 if $test ! -d "\$dir"; then
3417                         me=\`basename \$0\`
3418                         echo "\$me: can't locate home directory for: \$name" >&2
3419                         exit 1
3420                 fi
3421                 case "\$1" in
3422                 */*)
3423                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3424                         ;;
3425                 *)
3426                         echo \$dir
3427                         ;;
3428                 esac
3429         fi
3430         ;;
3431 *)
3432         echo \$1
3433         ;;
3434 esac
3435 EOSS
3436 chmod +x filexp
3437 $eunicefix filexp
3438
3439 : now set up to get a file name
3440 cat <<EOS >getfile
3441 $startsh
3442 EOS
3443 cat <<'EOSC' >>getfile
3444 tilde=''
3445 fullpath=''
3446 already=''
3447 skip=''
3448 none_ok=''
3449 exp_file=''
3450 nopath_ok=''
3451 orig_rp="$rp"
3452 orig_dflt="$dflt"
3453 case "$gfpth" in
3454 '') gfpth='.' ;;
3455 esac
3456
3457 case "$fn" in
3458 *\(*)
3459         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3460         fn=`echo $fn | sed 's/(.*)//'`
3461         ;;
3462 esac
3463
3464 case "$fn" in
3465 *:*)
3466         loc_file=`expr $fn : '.*:\(.*\)'`
3467         fn=`expr $fn : '\(.*\):.*'`
3468         ;;
3469 esac
3470
3471 case "$fn" in
3472 *~*) tilde=true;;
3473 esac
3474 case "$fn" in
3475 */*) fullpath=true;;
3476 esac
3477 case "$fn" in
3478 *+*) skip=true;;
3479 esac
3480 case "$fn" in
3481 *n*) none_ok=true;;
3482 esac
3483 case "$fn" in
3484 *e*) exp_file=true;;
3485 esac
3486 case "$fn" in
3487 *p*) nopath_ok=true;;
3488 esac
3489
3490 case "$fn" in
3491 *f*) type='File';;
3492 *d*) type='Directory';;
3493 *l*) type='Locate';;
3494 esac
3495
3496 what="$type"
3497 case "$what" in
3498 Locate) what='File';;
3499 esac
3500
3501 case "$exp_file" in
3502 '')
3503         case "$d_portable" in
3504         "$define") ;;
3505         *) exp_file=true;;
3506         esac
3507         ;;
3508 esac
3509
3510 cd ..
3511 while test "$type"; do
3512         redo=''
3513         rp="$orig_rp"
3514         dflt="$orig_dflt"
3515         case "$tilde" in
3516         true) rp="$rp (~name ok)";;
3517         esac
3518         . UU/myread
3519         if test -f UU/getfile.ok && \
3520                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3521         then
3522                 value="$ans"
3523                 ansexp="$ans"
3524                 break
3525         fi
3526         case "$ans" in
3527         none)
3528                 value=''
3529                 ansexp=''
3530                 case "$none_ok" in
3531                 true) type='';;
3532                 esac
3533                 ;;
3534         *)
3535                 case "$tilde" in
3536                 '') value="$ans"
3537                         ansexp="$ans";;
3538                 *)
3539                         value=`UU/filexp $ans`
3540                         case $? in
3541                         0)
3542                                 if test "$ans" != "$value"; then
3543                                         echo "(That expands to $value on this system.)"
3544                                 fi
3545                                 ;;
3546                         *) value="$ans";;
3547                         esac
3548                         ansexp="$value"
3549                         case "$exp_file" in
3550                         '') value="$ans";;
3551                         esac
3552                         ;;
3553                 esac
3554                 case "$fullpath" in
3555                 true)
3556                         case "$ansexp" in
3557                         /*) value="$ansexp" ;;
3558                         [a-zA-Z]:/*) value="$ansexp" ;;
3559                         *)
3560                                 redo=true
3561                                 case "$already" in
3562                                 true)
3563                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3564                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3565                                         ;;
3566                                 *)
3567                                 echo "Please give a full path name, starting with slash." >&4
3568                                         case "$tilde" in
3569                                         true)
3570                                 echo "Note that using ~name is ok provided it expands well." >&4
3571                                                 already=true
3572                                                 ;;
3573                                         esac
3574                                 esac
3575                                 ;;
3576                         esac
3577                         ;;
3578                 esac
3579                 case "$redo" in
3580                 '')
3581                         case "$type" in
3582                         File)
3583                                 for fp in $gfpth; do
3584                                         if test "X$fp" = X.; then
3585                                             pf="$ansexp"
3586                                         else    
3587                                             pf="$fp/$ansexp"
3588                                         fi
3589                                         if test -f "$pf"; then
3590                                                 type=''
3591                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3592                                         then
3593                                                 echo "($value is not a plain file, but that's ok.)"
3594                                                 type=''
3595                                         fi
3596                                         if test X"$type" = X; then
3597                                             value="$pf"
3598                                             break
3599                                         fi
3600                                 done
3601                                 ;;
3602                         Directory)
3603                                 for fp in $gfpth; do
3604                                         if test "X$fp" = X.; then
3605                                             dir="$ans"
3606                                             direxp="$ansexp"
3607                                         else    
3608                                             dir="$fp/$ansexp"
3609                                             direxp="$fp/$ansexp"
3610                                         fi
3611                                         if test -d "$direxp"; then
3612                                                 type=''
3613                                                 value="$dir"
3614                                                 break
3615                                         fi
3616                                 done
3617                                 ;;
3618                         Locate)
3619                                 if test -d "$ansexp"; then
3620                                         echo "(Looking for $loc_file in directory $value.)"
3621                                         value="$value/$loc_file"
3622                                         ansexp="$ansexp/$loc_file"
3623                                 fi
3624                                 if test -f "$ansexp"; then
3625                                         type=''
3626                                 fi
3627                                 case "$nopath_ok" in
3628                                 true)   case "$value" in
3629                                         */*) ;;
3630                                         *)      echo "Assuming $value will be in people's path."
3631                                                 type=''
3632                                                 ;;
3633                                         esac
3634                                         ;;
3635                                 esac
3636                                 ;;
3637                         esac
3638
3639                         case "$skip" in
3640                         true) type='';
3641                         esac
3642
3643                         case "$type" in
3644                         '') ;;
3645                         *)
3646                                 if test "$fastread" = yes; then
3647                                         dflt=y
3648                                 else
3649                                         dflt=n
3650                                 fi
3651                                 rp="$what $value doesn't exist.  Use that name anyway?"
3652                                 . UU/myread
3653                                 dflt=''
3654                                 case "$ans" in
3655                                 y*) type='';;
3656                                 *) echo " ";;
3657                                 esac
3658                                 ;;
3659                         esac
3660                         ;;
3661                 esac
3662                 ;;
3663         esac
3664 done
3665 cd UU
3666 ans="$value"
3667 rp="$orig_rp"
3668 dflt="$orig_dflt"
3669 rm -f getfile.ok
3670 test "X$gfpthkeep" != Xy && gfpth=""
3671 EOSC
3672
3673 : What should the include directory be ?
3674 echo " "
3675 $echo $n "Hmm...  $c"
3676 dflt='/usr/include'
3677 incpath=''
3678 mips_type=''
3679 if $test -f /bin/mips && /bin/mips; then
3680         echo "Looks like a MIPS system..."
3681         $cat >usr.c <<'EOCP'
3682 #ifdef SYSTYPE_BSD43
3683 /bsd43
3684 #endif
3685 EOCP
3686         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3687                 dflt='/bsd43/usr/include'
3688                 incpath='/bsd43'
3689                 mips_type='BSD 4.3'
3690         else
3691                 mips_type='System V'
3692         fi
3693         $rm -f usr.c usr.out
3694         echo "and you're compiling with the $mips_type compiler and libraries."
3695         xxx_prompt=y
3696         echo "exit 0" >mips
3697 else
3698         echo "Doesn't look like a MIPS system."
3699         xxx_prompt=n
3700         echo "exit 1" >mips
3701 fi
3702 chmod +x mips
3703 $eunicefix mips
3704 case "$usrinc" in
3705 '') ;;
3706 *) dflt="$usrinc";;
3707 esac
3708 case "$xxx_prompt" in
3709 y)      fn=d/
3710         echo " "
3711         rp='Where are the include files you want to use?'
3712         . ./getfile
3713         usrinc="$ans"
3714         ;;
3715 *)      usrinc="$dflt"
3716         ;;
3717 esac
3718
3719 : Set private lib path
3720 case "$plibpth" in
3721 '') if ./mips; then
3722                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3723         fi;;
3724 esac
3725 case "$libpth" in
3726 ' ') dlist='';;
3727 '') dlist="$loclibpth $plibpth $glibpth";;
3728 *) dlist="$libpth";;
3729 esac
3730
3731 : Now check and see which directories actually exist, avoiding duplicates
3732 libpth=''
3733 for xxx in $dlist
3734 do
3735     if $test -d $xxx; then
3736                 case " $libpth " in
3737                 *" $xxx "*) ;;
3738                 *) libpth="$libpth $xxx";;
3739                 esac
3740     fi
3741 done
3742 $cat <<'EOM'
3743
3744 Some systems have incompatible or broken versions of libraries.  Among
3745 the directories listed in the question below, please remove any you
3746 know not to be holding relevant libraries, and add any that are needed.
3747 Say "none" for none.
3748
3749 EOM
3750 case "$libpth" in
3751 '') dflt='none';;
3752 *)
3753         set X $libpth
3754         shift
3755         dflt=${1+"$@"}
3756         ;;
3757 esac
3758 rp="Directories to use for library searches?"
3759 . ./myread
3760 case "$ans" in
3761 none) libpth=' ';;
3762 *) libpth="$ans";;
3763 esac
3764
3765 : compute shared library extension
3766 case "$so" in
3767 '')
3768         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3769                 dflt='sl'
3770         else
3771                 dflt='so'
3772         fi
3773         ;;
3774 *) dflt="$so";;
3775 esac
3776 $cat <<EOM
3777
3778 On some systems, shared libraries may be available.  Answer 'none' if
3779 you want to suppress searching of shared libraries for the remainder
3780 of this configuration.
3781
3782 EOM
3783 rp='What is the file extension used for shared libraries?'
3784 . ./myread
3785 so="$ans"
3786
3787 : Define several unixisms.
3788 : Hints files or command line option can be used to override them.
3789 : The convoluted testing is in case hints files set either the old
3790 : or the new name.
3791 case "$_exe" in
3792 '')     case "$exe_ext" in
3793     '') ;;
3794         *)      _exe="$exe_ext" ;;
3795         esac
3796         ;;
3797 esac
3798 case "$_a" in
3799 '')     case "$lib_ext" in
3800     '') _a='.a';;
3801         *)      _a="$lib_ext" ;;
3802         esac
3803         ;;
3804 esac
3805 case "$_o" in
3806 '') case "$obj_ext" in
3807         '')     _o='.o';;
3808         *)      _o="$obj_ext";;
3809         esac
3810         ;;
3811 esac
3812 case "$p_" in
3813 '') case "$path_sep" in
3814         '')     p_=':';;
3815         *)      p_="$path_sep";;
3816         esac
3817         ;;
3818 esac
3819 exe_ext=$_exe
3820 lib_ext=$_a
3821 obj_ext=$_o
3822 path_sep=$p_
3823
3824 : Which makefile gets called first.  This is used by make depend.
3825 case "$firstmakefile" in
3826 '') firstmakefile='makefile';;
3827 esac
3828
3829 case "$usesocks" in
3830 $define|true|[yY]*)     dflt='y';;
3831 *) dflt='n';;
3832 esac
3833 cat <<EOM
3834
3835 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3836 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3837 to use the PerlIO abstraction layer, this will be implicitly selected.
3838
3839 If this doesn't make any sense to you, just accept the default '$dflt'.
3840 EOM
3841 rp='Build Perl for SOCKS?'
3842 . ./myread
3843 case "$ans" in
3844 y|Y)    val="$define" ;;     
3845 *)      val="$undef" ;;
3846 esac
3847 set usesocks
3848 eval $setvar
3849
3850 case "$usesocks" in
3851 $define|true|[yY]*) useperlio="$define";;
3852 esac
3853
3854 : Looking for optional libraries
3855 echo " "
3856 echo "Checking for optional libraries..." >&4
3857 case "$libs" in
3858 ' '|'') dflt='';;
3859 *) dflt="$libs";;
3860 esac
3861 case "$libswanted" in
3862 '') libswanted='c_s';;
3863 esac
3864 case "$usesocks" in
3865 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3866 esac
3867 libsfound=''
3868 libsfiles=''
3869 libsdirs=''
3870 libspath=''
3871 for thisdir in $libpth $xlibpth; do
3872   test -d $thisdir && libspath="$libspath $thisdir"
3873 done
3874 for thislib in $libswanted; do
3875         for thisdir in $libspath; do
3876             xxx=''
3877             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3878                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3879                 $test -f "$xxx" && eval $libscheck
3880                 $test -f "$xxx" && libstyle=shared
3881             fi
3882             if test ! -f "$xxx"; then
3883                 xxx=$thisdir/lib$thislib.$so
3884                 $test -f "$xxx" && eval $libscheck
3885                 $test -f "$xxx" && libstyle=shared
3886             fi  
3887             if test ! -f "$xxx"; then
3888                 xxx=$thisdir/lib$thislib$_a
3889                 $test -f "$xxx" && eval $libscheck
3890                 $test -f "$xxx" && libstyle=static
3891             fi
3892             if test ! -f "$xxx"; then
3893                 xxx=$thisdir/$thislib$_a
3894                 $test -f "$xxx" && eval $libscheck
3895                 $test -f "$xxx" && libstyle=static
3896             fi
3897             if test ! -f "$xxx"; then
3898                 xxx=$thisdir/lib${thislib}_s$_a
3899                 $test -f "$xxx" && eval $libscheck
3900                 $test -f "$xxx" && libstyle=static
3901                 $test -f "$xxx" && thislib=${thislib}_s
3902             fi
3903             if test ! -f "$xxx"; then
3904                 xxx=$thisdir/Slib$thislib$_a
3905                 $test -f "$xxx" && eval $libscheck
3906                 $test -f "$xxx" && libstyle=static
3907             fi
3908             if $test -f "$xxx"; then
3909                 case "$libstyle" in
3910                 shared) echo "Found -l$thislib (shared)." ;;
3911                 static) echo "Found -l$thislib." ;;
3912                 *)      echo "Found -l$thislib ($libstyle)." ;;
3913                 esac
3914                 case " $dflt " in
3915                 *"-l$thislib "*);;
3916                 *) dflt="$dflt -l$thislib"
3917                    libsfound="$libsfound $xxx"
3918                    yyy=`basename $xxx`
3919                    libsfiles="$libsfiles $yyy"
3920                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3921                    case " $libsdirs " in
3922                    *" $yyy "*) ;;
3923                    *) libsdirs="$libsdirs $yyy" ;;
3924                    esac
3925                    ;;
3926                 esac
3927                 break
3928             fi  
3929         done
3930         if $test ! -f "$xxx"; then
3931             echo "No -l$thislib."
3932         fi
3933 done
3934 set X $dflt
3935 shift
3936 dflt="$*"
3937 case "$libs" in
3938 '') dflt="$dflt";;
3939 *) dflt="$libs";;
3940 esac
3941 case "$dflt" in
3942 ' '|'') dflt='none';;
3943 esac
3944
3945 $cat <<EOM
3946
3947 In order to compile $package on your machine, a number of libraries
3948 are usually needed.  Include any other special libraries here as well.
3949 Say "none" for none.  The default list is almost always right.
3950 EOM
3951
3952 echo " "
3953 rp="What libraries to use?"
3954 . ./myread
3955 case "$ans" in
3956 none) libs=' ';;
3957 *) libs="$ans";;
3958 esac
3959
3960 : determine optimization, if desired, or use for debug flag also
3961 case "$optimize" in
3962 ' '|$undef) dflt='none';;
3963 '') dflt='-O';;
3964 *) dflt="$optimize";;
3965 esac
3966 $cat <<EOH
3967
3968 By default, $package compiles with the -O flag to use the optimizer.
3969 Alternately, you might want to use the symbolic debugger, which uses
3970 the -g flag (on traditional Unix systems).  Either flag can be
3971 specified here.  To use neither flag, specify the word "none".
3972
3973 EOH
3974 rp="What optimizer/debugger flag should be used?"
3975 . ./myread
3976 optimize="$ans"
3977 case "$optimize" in
3978 'none') optimize=" ";;
3979 esac
3980
3981 dflt=''
3982 : We will not override a previous value, but we might want to
3983 : augment a hint file
3984 case "$hint" in
3985 default|recommended)
3986         case "$gccversion" in
3987         1*) dflt='-fpcc-struct-return' ;;
3988         esac
3989         case "$optimize" in
3990         *-g*) dflt="$dflt -DDEBUGGING";;
3991         esac
3992         case "$gccversion" in
3993         2*) if test -d /etc/conf/kconfig.d &&
3994                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3995                 then
3996                         dflt="$dflt -posix"
3997                 fi
3998                 ;;
3999         esac
4000         case "$gccversion" in
4001         1*) ;;
4002         2.[0-8]*) ;;
4003         ?*)     echo " "
4004                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4005                 echo 'int main(void) { return 0; }' > gcctest.c
4006                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4007                         echo "Yes, it does." 2>&1
4008                         case "$ccflags" in
4009                         *strict-aliasing*) 
4010                                 echo "Leaving current flags $ccflags alone." 2>&1
4011                                 ;;
4012                         *) dflt="$dflt -fno-strict-aliasing" ;;
4013                         esac
4014                 else
4015                         echo "Nope, it doesn't, but that's ok." 2>&1
4016                 fi
4017                 ;;
4018         esac
4019         ;;
4020 esac
4021
4022 case "$mips_type" in
4023 *BSD*|'') inclwanted="$locincpth $usrinc";;
4024 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4025 esac
4026 for thisincl in $inclwanted; do
4027         if $test -d $thisincl; then
4028                 if $test x$thisincl != x$usrinc; then
4029                         case "$dflt" in
4030                         *" -I$thisincl "*);;
4031                         *) dflt="$dflt -I$thisincl ";;
4032                         esac
4033                 fi
4034         fi
4035 done
4036
4037 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4038         xxx=true;
4039 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4040         xxx=true;
4041 else
4042         xxx=false;
4043 fi;
4044 if $xxx; then
4045         case "$dflt" in
4046         *$2*);;
4047         *) dflt="$dflt -D$2";;
4048         esac;
4049 fi'
4050
4051 set signal.h LANGUAGE_C; eval $inctest
4052
4053 case "$usesocks" in
4054 $define)
4055         ccflags="$ccflags -DSOCKS"
4056         ;;
4057 esac
4058
4059 case "$hint" in
4060 default|recommended) dflt="$ccflags $dflt" ;;
4061 *) dflt="$ccflags";;
4062 esac
4063
4064 case "$dflt" in
4065 ''|' ') dflt=none;;
4066 esac
4067
4068 $cat <<EOH
4069
4070 Your C compiler may want other flags.  For this question you should include
4071 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4072 but you should NOT include libraries or ld flags like -lwhatever.  If you
4073 want $package to honor its debug switch, you should include -DDEBUGGING here.
4074 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4075
4076 To use no flags, specify the word "none".
4077
4078 EOH
4079 set X $dflt
4080 shift
4081 dflt=${1+"$@"}
4082 rp="Any additional cc flags?"
4083 . ./myread
4084 case "$ans" in
4085 none) ccflags='';;
4086 *) ccflags="$ans";;
4087 esac
4088
4089 : the following weeds options from ccflags that are of no interest to cpp
4090 case "$cppflags" in
4091 '') cppflags="$ccflags" ;;
4092 *)  cppflags="$cppflags $ccflags" ;;
4093 esac
4094 case "$gccversion" in
4095 1*) cppflags="$cppflags -D__GNUC__"
4096 esac
4097 case "$mips_type" in
4098 '');;
4099 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4100 esac
4101 case "$cppflags" in
4102 '');;
4103 *)
4104         echo " "
4105         echo "Let me guess what the preprocessor flags are..." >&4
4106         set X $cppflags
4107         shift
4108         cppflags=''
4109         $cat >cpp.c <<'EOM'
4110 #define BLURFL foo
4111
4112 BLURFL xx LFRULB
4113 EOM
4114         previous=''
4115         for flag in $*
4116         do
4117                 case "$flag" in
4118                 -*) ftry="$flag";;
4119                 *) ftry="$previous $flag";;
4120                 esac
4121                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4122                         >cpp1.out 2>/dev/null && \
4123                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4124                         >cpp2.out 2>/dev/null && \
4125                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4126                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4127                 then
4128                         cppflags="$cppflags $ftry"
4129                         previous=''
4130                 else
4131                         previous="$flag"
4132                 fi
4133         done
4134         set X $cppflags
4135         shift
4136         cppflags=${1+"$@"}
4137         case "$cppflags" in
4138         *-*)  echo "They appear to be: $cppflags";;
4139         esac
4140         $rm -f cpp.c cpp?.out
4141         ;;
4142 esac
4143
4144 : flags used in final linking phase
4145 case "$ldflags" in
4146 '') if ./venix; then
4147                 dflt='-i -z'
4148         else
4149                 dflt=''
4150         fi
4151         case "$ccflags" in
4152         *-posix*) dflt="$dflt -posix" ;;
4153         esac
4154         ;;
4155 *) dflt="$ldflags";;
4156 esac
4157
4158 : Try to guess additional flags to pick up local libraries.
4159 for thislibdir in $libpth; do
4160         case " $loclibpth " in
4161         *" $thislibdir "*)
4162                 case "$dflt " in 
4163                 *"-L$thislibdir "*) ;;
4164                 *)  dflt="$dflt -L$thislibdir" ;;
4165                 esac
4166                 ;;
4167         esac
4168 done
4169
4170 case "$dflt" in
4171 '') dflt='none' ;;
4172 esac
4173
4174 $cat <<EOH
4175
4176 Your C linker may need flags.  For this question you should
4177 include -L/whatever and any other flags used by the C linker, but you
4178 should NOT include libraries like -lwhatever.
4179
4180 Make sure you include the appropriate -L/path flags if your C linker
4181 does not normally search all of the directories you specified above,
4182 namely
4183         $libpth
4184 To use no flags, specify the word "none".
4185
4186 EOH
4187
4188 rp="Any additional ld flags (NOT including libraries)?"
4189 . ./myread
4190 case "$ans" in
4191 none) ldflags='';;
4192 *) ldflags="$ans";;
4193 esac
4194 rmlist="$rmlist pdp11"
4195
4196 : coherency check
4197 echo " "
4198 echo "Checking your choice of C compiler and flags for coherency..." >&4
4199 $cat > try.c <<'EOF'
4200 #include <stdio.h>
4201 int main() { printf("Ok\n"); exit(0); }
4202 EOF
4203 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4204 shift
4205 $cat >try.msg <<'EOM'
4206 I've tried to compile and run the following simple program:
4207
4208 EOM
4209 $cat try.c >> try.msg
4210
4211 $cat >> try.msg <<EOM
4212
4213 I used the command:
4214
4215         $*
4216         ./try
4217
4218 and I got the following output:
4219
4220 EOM
4221 dflt=y
4222 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4223         if $sh -c './try' >>try.msg 2>&1; then
4224                 xxx=`./try`
4225                 case "$xxx" in
4226                 "Ok") dflt=n ;;
4227                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4228                         case " $libs " in
4229                         *" -lsfio "*)
4230                                 cat >> try.msg <<'EOQS'
4231 If $libs contains -lsfio, and sfio is mis-configured, then it
4232 sometimes (apparently) runs and exits with a 0 status, but with no
4233 output!  It may have to do with sfio's use of _exit vs. exit.
4234
4235 EOQS
4236                                 rp="You have a big problem.  Shall I abort Configure"
4237                                 dflt=y
4238                                 ;;
4239                         esac
4240                         ;;
4241                 esac
4242         else
4243                 echo "The program compiled OK, but exited with status $?." >>try.msg
4244                 rp="You have a problem.  Shall I abort Configure"
4245                 dflt=y
4246         fi
4247 else
4248         echo "I can't compile the test program." >>try.msg
4249         rp="You have a BIG problem.  Shall I abort Configure"
4250         dflt=y
4251 fi
4252 case "$dflt" in
4253 y)
4254         $cat try.msg >&4
4255         case "$knowitall" in
4256         '')
4257                 echo "(The supplied flags or libraries might be incorrect.)"
4258                 ;;
4259         *) dflt=n;;
4260         esac
4261         echo " "
4262         . ./myread
4263         case "$ans" in
4264         n*|N*) ;;
4265         *)      echo "Ok.  Stopping Configure." >&4
4266                 exit 1
4267                 ;;
4268         esac
4269         ;;
4270 n) echo "OK, that should do.";;
4271 esac
4272 $rm -f try try.* core
4273
4274 : define an is-a-typedef? function
4275 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4276 case "$inclist" in
4277 "") inclist="sys/types.h";;
4278 esac;
4279 eval "varval=\$$var";
4280 case "$varval" in
4281 "")
4282         $rm -f temp.c;
4283         for inc in $inclist; do
4284                 echo "#include <$inc>" >>temp.c;
4285         done;
4286         echo "#ifdef $type" >> temp.c;
4287         echo "printf(\"We have $type\");" >> temp.c;
4288         echo "#endif" >> temp.c;
4289         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4290         if $contains $type temp.E >/dev/null 2>&1; then
4291                 eval "$var=\$type";
4292         else
4293                 eval "$var=\$def";
4294         fi;
4295         $rm -f temp.?;;
4296 *) eval "$var=\$varval";;
4297 esac'
4298
4299 : define an is-a-typedef? function that prompts if the type is not available.
4300 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4301 case "$inclist" in
4302 "") inclist="sys/types.h";;
4303 esac;
4304 eval "varval=\$$var";
4305 case "$varval" in
4306 "")
4307         $rm -f temp.c;
4308         for inc in $inclist; do
4309                 echo "#include <$inc>" >>temp.c;
4310         done;
4311         echo "#ifdef $type" >> temp.c;
4312         echo "printf(\"We have $type\");" >> temp.c;
4313         echo "#endif" >> temp.c;
4314         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4315         echo " " ;
4316         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4317         if $contains $type temp.E >/dev/null 2>&1; then
4318                 echo "$type found." >&4;
4319                 eval "$var=\$type";
4320         else
4321                 echo "$type NOT found." >&4;
4322                 dflt="$def";
4323                 . ./myread ;
4324                 eval "$var=\$ans";
4325         fi;
4326         $rm -f temp.?;;
4327 *) eval "$var=\$varval";;
4328 esac'
4329
4330 : define a shorthand compile call
4331 compile='
4332 mc_file=$1;
4333 shift;
4334 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4335 : define a shorthand compile call for compilations that should be ok.
4336 compile_ok='
4337 mc_file=$1;
4338 shift;
4339 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4340
4341 : check for lengths of integral types
4342 echo " "
4343 case "$intsize" in
4344 '')
4345         echo "Checking to see how big your integers are..." >&4
4346         $cat >intsize.c <<'EOCP'
4347 #include <stdio.h>
4348 int main()
4349 {
4350         printf("intsize=%d;\n", (int)sizeof(int));
4351         printf("longsize=%d;\n", (int)sizeof(long));
4352         printf("shortsize=%d;\n", (int)sizeof(short));
4353         exit(0);
4354 }
4355 EOCP
4356         set intsize
4357         if eval $compile_ok && ./intsize > /dev/null; then
4358                 eval `./intsize`
4359                 echo "Your integers are $intsize bytes long."
4360                 echo "Your long integers are $longsize bytes long."
4361                 echo "Your short integers are $shortsize bytes long."
4362         else
4363                 $cat >&4 <<EOM
4364 !
4365 Help! I can't compile and run the intsize test program: please enlighten me!
4366 (This is probably a misconfiguration in your system or libraries, and
4367 you really ought to fix it.  Still, I'll try anyway.)
4368 !
4369 EOM
4370                 dflt=4
4371                 rp="What is the size of an integer (in bytes)?"
4372                 . ./myread
4373                 intsize="$ans"
4374                 dflt=$intsize
4375                 rp="What is the size of a long integer (in bytes)?"
4376                 . ./myread
4377                 longsize="$ans"
4378                 dflt=2
4379                 rp="What is the size of a short integer (in bytes)?"
4380                 . ./myread
4381                 shortsize="$ans"
4382         fi
4383         ;;
4384 esac
4385 $rm -f intsize intsize.*
4386
4387 : see what type lseek is declared as in the kernel
4388 rp="What is the type used for lseek's offset on this system?"
4389 set off_t lseektype long stdio.h sys/types.h
4390 eval $typedef_ask
4391
4392 echo " "
4393 echo "Checking to see how big your file offsets are..." >&4
4394 $cat >try.c <<EOCP
4395 #include <sys/types.h>
4396 #include <stdio.h>
4397 int main()
4398 {
4399     printf("%d\n", (int)sizeof($lseektype));
4400     return(0); 
4401 }
4402 EOCP
4403 set try
4404 if eval $compile_ok; then
4405         lseeksize=`./try`
4406         echo "Your file offsets are $lseeksize bytes long."
4407 else
4408         dflt=$longsize
4409         echo " "
4410         echo "(I can't seem to compile the test program.  Guessing...)"
4411         rp="What is the size of your file offsets (in bytes)?"
4412         . ./myread
4413         lseeksize="$ans"
4414 fi
4415 $rm -f try.c try
4416
4417 : see what type file positions are declared as in the library
4418 rp="What is the type for file position used by fsetpos()?"
4419 set fpos_t fpostype long stdio.h sys/types.h
4420 eval $typedef_ask
4421
4422 echo " "
4423 case "$fpostype" in
4424 *_t) zzz="$fpostype"    ;;
4425 *)   zzz="fpos_t"       ;;
4426 esac
4427 echo "Checking the size of $zzz..." >&4 
4428 cat > try.c <<EOCP
4429 #include <sys/types.h>
4430 #include <stdio.h>
4431 int main() {
4432     printf("%d\n", (int)sizeof($fpostype));
4433     exit(0);
4434 }
4435 EOCP
4436 set try
4437 if eval $compile_ok; then
4438         yyy=`./try`
4439         case "$yyy" in
4440         '')     fpossize=4
4441                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4442                 ;;
4443         *)      fpossize=$yyy
4444                 echo "Your $zzz is $fpossize bytes long."
4445                 ;;
4446         esac
4447 else
4448         dflt="$longsize"
4449         echo " " >&4
4450         echo "(I can't compile the test program.  Guessing...)" >&4
4451         rp="What is the size of your file positions (in bytes)?"
4452         . ./myread
4453         fpossize="$ans"
4454 fi
4455
4456
4457
4458 # Backward compatibility (uselfs is deprecated).
4459 case "$uselfs" in
4460 "$define"|true|[yY]*)
4461         cat <<EOM >&4
4462
4463 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4464 EOM
4465         uselargefiles="$define"
4466         ;;
4467 esac                          
4468
4469 case "$lseeksize:$fpossize" in
4470 8:8) cat <<EOM
4471
4472 You can have files larger than 2 gigabytes.
4473 EOM
4474    val="$define" ;;
4475 *)    case "$uselargefiles" in
4476    "$undef"|false|[nN]*) dflt='n' ;;
4477    *)   dflt='y' ;;
4478    esac
4479    cat <<EOM
4480
4481 Perl can be built to understand large files (files larger than 2 gigabytes)
4482 on some systems.  To do so, Configure can be run with -Duselargefiles.
4483
4484 If this doesn't make any sense to you, just accept the default '$dflt'.
4485 EOM
4486    rp='Try to understand large files, if available?'
4487    . ./myread
4488    case "$ans" in
4489    y|Y)         val="$define" ;;
4490    *)           val="$undef"  ;;
4491    esac
4492    ;;
4493 esac
4494 set uselargefiles
4495 eval $setvar
4496 case "$uselargefiles" in
4497 "$define")
4498 : Look for a hint-file generated 'call-back-unit'.  If the
4499 : user has specified that a large files perl is to be built,
4500 : we may need to set or change some other defaults.
4501         if $test -f uselargefiles.cbu; then
4502                 echo "Your platform has some specific hints for large file builds, using them..."
4503                 . ./uselargefiles.cbu
4504                 echo " "
4505                 echo "Rechecking to see how big your file offsets are..." >&4
4506                 $cat >try.c <<EOCP
4507 #include <sys/types.h>
4508 #include <stdio.h>
4509 int main()
4510 {
4511     printf("%d\n", (int)sizeof($lseektype));
4512     return(0); 
4513 }
4514 EOCP
4515                 set try
4516                 if eval $compile_ok; then
4517                         lseeksize=`./try`
4518                         $echo "Your file offsets are now $lseeksize bytes long."
4519                 else
4520                         dflt="$lseeksize"
4521                         echo " "
4522                         echo "(I can't seem to compile the test program.  Guessing...)"
4523                         rp="What is the size of your file offsets (in bytes)?"
4524                         . ./myread
4525                         lseeksize="$ans"
4526                 fi
4527                 case "$fpostype" in
4528                 *_t) zzz="$fpostype"    ;;
4529                 *)   zzz="fpos_t"       ;;
4530                 esac
4531                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4532                 $cat > try.c <<EOCP
4533 #include <sys/types.h>
4534 #include <stdio.h>
4535 int main() {
4536     printf("%d\n", (int)sizeof($fpostype));
4537     exit(0);
4538 }
4539 EOCP
4540                 set try
4541                 if eval $compile_ok; then
4542                         yyy=`./try`
4543                         dflt="$lseeksize"
4544                         case "$yyy" in
4545                         '')     echo " "
4546                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4547                                 ;;
4548                         *)      fpossize=$yyy
4549                                 echo " $fpossize bytes." >&4
4550                                 ;;
4551                         esac
4552                 else
4553                         dflt="$fpossize"
4554                         echo " "
4555                         echo "(I can't compile the test program.  Guessing...)" >&4
4556                         rp="What is the size of your file positions (in bytes)?"
4557                         . ./myread
4558                         fpossize="$ans"
4559                 fi
4560                 $rm -f try.c try
4561         fi
4562         ;;
4563 esac
4564
4565
4566 case "$usemorebits" in
4567 "$define"|true|[yY]*)
4568         use64bitint="$define"
4569         uselongdouble="$define"
4570         usemorebits="$define"
4571         ;;
4572 *)      usemorebits="$undef"
4573         ;;
4574 esac
4575
4576 : check for void type
4577 echo " "
4578 echo "Checking to see how well your C compiler groks the void type..." >&4
4579 case "$voidflags" in
4580 '')
4581         $cat >try.c <<'EOCP'
4582 #if TRY & 1
4583 void sub() {
4584 #else
4585 sub() {
4586 #endif
4587         extern void moo();      /* function returning void */
4588         void (*goo)();          /* ptr to func returning void */
4589 #if TRY & 8
4590         void *hue;              /* generic ptr */
4591 #endif
4592 #if TRY & 2
4593         void (*foo[10])();
4594 #endif
4595
4596 #if TRY & 4
4597         if(goo == moo) {
4598                 exit(0);
4599         }
4600 #endif
4601         exit(0);
4602 }
4603 int main() { sub(); }
4604 EOCP
4605         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4606                 voidflags=$defvoidused
4607         echo "Good.  It appears to support void to the level $package wants.">&4
4608                 if $contains warning .out >/dev/null 2>&1; then
4609                         echo "However, you might get some warnings that look like this:"
4610                         $cat .out
4611                 fi
4612         else
4613 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4614                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4615                         echo "It supports 1..."
4616                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4617                                 echo "It also supports 2..."
4618                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4619                                         voidflags=7
4620                                         echo "And it supports 4 but not 8 definitely."
4621                                 else
4622                                         echo "It doesn't support 4..."
4623                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4624                                                 voidflags=11
4625                                                 echo "But it supports 8."
4626                                         else
4627                                                 voidflags=3
4628                                                 echo "Neither does it support 8."
4629                                         fi
4630                                 fi
4631                         else
4632                                 echo "It does not support 2..."
4633                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4634                                         voidflags=13
4635                                         echo "But it supports 4 and 8."
4636                                 else
4637                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4638                                                 voidflags=5
4639                                                 echo "And it supports 4 but has not heard about 8."
4640                                         else
4641                                                 echo "However it supports 8 but not 4."
4642                                         fi
4643                                 fi
4644                         fi
4645                 else
4646                         echo "There is no support at all for void."
4647                         voidflags=0
4648                 fi
4649         fi
4650 esac
4651 case "$voidflags" in
4652 "$defvoidused") ;;
4653 *)      $cat >&4 <<'EOM'
4654   Support flag bits are:
4655     1: basic void declarations.
4656     2: arrays of pointers to functions returning void.
4657     4: operations between pointers to and addresses of void functions.
4658     8: generic void pointers.
4659 EOM
4660         dflt="$voidflags";
4661         rp="Your void support flags add up to what?"
4662         . ./myread
4663         voidflags="$ans"
4664         ;;
4665 esac
4666 $rm -f try.* .out
4667
4668 : check for length of pointer
4669 echo " "
4670 case "$ptrsize" in
4671 '')
4672         echo "Checking to see how big your pointers are..." >&4
4673         if test "$voidflags" -gt 7; then
4674                 echo '#define VOID_PTR char *' > try.c
4675         else
4676                 echo '#define VOID_PTR void *' > try.c
4677         fi
4678         $cat >>try.c <<'EOCP'
4679 #include <stdio.h>
4680 int main()
4681 {
4682     printf("%d\n", (int)sizeof(VOID_PTR));
4683     exit(0);
4684 }
4685 EOCP
4686         set try
4687         if eval $compile_ok; then
4688                 ptrsize=`./try`
4689                 echo "Your pointers are $ptrsize bytes long."
4690         else
4691                 dflt='4'
4692                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4693                 rp="What is the size of a pointer (in bytes)?"
4694                 . ./myread
4695                 ptrsize="$ans"
4696         fi
4697         ;;
4698 esac
4699 $rm -f try.c try
4700
4701 : check for long long
4702 echo " "
4703 echo "Checking to see if you have long long..." >&4
4704 echo 'int main() { long long x = 7; return 0; }' > try.c
4705 set try
4706 if eval $compile; then
4707         val="$define"
4708         echo "You have long long."
4709 else
4710         val="$undef"
4711         echo "You do not have long long."
4712 fi
4713 $rm try.*
4714 set d_longlong
4715 eval $setvar
4716
4717 : check for length of long long
4718 case "${d_longlong}${longlongsize}" in
4719 $define)
4720         echo " "
4721         echo "Checking to see how big your long longs are..." >&4
4722         $cat >try.c <<'EOCP'
4723 #include <stdio.h>
4724 int main()
4725 {
4726     printf("%d\n", (int)sizeof(long long));
4727     return(0);
4728 }
4729 EOCP
4730         set try
4731         if eval $compile_ok; then
4732                 longlongsize=`./try$exe_ext`
4733                 echo "Your long longs are $longlongsize bytes long."
4734         else
4735                 dflt='8'
4736                 echo " "
4737                 echo "(I can't seem to compile the test program.  Guessing...)"
4738                 rp="What is the size of a long long (in bytes)?"
4739                 . ./myread
4740                 longlongsize="$ans"
4741         fi
4742         if $test "X$longsize" = "X$longlongsize"; then
4743                 echo "(That isn't any different from an ordinary long.)"
4744         fi      
4745         ;;
4746 esac
4747 $rm -f try.* try
4748
4749 : determine filename position in cpp output
4750 echo " "
4751 echo "Computing filename position in cpp output for #include directives..." >&4
4752 echo '#include <stdio.h>' > foo.c
4753 $cat >fieldn <<EOF
4754 $startsh
4755 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4756 $grep '^[       ]*#.*stdio\.h' | \
4757 while read cline; do
4758         pos=1
4759         set \$cline
4760         while $test \$# -gt 0; do
4761                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4762                         echo "\$pos"
4763                         exit 0
4764                 fi
4765                 shift
4766                 pos=\`expr \$pos + 1\`
4767         done
4768 done
4769 EOF
4770 chmod +x fieldn
4771 fieldn=`./fieldn`
4772 $rm -f foo.c fieldn
4773 case $fieldn in
4774 '') pos='???';;
4775 1) pos=first;;
4776 2) pos=second;;
4777 3) pos=third;;
4778 *) pos="${fieldn}th";;
4779 esac
4780 echo "Your cpp writes the filename in the $pos field of the line."
4781
4782 : locate header file
4783 $cat >findhdr <<EOF
4784 $startsh
4785 wanted=\$1
4786 name=''
4787 for usrincdir in $usrinc
4788 do
4789         if test -f \$usrincdir/\$wanted; then
4790                 echo "\$usrincdir/\$wanted"
4791                 exit 0
4792         fi
4793 done
4794 awkprg='{ print \$$fieldn }'
4795 echo "#include <\$wanted>" > foo\$\$.c
4796 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4797 $grep "^[       ]*#.*\$wanted" | \
4798 while read cline; do
4799         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4800         case "\$name" in
4801         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4802         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4803         *) exit 2;;
4804         esac;
4805 done;
4806 #
4807 # status = 0: grep returned 0 lines, case statement not executed
4808 # status = 1: headerfile found
4809 # status = 2: while loop executed, no headerfile found
4810 #
4811 status=\$?
4812 $rm -f foo\$\$.c;
4813 if test \$status -eq 1; then
4814         exit 0;
4815 fi
4816 exit 1
4817 EOF
4818 chmod +x findhdr
4819
4820 : define an alternate in-header-list? function
4821 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4822 cont=true; xxf="echo \"<\$1> found.\" >&4";
4823 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4824 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4825 esac;
4826 case $# in 4) instead=instead;; *) instead="at last";; esac;
4827 while $test "$cont"; do
4828         xxx=`./findhdr $1`
4829         var=$2; eval "was=\$$2";
4830         if $test "$xxx" && $test -r "$xxx";
4831         then eval $xxf;
4832         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4833                 cont="";
4834         else eval $xxnf;
4835         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4836         set $yyy; shift; shift; yyy=$@;
4837         case $# in 0) cont="";;
4838         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4839                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4840         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4841                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4842         esac;
4843 done;
4844 while $test "$yyy";
4845 do set $yyy; var=$2; eval "was=\$$2";
4846         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4847         set $yyy; shift; shift; yyy=$@;
4848 done'
4849
4850 : see if inttypes.h is available
4851 : we want a real compile instead of Inhdr because some systems
4852 : have an inttypes.h which includes non-existent headers
4853 echo " "
4854 $cat >try.c <<EOCP
4855 #include <inttypes.h>
4856 int main() {
4857         static int32_t foo32 = 0x12345678;
4858 }
4859 EOCP
4860 set try
4861 if eval $compile; then
4862         echo "<inttypes.h> found." >&4
4863         val="$define"
4864 else
4865         echo "<inttypes.h> NOT found." >&4
4866         val="$undef"
4867 fi
4868 $rm -f try.c try
4869 set i_inttypes
4870 eval $setvar
4871
4872 : check for int64_t
4873 echo " "
4874 echo "Checking to see if you have int64_t..." >&4
4875 $cat >try.c <<EOCP
4876 #include <sys/types.h>
4877 #$i_inttypes I_INTTYPES
4878 #ifdef I_INTTYPES
4879 #include <inttypes.h>
4880 #endif
4881 int main() { int64_t x = 7; }
4882 EOCP
4883 set try
4884 if eval $compile; then
4885         val="$define"
4886         echo "You have int64_t."
4887 else
4888         val="$undef"
4889         echo "You do not have int64_t."
4890 fi
4891 $rm -f try try.*
4892 set d_int64_t
4893 eval $setvar
4894
4895
4896 echo " "
4897 echo "Checking which 64-bit integer type we could use..." >&4
4898
4899 case "$intsize" in
4900 8) val=int
4901    set quadtype
4902    eval $setvar
4903    val='"unsigned int"'
4904    set uquadtype
4905    eval $setvar
4906    quadkind=1
4907    ;;
4908 *) case "$longsize" in
4909    8) val=long
4910       set quadtype
4911       eval $setvar
4912       val='"unsigned long"'
4913       set uquadtype
4914       eval $setvar
4915       quadkind=2
4916       ;;
4917    *) case "$d_longlong:$longlongsize" in
4918       define:8)
4919         val='"long long"'
4920         set quadtype
4921         eval $setvar
4922         val='"unsigned long long"'
4923         set uquadtype
4924         eval $setvar
4925         quadkind=3
4926         ;;
4927       *) case "$d_int64_t" in
4928          define)
4929            val=int64_t
4930            set quadtype
4931            eval $setvar
4932            val=uint64_t
4933            set uquadtype
4934            eval $setvar
4935            quadkind=4
4936            ;;
4937          esac
4938          ;;
4939       esac
4940       ;;
4941    esac
4942    ;;
4943 esac
4944
4945 case "$quadtype" in
4946 '')     echo "Alas, no 64-bit integer types in sight." >&4
4947         d_quad="$undef"
4948         ;;
4949 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4950         d_quad="$define"
4951         ;;
4952 esac
4953
4954
4955 case "$uselonglong" in
4956 "$define"|true|[yY]*)
4957         cat <<EOM >&4
4958
4959 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4960 EOM
4961         use64bitint="$define"
4962         ;;
4963 esac                          
4964 case "$use64bits" in
4965 "$define"|true|[yY]*)
4966         cat <<EOM >&4
4967
4968 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4969 EOM
4970         use64bitint="$define"
4971         ;;
4972 esac                          
4973 case "$use64bitints" in
4974 "$define"|true|[yY]*)
4975         cat <<EOM >&4
4976
4977 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4978 EOM
4979         use64bitint="$define"
4980         ;;
4981 esac                          
4982 case "$use64bitsint" in
4983 "$define"|true|[yY]*)
4984         cat <<EOM >&4
4985
4986 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4987 EOM
4988         use64bitint="$define"
4989         ;;
4990 esac                          
4991 case "$uselonglongs" in
4992 "$define"|true|[yY]*)
4993         cat <<EOM >&4
4994
4995 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4996 EOM
4997         use64bitint="$define"
4998         ;;
4999 esac                          
5000 case "$use64bitsall" in
5001 "$define"|true|[yY]*)
5002         cat <<EOM >&4
5003
5004 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5005 EOM
5006         use64bitall="$define"
5007         ;;
5008 esac                          
5009
5010 case "$ccflags" in
5011 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5012 esac
5013 case "$use64bitall" in
5014 "$define"|true|[yY]*) use64bitint="$define" ;;
5015 esac
5016
5017 case "$longsize" in
5018 8) cat <<EOM
5019
5020 You have natively 64-bit long integers.
5021 EOM
5022    val="$define"
5023    ;;
5024 *) case "$use64bitint" in
5025    "$define"|true|[yY]*) dflt='y';;
5026    *) dflt='n';;
5027    esac
5028    case "$d_quad" in
5029    "$define") ;;
5030    *) dflt='n' ;;
5031    esac
5032    cat <<EOM
5033
5034 Perl can be built to take advantage of 64-bit integer types
5035 on some systems.  To do so, Configure can be run with -Duse64bitint.
5036 Choosing this option will most probably introduce binary incompatibilities.
5037
5038 If this doesn't make any sense to you, just accept the default '$dflt'.
5039 (The default has been chosen based on your configuration.)
5040 EOM
5041    rp='Try to use 64-bit integers, if available?'
5042    . ./myread
5043    case "$ans" in
5044    [yY]*) val="$define" ;;
5045    *)     val="$undef"  ;;
5046    esac
5047    ;;
5048 esac
5049 set use64bitint
5050 eval $setvar
5051
5052 case "$use64bitall" in
5053 "$define"|true|[yY]*) dflt='y' ;;
5054 *) case "$longsize" in
5055    8) dflt='y' ;;
5056    *) dflt='n' ;;
5057    esac
5058    ;;
5059 esac    
5060 cat <<EOM
5061
5062 You may also choose to try maximal 64-bitness.  It means using as much
5063 64-bitness as possible on the platform.  This in turn means even more
5064 binary incompatibilities.  On the other hand, your platform may not
5065 have any more 64-bitness available than what you already have chosen.
5066
5067 If this doesn't make any sense to you, just accept the default '$dflt'.
5068 (The default has been chosen based on your configuration.)
5069 EOM
5070 rp='Try to use maximal 64-bit support, if available?'
5071 . ./myread
5072 case "$ans" in
5073 [yY]*) val="$define" ;;
5074 *)     val="$undef"  ;;
5075 esac
5076 set use64bitall
5077 eval $setvar
5078 case "$use64bitall" in
5079 "$define")
5080         case "$use64bitint" in
5081         "$undef")
5082                 cat <<EOM
5083
5084 Since you have chosen a maximally 64-bit build, I'm also turning on
5085 the use of 64-bit integers.
5086 EOM
5087                 use64bitint="$define" ;;
5088         esac
5089         ;;
5090 esac
5091
5092 case "$use64bitall" in
5093 "$define"|true|[yY]*)
5094         case "$ptrsize" in
5095         4)      cat <<EOM >&4
5096
5097 *** You have chosen a maximally 64-bit build, but your pointers
5098 *** are only 4 bytes wide, disabling maximal 64-bitness.
5099
5100 EOM
5101                 use64bitall="$undef"
5102                 case "$use64bitint" in
5103                 "$define"|true|[yY]*) ;;
5104                 *)      cat <<EOM >&4
5105
5106 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5107
5108 EOM
5109                         use64bitint="$define"
5110                         ;;
5111                 esac
5112                 ;;
5113         esac
5114         ;;
5115 esac
5116
5117 case "$use64bitint" in
5118 "$define"|true|[yY]*)
5119 : Look for a hint-file generated 'call-back-unit'.  If the
5120 : user has specified that a 64-bit perl is to be built,
5121 : we may need to set or change some other defaults.
5122         if $test -f use64bitint.cbu; then
5123                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5124                 . ./use64bitint.cbu
5125         fi
5126         case "$longsize" in
5127         4) case "$archname64" in
5128            '') archname64=64int ;;
5129            esac
5130            ;;
5131         esac
5132         ;;
5133 esac
5134
5135 case "$use64bitall" in
5136 "$define"|true|[yY]*)
5137 : Look for a hint-file generated 'call-back-unit'.  If the
5138 : user has specified that a maximally 64-bit perl is to be built,
5139 : we may need to set or change some other defaults.
5140         if $test -f use64bitall.cbu; then
5141                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5142                 . ./use64bitall.cbu
5143         fi
5144         case "$longsize" in
5145         4) case "$archname64" in
5146            ''|64int) archname64=64all ;;
5147            esac
5148            ;;
5149         esac
5150         ;;
5151 esac
5152
5153 echo " "
5154 echo "Checking for GNU C Library..." >&4
5155 cat >gnulibc.c <<EOM
5156 #include <stdio.h>
5157 int main()
5158 {
5159 #ifdef __GLIBC__
5160     exit(0);
5161 #else
5162     exit(1);
5163 #endif
5164 }
5165 EOM
5166 set gnulibc
5167 if eval $compile_ok && ./gnulibc; then
5168         val="$define"
5169         echo "You are using the GNU C Library"
5170 else
5171         val="$undef"
5172         echo "You are not using the GNU C Library"
5173 fi
5174 $rm -f gnulibc*
5175 set d_gnulibc
5176 eval $setvar
5177
5178 : see if nm is to be used to determine whether a symbol is defined or not
5179 case "$usenm" in
5180 '')
5181         dflt=''
5182         case "$d_gnulibc" in
5183         "$define")
5184                 echo " "
5185                 echo "nm probably won't work on the GNU C Library." >&4
5186                 dflt=n
5187                 ;;
5188         esac
5189         case "$dflt" in
5190         '') 
5191                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5192                         echo " "
5193                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5194                         echo "'nm' won't be sufficient on this sytem." >&4
5195                         dflt=n
5196                 fi
5197                 ;;
5198         esac
5199         case "$dflt" in
5200         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5201                 if $test $dflt -gt 20; then
5202                         dflt=y
5203                 else
5204                         dflt=n
5205                 fi
5206                 ;;
5207         esac
5208         ;;
5209 *)
5210         case "$usenm" in
5211         true|$define) dflt=y;;
5212         *) dflt=n;;
5213         esac
5214         ;;
5215 esac
5216 $cat <<EOM
5217
5218 I can use $nm to extract the symbols from your C libraries. This
5219 is a time consuming task which may generate huge output on the disk (up
5220 to 3 megabytes) but that should make the symbols extraction faster. The
5221 alternative is to skip the 'nm' extraction part and to compile a small
5222 test program instead to determine whether each symbol is present. If
5223 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5224 this may be the best solution.
5225
5226 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5227
5228 EOM
5229 rp="Shall I use $nm to extract C symbols from the libraries?"
5230 . ./myread
5231 case "$ans" in
5232 [Nn]*) usenm=false;;
5233 *) usenm=true;;
5234 esac
5235
5236 runnm=$usenm
5237 case "$reuseval" in
5238 true) runnm=false;;
5239 esac
5240
5241 : nm options which may be necessary
5242 case "$nm_opt" in
5243 '') if $test -f /mach_boot; then
5244                 nm_opt=''       # Mach
5245         elif $test -d /usr/ccs/lib; then
5246                 nm_opt='-p'     # Solaris (and SunOS?)
5247         elif $test -f /dgux; then
5248                 nm_opt='-p'     # DG-UX
5249         elif $test -f /lib64/rld; then
5250                 nm_opt='-p'     # 64-bit Irix
5251         else
5252                 nm_opt=''
5253         fi;;
5254 esac
5255
5256 : nm options which may be necessary for shared libraries but illegal
5257 : for archive libraries.  Thank you, Linux.
5258 case "$nm_so_opt" in
5259 '')     case "$myuname" in
5260         *linux*)
5261                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5262                         nm_so_opt='--dynamic'
5263                 fi
5264                 ;;
5265         esac
5266         ;;
5267 esac
5268
5269 case "$runnm" in
5270 true)
5271 : get list of predefined functions in a handy place
5272 echo " "
5273 case "$libc" in
5274 '') libc=unknown
5275         case "$libs" in
5276         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5277         esac
5278         ;;
5279 esac
5280 libnames='';
5281 case "$libs" in
5282 '') ;;
5283 *)  for thislib in $libs; do
5284         case "$thislib" in
5285         -lc|-lc_s)
5286                 : Handle C library specially below.
5287                 ;;
5288         -l*)
5289                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5290                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5291                         :
5292                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5293                         :
5294                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5295                         :
5296                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5297                         :
5298                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5299                         :
5300                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5301                         :
5302                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5303                         :
5304                 else
5305                         try=''
5306                 fi
5307                 libnames="$libnames $try"
5308                 ;;
5309         *) libnames="$libnames $thislib" ;;
5310         esac
5311         done
5312         ;;
5313 esac
5314 xxx=normal
5315 case "$libc" in
5316 unknown)
5317         set /lib/libc.$so
5318         for xxx in $libpth; do
5319                 $test -r $1 || set $xxx/libc.$so
5320                 : The messy sed command sorts on library version numbers.
5321                 $test -r $1 || \
5322                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5323                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5324                                 h
5325                                 s/[0-9][0-9]*/0000&/g
5326                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5327                                 G
5328                                 s/\n/ /' | \
5329                          $sort | $sed -e 's/^.* //'`
5330                 eval set \$$#
5331         done
5332         $test -r $1 || set /usr/ccs/lib/libc.$so
5333         $test -r $1 || set /lib/libsys_s$_a
5334         ;;
5335 *)
5336         set blurfl
5337         ;;
5338 esac
5339 if $test -r "$1"; then
5340         echo "Your (shared) C library seems to be in $1."
5341         libc="$1"
5342 elif $test -r /lib/libc && $test -r /lib/clib; then
5343         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5344         xxx=apollo
5345         libc='/lib/clib /lib/libc'
5346         if $test -r /lib/syslib; then
5347                 echo "(Your math library is in /lib/syslib.)"
5348                 libc="$libc /lib/syslib"
5349         fi
5350 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5351         echo "Your C library seems to be in $libc, as you said before."
5352 elif $test -r $incpath/usr/lib/libc$_a; then
5353         libc=$incpath/usr/lib/libc$_a;
5354         echo "Your C library seems to be in $libc.  That's fine."
5355 elif $test -r /lib/libc$_a; then
5356         libc=/lib/libc$_a;
5357         echo "Your C library seems to be in $libc.  You're normal."
5358 else
5359         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5360                 :
5361         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5362                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5363         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5364                 :
5365         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5366                 :
5367         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5368                 :
5369         else
5370                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5371         fi
5372         if $test -r "$tans"; then
5373                 echo "Your C library seems to be in $tans, of all places."
5374                 libc=$tans
5375         else
5376                 libc='blurfl'
5377         fi
5378 fi
5379 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5380         dflt="$libc"
5381         cat <<EOM
5382
5383 If the guess above is wrong (which it might be if you're using a strange
5384 compiler, or your machine supports multiple models), you can override it here.
5385
5386 EOM
5387 else
5388         dflt=''
5389         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5390         cat >&4 <<EOM
5391 I can't seem to find your C library.  I've looked in the following places:
5392
5393 EOM
5394         $sed 's/^/      /' libpath
5395         cat <<EOM
5396
5397 None of these seems to contain your C library. I need to get its name...
5398
5399 EOM
5400 fi
5401 fn=f
5402 rp='Where is your C library?'
5403 . ./getfile
5404 libc="$ans"
5405
5406 echo " "
5407 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5408 set X `cat libnames`
5409 shift
5410 xxx=files
5411 case $# in 1) xxx=file; esac
5412 echo "Extracting names from the following $xxx for later perusal:" >&4
5413 echo " "
5414 $sed 's/^/      /' libnames >&4
5415 echo " "
5416 $echo $n "This may take a while...$c" >&4
5417
5418 for file in $*; do
5419         case $file in
5420         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5421         *) $nm $nm_opt $file 2>/dev/null;;
5422         esac
5423 done >libc.tmp
5424
5425 $echo $n ".$c"
5426 $grep fprintf libc.tmp > libc.ptf
5427 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5428 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5429 xxx='[ADTSIW]'
5430 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5431         eval $xscan;\
5432         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5433                 eval $xrun
5434 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5435         eval $xscan;\
5436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5437                 eval $xrun
5438 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5439         eval $xscan;\
5440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5441                 eval $xrun
5442 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5443         eval $xscan;\
5444         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5445                 eval $xrun
5446 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5447         eval $xscan;\
5448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5449                 eval $xrun
5450 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5451         eval $xscan;\
5452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5453                 eval $xrun
5454 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5455                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5456         eval $xscan;\
5457         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5458                 eval $xrun
5459 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5460         eval $xscan;\
5461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5462                 eval $xrun
5463 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5464         eval $xscan;\
5465         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5466                 eval $xrun
5467 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5468         eval $xscan;\
5469         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5470                 eval $xrun
5471 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5472         eval $xscan;\
5473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5474                 eval $xrun
5475 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5476         eval $xscan;\
5477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5478                 eval $xrun
5479 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5480         eval $xscan;\
5481         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5482                 eval $xrun
5483 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5484         eval $xscan;\
5485         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5486                 eval $xrun
5487 else
5488         $nm -p $* 2>/dev/null >libc.tmp
5489         $grep fprintf libc.tmp > libc.ptf
5490         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5491                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5492         then
5493                 nm_opt='-p'
5494                 eval $xrun
5495         else
5496                 echo " "
5497                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5498                 com=''
5499                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5500                         for thisname in $libnames $libc; do
5501                                 $ar t $thisname >>libc.tmp
5502                         done
5503                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5504                         echo "Ok." >&4
5505                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5506                         # Repeat libc to extract forwarders to DLL entries too
5507                         for thisname in $libnames $libc; do
5508                                 $ar tv $thisname >>libc.tmp
5509                                 # Revision 50 of EMX has bug in $ar.
5510                                 # it will not extract forwarders to DLL entries
5511                                 # Use emximp which will extract exactly them.
5512                                 emximp -o tmp.imp $thisname \
5513                                     2>/dev/null && \
5514                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5515                                     < tmp.imp >>libc.tmp
5516                                 $rm tmp.imp
5517                         done
5518                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5519                         echo "Ok." >&4
5520                 else
5521                         echo "$ar didn't seem to work right." >&4
5522                         echo "Maybe this is a Cray...trying bld instead..." >&4
5523                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5524                         then
5525                                 for thisname in $libnames; do
5526                                         bld t $libnames | \
5527                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5528                                         $ar t $thisname >>libc.tmp
5529                                 done
5530                                 echo "Ok." >&4
5531                         else
5532                                 echo "That didn't work either.  Giving up." >&4
5533                                 exit 1
5534                         fi
5535                 fi
5536         fi
5537 fi
5538 nm_extract="$com"
5539 if $test -f /lib/syscalls.exp; then
5540         echo " "
5541         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5542         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5543 fi
5544 ;;
5545 esac
5546 $rm -f libnames libpath
5547
5548 : is a C symbol defined?
5549 csym='tlook=$1;
5550 case "$3" in
5551 -v) tf=libc.tmp; tc=""; tdc="";;
5552 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5553 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5554 esac;
5555 tx=yes;
5556 case "$reuseval-$4" in
5557 true-) ;;
5558 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5559 esac;
5560 case "$tx" in
5561 yes)
5562         case "$runnm" in
5563         true)
5564                 if $contains $tlook $tf >/dev/null 2>&1;
5565                 then tval=true;
5566                 else tval=false;
5567                 fi;;
5568         *)
5569                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5570                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5571                 then tval=true;
5572                 else tval=false;
5573                 fi;
5574                 $rm -f t t.c;;
5575         esac;;
5576 *)
5577         case "$tval" in
5578         $define) tval=true;;
5579         *) tval=false;;
5580         esac;;
5581 esac;
5582 eval "$2=$tval"'
5583
5584 : define an is-in-libc? function
5585 inlibc='echo " "; td=$define; tu=$undef;
5586 sym=$1; var=$2; eval "was=\$$2";
5587 tx=yes;
5588 case "$reuseval$was" in
5589 true) ;;
5590 true*) tx=no;;
5591 esac;
5592 case "$tx" in
5593 yes)
5594         set $sym tres -f;
5595         eval $csym;
5596         case "$tres" in
5597         true)
5598                 echo "$sym() found." >&4;
5599                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5600         *)
5601                 echo "$sym() NOT found." >&4;
5602                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5603         esac;;
5604 *)
5605         case "$was" in
5606         $define) echo "$sym() found." >&4;;
5607         *) echo "$sym() NOT found." >&4;;
5608         esac;;
5609 esac'
5610
5611 : see if sqrtl exists
5612 set sqrtl d_sqrtl
5613 eval $inlibc
5614
5615 case "$ccflags" in
5616 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5617 esac
5618
5619 case "$uselongdouble" in
5620 $define|true|[yY]*)     dflt='y';;
5621 *) dflt='n';;
5622 esac
5623 cat <<EOM
5624
5625 Perl can be built to take advantage of long doubles which
5626 (if available) may give more accuracy and range for floating point numbers.
5627
5628 If this doesn't make any sense to you, just accept the default '$dflt'.
5629 EOM
5630 rp='Try to use long doubles if available?'
5631 . ./myread
5632 case "$ans" in
5633 y|Y)    val="$define"   ;;
5634 *)      val="$undef"    ;;
5635 esac
5636 set uselongdouble
5637 eval $setvar
5638
5639 case "$uselongdouble" in
5640 true|[yY]*) uselongdouble="$define" ;;
5641 esac
5642
5643 case "$uselongdouble" in
5644 $define)
5645 : Look for a hint-file generated 'call-back-unit'.  If the
5646 : user has specified that long doubles should be used,
5647 : we may need to set or change some other defaults.
5648         if $test -f uselongdouble.cbu; then
5649                 echo "Your platform has some specific hints for long doubles, using them..."
5650                 . ./uselongdouble.cbu
5651         else
5652                 $cat <<EOM
5653 (Your platform doesn't have any specific hints for long doubles.)
5654 EOM
5655         fi
5656         ;;
5657 esac
5658
5659 case "$uselongdouble:$d_sqrtl" in
5660 $define:$undef)
5661                 $cat <<EOM >&4
5662
5663 *** You requested the use of long doubles but you do not seem to have
5664 *** the mathematic functions for long doubles.  I'm disabling the use
5665 *** of long doubles.
5666
5667 EOM
5668         uselongdouble=$undef
5669         ;;
5670 esac
5671
5672 : check for length of double
5673 echo " "
5674 case "$doublesize" in
5675 '')
5676         echo "Checking to see how big your double precision numbers are..." >&4
5677         $cat >try.c <<'EOCP'
5678 #include <stdio.h>
5679 int main()
5680 {
5681     printf("%d\n", (int)sizeof(double));
5682     exit(0);
5683 }
5684 EOCP
5685         set try
5686         if eval $compile_ok; then
5687                 doublesize=`./try`
5688                 echo "Your double is $doublesize bytes long."
5689         else
5690                 dflt='8'
5691                 echo "(I can't seem to compile the test program.  Guessing...)"
5692                 rp="What is the size of a double precision number (in bytes)?"
5693                 . ./myread
5694                 doublesize="$ans"
5695         fi
5696         ;;
5697 esac
5698 $rm -f try.c try
5699
5700 : check for long doubles
5701 echo " "
5702 echo "Checking to see if you have long double..." >&4
5703 echo 'int main() { long double x = 7.0; }' > try.c
5704 set try
5705 if eval $compile; then
5706         val="$define"
5707         echo "You have long double."
5708 else
5709         val="$undef"
5710         echo "You do not have long double."
5711 fi
5712 $rm try.*
5713 set d_longdbl
5714 eval $setvar
5715
5716 : check for length of long double
5717 case "${d_longdbl}${longdblsize}" in
5718 $define)
5719         echo " "
5720         echo "Checking to see how big your long doubles are..." >&4
5721         $cat >try.c <<'EOCP'
5722 #include <stdio.h>
5723 int main()
5724 {
5725         printf("%d\n", sizeof(long double));
5726 }
5727 EOCP
5728         set try
5729         set try
5730         if eval $compile; then
5731                 longdblsize=`./try$exe_ext`
5732                 echo "Your long doubles are $longdblsize bytes long."
5733         else
5734                 dflt='8'
5735                 echo " "
5736                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5737                 rp="What is the size of a long double (in bytes)?"
5738                 . ./myread
5739                 longdblsize="$ans"
5740         fi
5741         if $test "X$doublesize" = "X$longdblsize"; then
5742                 echo "(That isn't any different from an ordinary double.)"
5743         fi      
5744         ;;
5745 esac
5746 $rm -f try.* try
5747
5748 case "$useperlio" in
5749 $define|true|[yY]*|'')  dflt='y';;
5750 *) dflt='n';;
5751 esac
5752 cat <<EOM
5753
5754 Previous version of $package used the standard IO mechanisms as
5755 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5756 alternate IO mechanisms via the PerlIO abstraction layer, but the
5757 stdio mechanism is still available if needed.  The abstraction layer
5758 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5759 Using PerlIO with sfio may cause problems with some extension modules.
5760
5761 If this doesn't make any sense to you, just accept the default '$dflt'.
5762 EOM
5763 rp='Use the PerlIO abstraction layer?'
5764 . ./myread
5765 case "$ans" in
5766 y|Y) 
5767         val="$define"
5768         ;;
5769 *)      
5770         echo "Ok, doing things the stdio way."
5771         val="$undef"
5772         ;;
5773 esac
5774 set useperlio
5775 eval $setvar 
5776
5777 case "$usesocks" in
5778 $define|true|[yY]*)
5779         case "$useperlio" in
5780         $define|true|[yY]*) ;;
5781         *)      cat >&4 <<EOM
5782
5783 You are using the SOCKS proxy protocol library which means that you
5784 should also use the PerlIO layer.  You may be headed for trouble.
5785
5786 EOM
5787                 ;;
5788         esac
5789         ;;
5790 esac
5791
5792         
5793 : determine the architecture name
5794 echo " "
5795 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5796         tarch=`arch`"-$osname"
5797 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5798         if uname -m > tmparch 2>&1 ; then
5799                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5800                         -e 's/$/'"-$osname/" tmparch`
5801         else
5802                 tarch="$osname"
5803         fi
5804         $rm -f tmparch
5805 else
5806         tarch="$osname"
5807 fi
5808 case "$myarchname" in
5809 ''|"$tarch") ;;
5810 *)
5811         echo "(Your architecture name used to be $myarchname.)"
5812         archname=''
5813         ;;
5814 esac
5815 myarchname="$tarch"
5816 case "$archname" in
5817 '') dflt="$tarch";;
5818 *) dflt="$archname";;
5819 esac
5820 rp='What is your architecture name'
5821 . ./myread
5822 archname="$ans"
5823 case "$usethreads" in
5824 $define)
5825         echo "Threads selected." >&4
5826         case "$archname" in
5827         *-thread*) echo "...and architecture name already has -thread." >&4
5828                 ;;
5829         *)      archname="$archname-thread"
5830                 echo "...setting architecture name to $archname." >&4
5831                 ;;
5832         esac
5833         ;;
5834 esac
5835 case "$usemultiplicity" in
5836 $define)
5837         echo "Multiplicity selected." >&4
5838         case "$archname" in
5839         *-multi*) echo "...and architecture name already has -multi." >&4
5840                 ;;
5841         *)      archname="$archname-multi"
5842                 echo "...setting architecture name to $archname." >&4
5843                 ;;
5844         esac
5845         ;;
5846 esac
5847 case "$use64bitint$use64bitall" in
5848 *"$define"*)
5849         case "$archname64" in
5850         '')
5851                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5852                 ;;
5853         *)
5854                 case "$use64bitint" in
5855                 "$define") echo "64 bit integers selected." >&4 ;;
5856                 esac
5857                 case "$use64bitall" in
5858                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5859                 esac
5860                 case "$archname" in
5861                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5862                         ;;
5863                 *)      archname="$archname-$archname64"
5864                         echo "...setting architecture name to $archname." >&4
5865                         ;;
5866                 esac
5867                 ;;
5868         esac
5869 esac
5870 case "$uselongdouble" in
5871 $define)
5872         echo "Long doubles selected." >&4
5873         case "$longdblsize" in
5874         $doublesize)
5875                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5876                 ;;
5877         *)
5878                 case "$archname" in
5879                 *-ld*) echo "...and architecture name already has -ld." >&4
5880                         ;;
5881                 *)      archname="$archname-ld"
5882                         echo "...setting architecture name to $archname." >&4
5883                         ;;
5884                 esac
5885                 ;;
5886         esac
5887         ;;
5888 esac
5889 case "$useperlio" in
5890 $define)
5891         echo "Perlio selected." >&4
5892         ;;
5893 *)
5894         echo "Perlio not selected, using stdio." >&4
5895         case "$archname" in
5896         *-stdio*) echo "...and architecture name already has -stdio." >&4
5897                 ;;
5898         *)      archname="$archname-stdio"
5899                 echo "...setting architecture name to $archname." >&4
5900                 ;;
5901         esac
5902         ;;
5903 esac
5904
5905 : determine root of directory hierarchy where package will be installed.
5906 case "$prefix" in
5907 '')
5908         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5909         ;;
5910 *)
5911         dflt="$prefix"
5912         ;;
5913 esac
5914 $cat <<EOM
5915
5916 By default, $package will be installed in $dflt/bin, manual pages
5917 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5918 installation directories. Typically this is something like /usr/local.
5919 If you wish to have binaries under /usr/bin but other parts of the
5920 installation under /usr/local, that's ok: you will be prompted
5921 separately for each of the installation directories, the prefix being
5922 only used to set the defaults.
5923
5924 EOM
5925 fn=d~
5926 rp='Installation prefix to use?'
5927 . ./getfile
5928 oldprefix=''
5929 case "$prefix" in
5930 '') ;;
5931 *)
5932         case "$ans" in
5933         "$prefix") ;;
5934         *) oldprefix="$prefix";;
5935         esac
5936         ;;
5937 esac
5938 prefix="$ans"
5939 prefixexp="$ansexp"
5940
5941 case "$afsroot" in
5942 '')     afsroot=/afs ;;
5943 *)      afsroot=$afsroot ;;
5944 esac
5945
5946 : is AFS running?
5947 echo " "
5948 case "$afs" in
5949 $define|true)   afs=true ;;
5950 $undef|false)   afs=false ;;
5951 *)      if test -d $afsroot; then
5952                 afs=true
5953         else
5954                 afs=false
5955         fi
5956         ;;
5957 esac
5958 if $afs; then
5959         echo "AFS may be running... I'll be extra cautious then..." >&4
5960 else
5961         echo "AFS does not seem to be running..." >&4
5962 fi
5963
5964 : determine installation prefix for where package is to be installed.
5965 if $afs; then 
5966 $cat <<EOM
5967
5968 Since you are running AFS, I need to distinguish the directory in which
5969 files will reside from the directory in which they are installed (and from
5970 which they are presumably copied to the former directory by occult means).
5971
5972 EOM
5973         case "$installprefix" in
5974         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5975         *) dflt="$installprefix";;
5976         esac
5977 else
5978 $cat <<EOM
5979
5980 In some special cases, particularly when building $package for distribution,
5981 it is convenient to distinguish between the directory in which files should 
5982 be installed from the directory ($prefix) in which they 
5983 will eventually reside.  For most users, these two directories are the same.
5984
5985 EOM
5986         case "$installprefix" in
5987         '') dflt=$prefix ;;
5988         *) dflt=$installprefix;;
5989         esac
5990 fi
5991 fn=d~
5992 rp='What installation prefix should I use for installing files?'
5993 . ./getfile
5994 installprefix="$ans"
5995 installprefixexp="$ansexp"
5996
5997 : set the prefixit variable, to compute a suitable default value
5998 prefixit='case "$3" in
5999 ""|none)
6000         case "$oldprefix" in
6001         "") eval "$1=\"\$$2\"";;
6002         *)
6003                 case "$3" in
6004                 "") eval "$1=";;
6005                 none)
6006                         eval "tp=\"\$$2\"";
6007                         case "$tp" in
6008                         ""|" ") eval "$1=\"\$$2\"";;
6009                         *) eval "$1=";;
6010                         esac;;
6011                 esac;;
6012         esac;;
6013 *)
6014         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6015         case "$tp" in
6016         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6017         /*-$oldprefix/*|\~*-$oldprefix/*)
6018                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6019         *) eval "$1=\"\$$2\"";;
6020         esac;;
6021 esac'
6022
6023
6024 : get the patchlevel
6025 echo " "
6026 echo "Getting the current patchlevel..." >&4
6027 if $test -r $rsrc/patchlevel.h;then
6028         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6029         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6030         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6031         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6032         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6033         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6034        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6035 else
6036         revision=0
6037         patchlevel=0
6038         subversion=0
6039         api_revision=0
6040         api_version=0
6041         api_subversion=0
6042         perl_patchlevel=0
6043         $echo "(You do not have patchlevel.h.  Eek.)"
6044 fi
6045 if $test -r $rsrc/.patch ; then  
6046         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6047                 perl_patchlevel=`cat $rsrc/.patch`
6048         fi
6049 fi
6050 case "$perl_patchlevel" in
6051 0)  ;;
6052 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6053 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6054 esac
6055 case "$osname" in
6056 dos|vms)
6057         : XXX Should be a Configure test for double-dots in filenames.
6058         version=`echo $revision $patchlevel $subversion | \
6059                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6060         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6061                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6062         ;;
6063 *)
6064         version=`echo $revision $patchlevel $subversion | \
6065                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6066         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6067                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6068         ;;
6069 esac
6070 : Special case the 5.005_xx maintenance series, which used 5.005
6071 : without any subversion label as a subdirectory in $sitelib
6072 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6073         api_versionstring='5.005'
6074 fi
6075
6076 : determine installation style
6077 : For now, try to deduce it from prefix unless it is already set.
6078 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6079 case "$installstyle" in
6080 '')     case "$prefix" in
6081                 *perl*) dflt='lib';;
6082                 *) dflt='lib/perl5' ;;
6083         esac
6084         ;;
6085 *)      dflt="$installstyle" ;;
6086 esac
6087 : Probably not worth prompting for this since we prompt for all
6088 : the directories individually, and the prompt would be too long and
6089 : confusing anyway.
6090 installstyle=$dflt
6091
6092 : determine where private library files go
6093 : Usual default is /usr/local/lib/perl5/$version.
6094 : Also allow things like /opt/perl/lib/$version, since 
6095 : /opt/perl/lib/perl5... would be redundant.
6096 : The default "style" setting is made in installstyle.U
6097 case "$installstyle" in
6098 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6099 *)       set dflt privlib lib/$version ;;
6100 esac
6101 eval $prefixit
6102 $cat <<EOM
6103
6104 There are some auxiliary files for $package that need to be put into a
6105 private library directory that is accessible by everyone.
6106
6107 EOM
6108 fn=d~+
6109 rp='Pathname where the private library files will reside?'
6110 . ./getfile
6111 privlib="$ans"
6112 privlibexp="$ansexp"
6113 : Change installation prefix, if necessary.
6114 if $test X"$prefix" != X"$installprefix"; then
6115         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6116 else
6117         installprivlib="$privlibexp"
6118 fi
6119
6120 : set the prefixup variable, to restore leading tilda escape
6121 prefixup='case "$prefixexp" in
6122 "$prefix") ;;
6123 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6124 esac'
6125
6126 : determine where public architecture dependent libraries go
6127 set archlib archlib
6128 eval $prefixit
6129 : privlib default is /usr/local/lib/$package/$version
6130 : archlib default is /usr/local/lib/$package/$version/$archname
6131 : privlib may have an optional trailing /share.
6132 tdflt=`echo $privlib | $sed 's,/share$,,'`
6133 tdflt=$tdflt/$archname
6134 case "$archlib" in
6135 '')     dflt=$tdflt
6136         ;;
6137 *)      dflt="$archlib"
6138     ;;
6139 esac
6140 $cat <<EOM
6141
6142 $spackage contains architecture-dependent library files.  If you are
6143 sharing libraries in a heterogeneous environment, you might store
6144 these files in a separate location.  Otherwise, you can just include
6145 them with the rest of the public library files.
6146
6147 EOM
6148 fn=d+~
6149 rp='Where do you want to put the public architecture-dependent libraries?'
6150 . ./getfile
6151 archlib="$ans"
6152 archlibexp="$ansexp"
6153 if $test X"$archlib" = X"$privlib"; then
6154         d_archlib="$undef"
6155 else
6156         d_archlib="$define"
6157 fi
6158 : Change installation prefix, if necessary.
6159 if $test X"$prefix" != X"$installprefix"; then
6160         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6161 else
6162         installarchlib="$archlibexp"
6163 fi
6164
6165
6166 : Binary compatibility with 5.005 is not possible for builds
6167 : with advanced features
6168 case "$usethreads$usemultiplicity" in
6169 *define*)
6170         bincompat5005="$undef"
6171         d_bincompat5005="$undef"
6172         ;;
6173 *)      $cat <<EOM
6174
6175 This version of Perl can be compiled for binary compatibility with 5.005.
6176 If you decide to do so, you will be able to continue using most of the
6177 extensions that were compiled for Perl 5.005.
6178
6179 EOM
6180         case "$bincompat5005$d_bincompat5005" in
6181         *"$undef"*) dflt=n ;;
6182         *) dflt=y ;;
6183         esac
6184         rp='Binary compatibility with Perl 5.005?'
6185         . ./myread
6186         case "$ans" in
6187         y*) val="$define" ;;
6188         *)  val="$undef" ;;
6189         esac
6190         set d_bincompat5005
6191         eval $setvar
6192         case "$d_bincompat5005" in
6193         "$define")
6194                 bincompat5005="$define"
6195                 ;;
6196         *)      bincompat5005="$undef"
6197                 d_bincompat5005="$undef"
6198                 ;;
6199         esac
6200         ;;
6201 esac
6202
6203
6204 : see if setuid scripts can be secure
6205 $cat <<EOM
6206
6207 Some kernels have a bug that prevents setuid #! scripts from being
6208 secure.  Some sites have disabled setuid #! scripts because of this.
6209
6210 First let's decide if your kernel supports secure setuid #! scripts.
6211 (If setuid #! scripts would be secure but have been disabled anyway,
6212 don't say that they are secure if asked.)
6213
6214 EOM
6215
6216 val="$undef"
6217 if $test -d /dev/fd; then
6218         echo "#!$ls" >reflect
6219         chmod +x,u+s reflect
6220         ./reflect >flect 2>&1
6221         if $contains "/dev/fd" flect >/dev/null; then
6222                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6223                 val="$define"
6224         else
6225                 $cat <<EOM
6226 If you are not sure if they are secure, I can check but I'll need a
6227 username and password different from the one you are using right now.
6228 If you don't have such a username or don't want me to test, simply
6229 enter 'none'.
6230
6231 EOM
6232                 rp='Other username to test security of setuid scripts with?'
6233                 dflt='none'
6234                 . ./myread
6235                 case "$ans" in
6236                 n|none)
6237                         case "$d_suidsafe" in
6238                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6239                                 dflt=n;;
6240                         "$undef")
6241                                 echo "Well, the $hint value is *not* secure." >&4
6242                                 dflt=n;;
6243                         *)      echo "Well, the $hint value *is* secure." >&4
6244                                 dflt=y;;
6245                         esac
6246                         ;;
6247                 *)
6248                         $rm -f reflect flect
6249                         echo "#!$ls" >reflect
6250                         chmod +x,u+s reflect
6251                         echo >flect
6252                         chmod a+w flect
6253                         echo '"su" will (probably) prompt you for '"$ans's password."
6254                         su $ans -c './reflect >flect'
6255                         if $contains "/dev/fd" flect >/dev/null; then
6256                                 echo "Okay, it looks like setuid scripts are secure." >&4
6257                                 dflt=y
6258                         else
6259                                 echo "I don't think setuid scripts are secure." >&4
6260                                 dflt=n
6261                         fi
6262                         ;;
6263                 esac
6264                 rp='Does your kernel have *secure* setuid scripts?'
6265                 . ./myread
6266                 case "$ans" in
6267                 [yY]*)  val="$define";;
6268                 *)      val="$undef";;
6269                 esac
6270         fi
6271 else
6272         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6273         echo "(That's for file descriptors, not floppy disks.)"
6274         val="$undef"
6275 fi
6276 set d_suidsafe
6277 eval $setvar
6278
6279 $rm -f reflect flect
6280
6281 : now see if they want to do setuid emulation
6282 echo " "
6283 val="$undef"
6284 case "$d_suidsafe" in
6285 "$define")
6286         val="$undef"
6287         echo "No need to emulate SUID scripts since they are secure here." >& 4
6288         ;;
6289 *)
6290         $cat <<EOM
6291 Some systems have disabled setuid scripts, especially systems where
6292 setuid scripts cannot be secure.  On systems where setuid scripts have
6293 been disabled, the setuid/setgid bits on scripts are currently
6294 useless.  It is possible for $package to detect those bits and emulate
6295 setuid/setgid in a secure fashion.  This emulation will only work if
6296 setuid scripts have been disabled in your kernel.
6297
6298 EOM
6299         case "$d_dosuid" in
6300         "$define") dflt=y ;;
6301         *) dflt=n ;;
6302         esac
6303         rp="Do you want to do setuid/setgid emulation?"
6304         . ./myread
6305         case "$ans" in
6306         [yY]*)  val="$define";;
6307         *)      val="$undef";;
6308         esac
6309         ;;
6310 esac
6311 set d_dosuid
6312 eval $setvar
6313
6314 : see if this is a malloc.h system
6315 set malloc.h i_malloc
6316 eval $inhdr
6317
6318 : see if stdlib is available
6319 set stdlib.h i_stdlib
6320 eval $inhdr
6321
6322 : determine which malloc to compile in
6323 echo " "
6324 case "$usemymalloc" in
6325 [yY]*|true|$define)     dflt='y' ;;
6326 [nN]*|false|$undef)     dflt='n' ;;
6327 *)      case "$ptrsize" in
6328         4) dflt='y' ;;
6329         *) dflt='n' ;;
6330         esac
6331         ;;
6332 esac
6333 rp="Do you wish to attempt to use the malloc that comes with $package?"
6334 . ./myread
6335 usemymalloc="$ans"
6336 case "$ans" in
6337 y*|true)
6338         usemymalloc='y'
6339         mallocsrc='malloc.c'
6340         mallocobj="malloc$_o"
6341         d_mymalloc="$define"
6342         case "$libs" in
6343         *-lmalloc*)
6344                 : Remove malloc from list of libraries to use
6345                 echo "Removing unneeded -lmalloc from library list" >&4
6346                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6347                 shift
6348                 libs="$*"
6349                 echo "libs = $libs" >&4
6350                 ;;
6351         esac
6352         ;;
6353 *)
6354         usemymalloc='n'
6355         mallocsrc=''
6356         mallocobj=''
6357         d_mymalloc="$undef"
6358         ;;
6359 esac
6360
6361 : compute the return types of malloc and free
6362 echo " "
6363 $cat >malloc.c <<END
6364 #$i_malloc I_MALLOC
6365 #$i_stdlib I_STDLIB
6366 #include <stdio.h>
6367 #include <sys/types.h>
6368 #ifdef I_MALLOC
6369 #include <malloc.h>
6370 #endif
6371 #ifdef I_STDLIB
6372 #include <stdlib.h>
6373 #endif
6374 #ifdef TRY_MALLOC
6375 void *malloc();
6376 #endif
6377 #ifdef TRY_FREE
6378 void free();
6379 #endif
6380 END
6381 case "$malloctype" in
6382 '')
6383         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6384                 malloctype='void *'
6385         else
6386                 malloctype='char *'
6387         fi
6388         ;;
6389 esac
6390 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6391
6392 case "$freetype" in
6393 '')
6394         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6395                 freetype='void'
6396         else
6397                 freetype='int'
6398         fi
6399         ;;
6400 esac
6401 echo "Your system uses $freetype free(), it would seem." >&4
6402 $rm -f malloc.[co]
6403 $cat <<EOM
6404
6405 After $package is installed, you may wish to install various
6406 add-on modules and utilities.  Typically, these add-ons will
6407 be installed under $prefix with the rest
6408 of this package.  However, you may wish to install such add-ons
6409 elsewhere under a different prefix.
6410
6411 If you do not wish to put everything under a single prefix, that's
6412 ok.  You will be prompted for the individual locations; this siteprefix
6413 is only used to suggest the defaults.
6414
6415 The default should be fine for most people.
6416
6417 EOM
6418 fn=d~+
6419 rp='Installation prefix to use for add-on modules and utilities?'
6420 : XXX Here might be another good place for an installstyle setting.
6421 case "$siteprefix" in
6422 '') dflt=$prefix ;;
6423 *)  dflt=$siteprefix ;;
6424 esac
6425 . ./getfile
6426 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6427 oldsiteprefix=''
6428 case "$siteprefix" in
6429 '') ;;
6430 *)      case "$ans" in
6431         "$prefix") ;;
6432         *) oldsiteprefix="$prefix";;
6433         esac
6434         ;;
6435 esac
6436 siteprefix="$ans"
6437 siteprefixexp="$ansexp"
6438
6439 : determine where site specific libraries go.
6440 : Usual default is /usr/local/lib/perl5/site_perl/$version
6441 : The default "style" setting is made in installstyle.U
6442 : XXX No longer works with Prefixit stuff.
6443 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6444 case "$sitelib" in
6445 '') case "$installstyle" in
6446         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6447         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6448         esac
6449         ;;
6450 *)      dflt="$sitelib"
6451         ;;
6452 esac
6453 $cat <<EOM
6454
6455 The installation process will create a directory for
6456 site-specific extensions and modules.  Most users find it convenient
6457 to place all site-specific files in this directory rather than in the
6458 main distribution directory.
6459
6460 EOM
6461 fn=d~+
6462 rp='Pathname for the site-specific library files?'
6463 . ./getfile
6464 sitelib="$ans"
6465 sitelibexp="$ansexp"
6466 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6467 : Change installation prefix, if necessary.
6468 if $test X"$prefix" != X"$installprefix"; then
6469         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6470 else
6471         installsitelib="$sitelibexp"
6472 fi
6473
6474 : determine where site specific architecture-dependent libraries go.
6475 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6476 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6477 : sitelib may have an optional trailing /share.
6478 case "$sitearch" in
6479 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6480         dflt="$dflt/$archname"
6481         ;;
6482 *)      dflt="$sitearch"
6483         ;;
6484 esac
6485 set sitearch sitearch none
6486 eval $prefixit
6487 $cat <<EOM
6488
6489 The installation process will also create a directory for
6490 architecture-dependent site-specific extensions and modules.
6491
6492 EOM
6493 fn=d~+
6494 rp='Pathname for the site-specific architecture-dependent library files?'
6495 . ./getfile
6496 sitearch="$ans"
6497 sitearchexp="$ansexp"
6498 : Change installation prefix, if necessary.
6499 if $test X"$prefix" != X"$installprefix"; then
6500         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6501 else
6502         installsitearch="$sitearchexp"
6503 fi
6504
6505 $cat <<EOM
6506
6507 The installation process will also create a directory for
6508 vendor-supplied add-ons.  Vendors who supply perl with their system
6509 may find it convenient to place all vendor-supplied files in this
6510 directory rather than in the main distribution directory.  This will
6511 ease upgrades between binary-compatible maintenance versions of perl.
6512
6513 Of course you may also use these directories in whatever way you see
6514 fit.  For example, you might use them to access modules shared over a
6515 company-wide network.
6516
6517 The default answer should be fine for most people.
6518 This causes further questions about vendor add-ons to be skipped
6519 and no vendor-specific directories will be configured for perl.
6520
6521 EOM
6522 rp='Do you want to configure vendor-specific add-on directories?'
6523 case "$usevendorprefix" in
6524 define|true|[yY]*) dflt=y ;;
6525 *)      : User may have set vendorprefix directly on Configure command line.
6526         case "$vendorprefix" in
6527         ''|' ') dflt=n ;;
6528         *)      dflt=y ;;
6529         esac
6530         ;;
6531 esac
6532 . ./myread
6533 case "$ans" in
6534 [yY]*)  fn=d~+
6535         rp='Installation prefix to use for vendor-supplied add-ons?'
6536         case "$vendorprefix" in
6537         '') dflt='' ;;
6538         *)  dflt=$vendorprefix ;;
6539         esac
6540         . ./getfile
6541         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6542         oldvendorprefix=''
6543         case "$vendorprefix" in
6544         '') ;;
6545         *)      case "$ans" in
6546                 "$prefix") ;;
6547                 *) oldvendorprefix="$prefix";;
6548                 esac
6549                 ;;
6550         esac
6551         usevendorprefix="$define"
6552         vendorprefix="$ans"
6553         vendorprefixexp="$ansexp"
6554         ;;
6555 *)      usevendorprefix="$undef"
6556         vendorprefix=''
6557         vendorprefixexp=''
6558         ;;
6559 esac
6560
6561 case "$vendorprefix" in
6562 '')     d_vendorlib="$undef"
6563         vendorlib=''
6564         vendorlibexp=''
6565         ;;
6566 *)      d_vendorlib="$define"
6567         : determine where vendor-supplied modules go.
6568         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6569         case "$vendorlib" in
6570         '')
6571                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6572                 case "$installstyle" in
6573                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6574                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6575                 esac
6576                 ;;
6577         *)      dflt="$vendorlib"
6578                 ;;
6579         esac
6580         fn=d~+
6581         rp='Pathname for the vendor-supplied library files?'
6582         . ./getfile
6583         vendorlib="$ans"
6584         vendorlibexp="$ansexp"
6585         ;;
6586 esac
6587 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6588 : Change installation prefix, if necessary.
6589 if $test X"$prefix" != X"$installprefix"; then
6590         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6591 else
6592         installvendorlib="$vendorlibexp"
6593 fi
6594
6595 case "$vendorprefix" in
6596 '')     d_vendorarch="$undef"
6597         vendorarch=''
6598         vendorarchexp=''
6599         ;;
6600 *)      d_vendorarch="$define"
6601         : determine where vendor-supplied architecture-dependent libraries go.
6602         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6603         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6604         : vendorlib may have an optional trailing /share.
6605         case "$vendorarch" in
6606         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6607                 dflt="$dflt/$archname"
6608                 ;;
6609         *)      dflt="$vendorarch" ;;
6610         esac
6611         fn=d~+
6612         rp='Pathname for vendor-supplied architecture-dependent files?'
6613         . ./getfile
6614         vendorarch="$ans"
6615         vendorarchexp="$ansexp"
6616         ;;
6617 esac
6618 : Change installation prefix, if necessary.
6619 if $test X"$prefix" != X"$installprefix"; then
6620         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6621 else
6622         installvendorarch="$vendorarchexp"
6623 fi
6624
6625 : Final catch-all directories to search
6626 $cat <<EOM
6627
6628 Lastly, you can have perl look in other directories for extensions and
6629 modules in addition to those already specified.
6630 These directories will be searched after 
6631         $sitearch 
6632         $sitelib 
6633 EOM
6634 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6635 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6636 echo ' '
6637 case "$otherlibdirs" in
6638 ''|' ') dflt='none' ;;
6639 *)      dflt="$otherlibdirs" ;;
6640 esac
6641 $cat <<EOM
6642 Enter a colon-separated set of extra paths to include in perl's @INC
6643 search path, or enter 'none' for no extra paths.
6644
6645 EOM
6646
6647 rp='Colon-separated list of additional directories for perl to search?'
6648 . ./myread
6649 case "$ans" in
6650 ' '|''|none)    otherlibdirs=' ' ;;     
6651 *)      otherlibdirs="$ans" ;;
6652 esac
6653 case "$otherlibdirs" in
6654 ' ') val=$undef ;;
6655 *)      val=$define ;;
6656 esac
6657 set d_perl_otherlibdirs
6658 eval $setvar
6659
6660 : Cruising for prototypes
6661 echo " "
6662 echo "Checking out function prototypes..." >&4
6663 $cat >prototype.c <<'EOCP'
6664 int main(int argc, char *argv[]) {
6665         exit(0);}
6666 EOCP
6667 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6668         echo "Your C compiler appears to support function prototypes."
6669         val="$define"
6670 else
6671         echo "Your C compiler doesn't seem to understand function prototypes."
6672         val="$undef"
6673 fi
6674 set prototype
6675 eval $setvar
6676 $rm -f prototype*
6677
6678 case "$prototype" in
6679 "$define") ;;
6680 *)      ansi2knr='ansi2knr'
6681         echo " "
6682         cat <<EOM >&4
6683
6684 $me:  FATAL ERROR:
6685 This version of $package can only be compiled by a compiler that 
6686 understands function prototypes.  Unfortunately, your C compiler 
6687         $cc $ccflags
6688 doesn't seem to understand them.  Sorry about that.
6689
6690 If GNU cc is available for your system, perhaps you could try that instead.  
6691
6692 Eventually, we hope to support building Perl with pre-ANSI compilers.
6693 If you would like to help in that effort, please contact <perlbug@perl.org>.
6694
6695 Aborting Configure now.
6696 EOM
6697         exit 2
6698         ;;
6699 esac
6700
6701 : determine where public executables go
6702 echo " "
6703 set dflt bin bin
6704 eval $prefixit
6705 fn=d~
6706 rp='Pathname where the public executables will reside?'
6707 . ./getfile
6708 if $test "X$ansexp" != "X$binexp"; then
6709         installbin=''
6710 fi
6711 bin="$ans"
6712 binexp="$ansexp"
6713 : Change installation prefix, if necessary.
6714 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6715 if $test X"$prefix" != X"$installprefix"; then
6716         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6717 else
6718         installbin="$binexp"
6719 fi
6720
6721 : Find perl5.005 or later.
6722 echo "Looking for a previously installed perl5.005 or later... "
6723 case "$perl5" in
6724 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6725                 : Check if this perl is recent and can load a simple module
6726                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6727                         perl5=$tdir/perl
6728                         break;
6729                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6730                         perl5=$tdir/perl5
6731                         break;
6732                 fi
6733         done
6734         ;;
6735 *)      perl5="$perl5"
6736         ;;
6737 esac
6738 case "$perl5" in
6739 '')     echo "None found.  That's ok.";;
6740 *)      echo "Using $perl5." ;;
6741 esac
6742
6743 : Determine list of previous versions to include in @INC
6744 $cat > getverlist <<EOPL
6745 #!$perl5 -w
6746 use File::Basename;
6747 \$api_versionstring = "$api_versionstring";
6748 \$version = "$version";
6749 \$stem = "$sitelib_stem";
6750 \$archname = "$archname";
6751 EOPL
6752         $cat >> getverlist <<'EOPL'
6753 # Can't have leading @ because metaconfig interprets it as a command!
6754 ;@inc_version_list=();
6755 # XXX Redo to do opendir/readdir? 
6756 if (-d $stem) {
6757     chdir($stem);
6758     ;@candidates = glob("5.*");
6759 }
6760 else {
6761     ;@candidates = ();
6762 }
6763
6764 # XXX ToDo:  These comparisons must be reworked when two-digit
6765 # subversions come along, so that 5.7.10 compares as greater than
6766 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6767 # widespread that we can use the built-in version vectors rather
6768 # than reinventing them here.  For 5.6.0, however, we must
6769 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6770 foreach $d (@candidates) {
6771     if ($d lt $version) {
6772         if ($d ge $api_versionstring) {
6773             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6774         }
6775         elsif ($d ge "5.005") {
6776             unshift(@inc_version_list, grep { -d } $d);
6777         }
6778     }
6779     else {
6780         # Skip newer version.  I.e. don't look in
6781         # 5.7.0 if we're installing 5.6.1.
6782     }
6783 }
6784
6785 if (@inc_version_list) {
6786     print join(' ', @inc_version_list);
6787 }
6788 else {
6789     # Blank space to preserve value for next Configure run.
6790     print " ";
6791 }
6792 EOPL
6793 chmod +x getverlist
6794 case "$inc_version_list" in
6795 '')     if test -x "$perl5$exe_ext"; then
6796                 dflt=`$perl5 getverlist`
6797         else
6798                 dflt='none'
6799         fi
6800         ;;
6801 $undef) dflt='none' ;;
6802 *)  eval dflt=\"$inc_version_list\" ;;
6803 esac
6804 case "$dflt" in
6805 ''|' ') dflt=none ;;
6806 esac
6807 case "$dflt" in
6808 5.005) case "$bincompat5005" in
6809        $define|true|[yY]*) ;;
6810        *) dflt=none ;;
6811        esac
6812        ;;
6813 esac
6814 $cat <<'EOM'
6815
6816 In order to ease the process of upgrading, this version of perl 
6817 can be configured to use modules built and installed with earlier 
6818 versions of perl that were installed under $prefix.  Specify here
6819 the list of earlier versions that this version of perl should check.
6820 If Configure detected no earlier versions of perl installed under
6821 $prefix, then the list will be empty.  Answer 'none' to tell perl
6822 to not search earlier versions.
6823
6824 The default should almost always be sensible, so if you're not sure,
6825 just accept the default.
6826 EOM
6827
6828 rp='List of earlier versions to include in @INC?'
6829 . ./myread
6830 case "$ans" in
6831 [Nn]one|''|' ') inc_version_list=' ' ;;
6832 *) inc_version_list="$ans" ;;
6833 esac
6834 case "$inc_version_list" in
6835 ''|' ') 
6836         inc_version_list_init='0';;
6837 *)      inc_version_list_init=`echo $inc_version_list |
6838                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6839         ;;
6840 esac
6841 $rm -f getverlist
6842
6843 : determine whether to install perl also as /usr/bin/perl
6844
6845 echo " "
6846 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6847         $cat <<EOM
6848 Many scripts expect perl to be installed as /usr/bin/perl.
6849 I can install the perl you are about to compile also as /usr/bin/perl
6850 (in addition to $installbin/perl).
6851 EOM
6852         case "$installusrbinperl" in
6853         "$undef"|[nN]*) dflt='n';;
6854         *)              dflt='y';;
6855         esac
6856         rp="Do you want to install perl as /usr/bin/perl?"
6857         . ./myread
6858         case "$ans" in
6859         [yY]*)  val="$define";;
6860         *)      val="$undef" ;;
6861         esac
6862 else
6863         val="$undef"
6864 fi
6865 set installusrbinperl
6866 eval $setvar
6867
6868 : see if dld is available
6869 set dld.h i_dld
6870 eval $inhdr
6871
6872 : see if dlopen exists
6873 xxx_runnm="$runnm"
6874 runnm=false
6875 set dlopen d_dlopen
6876 eval $inlibc
6877 runnm="$xxx_runnm"
6878
6879 : determine which dynamic loading, if any, to compile in
6880 echo " "
6881 dldir="ext/DynaLoader"
6882 case "$usedl" in
6883 $define|y|true)
6884         dflt='y'
6885         usedl="$define"
6886         ;;
6887 $undef|n|false)
6888         dflt='n'
6889         usedl="$undef"
6890         ;;
6891 *) 
6892         dflt='n'
6893         case "$d_dlopen" in
6894             $define) dflt='y' ;;
6895         esac
6896         case "$i_dld" in
6897             $define) dflt='y' ;;
6898         esac
6899         : Does a dl_xxx.xs file exist for this operating system
6900         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6901         ;;
6902 esac
6903 rp="Do you wish to use dynamic loading?"
6904 . ./myread
6905 usedl="$ans"
6906 case "$ans" in
6907 y*) usedl="$define"
6908         case "$dlsrc" in
6909         '')
6910                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6911                         dflt="$dldir/dl_${osname}.xs"
6912                 elif $test "$d_dlopen" = "$define" ; then
6913                         dflt="$dldir/dl_dlopen.xs"
6914                 elif $test "$i_dld" = "$define" ; then
6915                         dflt="$dldir/dl_dld.xs"
6916                 else
6917                         dflt=''
6918                 fi
6919                 ;;
6920         *)      dflt="$dldir/$dlsrc"
6921                 ;;
6922         esac
6923     echo "The following dynamic loading files are available:"
6924         : Can not go over to $dldir because getfile has path hard-coded in.
6925         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6926         rp="Source file to use for dynamic loading"
6927         fn="fne"
6928         gfpth="$src"
6929         . ./getfile
6930         usedl="$define"
6931         : emulate basename
6932         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6933
6934         $cat << EOM
6935
6936 Some systems may require passing special flags to $cc -c to
6937 compile modules that will be used to create a shared library.
6938 To use no flags, say "none".
6939
6940 EOM
6941     case "$cccdlflags" in
6942     '') case "$gccversion" in
6943                 '') case "$osname" in
6944                         hpux)   dflt='+z' ;;
6945                         next)   dflt='none' ;;
6946                         irix*)  dflt='-KPIC' ;;
6947                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6948                         sunos)  dflt='-pic' ;;
6949                         *)      dflt='none' ;;
6950                     esac
6951                         ;;
6952                 *)  case "$osname" in
6953                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6954                         *)      dflt='-fpic' ;;
6955                     esac ;;
6956             esac ;;
6957         ' ') dflt='none' ;;
6958     *)  dflt="$cccdlflags" ;;
6959     esac
6960     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6961     . ./myread
6962     case "$ans" in
6963     none) cccdlflags=' ' ;;
6964     *) cccdlflags="$ans" ;;
6965     esac
6966
6967     cat << EOM
6968
6969 Some systems use ld to create libraries that can be dynamically loaded,
6970 while other systems (such as those using ELF) use $cc.
6971
6972 EOM
6973         case "$ld" in
6974         '')     $cat >try.c <<'EOM'
6975 /* Test for whether ELF binaries are produced */
6976 #include <fcntl.h>
6977 #include <stdlib.h>
6978 int main() {
6979         char b[4];
6980         int i = open("a.out",O_RDONLY);
6981         if(i == -1) 
6982                 exit(1); /* fail */
6983         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6984                 exit(0); /* succeed (yes, it's ELF) */
6985         else
6986                 exit(1); /* fail */
6987 }
6988 EOM
6989                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6990                         cat <<EOM
6991 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6992 EOM
6993                         dflt="$cc"
6994                 else
6995                         echo "I'll use ld to build dynamic libraries."
6996                         dflt='ld'
6997                 fi
6998                 rm -f try.c a.out
6999                 ;;
7000         *)      dflt="$ld"
7001                 ;;
7002         esac
7003
7004     rp="What command should be used to create dynamic libraries?"
7005     . ./myread
7006         ld="$ans"
7007
7008     cat << EOM
7009
7010 Some systems may require passing special flags to $ld to create a
7011 library that can be dynamically loaded.  If your ld flags include
7012 -L/other/path options to locate libraries outside your loader's normal
7013 search path, you may need to specify those -L options here as well.  To
7014 use no flags, say "none".
7015
7016 EOM
7017     case "$lddlflags" in
7018     '') case "$osname" in
7019                         beos) dflt='-nostart' ;;
7020                         hpux) dflt='-b';
7021                               case "$gccversion" in
7022                               '') dflt="$dflt +vnocompatwarnings" ;;
7023                               esac
7024                               ;;        
7025                         linux|irix*)    dflt='-shared' ;;
7026                         next)  dflt='none' ;;
7027                         solaris) dflt='-G' ;;
7028                         sunos) dflt='-assert nodefinitions' ;;
7029                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7030                 *)     dflt='none' ;;
7031                         esac
7032                         ;;
7033     *) dflt="$lddlflags" ;;
7034     esac
7035
7036         : Try to guess additional flags to pick up local libraries.
7037         : Be careful not to append to a plain 'none'
7038         case "$dflt" in
7039         none) dflt='' ;;
7040         esac
7041         for thisflag in $ldflags; do
7042                 case "$thisflag" in
7043                 -L*|-R*)
7044                         case " $dflt " in
7045                         *" $thisflag "*) ;;
7046                         *) dflt="$dflt $thisflag" ;;
7047                         esac
7048                         ;;
7049                 esac
7050         done
7051
7052         case "$dflt" in
7053         ''|' ') dflt='none' ;;
7054         esac
7055
7056     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7057     . ./myread
7058     case "$ans" in
7059     none) lddlflags=' ' ;;
7060     *) lddlflags="$ans" ;;
7061     esac
7062
7063         cat <<EOM
7064
7065 Some systems may require passing special flags to $cc to indicate that
7066 the resulting executable will use dynamic linking.  To use no flags,
7067 say "none".
7068
7069 EOM
7070     case "$ccdlflags" in
7071     '') case "$osname" in
7072                 hpux)   dflt='-Wl,-E' ;;
7073                 linux)  dflt='-rdynamic' ;;
7074                 next)   dflt='none' ;;
7075                 sunos)  dflt='none' ;;
7076                 *)      dflt='none' ;;
7077             esac ;;
7078     ' ')  dflt='none' ;;
7079     *)  dflt="$ccdlflags" ;;
7080     esac
7081     rp="Any special flags to pass to $cc to use dynamic linking?"
7082     . ./myread
7083     case "$ans" in
7084     none) ccdlflags=' ' ;;
7085     *) ccdlflags="$ans" ;;
7086     esac
7087     ;;
7088 *)  usedl="$undef"
7089         ld='ld'
7090     dlsrc='dl_none.xs'
7091     lddlflags=''
7092     ccdlflags=''
7093     ;;
7094 esac
7095
7096 also=''
7097 case "$usedl" in
7098 $undef)
7099         # No dynamic loading being used, so don't bother even to prompt.
7100         useshrplib='false'
7101         ;;
7102 *)      case "$useshrplib" in
7103         '')     case "$osname" in
7104                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7105                         dflt=y
7106                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7107                         ;;
7108                 next*)
7109                         case "$osvers" in
7110                         4*)     dflt=y
7111                                 also='Building a shared libperl is needed for MAB support.'
7112                                 ;;
7113                         *)      dflt=n
7114                                 ;;
7115                         esac
7116                         ;;
7117                 *)      dflt=n
7118                         ;;
7119                 esac
7120                 ;;
7121         $define|true|[Yy]*)
7122                 dflt=y
7123                 ;;
7124         *)      dflt=n
7125                 ;;
7126         esac
7127         $cat << EOM
7128
7129 The perl executable is normally obtained by linking perlmain.c with
7130 libperl${_a}, any static extensions (usually just DynaLoader), and
7131 any other libraries needed on this system (such as -lm, etc.).  Since
7132 your system supports dynamic loading, it is probably possible to build
7133 a shared libperl.$so.  If you will have more than one executable linked
7134 to libperl.$so, this will significantly reduce the size of each
7135 executable, but it may have a noticeable affect on performance.  The
7136 default is probably sensible for your system.
7137 $also
7138
7139 EOM
7140         rp="Build a shared libperl.$so (y/n)"
7141         . ./myread
7142         case "$ans" in
7143         true|$define|[Yy]*)
7144                 useshrplib='true'  ;;
7145         *)      useshrplib='false' ;;
7146         esac
7147         ;;
7148 esac
7149
7150 case "$useshrplib" in
7151 true)
7152         case "$libperl" in
7153         '')
7154                 # Figure out a good name for libperl.so.  Since it gets stored in
7155                 # a version-specific architecture-dependent library, the version
7156                 # number isn't really that important, except for making cc/ld happy.
7157                 #
7158                 # A name such as libperl.so.3.1
7159                 majmin="libperl.$so.$patchlevel.$subversion"
7160                 # A name such as libperl.so.301
7161                 majonly=`echo $patchlevel $subversion |
7162                         $awk '{printf "%d%02d", $1, $2}'`
7163                 majonly=libperl.$so.$majonly
7164                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7165                 # rely on figuring it out from the naming of libc.
7166                 case "${osname}${osvers}" in
7167                 next4*)
7168                         dflt=libperl.5.$so
7169                         # XXX How handle the --version stuff for MAB?
7170                         ;;
7171                 linux*)  # ld won't link with a bare -lperl otherwise.
7172                         dflt=libperl.$so
7173                         ;;
7174                 cygwin*) # include version
7175                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7176                         ;;
7177                 *)      # Try to guess based on whether libc has major.minor.
7178                         case "$libc" in
7179                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7180                         *libc.$so.[0-9]*) dflt=$majonly ;;
7181                         *)      dflt=libperl.$so ;;
7182                         esac
7183                         ;;
7184                 esac
7185                 ;;
7186         *)      dflt=$libperl
7187                 ;;
7188         esac
7189         cat << EOM
7190
7191 I need to select a good name for the shared libperl.  If your system uses
7192 library names with major and minor numbers, then you might want something
7193 like $majmin.  Alternatively, if your system uses a single version
7194 number for shared libraries, then you might want to use $majonly.
7195 Or, your system might be quite happy with a simple libperl.$so.
7196
7197 Since the shared libperl will get installed into a version-specific
7198 architecture-dependent directory, the version number of the shared perl
7199 library probably isn't important, so the default should be o.k.
7200
7201 EOM
7202         rp='What name do you want to give to the shared libperl?'
7203         . ./myread
7204         libperl=$ans
7205         echo "Ok, I'll use $libperl"
7206         ;;
7207 *)
7208         libperl="libperl${_a}"
7209         ;;
7210 esac
7211
7212 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7213 case "$shrpdir" in
7214 '') ;;
7215 *)      $cat >&4 <<EOM
7216 WARNING:  Use of the shrpdir variable for the installation location of
7217 the shared $libperl is not supported.  It was never documented and
7218 will not work in this version.  Let me (perlbug@perl.org)
7219 know of any problems this may cause.
7220
7221 EOM
7222         case "$shrpdir" in
7223         "$archlibexp/CORE")
7224                 $cat >&4 <<EOM
7225 But your current setting of $shrpdir is
7226 the default anyway, so it's harmless.
7227 EOM
7228                 ;;
7229         *)
7230                 $cat >&4 <<EOM
7231 Further, your current attempted setting of $shrpdir
7232 conflicts with the value of $archlibexp/CORE
7233 that installperl will use.
7234 EOM
7235                 ;;
7236         esac
7237         ;;
7238 esac
7239
7240 # How will the perl executable find the installed shared $libperl?
7241 # Add $xxx to ccdlflags.
7242 # If we can't figure out a command-line option, use $shrpenv to
7243 # set env LD_RUN_PATH.  The main perl makefile uses this.
7244 shrpdir=$archlibexp/CORE
7245 xxx=''
7246 tmp_shrpenv=''
7247 if "$useshrplib"; then
7248     case "$osname" in 
7249         aix)
7250                 # We'll set it in Makefile.SH...
7251                 ;;
7252         solaris|netbsd)
7253                 xxx="-R $shrpdir"
7254                 ;;
7255         freebsd)
7256                 xxx="-Wl,-R$shrpdir"
7257                 ;;
7258         linux|irix*|dec_osf)
7259                 xxx="-Wl,-rpath,$shrpdir"
7260                 ;;
7261         next)
7262                 # next doesn't like the default...
7263                 ;;
7264         beos)
7265                 # beos doesn't like the default, either.
7266                 ;;
7267         hpux*)
7268                 # hpux doesn't like the default, either.
7269                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7270                 ;;
7271         *)
7272                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7273                 ;;
7274         esac
7275         case "$xxx" in
7276         '') ;;
7277         *)      
7278                 # Only add $xxx if it isn't already in ccdlflags.
7279                 case " $ccdlflags " in
7280                 *" $xxx "*)     ;;
7281                 *)      ccdlflags="$ccdlflags $xxx"
7282                         cat <<EOM >&4
7283
7284 Adding $xxx to the flags
7285 passed to $ld so that the perl executable will find the 
7286 installed shared $libperl.
7287
7288 EOM
7289                         ;;
7290                 esac
7291                 ;;
7292         esac
7293 fi
7294 # Fix ccdlflags in AIX for building external extensions.
7295 # (For building Perl itself bare -bE:perl.exp is needed,
7296 #  Makefile.SH takes care of this.)
7297 case "$osname" in
7298 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7299 esac
7300 # Respect a hint or command-line value.
7301 case "$shrpenv" in
7302 '') shrpenv="$tmp_shrpenv" ;;
7303 esac
7304 case "$ldlibpthname" in
7305 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7306 none)   ldlibpthname='' ;;
7307 esac
7308
7309 : determine where manual pages are on this system
7310 echo " "
7311 case "$sysman" in
7312 '') 
7313         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7314         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7315         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7316         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7317         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7318         sysman=`./loc . /usr/man/man1 $syspath`
7319         ;;
7320 esac
7321 if $test -d "$sysman"; then
7322         echo "System manual is in $sysman." >&4
7323 else
7324         echo "Could not find manual pages in source form." >&4
7325 fi
7326
7327 : determine where manual pages go
7328 set man1dir man1dir none
7329 eval $prefixit
7330 $cat <<EOM
7331
7332 $spackage has manual pages available in source form.
7333 EOM
7334 case "$nroff" in
7335 nroff)
7336         echo "However, you don't have nroff, so they're probably useless to you."
7337         case "$man1dir" in
7338         '') man1dir="none";;
7339         esac;;
7340 esac
7341 echo "If you don't want the manual sources installed, answer 'none'."
7342 case "$man1dir" in
7343 ' ') dflt=none
7344         ;;
7345 '')
7346         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7347         lookpath="$lookpath $prefixexp/man/p_man/man1"
7348         lookpath="$lookpath $prefixexp/man/u_man/man1"
7349         lookpath="$lookpath $prefixexp/man/man.1"
7350         case "$sysman" in
7351         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7352         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7353         esac
7354         set dflt
7355         eval $prefixup
7356         ;;
7357 *)  dflt="$man1dir"
7358         ;;
7359 esac
7360 echo " "
7361 fn=dn+~
7362 rp="Where do the main $spackage manual pages (source) go?"
7363 . ./getfile
7364 if $test "X$man1direxp" != "X$ansexp"; then
7365         installman1dir=''
7366 fi
7367 man1dir="$ans"
7368 man1direxp="$ansexp"
7369 case "$man1dir" in
7370 '')     man1dir=' '
7371         installman1dir='';;
7372 esac
7373
7374 : Change installation prefix, if necessary.
7375 if $test X"$prefix" != X"$installprefix"; then
7376         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7377 else
7378         installman1dir="$man1direxp"
7379 fi
7380
7381 : What suffix to use on installed man pages
7382
7383 case "$man1dir" in
7384 ' ')
7385         man1ext='0'
7386         ;;
7387 *)
7388         rp="What suffix should be used for the main $spackage man pages?"
7389         case "$man1ext" in
7390         '')     case "$man1dir" in
7391                 *1)  dflt=1 ;;
7392                 *1p) dflt=1p ;;
7393                 *1pm) dflt=1pm ;;
7394                 *l) dflt=l;;
7395                 *n) dflt=n;;
7396                 *o) dflt=o;;
7397                 *p) dflt=p;;
7398                 *C) dflt=C;;
7399                 *L) dflt=L;;
7400                 *L1) dflt=L1;;
7401                 *) dflt=1;;
7402                 esac
7403                 ;;
7404         *)      dflt="$man1ext";;
7405         esac
7406         . ./myread
7407         man1ext="$ans"
7408         ;;
7409 esac
7410
7411 : see if we can have long filenames
7412 echo " "
7413 first=123456789abcdef
7414 $rm -f $first
7415 if (echo hi >$first) 2>/dev/null; then
7416         if $test -f 123456789abcde; then
7417                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7418                 val="$undef"
7419         else
7420                 echo 'You can have filenames longer than 14 characters.'>&4
7421                 val="$define"
7422         fi
7423 else
7424         $cat <<'EOM'
7425 You can't have filenames longer than 14 chars.
7426 You can't even think about them!
7427 EOM
7428         val="$undef"
7429 fi 
7430 set d_flexfnam
7431 eval $setvar
7432 $rm -rf 123456789abcde*
7433
7434 : determine where library module manual pages go
7435 set man3dir man3dir none
7436 eval $prefixit
7437 $cat <<EOM
7438
7439 $spackage has manual pages for many of the library modules.
7440 EOM
7441
7442 case "$nroff" in
7443 nroff)
7444         $cat <<'EOM'
7445 However, you don't have nroff, so they're probably useless to you.
7446 EOM
7447         case "$man3dir" in
7448         '') man3dir="none";;
7449         esac;;
7450 esac
7451
7452 case "$d_flexfnam" in
7453 undef)
7454         $cat <<'EOM'
7455 However, your system can't handle the long file names like File::Basename.3. 
7456 EOM
7457         case "$man3dir" in
7458         '') man3dir="none";;
7459         esac;;
7460 esac
7461
7462 echo "If you don't want the manual sources installed, answer 'none'."
7463 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7464 case "$man3dir" in
7465 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7466         if $test -d "$privlib/man/man3"; then
7467                 cat <<EOM >&4
7468
7469 WARNING:  Previous versions of perl installed man3 pages into
7470 $privlib/man/man3.  This version will suggest a 
7471 new default of $dflt.  
7472 EOM
7473                 tdflt=$dflt
7474                 dflt='n'
7475                 rp='Do you wish to preserve the old behavior?(y/n)'
7476                 . ./myread
7477                 case "$ans" in
7478                 y*) dflt="$privlib/man/man3" ;;
7479                 *)  dflt=$tdflt ;;
7480                 esac
7481     fi
7482         ;;
7483 *)      dflt="$man3dir" ;;
7484 esac
7485 case "$dflt" in
7486 ' ') dflt=none ;;
7487 esac
7488 echo " "
7489 fn=dn+~
7490 rp="Where do the $package library man pages (source) go?"
7491 . ./getfile
7492 man3dir="$ans"
7493 man3direxp="$ansexp"
7494 case "$man3dir" in
7495 '')     man3dir=' '
7496         installman3dir='';;
7497 esac
7498
7499 : Change installation prefix, if necessary.
7500 if $test X"$prefix" != X"$installprefix"; then
7501         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7502 else
7503         installman3dir="$man3direxp"
7504 fi
7505
7506 : What suffix to use on installed man pages
7507 case "$man3dir" in
7508 ' ')
7509         man3ext='0'
7510         ;;
7511 *)
7512         rp="What suffix should be used for the $package library man pages?"
7513         case "$man3ext" in
7514         '')     case "$man3dir" in
7515                 *3)  dflt=3 ;;
7516                 *3p) dflt=3p ;;
7517                 *3pm) dflt=3pm ;;
7518                 *l) dflt=l;;
7519                 *n) dflt=n;;
7520                 *o) dflt=o;;
7521                 *p) dflt=p;;
7522                 *C) dflt=C;;
7523                 *L) dflt=L;;
7524                 *L3) dflt=L3;;
7525                 *) dflt=3;;
7526                 esac
7527                 ;;
7528         *)      dflt="$man3ext";;
7529         esac
7530         . ./myread
7531         man3ext="$ans"
7532         ;;
7533 esac
7534
7535 : see if we have to deal with yellow pages, now NIS.
7536 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7537         if $test -f /usr/etc/nibindd; then
7538                 echo " "
7539                 echo "I'm fairly confident you're on a NeXT."
7540                 echo " "
7541                 rp='Do you get the hosts file via NetInfo?'
7542                 dflt=y
7543                 case "$hostcat" in
7544                 nidump*) ;;
7545                 '') ;;
7546                 *) dflt=n;;
7547                 esac
7548                 . ./myread
7549                 case "$ans" in
7550                 y*) hostcat='nidump hosts .';;
7551                 *)      case "$hostcat" in
7552                         nidump*) hostcat='';;
7553                         esac
7554                         ;;
7555                 esac
7556         fi
7557         case "$hostcat" in
7558         nidump*) ;;
7559         *)
7560                 case "$hostcat" in
7561                 *ypcat*) dflt=y;;
7562                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7563                                 dflt=y
7564                         else
7565                                 dflt=n
7566                         fi;;
7567                 *) dflt=n;;
7568                 esac
7569                 echo " "
7570                 rp='Are you getting the hosts file via yellow pages?'
7571                 . ./myread
7572                 case "$ans" in
7573                 y*) hostcat='ypcat hosts';;
7574                 *) hostcat='cat /etc/hosts';;
7575                 esac
7576                 ;;
7577         esac
7578 fi
7579 case "$hostcat" in
7580 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7581 esac
7582 case "$groupcat" in
7583 '') test -f /etc/group && groupcat='cat /etc/group';;
7584 esac
7585 case "$passcat" in
7586 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7587 esac
7588
7589 : now get the host name
7590 echo " "
7591 echo "Figuring out host name..." >&4
7592 case "$myhostname" in
7593 '') cont=true
7594         echo 'Maybe "hostname" will work...'
7595         if tans=`sh -c hostname 2>&1` ; then
7596                 myhostname=$tans
7597                 phostname=hostname
7598                 cont=''
7599         fi
7600         ;;
7601 *) cont='';;
7602 esac
7603 if $test "$cont"; then
7604         if ./xenix; then
7605                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7606                 if tans=`cat /etc/systemid 2>&1` ; then
7607                         myhostname=$tans
7608                         phostname='cat /etc/systemid'
7609                         echo "Whadyaknow.  Xenix always was a bit strange..."
7610                         cont=''
7611                 fi
7612         elif $test -r /etc/systemid; then
7613                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7614         fi
7615 fi
7616 if $test "$cont"; then
7617         echo 'No, maybe "uuname -l" will work...'
7618         if tans=`sh -c 'uuname -l' 2>&1` ; then
7619                 myhostname=$tans
7620                 phostname='uuname -l'
7621         else
7622                 echo 'Strange.  Maybe "uname -n" will work...'
7623                 if tans=`sh -c 'uname -n' 2>&1` ; then
7624                         myhostname=$tans
7625                         phostname='uname -n'
7626                 else
7627                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7628                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7629                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7630                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7631                         else
7632                                 case "$myhostname" in
7633                                 '') echo "Does this machine have an identity crisis or something?"
7634                                         phostname='';;
7635                                 *)
7636                                         echo "Well, you said $myhostname before..."
7637                                         phostname='echo $myhostname';;
7638                                 esac
7639                         fi
7640                 fi
7641         fi
7642 fi
7643 : you do not want to know about this
7644 set $myhostname
7645 myhostname=$1
7646
7647 : verify guess
7648 if $test "$myhostname" ; then
7649         dflt=y
7650         rp='Your host name appears to be "'$myhostname'".'" Right?"
7651         . ./myread
7652         case "$ans" in
7653         y*) ;;
7654         *) myhostname='';;
7655         esac
7656 fi
7657
7658 : bad guess or no guess
7659 while $test "X$myhostname" = X ; do
7660         dflt=''
7661         rp="Please type the (one word) name of your host:"
7662         . ./myread
7663         myhostname="$ans"
7664 done
7665
7666 : translate upper to lower if necessary
7667 case "$myhostname" in
7668 *[A-Z]*)
7669         echo "(Normalizing case in your host name)"
7670         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7671         ;;
7672 esac
7673
7674 case "$myhostname" in
7675 *.*)
7676         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7677         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7678         echo "(Trimming domain name from host name--host name is now $myhostname)"
7679         ;;
7680 *) case "$mydomain" in
7681         '')
7682                 {
7683                         test "X$hostcat" = "Xypcat hosts" &&
7684                         ypmatch "$myhostname" hosts 2>/dev/null |\
7685                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7686                         $test -s hosts
7687                 } || {
7688                         test "X$hostcat" != "X" &&
7689                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7690                                         /[       ]$myhostname[  . ]/p" > hosts
7691                 }
7692                 tmp_re="[       . ]"
7693                 if $test -f hosts; then
7694                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7695                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7696                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7697                                 hosts | $sort | $uniq | \
7698                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7699                         case `$echo X$dflt` in
7700                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7701                                 dflt=.
7702                                 ;;
7703                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7704                                 ;;
7705                         esac
7706                 else
7707                         echo "(I cannot locate a hosts database anywhere)"
7708                         dflt=.
7709                 fi
7710                 case "$dflt" in
7711                 .)
7712                         tans=`./loc resolv.conf X /etc /usr/etc`
7713                         if $test -f "$tans"; then
7714                                 echo "(Attempting domain name extraction from $tans)"
7715                                 dflt=.`$sed -n -e 's/   / /g' \
7716                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7717                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7718                                 case "$dflt" in
7719                                 .) dflt=.`$sed -n -e 's/        / /g' \
7720                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7721                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7722                                         ;;
7723                                 esac
7724                         fi
7725                         ;;
7726                 esac
7727                 case "$dflt" in
7728                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7729                         dflt=.`sh -c domainname 2>/dev/null`
7730                         case "$dflt" in
7731                         '') dflt='.';;
7732                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7733                         esac
7734                         ;;
7735                 esac
7736                 case "$dflt$osname" in
7737                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7738                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7739                         ;;
7740                 esac
7741                 case "$dflt" in
7742                 .) echo "(Lost all hope -- silly guess then)"
7743                         dflt='.uucp'
7744                         ;;
7745                 esac
7746                 $rm -f hosts
7747                 ;;
7748         *) dflt="$mydomain";;
7749         esac;;
7750 esac
7751 echo " "
7752 rp="What is your domain name?"
7753 . ./myread
7754 tans="$ans"
7755 case "$ans" in
7756 '') ;;
7757 .*) ;;
7758 *) tans=".$tans";;
7759 esac
7760 mydomain="$tans"
7761
7762 : translate upper to lower if necessary
7763 case "$mydomain" in
7764 *[A-Z]*)
7765         echo "(Normalizing case in your domain name)"
7766         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7767         ;;
7768 esac
7769
7770 : a little sanity check here
7771 case "$phostname" in
7772 '') ;;
7773 *)
7774         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7775         $myhostname$mydomain|$myhostname) ;;
7776         *)
7777                 case "$phostname" in
7778                 sed*)
7779                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7780                         ;;
7781                 *)
7782                         echo "(That doesn't agree with your $phostname command, by the way.)"
7783                         ;;
7784                 esac
7785         ;;
7786         esac
7787         ;;
7788 esac
7789
7790 $cat <<EOM
7791
7792 I need to get your e-mail address in Internet format if possible, i.e.
7793 something like user@host.domain. Please answer accurately since I have
7794 no easy means to double check it. The default value provided below
7795 is most probably close to reality but may not be valid from outside
7796 your organization...
7797
7798 EOM
7799 cont=x
7800 while test "$cont"; do
7801         case "$cf_email" in
7802         '') dflt="$cf_by@$myhostname$mydomain";;
7803         *) dflt="$cf_email";;
7804         esac
7805         rp='What is your e-mail address?'
7806         . ./myread
7807         cf_email="$ans"
7808         case "$cf_email" in
7809         *@*.*) cont='' ;;
7810         *)
7811                 rp='Address does not look like an Internet one.  Use it anyway?'
7812                 case "$fastread" in
7813                 yes) dflt=y ;;
7814                 *) dflt=n ;;
7815                 esac
7816                 . ./myread
7817                 case "$ans" in
7818                 y*) cont='' ;;
7819                 *) echo " " ;;
7820                 esac
7821                 ;;
7822         esac
7823 done
7824
7825 $cat <<EOM
7826
7827 If you or somebody else will be maintaining perl at your site, please
7828 fill in the correct e-mail address here so that they may be contacted
7829 if necessary. Currently, the "perlbug" program included with perl
7830 will send mail to this address in addition to perlbug@perl.org. You may
7831 enter "none" for no administrator.
7832
7833 EOM
7834 case "$perladmin" in
7835 '') dflt="$cf_email";;
7836 *) dflt="$perladmin";;
7837 esac
7838 rp='Perl administrator e-mail address'
7839 . ./myread
7840 perladmin="$ans"
7841
7842 : determine whether to only install version-specific parts.
7843 echo " "
7844 $cat <<EOM
7845 Do you want to install only the version-specific parts of the perl
7846 distribution?  Usually you do *not* want to do this.
7847 EOM
7848 case "$versiononly" in
7849 "$define"|[Yy]*|true) dflt='y' ;;
7850 *) dflt='n';
7851 esac
7852 rp="Do you want to install only the version-specific parts of perl?"
7853 . ./myread
7854 case "$ans" in
7855 [yY]*)  val="$define";;
7856 *)      val="$undef" ;;
7857 esac
7858 set versiononly
7859 eval $setvar
7860
7861 : figure out how to guarantee perl startup
7862 case "$startperl" in
7863 '')
7864         case "$sharpbang" in
7865         *!)
7866                 $cat <<EOH
7867
7868 I can use the #! construct to start perl on your system. This will
7869 make startup of perl scripts faster, but may cause problems if you
7870 want to share those scripts and perl is not in a standard place
7871 ($binexp/perl) on all your platforms. The alternative is to force
7872 a shell by starting the script with a single ':' character.
7873
7874 EOH
7875                 case "$versiononly" in
7876                 "$define")      dflt="$binexp/perl$version";;  
7877                 *)              dflt="$binexp/perl";;
7878                 esac
7879                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7880                 . ./myread
7881                 case "$ans" in
7882                 none)   startperl=": # use perl";;
7883                 *)      startperl="#!$ans"
7884                         if $test 30 -lt `echo "$ans" | wc -c`; then
7885                                 $cat >&4 <<EOM
7886
7887 WARNING:  Some systems limit the #! command to 32 characters.
7888 If you experience difficulty running Perl scripts with #!, try
7889 installing Perl in a directory with a shorter pathname.
7890
7891 EOM
7892                         fi ;;
7893                 esac
7894                 ;;
7895         *) startperl=": # use perl"
7896                 ;;
7897         esac
7898         ;;
7899 esac
7900 echo "I'll use $startperl to start perl scripts."
7901
7902 : figure best path for perl in scripts
7903 case "$perlpath" in
7904 '')
7905         perlpath="$binexp/perl"
7906         case "$startperl" in
7907         *!*) ;;
7908         *)
7909                 $cat <<EOH
7910
7911 I will use the "eval 'exec'" idiom to start Perl on your system.
7912 I can use the full path of your Perl binary for this purpose, but
7913 doing so may cause problems if you want to share those scripts and
7914 Perl is not always in a standard place ($binexp/perl).
7915
7916 EOH
7917                 dflt="$binexp/perl"
7918                 rp="What path shall I use in \"eval 'exec'\"?"
7919                 . ./myread
7920                 perlpath="$ans"
7921                 ;;
7922         esac
7923         ;;
7924 esac
7925 case "$startperl" in
7926 *!*)    ;;
7927 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7928 esac
7929
7930 : determine where public executable scripts go
7931 set scriptdir scriptdir
7932 eval $prefixit
7933 case "$scriptdir" in
7934 '')
7935         dflt="$bin"
7936         : guess some guesses
7937         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7938         $test -d /usr/share/bin     && dflt=/usr/share/bin
7939         $test -d /usr/local/script  && dflt=/usr/local/script
7940         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7941         $test -d $prefixexp/script  && dflt=$prefixexp/script
7942         set dflt
7943         eval $prefixup
7944         ;;
7945 *)  dflt="$scriptdir"
7946         ;;
7947 esac
7948 $cat <<EOM
7949  
7950 Some installations have a separate directory just for executable scripts so
7951 that they can mount it across multiple architectures but keep the scripts in
7952 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7953 Or you might just lump your scripts in with all your other executables.
7954  
7955 EOM
7956 fn=d~
7957 rp='Where do you keep publicly executable scripts?'
7958 . ./getfile
7959 if $test "X$ansexp" != "X$scriptdirexp"; then
7960         installscript=''
7961 fi
7962 scriptdir="$ans"
7963 scriptdirexp="$ansexp"
7964 : Change installation prefix, if necessary.
7965 if $test X"$prefix" != X"$installprefix"; then
7966         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7967 else
7968         installscript="$scriptdirexp"
7969 fi
7970
7971 : determine where add-on public executables go
7972 case "$sitebin" in
7973 '')     dflt=$siteprefix/bin ;;
7974 *)      dflt=$sitebin ;;
7975 esac
7976 fn=d~
7977 rp='Pathname where the add-on public executables should be installed?'
7978 . ./getfile
7979 sitebin="$ans"
7980 sitebinexp="$ansexp"
7981 : Change installation prefix, if necessary.
7982 if $test X"$prefix" != X"$installprefix"; then
7983         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7984 else
7985         installsitebin="$sitebinexp"
7986 fi
7987
7988 case "$vendorprefix" in
7989 '')     d_vendorbin="$undef"
7990         vendorbin=''
7991         vendorbinexp=''
7992         ;;
7993 *)      d_vendorbin="$define"
7994         : determine where vendor-supplied executables go.
7995         case "$vendorbin" in
7996         '') dflt=$vendorprefix/bin ;;
7997         *)      dflt="$vendorbin" ;;
7998         esac
7999         fn=d~+
8000         rp='Pathname for the vendor-supplied executables directory?'
8001         . ./getfile
8002         vendorbin="$ans"
8003         vendorbinexp="$ansexp"
8004         ;;
8005 esac
8006 : Change installation prefix, if necessary.
8007 if $test X"$prefix" != X"$installprefix"; then
8008         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8009 else
8010         installvendorbin="$vendorbinexp"
8011 fi
8012
8013 : see if qgcvt exists
8014 set qgcvt d_qgcvt
8015 eval $inlibc
8016
8017 echo " "
8018
8019 if $test X"$d_longdbl" = X"$define"; then
8020
8021 echo "Checking how to print long doubles..." >&4
8022
8023 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8024         $cat >try.c <<'EOCP'
8025 #include <sys/types.h>
8026 #include <stdio.h>
8027 int main() {
8028   double d = 123.456;
8029   printf("%.3f\n", d);
8030 }
8031 EOCP
8032         set try
8033         if eval $compile; then
8034                 yyy=`./try$exe_ext`
8035                 case "$yyy" in
8036                 123.456)
8037                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8038                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8039                         echo "We will use %f."
8040                         ;;
8041                 esac
8042         fi
8043 fi
8044
8045 if $test X"$sPRIfldbl" = X; then
8046         $cat >try.c <<'EOCP'
8047 #include <sys/types.h>
8048 #include <stdio.h>
8049 int main() {
8050   long double d = 123.456;
8051   printf("%.3Lf\n", d);
8052 }
8053 EOCP
8054         set try
8055         if eval $compile; then
8056                 yyy=`./try$exe_ext`
8057                 case "$yyy" in
8058                 123.456)
8059                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8060                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8061                         echo "We will use %Lf."
8062                         ;;
8063                 esac
8064         fi
8065 fi
8066
8067 if $test X"$sPRIfldbl" = X; then
8068         $cat >try.c <<'EOCP'
8069 #include <sys/types.h>
8070 #include <stdio.h>
8071 int main() {
8072   long double d = 123.456;
8073   printf("%.3llf\n", d);
8074 }
8075 EOCP
8076         set try
8077         if eval $compile; then
8078                 yyy=`./try$exe_ext`
8079                 case "$yyy" in
8080                 123.456)
8081                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8082                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8083                         echo "We will use %llf."
8084                         ;;
8085                 esac
8086         fi
8087 fi
8088
8089 if $test X"$sPRIfldbl" = X; then
8090         $cat >try.c <<'EOCP'
8091 #include <sys/types.h>
8092 #include <stdio.h>
8093 int main() {
8094   long double d = 123.456;
8095   printf("%.3lf\n", d);
8096 }
8097 EOCP
8098         set try
8099         if eval $compile; then
8100                 yyy=`./try$exe_ext`
8101                 case "$yyy" in
8102                 123.456)
8103                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8104                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8105                         echo "We will use %lf."
8106                         ;;
8107                 esac
8108         fi
8109 fi
8110
8111 if $test X"$sPRIfldbl" = X; then
8112         echo "Cannot figure out how to print long doubles." >&4
8113 else
8114         sSCNfldbl=$sPRIfldbl    # expect consistency
8115 fi
8116
8117 $rm -f try try.*
8118
8119 fi # d_longdbl
8120
8121 case "$sPRIfldbl" in
8122 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8123         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8124         d_SCNfldbl="$undef";
8125         ;;
8126 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8127         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8128         d_SCNfldbl="$define";
8129         ;;
8130 esac
8131
8132 : Check how to convert floats to strings.
8133 echo " "
8134 echo "Checking for an efficient way to convert floats to strings."
8135 echo " " > try.c
8136 case "$uselongdouble" in
8137 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8138 esac
8139 case "$d_longdbl" in
8140 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8141 esac
8142 case "$d_PRIgldbl" in
8143 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8144 esac
8145 $cat >>try.c <<EOP
8146 #ifdef TRY_gconvert
8147 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8148 char *myname = "gconvert";
8149 #endif
8150 #ifdef TRY_gcvt
8151 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8152 char *myname = "gcvt";
8153 #endif
8154 #ifdef TRY_qgcvt
8155 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8156 char *myname = "qgcvt";
8157 #define DOUBLETYPE long double
8158 #endif
8159 #ifdef TRY_sprintf
8160 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8161 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8162 #else
8163 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8164 #endif
8165 char *myname = "sprintf";
8166 #endif
8167
8168 #ifndef DOUBLETYPE
8169 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8170 #define DOUBLETYPE long double
8171 #else
8172 #define DOUBLETYPE double
8173 #endif
8174 #endif
8175
8176 #include <stdio.h>
8177
8178 #define I_STDLIB $i_stdlib
8179 #ifdef I_STDLIB
8180 #include <stdlib.h>
8181 #endif
8182
8183 int
8184 checkit(expect, got)
8185 char *expect;
8186 char *got;
8187 {
8188     if (strcmp(expect, got)) {
8189                 printf("%s oddity:  Expected %s, got %s\n",
8190                         myname, expect, got);
8191                 exit(1);
8192         }
8193 }
8194
8195 int main()
8196
8197         char buf[64]; 
8198         buf[63] = '\0';
8199
8200         /* This must be 1st test on (which?) platform */
8201         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8202         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8203         checkit("0.1", buf);
8204
8205         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8206         checkit("1", buf);
8207
8208         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8209         checkit("1.1", buf);
8210
8211         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8212         checkit("1.01", buf);
8213
8214         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8215         checkit("1.001", buf);
8216
8217         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8218         checkit("1.0001", buf);
8219
8220         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8221         checkit("1.00001", buf);
8222
8223         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8224         checkit("1.000001", buf);
8225
8226         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8227         checkit("0", buf);
8228
8229         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8230         checkit("-1", buf);
8231
8232         /* Some Linux gcvt's give 1.e+5 here. */
8233         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8234         checkit("100000", buf);
8235         
8236         /* Some Linux gcvt's give -1.e+5 here. */
8237         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8238         checkit("-100000", buf);
8239
8240         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8241         checkit("123.456", buf);
8242
8243         exit(0);
8244 }
8245 EOP
8246 case "$d_Gconvert" in
8247 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8248 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8249 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8250 *) xxx_list='gconvert gcvt sprintf' ;;
8251 esac
8252
8253 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8254 "$define$define$define")
8255     # for long doubles prefer first qgcvt, then sprintf
8256     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8257     xxx_list="sprintf $xxx_list"
8258     case "$d_qgcvt" in
8259     "$define") xxx_list="qgcvt $xxx_list" ;;
8260     esac
8261     ;;
8262 esac
8263
8264 for xxx_convert in $xxx_list; do
8265         echo "Trying $xxx_convert..."
8266         $rm -f try try$_o
8267         set try -DTRY_$xxx_convert
8268         if eval $compile; then
8269                 echo "$xxx_convert() found." >&4
8270                 if ./try; then
8271                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8272                         break;
8273                 else
8274                         echo "...But $xxx_convert didn't work as I expected."
8275                 fi
8276         else
8277                 echo "$xxx_convert NOT found." >&4
8278         fi
8279 done
8280         
8281 case "$xxx_convert" in
8282 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8283 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8284 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8285 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8286    "$define$define$define")
8287       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8288    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8289    esac
8290    ;;  
8291 esac
8292
8293 : see if _fwalk exists
8294 set fwalk d__fwalk
8295 eval $inlibc
8296
8297 : Initialize h_fcntl
8298 h_fcntl=false
8299
8300 : Initialize h_sysfile
8301 h_sysfile=false
8302
8303 : access call always available on UNIX
8304 set access d_access
8305 eval $inlibc
8306
8307 : locate the flags for 'access()'
8308 case "$d_access" in
8309 "$define")
8310         echo " "
8311         $cat >access.c <<'EOCP'
8312 #include <sys/types.h>
8313 #ifdef I_FCNTL
8314 #include <fcntl.h>
8315 #endif
8316 #ifdef I_SYS_FILE
8317 #include <sys/file.h>
8318 #endif
8319 #ifdef I_UNISTD
8320 #include <unistd.h>
8321 #endif
8322 int main() {
8323         exit(R_OK);
8324 }
8325 EOCP
8326         : check sys/file.h first, no particular reason here
8327         if $test `./findhdr sys/file.h` && \
8328                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8329                 h_sysfile=true;
8330                 echo "<sys/file.h> defines the *_OK access constants." >&4
8331         elif $test `./findhdr fcntl.h` && \
8332                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8333                 h_fcntl=true;
8334                 echo "<fcntl.h> defines the *_OK access constants." >&4
8335         elif $test `./findhdr unistd.h` && \
8336                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8337                 echo "<unistd.h> defines the *_OK access constants." >&4
8338         else
8339                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8340         fi
8341         ;;
8342 esac
8343 $rm -f access*
8344
8345 : see if accessx exists
8346 set accessx d_accessx
8347 eval $inlibc
8348
8349 : see if alarm exists
8350 set alarm d_alarm
8351 eval $inlibc
8352
8353 : see if atolf exists
8354 set atolf d_atolf
8355 eval $inlibc
8356
8357 : see if atoll exists
8358 set atoll d_atoll
8359 eval $inlibc
8360
8361 : Look for GNU-cc style attribute checking
8362 echo " "
8363 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8364 $cat >attrib.c <<'EOCP'
8365 #include <stdio.h>
8366 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8367 EOCP
8368 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8369         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8370                 echo "Your C compiler doesn't fully support __attribute__."
8371                 val="$undef"
8372         else
8373                 echo "Your C compiler supports __attribute__."
8374                 val="$define"
8375         fi
8376 else
8377         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8378         val="$undef"
8379 fi
8380 set d_attribut
8381 eval $setvar
8382 $rm -f attrib*
8383
8384 : see if bcmp exists
8385 set bcmp d_bcmp
8386 eval $inlibc
8387
8388 : see if bcopy exists
8389 set bcopy d_bcopy
8390 eval $inlibc
8391
8392 : see if this is a unistd.h system
8393 set unistd.h i_unistd
8394 eval $inhdr
8395
8396 : see if getpgrp exists
8397 set getpgrp d_getpgrp
8398 eval $inlibc
8399
8400 case "$d_getpgrp" in
8401 "$define")
8402         echo " "
8403         echo "Checking to see which flavor of getpgrp is in use..."
8404         $cat >set.c <<EOP
8405 #$i_unistd I_UNISTD
8406 #include <sys/types.h>
8407 #ifdef I_UNISTD
8408 #  include <unistd.h>
8409 #endif
8410 int main()
8411 {
8412         if (getuid() == 0) {
8413                 printf("(I see you are running Configure as super-user...)\n");
8414                 setuid(1);
8415         }
8416 #ifdef TRY_BSD_PGRP
8417         if (getpgrp(1) == 0)
8418                 exit(0);
8419 #else
8420         if (getpgrp() > 0)
8421                 exit(0);
8422 #endif
8423         exit(1);
8424 }
8425 EOP
8426         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8427                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8428                 val="$define"
8429         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8430                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8431                 val="$undef"
8432         else
8433                 echo "I can't seem to compile and run the test program."
8434                 if ./usg; then
8435                         xxx="a USG one, i.e. you use getpgrp()."
8436                 else
8437                         # SVR4 systems can appear rather BSD-ish.
8438                         case "$i_unistd" in
8439                         $undef)
8440                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8441                                 val="$define"
8442                                 ;;
8443                         $define)
8444                                 xxx="probably a USG one, i.e. you use getpgrp()."
8445                                 val="$undef"
8446                                 ;;
8447                         esac
8448                 fi
8449                 echo "Assuming your getpgrp is $xxx" >&4
8450         fi
8451         ;;
8452 *) val="$undef";;
8453 esac
8454 set d_bsdgetpgrp
8455 eval $setvar
8456 $rm -f set set.c
8457
8458 : see if setpgrp exists
8459 set setpgrp d_setpgrp
8460 eval $inlibc
8461
8462 case "$d_setpgrp" in
8463 "$define")
8464         echo " "
8465         echo "Checking to see which flavor of setpgrp is in use..."
8466         $cat >set.c <<EOP
8467 #$i_unistd I_UNISTD
8468 #include <sys/types.h>
8469 #ifdef I_UNISTD
8470 #  include <unistd.h>
8471 #endif
8472 int main()
8473 {
8474         if (getuid() == 0) {
8475                 printf("(I see you are running Configure as super-user...)\n");
8476                 setuid(1);
8477         }
8478 #ifdef TRY_BSD_PGRP
8479         if (-1 == setpgrp(1, 1))
8480                 exit(0);
8481 #else
8482         if (setpgrp() != -1)
8483                 exit(0);
8484 #endif
8485         exit(1);
8486 }
8487 EOP
8488         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8489                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8490                 val="$define"
8491         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8492                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8493                 val="$undef"
8494         else
8495                 echo "(I can't seem to compile and run the test program.)"
8496                 if ./usg; then
8497                         xxx="a USG one, i.e. you use setpgrp()."
8498                 else
8499                         # SVR4 systems can appear rather BSD-ish.
8500                         case "$i_unistd" in
8501                         $undef)
8502                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8503                                 val="$define"
8504                                 ;;
8505                         $define)
8506                                 xxx="probably a USG one, i.e. you use setpgrp()."
8507                                 val="$undef"
8508                                 ;;
8509                         esac
8510                 fi
8511                 echo "Assuming your setpgrp is $xxx" >&4
8512         fi
8513         ;;
8514 *) val="$undef";;
8515 esac
8516 set d_bsdsetpgrp
8517 eval $setvar
8518 $rm -f set set.c
8519 : see if bzero exists
8520 set bzero d_bzero
8521 eval $inlibc
8522
8523 : see if signal is declared as pointer to function returning int or void
8524 echo " "
8525 xxx=`./findhdr signal.h`
8526 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8527 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8528         echo "You have int (*signal())() instead of void." >&4
8529         val="$undef"
8530 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8531         echo "You have void (*signal())()." >&4
8532         val="$define"
8533 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8534         echo "You have int (*signal())() instead of void." >&4
8535         val="$undef"
8536 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8537         echo "You have void (*signal())()." >&4
8538         val="$define"
8539 else
8540         case "$d_voidsig" in
8541         '')
8542         echo "I can't determine whether signal handler returns void or int..." >&4
8543                 dflt=void
8544                 rp="What type does your signal handler return?"
8545                 . ./myread
8546                 case "$ans" in
8547                 v*) val="$define";;
8548                 *) val="$undef";;
8549                 esac;;
8550         "$define")
8551                 echo "As you already told me, signal handler returns void." >&4
8552                 val="$define"
8553                 ;;
8554         *)      echo "As you already told me, signal handler returns int." >&4
8555                 val="$undef"
8556                 ;;
8557         esac
8558 fi
8559 set d_voidsig
8560 eval $setvar
8561 case "$d_voidsig" in
8562 "$define") signal_t="void";;
8563 *) signal_t="int";;
8564 esac
8565 $rm -f $$.tmp
8566
8567 : check for ability to cast large floats to 32-bit ints.
8568 echo " "
8569 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8570 if $test "$intsize" -ge 4; then
8571         xxx=int
8572 else
8573         xxx=long
8574 fi
8575 $cat >try.c <<EOCP
8576 #include <stdio.h>
8577 #include <sys/types.h>
8578 #include <signal.h>
8579 $signal_t blech(s) int s; { exit(3); }
8580 int main()
8581 {
8582         $xxx i32;
8583         double f, g;
8584         int result = 0;
8585         char str[16];
8586         signal(SIGFPE, blech);
8587
8588         /* Don't let compiler optimize the test away.  Store the number 
8589            in a writable string for gcc to pass to sscanf under HP/UX.
8590         */
8591         sprintf(str, "2147483647");
8592         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8593         g = 10 * f;
8594         i32  = ($xxx) g;
8595
8596         /* x86 processors will probably give 0x8000 0000, which is a
8597        sign change.  We don't want that.  We want to mimic SPARC
8598            behavior here, which is to preserve the sign and give
8599            back 0x7fff ffff.
8600         */
8601         if (i32 != ($xxx) f)
8602                 result |= 1;
8603         exit(result);
8604 }
8605 EOCP
8606 set try
8607 if eval $compile_ok; then
8608         ./try
8609         yyy=$?
8610 else
8611         echo "(I can't seem to compile the test program--assuming it can't)"
8612         yyy=1
8613 fi
8614 case "$yyy" in
8615 0)      val="$define"
8616         echo "Yup, it can."
8617         ;;
8618 *)      val="$undef"
8619         echo "Nope, it can't."
8620         ;;
8621 esac
8622 set d_casti32
8623 eval $setvar
8624 $rm -f try try.*
8625
8626 : check for ability to cast negative floats to unsigned
8627 echo " "
8628 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8629 $cat >try.c <<EOCP
8630 #include <stdio.h>
8631 #include <sys/types.h>
8632 #include <signal.h>
8633 $signal_t blech(s) int s; { exit(7); }
8634 $signal_t blech_in_list(s) int s; { exit(4); }
8635 unsigned long dummy_long(p) unsigned long p; { return p; }
8636 unsigned int dummy_int(p) unsigned int p; { return p; }
8637 unsigned short dummy_short(p) unsigned short p; { return p; }
8638 int main()
8639 {
8640         double f;
8641         unsigned long along;
8642         unsigned int aint;
8643         unsigned short ashort;
8644         int result = 0;
8645         char str[16];
8646         
8647         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8648            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8649            optimized the whole file away
8650         */
8651         /* Store the number in a writable string for gcc to pass to 
8652            sscanf under HP/UX.
8653         */
8654         sprintf(str, "-123");
8655         sscanf(str, "%lf", &f);  /* f = -123.; */
8656
8657         signal(SIGFPE, blech);
8658         along = (unsigned long)f;
8659         aint = (unsigned int)f;
8660         ashort = (unsigned short)f;
8661         if (along != (unsigned long)-123)
8662                 result |= 1;
8663         if (aint != (unsigned int)-123)
8664                 result |= 1;
8665         if (ashort != (unsigned short)-123)
8666                 result |= 1;
8667         sprintf(str, "1073741824.");
8668         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8669         f = f + f;
8670         along = 0;
8671         along = (unsigned long)f;
8672         if (along != 0x80000000)
8673                 result |= 2;
8674         f -= 1.;
8675         along = 0;
8676         along = (unsigned long)f;
8677         if (along != 0x7fffffff)
8678                 result |= 1;
8679         f += 2.;
8680         along = 0;
8681         along = (unsigned long)f;
8682         if (along != 0x80000001)
8683                 result |= 2;
8684         if (result)
8685                 exit(result);
8686         signal(SIGFPE, blech_in_list);
8687         sprintf(str, "123.");
8688         sscanf(str, "%lf", &f);  /* f = 123.; */
8689         along = dummy_long((unsigned long)f);
8690         aint = dummy_int((unsigned int)f);
8691         ashort = dummy_short((unsigned short)f);
8692         if (along != (unsigned long)123)
8693                 result |= 4;
8694         if (aint != (unsigned int)123)
8695                 result |= 4;
8696         if (ashort != (unsigned short)123)
8697                 result |= 4;
8698         exit(result);
8699
8700 }
8701 EOCP
8702 set try
8703 if eval $compile_ok; then
8704         ./try
8705         castflags=$?
8706 else
8707         echo "(I can't seem to compile the test program--assuming it can't)"
8708         castflags=7
8709 fi
8710 case "$castflags" in
8711 0)      val="$define"
8712         echo "Yup, it can."
8713         ;;
8714 *)      val="$undef"
8715         echo "Nope, it can't."
8716         ;;
8717 esac
8718 set d_castneg
8719 eval $setvar
8720 $rm -f try.*
8721
8722 : see if vprintf exists
8723 echo " "
8724 if set vprintf val -f d_vprintf; eval $csym; $val; then
8725         echo 'vprintf() found.' >&4
8726         val="$define"
8727         $cat >vprintf.c <<'EOF'
8728 #include <varargs.h>
8729
8730 int main() { xxx("foo"); }
8731
8732 xxx(va_alist)
8733 va_dcl
8734 {
8735         va_list args;
8736         char buf[10];
8737
8738         va_start(args);
8739         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8740 }
8741 EOF
8742         set vprintf
8743         if eval $compile && ./vprintf; then
8744                 echo "Your vsprintf() returns (int)." >&4
8745                 val2="$undef"
8746         else
8747                 echo "Your vsprintf() returns (char*)." >&4
8748                 val2="$define"
8749         fi
8750 else
8751         echo 'vprintf() NOT found.' >&4
8752                 val="$undef"
8753                 val2="$undef"
8754 fi
8755 set d_vprintf
8756 eval $setvar
8757 val=$val2
8758 set d_charvspr
8759 eval $setvar
8760
8761 : see if chown exists
8762 set chown d_chown
8763 eval $inlibc
8764
8765 : see if chroot exists
8766 set chroot d_chroot
8767 eval $inlibc
8768
8769 : see if chsize exists
8770 set chsize d_chsize
8771 eval $inlibc
8772
8773 hasstruct='varname=$1; struct=$2; shift; shift;
8774 while $test $# -ge 2; do
8775         case "$1" in
8776         $define) echo "#include <$2>";;
8777         esac ;
8778     shift 2;
8779 done > try.c;
8780 echo "int main () { struct $struct foo; }" >> try.c;
8781 set try;
8782 if eval $compile; then
8783         val="$define";
8784 else
8785         val="$undef";
8786 fi;
8787 set $varname;
8788 eval $setvar;
8789 $rm -f try.c try.o'
8790
8791 : see if sys/types.h has to be included
8792 set sys/types.h i_systypes
8793 eval $inhdr
8794
8795 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8796 while $test $# -ge 2; do
8797         case "$1" in
8798         $define) echo "#include <$2>";;
8799         esac ;
8800     shift 2;
8801 done > try.c;
8802 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8803 set try;
8804 if eval $compile; then
8805         val="$define";
8806 else
8807         val="$undef";
8808 fi;
8809 set $varname;
8810 eval $setvar;
8811 $rm -f try.c try.o'
8812
8813 socketlib=''
8814 sockethdr=''
8815 : see whether socket exists
8816 echo " "
8817 $echo $n "Hmm... $c" >&4
8818 if set socket val -f d_socket; eval $csym; $val; then
8819         echo "Looks like you have Berkeley networking support." >&4
8820         d_socket="$define"
8821         if set setsockopt val -f; eval $csym; $val; then
8822                 d_oldsock="$undef"
8823         else
8824                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8825                 d_oldsock="$define"
8826         fi
8827 else
8828         if $contains socklib libc.list >/dev/null 2>&1; then
8829                 echo "Looks like you have Berkeley networking support." >&4
8830                 d_socket="$define"
8831                 : we will have to assume that it supports the 4.2 BSD interface
8832                 d_oldsock="$undef"
8833         else
8834                 echo "You don't have Berkeley networking in libc$_a..." >&4
8835                 if test "X$d_socket" = "X$define"; then
8836                    echo "...but you seem to believe that you have sockets." >&4
8837                 else
8838                         for net in net socket
8839                         do
8840                                 if test -f /usr/lib/lib$net$_a; then
8841                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8842                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8843                                         if $contains socket libc.list >/dev/null 2>&1; then
8844                                                 d_socket="$define"
8845                                                 socketlib="-l$net"
8846                                                 case "$net" in
8847                                                 net)
8848                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8849                                                         sockethdr="-I/usr/netinclude"
8850                                                         ;;
8851                                                 esac
8852                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8853                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8854                                                         d_oldsock="$undef"
8855                                                 else
8856                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8857                                                         d_oldsock="$define"
8858                                                 fi
8859                                                 break
8860                                         fi
8861                                 fi
8862                         done
8863                         if test "X$d_socket" != "X$define"; then
8864                            echo "or anywhere else I see." >&4
8865                            d_socket="$undef"
8866                            d_oldsock="$undef"
8867                         fi
8868                 fi
8869         fi
8870 fi
8871
8872 : see if socketpair exists
8873 set socketpair d_sockpair
8874 eval $inlibc
8875
8876
8877 echo " "
8878 echo "Checking the availability of certain socket constants..." >& 4
8879 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8880         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8881         $cat >try.c <<EOF
8882 #include <sys/types.h>
8883 #include <sys/socket.h>
8884 int main() {
8885     int i = $ENUM;
8886 }
8887 EOF
8888         val="$undef"
8889         set try; if eval $compile; then
8890                 val="$define"
8891         fi
8892         set d_${enum}; eval $setvar
8893         $rm -f try.c try
8894 done
8895
8896 : see if this is a sys/uio.h system
8897 set sys/uio.h i_sysuio
8898 eval $inhdr
8899
8900
8901 echo " "
8902 echo "Checking to see if your system supports struct cmsghdr..." >&4
8903 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8904 eval $hasstruct
8905 case "$d_cmsghdr_s" in
8906 "$define")      echo "Yes, it does."   ;;
8907 *)              echo "No, it doesn't." ;;
8908 esac
8909
8910
8911 : check for const keyword
8912 echo " "
8913 echo 'Checking to see if your C compiler knows about "const"...' >&4
8914 $cat >const.c <<'EOCP'
8915 typedef struct spug { int drokk; } spug;
8916 int main()
8917 {
8918         const char *foo;
8919         const spug y;
8920 }
8921 EOCP
8922 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8923         val="$define"
8924         echo "Yup, it does."
8925 else
8926         val="$undef"
8927         echo "Nope, it doesn't."
8928 fi
8929 set d_const
8930 eval $setvar
8931
8932 : see if crypt exists
8933 echo " "
8934 if set crypt val -f d_crypt; eval $csym; $val; then
8935         echo 'crypt() found.' >&4
8936         val="$define"
8937         cryptlib=''
8938 else
8939         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8940         if $test -z "$cryptlib"; then
8941                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8942         else
8943                 cryptlib=-lcrypt
8944         fi
8945         if $test -z "$cryptlib"; then
8946                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8947         else
8948                 cryptlib=-lcrypt
8949         fi
8950         if $test -z "$cryptlib"; then
8951                 cryptlib=`./loc libcrypt$_a "" $libpth`
8952         else
8953                 cryptlib=-lcrypt
8954         fi
8955         if $test -z "$cryptlib"; then
8956                 echo 'crypt() NOT found.' >&4
8957                 val="$undef"
8958         else
8959                 val="$define"
8960         fi
8961 fi
8962 set d_crypt
8963 eval $setvar
8964
8965 : get csh whereabouts
8966 case "$csh" in
8967 'csh') val="$undef" ;;
8968 *) val="$define" ;;
8969 esac
8970 set d_csh
8971 eval $setvar
8972 : Respect a hint or command line value for full_csh.
8973 case "$full_csh" in
8974 '') full_csh=$csh ;;
8975 esac
8976
8977 : see if cuserid exists
8978 set cuserid d_cuserid
8979 eval $inlibc
8980
8981 : see if this is a limits.h system
8982 set limits.h i_limits
8983 eval $inhdr
8984
8985 : see if this is a float.h system
8986 set float.h i_float
8987 eval $inhdr
8988
8989 : See if number of significant digits in a double precision number is known
8990 echo " "
8991 $cat >dbl_dig.c <<EOM
8992 #$i_limits I_LIMITS
8993 #$i_float I_FLOAT
8994 #ifdef I_LIMITS
8995 #include <limits.h>
8996 #endif
8997 #ifdef I_FLOAT
8998 #include <float.h>
8999 #endif
9000 #ifdef DBL_DIG
9001 printf("Contains DBL_DIG");
9002 #endif
9003 EOM
9004 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9005 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9006         echo "DBL_DIG found." >&4
9007         val="$define"
9008 else
9009         echo "DBL_DIG NOT found." >&4
9010         val="$undef"
9011 fi
9012 $rm -f dbl_dig.?
9013 set d_dbl_dig
9014 eval $setvar
9015
9016 hasproto='varname=$1; func=$2; shift; shift;
9017 while $test $# -ge 2; do
9018         case "$1" in
9019         $define) echo "#include <$2>";;
9020         esac ;
9021     shift 2;
9022 done > try.c;
9023 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9024 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9025         echo "$func() prototype found.";
9026         val="$define";
9027 else
9028         echo "$func() prototype NOT found.";
9029         val="$undef";
9030 fi;
9031 set $varname;
9032 eval $setvar;
9033 $rm -f try.c tryout.c'
9034
9035 : see if dbm.h is available
9036 : see if dbmclose exists
9037 set dbmclose d_dbmclose
9038 eval $inlibc
9039
9040 case "$d_dbmclose" in
9041 $define)
9042         set dbm.h i_dbm
9043         eval $inhdr
9044         case "$i_dbm" in
9045         $define)
9046                 val="$undef"
9047                 set i_rpcsvcdbm
9048                 eval $setvar
9049                 ;;
9050         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9051                 eval $inhdr
9052                 ;;
9053         esac
9054         ;;
9055 *)      echo "We won't be including <dbm.h>"
9056         val="$undef"
9057         set i_dbm
9058         eval $setvar
9059         val="$undef"
9060         set i_rpcsvcdbm
9061         eval $setvar
9062         ;;
9063 esac
9064
9065 : see if prototype for dbminit is available
9066 echo " "
9067 set d_dbminitproto dbminit $i_dbm dbm.h
9068 eval $hasproto
9069
9070 : see if difftime exists
9071 set difftime d_difftime
9072 eval $inlibc
9073
9074 : see if this is a dirent system
9075 echo " "
9076 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9077         val="$define"
9078         echo "<dirent.h> found." >&4
9079 else
9080         val="$undef"
9081         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9082                 echo "<sys/dir.h> found." >&4
9083                 echo " "
9084         else
9085                 xinc=`./findhdr sys/ndir.h`
9086         fi
9087         echo "<dirent.h> NOT found." >&4
9088 fi
9089 set i_dirent
9090 eval $setvar
9091
9092 : Look for type of directory structure.
9093 echo " "
9094 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9095
9096 case "$direntrytype" in
9097 ''|' ')
9098         case "$i_dirent" in
9099         $define) guess1='struct dirent' ;;
9100         *) guess1='struct direct'  ;;
9101         esac
9102         ;;
9103 *)      guess1="$direntrytype"
9104         ;;
9105 esac
9106
9107 case "$guess1" in
9108 'struct dirent') guess2='struct direct' ;;
9109 *) guess2='struct dirent' ;;
9110 esac
9111                 
9112 if $contains "$guess1" try.c >/dev/null 2>&1; then
9113         direntrytype="$guess1"
9114         echo "Your directory entries are $direntrytype." >&4
9115 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9116         direntrytype="$guess2"
9117         echo "Your directory entries seem to be $direntrytype." >&4
9118 else
9119         echo "I don't recognize your system's directory entries." >&4
9120         rp="What type is used for directory entries on this system?"
9121         dflt="$guess1"
9122         . ./myread
9123         direntrytype="$ans"
9124 fi
9125 $rm -f try.c
9126
9127
9128 : see if the directory entry stores field length
9129 echo " "
9130 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9131 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9132         echo "Good, your directory entry keeps length information in d_namlen." >&4
9133         val="$define"
9134 else
9135         echo "Your directory entry does not know about the d_namlen field." >&4
9136         val="$undef"
9137 fi
9138 set d_dirnamlen
9139 eval $setvar
9140 $rm -f try.c
9141
9142 : see if dlerror exists
9143 xxx_runnm="$runnm"
9144 runnm=false
9145 set dlerror d_dlerror
9146 eval $inlibc
9147 runnm="$xxx_runnm"
9148
9149 : see if dlfcn is available
9150 set dlfcn.h i_dlfcn
9151 eval $inhdr
9152
9153 case "$usedl" in
9154 $define|y|true)
9155         $cat << EOM
9156
9157 On a few systems, the dynamically loaded modules that perl generates and uses
9158 will need a different extension than shared libs. The default will probably
9159 be appropriate.
9160
9161 EOM
9162         case "$dlext" in
9163         '')     dflt="$so" ;;
9164         *)      dflt="$dlext" ;;
9165         esac
9166         rp='What is the extension of dynamically loaded modules'
9167         . ./myread
9168         dlext="$ans"
9169         ;;
9170 *)
9171         dlext="none"
9172         ;;
9173 esac
9174
9175 : Check if dlsym need a leading underscore
9176 echo " "
9177 val="$undef"
9178
9179 case "$dlsrc" in
9180 dl_dlopen.xs)
9181         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9182         $cat >dyna.c <<'EOM'
9183 fred () { }
9184 EOM
9185
9186 $cat >fred.c<<EOM
9187
9188 #include <stdio.h>
9189 #$i_dlfcn I_DLFCN
9190 #ifdef I_DLFCN
9191 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9192 #else
9193 #include <sys/types.h>
9194 #include <nlist.h>
9195 #include <link.h>
9196 #endif
9197
9198 extern int fred() ;
9199
9200 int main()
9201 {
9202     void * handle ;
9203     void * symbol ;
9204 #ifndef RTLD_LAZY
9205     int mode = 1 ;
9206 #else
9207     int mode = RTLD_LAZY ;
9208 #endif
9209     handle = dlopen("./dyna.$dlext", mode) ;
9210     if (handle == NULL) {
9211         printf ("1\n") ;
9212         fflush (stdout) ;
9213         exit(0);
9214     }
9215     symbol = dlsym(handle, "fred") ;
9216     if (symbol == NULL) {
9217         /* try putting a leading underscore */
9218         symbol = dlsym(handle, "_fred") ;
9219         if (symbol == NULL) {
9220             printf ("2\n") ;
9221             fflush (stdout) ;
9222             exit(0);
9223         }
9224         printf ("3\n") ;
9225     }
9226     else
9227         printf ("4\n") ;
9228     fflush (stdout) ;
9229     exit(0);
9230 }
9231 EOM
9232         : Call the object file tmp-dyna.o in case dlext=o.
9233         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9234                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9235                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9236                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9237                 xxx=`./fred`
9238                 case $xxx in
9239                 1)      echo "Test program failed using dlopen." >&4
9240                         echo "Perhaps you should not use dynamic loading." >&4;;
9241                 2)      echo "Test program failed using dlsym." >&4
9242                         echo "Perhaps you should not use dynamic loading." >&4;;
9243                 3)      echo "dlsym needs a leading underscore" >&4
9244                         val="$define" ;;
9245                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9246                 esac
9247         else
9248                 echo "I can't compile and run the test program." >&4
9249                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9250         fi
9251         ;;
9252 esac
9253                 
9254 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9255
9256 set d_dlsymun
9257 eval $setvar
9258
9259 : see if prototype for drand48 is available
9260 echo " "
9261 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9262 eval $hasproto
9263
9264 : see if dup2 exists
9265 set dup2 d_dup2
9266 eval $inlibc
9267
9268 : see if eaccess exists
9269 set eaccess d_eaccess
9270 eval $inlibc
9271
9272 : see if endgrent exists
9273 set endgrent d_endgrent
9274 eval $inlibc
9275
9276 : see if endhostent exists
9277 set endhostent d_endhent
9278 eval $inlibc
9279
9280 : see if endnetent exists
9281 set endnetent d_endnent
9282 eval $inlibc
9283
9284 : see if endprotoent exists
9285 set endprotoent d_endpent
9286 eval $inlibc
9287
9288 : see if endpwent exists
9289 set endpwent d_endpwent
9290 eval $inlibc
9291
9292 : see if endservent exists
9293 set endservent d_endsent
9294 eval $inlibc
9295
9296 : Locate the flags for 'open()'
9297 echo " "
9298 $cat >open3.c <<'EOCP'
9299 #include <sys/types.h>
9300 #ifdef I_FCNTL
9301 #include <fcntl.h>
9302 #endif
9303 #ifdef I_SYS_FILE
9304 #include <sys/file.h>
9305 #endif
9306 int main() {
9307         if(O_RDONLY);
9308 #ifdef O_TRUNC
9309         exit(0);
9310 #else
9311         exit(1);
9312 #endif
9313 }
9314 EOCP
9315 : check sys/file.h first to get FREAD on Sun
9316 if $test `./findhdr sys/file.h` && \
9317                 set open3 -DI_SYS_FILE && eval $compile; then
9318         h_sysfile=true;
9319         echo "<sys/file.h> defines the O_* constants..." >&4
9320         if ./open3; then
9321                 echo "and you have the 3 argument form of open()." >&4
9322                 val="$define"
9323         else
9324                 echo "but not the 3 argument form of open().  Oh, well." >&4
9325                 val="$undef"
9326         fi
9327 elif $test `./findhdr fcntl.h` && \
9328                 set open3 -DI_FCNTL && eval $compile; then
9329         h_fcntl=true;
9330         echo "<fcntl.h> defines the O_* constants..." >&4
9331         if ./open3; then
9332                 echo "and you have the 3 argument form of open()." >&4
9333                 val="$define"
9334         else
9335                 echo "but not the 3 argument form of open().  Oh, well." >&4
9336                 val="$undef"
9337         fi
9338 else
9339         val="$undef"
9340         echo "I can't find the O_* constant definitions!  You got problems." >&4
9341 fi
9342 set d_open3
9343 eval $setvar
9344 $rm -f open3*
9345
9346 : see which of string.h or strings.h is needed
9347 echo " "
9348 strings=`./findhdr string.h`
9349 if $test "$strings" && $test -r "$strings"; then
9350         echo "Using <string.h> instead of <strings.h>." >&4
9351         val="$define"
9352 else
9353         val="$undef"
9354         strings=`./findhdr strings.h`
9355         if $test "$strings" && $test -r "$strings"; then
9356                 echo "Using <strings.h> instead of <string.h>." >&4
9357         else
9358                 echo "No string header found -- You'll surely have problems." >&4
9359         fi
9360 fi
9361 set i_string
9362 eval $setvar
9363 case "$i_string" in
9364 "$undef") strings=`./findhdr strings.h`;;
9365 *)        strings=`./findhdr string.h`;;
9366 esac
9367
9368 : check for non-blocking I/O stuff
9369 case "$h_sysfile" in
9370 true) echo "#include <sys/file.h>" > head.c;;
9371 *)
9372        case "$h_fcntl" in
9373        true) echo "#include <fcntl.h>" > head.c;;
9374        *) echo "#include <sys/fcntl.h>" > head.c;;
9375        esac
9376        ;;
9377 esac
9378 echo " "
9379 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9380 case "$o_nonblock" in
9381 '')
9382         $cat head.c > try.c
9383         $cat >>try.c <<'EOCP'
9384 #include <stdio.h>
9385 int main() {
9386 #ifdef O_NONBLOCK
9387         printf("O_NONBLOCK\n");
9388         exit(0);
9389 #endif
9390 #ifdef O_NDELAY
9391         printf("O_NDELAY\n");
9392         exit(0);
9393 #endif
9394 #ifdef FNDELAY
9395         printf("FNDELAY\n");
9396         exit(0);
9397 #endif
9398         exit(0);
9399 }
9400 EOCP
9401         set try
9402         if eval $compile_ok; then
9403                 o_nonblock=`./try`
9404                 case "$o_nonblock" in
9405                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9406                 *) echo "Seems like we can use $o_nonblock.";;
9407                 esac
9408         else
9409                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9410         fi
9411         ;;
9412 *) echo "Using $hint value $o_nonblock.";;
9413 esac
9414 $rm -f try try.* .out core
9415
9416 echo " "
9417 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9418 case "$eagain" in
9419 '')
9420         $cat head.c > try.c
9421         $cat >>try.c <<EOCP
9422 #include <errno.h>
9423 #include <sys/types.h>
9424 #include <signal.h>
9425 #include <stdio.h> 
9426 #define MY_O_NONBLOCK $o_nonblock
9427 #ifndef errno  /* XXX need better Configure test */
9428 extern int errno;
9429 #endif
9430 #$i_unistd I_UNISTD
9431 #ifdef I_UNISTD
9432 #include <unistd.h>
9433 #endif
9434 #$i_string I_STRING
9435 #ifdef I_STRING
9436 #include <string.h>
9437 #else
9438 #include <strings.h>
9439 #endif
9440 $signal_t blech(x) int x; { exit(3); }
9441 EOCP
9442         $cat >> try.c <<'EOCP'
9443 int main()
9444 {
9445         int pd[2];
9446         int pu[2];
9447         char buf[1];
9448         char string[100];
9449
9450         pipe(pd);       /* Down: child -> parent */
9451         pipe(pu);       /* Up: parent -> child */
9452         if (0 != fork()) {
9453                 int ret;
9454                 close(pd[1]);   /* Parent reads from pd[0] */
9455                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9456 #ifdef F_SETFL
9457                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9458                         exit(1);
9459 #else
9460                 exit(4);
9461 #endif
9462                 signal(SIGALRM, blech);
9463                 alarm(5);
9464                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9465                         exit(2);
9466                 sprintf(string, "%d\n", ret);
9467                 write(2, string, strlen(string));
9468                 alarm(0);
9469 #ifdef EAGAIN
9470                 if (errno == EAGAIN) {
9471                         printf("EAGAIN\n");
9472                         goto ok;
9473                 }
9474 #endif
9475 #ifdef EWOULDBLOCK
9476                 if (errno == EWOULDBLOCK)
9477                         printf("EWOULDBLOCK\n");
9478 #endif
9479         ok:
9480                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9481                 sleep(2);                               /* Give it time to close our pipe */
9482                 alarm(5);
9483                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9484                 alarm(0);
9485                 sprintf(string, "%d\n", ret);
9486                 write(3, string, strlen(string));
9487                 exit(0);
9488         }
9489
9490         close(pd[0]);                   /* We write to pd[1] */
9491         close(pu[1]);                   /* We read from pu[0] */
9492         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9493         close(pd[1]);                   /* Pipe pd is now fully closed! */
9494         exit(0);                                /* Bye bye, thank you for playing! */
9495 }
9496 EOCP
9497         set try
9498         if eval $compile_ok; then
9499                 echo "$startsh" >mtry
9500                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9501                 chmod +x mtry
9502                 ./mtry >/dev/null 2>&1
9503                 case $? in
9504                 0) eagain=`$cat try.out`;;
9505                 1) echo "Could not perform non-blocking setting!";;
9506                 2) echo "I did a successful read() for something that was not there!";;
9507                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9508                 4) echo "Could not find F_SETFL!";;
9509                 *) echo "Something terribly wrong happened during testing.";;
9510                 esac
9511                 rd_nodata=`$cat try.ret`
9512                 echo "A read() system call with no data present returns $rd_nodata."
9513                 case "$rd_nodata" in
9514                 0|-1) ;;
9515                 *)
9516                         echo "(That's peculiar, fixing that to be -1.)"
9517                         rd_nodata=-1
9518                         ;;
9519                 esac
9520                 case "$eagain" in
9521                 '')
9522                         echo "Forcing errno EAGAIN on read() with no data available."
9523                         eagain=EAGAIN
9524                         ;;
9525                 *)
9526                         echo "Your read() sets errno to $eagain when no data is available."
9527                         ;;
9528                 esac
9529                 status=`$cat try.err`
9530                 case "$status" in
9531                 0) echo "And it correctly returns 0 to signal EOF.";;
9532                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9533                 *) echo "However, your read() returns '$status' on EOF??";;
9534                 esac
9535                 val="$define"
9536                 if test "$status" = "$rd_nodata"; then
9537                         echo "WARNING: you can't distinguish between EOF and no data!"
9538                         val="$undef"
9539                 fi
9540         else
9541                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9542                 eagain=EAGAIN
9543         fi
9544         set d_eofnblk
9545         eval $setvar
9546         ;;
9547 *)
9548         echo "Using $hint value $eagain."
9549         echo "Your read() returns $rd_nodata when no data is present."
9550         case "$d_eofnblk" in
9551         "$define") echo "And you can see EOF because read() returns 0.";;
9552         "$undef") echo "But you can't see EOF status from read() returned value.";;
9553         *)
9554                 echo "(Assuming you can't see EOF status from read anyway.)"
9555                 d_eofnblk=$undef
9556                 ;;
9557         esac
9558         ;;
9559 esac
9560 $rm -f try try.* .out core head.c mtry
9561
9562 : see if fchmod exists
9563 set fchmod d_fchmod
9564 eval $inlibc
9565
9566 : see if fchown exists
9567 set fchown d_fchown
9568 eval $inlibc
9569
9570 : see if this is an fcntl system
9571 set fcntl d_fcntl
9572 eval $inlibc
9573
9574 echo " "
9575 : See if fcntl-based locking works.
9576 $cat >try.c <<'EOCP'
9577 #include <stdlib.h>
9578 #include <unistd.h>
9579 #include <fcntl.h>
9580 int main() {
9581 #if defined(F_SETLK) && defined(F_SETLKW)
9582      struct flock flock;
9583      int retval, fd;
9584      fd = open("try.c", O_RDONLY);
9585      flock.l_type = F_RDLCK;
9586      flock.l_whence = SEEK_SET;
9587      flock.l_start = flock.l_len = 0;
9588      retval = fcntl(fd, F_SETLK, &flock);
9589      close(fd);
9590      (retval < 0 ? exit(2) : exit(0));
9591 #else
9592      exit(2);
9593 #endif
9594 }
9595 EOCP
9596 echo "Checking if fcntl-based file locking works... "
9597 case "$d_fcntl" in
9598 "$define")
9599         set try
9600         if eval $compile_ok; then
9601                 if ./try; then
9602                         echo "Yes, it seems to work."
9603                         val="$define"
9604                 else
9605                         echo "Nope, it didn't work."
9606                         val="$undef"
9607                 fi
9608         else
9609                 echo "I'm unable to compile the test program, so I'll assume not."
9610                 val="$undef"
9611         fi
9612         ;;
9613 *) val="$undef";
9614         echo "Nope, since you don't even have fcntl()."
9615         ;;
9616 esac
9617 set d_fcntl_can_lock
9618 eval $setvar
9619 $rm -f try*
9620
9621
9622 : see if sys/select.h has to be included
9623 set sys/select.h i_sysselct
9624 eval $inhdr
9625
9626 : see if we should include time.h, sys/time.h, or both
9627 echo " "
9628 if test "X$timeincl" = X; then
9629         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9630         $echo $n "I'm now running the test program...$c"
9631         $cat >try.c <<'EOCP'
9632 #include <sys/types.h>
9633 #ifdef I_TIME
9634 #include <time.h>
9635 #endif
9636 #ifdef I_SYSTIME
9637 #ifdef SYSTIMEKERNEL
9638 #define KERNEL
9639 #endif
9640 #include <sys/time.h>
9641 #endif
9642 #ifdef I_SYSSELECT
9643 #include <sys/select.h>
9644 #endif
9645 int main()
9646 {
9647         struct tm foo;
9648 #ifdef S_TIMEVAL
9649         struct timeval bar;
9650 #endif
9651 #ifdef S_TIMEZONE
9652         struct timezone tzp;
9653 #endif
9654         if (foo.tm_sec == foo.tm_sec)
9655                 exit(0);
9656 #ifdef S_TIMEVAL
9657         if (bar.tv_sec == bar.tv_sec)
9658                 exit(0);
9659 #endif
9660         exit(1);
9661 }
9662 EOCP
9663         flags=''
9664         for s_timezone in '-DS_TIMEZONE' ''; do
9665         sysselect=''
9666         for s_timeval in '-DS_TIMEVAL' ''; do
9667         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9668         for i_time in '' '-DI_TIME'; do
9669         for i_systime in '-DI_SYSTIME' ''; do
9670                 case "$flags" in
9671                 '') $echo $n ".$c"
9672                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9673                         if eval $compile; then
9674                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9675                                 shift
9676                                 flags="$*"
9677                                 echo " "
9678                                 $echo $n "Succeeded with $flags$c"
9679                         fi
9680                         ;;
9681                 esac
9682         done
9683         done
9684         done
9685         done
9686         done
9687         timeincl=''
9688         echo " "
9689         case "$flags" in
9690         *SYSTIMEKERNEL*) i_systimek="$define"
9691                 timeincl=`./findhdr sys/time.h`
9692                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9693         *) i_systimek="$undef";;
9694         esac
9695         case "$flags" in
9696         *I_TIME*) i_time="$define"
9697                 timeincl=`./findhdr time.h`" $timeincl"
9698                 echo "We'll include <time.h>." >&4;;
9699         *) i_time="$undef";;
9700         esac
9701         case "$flags" in
9702         *I_SYSTIME*) i_systime="$define"
9703                 timeincl=`./findhdr sys/time.h`" $timeincl"
9704                 echo "We'll include <sys/time.h>." >&4;;
9705         *) i_systime="$undef";;
9706         esac
9707         $rm -f try.c try
9708 fi
9709
9710 : check for fd_set items
9711 $cat <<EOM
9712
9713 Checking to see how well your C compiler handles fd_set and friends ...
9714 EOM
9715 $cat >fd_set.c <<EOCP
9716 #$i_systime I_SYS_TIME
9717 #$i_sysselct I_SYS_SELECT
9718 #$d_socket HAS_SOCKET
9719 #include <sys/types.h>
9720 #ifdef HAS_SOCKET
9721 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9722 #endif
9723 #ifdef I_SYS_TIME
9724 #include <sys/time.h>
9725 #endif
9726 #ifdef I_SYS_SELECT
9727 #include <sys/select.h>
9728 #endif
9729 int main() {
9730         fd_set fds;
9731
9732 #ifdef TRYBITS
9733         if(fds.fds_bits);
9734 #endif
9735
9736 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9737         exit(0);
9738 #else
9739         exit(1);
9740 #endif
9741 }
9742 EOCP
9743 set fd_set -DTRYBITS
9744 if eval $compile; then
9745         d_fds_bits="$define"
9746         d_fd_set="$define"
9747         echo "Well, your system knows about the normal fd_set typedef..." >&4
9748         if ./fd_set; then
9749                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9750                 d_fd_macros="$define"
9751         else
9752                 $cat >&4 <<'EOM'
9753 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9754 EOM
9755                 d_fd_macros="$undef"
9756         fi
9757 else
9758         $cat <<'EOM'
9759 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9760 EOM
9761         set fd_set
9762         if eval $compile; then
9763                 d_fds_bits="$undef"
9764                 d_fd_set="$define"
9765                 echo "Well, your system has some sort of fd_set available..." >&4
9766                 if ./fd_set; then
9767                         echo "and you have the normal fd_set macros." >&4
9768                         d_fd_macros="$define"
9769                 else
9770                         $cat <<'EOM'
9771 but not the normal fd_set macros!  Gross!  More work for me...
9772 EOM
9773                         d_fd_macros="$undef"
9774                 fi
9775         else
9776         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9777                 d_fd_set="$undef"
9778                 d_fds_bits="$undef"
9779                 d_fd_macros="$undef"
9780         fi
9781 fi
9782 $rm -f fd_set*
9783
9784 : see if fgetpos exists
9785 set fgetpos d_fgetpos
9786 eval $inlibc
9787
9788 : see if flock exists
9789 set flock d_flock
9790 eval $inlibc
9791
9792 : see if this is a sys/file.h system
9793 val=''
9794 set sys/file.h val
9795 eval $inhdr
9796
9797 : do we need to include sys/file.h ?
9798 case "$val" in
9799 "$define")
9800         echo " "
9801         if $h_sysfile; then
9802                 val="$define"
9803                 echo "We'll be including <sys/file.h>." >&4
9804         else
9805                 val="$undef"
9806                 echo "We won't be including <sys/file.h>." >&4
9807         fi
9808         ;;
9809 *)
9810         h_sysfile=false
9811         ;;
9812 esac
9813 set i_sysfile
9814 eval $setvar
9815
9816 : see if prototype for flock is available
9817 echo " "
9818 set d_flockproto flock $i_sysfile sys/file.h
9819 eval $hasproto
9820
9821 : see if fork exists
9822 set fork d_fork
9823 eval $inlibc
9824
9825 : see if pathconf exists
9826 set pathconf d_pathconf
9827 eval $inlibc
9828
9829 : see if fpathconf exists
9830 set fpathconf d_fpathconf
9831 eval $inlibc
9832
9833
9834 : check for fpos64_t
9835 echo " "
9836 echo "Checking to see if you have fpos64_t..." >&4
9837 $cat >try.c <<EOCP
9838 #include <stdio.h>
9839 int main() { fpos64_t x = 7; }
9840 EOCP
9841 set try
9842 if eval $compile; then
9843         val="$define"
9844         echo "You have fpos64_t."
9845 else
9846         val="$undef"
9847         echo "You do not have fpos64_t."
9848         case "$fpossize" in
9849         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9850         esac
9851 fi
9852 $rm -f try.* try
9853 set d_fpos64_t
9854 eval $setvar
9855
9856 : see if frexpl exists
9857 set frexpl d_frexpl
9858 eval $inlibc
9859
9860 : see if this is a sys/param system
9861 set sys/param.h i_sysparam
9862 eval $inhdr
9863
9864 : see if this is a sys/mount.h system
9865 set sys/mount.h i_sysmount
9866 eval $inhdr
9867
9868
9869 echo " "
9870 echo "Checking to see if your system supports struct fs_data..." >&4
9871 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9872 eval $hasstruct
9873 case "$d_fs_data_s" in
9874 "$define")      echo "Yes, it does."   ;;
9875 *)              echo "No, it doesn't." ;;
9876 esac
9877
9878 : see if fseeko exists
9879 set fseeko d_fseeko
9880 eval $inlibc
9881 case "$longsize" in
9882 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9883 esac
9884
9885 : see if fsetpos exists
9886 set fsetpos d_fsetpos
9887 eval $inlibc
9888
9889
9890 : see if fstatfs exists
9891 set fstatfs d_fstatfs
9892 eval $inlibc
9893
9894
9895 : see if statvfs exists
9896 set statvfs d_statvfs
9897 eval $inlibc
9898
9899 : see if fstatvfs exists
9900 set fstatvfs d_fstatvfs
9901 eval $inlibc
9902
9903
9904 : see if fsync exists
9905 set fsync d_fsync
9906 eval $inlibc
9907
9908 : see if ftello exists
9909 set ftello d_ftello
9910 eval $inlibc
9911 case "$longsize" in
9912 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9913 esac
9914
9915 : see if getcwd exists
9916 set getcwd d_getcwd
9917 eval $inlibc
9918
9919 : see if getespwnam exists
9920 set getespwnam d_getespwnam
9921 eval $inlibc
9922
9923
9924 : see if getfsstat exists
9925 set getfsstat d_getfsstat
9926 eval $inlibc
9927
9928 : see if getgrent exists
9929 set getgrent d_getgrent
9930 eval $inlibc
9931
9932 : see if gethostbyaddr exists
9933 set gethostbyaddr d_gethbyaddr
9934 eval $inlibc
9935
9936 : see if gethostbyname exists
9937 set gethostbyname d_gethbyname
9938 eval $inlibc
9939
9940 : see if gethostent exists
9941 set gethostent d_gethent
9942 eval $inlibc
9943
9944 : see how we will look up host name
9945 echo " "
9946 call=''
9947 if set gethostname val -f d_gethname; eval $csym; $val; then
9948         echo 'gethostname() found.' >&4
9949         d_gethname="$define"
9950         call=gethostname
9951 fi
9952 if set uname val -f d_uname; eval $csym; $val; then
9953         if ./xenix; then
9954                 $cat <<'EOM'
9955 uname() was found, but you're running xenix, and older versions of xenix
9956 have a broken uname(). If you don't really know whether your xenix is old
9957 enough to have a broken system call, use the default answer.
9958
9959 EOM
9960                 dflt=y
9961                 case "$d_uname" in
9962                 "$define") dflt=n;;
9963                 esac
9964                 rp='Is your uname() broken?'
9965                 . ./myread
9966                 case "$ans" in
9967                 n*) d_uname="$define"; call=uname;;
9968                 esac
9969         else
9970                 echo 'uname() found.' >&4
9971                 d_uname="$define"
9972                 case "$call" in
9973                 '') call=uname ;;
9974                 esac
9975         fi
9976 fi
9977 case "$d_gethname" in
9978 '') d_gethname="$undef";;
9979 esac
9980 case "$d_uname" in
9981 '') d_uname="$undef";;
9982 esac
9983 case "$d_uname$d_gethname" in
9984 *define*)
9985         dflt=n
9986         cat <<EOM
9987  
9988 Every now and then someone has a $call() that lies about the hostname
9989 but can't be fixed for political or economic reasons.  If you wish, I can
9990 pretend $call() isn't there and maybe compute hostname at run-time
9991 thanks to the '$phostname' command.
9992
9993 EOM
9994         rp="Shall I ignore $call() from now on?"
9995         . ./myread
9996         case "$ans" in
9997         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9998         esac;;
9999 esac
10000 case "$phostname" in
10001 '') aphostname='';;
10002 *) case "$aphostname" in
10003         /*) ;;
10004         *) set X $phostname
10005                 shift
10006                 file=$1
10007                 shift
10008                 file=`./loc $file $file $pth`
10009                 aphostname=`echo $file $*`
10010                 ;;
10011         esac
10012         ;;
10013 esac
10014 case "$d_uname$d_gethname" in
10015 *define*) ;;
10016 *)
10017         case "$phostname" in
10018         '')
10019                 echo "There will be no way for $package to get your hostname." >&4;;
10020         *)
10021         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10022                 ;;
10023         esac;;
10024 esac
10025 case "$d_phostname" in
10026 '') d_phostname="$undef";;
10027 esac
10028
10029 : see if this is a netdb.h system
10030 set netdb.h i_netdb
10031 eval $inhdr
10032
10033 : see if prototypes for various gethostxxx netdb.h functions are available
10034 echo " "
10035 set d_gethostprotos gethostent $i_netdb netdb.h
10036 eval $hasproto
10037
10038 : see if getitimer exists
10039 set getitimer d_getitimer
10040 eval $inlibc
10041
10042 : see if getlogin exists
10043 set getlogin d_getlogin
10044 eval $inlibc
10045
10046 : see if getmnt exists
10047 set getmnt d_getmnt
10048 eval $inlibc
10049
10050 : see if getmntent exists
10051 set getmntent d_getmntent
10052 eval $inlibc
10053
10054 : see if getnetbyaddr exists
10055 set getnetbyaddr d_getnbyaddr
10056 eval $inlibc
10057
10058 : see if getnetbyname exists
10059 set getnetbyname d_getnbyname
10060 eval $inlibc
10061
10062 : see if getnetent exists
10063 set getnetent d_getnent
10064 eval $inlibc
10065
10066 : see if prototypes for various getnetxxx netdb.h functions are available
10067 echo " "
10068 set d_getnetprotos getnetent $i_netdb netdb.h
10069 eval $hasproto
10070
10071 : see if getpagesize exists
10072 set getpagesize d_getpagsz
10073 eval $inlibc
10074
10075
10076 : see if getprotobyname exists
10077 set getprotobyname d_getpbyname
10078 eval $inlibc
10079
10080 : see if getprotobynumber exists
10081 set getprotobynumber d_getpbynumber
10082 eval $inlibc
10083
10084 : see if getprotoent exists
10085 set getprotoent d_getpent
10086 eval $inlibc
10087
10088 : see if getpgid exists
10089 set getpgid d_getpgid
10090 eval $inlibc
10091
10092 : see if getpgrp2 exists
10093 set getpgrp2 d_getpgrp2
10094 eval $inlibc
10095
10096 : see if getppid exists
10097 set getppid d_getppid
10098 eval $inlibc
10099
10100 : see if getpriority exists
10101 set getpriority d_getprior
10102 eval $inlibc
10103
10104 : see if prototypes for various getprotoxxx netdb.h functions are available
10105 echo " "
10106 set d_getprotoprotos getprotoent $i_netdb netdb.h
10107 eval $hasproto
10108
10109 : see if getprpwnam exists
10110 set getprpwnam d_getprpwnam
10111 eval $inlibc
10112
10113 : see if getpwent exists
10114 set getpwent d_getpwent
10115 eval $inlibc
10116
10117
10118 : see if getservbyname exists
10119 set getservbyname d_getsbyname
10120 eval $inlibc
10121
10122 : see if getservbyport exists
10123 set getservbyport d_getsbyport
10124 eval $inlibc
10125
10126 : see if getservent exists
10127 set getservent d_getsent
10128 eval $inlibc
10129
10130 : see if prototypes for various getservxxx netdb.h functions are available
10131 echo " "
10132 set d_getservprotos getservent $i_netdb netdb.h
10133 eval $hasproto
10134
10135 : see if getspnam exists
10136 set getspnam d_getspnam
10137 eval $inlibc
10138
10139 : see if gettimeofday or ftime exists
10140 set gettimeofday d_gettimeod
10141 eval $inlibc
10142 case "$d_gettimeod" in
10143 "$undef")
10144         set ftime d_ftime 
10145         eval $inlibc
10146         ;;
10147 *)
10148         val="$undef"; set d_ftime; eval $setvar
10149         ;;
10150 esac
10151 case "$d_gettimeod$d_ftime" in
10152 "$undef$undef")
10153         echo " "
10154         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10155         ;;
10156 esac
10157
10158 : see if this is an grp system
10159 set grp.h i_grp
10160 eval $inhdr
10161
10162 case "$i_grp" in
10163 $define)
10164         xxx=`./findhdr grp.h`
10165         $cppstdin $cppflags $cppminus < $xxx >$$.h
10166
10167         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10168                 val="$define"
10169         else
10170                 val="$undef"
10171         fi
10172         set d_grpasswd
10173         eval $setvar
10174
10175         $rm -f $$.h
10176         ;;
10177 *)
10178         val="$undef";
10179         set d_grpasswd; eval $setvar
10180         ;;
10181 esac
10182
10183 : see if hasmntopt exists
10184 set hasmntopt d_hasmntopt
10185 eval $inlibc
10186
10187 : see if this is a netinet/in.h or sys/in.h system
10188 set netinet/in.h i_niin sys/in.h i_sysin
10189 eval $inhdr
10190
10191 : see if arpa/inet.h has to be included
10192 set arpa/inet.h i_arpainet
10193 eval $inhdr
10194
10195 : see if htonl --and friends-- exists
10196 val=''
10197 set htonl val
10198 eval $inlibc
10199
10200 : Maybe they are macros.
10201 case "$val" in
10202 $undef)
10203         $cat >htonl.c <<EOM
10204 #include <stdio.h>
10205 #include <sys/types.h>
10206 #$i_niin I_NETINET_IN
10207 #$i_sysin I_SYS_IN
10208 #$i_arpainet I_ARPA_INET
10209 #ifdef I_NETINET_IN
10210 #include <netinet/in.h>
10211 #endif
10212 #ifdef I_SYS_IN
10213 #include <sys/in.h>
10214 #endif
10215 #ifdef I_ARPA_INET
10216 #include <arpa/inet.h>
10217 #endif
10218 #ifdef htonl
10219 printf("Defined as a macro.");
10220 #endif
10221 EOM
10222         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10223         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10224                 val="$define"
10225                 echo "But it seems to be defined as a macro." >&4
10226         fi
10227         $rm -f htonl.?
10228         ;;
10229 esac
10230 set d_htonl
10231 eval $setvar
10232
10233 : see if iconv exists
10234 set iconv d_iconv
10235 eval $inlibc
10236
10237 : index or strchr
10238 echo " "
10239 if set index val -f; eval $csym; $val; then
10240         if set strchr val -f d_strchr; eval $csym; $val; then
10241                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10242                         val="$define"
10243                         vali="$undef"
10244                         echo "strchr() found." >&4
10245                 else
10246                         val="$undef"
10247                         vali="$define"
10248                         echo "index() found." >&4
10249                 fi
10250         else
10251                 val="$undef"
10252                 vali="$define"
10253                 echo "index() found." >&4
10254         fi
10255 else
10256         if set strchr val -f d_strchr; eval $csym; $val; then
10257                 val="$define"
10258                 vali="$undef"
10259                 echo "strchr() found." >&4
10260         else
10261                 echo "No index() or strchr() found!" >&4
10262                 val="$undef"
10263                 vali="$undef"
10264         fi
10265 fi
10266 set d_strchr; eval $setvar
10267 val="$vali"
10268 set d_index; eval $setvar
10269
10270 : check whether inet_aton exists
10271 set inet_aton d_inetaton
10272 eval $inlibc
10273
10274 : Look for isascii
10275 echo " "
10276 $cat >isascii.c <<'EOCP'
10277 #include <stdio.h>
10278 #include <ctype.h>
10279 int main() {
10280         int c = 'A';
10281         if (isascii(c))
10282                 exit(0);
10283         else
10284                 exit(1);
10285 }
10286 EOCP
10287 set isascii
10288 if eval $compile; then
10289         echo "isascii() found." >&4
10290         val="$define"
10291 else
10292         echo "isascii() NOT found." >&4
10293         val="$undef"
10294 fi
10295 set d_isascii
10296 eval $setvar
10297 $rm -f isascii*
10298
10299 : see if isnan exists
10300 set isnan d_isnan
10301 eval $inlibc
10302
10303 : see if isnanl exists
10304 set isnanl d_isnanl
10305 eval $inlibc
10306
10307 : see if killpg exists
10308 set killpg d_killpg
10309 eval $inlibc
10310
10311 : see if lchown exists
10312 echo " "
10313 $cat > try.c <<'EOCP'
10314 /* System header to define __stub macros and hopefully few prototypes,
10315     which can conflict with char lchown(); below.  */
10316 #include <assert.h>
10317 /* Override any gcc2 internal prototype to avoid an error.  */
10318 /* We use char because int might match the return type of a gcc2
10319    builtin and then its argument prototype would still apply.  */
10320 char lchown();
10321 int main() {
10322     /*  The GNU C library defines this for functions which it implements
10323         to always fail with ENOSYS.  Some functions are actually named
10324         something starting with __ and the normal name is an alias.  */
10325 #if defined (__stub_lchown) || defined (__stub___lchown)
10326 choke me
10327 #else
10328 lchown();
10329 #endif
10330 ; return 0; }
10331 EOCP
10332 set try
10333 if eval $compile; then
10334     $echo "lchown() found." >&4
10335     val="$define"
10336 else
10337     $echo "lchown() NOT found." >&4
10338     val="$undef"
10339 fi
10340 set d_lchown
10341 eval $setvar
10342
10343 : See if number of significant digits in a double precision number is known
10344 echo " "
10345 $cat >ldbl_dig.c <<EOM
10346 #$i_limits I_LIMITS
10347 #$i_float I_FLOAT
10348 #ifdef I_LIMITS
10349 #include <limits.h>
10350 #endif
10351 #ifdef I_FLOAT
10352 #include <float.h>
10353 #endif
10354 #ifdef LDBL_DIG
10355 printf("Contains LDBL_DIG");
10356 #endif
10357 EOM
10358 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10359 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10360         echo "LDBL_DIG found." >&4
10361         val="$define"
10362 else
10363         echo "LDBL_DIG NOT found." >&4
10364         val="$undef"
10365 fi
10366 $rm -f ldbl_dig.?
10367 set d_ldbl_dig
10368 eval $setvar
10369
10370 : see if link exists
10371 set link d_link
10372 eval $inlibc
10373
10374 : see if localeconv exists
10375 set localeconv d_locconv
10376 eval $inlibc
10377
10378 : see if lockf exists
10379 set lockf d_lockf
10380 eval $inlibc
10381
10382 : see if prototype for lseek is available
10383 echo " "
10384 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10385 eval $hasproto
10386
10387 : see if lstat exists
10388 set lstat d_lstat
10389 eval $inlibc
10390
10391 : see if madvise exists
10392 set madvise d_madvise
10393 eval $inlibc
10394
10395 : see if mblen exists
10396 set mblen d_mblen
10397 eval $inlibc
10398
10399 : see if mbstowcs exists
10400 set mbstowcs d_mbstowcs
10401 eval $inlibc
10402
10403 : see if mbtowc exists
10404 set mbtowc d_mbtowc
10405 eval $inlibc
10406
10407 : see if memchr exists
10408 set memchr d_memchr
10409 eval $inlibc
10410
10411 : see if memcmp exists
10412 set memcmp d_memcmp
10413 eval $inlibc
10414
10415 : see if memcpy exists
10416 set memcpy d_memcpy
10417 eval $inlibc
10418
10419 : see if memmove exists
10420 set memmove d_memmove
10421 eval $inlibc
10422
10423 : see if memset exists
10424 set memset d_memset
10425 eval $inlibc
10426
10427 : see if mkdir exists
10428 set mkdir d_mkdir
10429 eval $inlibc
10430
10431 : see if mkdtemp exists
10432 set mkdtemp d_mkdtemp
10433 eval $inlibc
10434
10435 : see if mkfifo exists
10436 set mkfifo d_mkfifo
10437 eval $inlibc
10438
10439 : see if mkstemp exists
10440 set mkstemp d_mkstemp
10441 eval $inlibc
10442
10443 : see if mkstemps exists
10444 set mkstemps d_mkstemps
10445 eval $inlibc
10446
10447 : see if mktime exists
10448 set mktime d_mktime
10449 eval $inlibc
10450
10451 : see if this is a sys/mman.h system
10452 set sys/mman.h i_sysmman
10453 eval $inhdr
10454
10455 : see if mmap exists
10456 set mmap d_mmap
10457 eval $inlibc
10458 : see what shmat returns
10459 : default to something harmless
10460 mmaptype='void *'
10461 case "$i_sysmman$d_mmap" in
10462 "$define$define")
10463         $cat >mmap.c <<'END'
10464 #include <sys/mman.h>
10465 void *mmap();
10466 END
10467         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10468                 mmaptype='void *'
10469         else
10470                 mmaptype='caddr_t'
10471         fi
10472         echo "and it returns ($mmaptype)." >&4
10473         ;;
10474 esac
10475
10476
10477
10478 : see if modfl exists
10479 set modfl d_modfl
10480 eval $inlibc
10481
10482 d_modfl_pow32_bug="$undef"
10483
10484 case "$d_longdbl$d_modfl" in
10485 $define$define)
10486         $cat <<EOM
10487 Checking to see whether your modfl() is okay for large values...
10488 EOM
10489 $cat >try.c <<EOCP
10490 #include <math.h> 
10491 #include <stdio.h>
10492 int main() {
10493     long double nv = 4294967303.15;
10494     long double v, w;
10495     v = modfl(nv, &w);         
10496 #ifdef __GLIBC__
10497     printf("glibc");
10498 #endif
10499     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10500     return 0;
10501 }
10502 EOCP
10503         case "$osname:$gccversion" in
10504         aix:)   saveccflags="$ccflags"
10505                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10506         esac
10507         set try
10508         if eval $compile; then
10509                 foo=`./try`
10510                 case "$foo" in
10511                 *" 4294967303.150000 1.150000 4294967302.000000")
10512                         echo >&4 "Your modfl() is broken for large values."
10513                         d_modfl_pow32_bug="$define"
10514                         case "$foo" in
10515                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10516                         ;;
10517                         esac
10518                         ;;
10519                 *" 4294967303.150000 0.150000 4294967303.000000")
10520                         echo >&4 "Your modfl() seems okay for large values."
10521                         ;;
10522                 *)      echo >&4 "I don't understand your modfl() at all."
10523                         d_modfl="$undef"
10524                         ;;
10525                 esac
10526                 $rm -f try.* try core core.try.*
10527         else
10528                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10529                 d_modfl="$undef"
10530         fi
10531         case "$osname:$gccversion" in
10532         aix:)   $ccflags="saveccflags" ;; # restore
10533         esac
10534         ;;
10535 esac
10536
10537 : see if mprotect exists
10538 set mprotect d_mprotect
10539 eval $inlibc
10540
10541 : see if msgctl exists
10542 set msgctl d_msgctl
10543 eval $inlibc
10544
10545 : see if msgget exists
10546 set msgget d_msgget
10547 eval $inlibc
10548
10549 : see if msgsnd exists
10550 set msgsnd d_msgsnd
10551 eval $inlibc
10552
10553 : see if msgrcv exists
10554 set msgrcv d_msgrcv
10555 eval $inlibc
10556
10557 : see how much of the 'msg*(2)' library is present.
10558 h_msg=true
10559 echo " "
10560 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10561 *"$undef"*) h_msg=false;;
10562 esac
10563 case "$osname" in
10564 freebsd)
10565     case "`ipcs 2>&1`" in
10566     "SVID messages"*"not configured"*)
10567         echo "Your $osname does not have the msg*(2) configured." >&4
10568         h_msg=false
10569         val="$undef"
10570         set msgctl d_msgctl
10571         eval $setvar
10572         set msgget d_msgget
10573         eval $setvar
10574         set msgsnd d_msgsnd
10575         eval $setvar
10576         set msgrcv d_msgrcv
10577         eval $setvar
10578         ;;
10579     esac
10580     ;;
10581 esac
10582 : we could also check for sys/ipc.h ...
10583 if $h_msg && $test `./findhdr sys/msg.h`; then
10584         echo "You have the full msg*(2) library." >&4
10585         val="$define"
10586 else
10587         echo "You don't have the full msg*(2) library." >&4
10588         val="$undef"
10589 fi
10590 set d_msg
10591 eval $setvar
10592
10593
10594 echo " "
10595 echo "Checking to see if your system supports struct msghdr..." >&4
10596 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10597 eval $hasstruct
10598 case "$d_msghdr_s" in
10599 "$define")      echo "Yes, it does."   ;;
10600 *)              echo "No, it doesn't." ;;
10601 esac
10602
10603
10604 : see if msync exists
10605 set msync d_msync
10606 eval $inlibc
10607
10608 : see if munmap exists
10609 set munmap d_munmap
10610 eval $inlibc
10611
10612 : see if nice exists
10613 set nice d_nice
10614 eval $inlibc
10615
10616 : check for length of character
10617 echo " "
10618 case "$charsize" in
10619 '')
10620         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10621         $cat >try.c <<'EOCP'
10622 #include <stdio.h>
10623 int main()
10624 {
10625     printf("%d\n", (int)sizeof(char));
10626     exit(0);
10627 }
10628 EOCP
10629         set try
10630         if eval $compile_ok; then
10631                 dflt=`./try`
10632         else
10633                 dflt='1'
10634                 echo "(I can't seem to compile the test program.  Guessing...)"
10635         fi
10636         ;;
10637 *)
10638         dflt="$charsize"
10639         ;;
10640 esac
10641 rp="What is the size of a character (in bytes)?"
10642 . ./myread
10643 charsize="$ans"
10644 $rm -f try.c try
10645
10646 : check for volatile keyword
10647 echo " "
10648 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10649 $cat >try.c <<'EOCP'
10650 int main()
10651 {
10652         typedef struct _goo_struct goo_struct;
10653         goo_struct * volatile goo = ((goo_struct *)0);
10654         struct _goo_struct {
10655                 long long_int;
10656                 int reg_int;
10657                 char char_var;
10658         };
10659         typedef unsigned short foo_t;
10660         char *volatile foo;
10661         volatile int bar;
10662         volatile foo_t blech;
10663         foo = foo;
10664 }
10665 EOCP
10666 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10667         val="$define"
10668         echo "Yup, it does."
10669 else
10670         val="$undef"
10671         echo "Nope, it doesn't."
10672 fi
10673 set d_volatile
10674 eval $setvar
10675 $rm -f try.*
10676
10677
10678 echo " "
10679 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10680
10681 case "$use64bitint:$d_quad:$quadtype" in
10682 define:define:?*)
10683         ivtype="$quadtype"
10684         uvtype="$uquadtype"
10685         ivsize=8
10686         uvsize=8
10687         ;;
10688 *)      ivtype="long"
10689         uvtype="unsigned long"
10690         ivsize=$longsize
10691         uvsize=$longsize
10692         ;;
10693 esac
10694
10695 case "$uselongdouble:$d_longdbl" in
10696 define:define)
10697         nvtype="long double"
10698         nvsize=$longdblsize
10699         ;;
10700 *)      nvtype=double
10701         nvsize=$doublesize
10702         ;;
10703 esac
10704
10705 $echo "(IV will be "$ivtype", $ivsize bytes)"
10706 $echo "(UV will be "$uvtype", $uvsize bytes)"
10707 $echo "(NV will be "$nvtype", $nvsize bytes)"
10708
10709 $cat >try.c <<EOCP
10710 #$i_inttypes I_INTTYPES
10711 #ifdef I_INTTYPES
10712 #include <inttypes.h>
10713 #endif
10714 #include <stdio.h>
10715 int main() {
10716 #ifdef INT8
10717    int8_t i =  INT8_MAX;
10718   uint8_t u = UINT8_MAX;
10719   printf("int8_t\n");
10720 #endif
10721 #ifdef INT16
10722    int16_t i =  INT16_MAX;
10723   uint16_t i = UINT16_MAX;
10724   printf("int16_t\n");
10725 #endif
10726 #ifdef INT32
10727    int32_t i =  INT32_MAX;
10728   uint32_t u = UINT32_MAX;
10729   printf("int32_t\n");
10730 #endif
10731 }
10732 EOCP
10733
10734 case "$i8type" in
10735 '')     case "$charsize" in
10736         1)      i8type=char
10737                 u8type="unsigned char"
10738                 i8size=$charsize
10739                 u8size=$charsize
10740                 ;;
10741         esac
10742         ;;
10743 esac
10744 case "$i8type" in
10745 '')     set try -DINT8
10746         if eval $compile; then
10747                 case "`./try$exe_ext`" in
10748                 int8_t) i8type=int8_t
10749                         u8type=uint8_t
10750                         i8size=1
10751                         u8size=1
10752                         ;;
10753                 esac
10754         fi
10755         ;;
10756 esac
10757 case "$i8type" in
10758 '')     if $test $charsize -ge 1; then
10759                 i8type=char
10760                 u8type="unsigned char"
10761                 i8size=$charsize
10762                 u8size=$charsize
10763         fi
10764         ;;
10765 esac
10766
10767 case "$i16type" in
10768 '')     case "$shortsize" in
10769         2)      i16type=short
10770                 u16type="unsigned short"
10771                 i16size=$shortsize
10772                 u16size=$shortsize
10773                 ;;
10774         esac
10775         ;;
10776 esac
10777 case "$i16type" in
10778 '')     set try -DINT16
10779         if eval $compile; then
10780                 case "`./try$exe_ext`" in
10781                 int16_t)
10782                         i16type=int16_t
10783                         u16type=uint16_t
10784                         i16size=2
10785                         u16size=2
10786                         ;;
10787                 esac
10788         fi
10789         ;;
10790 esac
10791 case "$i16type" in
10792 '')     if $test $shortsize -ge 2; then
10793                 i16type=short
10794                 u16type="unsigned short"
10795                 i16size=$shortsize
10796                 u16size=$shortsize
10797         fi
10798         ;;
10799 esac
10800
10801 case "$i32type" in
10802 '')     case "$longsize" in
10803         4)      i32type=long
10804                 u32type="unsigned long"
10805                 i32size=$longsize
10806                 u32size=$longsize
10807                 ;;
10808         *)      case "$intsize" in
10809                 4)      i32type=int
10810                         u32type="unsigned int"
10811                         i32size=$intsize
10812                         u32size=$intsize
10813                         ;;
10814                 esac
10815                 ;;
10816         esac
10817         ;;
10818 esac
10819 case "$i32type" in
10820 '')     set try -DINT32
10821         if eval $compile; then
10822                 case "`./try$exe_ext`" in
10823                 int32_t)
10824                         i32type=int32_t
10825                         u32type=uint32_t
10826                         i32size=4
10827                         u32size=4
10828                         ;;
10829                 esac
10830         fi
10831         ;;
10832 esac
10833 case "$i32type" in
10834 '')     if $test $intsize -ge 4; then
10835                 i32type=int
10836                 u32type="unsigned int"
10837                 i32size=$intsize
10838                 u32size=$intsize
10839         fi
10840         ;;
10841 esac
10842
10843 case "$i64type" in
10844 '')     case "$d_quad:$quadtype" in
10845         define:?*)
10846                 i64type="$quadtype"
10847                 u64type="$uquadtype"
10848                 i64size=8
10849                 u64size=8
10850                 ;;
10851         esac
10852         ;;
10853 esac
10854
10855 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10856 : volatile so that the compiler has to store it out to memory.
10857 if test X"$d_volatile" = X"$define"; then
10858         volatile=volatile
10859 fi
10860 $cat <<EOP >try.c
10861 #include <stdio.h>
10862 #include <sys/types.h>
10863 #include <signal.h>
10864 #ifdef SIGFPE
10865 $volatile int bletched = 0;
10866 $signal_t blech(s) int s; { bletched = 1; }
10867 #endif
10868 int main() {
10869     $uvtype u = 0;
10870     $nvtype d;
10871     int     n = 8 * $uvsize;
10872     int     i;
10873 #ifdef SIGFPE
10874     signal(SIGFPE, blech);
10875 #endif
10876
10877     for (i = 0; i < n; i++) {
10878       u = u << 1 | ($uvtype)1;
10879       d = ($nvtype)u;
10880       if (($uvtype)d != u)
10881         break;
10882       if (d <= 0)
10883         break;
10884       d = ($nvtype)(u - 1);
10885       if (($uvtype)d != (u - 1))
10886         break;
10887 #ifdef SIGFPE
10888       if (bletched) {
10889         break;
10890 #endif
10891       } 
10892     }
10893     printf("%d\n", ((i == n) ? -n : i));
10894     exit(0);
10895 }
10896 EOP
10897 set try
10898
10899 d_nv_preserves_uv="$undef"
10900 if eval $compile; then
10901         d_nv_preserves_uv_bits="`./try$exe_ext`"
10902 fi
10903 case "$d_nv_preserves_uv_bits" in
10904 \-[1-9]*)       
10905         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10906         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10907         d_nv_preserves_uv="$define"
10908         ;;
10909 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10910         d_nv_preserves_uv="$undef" ;;
10911 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10912         d_nv_preserves_uv_bits="$undef" ;;
10913 esac
10914
10915 $rm -f try.* try
10916
10917
10918 : check for off64_t
10919 echo " "
10920 echo "Checking to see if you have off64_t..." >&4
10921 $cat >try.c <<EOCP
10922 #include <sys/types.h>
10923 #include <unistd.h>
10924 int main() { off64_t x = 7; }
10925 EOCP
10926 set try
10927 if eval $compile; then
10928         val="$define"
10929         echo "You have off64_t."
10930 else
10931         val="$undef"
10932         echo "You do not have off64_t."
10933         case "$lseeksize" in
10934         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10935         esac
10936 fi
10937 $rm -f try.* try
10938 set d_off64_t
10939 eval $setvar
10940
10941 : see if POSIX threads are available
10942 set pthread.h i_pthread
10943 eval $inhdr
10944
10945
10946
10947
10948 : how to create joinable pthreads
10949 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10950         echo " "
10951         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10952         $cat >try.c <<'EOCP'
10953 #include <pthread.h>
10954 int main() {
10955     int detachstate = JOINABLE;
10956 }
10957 EOCP
10958         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10959         if eval $compile; then
10960                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10961                 val="$undef" # Yes, undef.
10962                 set d_old_pthread_create_joinable
10963                 eval $setvar
10964                 val=""
10965                 set old_pthread_create_joinable
10966                 eval $setvar
10967         else
10968                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10969                 if eval $compile; then
10970                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10971                         val="$define"
10972                         set d_old_pthread_create_joinable
10973                         eval $setvar
10974                         val=PTHREAD_CREATE_UNDETACHED
10975                         set old_pthread_create_joinable
10976                         eval $setvar
10977                 else            
10978                         set try -DJOINABLE=__UNDETACHED
10979                         if eval $compile; then
10980                                 echo "You seem to use __UNDETACHED." >&4
10981                                 val="$define"
10982                                 set d_old_pthread_create_joinable
10983                                 eval $setvar
10984                                 val=__UNDETACHED
10985                                 set old_pthread_create_joinable
10986                                 eval $setvar
10987                         else
10988                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10989                                 val="$define"
10990                                 set d_old_pthread_create_joinable
10991                                 eval $setvar
10992                                 val=0
10993                                 set old_pthread_create_joinable
10994                                 eval $setvar
10995                         fi
10996                 fi
10997         fi
10998         $rm -f try try.*
10999 else
11000     d_old_pthread_create_joinable="$undef"
11001     old_pthread_create_joinable=""
11002 fi
11003
11004 : see if pause exists
11005 set pause d_pause
11006 eval $inlibc
11007
11008 : see if pipe exists
11009 set pipe d_pipe
11010 eval $inlibc
11011
11012 : see if poll exists
11013 set poll d_poll
11014 eval $inlibc
11015
11016
11017 : see whether the various POSIXish _yields exist
11018 $cat >try.c <<EOP
11019 #include <pthread.h>
11020 #include <stdio.h>
11021 int main() {
11022 #ifdef SCHED_YIELD
11023         sched_yield();
11024 #else
11025 #ifdef PTHREAD_YIELD
11026         pthread_yield();
11027 #else
11028 #ifdef PTHREAD_YIELD_NULL
11029         pthread_yield(NULL);
11030 #endif
11031 #endif
11032 #endif
11033 }
11034 EOP
11035 : see if sched_yield exists
11036 set try -DSCHED_YIELD
11037 if eval $compile; then
11038     val="$define"
11039     sched_yield='sched_yield()'
11040 else
11041     val="$undef"
11042 fi
11043 case "$usethreads" in
11044 $define)
11045         case "$val" in
11046         $define) echo 'sched_yield() found.' >&4        ;;
11047         *)       echo 'sched_yield() NOT found.' >&4    ;;
11048         esac
11049 esac
11050 set d_sched_yield
11051 eval $setvar
11052
11053 : see if pthread_yield exists
11054 set try -DPTHREAD_YIELD
11055 if eval $compile; then
11056     val="$define"
11057     case "$sched_yield" in
11058     '') sched_yield='pthread_yield()' ;;
11059     esac
11060 else
11061     set try -DPTHREAD_YIELD_NULL
11062     if eval $compile; then
11063         val="$define"
11064         case "$sched_yield" in
11065         '') sched_yield='pthread_yield(NULL)' ;;
11066         esac
11067     else
11068         val="$undef"
11069     fi
11070 fi
11071 case "$usethreads" in
11072 $define)
11073         case "$val" in
11074         $define) echo 'pthread_yield() found.' >&4      ;;
11075         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11076         esac
11077         ;;
11078 esac
11079 set d_pthread_yield
11080 eval $setvar
11081
11082 case "$sched_yield" in
11083 '') sched_yield=undef ;;
11084 esac
11085
11086 $rm -f try try.*
11087
11088 : see if this is a pwd.h system
11089 set pwd.h i_pwd
11090 eval $inhdr
11091
11092 case "$i_pwd" in
11093 $define)
11094         xxx=`./findhdr pwd.h`
11095         $cppstdin $cppflags $cppminus < $xxx >$$.h
11096
11097         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11098                 val="$define"
11099         else
11100                 val="$undef"
11101         fi
11102         set d_pwquota
11103         eval $setvar
11104
11105         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11106                 val="$define"
11107         else
11108                 val="$undef"
11109         fi
11110         set d_pwage
11111         eval $setvar
11112
11113         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11114                 val="$define"
11115         else
11116                 val="$undef"
11117         fi
11118         set d_pwchange
11119         eval $setvar
11120
11121         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11122                 val="$define"
11123         else
11124                 val="$undef"
11125         fi
11126         set d_pwclass
11127         eval $setvar
11128
11129         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11130                 val="$define"
11131         else
11132                 val="$undef"
11133         fi
11134         set d_pwexpire
11135         eval $setvar
11136
11137         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11138                 val="$define"
11139         else
11140                 val="$undef"
11141         fi
11142         set d_pwcomment
11143         eval $setvar
11144
11145         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11146                 val="$define"
11147         else
11148                 val="$undef"
11149         fi
11150         set d_pwgecos
11151         eval $setvar
11152
11153         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11154                 val="$define"
11155         else
11156                 val="$undef"
11157         fi
11158         set d_pwpasswd
11159         eval $setvar
11160
11161         $rm -f $$.h
11162         ;;
11163 *)
11164         val="$undef"; 
11165         set d_pwquota; eval $setvar
11166         set d_pwage; eval $setvar
11167         set d_pwchange; eval $setvar
11168         set d_pwclass; eval $setvar
11169         set d_pwexpire; eval $setvar
11170         set d_pwcomment; eval $setvar
11171         set d_pwgecos; eval $setvar
11172         set d_pwpasswd; eval $setvar
11173         ;;
11174 esac
11175
11176 : see if readdir and friends exist
11177 set readdir d_readdir
11178 eval $inlibc
11179 set seekdir d_seekdir
11180 eval $inlibc
11181 set telldir d_telldir
11182 eval $inlibc
11183 set rewinddir d_rewinddir
11184 eval $inlibc
11185
11186 : see if readlink exists
11187 set readlink d_readlink
11188 eval $inlibc
11189
11190 : see if readv exists
11191 set readv d_readv
11192 eval $inlibc
11193
11194 : see if realpath exists
11195 set realpath d_realpath
11196 eval $inlibc
11197
11198 : see if recvmsg exists
11199 set recvmsg d_recvmsg
11200 eval $inlibc
11201
11202 : see if rename exists
11203 set rename d_rename
11204 eval $inlibc
11205
11206 : see if rmdir exists
11207 set rmdir d_rmdir
11208 eval $inlibc
11209
11210 : see if memory.h is available.
11211 val=''
11212 set memory.h val
11213 eval $inhdr
11214
11215 : See if it conflicts with string.h
11216 case "$val" in
11217 $define)
11218         case "$strings" in
11219         '') ;;
11220         *)
11221                 $cppstdin $cppflags $cppminus < $strings > mem.h
11222                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11223                         echo " "
11224                         echo "We won't be including <memory.h>."
11225                         val="$undef"
11226                 fi
11227                 $rm -f mem.h
11228                 ;;
11229         esac
11230 esac
11231 set i_memory
11232 eval $setvar
11233
11234 : can bcopy handle overlapping blocks?
11235 val="$undef"
11236 case "$d_bcopy" in
11237 "$define")
11238         echo " "
11239         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11240         $cat >try.c <<EOCP
11241 #$i_memory I_MEMORY
11242 #$i_stdlib I_STDLIB
11243 #$i_string I_STRING
11244 #$i_unistd I_UNISTD
11245 EOCP
11246         $cat >>try.c <<'EOCP'
11247 #include <stdio.h>
11248 #ifdef I_MEMORY
11249 #  include <memory.h>
11250 #endif
11251 #ifdef I_STDLIB
11252 #  include <stdlib.h>
11253 #endif
11254 #ifdef I_STRING
11255 #  include <string.h>
11256 #else
11257 #  include <strings.h>
11258 #endif
11259 #ifdef I_UNISTD
11260 #  include <unistd.h>  /* Needed for NetBSD */
11261 #endif
11262 int main()
11263 {
11264 char buf[128], abc[128];
11265 char *b;
11266 int len;
11267 int off;
11268 int align;
11269
11270 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11271
11272 for (align = 7; align >= 0; align--) {
11273         for (len = 36; len; len--) {
11274                 b = buf+align;
11275                 bcopy(abc, b, len);
11276                 for (off = 1; off <= len; off++) {
11277                         bcopy(b, b+off, len);
11278                         bcopy(b+off, b, len);
11279                         if (bcmp(b, abc, len))
11280                                 exit(1);
11281                 }
11282         }
11283 }
11284 exit(0);
11285 }
11286 EOCP
11287         set try
11288         if eval $compile_ok; then
11289                 if ./try 2>/dev/null; then
11290                         echo "Yes, it can."
11291                         val="$define"
11292                 else
11293                         echo "It can't, sorry."
11294                         case "$d_memmove" in
11295                         "$define") echo "But that's Ok since you have memmove()." ;;
11296                         esac
11297                 fi
11298         else
11299                 echo "(I can't compile the test program, so we'll assume not...)"
11300                 case "$d_memmove" in
11301                 "$define") echo "But that's Ok since you have memmove()." ;;
11302                 esac
11303         fi
11304         ;;
11305 esac
11306 $rm -f try.* try core
11307 set d_safebcpy
11308 eval $setvar
11309
11310 : can memcpy handle overlapping blocks?
11311 val="$undef"
11312 case "$d_memcpy" in
11313 "$define")
11314         echo " "
11315         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11316         $cat >try.c <<EOCP
11317 #$i_memory I_MEMORY
11318 #$i_stdlib I_STDLIB
11319 #$i_string I_STRING
11320 #$i_unistd I_UNISTD
11321 EOCP
11322         $cat >>try.c <<'EOCP'
11323 #include <stdio.h>
11324 #ifdef I_MEMORY
11325 #  include <memory.h>
11326 #endif
11327 #ifdef I_STDLIB
11328 #  include <stdlib.h>
11329 #endif
11330 #ifdef I_STRING
11331 #  include <string.h>
11332 #else
11333 #  include <strings.h>
11334 #endif
11335 #ifdef I_UNISTD
11336 #  include <unistd.h>  /* Needed for NetBSD */
11337 #endif
11338 int main()
11339 {
11340 char buf[128], abc[128];
11341 char *b;
11342 int len;
11343 int off;
11344 int align;
11345
11346 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11347    try to store the string in read-only memory. */
11348 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11349
11350 for (align = 7; align >= 0; align--) {
11351         for (len = 36; len; len--) {
11352                 b = buf+align;
11353                 memcpy(b, abc, len);
11354                 for (off = 1; off <= len; off++) {
11355                         memcpy(b+off, b, len);
11356                         memcpy(b, b+off, len);
11357                         if (memcmp(b, abc, len))
11358                                 exit(1);
11359                 }
11360         }
11361 }
11362 exit(0);
11363 }
11364 EOCP
11365         set try
11366         if eval $compile_ok; then
11367                 if ./try 2>/dev/null; then
11368                         echo "Yes, it can."
11369                         val="$define"
11370                 else
11371                         echo "It can't, sorry."
11372                         case "$d_memmove" in
11373                         "$define") echo "But that's Ok since you have memmove()." ;;
11374                         esac
11375                 fi
11376         else
11377                 echo "(I can't compile the test program, so we'll assume not...)"
11378                 case "$d_memmove" in
11379                 "$define") echo "But that's Ok since you have memmove()." ;;
11380                 esac
11381         fi
11382         ;;
11383 esac
11384 $rm -f try.* try core
11385 set d_safemcpy
11386 eval $setvar
11387
11388 : can memcmp be trusted to compare relative magnitude?
11389 val="$undef"
11390 case "$d_memcmp" in
11391 "$define")
11392         echo " "
11393         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11394         $cat >try.c <<EOCP
11395 #$i_memory I_MEMORY
11396 #$i_stdlib I_STDLIB
11397 #$i_string I_STRING
11398 #$i_unistd I_UNISTD
11399 EOCP
11400         $cat >>try.c <<'EOCP'
11401 #include <stdio.h>
11402 #ifdef I_MEMORY
11403 #  include <memory.h>
11404 #endif
11405 #ifdef I_STDLIB
11406 #  include <stdlib.h>
11407 #endif
11408 #ifdef I_STRING
11409 #  include <string.h>
11410 #else
11411 #  include <strings.h>
11412 #endif
11413 #ifdef I_UNISTD
11414 #  include <unistd.h>  /* Needed for NetBSD */
11415 #endif
11416 int main()
11417 {
11418 char a = -1;
11419 char b = 0;
11420 if ((a < b) && memcmp(&a, &b, 1) < 0)
11421         exit(1);
11422 exit(0);
11423 }
11424 EOCP
11425         set try
11426         if eval $compile_ok; then
11427                 if ./try 2>/dev/null; then
11428                         echo "Yes, it can."
11429                         val="$define"
11430                 else
11431                         echo "No, it can't (it uses signed chars)."
11432                 fi
11433         else
11434                 echo "(I can't compile the test program, so we'll assume not...)"
11435         fi
11436         ;;
11437 esac
11438 $rm -f try.* try core
11439 set d_sanemcmp
11440 eval $setvar
11441
11442 : see if prototype for sbrk is available
11443 echo " "
11444 set d_sbrkproto sbrk $i_unistd unistd.h
11445 eval $hasproto
11446
11447 : see if select exists
11448 set select d_select
11449 eval $inlibc
11450
11451 : see if semctl exists
11452 set semctl d_semctl
11453 eval $inlibc
11454
11455 : see if semget exists
11456 set semget d_semget
11457 eval $inlibc
11458
11459 : see if semop exists
11460 set semop d_semop
11461 eval $inlibc
11462
11463 : see how much of the 'sem*(2)' library is present.
11464 h_sem=true
11465 echo " "
11466 case "$d_semctl$d_semget$d_semop" in
11467 *"$undef"*) h_sem=false;;
11468 esac
11469 case "$osname" in
11470 freebsd)
11471     case "`ipcs 2>&1`" in
11472     "SVID messages"*"not configured"*)
11473         echo "Your $osname does not have the sem*(2) configured." >&4
11474         h_sem=false
11475         val="$undef"
11476         set semctl d_semctl
11477         eval $setvar
11478         set semget d_semget
11479         eval $setvar
11480         set semop d_semop
11481         eval $setvar
11482         ;;
11483     esac
11484     ;;
11485 esac
11486 : we could also check for sys/ipc.h ...
11487 if $h_sem && $test `./findhdr sys/sem.h`; then
11488         echo "You have the full sem*(2) library." >&4
11489         val="$define"
11490 else
11491         echo "You don't have the full sem*(2) library." >&4
11492         val="$undef"
11493 fi
11494 set d_sem
11495 eval $setvar
11496
11497 : see whether sys/sem.h defines union semun
11498 echo " "
11499 $cat > try.c <<'END'
11500 #include <sys/types.h>
11501 #include <sys/ipc.h>
11502 #include <sys/sem.h>
11503 int main () { union semun semun; semun.buf = 0; }
11504 END
11505 set try
11506 if eval $compile; then
11507     echo "You have union semun in <sys/sem.h>." >&4
11508     val="$define"
11509 else
11510     echo "You do not have union semun in <sys/sem.h>." >&4
11511     val="$undef"
11512 fi
11513 $rm -f try try.c try.h
11514 set d_union_semun
11515 eval $setvar
11516
11517 : see how to do semctl IPC_STAT
11518 case "$d_sem" in
11519 $define)
11520     : see whether semctl IPC_STAT can use union semun
11521     echo " "
11522     $cat > try.h <<END
11523 #ifndef S_IRUSR
11524 #   ifdef S_IREAD
11525 #       define S_IRUSR S_IREAD
11526 #       define S_IWUSR S_IWRITE
11527 #       define S_IXUSR S_IEXEC
11528 #   else
11529 #       define S_IRUSR 0400
11530 #       define S_IWUSR 0200
11531 #       define S_IXUSR 0100
11532 #   endif
11533 #   define S_IRGRP (S_IRUSR>>3)
11534 #   define S_IWGRP (S_IWUSR>>3)
11535 #   define S_IXGRP (S_IXUSR>>3)
11536 #   define S_IROTH (S_IRUSR>>6)
11537 #   define S_IWOTH (S_IWUSR>>6)
11538 #   define S_IXOTH (S_IXUSR>>6)
11539 #endif
11540 #ifndef S_IRWXU
11541 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11542 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11543 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11544 #endif
11545 END
11546
11547     $cat > try.c <<END
11548 #include <sys/types.h>
11549 #include <sys/ipc.h>
11550 #include <sys/sem.h>
11551 #include <sys/stat.h>
11552 #include <stdio.h>
11553 #include <errno.h>
11554 #include "try.h"
11555 #ifndef errno
11556 extern int errno;
11557 #endif
11558 #$d_union_semun HAS_UNION_SEMUN
11559 int main() {
11560     union semun
11561 #ifndef HAS_UNION_SEMUN
11562     {
11563         int val;
11564         struct semid_ds *buf;
11565         unsigned short *array;
11566     }
11567 #endif
11568     arg;
11569     int sem, st;
11570
11571 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11572     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11573     if (sem > -1) {
11574         struct semid_ds argbuf;
11575         arg.buf = &argbuf;
11576 #       ifdef IPC_STAT
11577         st = semctl(sem, 0, IPC_STAT, arg);
11578         if (st == 0)
11579             printf("semun\n");
11580         else
11581 #       endif /* IPC_STAT */
11582             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11583 #       ifdef IPC_RMID
11584         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11585 #       endif /* IPC_RMID */
11586             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11587     } else
11588 #endif /* IPC_PRIVATE && ... */
11589         printf("semget failed: errno = %d\n", errno);
11590   return 0;
11591 }
11592 END
11593     val="$undef"
11594     set try
11595     if eval $compile; then
11596         xxx=`./try`
11597         case "$xxx" in
11598         semun) val="$define" ;;
11599         esac
11600     fi
11601     $rm -f try try.c
11602     set d_semctl_semun
11603     eval $setvar
11604     case "$d_semctl_semun" in
11605     $define)
11606         echo "You can use union semun for semctl IPC_STAT." >&4
11607         also='also'
11608         ;;
11609     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11610         also=''
11611         ;;
11612     esac
11613
11614     : see whether semctl IPC_STAT can use struct semid_ds pointer
11615     $cat > try.c <<'END'
11616 #include <sys/types.h>
11617 #include <sys/ipc.h>
11618 #include <sys/sem.h>
11619 #include <sys/stat.h>
11620 #include "try.h"
11621 #include <stdio.h>
11622 #include <errno.h>
11623 #ifndef errno
11624 extern int errno;
11625 #endif
11626 int main() {
11627     struct semid_ds arg;
11628     int sem, st;
11629
11630 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11631     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11632     if (sem > -1) {
11633 #       ifdef IPC_STAT
11634         st = semctl(sem, 0, IPC_STAT, &arg);
11635         if (st == 0)
11636             printf("semid_ds\n");
11637         else
11638 #       endif /* IPC_STAT */
11639             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11640 #       ifdef IPC_RMID
11641         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11642 #       endif /* IPC_RMID */
11643             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11644     } else
11645 #endif /* IPC_PRIVATE && ... */
11646         printf("semget failed: errno = %d\n", errno);
11647
11648     return 0;
11649 }
11650 END
11651     val="$undef"
11652     set try
11653     if eval $compile; then
11654         xxx=`./try`
11655         case "$xxx" in
11656         semid_ds) val="$define" ;;
11657         esac
11658     fi
11659     $rm -f try try.c
11660     set d_semctl_semid_ds
11661     eval $setvar
11662     case "$d_semctl_semid_ds" in
11663     $define)
11664         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11665         ;;
11666     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11667         ;;
11668     esac
11669     $rm -f try.h
11670     ;;
11671 *)  val="$undef"
11672
11673     # We do not have the full sem*(2) library, so assume we can not
11674     # use either.
11675
11676     set d_semctl_semun
11677     eval $setvar
11678
11679     set d_semctl_semid_ds
11680     eval $setvar
11681     ;;
11682 esac
11683
11684 : see if sendmsg exists
11685 set sendmsg d_sendmsg
11686 eval $inlibc
11687
11688 : see if setegid exists
11689 set setegid d_setegid
11690 eval $inlibc
11691
11692 : see if seteuid exists
11693 set seteuid d_seteuid
11694 eval $inlibc
11695
11696 : see if setgrent exists
11697 set setgrent d_setgrent
11698 eval $inlibc
11699
11700 : see if sethostent exists
11701 set sethostent d_sethent
11702 eval $inlibc
11703
11704 : see if setitimer exists
11705 set setitimer d_setitimer
11706 eval $inlibc
11707
11708 : see if setlinebuf exists
11709 set setlinebuf d_setlinebuf
11710 eval $inlibc
11711
11712 : see if setlocale exists
11713 set setlocale d_setlocale
11714 eval $inlibc
11715
11716 : see if setnetent exists
11717 set setnetent d_setnent
11718 eval $inlibc
11719
11720 : see if setprotoent exists
11721 set setprotoent d_setpent
11722 eval $inlibc
11723
11724 : see if setpgid exists
11725 set setpgid d_setpgid
11726 eval $inlibc
11727
11728 : see if setpgrp2 exists
11729 set setpgrp2 d_setpgrp2
11730 eval $inlibc
11731
11732 : see if setpriority exists
11733 set setpriority d_setprior
11734 eval $inlibc
11735
11736 : see if setproctitle exists
11737 set setproctitle d_setproctitle
11738 eval $inlibc
11739
11740 : see if setpwent exists
11741 set setpwent d_setpwent
11742 eval $inlibc
11743
11744 : see if setregid exists
11745 set setregid d_setregid
11746 eval $inlibc
11747 set setresgid d_setresgid
11748 eval $inlibc
11749
11750 : see if setreuid exists
11751 set setreuid d_setreuid
11752 eval $inlibc
11753 set setresuid d_setresuid
11754 eval $inlibc
11755
11756 : see if setrgid exists
11757 set setrgid d_setrgid
11758 eval $inlibc
11759
11760 : see if setruid exists
11761 set setruid d_setruid
11762 eval $inlibc
11763
11764 : see if setservent exists
11765 set setservent d_setsent
11766 eval $inlibc
11767
11768 : see if setsid exists
11769 set setsid d_setsid
11770 eval $inlibc
11771
11772 : see if setvbuf exists
11773 set setvbuf d_setvbuf
11774 eval $inlibc
11775
11776 : see if sfio.h is available
11777 set sfio.h i_sfio
11778 eval $inhdr
11779
11780
11781 : see if sfio library is available
11782 case "$i_sfio" in
11783 $define)
11784         val=''
11785         set sfreserve val
11786         eval $inlibc
11787         ;;
11788 *)
11789         val="$undef"
11790         ;;
11791 esac
11792 : Ok, but do we want to use it.
11793 case "$val" in
11794 $define)
11795         case "$usesfio" in
11796         true|$define|[yY]*) dflt='y';;
11797         *) dflt='n';;
11798         esac
11799         echo "$package can use the sfio library, but it is experimental."
11800         case "$useperlio" in
11801         "$undef")
11802             echo "For sfio also the PerlIO abstraction layer is needed."
11803             echo "Earlier you said you wouldn't want that."
11804             ;;
11805         esac
11806         rp="You seem to have sfio available, do you want to try using it?"
11807         . ./myread
11808         case "$ans" in
11809         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11810                 useperlio="$define"
11811                 val="$define"
11812                 ;;
11813         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11814                 val="$undef"
11815                 ;;
11816         esac
11817         ;;
11818 *)      case "$usesfio" in
11819         true|$define|[yY]*)
11820                 echo "Sorry, cannot find sfio on this machine." >&4
11821                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11822                 val="$undef"
11823                 ;;
11824         esac
11825         ;;
11826 esac
11827 set d_sfio
11828 eval $setvar
11829 case "$d_sfio" in
11830 $define) usesfio='true';;
11831 *) usesfio='false';;
11832 esac
11833 case "$d_sfio" in
11834 $define) ;;
11835 *)      : Remove sfio from list of libraries to use
11836         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11837         shift
11838         libs="$*"
11839         echo "libs = $libs" >&4
11840 ;;
11841 esac
11842
11843
11844 : see if shmctl exists
11845 set shmctl d_shmctl
11846 eval $inlibc
11847
11848 : see if shmget exists
11849 set shmget d_shmget
11850 eval $inlibc
11851
11852 : see if shmat exists
11853 set shmat d_shmat
11854 eval $inlibc
11855 : see what shmat returns
11856 case "$d_shmat" in
11857 "$define")
11858         $cat >shmat.c <<'END'
11859 #include <sys/shm.h>
11860 void *shmat();
11861 END
11862         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11863                 shmattype='void *'
11864         else
11865                 shmattype='char *'
11866         fi
11867         echo "and it returns ($shmattype)." >&4
11868         : see if a prototype for shmat is available
11869         xxx=`./findhdr sys/shm.h`
11870         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11871         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11872                 val="$define"
11873         else
11874                 val="$undef"
11875         fi
11876         $rm -f shmat.[co]
11877         ;;
11878 *)
11879         val="$undef"
11880         ;;
11881 esac
11882 set d_shmatprototype
11883 eval $setvar
11884
11885 : see if shmdt exists
11886 set shmdt d_shmdt
11887 eval $inlibc
11888
11889 : see how much of the 'shm*(2)' library is present.
11890 h_shm=true
11891 echo " "
11892 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11893 *"$undef"*) h_shm=false;;
11894 esac
11895 case "$osname" in
11896 freebsd)
11897     case "`ipcs 2>&1`" in
11898     "SVID shared memory"*"not configured"*)
11899         echo "Your $osname does not have the shm*(2) configured." >&4
11900         h_shm=false
11901         val="$undef"
11902         set shmctl d_shmctl
11903         evat $setvar
11904         set shmget d_shmget
11905         evat $setvar
11906         set shmat d_shmat
11907         evat $setvar
11908         set shmdt d_shmdt
11909         evat $setvar
11910         ;;
11911     esac
11912     ;;
11913 esac
11914 : we could also check for sys/ipc.h ...
11915 if $h_shm && $test `./findhdr sys/shm.h`; then
11916         echo "You have the full shm*(2) library." >&4
11917         val="$define"
11918 else
11919         echo "You don't have the full shm*(2) library." >&4
11920         val="$undef"
11921 fi
11922 set d_shm
11923 eval $setvar
11924
11925 echo " "
11926 : see if we have sigaction
11927 if set sigaction val -f d_sigaction; eval $csym; $val; then
11928         echo 'sigaction() found.' >&4
11929         $cat > try.c <<'EOP'
11930 #include <stdio.h>
11931 #include <sys/types.h>
11932 #include <signal.h>
11933 int main()
11934 {
11935     struct sigaction act, oact;
11936     act.sa_flags = 0;
11937     oact.sa_handler = 0;
11938     /* so that act and oact are used */
11939     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11940 }
11941 EOP
11942         set try
11943         if eval $compile_ok; then
11944                 val="$define"
11945         else
11946                 echo "But you don't seem to have a useable struct sigaction." >&4
11947                 val="$undef"
11948         fi
11949 else
11950         echo 'sigaction NOT found.' >&4
11951         val="$undef"
11952 fi
11953 set d_sigaction; eval $setvar
11954 $rm -f try try$_o try.c
11955
11956 : see if sigprocmask exists
11957 set sigprocmask d_sigprocmask
11958 eval $inlibc
11959
11960 : see if sigsetjmp exists
11961 echo " "
11962 case "$d_sigsetjmp" in
11963 '')
11964         $cat >try.c <<'EOP'
11965 #include <setjmp.h>
11966 sigjmp_buf env;
11967 int set = 1;
11968 int main()
11969 {
11970         if (sigsetjmp(env,1))
11971                 exit(set);
11972         set = 0;
11973         siglongjmp(env, 1);
11974         exit(1);
11975 }
11976 EOP
11977         set try
11978         if eval $compile; then
11979                 if ./try >/dev/null 2>&1; then
11980                         echo "POSIX sigsetjmp found." >&4
11981                         val="$define"
11982                 else
11983                         $cat >&4 <<EOM
11984 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11985 I'll ignore them.
11986 EOM
11987                         val="$undef"
11988                 fi
11989         else
11990                 echo "sigsetjmp not found." >&4
11991                 val="$undef"
11992         fi
11993         ;;
11994 *) val="$d_sigsetjmp"
11995         case "$d_sigsetjmp" in
11996         $define) echo "POSIX sigsetjmp found." >&4;;
11997         $undef) echo "sigsetjmp not found." >&4;;
11998         esac
11999         ;;
12000 esac
12001 set d_sigsetjmp
12002 eval $setvar
12003 $rm -f try.c try
12004
12005 : see if sockatmark exists
12006 set sockatmark d_sockatmark
12007 eval $inlibc
12008
12009 : see if prototype for sockatmark is available
12010 echo " "
12011 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12012 eval $hasproto
12013
12014 : see if socks5_init exists
12015 set socks5_init d_socks5_init
12016 eval $inlibc
12017
12018 : see if prototype for setresgid is available
12019 echo " "
12020 set d_sresgproto setresgid $i_unistd unistd.h
12021 eval $hasproto
12022
12023 : see if prototype for setresuid is available
12024 echo " "
12025 set d_sresuproto setresuid $i_unistd unistd.h
12026 eval $hasproto
12027
12028 : see if sys/stat.h is available
12029 set sys/stat.h i_sysstat
12030 eval $inhdr
12031
12032
12033 : see if stat knows about block sizes
12034 echo " "
12035 echo "Checking to see if your struct stat has st_blocks field..." >&4
12036 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12037 eval $hasfield
12038
12039
12040 : see if this is a sys/vfs.h system
12041 set sys/vfs.h i_sysvfs
12042 eval $inhdr
12043
12044
12045 : see if this is a sys/statfs.h system
12046 set sys/statfs.h i_sysstatfs
12047 eval $inhdr
12048
12049
12050 echo " "
12051 echo "Checking to see if your system supports struct statfs..." >&4
12052 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
12053 eval $hasstruct
12054 case "$d_statfs_s" in
12055 "$define")      echo "Yes, it does."   ;;
12056 *)              echo "No, it doesn't." ;;
12057 esac
12058
12059
12060
12061 : see if struct statfs knows about f_flags
12062 case "$d_statfs_s" in
12063 define) 
12064         echo " "
12065         echo "Checking to see if your struct statfs has f_flags field..." >&4
12066         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
12067         eval $hasfield
12068         ;;
12069 *)      val="$undef"
12070         set d_statfs_f_flags
12071         eval $setvar
12072         ;;
12073 esac
12074 case "$d_statfs_f_flags" in
12075 "$define")      echo "Yes, it does."   ;;
12076 *)              echo "No, it doesn't." ;;
12077 esac
12078
12079 : see if _ptr and _cnt from stdio act std
12080 echo " "
12081
12082 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12083         echo "(Looks like you have stdio.h from BSD.)"
12084         case "$stdio_ptr" in
12085         '') stdio_ptr='((fp)->_p)'
12086                 ptr_lval=$define
12087                 ;;
12088         *)      ptr_lval=$d_stdio_ptr_lval;;
12089         esac
12090         case "$stdio_cnt" in
12091         '') stdio_cnt='((fp)->_r)'
12092                 cnt_lval=$define
12093                 ;;
12094         *)      cnt_lval=$d_stdio_cnt_lval;;
12095         esac
12096         case "$stdio_base" in
12097         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12098         esac
12099         case "$stdio_bufsiz" in
12100         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12101         esac
12102 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12103         echo "(Looks like you have stdio.h from Linux.)"
12104         case "$stdio_ptr" in
12105         '') stdio_ptr='((fp)->_IO_read_ptr)'
12106                 ptr_lval=$define
12107                 ;;
12108         *)      ptr_lval=$d_stdio_ptr_lval;;
12109         esac
12110         case "$stdio_cnt" in
12111         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12112                 cnt_lval=$undef
12113                 ;;
12114         *)      cnt_lval=$d_stdio_cnt_lval;;
12115         esac
12116         case "$stdio_base" in
12117         '') stdio_base='((fp)->_IO_read_base)';;
12118         esac
12119         case "$stdio_bufsiz" in
12120         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12121         esac
12122 else
12123         case "$stdio_ptr" in
12124         '') stdio_ptr='((fp)->_ptr)'
12125                 ptr_lval=$define
12126                 ;;
12127         *)      ptr_lval=$d_stdio_ptr_lval;;
12128         esac
12129         case "$stdio_cnt" in
12130         '') stdio_cnt='((fp)->_cnt)'
12131                 cnt_lval=$define
12132                 ;;
12133         *)      cnt_lval=$d_stdio_cnt_lval;;
12134         esac
12135         case "$stdio_base" in
12136         '') stdio_base='((fp)->_base)';;
12137         esac
12138         case "$stdio_bufsiz" in
12139         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12140         esac
12141 fi
12142
12143 : test whether _ptr and _cnt really work
12144 echo "Checking how std your stdio is..." >&4
12145 $cat >try.c <<EOP
12146 #include <stdio.h>
12147 #define FILE_ptr(fp)    $stdio_ptr
12148 #define FILE_cnt(fp)    $stdio_cnt
12149 int main() {
12150         FILE *fp = fopen("try.c", "r");
12151         char c = getc(fp);
12152         if (
12153                 18 <= FILE_cnt(fp) &&
12154                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12155         )
12156                 exit(0);
12157         exit(1);
12158 }
12159 EOP
12160 val="$undef"
12161 set try
12162 if eval $compile; then
12163         if ./try; then
12164                 echo "Your stdio acts pretty std."
12165                 val="$define"
12166         else
12167                 echo "Your stdio isn't very std."
12168         fi
12169 else
12170         echo "Your stdio doesn't appear very std."
12171 fi
12172 $rm -f try.c try
12173 set d_stdstdio
12174 eval $setvar
12175
12176 : Can _ptr be used as an lvalue?
12177 case "$d_stdstdio$ptr_lval" in
12178 $define$define) val=$define ;;
12179 *) val=$undef ;;
12180 esac
12181 set d_stdio_ptr_lval
12182 eval $setvar
12183
12184 : Can _cnt be used as an lvalue?
12185 case "$d_stdstdio$cnt_lval" in
12186 $define$define) val=$define ;;
12187 *) val=$undef ;;
12188 esac
12189 set d_stdio_cnt_lval
12190 eval $setvar
12191
12192
12193 : test whether setting _ptr sets _cnt as a side effect
12194 d_stdio_ptr_lval_sets_cnt="$undef"
12195 d_stdio_ptr_lval_nochange_cnt="$undef"
12196 case "$d_stdio_ptr_lval$d_stdstdio" in
12197 $define$define)
12198         echo "Checking to see what happens if we set the stdio ptr..." >&4
12199 $cat >try.c <<EOP
12200 #include <stdio.h>
12201 /* Can we scream? */
12202 /* Eat dust sed :-) */
12203 /* In the buffer space, no one can hear you scream. */
12204 #define FILE_ptr(fp)    $stdio_ptr
12205 #define FILE_cnt(fp)    $stdio_cnt
12206 #include <sys/types.h>
12207 int main() {
12208         FILE *fp = fopen("try.c", "r");
12209         int c;
12210         char *ptr;
12211         size_t cnt;
12212         if (!fp) {
12213             puts("Fail even to read");
12214             exit(1);
12215         }
12216         c = getc(fp); /* Read away the first # */
12217         if (c == EOF) {
12218             puts("Fail even to read");
12219             exit(1);
12220         }
12221         if (!(
12222                 18 <= FILE_cnt(fp) &&
12223                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12224         )) {
12225                 puts("Fail even to read");
12226                 exit (1);
12227         }
12228         ptr = (char*) FILE_ptr(fp);
12229         cnt = (size_t)FILE_cnt(fp);
12230
12231         FILE_ptr(fp) += 42;
12232
12233         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12234                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12235                 exit (1);
12236         }
12237         if (FILE_cnt(fp) <= 20) {
12238                 printf ("Fail (<20 chars to test)");
12239                 exit (1);
12240         }
12241         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12242                 puts("Fail compare");
12243                 exit (1);
12244         }
12245         if (cnt == FILE_cnt(fp)) {
12246                 puts("Pass_unchanged");
12247                 exit (0);
12248         }       
12249         if (FILE_cnt(fp) == (cnt - 42)) {
12250                 puts("Pass_changed");
12251                 exit (0);
12252         }
12253         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12254         return 1;
12255
12256 }
12257 EOP
12258         set try
12259         if eval $compile; then
12260                 case `./try$exe_ext` in
12261                 Pass_changed)
12262                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12263                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12264                 Pass_unchanged)
12265                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12266                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12267                 Fail*)
12268                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12269                 *)
12270                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12271         esac
12272         else
12273                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12274         fi
12275         $rm -f try.c try
12276         ;;
12277 esac
12278
12279 : see if _base is also standard
12280 val="$undef"
12281 case "$d_stdstdio" in
12282 $define)
12283         $cat >try.c <<EOP
12284 #include <stdio.h>
12285 #define FILE_base(fp)   $stdio_base
12286 #define FILE_bufsiz(fp) $stdio_bufsiz
12287 int main() {
12288         FILE *fp = fopen("try.c", "r");
12289         char c = getc(fp);
12290         if (
12291                 19 <= FILE_bufsiz(fp) &&
12292                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12293         )
12294                 exit(0);
12295         exit(1);
12296 }
12297 EOP
12298         set try
12299         if eval $compile; then
12300                 if ./try; then
12301                         echo "And its _base field acts std."
12302                         val="$define"
12303                 else
12304                         echo "But its _base field isn't std."
12305                 fi
12306         else
12307                 echo "However, it seems to be lacking the _base field."
12308         fi
12309         $rm -f try.c try
12310         ;;
12311 esac
12312 set d_stdiobase
12313 eval $setvar
12314
12315 $cat >&4 <<EOM
12316 Checking how to access stdio streams by file descriptor number...
12317 EOM
12318 case "$stdio_stream_array" in
12319 '')     $cat >try.c <<EOCP
12320 #include <stdio.h>
12321 int main() {
12322   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12323     printf("yes\n");
12324 }
12325 EOCP
12326         for s in _iob __iob __sF
12327         do
12328                 set try -DSTDIO_STREAM_ARRAY=$s
12329                 if eval $compile; then
12330                         case "`./try$exe_ext`" in
12331                         yes)    stdio_stream_array=$s; break ;;
12332                         esac
12333                 fi
12334         done
12335         $rm -f try.* try$exe_ext
12336 esac
12337 case "$stdio_stream_array" in
12338 '')     $cat >&4 <<EOM
12339 I can't figure out how to access stdio streams by file descriptor number.
12340 EOM
12341         d_stdio_stream_array="$undef"
12342         ;;
12343 *)      $cat >&4 <<EOM
12344 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12345 EOM
12346         d_stdio_stream_array="$define"
12347         ;;
12348 esac
12349
12350 : see if strcoll exists
12351 set strcoll d_strcoll
12352 eval $inlibc
12353
12354 : check for structure copying
12355 echo " "
12356 echo "Checking to see if your C compiler can copy structs..." >&4
12357 $cat >try.c <<'EOCP'
12358 int main()
12359 {
12360         struct blurfl {
12361                 int dyick;
12362         } foo, bar;
12363
12364         foo = bar;
12365 }
12366 EOCP
12367 if $cc -c try.c >/dev/null 2>&1 ; then
12368         val="$define"
12369         echo "Yup, it can."
12370 else
12371         val="$undef"
12372         echo "Nope, it can't."
12373 fi
12374 set d_strctcpy
12375 eval $setvar
12376 $rm -f try.*
12377
12378 : see if strerror and/or sys_errlist[] exist
12379 echo " "
12380 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12381     if set strerror val -f d_strerror; eval $csym; $val; then
12382                 echo 'strerror() found.' >&4
12383                 d_strerror="$define"
12384                 d_strerrm='strerror(e)'
12385                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12386                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12387                         d_syserrlst="$define"
12388                 else
12389                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12390                         d_syserrlst="$undef"
12391                 fi
12392     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12393                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12394                 echo 'strerror() found in string header.' >&4
12395                 d_strerror="$define"
12396                 d_strerrm='strerror(e)'
12397                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12398                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12399                                 d_syserrlst="$define"
12400                 else
12401                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12402                         d_syserrlst="$undef"
12403                 fi
12404     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12405                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12406                 d_strerror="$undef"
12407                 d_syserrlst="$define"
12408                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12409     else
12410                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12411                 d_strerror="$undef"
12412                 d_syserrlst="$undef"
12413                 d_strerrm='"unknown"'
12414     fi
12415 fi
12416
12417 : see if strftime exists
12418 set strftime d_strftime
12419 eval $inlibc
12420
12421 : see if strtod exists
12422 set strtod d_strtod
12423 eval $inlibc
12424
12425 : see if strtol exists
12426 set strtol d_strtol
12427 eval $inlibc
12428
12429 : see if strtold exists
12430 set strtold d_strtold
12431 eval $inlibc
12432
12433 : see if strtoll exists
12434 set strtoll d_strtoll
12435 eval $inlibc
12436
12437 case "$d_longlong-$d_strtoll" in
12438 "$define-$define")
12439         $cat <<EOM
12440 Checking whether your strtoll() works okay...
12441 EOM
12442         $cat >try.c <<'EOCP'
12443 #include <errno.h>
12444 #ifdef __hpux
12445 #define strtoll __strtoll
12446 #endif
12447 #ifdef __EMX__
12448 #define strtoll _strtoll
12449 #endif
12450 #include <stdio.h>
12451 extern long long int strtoll(char *s, char **, int); 
12452 static int bad = 0;
12453 int check(char *s, long long ell, int een) {
12454         long long gll;
12455         errno = 0;
12456         gll = strtoll(s, 0, 10);
12457         if (!((gll == ell) && (errno == een)))
12458                 bad++;
12459 }
12460 int main() {
12461         check(" 1",                                      1LL, 0);
12462         check(" 0",                                      0LL, 0);
12463         check("-1",                                     -1LL, 0);
12464         check("-9223372036854775808", -9223372036854775808LL, 0);
12465         check("-9223372036854775808", -9223372036854775808LL, 0);
12466         check(" 9223372036854775807",  9223372036854775807LL, 0);
12467         check("-9223372036854775808", -9223372036854775808LL, 0);
12468         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12469         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12470         if (!bad)
12471                 printf("ok\n");
12472 }
12473 EOCP
12474         set try
12475         if eval $compile; then
12476                 yyy=`./try`
12477                 case "$yyy" in
12478                 ok) echo "Your strtoll() seems to be working okay." ;;
12479                 *) cat <<EOM >&4
12480 Your strtoll() doesn't seem to be working okay.
12481 EOM
12482                    d_strtoll="$undef"
12483                    ;;
12484                 esac
12485         else
12486                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12487                 d_strtoll="$undef"
12488         fi
12489         ;;
12490 esac
12491
12492 : see if strtoq exists
12493 set strtoq d_strtoq
12494 eval $inlibc
12495
12496 : see if strtoul exists
12497 set strtoul d_strtoul
12498 eval $inlibc
12499
12500 case "$d_strtoul" in
12501 "$define")
12502         $cat <<EOM
12503 Checking whether your strtoul() works okay...
12504 EOM
12505         $cat >try.c <<'EOCP'
12506 #include <errno.h>
12507 #include <stdio.h>
12508 extern unsigned long int strtoul(char *s, char **, int); 
12509 static int bad = 0;
12510 void check(char *s, unsigned long eul, int een) {
12511         unsigned long gul;
12512         errno = 0;
12513         gul = strtoul(s, 0, 10);
12514         if (!((gul == eul) && (errno == een)))
12515                 bad++;
12516 }
12517 int main() {
12518         check(" 1", 1L, 0);
12519         check(" 0", 0L, 0);
12520 EOCP
12521         case "$longsize" in
12522         8)
12523             $cat >>try.c <<'EOCP'
12524         check("18446744073709551615", 18446744073709551615UL, 0);
12525         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12526 #if 0 /* strtoul() for /^-/ strings is undefined. */
12527         check("-1", 18446744073709551615UL, 0);
12528         check("-18446744073709551614", 2, 0);
12529         check("-18446744073709551615", 1, 0);
12530         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12531         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12532 #endif
12533 EOCP
12534                 ;;
12535         4)
12536                     $cat >>try.c <<'EOCP'
12537         check("4294967295", 4294967295UL, 0);
12538         check("4294967296", 4294967295UL, ERANGE);
12539 #if 0 /* strtoul() for /^-/ strings is undefined. */
12540         check("-1", 4294967295UL, 0);
12541         check("-4294967294", 2, 0);
12542         check("-4294967295", 1, 0);
12543         check("-4294967296", 4294967295UL, ERANGE);
12544         check("-4294967297", 4294967295UL, ERANGE);
12545 #endif
12546 EOCP
12547                 ;;
12548         *)
12549 : Should we write these tests to be more portable by sprintf-ing
12550 : ~0 and then manipulating that char string as input for strtol?
12551                 ;;
12552         esac
12553         $cat >>try.c <<'EOCP'
12554         if (!bad)
12555                 printf("ok\n");
12556         return 0;
12557 }
12558 EOCP
12559         set try
12560         if eval $compile; then
12561                 case "`./try`" in
12562                 ok) echo "Your strtoul() seems to be working okay." ;;
12563                 *) cat <<EOM >&4
12564 Your strtoul() doesn't seem to be working okay.
12565 EOM
12566                    d_strtoul="$undef"
12567                    ;;
12568                 esac
12569         fi
12570         ;;
12571 esac
12572
12573 : see if strtoull exists
12574 set strtoull d_strtoull
12575 eval $inlibc
12576
12577 case "$d_longlong-$d_strtoull" in
12578 "$define-$define")
12579         $cat <<EOM
12580 Checking whether your strtoull() works okay...
12581 EOM
12582         $cat >try.c <<'EOCP'
12583 #include <errno.h>
12584 #ifdef __hpux
12585 #define strtoull __strtoull
12586 #endif
12587 #include <stdio.h>
12588 extern unsigned long long int strtoull(char *s, char **, int); 
12589 static int bad = 0;
12590 int check(char *s, long long eull, int een) {
12591         long long gull;
12592         errno = 0;
12593         gull = strtoull(s, 0, 10);
12594         if (!((gull == eull) && (errno == een)))
12595                 bad++;
12596 }
12597 int main() {
12598         check(" 1",                                        1LL, 0);
12599         check(" 0",                                        0LL, 0);
12600         check("18446744073709551615",  18446744073709551615ULL, 0);
12601         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12602 #if 0 /* strtoull() for /^-/ strings is undefined. */
12603         check("-1",                    18446744073709551615ULL, 0);
12604         check("-18446744073709551614",                     2LL, 0);
12605         check("-18446744073709551615",                     1LL, 0);
12606         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12607         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12608 #endif
12609         if (!bad)
12610                 printf("ok\n");
12611 }
12612 EOCP
12613         set try
12614         if eval $compile; then
12615                 case "`./try`" in
12616                 ok) echo "Your strtoull() seems to be working okay." ;;
12617                 *) cat <<EOM >&4
12618 Your strtoull() doesn't seem to be working okay.
12619 EOM
12620                    d_strtoull="$undef"
12621                    ;;
12622                 esac
12623         fi
12624         ;;
12625 esac
12626
12627 : see if strtouq exists
12628 set strtouq d_strtouq
12629 eval $inlibc
12630
12631 case "$d_strtouq" in
12632 "$define")
12633         $cat <<EOM
12634 Checking whether your strtouq() works okay...
12635 EOM
12636         $cat >try.c <<'EOCP'
12637 #include <errno.h>
12638 #include <stdio.h>
12639 extern unsigned long long int strtouq(char *s, char **, int); 
12640 static int bad = 0;
12641 void check(char *s, unsigned long long eull, int een) {
12642         unsigned long long gull;
12643         errno = 0;
12644         gull = strtouq(s, 0, 10);
12645         if (!((gull == eull) && (errno == een)))
12646                 bad++;
12647 }
12648 int main() {
12649         check(" 1",                                        1LL, 0);
12650         check(" 0",                                        0LL, 0);
12651         check("18446744073709551615",  18446744073709551615ULL, 0);
12652         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12653 #if 0 /* strtouq() for /^-/ strings is undefined. */
12654         check("-1",                    18446744073709551615ULL, 0);
12655         check("-18446744073709551614",                     2LL, 0);
12656         check("-18446744073709551615",                     1LL, 0);
12657         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12658         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12659 #endif
12660         if (!bad)
12661                 printf("ok\n");
12662         return 0;
12663 }
12664 EOCP
12665         set try
12666         if eval $compile; then
12667                 case "`./try`" in
12668                 ok) echo "Your strtouq() seems to be working okay." ;;
12669                 *) cat <<EOM >&4
12670 Your strtouq() doesn't seem to be working okay.
12671 EOM
12672                    d_strtouq="$undef"
12673                    ;;
12674                 esac
12675         fi
12676         ;;
12677 esac
12678
12679 : see if strxfrm exists
12680 set strxfrm d_strxfrm
12681 eval $inlibc
12682
12683 : see if symlink exists
12684 set symlink d_symlink
12685 eval $inlibc
12686
12687 : see if syscall exists
12688 set syscall d_syscall
12689 eval $inlibc
12690
12691 : see if prototype for syscall is available
12692 echo " "
12693 set d_syscallproto syscall $i_unistd unistd.h
12694 eval $hasproto
12695
12696 : see if sysconf exists
12697 set sysconf d_sysconf
12698 eval $inlibc
12699
12700 : see if system exists
12701 set system d_system
12702 eval $inlibc
12703
12704 : see if tcgetpgrp exists
12705 set tcgetpgrp d_tcgetpgrp
12706 eval $inlibc
12707
12708 : see if tcsetpgrp exists
12709 set tcsetpgrp d_tcsetpgrp
12710 eval $inlibc
12711
12712 : see if prototype for telldir is available
12713 echo " "
12714 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12715 eval $hasproto
12716
12717 : see if this is a sys/times.h system
12718 set sys/times.h i_systimes
12719 eval $inhdr
12720
12721 : see if times exists
12722 echo " "
12723 if set times val -f d_times; eval $csym; $val; then
12724         echo 'times() found.' >&4
12725         d_times="$define"
12726         inc=''
12727         case "$i_systimes" in
12728         "$define") inc='sys/times.h';;
12729         esac
12730         rp="What is the type returned by times() on this system?"
12731         set clock_t clocktype long stdio.h sys/types.h $inc
12732         eval $typedef_ask
12733 else
12734         echo 'times() NOT found, hope that will do.' >&4
12735         d_times="$undef"
12736         clocktype='int'
12737 fi
12738
12739 : see if truncate exists
12740 set truncate d_truncate
12741 eval $inlibc
12742
12743 : see if tzname[] exists
12744 echo " "
12745 if set tzname val -a d_tzname; eval $csym; $val; then
12746         val="$define"
12747         echo 'tzname[] found.' >&4
12748 else
12749         val="$undef"
12750         echo 'tzname[] NOT found.' >&4
12751 fi
12752 set d_tzname
12753 eval $setvar
12754
12755 case "$crosscompile" in
12756 ''|[nN]*) crosscompile="$undef" ;;
12757 esac
12758
12759 case "$osname" in
12760 next|rhapsody|darwin) multiarch="$define" ;;
12761 esac
12762 case "$multiarch" in
12763 ''|[nN]*) multiarch="$undef" ;;
12764 esac
12765
12766 : check for ordering of bytes in a long
12767 echo " "
12768 case "$crosscompile$multiarch" in
12769 *$define*)
12770         $cat <<EOM
12771 You seem to be either cross-compiling or doing a multiarchitecture build,
12772 skipping the byteorder check.
12773
12774 EOM
12775         byteorder='0xffff'
12776         ;;
12777 *)
12778         case "$byteorder" in
12779         '')
12780                 $cat <<'EOM'
12781 In the following, larger digits indicate more significance.  A big-endian
12782 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12783 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12784 machines may have weird orders like 3412.  A Cray will report 87654321,
12785 an Alpha will report 12345678. If the test program works the default is
12786 probably right.
12787 I'm now running the test program...
12788 EOM
12789                 $cat >try.c <<'EOCP'
12790 #include <stdio.h>
12791 int main()
12792 {
12793         int i;
12794         union {
12795                 unsigned long l;
12796                 char c[sizeof(long)];
12797         } u;
12798
12799         if (sizeof(long) > 4)
12800                 u.l = (0x08070605L << 32) | 0x04030201L;
12801         else
12802                 u.l = 0x04030201L;
12803         for (i = 0; i < sizeof(long); i++)
12804                 printf("%c", u.c[i]+'0');
12805         printf("\n");
12806         exit(0);
12807 }
12808 EOCP
12809                 xxx_prompt=y
12810                 set try
12811                 if eval $compile && ./try > /dev/null; then
12812                         dflt=`./try`
12813                         case "$dflt" in
12814                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12815                                 echo "(The test program ran ok.)"
12816                                 echo "byteorder=$dflt"
12817                                 xxx_prompt=n
12818                         ;;
12819                         ????|????????) echo "(The test program ran ok.)" ;;
12820                         *) echo "(The test program didn't run right for some reason.)" ;;
12821                         esac
12822                 else
12823                         dflt='4321'
12824                         cat <<'EOM'
12825 (I can't seem to compile the test program.  Guessing big-endian...)
12826 EOM
12827                 fi
12828                 case "$xxx_prompt" in
12829                 y)
12830                         rp="What is the order of bytes in a long?"
12831                         . ./myread
12832                         byteorder="$ans"
12833                         ;;
12834                 *)      byteorder=$dflt
12835                         ;;
12836                 esac
12837                 ;;
12838         esac
12839         $rm -f try.c try
12840         ;;
12841 esac
12842
12843
12844 $cat <<EOM
12845
12846 Checking to see whether you can access character data unalignedly...
12847 EOM
12848 $cat >try.c <<EOCP
12849 #include <stdio.h>
12850 #define U32 $u32type
12851 #define BYTEORDER $byteorder
12852 int main() {
12853 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12854     U8 buf[] = "\0\0\0\1\0\0\0\0";
12855     U32 *up;
12856     int i;
12857
12858     if (sizeof(U32) != 4) {
12859         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12860         exit(1);
12861     }
12862
12863     fflush(stdout);
12864
12865     for (i = 0; i < 4; i++) {
12866         up = (U32*)(buf + i);
12867         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12868                (*up == 1 << (8*(3-i)))  /* little-endian */
12869               )
12870            )
12871         {
12872             printf("read failed (%x)\n", *up);
12873             exit(2);
12874         }
12875     }
12876
12877     /* write test */
12878     for (i = 0; i < 4; i++) {
12879         up = (U32*)(buf + i);
12880         *up = 0xBeef;
12881         if (*up != 0xBeef) {
12882             printf("write failed (%x)\n", *up);
12883             exit(3);
12884         }
12885     }
12886
12887     exit(0);
12888 #else
12889     printf("1\n");
12890     exit(1);
12891 #endif
12892     return 0;
12893 }
12894 EOCP
12895 set try
12896 if eval $compile_ok; then
12897         echo "(Testign for character data alignment may dump core.)" >&4
12898         ./try 2>&1 >/dev/null
12899         case "$?" in
12900         0)      cat >&4 <<EOM
12901 You can access character data pretty unalignedly.
12902 EOM
12903                 d_u32align="$undef"
12904                 ;;
12905         *)      cat >&4 <<EOM
12906 It seems that you must access character data in an aligned manner.
12907 EOM
12908                 d_u32align="$define"
12909                 ;;
12910         esac
12911         $rm -f core core.try.* try.core
12912 else
12913         rp='Can you access character data at unaligned addresses?'
12914         dflt='n'
12915         . ./myread
12916         case "$ans" in
12917         [yY]*)  d_u32align="$undef"  ;;
12918         *)      d_u32align="$define" ;;
12919         esac
12920 fi
12921
12922 : see if ualarm exists
12923 set ualarm d_ualarm
12924 eval $inlibc
12925
12926 : see if umask exists
12927 set umask d_umask
12928 eval $inlibc
12929
12930 : see if usleep exists
12931 set usleep d_usleep
12932 eval $inlibc
12933
12934 : see if prototype for usleep is available
12935 echo " "
12936 set d_usleepproto usleep $i_unistd unistd.h
12937 eval $hasproto
12938
12939 : see if ustat exists
12940 set ustat d_ustat
12941 eval $inlibc
12942
12943 : backward compatibility for d_hvfork
12944 if test X$d_hvfork != X; then
12945         d_vfork="$d_hvfork"
12946         d_hvfork=''
12947 fi
12948 : see if there is a vfork
12949 val=''
12950 set vfork val
12951 eval $inlibc
12952
12953 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12954 : perl on Solaris 2.x, and probably elsewhere.
12955 case "$val" in
12956 $define)
12957         echo " "
12958         case "$usevfork" in
12959         false) dflt='n';;
12960         *) dflt='y';;
12961         esac
12962         cat <<'EOM'
12963  
12964 Perl can only use a vfork() that doesn't suffer from strict
12965 restrictions on calling functions or modifying global data in
12966 the child.  For example, glibc-2.1 contains such a vfork()
12967 that is unsuitable.  If your system provides a proper fork()
12968 call, chances are that you do NOT want perl to use vfork().
12969
12970 EOM
12971         rp="Do you still want to use vfork()?"
12972         . ./myread
12973         case "$ans" in
12974         y|Y) ;;
12975         *)
12976                 echo "Ok, we won't use vfork()."
12977                 val="$undef"
12978                 ;;
12979         esac
12980         ;;
12981 esac
12982 set d_vfork
12983 eval $setvar
12984 case "$d_vfork" in
12985 $define) usevfork='true';;
12986 *) usevfork='false';;
12987 esac
12988
12989 : see if this is an sysdir system
12990 set sys/dir.h i_sysdir
12991 eval $inhdr
12992
12993 : see if this is an sysndir system
12994 set sys/ndir.h i_sysndir
12995 eval $inhdr
12996
12997 : see if closedir exists
12998 set closedir d_closedir
12999 eval $inlibc
13000
13001 case "$d_closedir" in
13002 "$define")
13003         echo " "
13004         echo "Checking whether closedir() returns a status..." >&4
13005         cat > closedir.c <<EOM
13006 #$i_dirent I_DIRENT             /**/
13007 #$i_sysdir I_SYS_DIR            /**/
13008 #$i_sysndir I_SYS_NDIR          /**/
13009 #$i_systypes I_SYS_TYPES        /**/
13010
13011 #if defined(I_SYS_TYPES)
13012 #include <sys/types.h>
13013 #endif
13014 #if defined(I_DIRENT)
13015 #include <dirent.h>
13016 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13017 #include <sys/dir.h>
13018 #endif
13019 #else
13020 #ifdef I_SYS_NDIR
13021 #include <sys/ndir.h>
13022 #else
13023 #ifdef I_SYS_DIR
13024 #ifdef hp9000s500
13025 #include <ndir.h>       /* may be wrong in the future */
13026 #else
13027 #include <sys/dir.h>
13028 #endif
13029 #endif
13030 #endif
13031 #endif 
13032 int main() { return closedir(opendir(".")); }
13033 EOM
13034         set closedir
13035         if eval $compile_ok; then
13036                 if ./closedir > /dev/null 2>&1 ; then
13037                         echo "Yes, it does."
13038                         val="$undef"
13039                 else
13040                         echo "No, it doesn't."
13041                         val="$define"
13042                 fi
13043         else
13044                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13045                 val="$define"
13046         fi
13047         ;;
13048 *)
13049         val="$undef";
13050         ;;
13051 esac
13052 set d_void_closedir
13053 eval $setvar
13054 $rm -f closedir*
13055 : see if there is a wait4
13056 set wait4 d_wait4
13057 eval $inlibc
13058
13059 : see if waitpid exists
13060 set waitpid d_waitpid
13061 eval $inlibc
13062
13063 : see if wcstombs exists
13064 set wcstombs d_wcstombs
13065 eval $inlibc
13066
13067 : see if wctomb exists
13068 set wctomb d_wctomb
13069 eval $inlibc
13070
13071 : see if writev exists
13072 set writev d_writev
13073 eval $inlibc
13074
13075 : preserve RCS keywords in files with variable substitution, grrr
13076 Date='$Date'
13077 Id='$Id'
13078 Log='$Log'
13079 RCSfile='$RCSfile'
13080 Revision='$Revision'
13081
13082 : check for alignment requirements
13083 echo " "
13084 case "$crosscompile$multiarch" in
13085 *$define*)
13086         $cat <<EOM
13087 You seem to be either cross-compiling or doing a multiarchitecture build,
13088 skipping the memory alignment check.
13089
13090 EOM
13091         case "$alignbytes" in
13092         '') alignbytes=8 ;;
13093         esac
13094         ;;
13095 *)
13096         case "$alignbytes" in
13097         '') echo "Checking alignment constraints..." >&4
13098                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13099                         $cat >try.c <<'EOCP'
13100 typedef long double NV;
13101 EOCP
13102                 else
13103                         $cat >try.c <<'EOCP'
13104 typedef double NV;
13105 EOCP
13106                 fi
13107                 $cat >>try.c <<'EOCP'
13108 #include <stdio.h>
13109 struct foobar {
13110         char foo;
13111         NV bar;
13112 } try_algn;
13113 int main()
13114 {
13115     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13116     return(0);
13117 }
13118 EOCP
13119                 set try
13120                 if eval $compile_ok; then
13121                         dflt=`./try`
13122                 else
13123                         dflt='8'
13124                         echo "(I can't seem to compile the test program...)"
13125                 fi
13126                 ;;
13127         *) dflt="$alignbytes"
13128                 ;;
13129         esac
13130         rp="Doubles must be aligned on a how-many-byte boundary?"
13131         . ./myread
13132         alignbytes="$ans"
13133         $rm -f try.c try
13134         ;;
13135 esac
13136
13137
13138 : set the base revision
13139 baserev=5.0
13140
13141 : how do we catenate cpp tokens here?
13142 echo " "
13143 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13144 $cat >cpp_stuff.c <<'EOCP'
13145 #define RCAT(a,b)a/**/b
13146 #define ACAT(a,b)a ## b
13147 RCAT(Rei,ser)
13148 ACAT(Cir,cus)
13149 EOCP
13150 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13151 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13152         echo "Oh!  Smells like ANSI's been here." >&4
13153         echo "We can catify or stringify, separately or together!"
13154         cpp_stuff=42
13155 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13156         echo "Ah, yes!  The good old days!" >&4
13157         echo "However, in the good old days we don't know how to stringify and"
13158         echo "catify at the same time."
13159         cpp_stuff=1
13160 else
13161         $cat >&4 <<EOM
13162 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13163 to have to edit the values of CAT[2-5] in config.h...
13164 EOM
13165         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13166 fi
13167 $rm -f cpp_stuff.*
13168
13169 : see if this is a db.h system
13170 set db.h i_db
13171 eval $inhdr
13172
13173 case "$i_db" in
13174 $define)
13175         : Check db version.
13176         echo " "
13177         echo "Checking Berkeley DB version ..." >&4
13178         $cat >try.c <<EOCP
13179 #$d_const HASCONST
13180 #ifndef HASCONST
13181 #define const
13182 #endif
13183 #include <sys/types.h>
13184 #include <stdio.h>
13185 #include <db.h>
13186 int main(int argc, char *argv[])
13187 {
13188 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13189     int Major, Minor, Patch ;
13190     unsigned long Version ;
13191     (void)db_version(&Major, &Minor, &Patch) ;
13192     if (argc == 2) {
13193         printf("%d %d %d %d %d %d\n",
13194                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13195                Major, Minor, Patch);
13196         exit(0);
13197     }
13198     printf("You have Berkeley DB Version 2 or greater.\n");
13199
13200     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13201                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13202     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13203                 Major, Minor, Patch) ;
13204
13205     /* check that db.h & libdb are compatible */
13206     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13207         printf("db.h and libdb are incompatible.\n") ;
13208         exit(3);        
13209     }
13210
13211     printf("db.h and libdb are compatible.\n") ;
13212
13213     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13214                 + DB_VERSION_PATCH ;
13215
13216     /* needs to be >= 2.3.4 */
13217     if (Version < 2003004) {
13218     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13219         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13220         exit(2);        
13221     }
13222
13223     exit(0);
13224 #else
13225 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13226     if (argc == 2) {
13227         printf("1 0 0\n");
13228         exit(0);
13229     }
13230     printf("You have Berkeley DB Version 1.\n");
13231     exit(0);    /* DB version < 2: the coast is clear. */
13232 #else
13233     exit(1);    /* <db.h> not Berkeley DB? */
13234 #endif
13235 #endif
13236 }
13237 EOCP
13238         set try
13239         if eval $compile_ok && ./try; then
13240                 echo 'Looks OK.' >&4
13241                 set `./try 1`
13242                 db_version_major=$1
13243                 db_version_minor=$2
13244                 db_version_patch=$3
13245         else
13246                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13247                 i_db=$undef
13248                 case " $libs " in
13249                 *"-ldb "*)
13250                         : Remove db from list of libraries to use
13251                         echo "Removing unusable -ldb from library list" >&4
13252                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13253                         shift
13254                         libs="$*"
13255                         echo "libs = $libs" >&4
13256                         ;;
13257                 esac
13258         fi
13259         $rm -f try.*
13260         ;;
13261 esac
13262
13263 case "$i_db" in
13264 define)
13265         : Check the return type needed for hash 
13266         echo " "
13267         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13268         $cat >try.c <<EOCP
13269 #$d_const HASCONST
13270 #ifndef HASCONST
13271 #define const
13272 #endif
13273 #include <sys/types.h>
13274 #include <db.h>
13275
13276 #ifndef DB_VERSION_MAJOR
13277 u_int32_t hash_cb (ptr, size)
13278 const void *ptr;
13279 size_t size;
13280 {
13281 }
13282 HASHINFO info;
13283 int main()
13284 {
13285         info.hash = hash_cb;
13286 }
13287 #endif
13288 EOCP
13289         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13290                 if $contains warning try.out >>/dev/null 2>&1 ; then
13291                         db_hashtype='int'
13292                 else
13293                         db_hashtype='u_int32_t'
13294                 fi
13295         else
13296                 : XXX Maybe we should just give up here.
13297                 db_hashtype=u_int32_t
13298                 $cat try.out >&4
13299                 echo "Help:  I can't seem to compile the db test program." >&4
13300                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13301         fi
13302         $rm -f try.*
13303         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13304         ;;
13305 *)      db_hashtype=u_int32_t
13306         ;;
13307 esac
13308 case "$i_db" in
13309 define)
13310         : Check the return type needed for prefix 
13311         echo " "
13312         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13313         cat >try.c <<EOCP
13314 #$d_const HASCONST
13315 #ifndef HASCONST
13316 #define const
13317 #endif
13318 #include <sys/types.h>
13319 #include <db.h>
13320
13321 #ifndef DB_VERSION_MAJOR
13322 size_t prefix_cb (key1, key2)
13323 const DBT *key1;
13324 const DBT *key2;
13325 {
13326 }
13327 BTREEINFO info;
13328 int main()
13329 {
13330         info.prefix = prefix_cb;
13331 }
13332 #endif
13333 EOCP
13334         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13335                 if $contains warning try.out >>/dev/null 2>&1 ; then
13336                         db_prefixtype='int'
13337                 else
13338                         db_prefixtype='size_t'
13339                 fi
13340         else
13341                 db_prefixtype='size_t'
13342                 : XXX Maybe we should just give up here.
13343                 $cat try.out >&4
13344                 echo "Help:  I can't seem to compile the db test program." >&4
13345                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13346         fi
13347         $rm -f try.*
13348         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13349         ;;
13350 *)      db_prefixtype='size_t'
13351         ;;
13352 esac
13353
13354
13355 : How can we generate normalized random numbers ?
13356 echo " "
13357 echo "Looking for a random number function..." >&4
13358 case "$randfunc" in
13359 '')
13360         if set drand48 val -f; eval $csym; $val; then
13361                 dflt="drand48"
13362                 echo "Good, found drand48()." >&4
13363         elif set random val -f; eval $csym; $val; then
13364                 dflt="random"
13365                 echo "OK, found random()." >&4
13366         else
13367                 dflt="rand"
13368                 echo "Yick, looks like I have to use rand()." >&4
13369         fi
13370         echo " "
13371         ;;
13372 *)
13373         dflt="$randfunc"
13374         ;;
13375 esac
13376 cont=true
13377
13378 case "$ccflags" in
13379 *-Dmy_rand=*|*-Dmy_srand=*)
13380         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13381         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13382         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13383         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13384         ;;
13385 esac
13386
13387 while $test "$cont"; do
13388         rp="Use which function to generate random numbers?"
13389         . ./myread
13390         if $test "$ans" = "$dflt"; then
13391                 : null
13392         else
13393                 randbits=''
13394         fi
13395         randfunc="$ans"
13396         if set $ans val -f; eval $csym; $val; then
13397                 cont=''
13398         else
13399                 dflt=y
13400                 rp="I cannot find function $ans. Use that name anyway?"
13401                 . ./myread
13402                 dflt=rand
13403                 case "$ans" in
13404                         [yY]*) cont='';;
13405                 esac
13406         fi
13407         case "$cont" in
13408         '')
13409                 case "$randfunc" in
13410                 drand48)
13411                         drand01="drand48()"
13412                         seedfunc="srand48"
13413                         randbits=48
13414                         randseedtype=long
13415                         ;;
13416                 rand|random)
13417                         case "$randbits" in
13418                         '')
13419 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13420                                 $cat >try.c <<EOCP
13421 #$i_unistd I_UNISTD
13422 #$i_stdlib I_STDLIB
13423 #include <stdio.h>
13424 #ifdef I_UNISTD
13425 #  include <unistd.h>
13426 #endif
13427 #ifdef I_STDLIB
13428 #  include <stdlib.h>
13429 #endif
13430 int main()
13431 {
13432         register int i;
13433         register unsigned long tmp;
13434         register unsigned long max = 0L;
13435
13436         for (i = 1000; i; i--) {
13437                 tmp = (unsigned long) $randfunc();
13438                 if (tmp > max) max = tmp;
13439         }
13440         for (i = 0; max; i++)
13441                 max /= 2;
13442         printf("%d\n",i);
13443 }
13444 EOCP
13445                                 set try
13446                                 if eval $compile_ok; then
13447                                         dflt=`try`
13448                                 else
13449                                         dflt='?'
13450                                         echo "(I can't seem to compile the test program...)"
13451                                 fi
13452                                 ;;
13453                         *)
13454                                 dflt="$randbits"
13455                                 ;;
13456                         esac
13457                         rp="How many bits does your $randfunc() function produce?"
13458                         . ./myread
13459                         randbits="$ans"
13460                         $rm -f try.c try
13461                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13462                         seedfunc="s$randfunc"
13463                         randseedtype=unsigned
13464                         ;;
13465                 *)
13466                         dflt="31"
13467                         rp="How many bits does your $randfunc() function produce?"
13468                         . ./myread
13469                         randbits="$ans"
13470                         seedfunc="s$randfunc"
13471                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13472                         if set $seedfunc val -f; eval $csym; $val; then
13473                                 echo "(Using $seedfunc() to seed random generator)"
13474                         else
13475                                 echo "(Warning: no $seedfunc() to seed random generator)"
13476                                 seedfunc=rand
13477                         fi
13478                         randseedtype=unsigned
13479                         ;;
13480                 esac
13481                 ;;
13482         esac
13483 done
13484
13485 echo " "
13486 echo "Determining whether or not we are on an EBCDIC system..." >&4
13487 $cat >tebcdic.c <<'EOM'
13488 int main()
13489 {
13490   if ('M'==0xd4) return 0;
13491   return 1;
13492 }
13493 EOM
13494
13495 val=$undef
13496 set tebcdic
13497 if eval $compile_ok; then
13498         if ./tebcdic; then
13499                 echo "You seem to speak EBCDIC." >&4
13500                 val="$define"
13501         else
13502                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13503         fi
13504 else
13505         echo "I'm unable to compile the test program." >&4
13506         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13507 fi
13508 $rm -f tebcdic.c tebcdic
13509 set ebcdic
13510 eval $setvar
13511
13512 echo " "
13513 $cat >&4 <<EOM
13514 Checking how to flush all pending stdio output...
13515 EOM
13516 # I only know how to find the first 32 possibly open files on SunOS.
13517 # See also hints/sunos_4_1.sh and util.c  --AD
13518 case "$osname" in
13519 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13520 esac
13521 $cat >>try.c <<EOCP
13522 #include <stdio.h>
13523 #$i_unistd I_UNISTD
13524 #ifdef I_UNISTD
13525 # include <unistd.h>
13526 #endif
13527 #$d_sysconf HAS_SYSCONF
13528 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13529 #ifdef HAS_STDIO_STREAM_ARRAY
13530 # define STDIO_STREAM_ARRAY $stdio_stream_array
13531 #endif
13532 int main() {
13533   FILE* p = fopen("try.out", "w");
13534 #ifdef TRY_FPUTC
13535   fputc('x', p);
13536 #else
13537 # ifdef TRY_FPRINTF
13538   fprintf(p, "x");
13539 # endif
13540 #endif
13541 #ifdef TRY_FFLUSH_NULL
13542   fflush(NULL);
13543 #endif
13544 #ifdef TRY_FFLUSH_ALL
13545   {
13546     long open_max = -1;
13547 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13548     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13549 # else
13550 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13551     open_max = sysconf(_SC_OPEN_MAX);
13552 #  else
13553 #   ifdef FOPEN_MAX
13554     open_max = FOPEN_MAX;
13555 #   else
13556 #    ifdef OPEN_MAX
13557     open_max = OPEN_MAX;
13558 #    else
13559 #     ifdef _NFILE
13560     open_max = _NFILE;
13561 #     endif
13562 #    endif
13563 #   endif
13564 #  endif
13565 # endif 
13566 # ifdef HAS_STDIO_STREAM_ARRAY
13567     if (open_max > 0) {
13568       long i;
13569       for (i = 0; i < open_max; i++)
13570             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13571                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13572                 STDIO_STREAM_ARRAY[i]._flag)
13573                 fflush(&STDIO_STREAM_ARRAY[i]);
13574     }   
13575   }
13576 # endif
13577 #endif
13578   _exit(42);
13579 }
13580 EOCP
13581 : first we have to find out how _not_ to flush
13582 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13583     output=''
13584     set try -DTRY_FPUTC
13585     if eval $compile; then
13586             $rm -f try.out
13587             ./try$exe_ext 2>/dev/null
13588             if $test ! -s try.out -a "X$?" = X42; then
13589                 output=-DTRY_FPUTC
13590             fi
13591     fi
13592     case "$output" in
13593     '')
13594             set try -DTRY_FPRINTF
13595             $rm -f try.out
13596             if eval $compile; then
13597                     $rm -f try.out
13598                     ./try$exe_ext 2>/dev/null
13599                     if $test ! -s try.out -a "X$?" = X42; then
13600                         output=-DTRY_FPRINTF
13601                     fi
13602             fi
13603         ;;
13604     esac
13605 fi
13606 : check for fflush NULL behaviour
13607 case "$fflushNULL" in
13608 '')     set try -DTRY_FFLUSH_NULL $output
13609         if eval $compile; then
13610                 $rm -f try.out
13611                 ./try$exe_ext 2>/dev/null
13612                 code="$?"
13613                 if $test -s try.out -a "X$code" = X42; then
13614                         fflushNULL="`$cat try.out`"
13615                 else
13616                         if $test "X$code" != X42; then
13617                                 $cat >&4 <<EOM
13618 (If this test failed, don't worry, we'll try another method shortly.)
13619 EOM
13620                         fi
13621                 fi
13622         fi
13623         $rm -f core try.core core.try.*
13624         case "$fflushNULL" in
13625         x)      $cat >&4 <<EOM
13626 Your fflush(NULL) works okay for output streams.
13627 Let's see if it clobbers input pipes...
13628 EOM
13629 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13630 # bug that improperly flushes the input end of pipes.  So we avoid the
13631 # autoflush on fork/system/exec support for now. :-(
13632 $cat >tryp.c <<EOCP
13633 #include <stdio.h>
13634 int
13635 main(int argc, char **argv)
13636 {
13637     char buf[1024];
13638     int i;
13639     char *bp = buf;
13640     while (1) {
13641         while ((i = getc(stdin)) != -1
13642                && (*bp++ = i) != '\n'
13643                && bp < &buf[1024])
13644         /* DO NOTHING */ ;
13645         *bp = '\0';
13646         fprintf(stdout, "%s", buf);
13647         fflush(NULL);
13648         if (i == -1)
13649             return 0;
13650         bp = buf;
13651     }
13652 }
13653 EOCP
13654                 fflushNULL="$define"
13655                 set tryp
13656                 if eval $compile; then
13657                     $rm -f tryp.out
13658                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13659                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13660                        $cat >&4 <<EOM
13661 fflush(NULL) seems to behave okay with input streams.
13662 EOM
13663                         fflushNULL="$define"
13664                     else
13665                         $cat >&4 <<EOM
13666 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13667 EOM
13668                         fflushNULL="$undef"
13669                     fi
13670                 fi
13671                 $rm -f core tryp.c tryp.core core.tryp.*
13672                 ;;
13673         '')     $cat >&4 <<EOM
13674 Your fflush(NULL) isn't working (contrary to ANSI C).
13675 EOM
13676                 fflushNULL="$undef"
13677                 ;;
13678         *)      $cat >&4 <<EOM
13679 Cannot figure out whether your fflush(NULL) works or not.
13680 I'm assuming it doesn't (contrary to ANSI C).
13681 EOM
13682                 fflushNULL="$undef"
13683                 ;;
13684         esac
13685         ;;
13686 $define|true|[yY]*)
13687         fflushNULL="$define"
13688         ;;
13689 *)
13690         fflushNULL="$undef"
13691         ;;
13692 esac
13693 : check explicit looping only if NULL did not work, and if the pipe
13694 : bug does not show up on an explicit flush too
13695 case "$fflushNULL" in
13696 "$undef")
13697         $cat >tryp.c <<EOCP
13698 #include <stdio.h>
13699 int
13700 main(int argc, char **argv)
13701 {
13702     char buf[1024];
13703     int i;
13704     char *bp = buf;
13705     while (1) {
13706         while ((i = getc(stdin)) != -1
13707                && (*bp++ = i) != '\n'
13708                && bp < &buf[1024])
13709         /* DO NOTHING */ ;
13710         *bp = '\0';
13711         fprintf(stdout, "%s", buf);
13712         fflush(stdin);
13713         if (i == -1)
13714             return 0;
13715         bp = buf;
13716     }
13717 }
13718 EOCP
13719         set tryp
13720         if eval $compile; then
13721             $rm -f tryp.out
13722             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13723             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13724                $cat >&4 <<EOM
13725 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13726 EOM
13727                 : now check for fflushall behaviour
13728                 case "$fflushall" in
13729                 '')     set try -DTRY_FFLUSH_ALL $output
13730                         if eval $compile; then
13731                                 $cat >&4 <<EOM
13732 (Now testing the other method--but note that this also may fail.)
13733 EOM
13734                                 $rm -f try.out
13735                                 ./try$exe_ext 2>/dev/null
13736                                 if $test -s try.out -a "X$?" = X42; then
13737                                         fflushall="`$cat try.out`"
13738                                 fi
13739                         fi
13740                         $rm -f core try.core core.try.*
13741                         case "$fflushall" in
13742                         x)      $cat >&4 <<EOM
13743 Whew. Flushing explicitly all the stdio streams works.
13744 EOM
13745                                 fflushall="$define"
13746                                 ;;
13747                         '')     $cat >&4 <<EOM
13748 Sigh. Flushing explicitly all the stdio streams doesn't work.
13749 EOM
13750                                 fflushall="$undef"
13751                                 ;;
13752                         *)      $cat >&4 <<EOM
13753 Cannot figure out whether flushing stdio streams explicitly works or not.
13754 I'm assuming it doesn't.
13755 EOM
13756                                 fflushall="$undef"
13757                                 ;;
13758                         esac
13759                         ;;
13760                 "$define"|true|[yY]*)
13761                         fflushall="$define"
13762                         ;;
13763                 *)
13764                         fflushall="$undef"
13765                         ;;
13766                 esac
13767             else
13768                 $cat >&4 <<EOM
13769 All is futile.  Even fflush(stdin) clobbers input pipes!
13770 EOM
13771                 fflushall="$undef"
13772             fi
13773         else
13774             fflushall="$undef"
13775         fi
13776         $rm -f core tryp.c tryp.core core.tryp.*
13777         ;;
13778 *)      fflushall="$undef"
13779         ;;
13780 esac
13781
13782 case "$fflushNULL$fflushall" in
13783 undefundef)
13784         $cat <<EOM
13785 OK, I give up.  I cannot figure out how to flush pending stdio output.
13786 We won't be flushing handles at all before fork/exec/popen.
13787 EOM
13788         ;;
13789 esac
13790 $rm -f try.* try$exe_ext
13791
13792 : Store the full pathname to the ar program for use in the C program
13793 : Respect a hint or command line value for full_ar.
13794 case "$full_ar" in
13795 '') full_ar=$ar ;;
13796 esac
13797
13798 : Store the full pathname to the sed program for use in the C program
13799 full_sed=$sed
13800
13801 : see what type gids are declared as in the kernel
13802 echo " "
13803 echo "Looking for the type for group ids returned by getgid()."
13804 set gid_t gidtype xxx stdio.h sys/types.h
13805 eval $typedef
13806 case "$gidtype" in
13807 xxx)
13808         xxx=`./findhdr sys/user.h`
13809         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13810         case $1 in
13811         unsigned) dflt="$1 $2" ;;
13812         *) dflt="$1" ;;
13813         esac
13814         ;;
13815 *) dflt="$gidtype";;
13816 esac
13817 case "$gidtype" in
13818 gid_t) echo "gid_t found." ;;
13819 *)      rp="What is the type for group ids returned by getgid()?"
13820         . ./myread
13821         gidtype="$ans"
13822         ;;
13823 esac
13824
13825 echo " "
13826 case "$gidtype" in
13827 *_t) zzz="$gidtype"     ;;
13828 *)   zzz="gid"          ;;
13829 esac
13830 echo "Checking the size of $zzz..." >&4 
13831 cat > try.c <<EOCP
13832 #include <sys/types.h>
13833 #include <stdio.h>
13834 int main() {
13835     printf("%d\n", (int)sizeof($gidtype));
13836     exit(0);
13837 }
13838 EOCP
13839 set try
13840 if eval $compile_ok; then
13841         yyy=`./try`
13842         case "$yyy" in
13843         '')     gidsize=4
13844                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13845                 ;;
13846         *)      gidsize=$yyy
13847                 echo "Your $zzz is $gidsize bytes long."
13848                 ;;
13849         esac
13850 else
13851         gidsize=4
13852         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13853 fi
13854
13855
13856 echo " "
13857 case "$gidtype" in
13858 *_t) zzz="$gidtype"     ;;
13859 *)   zzz="gid"          ;;
13860 esac
13861 echo "Checking the sign of $zzz..." >&4 
13862 cat > try.c <<EOCP
13863 #include <sys/types.h>
13864 #include <stdio.h>
13865 int main() {
13866         $gidtype foo = -1;
13867         if (foo < 0)
13868                 printf("-1\n");
13869         else
13870                 printf("1\n");
13871 }
13872 EOCP
13873 set try
13874 if eval $compile; then
13875         yyy=`./try`
13876         case "$yyy" in
13877         '')     gidsign=1
13878                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13879                 ;;
13880         *)      gidsign=$yyy
13881                 case "$gidsign" in
13882                  1) echo "Your $zzz is unsigned." ;;
13883                 -1) echo "Your $zzz is signed."   ;;
13884                 esac
13885                 ;;
13886         esac
13887 else
13888         gidsign=1
13889         echo "(I can't compile the test program--guessing unsigned.)" >&4
13890 fi
13891
13892
13893 echo " "
13894
13895 if $test X"$quadtype" != X; then
13896
13897 echo "Checking how to print 64-bit integers..." >&4
13898
13899 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13900         $cat >try.c <<'EOCP'
13901 #include <sys/types.h>
13902 #include <stdio.h>
13903 int main() {
13904   int q = 12345678901;
13905   printf("%ld\n", q);
13906 }
13907 EOCP
13908         set try
13909         if eval $compile; then
13910                 yyy=`./try$exe_ext`
13911                 case "$yyy" in
13912                 12345678901)
13913                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13914                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13915                         echo "We will use %d."
13916                         ;;
13917                 esac
13918         fi
13919 fi
13920
13921 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13922         $cat >try.c <<'EOCP'
13923 #include <sys/types.h>
13924 #include <stdio.h>
13925 int main() {
13926   long q = 12345678901;
13927   printf("%ld\n", q);
13928 }
13929 EOCP
13930         set try
13931         if eval $compile; then
13932                 yyy=`./try$exe_ext`
13933                 case "$yyy" in
13934                 12345678901)
13935                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13936                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13937                         echo "We will use %ld."
13938                         ;;
13939                 esac
13940         fi
13941 fi
13942
13943 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13944         $cat >try.c <<'EOCP'
13945 #include <sys/types.h>
13946 #include <inttypes.h>
13947 #include <stdio.h>
13948 int main() {
13949   int64_t q = 12345678901;
13950   printf("%" PRId64 "\n", q);
13951 }
13952 EOCP
13953         set try
13954         if eval $compile; then
13955                 yyy=`./try$exe_ext`
13956                 case "$yyy" in
13957                 12345678901)
13958                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13959                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13960                         echo "We will use the C9X style."
13961                         ;;
13962                 esac
13963         fi
13964 fi
13965
13966 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13967         $cat >try.c <<EOCP
13968 #include <sys/types.h>
13969 #include <stdio.h>
13970 int main() {
13971   $quadtype q = 12345678901;
13972   printf("%Ld\n", q);
13973 }
13974 EOCP
13975         set try
13976         if eval $compile; then
13977                 yyy=`./try$exe_ext`
13978                 case "$yyy" in
13979                 12345678901)
13980                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13981                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13982                         echo "We will use %Ld."
13983                         ;;
13984                 esac
13985         fi
13986 fi
13987
13988 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13989         $cat >try.c <<'EOCP'
13990 #include <sys/types.h>
13991 #include <stdio.h>
13992 int main() {
13993   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13994   printf("%lld\n", q);
13995 }
13996 EOCP
13997         set try
13998         if eval $compile; then
13999                 yyy=`./try$exe_ext`
14000                 case "$yyy" in
14001                 12345678901)
14002                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14003                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14004                         echo "We will use the %lld style."
14005                         ;;
14006                 esac
14007         fi
14008 fi
14009
14010 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14011         $cat >try.c <<EOCP
14012 #include <sys/types.h>
14013 #include <stdio.h>
14014 int main() {
14015   $quadtype q = 12345678901;
14016   printf("%qd\n", q);
14017 }
14018 EOCP
14019         set try
14020         if eval $compile; then
14021                 yyy=`./try$exe_ext`
14022                 case "$yyy" in
14023                 12345678901)
14024                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14025                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14026                         echo "We will use %qd."
14027                         ;;
14028                 esac
14029         fi
14030 fi
14031
14032 if $test X"$sPRId64" = X; then
14033         echo "Cannot figure out how to print 64-bit integers." >&4
14034 fi
14035
14036 $rm -f try try.*
14037
14038 fi
14039
14040 case "$sPRId64" in
14041 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14042         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14043         ;;
14044 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14045         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14046         ;;
14047 esac
14048
14049
14050 echo " "
14051 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14052
14053 if $test X"$ivsize" = X8; then
14054         ivdformat="$sPRId64"
14055         uvuformat="$sPRIu64"
14056         uvoformat="$sPRIo64"
14057         uvxformat="$sPRIx64"
14058         uvXUformat="$sPRIXU64"
14059 else
14060         if $test X"$ivsize" = X"$longsize"; then
14061                 ivdformat='"ld"'
14062                 uvuformat='"lu"'
14063                 uvoformat='"lo"'
14064                 uvxformat='"lx"'
14065                 uvXUformat='"lX"'
14066         else
14067                 if $test X"$ivsize" = X"$intsize"; then
14068                         ivdformat='"d"'
14069                         uvuformat='"u"'
14070                         uvoformat='"o"'
14071                         uvxformat='"x"'
14072                         uvXUformat='"X"'
14073                 else
14074                         : far out
14075                         if $test X"$ivsize" = X"$shortsize"; then
14076                                 ivdformat='"hd"'
14077                                 uvuformat='"hu"'
14078                                 uvoformat='"ho"'
14079                                 uvxformat='"hx"'
14080                                 uvXUformat='"hX"'
14081                         fi
14082                 fi
14083         fi
14084 fi
14085
14086 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14087         nveformat="$sPRIeldbl"
14088         nvfformat="$sPRIfldbl"
14089         nvgformat="$sPRIgldbl"
14090         nvEUformat="$sPRIEUldbl"
14091         nvFUformat="$sPRIFUldbl"
14092         nvGUformat="$sPRIGUldbl"
14093 else
14094         nveformat='"e"'
14095         nvfformat='"f"'
14096         nvgformat='"g"'
14097         nvEUformat='"E"'
14098         nvFUformat='"F"'
14099         nvGUformat='"G"'
14100 fi
14101
14102 case "$ivdformat" in
14103 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14104     exit 1
14105     ;;
14106 esac
14107
14108
14109 echo " "
14110 $echo "Checking the format string to be used for gids..." >&4
14111
14112 case "$gidsign" in
14113 -1)     if $test X"$gidsize" = X"$ivsize"; then
14114                 gidformat="$ivdformat"
14115         else
14116                 if $test X"$gidsize" = X"$longsize"; then
14117                         gidformat='"ld"'
14118                 else
14119                         if $test X"$gidsize" = X"$intsize"; then
14120                                 gidformat='"d"'
14121                         else
14122                                 if $test X"$gidsize" = X"$shortsize"; then
14123                                         gidformat='"hd"'
14124                                 fi
14125                         fi
14126                 fi
14127         fi
14128         ;;
14129 *)      if $test X"$gidsize" = X"$uvsize"; then
14130                 gidformat="$uvuformat"
14131         else
14132                 if $test X"$gidsize" = X"$longsize"; then
14133                         gidformat='"lu"'
14134                 else
14135                         if $test X"$gidsize" = X"$intsize"; then
14136                                 gidformat='"u"'
14137                         else
14138                                 if $test X"$gidsize" = X"$shortsize"; then
14139                                         gidformat='"hu"'
14140                                 fi
14141                         fi
14142                 fi
14143         fi
14144         ;;
14145 esac
14146
14147 : see if getgroups exists
14148 set getgroups d_getgrps
14149 eval $inlibc
14150
14151 : see if setgroups exists
14152 set setgroups d_setgrps
14153 eval $inlibc
14154
14155
14156 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14157 echo " "
14158 case "$d_getgrps$d_setgrps" in
14159 *define*)
14160         case "$groupstype" in
14161         '') dflt="$gidtype" ;;
14162         *)  dflt="$groupstype" ;;
14163         esac
14164         $cat <<EOM
14165 What type of pointer is the second argument to getgroups() and setgroups()?
14166 Usually this is the same as group ids, $gidtype, but not always.
14167
14168 EOM
14169         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14170         . ./myread
14171         groupstype="$ans"
14172         ;;
14173 *)  groupstype="$gidtype";;
14174 esac
14175
14176 echo " "
14177 echo "Checking if your $make program sets \$(MAKE)..." >&4
14178 case "$make_set_make" in
14179 '')
14180         $sed 's/^X //' > testmake.mak << 'EOF'
14181 Xall:
14182 X       @echo 'maketemp="$(MAKE)"'
14183 EOF
14184         case "`$make -f testmake.mak 2>/dev/null`" in
14185         *maketemp=*) make_set_make='#' ;;
14186         *)      make_set_make="MAKE=$make" ;;
14187         esac
14188         $rm -f testmake.mak
14189         ;;
14190 esac
14191 case "$make_set_make" in
14192 '#') echo "Yup, it does.";;
14193 *) echo "Nope, it doesn't.";;
14194 esac
14195
14196 : see what type is used for mode_t
14197 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14198 set mode_t modetype int stdio.h sys/types.h
14199 eval $typedef_ask
14200
14201 : see if stdarg is available
14202 echo " "
14203 if $test `./findhdr stdarg.h`; then
14204         echo "<stdarg.h> found." >&4
14205         valstd="$define"
14206 else
14207         echo "<stdarg.h> NOT found." >&4
14208         valstd="$undef"
14209 fi
14210
14211 : see if varags is available
14212 echo " "
14213 if $test `./findhdr varargs.h`; then
14214         echo "<varargs.h> found." >&4
14215 else
14216         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14217 fi
14218
14219 : set up the varargs testing programs
14220 $cat > varargs.c <<EOP
14221 #ifdef I_STDARG
14222 #include <stdarg.h>
14223 #endif
14224 #ifdef I_VARARGS
14225 #include <varargs.h>
14226 #endif
14227
14228 #ifdef I_STDARG
14229 int f(char *p, ...)
14230 #else
14231 int f(va_alist)
14232 va_dcl
14233 #endif
14234 {
14235         va_list ap;
14236 #ifndef I_STDARG
14237         char *p;
14238 #endif
14239 #ifdef I_STDARG
14240         va_start(ap,p);
14241 #else
14242         va_start(ap);
14243         p = va_arg(ap, char *);
14244 #endif
14245         va_end(ap);
14246 }
14247 EOP
14248 $cat > varargs <<EOP
14249 $startsh
14250 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14251         echo "true"
14252 else
14253         echo "false"
14254 fi
14255 $rm -f varargs$_o
14256 EOP
14257 chmod +x varargs
14258
14259 : now check which varargs header should be included
14260 echo " "
14261 i_varhdr=''
14262 case "$valstd" in
14263 "$define")
14264         if `./varargs I_STDARG`; then
14265                 val='stdarg.h'
14266         elif `./varargs I_VARARGS`; then
14267                 val='varargs.h'
14268         fi
14269         ;;
14270 *)
14271         if `./varargs I_VARARGS`; then
14272                 val='varargs.h'
14273         fi
14274         ;;
14275 esac
14276 case "$val" in
14277 '')
14278 echo "I could not find the definition for va_dcl... You have problems..." >&4
14279         val="$undef"; set i_stdarg; eval $setvar
14280         val="$undef"; set i_varargs; eval $setvar
14281         ;;
14282 *) 
14283         set i_varhdr
14284         eval $setvar
14285         case "$i_varhdr" in
14286         stdarg.h)
14287                 val="$define"; set i_stdarg; eval $setvar
14288                 val="$undef"; set i_varargs; eval $setvar
14289                 ;;
14290         varargs.h)
14291                 val="$undef"; set i_stdarg; eval $setvar
14292                 val="$define"; set i_varargs; eval $setvar
14293                 ;;
14294         esac
14295         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14296 esac
14297 $rm -f varargs*
14298
14299 : see if we need va_copy
14300 echo " "
14301 case "$i_stdarg" in
14302 "$define")
14303         $cat >try.c <<EOCP
14304 #include <stdarg.h>
14305 #include <stdio.h>
14306 #$i_stdlib I_STDLIB
14307 #ifdef I_STDLIB
14308 #include <stdlib.h>
14309 #endif
14310 #include <signal.h>
14311
14312 int
14313 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14314 {
14315   return vfprintf(f, fmt, *valp);
14316 }
14317  
14318 int    
14319 myvfprintf(FILE *f, const  char *fmt, va_list val)
14320 {
14321   return ivfprintf(f, fmt, &val);
14322 }
14323       
14324 int
14325 myprintf(char *fmt, ...) 
14326 {
14327   va_list val;
14328   va_start(val, fmt);
14329   return myvfprintf(stdout, fmt, val); 
14330 }         
14331
14332 int
14333 main(int ac, char **av)
14334 {
14335   signal(SIGSEGV, exit);
14336
14337   myprintf("%s%cs all right, then\n", "that", '\'');                            
14338   exit(0);      
14339 }
14340 EOCP
14341         set try
14342         if eval $compile && ./try 2>&1 >/dev/null; then
14343                 case "`./try`" in
14344                 "that's all right, then")
14345                         okay=yes
14346                         ;;
14347                 esac
14348         fi
14349         case "$okay" in
14350         yes)    echo "It seems that you don't need va_copy()." >&4
14351                 need_va_copy="$undef"
14352                 ;;
14353         *)      echo "It seems that va_copy() or similar will be needed." >&4
14354                 need_va_copy="$define"
14355                 ;;
14356         esac
14357         $rm -f try.* core core.* *.core *.core.*
14358         ;;
14359 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14360         ;;
14361 esac
14362
14363 : define a fucntion to check prototypes
14364 $cat > protochk <<EOSH
14365 $startsh
14366 cc="$cc"
14367 optimize="$optimize"
14368 ccflags="$ccflags"
14369 prototype="$prototype"
14370 define="$define"
14371 rm=$rm
14372 EOSH
14373
14374 $cat >> protochk <<'EOSH'
14375
14376 $rm -f try.c
14377 foo="$1"
14378 shift
14379 while test $# -ge 2; do
14380         case "$1" in
14381                 $define) echo "#include <$2>" >> try.c ;;
14382                 literal) echo "$2" >> try.c ;;
14383         esac
14384     shift 2
14385 done
14386 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14387 cat >> try.c <<'EOCP'
14388 #ifdef CAN_PROTOTYPE
14389 #define _(args) args
14390 #else
14391 #define _(args) ()
14392 #endif
14393 EOCP
14394 echo "$foo" >> try.c
14395 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14396 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14397 status=$?
14398 $rm -f try.[co]
14399 exit $status
14400 EOSH
14401 chmod +x protochk
14402 $eunicefix protochk
14403
14404 : see what type is used for size_t
14405 rp="What is the type used for the length parameter for string functions?"
14406 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14407 eval $typedef_ask
14408
14409 : check for type of arguments to gethostbyaddr. 
14410 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14411         case "$d_gethbyaddr" in
14412         $define)
14413                 $cat <<EOM
14414
14415 Checking to see what type of arguments are accepted by gethostbyaddr().
14416 EOM
14417                 hdrs="$define sys/types.h
14418                         $d_socket sys/socket.h 
14419                         $i_niin netinet/in.h 
14420                         $i_netdb netdb.h
14421                         $i_unistd unistd.h"
14422                 : The first arg can 'char *' or 'void *'
14423                 : The second arg is some of integral type
14424                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14425                         for yyy in size_t long int; do
14426                                 case "$netdb_host_type" in
14427                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14428                                         if ./protochk "$try" $hdrs; then
14429                                                 echo "Your system accepts $xxx for the first arg."
14430                                                 echo "...and $yyy for the second arg."
14431                                                 netdb_host_type="$xxx"
14432                                                 netdb_hlen_type="$yyy"
14433                                         fi
14434                                         ;;
14435                                 esac
14436                         done
14437                 done
14438                 : In case none of those worked, prompt the user.
14439                 case "$netdb_host_type" in
14440                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14441                         dflt='char *'
14442                         . ./myread
14443                         netdb_host_type=$ans
14444                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14445                         dflt="$sizetype"
14446                         . ./myread
14447                         netdb_hlen_type=$ans
14448                         ;;
14449                 esac
14450                 ;;
14451         *)      : no gethostbyaddr, so pick harmless defaults
14452                 netdb_host_type='char *'
14453                 netdb_hlen_type="$sizetype"
14454                 ;;
14455         esac
14456         # Remove the "const" if needed. -- but then we'll have a 
14457         # prototype clash!
14458         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14459 fi
14460
14461 : check for type of argument to gethostbyname. 
14462 if test "X$netdb_name_type" = X ; then
14463         case "$d_gethbyname" in
14464         $define)
14465                 $cat <<EOM
14466
14467 Checking to see what type of argument is accepted by gethostbyname().
14468 EOM
14469                 hdrs="$define sys/types.h
14470                         $d_socket sys/socket.h 
14471                         $i_niin netinet/in.h 
14472                         $i_netdb netdb.h
14473                         $i_unistd unistd.h"
14474                 for xxx in "const char *" "char *"; do
14475                         case "$netdb_name_type" in
14476                         '')     try="extern struct hostent *gethostbyname($xxx);"
14477                                 if ./protochk "$try" $hdrs; then
14478                                         echo "Your system accepts $xxx."
14479                                         netdb_name_type="$xxx"
14480                                 fi
14481                                 ;;
14482                         esac
14483                 done
14484                 : In case none of those worked, prompt the user.
14485                 case "$netdb_name_type" in
14486                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14487                         dflt='char *'
14488                         . ./myread
14489                         netdb_name_type=$ans
14490                         ;;
14491                 esac
14492                 ;;
14493         *)      : no gethostbyname, so pick harmless default
14494                 netdb_name_type='char *'
14495                 ;;
14496         esac
14497 fi
14498
14499 : check for type of 1st argument to getnetbyaddr. 
14500 if test "X$netdb_net_type" = X ; then
14501         case "$d_getnbyaddr" in
14502         $define)
14503                 $cat <<EOM
14504
14505 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14506 EOM
14507                 hdrs="$define sys/types.h
14508                         $d_socket sys/socket.h 
14509                         $i_niin netinet/in.h 
14510                         $i_netdb netdb.h
14511                         $i_unistd unistd.h"
14512                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14513                         case "$netdb_net_type" in
14514                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14515                                 if ./protochk "$try" $hdrs; then
14516                                         echo "Your system accepts $xxx."
14517                                         netdb_net_type="$xxx"
14518                                 fi
14519                                 ;;
14520                         esac
14521                 done
14522                 : In case none of those worked, prompt the user.
14523                 case "$netdb_net_type" in
14524                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14525                         dflt='long'
14526                         . ./myread
14527                         netdb_net_type=$ans
14528                         ;;
14529                 esac
14530                 ;;
14531         *)      : no getnetbyaddr, so pick harmless default
14532                 netdb_net_type='long'
14533                 ;;
14534         esac
14535 fi
14536 : locate the preferred pager for this system
14537 case "$pager" in
14538 '')
14539         dflt=''
14540         case "$pg" in
14541         /*) dflt=$pg;;
14542         [a-zA-Z]:/*) dflt=$pg;;
14543         esac
14544         case "$more" in
14545         /*) dflt=$more;;
14546         [a-zA-Z]:/*) dflt=$more;;
14547         esac
14548         case "$less" in
14549         /*) dflt=$less;;
14550         [a-zA-Z]:/*) dflt=$less;;
14551         esac
14552         case "$dflt" in
14553         '') dflt=/usr/ucb/more;;
14554         esac
14555         ;;
14556 *) dflt="$pager";;
14557 esac
14558 echo " "
14559 fn=f/
14560 rp='What pager is used on your system?'
14561 . ./getfile
14562 pager="$ans"
14563
14564 : see what type pids are declared as in the kernel
14565 rp="What is the type of process ids on this system?"
14566 set pid_t pidtype int stdio.h sys/types.h
14567 eval $typedef_ask
14568
14569 : Find earliest binary compatible site_perl subdirectory perl can use.
14570 case "$bincompat5005" in
14571 "$define") xs_apiversion='5.005' ;;
14572 *) xs_apiversion=$version ;;   # The current site_perl version.
14573 esac
14574 : Find earliest pure perl site_perl subdirectory perl can use.
14575 : The versioned directories started at 5.005.
14576 pm_apiversion='5.005'
14577
14578 : see if ar generates random libraries by itself
14579 echo " "
14580 echo "Checking how to generate random libraries on your machine..." >&4
14581 echo 'int bar1() { return bar2(); }' > bar1.c
14582 echo 'int bar2() { return 2; }' > bar2.c
14583 $cat > foo.c <<'EOP'
14584 int main() { printf("%d\n", bar1()); exit(0); }
14585 EOP
14586 $cc $ccflags -c bar1.c >/dev/null 2>&1
14587 $cc $ccflags -c bar2.c >/dev/null 2>&1
14588 $cc $ccflags -c foo.c >/dev/null 2>&1
14589 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14590 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14591         ./foobar >/dev/null 2>&1; then
14592         echo "$ar appears to generate random libraries itself."
14593         orderlib=false
14594         ranlib=":"
14595 elif $ar ts bar$_a >/dev/null 2>&1 &&
14596         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14597         ./foobar >/dev/null 2>&1; then
14598                 echo "a table of contents needs to be added with '$ar ts'."
14599                 orderlib=false
14600                 ranlib="$ar ts"
14601 else
14602         case "$ranlib" in
14603         :) ranlib='';;
14604         '')
14605                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14606                 $test -f $ranlib || ranlib=''
14607                 ;;
14608         esac
14609         if $test -n "$ranlib"; then
14610                 echo "your system has '$ranlib'; we'll use that."
14611                 orderlib=false
14612         else
14613                 echo "your system doesn't seem to support random libraries"
14614                 echo "so we'll use lorder and tsort to order the libraries."
14615                 orderlib=true
14616                 ranlib=":"
14617         fi
14618 fi
14619 $rm -f foo* bar* 
14620
14621 : check for type of arguments to select. 
14622 case "$selecttype" in
14623 '') case "$d_select" in
14624         $define)
14625                 echo " "
14626                 $cat <<EOM
14627 Checking to see what type of arguments are accepted by select().
14628 EOM
14629                 hdrs="$define sys/types.h
14630                         $i_systime sys/time.h 
14631                         $i_sysselct sys/select.h
14632                         $d_socket sys/socket.h"
14633                 : The first arg can be int, unsigned, or size_t
14634                 : The last arg may or may not be 'const'
14635                 val=''
14636                 : void pointer has been seen but using that
14637                 : breaks the selectminbits test
14638                 for xxx in 'fd_set *' 'int *'; do
14639                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14640                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14641                                         case "$val" in
14642                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14643                                                 if ./protochk "$try" $hdrs; then
14644                                                         echo "Your system accepts $xxx."
14645                                                         val="$xxx"
14646                                                 fi
14647                                                 ;;
14648                                         esac
14649                                 done
14650                         done
14651                 done
14652                 case "$val" in
14653                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14654                         case "$d_fd_set" in
14655                                 $define) dflt="fd_set *" ;;
14656                                 *)              dflt="int *" ;;
14657                         esac
14658                         . ./myread
14659                         val=$ans
14660                         ;;
14661                 esac
14662                 selecttype="$val"
14663                 ;;
14664         *)      : no select, so pick a harmless default
14665                 selecttype='int *'
14666                 ;;
14667         esac
14668         ;;
14669 esac
14670
14671 : check for the select 'width'
14672 case "$selectminbits" in
14673 '') case "$d_select" in
14674         $define)
14675                 $cat <<EOM
14676
14677 Checking to see on how many bits at a time your select() operates...
14678 EOM
14679                 $cat >try.c <<EOCP
14680 #include <sys/types.h>
14681 #$i_time I_TIME
14682 #$i_systime I_SYS_TIME
14683 #$i_systimek I_SYS_TIME_KERNEL
14684 #ifdef I_TIME
14685 #   include <time.h>
14686 #endif
14687 #ifdef I_SYS_TIME
14688 #   ifdef I_SYS_TIME_KERNEL
14689 #       define KERNEL
14690 #   endif
14691 #   include <sys/time.h>
14692 #   ifdef I_SYS_TIME_KERNEL
14693 #       undef KERNEL
14694 #   endif
14695 #endif
14696 #$i_sysselct I_SYS_SELECT
14697 #ifdef I_SYS_SELECT
14698 #include <sys/select.h>
14699 #endif
14700 #$d_socket HAS_SOCKET
14701 #ifdef HAS_SOCKET
14702 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14703 #endif
14704 #include <stdio.h>
14705 $selecttype b;
14706 #define S sizeof(*(b))
14707 #define MINBITS 64
14708 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14709 #define NBITS  (NBYTES * 8)
14710 int main() {
14711     char s[NBYTES];
14712     struct timeval t;
14713     int i;
14714     FILE* fp;
14715     int fd;
14716
14717     fclose(stdin);
14718     fp = fopen("try.c", "r");
14719     if (fp == 0)
14720       exit(1);
14721     fd = fileno(fp);
14722     if (fd < 0)
14723       exit(2);
14724     b = ($selecttype)s;
14725     for (i = 0; i < NBITS; i++)
14726         FD_SET(i, b);
14727     t.tv_sec  = 0;
14728     t.tv_usec = 0;
14729     select(fd + 1, b, 0, 0, &t);
14730     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14731     printf("%d\n", i + 1);
14732     return 0;
14733 }
14734 EOCP
14735                 set try
14736                 if eval $compile_ok; then
14737                         selectminbits=`./try`
14738                         case "$selectminbits" in
14739                         '')     cat >&4 <<EOM
14740 Cannot figure out on how many bits at a time your select() operates.
14741 I'll play safe and guess it is 32 bits.
14742 EOM
14743                                 selectminbits=32
14744                                 bits="32 bits"
14745                                 ;;
14746                         1)      bits="1 bit" ;;
14747                         *)      bits="$selectminbits bits" ;;
14748                         esac
14749                         echo "Your select() operates on $bits at a time." >&4
14750                 else
14751                         rp='What is the minimum number of bits your select() operates on?'
14752                         case "$byteorder" in
14753                         1234|12345678)  dflt=32 ;;
14754                         *)              dflt=1  ;;
14755                         esac
14756                         . ./myread
14757                         val=$ans
14758                         selectminbits="$val"
14759                 fi
14760                 $rm -f try.* try
14761                 ;;
14762         *)      : no select, so pick a harmless default
14763                 selectminbits='32'
14764                 ;;
14765         esac
14766         ;;
14767 esac
14768
14769 : Trace out the files included by signal.h, then look for SIGxxx names.
14770 : Remove SIGARRAYSIZE used by HPUX.
14771 : Remove SIGSTKSIZE used by Linux.
14772 : Remove SIGSTKSZ used by Posix.
14773 : Remove SIGTYP void lines used by OS2.
14774 : Some cpps, like os390, dont give the file name anywhere
14775 if [ "X$fieldn" = X ]; then
14776         : Just make some guesses.  We check them later.
14777         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14778 else
14779         xxx=`echo '#include <signal.h>' |
14780         $cppstdin $cppminus $cppflags 2>/dev/null |
14781         $grep '^[       ]*#.*include' | 
14782         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14783 fi
14784 : Check this list of files to be sure we have parsed the cpp output ok.
14785 : This will also avoid potentially non-existent files, such 
14786 : as ../foo/bar.h
14787 xxxfiles=''
14788 for xx in $xxx /dev/null ; do
14789         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14790 done
14791 : If we have found no files, at least try signal.h
14792 case "$xxxfiles" in
14793 '')     xxxfiles=`./findhdr signal.h` ;;
14794 esac
14795 xxx=`awk '
14796 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14797         print substr($2, 4, 20)
14798 }
14799 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14800         print substr($3, 4, 20)
14801 }' $xxxfiles`
14802 : Append some common names just in case the awk scan failed.
14803 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14804 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14805 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14806 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14807 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14808
14809 : generate a few handy files for later
14810 $cat > signal.c <<'EOCP'
14811 #include <sys/types.h>
14812 #include <signal.h>
14813 #include <stdio.h>
14814 int main() {
14815
14816 /* Strange style to avoid deeply-nested #if/#else/#endif */
14817 #ifndef NSIG
14818 #  ifdef _NSIG
14819 #    define NSIG (_NSIG)
14820 #  endif
14821 #endif
14822
14823 #ifndef NSIG
14824 #  ifdef SIGMAX
14825 #    define NSIG (SIGMAX+1)
14826 #  endif
14827 #endif
14828
14829 #ifndef NSIG
14830 #  ifdef SIG_MAX
14831 #    define NSIG (SIG_MAX+1)
14832 #  endif
14833 #endif
14834
14835 #ifndef NSIG
14836 #  ifdef MAXSIG
14837 #    define NSIG (MAXSIG+1)
14838 #  endif
14839 #endif
14840
14841 #ifndef NSIG
14842 #  ifdef MAX_SIG
14843 #    define NSIG (MAX_SIG+1)
14844 #  endif
14845 #endif
14846
14847 #ifndef NSIG
14848 #  ifdef SIGARRAYSIZE
14849 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14850 #  endif
14851 #endif
14852
14853 #ifndef NSIG
14854 #  ifdef _sys_nsig
14855 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14856 #  endif
14857 #endif
14858
14859 /* Default to some arbitrary number that's big enough to get most
14860    of the common signals.
14861 */
14862 #ifndef NSIG
14863 #    define NSIG 50
14864 #endif
14865
14866 printf("NSIG %d\n", NSIG);
14867
14868 #ifndef JUST_NSIG
14869
14870 EOCP
14871
14872 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14873 {
14874         printf "#ifdef SIG"; printf $1; printf "\n"
14875         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14876         printf $1; printf ");\n"
14877         printf "#endif\n"
14878 }
14879 END {
14880         printf "#endif /* JUST_NSIG */\n";
14881         printf "exit(0);\n}\n";
14882 }
14883 ' >>signal.c
14884 $cat >signal.awk <<'EOP'
14885 BEGIN { ndups = 0 }
14886 $1 ~ /^NSIG$/ { nsig = $2 }
14887 ($1 !~ /^NSIG$/) && (NF == 2) {
14888     if ($2 > maxsig) { maxsig = $2 }
14889     if (sig_name[$2]) {
14890         dup_name[ndups] = $1
14891         dup_num[ndups] = $2
14892         ndups++ 
14893     }
14894     else {
14895         sig_name[$2] = $1
14896         sig_num[$2] = $2
14897     }
14898 }
14899 END { 
14900     if (nsig == 0) {
14901         nsig = maxsig + 1
14902     }
14903     printf("NSIG %d\n", nsig);
14904     for (n = 1; n < nsig; n++) {
14905         if (sig_name[n]) {
14906             printf("%s %d\n", sig_name[n], sig_num[n])
14907         }
14908         else {
14909             printf("NUM%d %d\n", n, n) 
14910         }
14911     }
14912     for (n = 0; n < ndups; n++) {
14913         printf("%s %d\n", dup_name[n], dup_num[n])
14914     }
14915 }
14916 EOP
14917 $cat >signal_cmd <<EOS
14918 $startsh
14919 if $test -s signal.lst; then
14920     echo "Using your existing signal.lst file"
14921         exit 0
14922 fi
14923 xxx="$xxx"
14924 EOS
14925 $cat >>signal_cmd <<'EOS'
14926
14927 set signal
14928 if eval $compile_ok; then
14929         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14930 else
14931         echo "(I can't seem be able to compile the whole test program)" >&4
14932         echo "(I'll try it in little pieces.)" >&4
14933         set signal -DJUST_NSIG
14934         if eval $compile_ok; then
14935                 ./signal$_exe > signal.nsg
14936                 $cat signal.nsg
14937         else
14938                 echo "I can't seem to figure out how many signals you have." >&4
14939                 echo "Guessing 50." >&4
14940                 echo 'NSIG 50' > signal.nsg
14941         fi
14942         : Now look at all the signal names, one at a time.
14943         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14944                 $cat > signal.c <<EOCP
14945 #include <sys/types.h>
14946 #include <signal.h>
14947 #include <stdio.h>
14948 int main() {
14949 printf("$xx %d\n", SIG${xx});
14950 return 0;
14951 }
14952 EOCP
14953                 set signal
14954                 if eval $compile; then
14955                         echo "SIG${xx} found."
14956                         ./signal$_exe  >> signal.ls1
14957                 else
14958                         echo "SIG${xx} NOT found."
14959                 fi
14960         done
14961         if $test -s signal.ls1; then
14962                 $cat signal.nsg signal.ls1 |
14963                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14964         fi
14965
14966 fi
14967 if $test -s signal.lst; then
14968         :
14969 else
14970         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14971         echo 'kill -l' >signal
14972         set X `csh -f <signal`
14973         $rm -f signal
14974         shift
14975         case $# in
14976         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14977         esac
14978         echo $@ | $tr ' ' $trnl | \
14979             $awk '{ printf "%s %d\n", $1, ++s; }
14980                   END { printf "NSIG %d\n", ++s }' >signal.lst
14981 fi
14982 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14983 EOS
14984 chmod a+x signal_cmd
14985 $eunicefix signal_cmd
14986
14987 : generate list of signal names
14988 echo " "
14989 case "$sig_name_init" in
14990 '') doinit=yes ;;
14991 *)  case "$sig_num_init" in
14992     ''|*,*) doinit=yes ;;
14993     esac ;;
14994 esac
14995 case "$doinit" in
14996 yes)
14997         echo "Generating a list of signal names and numbers..." >&4
14998         . ./signal_cmd
14999         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15000         sig_name=`$awk 'BEGIN { printf "ZERO " }
15001                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15002         sig_num=`$awk  'BEGIN { printf "0 " }
15003                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15004         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15005                              !/^NSIG/   { printf "\"%s\", ", $1 }
15006                              END        { printf "0\n" }' signal.lst`
15007         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15008                              !/^NSIG/   { printf "%d, ", $2}
15009                              END        { printf "0\n"}' signal.lst`
15010         ;;
15011 esac
15012 echo "The following $sig_count signals are available:"
15013 echo " "
15014 echo $sig_name | $awk \
15015 'BEGIN { linelen = 0 }
15016 {
15017         for (i = 1; i <= NF; i++) {
15018                 name = "SIG" $i " "
15019                 linelen = linelen + length(name)
15020                 if (linelen > 70) {
15021                         printf "\n"
15022                         linelen = length(name)
15023                 }
15024                 printf "%s", name
15025         }
15026         printf "\n"
15027 }'
15028 sig_size=`echo $sig_name | awk '{print NF}'`
15029 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15030
15031 echo " "
15032 case "$sizetype" in
15033 *_t) zzz="$sizetype"    ;;
15034 *)   zzz="filesize"     ;;
15035 esac
15036 echo "Checking the size of $zzz..." >&4 
15037 cat > try.c <<EOCP
15038 #include <sys/types.h>
15039 #include <stdio.h>
15040 int main() {
15041     printf("%d\n", (int)sizeof($sizetype));
15042     exit(0);
15043 }
15044 EOCP
15045 set try
15046 if eval $compile_ok; then
15047         yyy=`./try`
15048         case "$yyy" in
15049         '')     sizesize=4
15050                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15051                 ;;
15052         *)      sizesize=$yyy
15053                 echo "Your $zzz size is $sizesize bytes."
15054                 ;;
15055         esac
15056 else
15057         sizesize=4
15058         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15059 fi
15060
15061
15062 : check for socklen_t
15063 echo " "
15064 echo "Checking to see if you have socklen_t..." >&4
15065 $cat >try.c <<EOCP
15066 #include <sys/types.h>
15067 #$d_socket HAS_SOCKET
15068 #ifdef HAS_SOCKET
15069 #include <sys/socket.h>
15070 #endif
15071 int main() { socklen_t x = 16; }
15072 EOCP
15073 set try
15074 if eval $compile; then
15075         val="$define"
15076         echo "You have socklen_t."
15077 else
15078         val="$undef"
15079         echo "You do not have socklen_t."
15080         case "$sizetype" in
15081         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15082         esac
15083 fi
15084 $rm -f try try.*
15085 set d_socklen_t
15086 eval $setvar
15087
15088 : see if this is a socks.h system
15089 set socks.h i_socks
15090 eval $inhdr
15091
15092 : check for type of the size argument to socket calls
15093 case "$d_socket" in
15094 "$define")
15095         $cat <<EOM
15096
15097 Checking to see what type is the last argument of accept().
15098 EOM
15099         yyy=''
15100         case "$d_socklen_t" in
15101         "$define") yyy="$yyy socklen_t"
15102         esac
15103         yyy="$yyy $sizetype int long unsigned"
15104         for xxx in $yyy; do
15105                 case "$socksizetype" in
15106                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15107                         case "$usesocks" in
15108                         "$define")
15109                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15110                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15111                                         socksizetype="$xxx"
15112                                 fi
15113                                 ;;
15114                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15115                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15116                                         socksizetype="$xxx"
15117                                 fi
15118                                 ;;
15119                         esac
15120                         ;;
15121                 esac
15122         done
15123 : In case none of those worked, prompt the user.
15124         case "$socksizetype" in
15125         '')     rp='What is the type for socket address structure sizes?'
15126                 dflt='int'
15127                 . ./myread
15128                 socksizetype=$ans
15129                 ;;
15130         esac
15131         ;;
15132 *)      : no sockets, so pick relatively harmless default
15133         socksizetype='int'
15134         ;;
15135 esac
15136
15137 : see what type is used for signed size_t
15138 set ssize_t ssizetype int stdio.h sys/types.h
15139 eval $typedef
15140 dflt="$ssizetype"
15141 $cat > ssize.c <<EOM
15142 #include <stdio.h>
15143 #include <sys/types.h>
15144 #define Size_t $sizetype
15145 #define SSize_t $dflt
15146 int main()
15147 {
15148         if (sizeof(Size_t) == sizeof(SSize_t))
15149                 printf("$dflt\n");
15150         else if (sizeof(Size_t) == sizeof(int))
15151                 printf("int\n");
15152         else 
15153                 printf("long\n");
15154         exit(0);
15155 }
15156 EOM
15157 echo " "
15158 set ssize
15159 if eval $compile_ok && ./ssize > /dev/null; then
15160         ssizetype=`./ssize`
15161         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15162 else
15163         $cat >&4 <<EOM
15164 Help! I can't compile and run the ssize_t test program: please enlighten me!
15165 (This is probably a misconfiguration in your system or libraries, and
15166 you really ought to fix it.  Still, I'll try anyway.)
15167
15168 I need a type that is the same size as $sizetype, but is guaranteed to
15169 be signed.  Common values are ssize_t, int and long.
15170
15171 EOM
15172         rp="What signed type is the same size as $sizetype?"
15173         . ./myread
15174         ssizetype="$ans"
15175 fi
15176 $rm -f ssize ssize.*
15177
15178 : see what type of char stdio uses.
15179 echo " "
15180 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15181 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15182         echo "Your stdio uses unsigned chars." >&4
15183         stdchar="unsigned char"
15184 else
15185         echo "Your stdio uses signed chars." >&4
15186         stdchar="char"
15187 fi
15188 $rm -f stdioh
15189
15190
15191
15192 : see if time exists
15193 echo " "
15194 if test "X$d_time" = X -o X"$timetype" = X; then
15195     if set time val -f d_time; eval $csym; $val; then
15196                 echo 'time() found.' >&4
15197                 val="$define"
15198                 rp="What is the type returned by time() on this system?"
15199                 set time_t timetype long stdio.h sys/types.h
15200                 eval $typedef_ask
15201     else
15202                 echo 'time() not found, hope that will do.' >&4
15203                 val="$undef"
15204                 timetype='int';
15205     fi
15206     set d_time
15207     eval $setvar
15208 fi
15209
15210 : see what type uids are declared as in the kernel
15211 echo " "
15212 echo "Looking for the type for user ids returned by getuid()."
15213 set uid_t uidtype xxx stdio.h sys/types.h
15214 eval $typedef
15215 case "$uidtype" in
15216 xxx)
15217         xxx=`./findhdr sys/user.h`
15218         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15219         case $1 in
15220         unsigned) dflt="$1 $2" ;;
15221         *) dflt="$1" ;;
15222         esac
15223         ;;
15224 *) dflt="$uidtype";;
15225 esac
15226 case "$uidtype" in
15227 uid_t)  echo "uid_t found." ;;
15228 *)      rp="What is the type for user ids returned by getuid()?"
15229         . ./myread
15230         uidtype="$ans"
15231         ;;
15232 esac
15233
15234 echo " "
15235 case "$uidtype" in
15236 *_t) zzz="$uidtype"     ;;
15237 *)   zzz="uid"          ;;
15238 esac
15239 echo "Checking the size of $zzz..." >&4 
15240 cat > try.c <<EOCP
15241 #include <sys/types.h>
15242 #include <stdio.h>
15243 int main() {
15244     printf("%d\n", (int)sizeof($uidtype));
15245     exit(0);
15246 }
15247 EOCP
15248 set try
15249 if eval $compile_ok; then
15250         yyy=`./try`
15251         case "$yyy" in
15252         '')     uidsize=4
15253                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15254                 ;;
15255         *)      uidsize=$yyy
15256                 echo "Your $zzz is $uidsize bytes long."
15257                 ;;
15258         esac
15259 else
15260         uidsize=4
15261         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15262 fi
15263
15264 echo " "
15265 case "$uidtype" in
15266 *_t) zzz="$uidtype"     ;;
15267 *)   zzz="uid"          ;;
15268 esac
15269 echo "Checking the sign of $zzz..." >&4
15270 cat > try.c <<EOCP
15271 #include <sys/types.h>
15272 #include <stdio.h>
15273 int main() {
15274         $uidtype foo = -1;
15275         if (foo < 0)
15276                 printf("-1\n");
15277         else
15278                 printf("1\n");
15279 }
15280 EOCP
15281 set try
15282 if eval $compile; then
15283         yyy=`./try`
15284         case "$yyy" in
15285         '')     uidsign=1
15286                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15287                 ;;
15288         *)      uidsign=$yyy
15289                 case "$uidsign" in
15290                  1) echo "Your $zzz is unsigned." ;;
15291                 -1) echo "Your $zzz is signed."   ;;
15292                 esac
15293                 ;;
15294         esac
15295 else
15296         uidsign=1
15297         echo "(I can't compile the test program--guessing unsigned.)" >&4
15298 fi
15299
15300
15301
15302 echo " "
15303 $echo "Checking the format string to be used for uids..." >&4
15304
15305 case "$uidsign" in
15306 -1)     if $test X"$uidsize" = X"$ivsize"; then
15307                 uidformat="$ivdformat"
15308         else
15309                 if $test X"$uidsize" = X"$longsize"; then
15310                         uidformat='"ld"'
15311                 else
15312                         if $test X"$uidsize" = X"$intsize"; then
15313                                 uidformat='"d"'
15314                         else
15315                                 if $test X"$uidsize" = X"$shortsize"; then
15316                                         uidformat='"hd"'
15317                                 fi
15318                         fi
15319                 fi
15320         fi
15321         ;;
15322 *)      if $test X"$uidsize" = X"$uvsize"; then
15323                 uidformat="$uvuformat"
15324         else
15325                 if $test X"$uidsize" = X"$longsize"; then
15326                         uidformat='"lu"'
15327                 else
15328                         if $test X"$uidsize" = X"$intsize"; then
15329                                 uidformat='"u"'
15330                         else
15331                                 if $test X"$uidsize" = X"$shortsize"; then
15332                                         uidformat='"hu"'
15333                                 fi
15334                         fi
15335                 fi
15336         fi
15337         ;;
15338 esac
15339
15340 : determine compiler compiler
15341 case "$yacc" in
15342 '')
15343         dflt=yacc;;
15344 *)
15345         dflt="$yacc";;
15346 esac
15347 echo " "
15348 comp='yacc'
15349 if $test -f "$byacc"; then
15350         dflt="$byacc"
15351         comp="byacc or $comp"
15352 fi
15353 if $test -f "$bison"; then
15354         comp="$comp or bison -y"
15355 fi
15356 rp="Which compiler compiler ($comp) shall I use?"
15357 . ./myread
15358 yacc="$ans"
15359 case "$yacc" in
15360 *bis*)
15361         case "$yacc" in
15362         *-y*) ;;
15363         *)
15364                 yacc="$yacc -y"
15365                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15366                 ;;
15367         esac
15368         ;;
15369 esac
15370
15371 : see if fcntl.h is there
15372 val=''
15373 set fcntl.h val
15374 eval $inhdr
15375
15376 : see if we can include fcntl.h
15377 case "$val" in
15378 "$define")
15379         echo " "
15380         if $h_fcntl; then
15381                 val="$define"
15382                 echo "We'll be including <fcntl.h>." >&4
15383         else
15384                 val="$undef"
15385                 if $h_sysfile; then
15386         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15387                 else
15388                         echo "We won't be including <fcntl.h>." >&4
15389                 fi
15390         fi
15391         ;;
15392 *)
15393         h_fcntl=false
15394         val="$undef"
15395         ;;
15396 esac
15397 set i_fcntl
15398 eval $setvar
15399
15400 : see if this is a iconv.h system
15401 set iconv.h i_iconv
15402 eval $inhdr
15403
15404 : see if this is a ieeefp.h system
15405 set ieeefp.h i_ieeefp
15406 eval $inhdr
15407
15408 : see if this is a libutil.h system
15409 set libutil.h i_libutil
15410 eval $inhdr
15411
15412 : see if locale.h is available
15413 set locale.h i_locale
15414 eval $inhdr
15415
15416 : see if mach cthreads are available
15417 if test "X$usethreads" = "X$define"; then
15418         set mach/cthreads.h i_machcthr
15419         eval $inhdr
15420 else
15421         i_machcthr="$undef"
15422 fi
15423
15424
15425
15426 : see if this is a math.h system
15427 set math.h i_math
15428 eval $inhdr
15429
15430 : see if this is a mntent.h system
15431 set mntent.h i_mntent
15432 eval $inhdr
15433
15434 : see if ndbm.h is available
15435 set ndbm.h t_ndbm
15436 eval $inhdr
15437 case "$t_ndbm" in
15438 $define)
15439         : see if dbm_open exists
15440         set dbm_open d_dbm_open
15441         eval $inlibc
15442         case "$d_dbm_open" in
15443         $undef)
15444                 t_ndbm="$undef"
15445                 echo "We won't be including <ndbm.h>"
15446                 ;;
15447         esac
15448         ;;
15449 esac
15450 val="$t_ndbm"
15451 set i_ndbm
15452 eval $setvar
15453
15454 : see if net/errno.h is available
15455 val=''
15456 set net/errno.h val
15457 eval $inhdr
15458
15459 : Unfortunately, it causes problems on some systems.  Arrgh.
15460 case "$val" in
15461 $define)
15462         cat > try.c <<'EOM'
15463 #include <stdio.h>
15464 #include <errno.h>
15465 #include <net/errno.h>
15466 int func()
15467 {
15468         return ENOTSOCK;
15469 }
15470 EOM
15471         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15472                 echo "We'll be including <net/errno.h>." >&4
15473         else
15474                 echo "We won't be including <net/errno.h>." >&4
15475                 val="$undef"
15476         fi
15477         $rm -f try.* try
15478         ;;
15479 esac
15480 set i_neterrno
15481 eval $setvar
15482
15483 : see if netinet/tcp.h is available
15484 set netinet/tcp.h i_netinettcp
15485 eval $inhdr
15486
15487 : see if this is a poll.h system
15488 set poll.h i_poll
15489 eval $inhdr
15490
15491 : see if this is a prot.h system
15492 set prot.h i_prot
15493 eval $inhdr
15494
15495 echo " "
15496 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15497 $cat <<'EOSH' > Cppsym.know
15498 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15499 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15500 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15501 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15502 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15503 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15504 bull c cadmus clipper CMU COFF COMPILER_VERSION
15505 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15506 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15507 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15508 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15509 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15510 H3050R H3050RX hbullx20 hcx host_mips
15511 hp200 hp300 hp700 HP700 hp800 hp9000
15512 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15513 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15514 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15515 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15516 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15517 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15518 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15519 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15520 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15521 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15522 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15523 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15524 MATH_HAS_NO_SIDE_EFFECTS
15525 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15526 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15527 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15528 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15529 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15530 NetBSD news1500 news1700 news1800 news1900 news3700
15531 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15532 ns32016 ns32332 ns32k nsc32000
15533 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15534 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15535 pc532 pdp11 PGC PIC plexus PORTAR posix
15536 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15537 POSIX_C_SOURCE POSIX_SOURCE POWER
15538 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15539 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15540 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15541 sony sony_news sonyrisc sparc sparclite spectrum
15542 stardent stdc STDC_EXT stratos sun sun3 sun386
15543 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15544 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15545 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15546 sysV68 sysV88 Tek4132 Tek4300 titan
15547 TM3200 TM5400 TM5600
15548 tower tower32 tower32_200 tower32_600 tower32_700
15549 tower32_800 tower32_850 tss
15550 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15551 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15552 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15553 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15554 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15555 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15556 z8000
15557 EOSH
15558 # Maybe put other stuff here too.
15559 cat <<EOSH >>Cppsym.know
15560 $osname
15561 EOSH
15562 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15563 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15564 $cat Cppsym.know > Cppsym.c
15565 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15566 $rm -f Cppsym.a Cppsym.b Cppsym.c
15567 cat <<EOSH > Cppsym
15568 $startsh
15569 if $test \$# -gt 0; then
15570     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15571     if $test -s Cppsym.got; then
15572         $rm -f Cppsym.got
15573         exit 0
15574     fi
15575     $rm -f Cppsym.got
15576     exit 1
15577 else
15578     $tr " " "$trnl" | ./Cppsym.try
15579     exit 0
15580 fi
15581 EOSH
15582 chmod +x Cppsym
15583 $eunicefix Cppsym
15584 cat <<EOSH > Cppsym.try
15585 $startsh
15586 cat <<'EOCP' > try.c
15587 #include <stdio.h>
15588 int main() {
15589 EOCP
15590 $awk \\
15591 EOSH
15592 cat <<'EOSH' >> Cppsym.try
15593 'length($1) > 0 {
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     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
15597     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
15598 }'       >> try.c
15599 echo 'return 0;}' >> try.c
15600 EOSH
15601 cat <<EOSH >> Cppsym.try
15602 ccflags="$ccflags"
15603 case "$osname-$gccversion" in
15604 irix-) ccflags="\$ccflags -woff 1178" ;;
15605 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15606 esac
15607 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15608 EOSH
15609 chmod +x Cppsym.try
15610 $eunicefix Cppsym.try
15611 ./Cppsym < Cppsym.know > Cppsym.true
15612 : now check the C compiler for additional symbols
15613 postprocess_cc_v=''
15614 case "$osname" in
15615 aix) postprocess_cc_v="|$tr , ' '" ;;
15616 esac
15617 $cat >ccsym <<EOS
15618 $startsh
15619 $cat >tmp.c <<EOF
15620 extern int foo;
15621 EOF
15622 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15623 do
15624         case "\$i" in
15625         -D*) echo "\$i" | $sed 's/^-D//';;
15626         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15627         esac
15628 done
15629 $rm -f try.c
15630 EOS
15631 postprocess_cc_v=''
15632 chmod +x ccsym
15633 $eunicefix ccsym
15634 ./ccsym > ccsym1.raw
15635 if $test -s ccsym1.raw; then
15636        $sort ccsym1.raw | $uniq >ccsym.raw
15637 else
15638        mv ccsym1.raw ccsym.raw
15639 fi
15640
15641 $awk '/\=/ { print $0; next }
15642         { print $0"=1" }' ccsym.raw >ccsym.list
15643 $awk '/\=/ { print $0; next }
15644         { print $0"=1" }' Cppsym.true >ccsym.true
15645 $comm -13 ccsym.true ccsym.list >ccsym.own
15646 $comm -12 ccsym.true ccsym.list >ccsym.com
15647 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15648 also=''
15649 if $test -z ccsym.raw; then
15650         echo "Your C compiler doesn't seem to define any symbols!" >&4
15651         echo " "
15652         echo "However, your C preprocessor defines the following symbols:"
15653         $cat Cppsym.true
15654         ccsymbols=''
15655         cppsymbols=`$cat Cppsym.true`
15656         cppsymbols=`echo $cppsymbols`
15657         cppccsymbols="$cppsymbols"
15658 else
15659         if $test -s ccsym.com; then
15660                 echo "Your C compiler and pre-processor define these symbols:"
15661                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15662                 also='also '
15663                 symbols='ones'
15664                 cppccsymbols=`$cat ccsym.com`
15665                 cppccsymbols=`echo $cppccsymbols`
15666                 $test "$silent" || sleep 1
15667         fi
15668         if $test -s ccsym.cpp; then
15669                 $test "$also" && echo " "
15670                 echo "Your C pre-processor ${also}defines the following symbols:"
15671                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15672                 also='further '
15673                 cppsymbols=`$cat ccsym.cpp`
15674                 cppsymbols=`echo $cppsymbols`
15675                 $test "$silent" || sleep 1
15676         fi
15677         if $test -s ccsym.own; then
15678                 $test "$also" && echo " "
15679                 echo "Your C compiler ${also}defines the following cpp symbols:"
15680                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15681                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15682                 ccsymbols=`$cat ccsym.own`
15683                 ccsymbols=`echo $ccsymbols`
15684                 $test "$silent" || sleep 1
15685         fi
15686 fi
15687 $rm -f ccsym* Cppsym.*
15688
15689 : see if this is a termio system
15690 val="$undef"
15691 val2="$undef"
15692 val3="$undef"
15693 if $test `./findhdr termios.h`; then
15694         set tcsetattr i_termios
15695         eval $inlibc
15696         val3="$i_termios"
15697 fi
15698 echo " "
15699 case "$val3" in
15700 "$define") echo "You have POSIX termios.h... good!" >&4;;
15701 *) if ./Cppsym pyr; then
15702                 case "`/bin/universe`" in
15703                 ucb) if $test `./findhdr sgtty.h`; then
15704                                 val2="$define"
15705                                 echo "<sgtty.h> found." >&4
15706                         else
15707                                 echo "System is pyramid with BSD universe."
15708                                 echo "<sgtty.h> not found--you could have problems." >&4
15709                         fi;;
15710                 *) if $test `./findhdr termio.h`; then
15711                                 val="$define"
15712                                 echo "<termio.h> found." >&4
15713                         else
15714                                 echo "System is pyramid with USG universe."
15715                                 echo "<termio.h> not found--you could have problems." >&4
15716                         fi;;
15717                 esac
15718         elif ./usg; then
15719                 if $test `./findhdr termio.h`; then
15720                         echo "<termio.h> found." >&4
15721                         val="$define"
15722                 elif $test `./findhdr sgtty.h`; then
15723                         echo "<sgtty.h> found." >&4
15724                         val2="$define"
15725                 else
15726 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15727                 fi
15728         else
15729                 if $test `./findhdr sgtty.h`; then
15730                         echo "<sgtty.h> found." >&4
15731                         val2="$define"
15732                 elif $test `./findhdr termio.h`; then
15733                         echo "<termio.h> found." >&4
15734                         val="$define"
15735                 else
15736 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15737                 fi
15738         fi;;
15739 esac
15740 set i_termio; eval $setvar
15741 val=$val2; set i_sgtty; eval $setvar
15742 val=$val3; set i_termios; eval $setvar
15743
15744 : see if this is a shadow.h system
15745 set shadow.h i_shadow
15746 eval $inhdr
15747
15748 : see if stddef is available
15749 set stddef.h i_stddef
15750 eval $inhdr
15751
15752 : see if this is a sunmath.h system
15753 set sunmath.h i_sunmath
15754 eval $inhdr
15755
15756 : see if sys/access.h is available
15757 set sys/access.h i_sysaccess
15758 eval $inhdr
15759
15760 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15761 set sys/filio.h i_sysfilio
15762 eval $inhdr
15763 echo " "
15764 if $test `./findhdr sys/ioctl.h`; then
15765         val="$define"
15766         echo '<sys/ioctl.h> found.' >&4
15767 else
15768         val="$undef"
15769         if $test $i_sysfilio = "$define"; then
15770             echo '<sys/ioctl.h> NOT found.' >&4
15771         else
15772                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15773                 $test $i_termio = "$define" && xxx="termio.h"
15774                 $test $i_termios = "$define" && xxx="termios.h"
15775 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15776         fi
15777 fi
15778 set i_sysioctl
15779 eval $setvar
15780
15781 : see if socket ioctl defs are in sys/sockio.h
15782 echo " "
15783 xxx=`./findhdr sys/sockio.h`
15784 if $test "$xxx"; then
15785         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15786                 val="$define"
15787                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15788         else
15789                 val="$undef"
15790                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15791         fi
15792 else
15793         val="$undef"
15794         $cat <<EOM
15795 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15796 EOM
15797 fi
15798 set i_syssockio
15799 eval $setvar
15800
15801
15802 : see if this is a syslog.h system
15803 set syslog.h i_syslog
15804 eval $inhdr
15805
15806
15807 : see if this is a sys/mode.h system
15808 set sys/mode.h i_sysmode
15809 eval $inhdr
15810
15811 : see if sys/resource.h has to be included
15812 set sys/resource.h i_sysresrc
15813 eval $inhdr
15814
15815 : see if sys/security.h is available
15816 set sys/security.h i_syssecrt
15817 eval $inhdr
15818
15819 : see if this is a sys/statvfs.h system
15820 set sys/statvfs.h i_sysstatvfs
15821 eval $inhdr
15822
15823 : see if this is a sys/un.h system
15824 set sys/un.h i_sysun
15825 eval $inhdr
15826
15827
15828 : see if this is a sys/utsname.h system
15829 set sys/utsname.h i_sysutsname
15830 eval $inhdr
15831
15832 : see if this is a syswait system
15833 set sys/wait.h i_syswait
15834 eval $inhdr
15835
15836 : see if this is a ustat.h system
15837 set ustat.h i_ustat
15838 eval $inhdr
15839
15840 : see if this is an utime system
15841 set utime.h i_utime
15842 eval $inhdr
15843
15844 : see if this is a values.h system
15845 set values.h i_values
15846 eval $inhdr
15847
15848 : see if this is a vfork system
15849 case "$d_vfork" in
15850 "$define")
15851         set vfork.h i_vfork
15852         eval $inhdr
15853         ;;
15854 *)
15855         i_vfork="$undef"
15856         ;;
15857 esac
15858
15859 : see if gdbm.h is available
15860 set gdbm.h t_gdbm
15861 eval $inhdr
15862 case "$t_gdbm" in
15863 $define)
15864         : see if gdbm_open exists
15865         set gdbm_open d_gdbm_open
15866         eval $inlibc
15867         case "$d_gdbm_open" in
15868         $undef)
15869                 t_gdbm="$undef"
15870                 echo "We won't be including <gdbm.h>"
15871                 ;;
15872         esac
15873         ;;
15874 esac
15875 val="$t_gdbm"
15876 set i_gdbm
15877 eval $setvar
15878
15879 echo " "
15880 echo "Looking for extensions..." >&4
15881 : If we are using the old config.sh, known_extensions may contain
15882 : old or inaccurate or duplicate values.
15883 known_extensions=''
15884 nonxs_extensions=''
15885 : We do not use find because it might not be available.
15886 : We do not just use MANIFEST because the user may have dropped
15887 : some additional extensions into the source tree and expect them
15888 : to be built.
15889
15890 : Function to recursively find available extensions, ignoring DynaLoader
15891 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15892 find_extensions='
15893     for xxx in *; do
15894        case "$xxx" in
15895            DynaLoader|dynaload) ;;
15896            *)
15897            if $test -f $xxx/$xxx.xs; then
15898                known_extensions="$known_extensions $1$xxx";
15899            elif $test -f $xxx/Makefile.PL; then
15900                nonxs_extensions="$nonxs_extensions $1$xxx";
15901            else
15902                if $test -d $xxx -a $# -lt 10; then
15903                    set $1$xxx/ $*;
15904                    cd $xxx;
15905                    eval $find_extensions;
15906                    cd ..;
15907                    shift;
15908                fi;
15909            fi
15910            ;;
15911        esac;
15912     done'
15913 tdir=`pwd`
15914 cd $rsrc/ext
15915 set X
15916 shift
15917 eval $find_extensions
15918 set X $nonxs_extensions
15919 shift
15920 nonxs_extensions="$*"
15921 set X $known_extensions
15922 shift
15923 known_extensions="$*"
15924 cd $tdir
15925
15926 : Now see which are supported on this system.
15927 avail_ext=''
15928 for xxx in $known_extensions ; do
15929         case "$xxx" in
15930         DB_File|db_file)
15931                 case "$i_db" in
15932                 $define) avail_ext="$avail_ext $xxx" ;;
15933                 esac
15934                 ;;
15935         GDBM_File|gdbm_fil)
15936                 case "$i_gdbm" in 
15937                 $define) avail_ext="$avail_ext $xxx" ;;
15938                 esac
15939                 ;;
15940         NDBM_File|ndbm_fil)
15941                 case "$i_ndbm" in
15942                 $define)
15943                     case "$osname-$use64bitint" in
15944                     hpux-define)
15945                         case "$libs" in
15946                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15947                         esac
15948                         ;;
15949                     *) avail_ext="$avail_ext $xxx" ;;
15950                     esac
15951                     ;;
15952                 esac
15953                 ;;
15954         ODBM_File|odbm_fil) 
15955                 case "${i_dbm}${i_rpcsvcdbm}" in
15956                 *"${define}"*)
15957                     case "$osname-$use64bitint" in
15958                     hpux-define)
15959                         case "$libs" in
15960                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15961                         esac
15962                         ;;
15963                     *) avail_ext="$avail_ext $xxx" ;;
15964                     esac
15965                     ;;
15966                 esac
15967                 ;;
15968         POSIX|posix)
15969                 case "$useposix" in
15970                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15971                 esac
15972                 ;;
15973         Opcode|opcode)
15974                 case "$useopcode" in
15975                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15976                 esac
15977                 ;;
15978         Socket|socket)
15979                 case "$d_socket" in 
15980                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15981                 esac
15982                 ;;
15983         Sys/Syslog|sys/syslog)
15984                 : XXX syslog requires socket
15985                 case "$d_socket" in 
15986                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15987                 esac
15988                 ;;
15989         Thread|thread)
15990                 case "$usethreads" in
15991                 true|$define|y)
15992                         case "$useithreads" in
15993                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
15994                         esac
15995                 esac
15996                 ;;
15997         IPC/SysV|ipc/sysv)
15998                 : XXX Do we need a useipcsysv variable here
15999                 case "${d_msg}${d_sem}${d_shm}" in 
16000                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16001                 esac
16002                 ;;
16003         *)      avail_ext="$avail_ext $xxx"
16004                 ;;
16005         esac
16006 done
16007
16008 set X $avail_ext
16009 shift
16010 avail_ext="$*"
16011
16012 : Now see which nonxs extensions are supported on this system.
16013 : For now assume all are.
16014 nonxs_ext=''
16015 for xxx in $nonxs_extensions ; do
16016         case "$xxx" in
16017         *)      nonxs_ext="$nonxs_ext $xxx"
16018                 ;;
16019         esac
16020 done
16021
16022 set X $nonxs_ext
16023 shift
16024 nonxs_ext="$*"
16025
16026 case $usedl in
16027 $define)
16028         $cat <<EOM
16029 A number of extensions are supplied with $package.  You may choose to
16030 compile these extensions for dynamic loading (the default), compile
16031 them into the $package executable (static loading), or not include
16032 them at all.  Answer "none" to include no extensions.
16033 Note that DynaLoader is always built and need not be mentioned here.
16034
16035 EOM
16036         case "$dynamic_ext" in
16037         '') dflt="$avail_ext" ;;
16038         *)      dflt="$dynamic_ext"
16039                 # Perhaps we are reusing an old out-of-date config.sh.
16040                 case "$hint" in
16041                 previous)
16042                         if test X"$dynamic_ext" != X"$avail_ext"; then
16043                                 $cat <<EOM
16044 NOTICE:  Your previous config.sh list may be incorrect. 
16045 The extensions now available to you are 
16046         ${avail_ext}
16047 but the default list from your previous config.sh is
16048         ${dynamic_ext} 
16049
16050 EOM
16051                         fi
16052                         ;;
16053                 esac
16054                 ;;
16055         esac
16056         case "$dflt" in
16057         '')     dflt=none;;
16058         esac
16059         rp="What extensions do you wish to load dynamically?"
16060         . ./myread
16061         case "$ans" in
16062         none) dynamic_ext=' ' ;;
16063         *) dynamic_ext="$ans" ;;
16064         esac
16065
16066         case "$static_ext" in
16067         '')
16068                 : Exclude those already listed in dynamic linking
16069                 dflt=''
16070                 for xxx in $avail_ext; do
16071                         case " $dynamic_ext " in
16072                         *" $xxx "*) ;;
16073                         *) dflt="$dflt $xxx" ;;
16074                         esac
16075                 done
16076                 set X $dflt
16077                 shift
16078                 dflt="$*"
16079                 ;;
16080         *)  dflt="$static_ext" 
16081                 ;;
16082         esac
16083
16084         case "$dflt" in
16085         '')     dflt=none;;
16086         esac
16087         rp="What extensions do you wish to load statically?"
16088         . ./myread
16089         case "$ans" in
16090         none) static_ext=' ' ;;
16091         *) static_ext="$ans" ;;
16092         esac
16093         ;;
16094 *)
16095         $cat <<EOM
16096 A number of extensions are supplied with $package.  Answer "none" 
16097 to include no extensions. 
16098 Note that DynaLoader is always built and need not be mentioned here.
16099
16100 EOM
16101         case "$static_ext" in
16102         '') dflt="$avail_ext" ;;
16103         *)      dflt="$static_ext"
16104                 # Perhaps we are reusing an old out-of-date config.sh.
16105                 case "$hint" in
16106                 previous)
16107                         if test X"$static_ext" != X"$avail_ext"; then
16108                                 $cat <<EOM
16109 NOTICE:  Your previous config.sh list may be incorrect. 
16110 The extensions now available to you are 
16111         ${avail_ext}
16112 but the default list from your previous config.sh is
16113         ${static_ext} 
16114
16115 EOM
16116                         fi
16117                         ;;
16118                 esac
16119                 ;;
16120         esac
16121         : Exclude those that are not xs extensions
16122         case "$dflt" in
16123         '')     dflt=none;;
16124         esac
16125         rp="What extensions do you wish to include?"
16126         . ./myread
16127         case "$ans" in
16128         none) static_ext=' ' ;;
16129         *) static_ext="$ans" ;;
16130         esac
16131         ;;
16132 esac
16133
16134 set X $dynamic_ext $static_ext $nonxs_ext
16135 shift
16136 extensions="$*"
16137
16138 : Remove libraries needed only for extensions
16139 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16140 : The exception is SunOS 4.x, which needs them.
16141 case "${osname}X${osvers}" in
16142 sunos*X4*)
16143     perllibs="$libs"
16144     ;;
16145 *) case "$usedl" in
16146     $define|true|[yY]*)
16147             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16148             shift
16149             perllibs="$*"
16150             ;;
16151     *)  perllibs="$libs"
16152             ;;
16153     esac
16154     ;;
16155 esac
16156
16157 : Remove build directory name from cppstdin so it can be used from
16158 : either the present location or the final installed location.
16159 echo " "
16160 : Get out of the UU directory to get correct path name.
16161 cd ..
16162 case "$cppstdin" in
16163 `pwd`/cppstdin)
16164         echo "Stripping down cppstdin path name"
16165         cppstdin=cppstdin
16166         ;;
16167 esac
16168 cd UU
16169
16170 : end of configuration questions
16171 echo " "
16172 echo "End of configuration questions."
16173 echo " "
16174
16175 : back to where it started
16176 if test -d ../UU; then
16177         cd ..
16178 fi
16179
16180 : configuration may be patched via a 'config.over' file
16181 if $test -f config.over; then
16182         echo " "
16183         dflt=y
16184         rp='I see a config.over file.  Do you wish to load it?'
16185         . UU/myread
16186         case "$ans" in
16187         n*) echo "OK, I'll ignore it.";;
16188         *)      . ./config.over
16189                 echo "Configuration override changes have been loaded."
16190                 ;;
16191         esac
16192 fi
16193
16194 : in case they want portability, strip down executable paths
16195 case "$d_portable" in
16196 "$define")
16197         echo " "
16198         echo "Stripping down executable paths..." >&4
16199         for file in $loclist $trylist; do
16200                 eval temp=\$$file
16201                 eval $file=`basename $temp`
16202         done
16203         ;;
16204 esac
16205
16206 : create config.sh file
16207 echo " "
16208 echo "Creating config.sh..." >&4
16209 $spitshell <<EOT >config.sh
16210 $startsh
16211 #
16212 # This file was produced by running the Configure script. It holds all the
16213 # definitions figured out by Configure. Should you modify one of these values,
16214 # do not forget to propagate your changes by running "Configure -der". You may
16215 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16216 #
16217
16218 # Package name      : $package
16219 # Source directory  : $src
16220 # Configuration time: $cf_time
16221 # Configured by     : $cf_by
16222 # Target system     : $myuname
16223
16224 Author='$Author'
16225 Date='$Date'
16226 Header='$Header'
16227 Id='$Id'
16228 Locker='$Locker'
16229 Log='$Log'
16230 Mcc='$Mcc'
16231 RCSfile='$RCSfile'
16232 Revision='$Revision'
16233 Source='$Source'
16234 State='$State'
16235 _a='$_a'
16236 _exe='$_exe'
16237 _o='$_o'
16238 afs='$afs'
16239 afsroot='$afsroot'
16240 alignbytes='$alignbytes'
16241 ansi2knr='$ansi2knr'
16242 aphostname='$aphostname'
16243 api_revision='$api_revision'
16244 api_subversion='$api_subversion'
16245 api_version='$api_version'
16246 api_versionstring='$api_versionstring'
16247 ar='$ar'
16248 archlib='$archlib'
16249 archlibexp='$archlibexp'
16250 archname64='$archname64'
16251 archname='$archname'
16252 archobjs='$archobjs'
16253 awk='$awk'
16254 baserev='$baserev'
16255 bash='$bash'
16256 bin='$bin'
16257 bincompat5005='$bincompat5005'
16258 binexp='$binexp'
16259 bison='$bison'
16260 byacc='$byacc'
16261 byteorder='$byteorder'
16262 c='$c'
16263 castflags='$castflags'
16264 cat='$cat'
16265 cc='$cc'
16266 cccdlflags='$cccdlflags'
16267 ccdlflags='$ccdlflags'
16268 ccflags='$ccflags'
16269 ccflags_uselargefiles='$ccflags_uselargefiles'
16270 ccname='$ccname'
16271 ccsymbols='$ccsymbols'
16272 ccversion='$ccversion'
16273 cf_by='$cf_by'
16274 cf_email='$cf_email'
16275 cf_time='$cf_time'
16276 charsize='$charsize'
16277 chgrp='$chgrp'
16278 chmod='$chmod'
16279 chown='$chown'
16280 clocktype='$clocktype'
16281 comm='$comm'
16282 compress='$compress'
16283 contains='$contains'
16284 cp='$cp'
16285 cpio='$cpio'
16286 cpp='$cpp'
16287 cpp_stuff='$cpp_stuff'
16288 cppccsymbols='$cppccsymbols'
16289 cppflags='$cppflags'
16290 cpplast='$cpplast'
16291 cppminus='$cppminus'
16292 cpprun='$cpprun'
16293 cppstdin='$cppstdin'
16294 cppsymbols='$cppsymbols'
16295 crosscompile='$crosscompile'
16296 cryptlib='$cryptlib'
16297 csh='$csh'
16298 d_Gconvert='$d_Gconvert'
16299 d_PRIEUldbl='$d_PRIEUldbl'
16300 d_PRIFUldbl='$d_PRIFUldbl'
16301 d_PRIGUldbl='$d_PRIGUldbl'
16302 d_PRIXU64='$d_PRIXU64'
16303 d_PRId64='$d_PRId64'
16304 d_PRIeldbl='$d_PRIeldbl'
16305 d_PRIfldbl='$d_PRIfldbl'
16306 d_PRIgldbl='$d_PRIgldbl'
16307 d_PRIi64='$d_PRIi64'
16308 d_PRIo64='$d_PRIo64'
16309 d_PRIu64='$d_PRIu64'
16310 d_PRIx64='$d_PRIx64'
16311 d_SCNfldbl='$d_SCNfldbl'
16312 d__fwalk='$d__fwalk'
16313 d_access='$d_access'
16314 d_accessx='$d_accessx'
16315 d_alarm='$d_alarm'
16316 d_archlib='$d_archlib'
16317 d_atolf='$d_atolf'
16318 d_atoll='$d_atoll'
16319 d_attribut='$d_attribut'
16320 d_bcmp='$d_bcmp'
16321 d_bcopy='$d_bcopy'
16322 d_bincompat5005='$d_bincompat5005'
16323 d_bsd='$d_bsd'
16324 d_bsdgetpgrp='$d_bsdgetpgrp'
16325 d_bsdsetpgrp='$d_bsdsetpgrp'
16326 d_bzero='$d_bzero'
16327 d_casti32='$d_casti32'
16328 d_castneg='$d_castneg'
16329 d_charvspr='$d_charvspr'
16330 d_chown='$d_chown'
16331 d_chroot='$d_chroot'
16332 d_chsize='$d_chsize'
16333 d_closedir='$d_closedir'
16334 d_cmsghdr_s='$d_cmsghdr_s'
16335 d_const='$d_const'
16336 d_crypt='$d_crypt'
16337 d_csh='$d_csh'
16338 d_cuserid='$d_cuserid'
16339 d_dbl_dig='$d_dbl_dig'
16340 d_dbminitproto='$d_dbminitproto'
16341 d_difftime='$d_difftime'
16342 d_dirnamlen='$d_dirnamlen'
16343 d_dlerror='$d_dlerror'
16344 d_dlopen='$d_dlopen'
16345 d_dlsymun='$d_dlsymun'
16346 d_dosuid='$d_dosuid'
16347 d_drand48proto='$d_drand48proto'
16348 d_dup2='$d_dup2'
16349 d_eaccess='$d_eaccess'
16350 d_endgrent='$d_endgrent'
16351 d_endhent='$d_endhent'
16352 d_endnent='$d_endnent'
16353 d_endpent='$d_endpent'
16354 d_endpwent='$d_endpwent'
16355 d_endsent='$d_endsent'
16356 d_eofnblk='$d_eofnblk'
16357 d_eunice='$d_eunice'
16358 d_fchmod='$d_fchmod'
16359 d_fchown='$d_fchown'
16360 d_fcntl='$d_fcntl'
16361 d_fcntl_can_lock='$d_fcntl_can_lock'
16362 d_fd_macros='$d_fd_macros'
16363 d_fd_set='$d_fd_set'
16364 d_fds_bits='$d_fds_bits'
16365 d_fgetpos='$d_fgetpos'
16366 d_flexfnam='$d_flexfnam'
16367 d_flock='$d_flock'
16368 d_flockproto='$d_flockproto'
16369 d_fork='$d_fork'
16370 d_fpathconf='$d_fpathconf'
16371 d_fpos64_t='$d_fpos64_t'
16372 d_frexpl='$d_frexpl'
16373 d_fs_data_s='$d_fs_data_s'
16374 d_fseeko='$d_fseeko'
16375 d_fsetpos='$d_fsetpos'
16376 d_fstatfs='$d_fstatfs'
16377 d_fstatvfs='$d_fstatvfs'
16378 d_fsync='$d_fsync'
16379 d_ftello='$d_ftello'
16380 d_ftime='$d_ftime'
16381 d_getcwd='$d_getcwd'
16382 d_getespwnam='$d_getespwnam'
16383 d_getfsstat='$d_getfsstat'
16384 d_getgrent='$d_getgrent'
16385 d_getgrps='$d_getgrps'
16386 d_gethbyaddr='$d_gethbyaddr'
16387 d_gethbyname='$d_gethbyname'
16388 d_gethent='$d_gethent'
16389 d_gethname='$d_gethname'
16390 d_gethostprotos='$d_gethostprotos'
16391 d_getitimer='$d_getitimer'
16392 d_getlogin='$d_getlogin'
16393 d_getmnt='$d_getmnt'
16394 d_getmntent='$d_getmntent'
16395 d_getnbyaddr='$d_getnbyaddr'
16396 d_getnbyname='$d_getnbyname'
16397 d_getnent='$d_getnent'
16398 d_getnetprotos='$d_getnetprotos'
16399 d_getpagsz='$d_getpagsz'
16400 d_getpbyname='$d_getpbyname'
16401 d_getpbynumber='$d_getpbynumber'
16402 d_getpent='$d_getpent'
16403 d_getpgid='$d_getpgid'
16404 d_getpgrp2='$d_getpgrp2'
16405 d_getpgrp='$d_getpgrp'
16406 d_getppid='$d_getppid'
16407 d_getprior='$d_getprior'
16408 d_getprotoprotos='$d_getprotoprotos'
16409 d_getprpwnam='$d_getprpwnam'
16410 d_getpwent='$d_getpwent'
16411 d_getsbyname='$d_getsbyname'
16412 d_getsbyport='$d_getsbyport'
16413 d_getsent='$d_getsent'
16414 d_getservprotos='$d_getservprotos'
16415 d_getspnam='$d_getspnam'
16416 d_gettimeod='$d_gettimeod'
16417 d_gnulibc='$d_gnulibc'
16418 d_grpasswd='$d_grpasswd'
16419 d_hasmntopt='$d_hasmntopt'
16420 d_htonl='$d_htonl'
16421 d_iconv='$d_iconv'
16422 d_index='$d_index'
16423 d_inetaton='$d_inetaton'
16424 d_int64_t='$d_int64_t'
16425 d_isascii='$d_isascii'
16426 d_isnan='$d_isnan'
16427 d_isnanl='$d_isnanl'
16428 d_killpg='$d_killpg'
16429 d_lchown='$d_lchown'
16430 d_ldbl_dig='$d_ldbl_dig'
16431 d_link='$d_link'
16432 d_locconv='$d_locconv'
16433 d_lockf='$d_lockf'
16434 d_longdbl='$d_longdbl'
16435 d_longlong='$d_longlong'
16436 d_lseekproto='$d_lseekproto'
16437 d_lstat='$d_lstat'
16438 d_madvise='$d_madvise'
16439 d_mblen='$d_mblen'
16440 d_mbstowcs='$d_mbstowcs'
16441 d_mbtowc='$d_mbtowc'
16442 d_memchr='$d_memchr'
16443 d_memcmp='$d_memcmp'
16444 d_memcpy='$d_memcpy'
16445 d_memmove='$d_memmove'
16446 d_memset='$d_memset'
16447 d_mkdir='$d_mkdir'
16448 d_mkdtemp='$d_mkdtemp'
16449 d_mkfifo='$d_mkfifo'
16450 d_mkstemp='$d_mkstemp'
16451 d_mkstemps='$d_mkstemps'
16452 d_mktime='$d_mktime'
16453 d_mmap='$d_mmap'
16454 d_modfl='$d_modfl'
16455 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16456 d_mprotect='$d_mprotect'
16457 d_msg='$d_msg'
16458 d_msg_ctrunc='$d_msg_ctrunc'
16459 d_msg_dontroute='$d_msg_dontroute'
16460 d_msg_oob='$d_msg_oob'
16461 d_msg_peek='$d_msg_peek'
16462 d_msg_proxy='$d_msg_proxy'
16463 d_msgctl='$d_msgctl'
16464 d_msgget='$d_msgget'
16465 d_msghdr_s='$d_msghdr_s'
16466 d_msgrcv='$d_msgrcv'
16467 d_msgsnd='$d_msgsnd'
16468 d_msync='$d_msync'
16469 d_munmap='$d_munmap'
16470 d_mymalloc='$d_mymalloc'
16471 d_nice='$d_nice'
16472 d_nv_preserves_uv='$d_nv_preserves_uv'
16473 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16474 d_off64_t='$d_off64_t'
16475 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16476 d_oldpthreads='$d_oldpthreads'
16477 d_oldsock='$d_oldsock'
16478 d_open3='$d_open3'
16479 d_pathconf='$d_pathconf'
16480 d_pause='$d_pause'
16481 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16482 d_phostname='$d_phostname'
16483 d_pipe='$d_pipe'
16484 d_poll='$d_poll'
16485 d_portable='$d_portable'
16486 d_pthread_yield='$d_pthread_yield'
16487 d_pwage='$d_pwage'
16488 d_pwchange='$d_pwchange'
16489 d_pwclass='$d_pwclass'
16490 d_pwcomment='$d_pwcomment'
16491 d_pwexpire='$d_pwexpire'
16492 d_pwgecos='$d_pwgecos'
16493 d_pwpasswd='$d_pwpasswd'
16494 d_pwquota='$d_pwquota'
16495 d_qgcvt='$d_qgcvt'
16496 d_quad='$d_quad'
16497 d_readdir='$d_readdir'
16498 d_readlink='$d_readlink'
16499 d_readv='$d_readv'
16500 d_realpath='$d_realpath'
16501 d_recvmsg='$d_recvmsg'
16502 d_rename='$d_rename'
16503 d_rewinddir='$d_rewinddir'
16504 d_rmdir='$d_rmdir'
16505 d_safebcpy='$d_safebcpy'
16506 d_safemcpy='$d_safemcpy'
16507 d_sanemcmp='$d_sanemcmp'
16508 d_sbrkproto='$d_sbrkproto'
16509 d_sched_yield='$d_sched_yield'
16510 d_scm_rights='$d_scm_rights'
16511 d_seekdir='$d_seekdir'
16512 d_select='$d_select'
16513 d_sem='$d_sem'
16514 d_semctl='$d_semctl'
16515 d_semctl_semid_ds='$d_semctl_semid_ds'
16516 d_semctl_semun='$d_semctl_semun'
16517 d_semget='$d_semget'
16518 d_semop='$d_semop'
16519 d_sendmsg='$d_sendmsg'
16520 d_setegid='$d_setegid'
16521 d_seteuid='$d_seteuid'
16522 d_setgrent='$d_setgrent'
16523 d_setgrps='$d_setgrps'
16524 d_sethent='$d_sethent'
16525 d_setitimer='$d_setitimer'
16526 d_setlinebuf='$d_setlinebuf'
16527 d_setlocale='$d_setlocale'
16528 d_setnent='$d_setnent'
16529 d_setpent='$d_setpent'
16530 d_setpgid='$d_setpgid'
16531 d_setpgrp2='$d_setpgrp2'
16532 d_setpgrp='$d_setpgrp'
16533 d_setprior='$d_setprior'
16534 d_setproctitle='$d_setproctitle'
16535 d_setpwent='$d_setpwent'
16536 d_setregid='$d_setregid'
16537 d_setresgid='$d_setresgid'
16538 d_setresuid='$d_setresuid'
16539 d_setreuid='$d_setreuid'
16540 d_setrgid='$d_setrgid'
16541 d_setruid='$d_setruid'
16542 d_setsent='$d_setsent'
16543 d_setsid='$d_setsid'
16544 d_setvbuf='$d_setvbuf'
16545 d_sfio='$d_sfio'
16546 d_shm='$d_shm'
16547 d_shmat='$d_shmat'
16548 d_shmatprototype='$d_shmatprototype'
16549 d_shmctl='$d_shmctl'
16550 d_shmdt='$d_shmdt'
16551 d_shmget='$d_shmget'
16552 d_sigaction='$d_sigaction'
16553 d_sigprocmask='$d_sigprocmask'
16554 d_sigsetjmp='$d_sigsetjmp'
16555 d_sockatmark='$d_sockatmark'
16556 d_sockatmarkproto='$d_sockatmarkproto'
16557 d_socket='$d_socket'
16558 d_socklen_t='$d_socklen_t'
16559 d_sockpair='$d_sockpair'
16560 d_socks5_init='$d_socks5_init'
16561 d_sqrtl='$d_sqrtl'
16562 d_sresgproto='$d_sresgproto'
16563 d_sresuproto='$d_sresuproto'
16564 d_statblks='$d_statblks'
16565 d_statfs_f_flags='$d_statfs_f_flags'
16566 d_statfs_s='$d_statfs_s'
16567 d_statvfs='$d_statvfs'
16568 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16569 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16570 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16571 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16572 d_stdio_stream_array='$d_stdio_stream_array'
16573 d_stdiobase='$d_stdiobase'
16574 d_stdstdio='$d_stdstdio'
16575 d_strchr='$d_strchr'
16576 d_strcoll='$d_strcoll'
16577 d_strctcpy='$d_strctcpy'
16578 d_strerrm='$d_strerrm'
16579 d_strerror='$d_strerror'
16580 d_strftime='$d_strftime'
16581 d_strtod='$d_strtod'
16582 d_strtol='$d_strtol'
16583 d_strtold='$d_strtold'
16584 d_strtoll='$d_strtoll'
16585 d_strtoq='$d_strtoq'
16586 d_strtoul='$d_strtoul'
16587 d_strtoull='$d_strtoull'
16588 d_strtouq='$d_strtouq'
16589 d_strxfrm='$d_strxfrm'
16590 d_suidsafe='$d_suidsafe'
16591 d_symlink='$d_symlink'
16592 d_syscall='$d_syscall'
16593 d_syscallproto='$d_syscallproto'
16594 d_sysconf='$d_sysconf'
16595 d_sysernlst='$d_sysernlst'
16596 d_syserrlst='$d_syserrlst'
16597 d_system='$d_system'
16598 d_tcgetpgrp='$d_tcgetpgrp'
16599 d_tcsetpgrp='$d_tcsetpgrp'
16600 d_telldir='$d_telldir'
16601 d_telldirproto='$d_telldirproto'
16602 d_time='$d_time'
16603 d_times='$d_times'
16604 d_truncate='$d_truncate'
16605 d_tzname='$d_tzname'
16606 d_u32align='$d_u32align'
16607 d_ualarm='$d_ualarm'
16608 d_umask='$d_umask'
16609 d_uname='$d_uname'
16610 d_union_semun='$d_union_semun'
16611 d_usleep='$d_usleep'
16612 d_usleepproto='$d_usleepproto'
16613 d_ustat='$d_ustat'
16614 d_vendorarch='$d_vendorarch'
16615 d_vendorbin='$d_vendorbin'
16616 d_vendorlib='$d_vendorlib'
16617 d_vfork='$d_vfork'
16618 d_void_closedir='$d_void_closedir'
16619 d_voidsig='$d_voidsig'
16620 d_voidtty='$d_voidtty'
16621 d_volatile='$d_volatile'
16622 d_vprintf='$d_vprintf'
16623 d_wait4='$d_wait4'
16624 d_waitpid='$d_waitpid'
16625 d_wcstombs='$d_wcstombs'
16626 d_wctomb='$d_wctomb'
16627 d_writev='$d_writev'
16628 d_xenix='$d_xenix'
16629 date='$date'
16630 db_hashtype='$db_hashtype'
16631 db_prefixtype='$db_prefixtype'
16632 db_version_major='$db_version_major'
16633 db_version_minor='$db_version_minor'
16634 db_version_patch='$db_version_patch'
16635 defvoidused='$defvoidused'
16636 direntrytype='$direntrytype'
16637 dlext='$dlext'
16638 dlsrc='$dlsrc'
16639 doublesize='$doublesize'
16640 drand01='$drand01'
16641 dynamic_ext='$dynamic_ext'
16642 eagain='$eagain'
16643 ebcdic='$ebcdic'
16644 echo='$echo'
16645 egrep='$egrep'
16646 emacs='$emacs'
16647 eunicefix='$eunicefix'
16648 exe_ext='$exe_ext'
16649 expr='$expr'
16650 extensions='$extensions'
16651 fflushNULL='$fflushNULL'
16652 fflushall='$fflushall'
16653 find='$find'
16654 firstmakefile='$firstmakefile'
16655 flex='$flex'
16656 fpossize='$fpossize'
16657 fpostype='$fpostype'
16658 freetype='$freetype'
16659 full_ar='$full_ar'
16660 full_csh='$full_csh'
16661 full_sed='$full_sed'
16662 gccosandvers='$gccosandvers'
16663 gccversion='$gccversion'
16664 gidformat='$gidformat'
16665 gidsign='$gidsign'
16666 gidsize='$gidsize'
16667 gidtype='$gidtype'
16668 glibpth='$glibpth'
16669 grep='$grep'
16670 groupcat='$groupcat'
16671 groupstype='$groupstype'
16672 gzip='$gzip'
16673 h_fcntl='$h_fcntl'
16674 h_sysfile='$h_sysfile'
16675 hint='$hint'
16676 hostcat='$hostcat'
16677 i16size='$i16size'
16678 i16type='$i16type'
16679 i32size='$i32size'
16680 i32type='$i32type'
16681 i64size='$i64size'
16682 i64type='$i64type'
16683 i8size='$i8size'
16684 i8type='$i8type'
16685 i_arpainet='$i_arpainet'
16686 i_bsdioctl='$i_bsdioctl'
16687 i_db='$i_db'
16688 i_dbm='$i_dbm'
16689 i_dirent='$i_dirent'
16690 i_dld='$i_dld'
16691 i_dlfcn='$i_dlfcn'
16692 i_fcntl='$i_fcntl'
16693 i_float='$i_float'
16694 i_gdbm='$i_gdbm'
16695 i_grp='$i_grp'
16696 i_iconv='$i_iconv'
16697 i_ieeefp='$i_ieeefp'
16698 i_inttypes='$i_inttypes'
16699 i_libutil='$i_libutil'
16700 i_limits='$i_limits'
16701 i_locale='$i_locale'
16702 i_machcthr='$i_machcthr'
16703 i_malloc='$i_malloc'
16704 i_math='$i_math'
16705 i_memory='$i_memory'
16706 i_mntent='$i_mntent'
16707 i_ndbm='$i_ndbm'
16708 i_netdb='$i_netdb'
16709 i_neterrno='$i_neterrno'
16710 i_netinettcp='$i_netinettcp'
16711 i_niin='$i_niin'
16712 i_poll='$i_poll'
16713 i_prot='$i_prot'
16714 i_pthread='$i_pthread'
16715 i_pwd='$i_pwd'
16716 i_rpcsvcdbm='$i_rpcsvcdbm'
16717 i_sfio='$i_sfio'
16718 i_sgtty='$i_sgtty'
16719 i_shadow='$i_shadow'
16720 i_socks='$i_socks'
16721 i_stdarg='$i_stdarg'
16722 i_stddef='$i_stddef'
16723 i_stdlib='$i_stdlib'
16724 i_string='$i_string'
16725 i_sunmath='$i_sunmath'
16726 i_sysaccess='$i_sysaccess'
16727 i_sysdir='$i_sysdir'
16728 i_sysfile='$i_sysfile'
16729 i_sysfilio='$i_sysfilio'
16730 i_sysin='$i_sysin'
16731 i_sysioctl='$i_sysioctl'
16732 i_syslog='$i_syslog'
16733 i_sysmman='$i_sysmman'
16734 i_sysmode='$i_sysmode'
16735 i_sysmount='$i_sysmount'
16736 i_sysndir='$i_sysndir'
16737 i_sysparam='$i_sysparam'
16738 i_sysresrc='$i_sysresrc'
16739 i_syssecrt='$i_syssecrt'
16740 i_sysselct='$i_sysselct'
16741 i_syssockio='$i_syssockio'
16742 i_sysstat='$i_sysstat'
16743 i_sysstatfs='$i_sysstatfs'
16744 i_sysstatvfs='$i_sysstatvfs'
16745 i_systime='$i_systime'
16746 i_systimek='$i_systimek'
16747 i_systimes='$i_systimes'
16748 i_systypes='$i_systypes'
16749 i_sysuio='$i_sysuio'
16750 i_sysun='$i_sysun'
16751 i_sysutsname='$i_sysutsname'
16752 i_sysvfs='$i_sysvfs'
16753 i_syswait='$i_syswait'
16754 i_termio='$i_termio'
16755 i_termios='$i_termios'
16756 i_time='$i_time'
16757 i_unistd='$i_unistd'
16758 i_ustat='$i_ustat'
16759 i_utime='$i_utime'
16760 i_values='$i_values'
16761 i_varargs='$i_varargs'
16762 i_varhdr='$i_varhdr'
16763 i_vfork='$i_vfork'
16764 ignore_versioned_solibs='$ignore_versioned_solibs'
16765 inc_version_list='$inc_version_list'
16766 inc_version_list_init='$inc_version_list_init'
16767 incpath='$incpath'
16768 inews='$inews'
16769 installarchlib='$installarchlib'
16770 installbin='$installbin'
16771 installman1dir='$installman1dir'
16772 installman3dir='$installman3dir'
16773 installprefix='$installprefix'
16774 installprefixexp='$installprefixexp'
16775 installprivlib='$installprivlib'
16776 installscript='$installscript'
16777 installsitearch='$installsitearch'
16778 installsitebin='$installsitebin'
16779 installsitelib='$installsitelib'
16780 installstyle='$installstyle'
16781 installusrbinperl='$installusrbinperl'
16782 installvendorarch='$installvendorarch'
16783 installvendorbin='$installvendorbin'
16784 installvendorlib='$installvendorlib'
16785 intsize='$intsize'
16786 issymlink='$issymlink'
16787 ivdformat='$ivdformat'
16788 ivsize='$ivsize'
16789 ivtype='$ivtype'
16790 known_extensions='$known_extensions'
16791 ksh='$ksh'
16792 ld='$ld'
16793 lddlflags='$lddlflags'
16794 ldflags='$ldflags'
16795 ldflags_uselargefiles='$ldflags_uselargefiles'
16796 ldlibpthname='$ldlibpthname'
16797 less='$less'
16798 lib_ext='$lib_ext'
16799 libc='$libc'
16800 libperl='$libperl'
16801 libpth='$libpth'
16802 libs='$libs'
16803 libsdirs='$libsdirs'
16804 libsfiles='$libsfiles'
16805 libsfound='$libsfound'
16806 libspath='$libspath'
16807 libswanted='$libswanted'
16808 libswanted_uselargefiles='$libswanted_uselargefiles'
16809 line='$line'
16810 lint='$lint'
16811 lkflags='$lkflags'
16812 ln='$ln'
16813 lns='$lns'
16814 locincpth='$locincpth'
16815 loclibpth='$loclibpth'
16816 longdblsize='$longdblsize'
16817 longlongsize='$longlongsize'
16818 longsize='$longsize'
16819 lp='$lp'
16820 lpr='$lpr'
16821 ls='$ls'
16822 lseeksize='$lseeksize'
16823 lseektype='$lseektype'
16824 mail='$mail'
16825 mailx='$mailx'
16826 make='$make'
16827 make_set_make='$make_set_make'
16828 mallocobj='$mallocobj'
16829 mallocsrc='$mallocsrc'
16830 malloctype='$malloctype'
16831 man1dir='$man1dir'
16832 man1direxp='$man1direxp'
16833 man1ext='$man1ext'
16834 man3dir='$man3dir'
16835 man3direxp='$man3direxp'
16836 man3ext='$man3ext'
16837 mips_type='$mips_type'
16838 mkdir='$mkdir'
16839 mmaptype='$mmaptype'
16840 modetype='$modetype'
16841 more='$more'
16842 multiarch='$multiarch'
16843 mv='$mv'
16844 myarchname='$myarchname'
16845 mydomain='$mydomain'
16846 myhostname='$myhostname'
16847 myuname='$myuname'
16848 n='$n'
16849 need_va_copy='$need_va_copy'
16850 netdb_hlen_type='$netdb_hlen_type'
16851 netdb_host_type='$netdb_host_type'
16852 netdb_name_type='$netdb_name_type'
16853 netdb_net_type='$netdb_net_type'
16854 nm='$nm'
16855 nm_opt='$nm_opt'
16856 nm_so_opt='$nm_so_opt'
16857 nonxs_ext='$nonxs_ext'
16858 nroff='$nroff'
16859 nvEUformat='$nvEUformat'
16860 nvFUformat='$nvFUformat'
16861 nvGUformat='$nvGUformat'
16862 nveformat='$nveformat'
16863 nvfformat='$nvfformat'
16864 nvgformat='$nvgformat'
16865 nvsize='$nvsize'
16866 nvtype='$nvtype'
16867 o_nonblock='$o_nonblock'
16868 obj_ext='$obj_ext'
16869 old_pthread_create_joinable='$old_pthread_create_joinable'
16870 optimize='$optimize'
16871 orderlib='$orderlib'
16872 osname='$osname'
16873 osvers='$osvers'
16874 otherlibdirs='$otherlibdirs'
16875 package='$package'
16876 pager='$pager'
16877 passcat='$passcat'
16878 patchlevel='$patchlevel'
16879 path_sep='$path_sep'
16880 perl5='$perl5'
16881 perl='$perl'
16882 perl_patchlevel='$perl_patchlevel'
16883 perladmin='$perladmin'
16884 perllibs='$perllibs'
16885 perlpath='$perlpath'
16886 pg='$pg'
16887 phostname='$phostname'
16888 pidtype='$pidtype'
16889 plibpth='$plibpth'
16890 pm_apiversion='$pm_apiversion'
16891 pmake='$pmake'
16892 pr='$pr'
16893 prefix='$prefix'
16894 prefixexp='$prefixexp'
16895 privlib='$privlib'
16896 privlibexp='$privlibexp'
16897 prototype='$prototype'
16898 ptrsize='$ptrsize'
16899 quadkind='$quadkind'
16900 quadtype='$quadtype'
16901 randbits='$randbits'
16902 randfunc='$randfunc'
16903 randseedtype='$randseedtype'
16904 ranlib='$ranlib'
16905 rd_nodata='$rd_nodata'
16906 revision='$revision'
16907 rm='$rm'
16908 rmail='$rmail'
16909 runnm='$runnm'
16910 sPRIEUldbl='$sPRIEUldbl'
16911 sPRIFUldbl='$sPRIFUldbl'
16912 sPRIGUldbl='$sPRIGUldbl'
16913 sPRIXU64='$sPRIXU64'
16914 sPRId64='$sPRId64'
16915 sPRIeldbl='$sPRIeldbl'
16916 sPRIfldbl='$sPRIfldbl'
16917 sPRIgldbl='$sPRIgldbl'
16918 sPRIi64='$sPRIi64'
16919 sPRIo64='$sPRIo64'
16920 sPRIu64='$sPRIu64'
16921 sPRIx64='$sPRIx64'
16922 sSCNfldbl='$sSCNfldbl'
16923 sched_yield='$sched_yield'
16924 scriptdir='$scriptdir'
16925 scriptdirexp='$scriptdirexp'
16926 sed='$sed'
16927 seedfunc='$seedfunc'
16928 selectminbits='$selectminbits'
16929 selecttype='$selecttype'
16930 sendmail='$sendmail'
16931 sh='$sh'
16932 shar='$shar'
16933 sharpbang='$sharpbang'
16934 shmattype='$shmattype'
16935 shortsize='$shortsize'
16936 shrpenv='$shrpenv'
16937 shsharp='$shsharp'
16938 sig_count='$sig_count'
16939 sig_name='$sig_name'
16940 sig_name_init='$sig_name_init'
16941 sig_num='$sig_num'
16942 sig_num_init='$sig_num_init'
16943 sig_size='$sig_size'
16944 signal_t='$signal_t'
16945 sitearch='$sitearch'
16946 sitearchexp='$sitearchexp'
16947 sitebin='$sitebin'
16948 sitebinexp='$sitebinexp'
16949 sitelib='$sitelib'
16950 sitelib_stem='$sitelib_stem'
16951 sitelibexp='$sitelibexp'
16952 siteprefix='$siteprefix'
16953 siteprefixexp='$siteprefixexp'
16954 sizesize='$sizesize'
16955 sizetype='$sizetype'
16956 sleep='$sleep'
16957 smail='$smail'
16958 so='$so'
16959 sockethdr='$sockethdr'
16960 socketlib='$socketlib'
16961 socksizetype='$socksizetype'
16962 sort='$sort'
16963 spackage='$spackage'
16964 spitshell='$spitshell'
16965 src='$src'
16966 ssizetype='$ssizetype'
16967 startperl='$startperl'
16968 startsh='$startsh'
16969 static_ext='$static_ext'
16970 stdchar='$stdchar'
16971 stdio_base='$stdio_base'
16972 stdio_bufsiz='$stdio_bufsiz'
16973 stdio_cnt='$stdio_cnt'
16974 stdio_filbuf='$stdio_filbuf'
16975 stdio_ptr='$stdio_ptr'
16976 stdio_stream_array='$stdio_stream_array'
16977 strings='$strings'
16978 submit='$submit'
16979 subversion='$subversion'
16980 sysman='$sysman'
16981 tail='$tail'
16982 tar='$tar'
16983 tbl='$tbl'
16984 tee='$tee'
16985 test='$test'
16986 timeincl='$timeincl'
16987 timetype='$timetype'
16988 touch='$touch'
16989 tr='$tr'
16990 trnl='$trnl'
16991 troff='$troff'
16992 u16size='$u16size'
16993 u16type='$u16type'
16994 u32size='$u32size'
16995 u32type='$u32type'
16996 u64size='$u64size'
16997 u64type='$u64type'
16998 u8size='$u8size'
16999 u8type='$u8type'
17000 uidformat='$uidformat'
17001 uidsign='$uidsign'
17002 uidsize='$uidsize'
17003 uidtype='$uidtype'
17004 uname='$uname'
17005 uniq='$uniq'
17006 uquadtype='$uquadtype'
17007 use5005threads='$use5005threads'
17008 use64bitall='$use64bitall'
17009 use64bitint='$use64bitint'
17010 usedl='$usedl'
17011 useithreads='$useithreads'
17012 uselargefiles='$uselargefiles'
17013 uselongdouble='$uselongdouble'
17014 usemorebits='$usemorebits'
17015 usemultiplicity='$usemultiplicity'
17016 usemymalloc='$usemymalloc'
17017 usenm='$usenm'
17018 useopcode='$useopcode'
17019 useperlio='$useperlio'
17020 useposix='$useposix'
17021 usereentrant='$usereentrant'
17022 usesfio='$usesfio'
17023 useshrplib='$useshrplib'
17024 usesocks='$usesocks'
17025 usethreads='$usethreads'
17026 usevendorprefix='$usevendorprefix'
17027 usevfork='$usevfork'
17028 usrinc='$usrinc'
17029 uuname='$uuname'
17030 uvXUformat='$uvXUformat'
17031 uvoformat='$uvoformat'
17032 uvsize='$uvsize'
17033 uvtype='$uvtype'
17034 uvuformat='$uvuformat'
17035 uvxformat='$uvxformat'
17036 vendorarch='$vendorarch'
17037 vendorarchexp='$vendorarchexp'
17038 vendorbin='$vendorbin'
17039 vendorbinexp='$vendorbinexp'
17040 vendorlib='$vendorlib'
17041 vendorlib_stem='$vendorlib_stem'
17042 vendorlibexp='$vendorlibexp'
17043 vendorprefix='$vendorprefix'
17044 vendorprefixexp='$vendorprefixexp'
17045 version='$version'
17046 versiononly='$versiononly'
17047 vi='$vi'
17048 voidflags='$voidflags'
17049 xlibpth='$xlibpth'
17050 xs_apiversion='$xs_apiversion'
17051 yacc='$yacc'
17052 yaccflags='$yaccflags'
17053 zcat='$zcat'
17054 zip='$zip'
17055 EOT
17056
17057 : Add in command line options if available
17058 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17059
17060 : add special variables
17061 $test -f $src/patchlevel.h && \
17062 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17063 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17064 echo "PERL_CONFIG_SH=true" >>config.sh
17065
17066 : propagate old symbols
17067 if $test -f UU/config.sh; then
17068         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17069         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17070         $sort | $uniq -u >UU/oldsyms
17071         set X `cat UU/oldsyms`
17072         shift
17073         case $# in
17074         0) ;;
17075         *)
17076                 cat <<EOM
17077 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17078 EOM
17079                 echo "# Variables propagated from previous config.sh file." >>config.sh
17080                 for sym in `cat UU/oldsyms`; do
17081                         echo "    Propagating $hint variable "'$'"$sym..."
17082                         eval 'tmp="$'"${sym}"'"'
17083                         echo "$tmp" | \
17084                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17085                 done
17086                 ;;
17087         esac
17088 fi
17089
17090 : Finish up by extracting the .SH files
17091 case "$alldone" in
17092 exit)
17093         $rm -rf UU
17094         echo "Extraction done."
17095         exit 0
17096         ;;
17097 cont)
17098         ;;
17099 '')
17100         dflt=''
17101         nostick=true
17102         $cat <<EOM
17103
17104 If you'd like to make any changes to the config.sh file before I begin
17105 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17106
17107 EOM
17108         rp="Press return or use a shell escape to edit config.sh:"
17109         . UU/myread
17110         nostick=''
17111         case "$ans" in
17112         '') ;;
17113         *) : in case they cannot read
17114                 sh 1>&4 -c "$ans";;
17115         esac
17116         ;;
17117 esac
17118
17119 : if this fails, just run all the .SH files by hand
17120 . ./config.sh
17121
17122 echo " "
17123 exec 1>&4
17124 . ./UU/extract
17125
17126 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17127         dflt=y
17128         case "$silent" in
17129         true) ;;
17130         *)
17131                 $cat <<EOM
17132
17133 Now you need to generate make dependencies by running "$make depend".
17134 You might prefer to run it in background: "$make depend > makedepend.out &"
17135 It can take a while, so you might not want to run it right now.
17136
17137 EOM
17138                 ;;
17139         esac
17140         rp="Run $make depend now?"
17141         . UU/myread
17142         case "$ans" in
17143         y*)
17144                 $make depend && echo "Now you must run '$make'."
17145                 ;;
17146         *)
17147                 echo "You must run '$make depend' then '$make'."
17148                 ;;
17149         esac
17150 elif test -f [Mm]akefile; then
17151         echo " "
17152         echo "Now you must run a $make."
17153 else
17154         echo "Configure done."
17155 fi
17156
17157 if $test -f Policy.sh; then
17158     $cat <<EOM
17159
17160 If you compile $package on a different machine or from a different object
17161 directory, copy the Policy.sh file from this object directory to the
17162 new one before you run Configure -- this will help you with most of
17163 the policy defaults.
17164
17165 EOM
17166 fi
17167 if $test -f config.msg; then
17168     echo "Hmm.  I also noted the following information while running:"
17169     echo " "
17170     $cat config.msg >&4
17171     $rm -f config.msg
17172 fi
17173 $rm -f kit*isdone ark*isdone
17174 $rm -rf UU
17175
17176 : End of Configure
17177