Add Configure directive -Dusereentrant for Artur's ithreads work,
[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:10:05 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 : full support for void wanted by default
1061 defvoidused=15
1062
1063 : List of libraries we want.
1064 : If anyone needs -lnet, put it in a hint file.
1065 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1066 libswanted="$libswanted dld ld sun m c cposix posix"
1067 libswanted="$libswanted ndir dir crypt sec"
1068 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1069 : We probably want to search /usr/shlib before most other libraries.
1070 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1071 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1072 glibpth="/usr/shlib $glibpth"
1073 : Do not use vfork unless overridden by a hint file.
1074 usevfork=false
1075
1076 : Find the basic shell for Bourne shell scripts
1077 case "$sh" in
1078 '')
1079         case "$SYSTYPE" in
1080         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1081         *) xxx='/bin/sh';;
1082         esac
1083         if test -f "$xxx"; then
1084                 sh="$xxx"
1085         else
1086                 : Build up a list and do a single loop so we can 'break' out.
1087                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1088                 for xxx in sh bash ksh pdksh ash; do
1089                         for p in $pth; do
1090                                 try="$try ${p}/${xxx}"
1091                         done
1092                 done
1093                 for xxx in $try; do
1094                         if test -f "$xxx"; then
1095                                 sh="$xxx";
1096                                 break
1097                         elif test -f "$xxx.exe"; then
1098                                 sh="$xxx";
1099                                 break
1100                         fi
1101                 done
1102         fi
1103         ;;
1104 esac
1105
1106 case "$sh" in
1107 '')     cat <<EOM >&2
1108 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1109
1110 Usually it's in /bin/sh.  How did you even get this far?
1111 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1112 we'll try to straighten this all out.
1113 EOM
1114         exit 1
1115         ;;
1116 esac
1117
1118 : see if sh knows # comments
1119 if `$sh -c '#' >/dev/null 2>&1`; then
1120         shsharp=true
1121         spitshell=cat
1122         xcat=/bin/cat
1123         test -f $xcat || xcat=/usr/bin/cat
1124         echo "#!$xcat" >try
1125         $eunicefix try
1126         chmod +x try
1127         ./try > today
1128         if test -s today; then
1129                 sharpbang='#!'
1130         else
1131                 echo "#! $xcat" > try
1132                 $eunicefix try
1133                 chmod +x try
1134                 ./try > today
1135                 if test -s today; then
1136                         sharpbang='#! '
1137                 else
1138                         sharpbang=': use '
1139                 fi
1140         fi
1141 else
1142         echo " "
1143         echo "Your $sh doesn't grok # comments--I will strip them later on."
1144         shsharp=false
1145         cd ..
1146         echo "exec grep -v '^[  ]*#'" >spitshell
1147         chmod +x spitshell
1148         $eunicefix spitshell
1149         spitshell=`pwd`/spitshell
1150         cd UU
1151         echo "I presume that if # doesn't work, #! won't work either!"
1152         sharpbang=': use '
1153 fi
1154 rm -f try today
1155
1156 : figure out how to guarantee sh startup
1157 case "$startsh" in
1158 '') startsh=${sharpbang}${sh} ;;
1159 *)
1160 esac
1161 cat >try <<EOSS
1162 $startsh
1163 set abc
1164 test "$?abc" != 1
1165 EOSS
1166
1167 chmod +x try
1168 $eunicefix try
1169 if ./try; then
1170         : echo "Yup, it does."
1171 else
1172         echo "Hmm... '$startsh' does not guarantee sh startup..."
1173         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1174 fi
1175 rm -f try
1176
1177
1178 : Save command line options in file UU/cmdline.opt for later use in
1179 : generating config.sh.
1180 cat > cmdline.opt <<EOSH
1181 # Configure command line arguments.
1182 config_arg0='$0'
1183 config_args='$*'
1184 config_argc=$#
1185 EOSH
1186 argn=1
1187 for arg in "$@"; do
1188         cat >>cmdline.opt <<EOSH
1189 config_arg$argn='$arg'
1190 EOSH
1191         argn=`expr $argn + 1`
1192 done
1193
1194 : produce awk script to parse command line options
1195 cat >options.awk <<'EOF'
1196 BEGIN {
1197         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1198
1199         len = length(optstr);
1200         for (i = 1; i <= len; i++) {
1201                 c = substr(optstr, i, 1);
1202                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1203                 if (a == ":") {
1204                         arg[c] = 1;
1205                         i++;
1206                 }
1207                 opt[c] = 1;
1208         }
1209 }
1210 {
1211         expect = 0;
1212         str = $0;
1213         if (substr(str, 1, 1) != "-") {
1214                 printf("'%s'\n", str);
1215                 next;
1216         }
1217         len = length($0);
1218         for (i = 2; i <= len; i++) {
1219                 c = substr(str, i, 1);
1220                 if (!opt[c]) {
1221                         printf("-%s\n", substr(str, i));
1222                         next;
1223                 }
1224                 printf("-%s\n", c);
1225                 if (arg[c]) {
1226                         if (i < len)
1227                                 printf("'%s'\n", substr(str, i + 1));
1228                         else
1229                                 expect = 1;
1230                         next;
1231                 }
1232         }
1233 }
1234 END {
1235         if (expect)
1236                 print "?";
1237 }
1238 EOF
1239
1240 : process the command line options
1241 set X `for arg in "$@"; do echo "X$arg"; done |
1242         sed -e s/X// | awk -f options.awk`
1243 eval "set $*"
1244 shift
1245 rm -f options.awk
1246
1247 : set up default values
1248 fastread=''
1249 reuseval=false
1250 config_sh=''
1251 alldone=''
1252 error=''
1253 silent=''
1254 extractsh=''
1255 override=''
1256 knowitall=''
1257 rm -f optdef.sh posthint.sh
1258 cat >optdef.sh <<EOS
1259 $startsh
1260 EOS
1261
1262
1263 : option parsing
1264 while test $# -gt 0; do
1265         case "$1" in
1266         -d) shift; fastread=yes;;
1267         -e) shift; alldone=cont;;
1268         -f)
1269                 shift
1270                 cd ..
1271                 if test -r "$1"; then
1272                         config_sh="$1"
1273                 else
1274                         echo "$me: cannot read config file $1." >&2
1275                         error=true
1276                 fi
1277                 cd UU
1278                 shift;;
1279         -h) shift; error=true;;
1280         -r) shift; reuseval=true;;
1281         -s) shift; silent=true; realsilent=true;;
1282         -E) shift; alldone=exit;;
1283         -K) shift; knowitall=true;;
1284         -O) shift; override=true;;
1285         -S) shift; silent=true; extractsh=true;;
1286         -D)
1287                 shift
1288                 case "$1" in
1289                 *=)
1290                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1291                         echo "$me: ignoring -D $1" >&2
1292                         ;;
1293                 *=*) echo "$1" | \
1294                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1295                 *) echo "$1='define'" >> optdef.sh;;
1296                 esac
1297                 shift
1298                 ;;
1299         -U)
1300                 shift
1301                 case "$1" in
1302                 *=) echo "$1" >> optdef.sh;;
1303                 *=*)
1304                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1305                         echo "$me: ignoring -U $1" >&2
1306                         ;;
1307                 *) echo "$1='undef'" >> optdef.sh;;
1308                 esac
1309                 shift
1310                 ;;
1311         -A)
1312             shift
1313             xxx=''
1314             yyy="$1"
1315             zzz=''
1316             uuu=undef
1317             case "$yyy" in
1318             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1319                  case "$zzz" in
1320                  *:*) zzz='' ;;
1321                  *)   xxx=append
1322                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1323                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1324                  esac
1325                  ;;
1326             esac
1327             case "$xxx" in
1328             '')  case "$yyy" in
1329                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1330                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1331                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1332                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1333                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1334                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1335                  esac
1336                  ;;       
1337             esac
1338             case "$xxx" in
1339             append)
1340                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1341             clear)
1342                 echo "$yyy=''"                  >> posthint.sh ;;
1343             define)
1344                 case "$zzz" in
1345                 '') zzz=define ;;
1346                 esac
1347                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1348             eval)
1349                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1350             prepend)
1351                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1352             undef)
1353                 case "$zzz" in
1354                 '') zzz="$uuu" ;;
1355                 esac
1356                 echo "$yyy=$zzz"                >> posthint.sh ;;
1357             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1358             esac
1359             shift
1360             ;;
1361         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1362             exit 0;;
1363         --) break;;
1364         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1365         *) break;;
1366         esac
1367 done
1368
1369 case "$error" in
1370 true)
1371         cat >&2 <<EOM
1372 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1373                  [-U symbol] [-U symbol=] [-A command:symbol...]
1374   -d : use defaults for all answers.
1375   -e : go on without questioning past the production of config.sh.
1376   -f : specify an alternate default configuration file.
1377   -h : print this help message and exit (with an error status).
1378   -r : reuse C symbols value if possible (skips costly nm extraction).
1379   -s : silent mode, only echoes questions and essential information.
1380   -D : define symbol to have some value:
1381          -D symbol         symbol gets the value 'define'
1382          -D symbol=value   symbol gets the value 'value'
1383   -E : stop at the end of questions, after having produced config.sh.
1384   -K : do not use unless you know what you are doing.
1385   -O : let -D and -U override definitions from loaded configuration file.
1386   -S : perform variable substitutions on all .SH files (can mix with -f)
1387   -U : undefine symbol:
1388          -U symbol    symbol gets the value 'undef'
1389          -U symbol=   symbol gets completely empty
1390   -A : manipulate symbol after the platform specific hints have been applied:
1391          -A symbol=value                append " "value to symbol
1392          -A append:symbol=value         append value to symbol
1393          -A define:symbol=value         define symbol to have value
1394          -A clear:symbol                define symbol to be ''
1395          -A define:symbol               define symbol to be 'define'
1396          -A eval:symbol=value           define symbol to be eval of value
1397          -A prepend:symbol=value        prepend value to symbol
1398          -A undef:symbol                define symbol to be 'undef'
1399          -A undef:symbol=               define symbol to be ''
1400   -V : print version number and exit (with a zero status).
1401 EOM
1402         exit 1
1403         ;;
1404 esac
1405
1406 : Sanity checks
1407 case "$fastread$alldone" in
1408 yescont|yesexit) ;;
1409 *)
1410         case "$extractsh" in
1411         true) ;;
1412         *)
1413                 if test ! -t 0; then
1414                         echo "Say 'sh Configure', not 'sh <Configure'"
1415                         exit 1
1416                 fi
1417                 ;;
1418         esac
1419         ;;
1420 esac
1421
1422 exec 4>&1
1423 case "$silent" in
1424 true) exec 1>/dev/null;;
1425 esac
1426
1427 : run the defines and the undefines, if any, but leave the file out there...
1428 touch optdef.sh
1429 . ./optdef.sh
1430 : create the posthint manipulation script and leave the file out there...
1431 touch posthint.sh
1432
1433 : set package name
1434 package=perl5
1435 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1436 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1437 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1438 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1439 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1440 esac
1441
1442 : Some greps do not return status, grrr.
1443 echo "grimblepritz" >grimble
1444 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1445         contains=contains
1446 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1447         contains=grep
1448 else
1449         contains=contains
1450 fi
1451 rm -f grimble
1452 : the following should work in any shell
1453 case "$contains" in
1454 contains*)
1455         echo " "
1456         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1457         cat >contains <<'EOSS'
1458 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1459 EOSS
1460 chmod +x contains
1461 esac
1462
1463 : Find the path to the source tree
1464 case "$src" in
1465 '') case "$0" in
1466     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1467          case "$src" in
1468          /*)    ;;
1469          .)     ;;
1470          *)     src=`cd ../$src && pwd` ;;
1471          esac
1472          ;;
1473     *)   src='.';;
1474     esac;;
1475 esac
1476 case "$src" in
1477 '')     src=/
1478         rsrc=/
1479         ;;
1480 /*) rsrc="$src";;
1481 *) rsrc="../$src";;
1482 esac
1483 if test -f $rsrc/Configure && \
1484         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1485 then
1486    : found it, so we are ok.
1487 else
1488         rsrc=''
1489         for src in . .. ../.. ../../.. ../../../..; do
1490                 if test -f ../$src/Configure && \
1491                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1492                 then
1493                         rsrc=../$src
1494                         break
1495                 fi
1496         done
1497 fi
1498 case "$rsrc" in
1499 '')
1500         cat <<EOM >&4
1501
1502 Sorry, I can't seem to locate the source dir for $package.  Please start
1503 Configure with an explicit path -- i.e. /some/path/Configure.
1504
1505 EOM
1506         exit 1
1507         ;;
1508 ../.)   rsrc='..';;
1509 *)
1510         echo " "
1511         echo "Sources for $package found in \"$src\"." >&4
1512         ;;
1513 esac
1514
1515 : script used to extract .SH files with variable substitutions
1516 cat >extract <<'EOS'
1517 PERL_CONFIG_SH=true
1518 echo "Doing variable substitutions on .SH files..."
1519 if test -f MANIFEST; then
1520         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1521 else
1522         echo "(Looking for .SH files under the source directory.)"
1523         set x `(cd $src; find . -name "*.SH" -print)`
1524 fi
1525 shift
1526 case $# in
1527 0) set x `(cd $src; echo *.SH)`; shift;;
1528 esac
1529 if test ! -f $src/$1; then
1530         shift
1531 fi
1532 mkdir_p='
1533 name=$1;
1534 create="";
1535 while test $name; do
1536         if test ! -d "$name"; then
1537                 create="$name $create";
1538                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1539                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1540         else
1541                 name="";
1542         fi;
1543 done;
1544 for file in $create; do
1545         mkdir $file;
1546 done
1547 '
1548 for file in $*; do
1549         case "$src" in
1550         ".")
1551                 case "$file" in
1552                 */*)
1553                         dir=`expr X$file : 'X\(.*\)/'`
1554                         file=`expr X$file : 'X.*/\(.*\)'`
1555                         (cd $dir && . ./$file)
1556                         ;;
1557                 *)
1558                         . ./$file
1559                         ;;
1560                 esac
1561                 ;;
1562         *)
1563                 case "$file" in
1564                 */*)
1565                         dir=`expr X$file : 'X\(.*\)/'`
1566                         file=`expr X$file : 'X.*/\(.*\)'`
1567                         (set x $dir; shift; eval $mkdir_p)
1568                         sh <$src/$dir/$file
1569                         ;;
1570                 *)
1571                         sh <$src/$file
1572                         ;;
1573                 esac
1574                 ;;
1575         esac
1576 done
1577 if test -f $src/config_h.SH; then
1578         if test ! -f config.h; then
1579         : oops, they left it out of MANIFEST, probably, so do it anyway.
1580         . $src/config_h.SH
1581         fi
1582 fi
1583 EOS
1584
1585 : extract files and exit if asked to do so
1586 case "$extractsh" in
1587 true)
1588         case "$realsilent" in
1589         true) ;;
1590         *) exec 1>&4;;
1591         esac
1592         case "$config_sh" in
1593         '') config_sh='config.sh';;
1594         esac
1595         echo " "
1596         echo "Fetching answers from $config_sh..."
1597         cd ..
1598         . $config_sh
1599         test "$override" && . ./optdef.sh
1600         echo " "
1601         . UU/extract
1602         rm -rf UU
1603         echo "Extraction done."
1604         exit 0
1605         ;;
1606 esac
1607
1608 : Eunice requires " " instead of "", can you believe it
1609 echo " "
1610 : Here we go...
1611 echo "Beginning of configuration questions for $package."
1612
1613 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1614
1615 : first determine how to suppress newline on echo command
1616 echo " "
1617 echo "Checking echo to see how to suppress newlines..."
1618 (echo "hi there\c" ; echo " ") >.echotmp
1619 if $contains c .echotmp >/dev/null 2>&1 ; then
1620         echo "...using -n."
1621         n='-n'
1622         c=''
1623 else
1624         cat <<'EOM'
1625 ...using \c
1626 EOM
1627         n=''
1628         c='\c'
1629 fi
1630 echo $n "The star should be here-->$c"
1631 echo '*'
1632 rm -f .echotmp
1633
1634 : Now test for existence of everything in MANIFEST
1635 echo " "
1636 if test -f $rsrc/MANIFEST; then
1637         echo "First let's make sure your kit is complete.  Checking..." >&4
1638         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1639         rm -f missing
1640         tmppwd=`pwd`
1641         for filelist in x??; do
1642                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1643         done
1644         if test -s missing; then
1645                 cat missing >&4
1646                 cat >&4 <<'EOM'
1647
1648 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1649
1650 You have the option of continuing the configuration process, despite the
1651 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1652 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1653 and contact the author (perlbug@perl.org).
1654
1655 EOM
1656                 echo $n "Continue? [n] $c" >&4
1657                 read ans
1658                 case "$ans" in
1659                 y*)
1660                         echo "Continuing..." >&4
1661                         rm -f missing
1662                         ;;
1663                 *)
1664                         echo "ABORTING..." >&4
1665                         kill $$
1666                         ;;
1667                 esac
1668         else
1669                 echo "Looks good..."
1670         fi
1671 else
1672         echo "There is no MANIFEST file.  I hope your kit is complete !"
1673 fi
1674 rm -f missing x??
1675
1676 echo " "
1677 : Find the appropriate value for a newline for tr
1678 if test -n "$DJGPP"; then
1679        trnl='\012'
1680 fi
1681 if test X"$trnl" = X; then
1682         case "`echo foo|tr '\n' x 2>/dev/null`" in
1683         foox) trnl='\n' ;;
1684         esac
1685 fi
1686 if test X"$trnl" = X; then
1687         case "`echo foo|tr '\012' x 2>/dev/null`" in
1688         foox) trnl='\012' ;;
1689         esac
1690 fi
1691 if test X"$trnl" = X; then
1692         cat <<EOM >&2
1693
1694 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1695
1696 EOM
1697         exit 1
1698 fi
1699
1700 : compute the number of columns on the terminal for proper question formatting
1701 case "$COLUMNS" in
1702 '') COLUMNS='80';;
1703 esac
1704
1705 : set up the echo used in my read
1706 myecho="case \"\$xxxm\" in
1707 '') echo $n \"\$rp $c\" >&4;;
1708 *) case \"\$rp\" in
1709         '') echo $n \"[\$xxxm] $c\";;
1710         *)
1711                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1712                         echo \"\$rp\" >&4
1713                         echo $n \"[\$xxxm] $c\" >&4
1714                 else
1715                         echo $n \"\$rp [\$xxxm] $c\" >&4
1716                 fi
1717                 ;;
1718         esac;;
1719 esac"
1720
1721 : now set up to do reads with possible shell escape and default assignment
1722 cat <<EOSC >myread
1723 $startsh
1724 xxxm=\$dflt
1725 $myecho
1726 ans='!'
1727 case "\$fastread" in
1728 yes) case "\$dflt" in
1729         '') ;;
1730         *) ans='';
1731                 case "\$silent-\$rp" in
1732                 true-) ;;
1733                 *) echo " " >&4;;
1734                 esac;;
1735         esac;;
1736 *) case "\$silent" in
1737         true) case "\$rp" in
1738                 '') ans='';;
1739                 esac;;
1740         esac;;
1741 esac
1742 while expr "X\$ans" : "X!" >/dev/null; do
1743         read answ
1744         set x \$xxxm
1745         shift
1746         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1747         case  "\$answ" in
1748         "!")
1749                 sh 1>&4
1750                 echo " "
1751                 $myecho
1752                 ;;
1753         !*)
1754                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1755                 shift
1756                 sh 1>&4 -c "\$*"
1757                 echo " "
1758                 $myecho
1759                 ;;
1760         "\$ans")
1761                 case "\$ans" in
1762                 \\&*)
1763                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1764                         shift
1765                         case "\$1" in
1766                         -d)
1767                                 fastread=yes
1768                                 echo "(OK, I'll run with -d after this question.)" >&4
1769                                 ;;
1770                         -*)
1771                                 echo "*** Sorry, \$1 not supported yet." >&4
1772                                 ;;
1773                         esac
1774                         $myecho
1775                         ans=!
1776                         ;;
1777                 esac;;
1778         *)
1779                 case "\$aok" in
1780                 y)
1781                         echo "*** Substitution done -- please confirm."
1782                         xxxm="\$ans"
1783                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1784                         xxxm="\$ans"
1785                         ans=!
1786                         ;;
1787                 *)
1788                         echo "*** Error -- try again."
1789                         ans=!
1790                         ;;
1791                 esac
1792                 $myecho
1793                 ;;
1794         esac
1795         case "\$ans\$xxxm\$nostick" in
1796         '')
1797                 ans=!
1798                 $myecho
1799                 ;;
1800         esac
1801 done
1802 case "\$ans" in
1803 '') ans="\$xxxm";;
1804 esac
1805 EOSC
1806
1807 : create .config dir to save info across Configure sessions
1808 test -d ../.config || mkdir ../.config
1809 cat >../.config/README <<EOF
1810 This directory created by Configure to save information that should
1811 persist across sessions for $package.
1812
1813 You may safely delete it if you wish.
1814 EOF
1815
1816 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1817 case "$usedevel" in
1818 $define|true|[yY]*) ;;
1819 *) case "$xversion" in
1820    *[13579])
1821         cat >&4 <<EOH
1822 *** WHOA THERE!!! ***
1823
1824     This is an UNSTABLE DEVELOPMENT release.
1825     The version of this $package distribution is $xversion, that is, odd,
1826     (as opposed to even) and that signifies a development release.
1827     If you want a maintenance release, you want an even-numbered version.
1828
1829     Do ***NOT*** install this into production use.
1830     Data corruption and crashes are possible.
1831
1832     It is most seriously suggested that you do not continue any further
1833     unless you want to help in developing and debugging Perl.
1834
1835     If you *still* want to build perl, you can answer 'y' now,
1836     or pass -Dusedevel to Configure.
1837
1838 EOH
1839         rp='Do you really want to continue?'
1840         dflt='n'
1841         . ./myread
1842         case "$ans" in
1843         [yY]) echo >&4 "Okay, continuing."
1844               usedevel="$define" ;;
1845         *) echo >&4 "Okay, bye."
1846            exit 1
1847            ;;
1848         esac
1849         ;;
1850     esac
1851     ;;
1852 esac
1853 case "$usedevel" in
1854 $define|true|[yY]*)
1855         case "$versiononly" in
1856         '') versiononly="$define" ;;
1857         esac
1858         case "$installusrbinperl" in
1859         '') installusrbinperl="$undef" ;;
1860         esac
1861         ;;
1862 esac
1863
1864 : general instructions
1865 needman=true
1866 firsttime=true
1867 user=`(logname) 2>/dev/null`
1868 case "$user" in
1869 '') user=`whoami 2>&1`;;
1870 esac
1871 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1872         firsttime=false
1873         echo " "
1874         rp='Would you like to see the instructions?'
1875         dflt=n
1876         . ./myread
1877         case "$ans" in
1878         [yY]*) ;;
1879         *) needman=false;;
1880         esac
1881 fi
1882 if $needman; then
1883         cat <<EOH
1884
1885 This installation shell script will examine your system and ask you questions
1886 to determine how the perl5 package should be installed. If you get
1887 stuck on a question, you may use a ! shell escape to start a subshell or
1888 execute a command.  Many of the questions will have default answers in square
1889 brackets; typing carriage return will give you the default.
1890
1891 On some of the questions which ask for file or directory names you are allowed
1892 to use the ~name construct to specify the login directory belonging to "name",
1893 even if you don't have a shell which knows about that.  Questions where this is
1894 allowed will be marked "(~name ok)".
1895
1896 EOH
1897         rp=''
1898         dflt='Type carriage return to continue'
1899         . ./myread
1900         cat <<'EOH'
1901
1902 The prompter used in this script allows you to use shell variables and
1903 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1904 in the default answer, as if the default line was a set of arguments given to a
1905 script shell.  This means you may also use $* to repeat the whole default line,
1906 so you do not have to re-type everything to add something to the default.
1907
1908 Everytime there is a substitution, you will have to confirm.  If there is an
1909 error (e.g. an unmatched backtick), the default answer will remain unchanged
1910 and you will be prompted again.
1911
1912 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1913 the questions and use the computed defaults (or the previous answers if there
1914 was already a config.sh file). Type 'Configure -h' for a list of options.
1915 You may also start interactively and then answer '& -d' at any prompt to turn
1916 on the non-interactive behaviour for the remainder of the execution.
1917
1918 EOH
1919         . ./myread
1920         cat <<EOH
1921
1922 Much effort has been expended to ensure that this shell script will run on any
1923 Unix system.  If despite that it blows up on yours, your best bet is to edit
1924 Configure and run it again.  If you can't run Configure for some reason,
1925 you'll have to generate a config.sh file by hand.  Whatever problems you
1926 have, let me (perlbug@perl.org) know how I blew it.
1927
1928 This installation script affects things in two ways:
1929
1930 1) it may do direct variable substitutions on some of the files included
1931    in this kit.
1932 2) it builds a config.h file for inclusion in C programs.  You may edit
1933    any of these files as the need arises after running this script.
1934
1935 If you make a mistake on a question, there is no easy way to back up to it
1936 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1937 files.  Configure will offer to let you do this before it runs the SH files.
1938
1939 EOH
1940         dflt='Type carriage return to continue'
1941         . ./myread
1942         case "$firsttime" in
1943         true) echo $user >>../.config/instruct;;
1944         esac
1945 fi
1946
1947 : find out where common programs are
1948 echo " "
1949 echo "Locating common programs..." >&4
1950 cat <<EOSC >loc
1951 $startsh
1952 case \$# in
1953 0) exit 1;;
1954 esac
1955 thing=\$1
1956 shift
1957 dflt=\$1
1958 shift
1959 for dir in \$*; do
1960         case "\$thing" in
1961         .)
1962         if test -d \$dir/\$thing; then
1963                 echo \$dir
1964                 exit 0
1965         fi
1966         ;;
1967         *)
1968         for thisthing in \$dir/\$thing; do
1969                 : just loop through to pick last item
1970         done
1971         if test -f \$thisthing; then
1972                 echo \$thisthing
1973                 exit 0
1974         elif test -f \$dir/\$thing.exe; then
1975                 if test -n "$DJGPP"; then
1976                         echo \$dir/\$thing.exe
1977                 else
1978                         : on Eunice apparently
1979                         echo \$dir/\$thing
1980                 fi
1981                 exit 0
1982         fi
1983         ;;
1984         esac
1985 done
1986 echo \$dflt
1987 exit 1
1988 EOSC
1989 chmod +x loc
1990 $eunicefix loc
1991 loclist="
1992 awk
1993 cat
1994 comm
1995 cp
1996 echo
1997 expr
1998 grep
1999 ls
2000 make
2001 mkdir
2002 rm
2003 sed
2004 sort
2005 touch
2006 tr
2007 uniq
2008 "
2009 trylist="
2010 Mcc
2011 ar
2012 bison
2013 byacc
2014 cpp
2015 csh
2016 date
2017 egrep
2018 gzip
2019 less
2020 ln
2021 more
2022 nm
2023 nroff
2024 pg
2025 test
2026 uname
2027 zip
2028 "
2029 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2030 pth="$pth /lib /usr/lib"
2031 for file in $loclist; do
2032         eval xxx=\$$file
2033         case "$xxx" in
2034         /*|?:[\\/]*)
2035                 if test -f "$xxx"; then
2036                         : ok
2037                 else
2038                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2039                         xxx=`./loc $file $file $pth`
2040                 fi
2041                 ;;
2042         '') xxx=`./loc $file $file $pth`;;
2043         *) xxx=`./loc $xxx $xxx $pth`;;
2044         esac
2045         eval $file=$xxx
2046         eval _$file=$xxx
2047         case "$xxx" in
2048         /*)
2049                 echo $file is in $xxx.
2050                 ;;
2051         ?:[\\/]*)
2052                 echo $file is in $xxx.
2053                 ;;
2054         *)
2055                 echo "I don't know where '$file' is, and my life depends on it." >&4
2056                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2057                 exit 1
2058                 ;;
2059         esac
2060 done
2061 echo " "
2062 echo "Don't worry if any of the following aren't found..."
2063 say=offhand
2064 for file in $trylist; do
2065         eval xxx=\$$file
2066         case "$xxx" in
2067         /*|?:[\\/]*)
2068                 if test -f "$xxx"; then
2069                         : ok
2070                 else
2071                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2072                         xxx=`./loc $file $file $pth`
2073                 fi
2074                 ;;
2075         '') xxx=`./loc $file $file $pth`;;
2076         *) xxx=`./loc $xxx $xxx $pth`;;
2077         esac
2078         eval $file=$xxx
2079         eval _$file=$xxx
2080         case "$xxx" in
2081         /*)
2082                 echo $file is in $xxx.
2083                 ;;
2084         ?:[\\/]*)
2085                 echo $file is in $xxx.
2086                 ;;
2087         *)
2088                 echo "I don't see $file out there, $say."
2089                 say=either
2090                 ;;
2091         esac
2092 done
2093 case "$egrep" in
2094 egrep)
2095         echo "Substituting grep for egrep."
2096         egrep=$grep
2097         ;;
2098 esac
2099 case "$ln" in
2100 ln)
2101         echo "Substituting cp for ln."
2102         ln=$cp
2103         ;;
2104 esac
2105 case "$test" in
2106 test)
2107         echo "Hopefully test is built into your sh."
2108         ;;
2109 *)
2110         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2111                 echo "Using the test built into your sh."
2112                 test=test
2113                 _test=test
2114         fi
2115         ;;
2116 esac
2117 case "$echo" in
2118 echo)
2119         echo "Hopefully echo is built into your sh."
2120         ;;
2121 '') ;;
2122 *)
2123         echo " "
2124 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2125         $echo $n "hi there$c" >foo1
2126         echo $n "hi there$c" >foo2
2127         if cmp foo1 foo2 >/dev/null 2>&1; then
2128                 echo "They are compatible.  In fact, they may be identical."
2129         else
2130                 case "$n" in
2131                 '-n') n='' c='\c';;
2132                 *) n='-n' c='';;
2133                 esac
2134                 cat <<FOO
2135 They are not compatible!  You are probably running ksh on a non-USG system.
2136 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2137 have echo built in and we may have to run some Bourne shell scripts.  That
2138 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2139
2140 FOO
2141                 $echo $n "The star should be here-->$c"
2142                 $echo "*"
2143         fi
2144         $rm -f foo1 foo2
2145         ;;
2146 esac
2147
2148 cat <<EOS >checkcc
2149 $startsh
2150 EOS
2151 cat <<'EOSC' >>checkcc
2152 case "$cc" in
2153 '') ;;
2154 *)  $rm -f try try.*
2155     $cat >try.c <<EOM
2156 int main(int argc, char *argv[]) {
2157   return 0;
2158 }
2159 EOM
2160     if $cc -o try $ccflags $ldflags try.c; then
2161        :
2162     else
2163         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2164         despair=yes
2165         trygcc=yes
2166         case "$cc" in
2167         *gcc*) trygcc=no ;;
2168         esac
2169         case "`$cc -v -c try.c 2>&1`" in
2170         *gcc*) trygcc=no ;;
2171         esac
2172         if $test X"$trygcc" = Xyes; then
2173             if gcc -o try -c try.c; then
2174                 echo " "
2175                 echo "You seem to have a working gcc, though." >&4
2176                 rp="Would you like to use it?"
2177                 dflt=y
2178                 if $test -f myread; then
2179                     . ./myread
2180                 else
2181                     if $test -f UU/myread; then
2182                         . ./UU/myread
2183                     else
2184                         echo "Cannot find myread, sorry.  Aborting." >&2
2185                         exit 1
2186                     fi
2187                 fi  
2188                 case "$ans" in
2189                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2190                 esac
2191             fi
2192         fi
2193         if $test X"$despair" = Xyes; then
2194             $cat >&4 <<EOM
2195 You need to find a working C compiler.
2196 Either (purchase and) install the C compiler supplied by your OS vendor,
2197 or for a free C compiler try http://gcc.gnu.org/
2198 I cannot continue any further, aborting.
2199 EOM
2200             exit 1
2201         fi
2202     fi
2203     $rm -f try try.*
2204     ;;
2205 esac
2206 EOSC
2207
2208 : determine whether symbolic links are supported
2209 echo " "
2210 $touch blurfl
2211 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2212         echo "Symbolic links are supported." >&4
2213         lns="$ln -s"
2214 else
2215         echo "Symbolic links are NOT supported." >&4
2216         lns="$ln"
2217 fi
2218 $rm -f blurfl sym
2219
2220 : determine whether symbolic links are supported
2221 echo " "
2222 case "$lns" in
2223 *"ln -s")
2224         echo "Checking how to test for symbolic links..." >&4
2225         $lns blurfl sym
2226         if $test "X$issymlink" = X; then
2227                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2228                 if test $? = 0; then
2229                         issymlink="test -h"
2230                 fi              
2231         fi
2232         if $test "X$issymlink" = X; then
2233                 if  $test -h >/dev/null 2>&1; then
2234                         issymlink="$test -h"
2235                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2236                 fi              
2237         fi
2238         if $test "X$issymlink" = X; then
2239                 if $test -L sym 2>/dev/null; then
2240                         issymlink="$test -L"
2241                 fi
2242         fi
2243         if $test "X$issymlink" != X; then
2244                 echo "You can test for symbolic links with '$issymlink'." >&4
2245         else
2246                 echo "I do not know how you can test for symbolic links." >&4
2247         fi
2248         $rm -f blurfl sym
2249         ;;
2250 *)      echo "No symbolic links, so not testing for their testing..." >&4
2251         ;;
2252 esac
2253 echo " "
2254
2255
2256 case "$mksymlinks" in
2257 $define|true|[yY]*)
2258         case "$src" in
2259         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2260                 exit 1
2261                 ;;
2262         *)      case "$lns:$issymlink" in
2263                 *"ln -s:"*"test -"?)
2264                         echo "Creating the symbolic links..." >&4
2265                         echo "(First creating the subdirectories...)" >&4
2266                         cd ..
2267                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2268                                 read directory
2269                                 test -z "$directory" && break
2270                                 mkdir -p $directory
2271                         done
2272                         # Sanity check 1.
2273                         if test ! -d t/base; then
2274                                 echo "Failed to create the subdirectories.  Aborting." >&4
2275                                 exit 1
2276                         fi
2277                         echo "(Then creating the symlinks...)" >&4
2278                         awk '{print $1}' $src/MANIFEST | while true; do
2279                                 read filename
2280                                 test -z "$filename" && break
2281                                 if test -f $filename; then
2282                                         if $issymlink $filename; then
2283                                                 rm -f $filename
2284                                         fi
2285                                 fi
2286                                 if test -f $filename; then
2287                                         echo "$filename already exists, not symlinking."
2288                                 else
2289                                         ln -s $src/$filename $filename
2290                                 fi
2291                         done
2292                         # Sanity check 2.
2293                         if test ! -f t/base/commonsense.t; then
2294                                 echo "Failed to create the symlinks.  Aborting." >&4
2295                                 exit 1
2296                         fi
2297                         cd UU
2298                         ;;
2299                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2300                         ;;
2301                 esac
2302                 ;;
2303         esac
2304         ;;
2305 esac
2306
2307 : see whether [:lower:] and [:upper:] are supported character classes
2308 echo " "
2309 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2310 ABYZ)
2311         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2312         up='[:upper:]'
2313         low='[:lower:]'
2314         ;;
2315 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2316         # (0xc9 and 0xd1), therefore that is a nice testing point.
2317         if test "X$up" = X -o "X$low" = X; then
2318             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2319             ij) up='[A-Z]'
2320                 low='[a-z]'
2321                 ;;
2322             esac
2323         fi
2324         if test "X$up" = X -o "X$low" = X; then
2325             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2326             ij) up='A-Z'
2327                 low='a-z'
2328                 ;;
2329             esac
2330         fi
2331         if test "X$up" = X -o "X$low" = X; then
2332             case "`echo IJ | od -x 2>/dev/null`" in
2333             *C9D1*|*c9d1*)
2334                 echo "Hey, this might be EBCDIC." >&4
2335                 if test "X$up" = X -o "X$low" = X; then
2336                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2337                     ij) up='[A-IJ-RS-Z]'
2338                         low='[a-ij-rs-z]'
2339                         ;;
2340                     esac
2341                 fi
2342                 if test "X$up" = X -o "X$low" = X; then
2343                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2344                     ij) up='A-IJ-RS-Z'
2345                         low='a-ij-rs-z'
2346                         ;;
2347                     esac
2348                 fi
2349                 ;;
2350             esac
2351         fi
2352 esac
2353 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2354 ij)
2355     echo "Using $up and $low to convert case." >&4
2356     ;;
2357 *)
2358     echo "I don't know how to translate letters from upper to lower case." >&4
2359     echo "Your tr is not acting any way I know of." >&4
2360     exit 1
2361     ;;
2362 esac
2363 : set up the translation script tr, must be called with ./tr of course
2364 cat >tr <<EOSC
2365 $startsh
2366 case "\$1\$2" in
2367 '[A-Z][a-z]') exec $tr '$up' '$low';;
2368 '[a-z][A-Z]') exec $tr '$low' '$up';;
2369 esac
2370 exec $tr "\$@"
2371 EOSC
2372 chmod +x tr
2373 $eunicefix tr
2374
2375 : Try to determine whether config.sh was made on this system
2376 case "$config_sh" in
2377 '')
2378 myuname=`$uname -a 2>/dev/null`
2379 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2380 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2381 # because the A-Z/a-z are not consecutive.
2382 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2383         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2384 newmyuname="$myuname"
2385 dflt=n
2386 case "$knowitall" in
2387 '')
2388         if test -f ../config.sh; then
2389                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2390                         eval "`grep myuname= ../config.sh`"
2391                 fi
2392                 if test "X$myuname" = "X$newmyuname"; then
2393                         dflt=y
2394                 fi
2395         fi
2396         ;;
2397 *) dflt=y;;
2398 esac
2399
2400 : Get old answers from old config file if Configure was run on the
2401 : same system, otherwise use the hints.
2402 hint=default
2403 cd ..
2404 if test -f config.sh; then
2405         echo " "
2406         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2407         . UU/myread
2408         case "$ans" in
2409         n*|N*) echo "OK, I'll ignore it."
2410                 mv config.sh config.sh.old
2411                 myuname="$newmyuname"
2412                 ;;
2413         *)  echo "Fetching default answers from your old config.sh file..." >&4
2414                 tmp_n="$n"
2415                 tmp_c="$c"
2416                 tmp_sh="$sh"
2417                 . ./config.sh
2418                 cp config.sh UU
2419                 n="$tmp_n"
2420                 c="$tmp_c"
2421                 : Older versions did not always set $sh.  Catch re-use of such
2422                 : an old config.sh.
2423                 case "$sh" in
2424                 '') sh="$tmp_sh" ;;
2425                 esac
2426                 hint=previous
2427                 ;;
2428         esac
2429 fi
2430 . ./UU/checkcc
2431 if test ! -f config.sh; then
2432         $cat <<EOM
2433
2434 First time through, eh?  I have some defaults handy for some systems
2435 that need some extra help getting the Configure answers right:
2436
2437 EOM
2438         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2439         dflt=''
2440         : Half the following guesses are probably wrong... If you have better
2441         : tests or hints, please send them to perlbug@perl.org
2442         : The metaconfig authors would also appreciate a copy...
2443         $test -f /irix && osname=irix
2444         $test -f /xenix && osname=sco_xenix
2445         $test -f /dynix && osname=dynix
2446         $test -f /dnix && osname=dnix
2447         $test -f /lynx.os && osname=lynxos
2448         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2449         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2450         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2451         $test -f /bin/mips && /bin/mips && osname=mips
2452         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2453                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2454         $test -d /usr/apollo/bin && osname=apollo
2455         $test -f /etc/saf/_sactab && osname=svr4
2456         $test -d /usr/include/minix && osname=minix
2457         if $test -d /MachTen -o -d /MachTen_Folder; then
2458                 osname=machten
2459                 if $test -x /sbin/version; then
2460                         osvers=`/sbin/version | $awk '{print $2}' |
2461                         $sed -e 's/[A-Za-z]$//'`
2462                 elif $test -x /usr/etc/version; then
2463                         osvers=`/usr/etc/version | $awk '{print $2}' |
2464                         $sed -e 's/[A-Za-z]$//'`
2465                 else
2466                         osvers="$2.$3"
2467                 fi
2468         fi
2469
2470         $test -f /sys/posix.dll &&
2471                 $test -f /usr/bin/what &&
2472                 set X `/usr/bin/what /sys/posix.dll` &&
2473                 $test "$3" = UWIN &&
2474                 osname=uwin &&
2475                 osvers="$5"
2476
2477         if $test -f $uname; then
2478                 set X $myuname
2479                 shift
2480
2481                 case "$5" in
2482                 fps*) osname=fps ;;
2483                 mips*)
2484                         case "$4" in
2485                         umips) osname=umips ;;
2486                         *) osname=mips ;;
2487                         esac;;
2488                 [23]100) osname=mips ;;
2489                 next*) osname=next ;;
2490                 i386*)
2491                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2492                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2493                                 osname='sco'
2494                                 osvers=$tmp
2495                         elif $test -f /etc/kconfig; then
2496                                 osname=isc
2497                                 if test "$lns" = "$ln -s"; then
2498                                         osvers=4
2499                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2500                                         osvers=3
2501                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2502                                         osvers=2
2503                                 fi
2504                         fi
2505                         tmp=''
2506                         ;;
2507                 pc*)
2508                         if test -n "$DJGPP"; then
2509                                 osname=dos
2510                                 osvers=djgpp
2511                         fi
2512                         ;;
2513                 esac
2514
2515                 case "$1" in
2516                 aix) osname=aix
2517                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2518                         case "$tmp" in
2519                         'not found') osvers="$4"."$3" ;;
2520                         '<3240'|'<>3240') osvers=3.2.0 ;;
2521                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2522                         '=3250'|'>3250') osvers=3.2.5 ;;
2523                         *) osvers=$tmp;;
2524                         esac
2525                         ;;
2526                 bsd386) osname=bsd386
2527                         osvers=`$uname -r`
2528                         ;;
2529                 cygwin*) osname=cygwin
2530                         osvers="$3"
2531                         ;;
2532                 *dc.osx) osname=dcosx
2533                         osvers="$3"
2534                         ;;
2535                 dnix) osname=dnix
2536                         osvers="$3"
2537                         ;;
2538                 domainos) osname=apollo
2539                         osvers="$3"
2540                         ;;
2541                 dgux) osname=dgux 
2542                         osvers="$3"
2543                         ;;
2544                 dynixptx*) osname=dynixptx
2545                         osvers=`echo "$4"|sed 's/^v//'`
2546                         ;;
2547                 freebsd) osname=freebsd 
2548                         osvers="$3" ;;
2549                 genix) osname=genix ;;
2550                 hp*) osname=hpux 
2551                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2552                         ;;
2553                 irix*) osname=irix
2554                         case "$3" in
2555                         4*) osvers=4 ;;
2556                         5*) osvers=5 ;;
2557                         *)      osvers="$3" ;;
2558                         esac
2559                         ;;
2560                 linux) osname=linux
2561                         case "$3" in
2562                         *)      osvers="$3" ;;
2563                         esac
2564                         ;;
2565                 MiNT) osname=mint
2566                         ;;
2567                 netbsd*) osname=netbsd
2568                         osvers="$3"
2569                         ;;
2570                 news-os) osvers="$3"
2571                         case "$3" in
2572                         4*) osname=newsos4 ;;
2573                         *) osname=newsos ;;
2574                         esac
2575                         ;;
2576                 next*) osname=next ;;
2577                 nonstop-ux) osname=nonstopux ;;
2578                 POSIX-BC | posix-bc ) osname=posix-bc
2579                         osvers="$3"
2580                         ;;
2581                 powerux | power_ux | powermax_os | powermaxos | \
2582                 powerunix | power_unix) osname=powerux
2583                         osvers="$3"
2584                         ;;
2585                 qnx) osname=qnx
2586                         osvers="$4"
2587                         ;;
2588                 solaris) osname=solaris
2589                         case "$3" in
2590                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2591                         *)      osvers="$3" ;;
2592                         esac
2593                         ;;
2594                 sunos) osname=sunos
2595                         case "$3" in
2596                         5*) osname=solaris
2597                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2598                         *)      osvers="$3" ;;
2599                         esac
2600                         ;;
2601                 titanos) osname=titanos
2602                         case "$3" in
2603                         1*) osvers=1 ;;
2604                         2*) osvers=2 ;;
2605                         3*) osvers=3 ;;
2606                         4*) osvers=4 ;;
2607                         *)      osvers="$3" ;;
2608                         esac
2609                         ;;
2610                 ultrix) osname=ultrix
2611                         osvers="$3"
2612                         ;;
2613                 osf1|mls+)      case "$5" in
2614                                 alpha)
2615                                         osname=dec_osf
2616                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2617                                         case "$osvers" in
2618                                         [1-9].[0-9]*) ;;
2619                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2620                                         esac
2621                                         ;;
2622                         hp*)    osname=hp_osf1  ;;
2623                         mips)   osname=mips_osf1 ;;
2624                         esac
2625                         ;;
2626                 unixware) osname=svr5
2627                         osvers="$4"
2628                         ;;
2629                 uts) osname=uts
2630                         osvers="$3"
2631                         ;;
2632                 $2) case "$osname" in
2633                         *isc*) ;;
2634                         *freebsd*) ;;
2635                         svr*)
2636                                 : svr4.x or possibly later
2637                                 case "svr$3" in 
2638                                 ${osname}*)
2639                                         osname=svr$3
2640                                         osvers=$4
2641                                         ;;
2642                                 esac
2643                                 case "$osname" in
2644                                 svr4.0)
2645                                         : Check for ESIX
2646                                         if test -f /stand/boot ; then
2647                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2648                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2649                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2650                                                         if test -n "$isesix"; then
2651                                                                 osname=esix4
2652                                                         fi
2653                                                 fi
2654                                         fi
2655                                         ;;
2656                                 esac
2657                                 ;;
2658                         *)      if test -f /etc/systemid; then
2659                                         osname=sco
2660                                         set `echo $3 | $sed 's/\./ /g'` $4
2661                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2662                                                 osvers=$1.$2.$3
2663                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2664                                                 osvers=$1.$2
2665                                         elif $test -f $src/hints/sco_$1.sh; then
2666                                                 osvers=$1
2667                                         fi
2668                                 else
2669                                         case "$osname" in
2670                                         '') : Still unknown.  Probably a generic Sys V.
2671                                                 osname="sysv"
2672                                                 osvers="$3"
2673                                                 ;;
2674                                         esac
2675                                 fi
2676                                 ;;
2677                         esac
2678                         ;;
2679                 *)      case "$osname" in
2680                         '') : Still unknown.  Probably a generic BSD.
2681                                 osname="$1"
2682                                 osvers="$3"
2683                                 ;;
2684                         esac
2685                         ;;
2686                 esac
2687         else
2688                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2689                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2690                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2691                                 osname=news_os
2692                         fi
2693                         $rm -f UU/kernel.what
2694                 elif test -d c:/.; then
2695                         set X $myuname
2696                         osname=os2
2697                         osvers="$5"
2698                 fi
2699         fi
2700         
2701         : Now look for a hint file osname_osvers, unless one has been
2702         : specified already.
2703         case "$hintfile" in
2704         ''|' ')
2705                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2706                 : Also try without trailing minor version numbers.
2707                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2708                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2709                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2710                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2711                 case "$file" in
2712                 '') dflt=none ;;
2713                 *)  case "$osvers" in
2714                         '') dflt=$file
2715                                 ;;
2716                         *)  if $test -f $src/hints/$file.sh ; then
2717                                         dflt=$file
2718                                 elif $test -f $src/hints/$xfile.sh ; then
2719                                         dflt=$xfile
2720                                 elif $test -f $src/hints/$xxfile.sh ; then
2721                                         dflt=$xxfile
2722                                 elif $test -f $src/hints/$xxxfile.sh ; then
2723                                         dflt=$xxxfile
2724                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2725                                         dflt=$xxxxfile
2726                                 elif $test -f "$src/hints/${osname}.sh" ; then
2727                                         dflt="${osname}"
2728                                 else
2729                                         dflt=none
2730                                 fi
2731                                 ;;
2732                         esac
2733                         ;;
2734                 esac
2735                 if $test -f Policy.sh ; then
2736                         case "$dflt" in
2737                         *Policy*) ;;
2738                         none) dflt="Policy" ;;
2739                         *) dflt="Policy $dflt" ;;
2740                         esac
2741                 fi
2742                 ;;
2743         *)
2744                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2745                 ;;
2746         esac
2747
2748         if $test -f Policy.sh ; then
2749                 $cat <<EOM
2750
2751 There's also a Policy hint file available, which should make the
2752 site-specific (policy) questions easier to answer.
2753 EOM
2754
2755         fi
2756
2757         $cat <<EOM
2758
2759 You may give one or more space-separated answers, or "none" if appropriate.
2760 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2761 is a good thing.  DO NOT give a wrong version or a wrong OS.
2762
2763 EOM
2764
2765         rp="Which of these apply, if any?"
2766         . UU/myread
2767         tans=$ans
2768         for file in $tans; do
2769                 if $test X$file = XPolicy -a -f Policy.sh; then
2770                         . Policy.sh
2771                         $cat Policy.sh >> UU/config.sh
2772                 elif $test -f $src/hints/$file.sh; then
2773                         . $src/hints/$file.sh
2774                         $cat $src/hints/$file.sh >> UU/config.sh
2775                 elif $test X$tans = X -o X$tans = Xnone ; then
2776                         : nothing
2777                 else
2778                         : Give one chance to correct a possible typo.
2779                         echo "$file.sh does not exist"
2780                         dflt=$file
2781                         rp="hint to use instead?"
2782                         . UU/myread
2783                         for file in $ans; do
2784                                 if $test -f "$src/hints/$file.sh"; then
2785                                         . $src/hints/$file.sh
2786                                         $cat $src/hints/$file.sh >> UU/config.sh
2787                                 elif $test X$ans = X -o X$ans = Xnone ; then
2788                                         : nothing
2789                                 else
2790                                         echo "$file.sh does not exist -- ignored."
2791                                 fi
2792                         done
2793                 fi
2794         done
2795
2796         hint=recommended
2797         : Remember our hint file for later.
2798         if $test -f "$src/hints/$file.sh" ; then
2799                 hintfile="$file"
2800         else
2801                 hintfile=''
2802         fi
2803 fi
2804 cd UU
2805 ;;
2806 *)
2807         echo " "
2808         echo "Fetching default answers from $config_sh..." >&4
2809         tmp_n="$n"
2810         tmp_c="$c"
2811         cd ..
2812         cp $config_sh config.sh 2>/dev/null
2813         chmod +w config.sh
2814         . ./config.sh
2815         cd UU
2816         cp ../config.sh .
2817         n="$tmp_n"
2818         c="$tmp_c"
2819         hint=previous
2820         ;;
2821 esac
2822 test "$override" && . ./optdef.sh
2823
2824 : Restore computed paths
2825 for file in $loclist $trylist; do
2826         eval $file="\$_$file"
2827 done
2828
2829 cat << EOM
2830
2831 Configure uses the operating system name and version to set some defaults.
2832 The default value is probably right if the name rings a bell. Otherwise,
2833 since spelling matters for me, either accept the default or answer "none"
2834 to leave it blank.
2835
2836 EOM
2837 case "$osname" in
2838         ''|' ')
2839                 case "$hintfile" in
2840                 ''|' '|none) dflt=none ;;
2841                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2842                 esac
2843                 ;;
2844         *) dflt="$osname" ;;
2845 esac
2846 rp="Operating system name?"
2847 . ./myread
2848 case "$ans" in
2849 none)  osname='' ;;
2850 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2851 esac
2852 echo " "
2853 case "$osvers" in
2854         ''|' ')
2855                 case "$hintfile" in
2856                 ''|' '|none) dflt=none ;;
2857                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2858                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2859                         case "$dflt" in
2860                         ''|' ') dflt=none ;;
2861                         esac
2862                         ;;
2863                 esac
2864                 ;;
2865         *) dflt="$osvers" ;;
2866 esac
2867 rp="Operating system version?"
2868 . ./myread
2869 case "$ans" in
2870 none)  osvers='' ;;
2871 *) osvers="$ans" ;;
2872 esac
2873
2874
2875 . ./posthint.sh
2876
2877 : who configured the system
2878 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2879 cf_by=`(logname) 2>/dev/null`
2880 case "$cf_by" in
2881 "")
2882         cf_by=`(whoami) 2>/dev/null`
2883         case "$cf_by" in
2884         "") cf_by=unknown ;;
2885         esac ;;
2886 esac
2887
2888 : set up the script used to warn in case of inconsistency
2889 cat <<EOS >whoa
2890 $startsh
2891 EOS
2892 cat <<'EOSC' >>whoa
2893 dflt=y
2894 echo " "
2895 echo "*** WHOA THERE!!! ***" >&4
2896 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2897 rp="    Keep the $hint value?"
2898 . ./myread
2899 case "$ans" in
2900 y) td=$was; tu=$was;;
2901 esac
2902 EOSC
2903
2904 : function used to set $1 to $val
2905 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2906 case "$val$was" in
2907 $define$undef) . ./whoa; eval "$var=\$td";;
2908 $undef$define) . ./whoa; eval "$var=\$tu";;
2909 *) eval "$var=$val";;
2910 esac'
2911
2912 case "$usethreads" in
2913 $define|true|[yY]*)     dflt='y';;
2914 *) dflt='n';;
2915 esac
2916 cat <<EOM
2917
2918 Perl can be built to take advantage of threads on some systems.
2919 To do so, Configure can be run with -Dusethreads.
2920
2921 Note that threading is a highly experimental feature, and
2922 some known race conditions still remain.  If you choose to try
2923 it, be very sure to not actually deploy it for production
2924 purposes.  README.threads has more details, and is required
2925 reading if you enable threads.
2926
2927 If this doesn't make any sense to you, just accept the default '$dflt'.
2928 EOM
2929 rp='Build a threading Perl?'
2930 . ./myread
2931 case "$ans" in
2932 y|Y)    val="$define" ;;
2933 *)      val="$undef" ;;
2934 esac
2935 set usethreads
2936 eval $setvar
2937
2938 case "$usethreads" in
2939 $define)
2940         $cat <<EOM
2941
2942 As of 5.5.640, Perl has two different internal threading implementations,
2943 the 5.005 version (5005threads) and an interpreter-based version
2944 (ithreads) that has one interpreter per thread.  Both are very 
2945 experimental.  This arrangement exists to help developers work out
2946 which one is better.
2947
2948 If you're a casual user, you probably don't want interpreter-threads
2949 at this time.  There doesn't yet exist a way to create threads from
2950 within Perl in this model, i.e., "use Thread;" will NOT work.
2951 EOM
2952         : Default to ithreads unless overridden on command line or with
2953         : old config.sh
2954         dflt='y'
2955         case "$use5005threads" in
2956                 $define|true|[yY]*) dflt='n';;
2957         esac
2958         case "$useithreads" in
2959                 $undef|false|[nN]*) dflt='n';;
2960         esac
2961         rp='Use interpreter-based ithreads?'
2962         . ./myread
2963         case "$ans" in
2964         y|Y)    val="$define" ;;
2965         *)      val="$undef" ;;
2966         esac
2967         set useithreads
2968         eval $setvar
2969         : Now set use5005threads to the opposite value.
2970         case "$useithreads" in
2971         $define) val="$undef" ;;
2972         *) val="$define" ;;
2973         esac
2974         set use5005threads
2975         eval $setvar
2976         ;;
2977 *)
2978         useithreads="$undef"
2979         use5005threads="$undef"
2980         ;;
2981 esac
2982
2983 case "$useithreads$use5005threads" in
2984 "$define$define")
2985         $cat >&4 <<EOM
2986
2987 You cannot have both the ithreads and the 5.005 threads enabled
2988 at the same time.  Disabling the 5.005 threads since they are
2989 much less stable than the ithreads.
2990
2991 EOM
2992         use5005threads="$undef"
2993         ;;
2994 esac
2995
2996 case "$d_oldpthreads" in
2997 '')     : Configure tests would be welcome here.  For now, assume undef.
2998         val="$undef" ;;
2999 *)      val="$d_oldpthreads" ;;
3000 esac
3001 set d_oldpthreads
3002 eval $setvar
3003
3004
3005 case "$usethreads" in
3006 "$define"|true|[yY]*)
3007 : Look for a hint-file generated 'call-back-unit'.  If the
3008 : user has specified that a threading perl is to be built,
3009 : we may need to set or change some other defaults.
3010         if $test -f usethreads.cbu; then
3011                 echo "Your platform has some specific hints for threaded builds, using them..."
3012                 . ./usethreads.cbu
3013         else
3014                 $cat <<EOM
3015 (Your platform doesn't have any specific hints for threaded builds.
3016  Assuming POSIX threads, then.)
3017 EOM
3018         fi
3019         ;;
3020 esac
3021
3022 cat <<EOM
3023
3024 Perl can be built so that multiple Perl interpreters can coexist
3025 within the same Perl executable.
3026 EOM
3027
3028 case "$useithreads" in
3029 $define)
3030         cat <<EOM
3031 This multiple interpreter support is required for interpreter-based threads.
3032 EOM
3033         val="$define"
3034         ;;
3035 *)      case "$usemultiplicity" in
3036         $define|true|[yY]*)     dflt='y';;
3037         *) dflt='n';;
3038         esac
3039         echo " "
3040         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3041         rp='Build Perl for multiplicity?'
3042         . ./myread
3043         case "$ans" in
3044         y|Y)    val="$define" ;;
3045         *)      val="$undef" ;;
3046         esac
3047         ;;
3048 esac
3049 set usemultiplicity
3050 eval $setvar
3051
3052 : make some quick guesses about what we are up against
3053 echo " "
3054 $echo $n "Hmm...  $c"
3055 echo exit 1 >bsd
3056 echo exit 1 >usg
3057 echo exit 1 >v7
3058 echo exit 1 >osf1
3059 echo exit 1 >eunice
3060 echo exit 1 >xenix
3061 echo exit 1 >venix
3062 echo exit 1 >os2
3063 d_bsd="$undef"
3064 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3065 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3066 then
3067         echo "Looks kind of like an OSF/1 system, but we'll see..."
3068         echo exit 0 >osf1
3069 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3070         xxx=`./loc addbib blurfl $pth`
3071         if $test -f $xxx; then
3072         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3073                 echo exit 0 >bsd
3074                 echo exit 0 >usg
3075         else
3076                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3077                         echo "Looks kind of like an extended USG system, but we'll see..."
3078                 else
3079                         echo "Looks kind of like a USG system, but we'll see..."
3080                 fi
3081                 echo exit 0 >usg
3082         fi
3083 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3084         echo "Looks kind of like a BSD system, but we'll see..."
3085         d_bsd="$define"
3086         echo exit 0 >bsd
3087 else
3088         echo "Looks kind of like a Version 7 system, but we'll see..."
3089         echo exit 0 >v7
3090 fi
3091 case "$eunicefix" in
3092 *unixtovms*)
3093         $cat <<'EOI'
3094 There is, however, a strange, musty smell in the air that reminds me of
3095 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3096 EOI
3097         echo exit 0 >eunice
3098         d_eunice="$define"
3099 : it so happens the Eunice I know will not run shell scripts in Unix format
3100         ;;
3101 *)
3102         echo " "
3103         echo "Congratulations.  You aren't running Eunice."
3104         d_eunice="$undef"
3105         ;;
3106 esac
3107 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3108 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3109 : semicolon as a patch separator
3110 case "$p_" in
3111 :) ;;
3112 *)
3113         $cat <<'EOI'
3114 I have the feeling something is not exactly right, however...don't tell me...
3115 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3116 (Or you may be running DOS with DJGPP.)
3117 EOI
3118         echo exit 0 >os2
3119         ;;
3120 esac
3121 if test -f /xenix; then
3122         echo "Actually, this looks more like a XENIX system..."
3123         echo exit 0 >xenix
3124         d_xenix="$define"
3125 else
3126         echo " "
3127         echo "It's not Xenix..."
3128         d_xenix="$undef"
3129 fi
3130 chmod +x xenix
3131 $eunicefix xenix
3132 if test -f /venix; then
3133         echo "Actually, this looks more like a VENIX system..."
3134         echo exit 0 >venix
3135 else
3136         echo " "
3137         if ./xenix; then
3138                 : null
3139         else
3140                 echo "Nor is it Venix..."
3141         fi
3142 fi
3143 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3144 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3145 $rm -f foo
3146
3147 case "$cc" in
3148 '') dflt=cc;;
3149 *) dflt="$cc";;
3150 esac
3151 rp="Use which C compiler?"
3152 . ./myread
3153 cc="$ans"
3154 : Look for a hint-file generated 'call-back-unit'.  Now that the
3155 : user has specified the compiler, we may need to set or change some
3156 : other defaults.
3157 if $test -f cc.cbu; then
3158     . ./cc.cbu
3159 fi
3160 . ./checkcc
3161
3162 echo " "
3163 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3164 $cat >gccvers.c <<EOM
3165 #include <stdio.h>
3166 int main() {
3167 #ifdef __GNUC__
3168 #ifdef __VERSION__
3169         printf("%s\n", __VERSION__);
3170 #else
3171         printf("%s\n", "1");
3172 #endif
3173 #endif
3174         exit(0);
3175 }
3176 EOM
3177 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3178         gccversion=`./gccvers`
3179         case "$gccversion" in
3180         '') echo "You are not using GNU cc." ;;
3181         *)  echo "You are using GNU cc $gccversion."
3182             ccname=gcc  
3183             ;;
3184         esac
3185 else
3186         echo " "
3187         echo "*** WHOA THERE!!! ***" >&4
3188         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3189         case "$knowitall" in
3190         '')
3191         echo "    You'd better start hunting for one and let me know about it." >&4
3192                 exit 1
3193                 ;;
3194         esac
3195 fi
3196 $rm -f gccvers*
3197 case "$gccversion" in
3198 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3199 esac
3200 case "$gccversion" in
3201 '') gccosandvers='' ;;
3202 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3203    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3204    gccshortvers=''
3205    case "$gccosandvers" in
3206    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3207    $osname$osvers) ;; # looking good
3208    $osname*) cat <<EOM >&4
3209
3210 *** WHOA THERE!!! ***
3211
3212     Your gcc has not been compiled for the exact release of
3213     your operating system ($gccosandvers versus $osname$osvers).
3214
3215     In general it is a good idea to keep gcc synchronized with
3216     the operating system because otherwise serious problems
3217     may ensue when trying to compile software, like Perl.
3218
3219     I'm trying to be optimistic here, though, and will continue.
3220     If later during the configuration and build icky compilation
3221     problems appear (headerfile conflicts being the most common
3222     manifestation), I suggest reinstalling the gcc to match
3223     your operating system release.
3224
3225 EOM
3226       ;;
3227    *) gccosandvers='' ;; # failed to parse, better be silent
3228    esac
3229    ;;
3230 esac
3231 case "$ccname" in
3232 '') ccname="$cc" ;;
3233 esac
3234
3235 case "$gccversion" in
3236 '') ;;
3237 *)  case "$ccflags" in
3238     *-Wall*) ;;
3239     *) ccflags="$ccflags -Wall" ;;
3240     esac
3241     ;;
3242 esac
3243
3244 : see how we invoke the C preprocessor
3245 echo " "
3246 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3247 cat <<'EOT' >testcpp.c
3248 #define ABC abc
3249 #define XYZ xyz
3250 ABC.XYZ
3251 EOT
3252 cd ..
3253 if test ! -f cppstdin; then
3254         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3255                 # AIX cc -E doesn't show the absolute headerfile
3256                 # locations but we'll cheat by using the -M flag.
3257                 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
3258         else
3259                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3260         fi
3261 else
3262         echo "Keeping your $hint cppstdin wrapper."
3263 fi
3264 chmod 755 cppstdin
3265 wrapper=`pwd`/cppstdin
3266 ok='false'
3267 cd UU
3268
3269 if $test "X$cppstdin" != "X" && \
3270         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3271         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3272 then
3273         echo "You used to use $cppstdin $cppminus so we'll use that again."
3274         case "$cpprun" in
3275         '') echo "But let's see if we can live without a wrapper..." ;;
3276         *)
3277                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3278                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3279                 then
3280                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3281                         ok='true'
3282                 else
3283                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3284                 fi
3285                 ;;
3286         esac
3287 else
3288         case "$cppstdin" in
3289         '') ;;
3290         *)
3291                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3292                 ;;
3293         esac
3294 fi
3295
3296 if $ok; then
3297         : nothing
3298 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3299         $cc -E <testcpp.c >testcpp.out 2>&1; \
3300         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3301         echo "Yup, it does."
3302         x_cpp="$cc -E"
3303         x_minus='';
3304 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3305         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3306         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3307         echo "Yup, it does."
3308         x_cpp="$cc -E"
3309         x_minus='-';
3310 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3311         $cc -P <testcpp.c >testcpp.out 2>&1; \
3312         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3313         echo "Yipee, that works!"
3314         x_cpp="$cc -P"
3315         x_minus='';
3316 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3317         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3318         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3319         echo "At long last!"
3320         x_cpp="$cc -P"
3321         x_minus='-';
3322 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3323         $cpp <testcpp.c >testcpp.out 2>&1; \
3324         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3325         echo "It works!"
3326         x_cpp="$cpp"
3327         x_minus='';
3328 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3329         $cpp - <testcpp.c >testcpp.out 2>&1; \
3330         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3331         echo "Hooray, it works!  I was beginning to wonder."
3332         x_cpp="$cpp"
3333         x_minus='-';
3334 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3335         $wrapper <testcpp.c >testcpp.out 2>&1; \
3336         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3337         x_cpp="$wrapper"
3338         x_minus=''
3339         echo "Eureka!"
3340 else
3341         dflt=''
3342         rp="No dice.  I can't find a C preprocessor.  Name one:"
3343         . ./myread
3344         x_cpp="$ans"
3345         x_minus=''
3346         $x_cpp <testcpp.c >testcpp.out 2>&1
3347         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3348                 echo "OK, that will do." >&4
3349         else
3350 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3351                 exit 1
3352         fi
3353 fi
3354
3355 case "$ok" in
3356 false)
3357         cppstdin="$x_cpp"
3358         cppminus="$x_minus"
3359         cpprun="$x_cpp"
3360         cpplast="$x_minus"
3361         set X $x_cpp
3362         shift
3363         case "$1" in
3364         "$cpp")
3365                 echo "Perhaps can we force $cc -E using a wrapper..."
3366                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3367                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3368                 then
3369                         echo "Yup, we can."
3370                         cppstdin="$wrapper"
3371                         cppminus='';
3372                 else
3373                         echo "Nope, we'll have to live without it..."
3374                 fi
3375                 ;;
3376         esac
3377         case "$cpprun" in
3378         "$wrapper")
3379                 cpprun=''
3380                 cpplast=''
3381                 ;;
3382         esac
3383         ;;
3384 esac
3385
3386 case "$cppstdin" in
3387 "$wrapper"|'cppstdin') ;;
3388 *) $rm -f $wrapper;;
3389 esac
3390 $rm -f testcpp.c testcpp.out
3391
3392 : decide how portable to be.  Allow command line overrides.
3393 case "$d_portable" in
3394 "$undef") ;;
3395 *)      d_portable="$define" ;;
3396 esac
3397
3398 : set up shell script to do ~ expansion
3399 cat >filexp <<EOSS
3400 $startsh
3401 : expand filename
3402 case "\$1" in
3403  ~/*|~)
3404         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3405         ;;
3406  ~*)
3407         if $test -f /bin/csh; then
3408                 /bin/csh -f -c "glob \$1"
3409                 failed=\$?
3410                 echo ""
3411                 exit \$failed
3412         else
3413                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3414                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3415                 if $test ! -d "\$dir"; then
3416                         me=\`basename \$0\`
3417                         echo "\$me: can't locate home directory for: \$name" >&2
3418                         exit 1
3419                 fi
3420                 case "\$1" in
3421                 */*)
3422                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3423                         ;;
3424                 *)
3425                         echo \$dir
3426                         ;;
3427                 esac
3428         fi
3429         ;;
3430 *)
3431         echo \$1
3432         ;;
3433 esac
3434 EOSS
3435 chmod +x filexp
3436 $eunicefix filexp
3437
3438 : now set up to get a file name
3439 cat <<EOS >getfile
3440 $startsh
3441 EOS
3442 cat <<'EOSC' >>getfile
3443 tilde=''
3444 fullpath=''
3445 already=''
3446 skip=''
3447 none_ok=''
3448 exp_file=''
3449 nopath_ok=''
3450 orig_rp="$rp"
3451 orig_dflt="$dflt"
3452 case "$gfpth" in
3453 '') gfpth='.' ;;
3454 esac
3455
3456 case "$fn" in
3457 *\(*)
3458         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3459         fn=`echo $fn | sed 's/(.*)//'`
3460         ;;
3461 esac
3462
3463 case "$fn" in
3464 *:*)
3465         loc_file=`expr $fn : '.*:\(.*\)'`
3466         fn=`expr $fn : '\(.*\):.*'`
3467         ;;
3468 esac
3469
3470 case "$fn" in
3471 *~*) tilde=true;;
3472 esac
3473 case "$fn" in
3474 */*) fullpath=true;;
3475 esac
3476 case "$fn" in
3477 *+*) skip=true;;
3478 esac
3479 case "$fn" in
3480 *n*) none_ok=true;;
3481 esac
3482 case "$fn" in
3483 *e*) exp_file=true;;
3484 esac
3485 case "$fn" in
3486 *p*) nopath_ok=true;;
3487 esac
3488
3489 case "$fn" in
3490 *f*) type='File';;
3491 *d*) type='Directory';;
3492 *l*) type='Locate';;
3493 esac
3494
3495 what="$type"
3496 case "$what" in
3497 Locate) what='File';;
3498 esac
3499
3500 case "$exp_file" in
3501 '')
3502         case "$d_portable" in
3503         "$define") ;;
3504         *) exp_file=true;;
3505         esac
3506         ;;
3507 esac
3508
3509 cd ..
3510 while test "$type"; do
3511         redo=''
3512         rp="$orig_rp"
3513         dflt="$orig_dflt"
3514         case "$tilde" in
3515         true) rp="$rp (~name ok)";;
3516         esac
3517         . UU/myread
3518         if test -f UU/getfile.ok && \
3519                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3520         then
3521                 value="$ans"
3522                 ansexp="$ans"
3523                 break
3524         fi
3525         case "$ans" in
3526         none)
3527                 value=''
3528                 ansexp=''
3529                 case "$none_ok" in
3530                 true) type='';;
3531                 esac
3532                 ;;
3533         *)
3534                 case "$tilde" in
3535                 '') value="$ans"
3536                         ansexp="$ans";;
3537                 *)
3538                         value=`UU/filexp $ans`
3539                         case $? in
3540                         0)
3541                                 if test "$ans" != "$value"; then
3542                                         echo "(That expands to $value on this system.)"
3543                                 fi
3544                                 ;;
3545                         *) value="$ans";;
3546                         esac
3547                         ansexp="$value"
3548                         case "$exp_file" in
3549                         '') value="$ans";;
3550                         esac
3551                         ;;
3552                 esac
3553                 case "$fullpath" in
3554                 true)
3555                         case "$ansexp" in
3556                         /*) value="$ansexp" ;;
3557                         [a-zA-Z]:/*) value="$ansexp" ;;
3558                         *)
3559                                 redo=true
3560                                 case "$already" in
3561                                 true)
3562                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3563                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3564                                         ;;
3565                                 *)
3566                                 echo "Please give a full path name, starting with slash." >&4
3567                                         case "$tilde" in
3568                                         true)
3569                                 echo "Note that using ~name is ok provided it expands well." >&4
3570                                                 already=true
3571                                                 ;;
3572                                         esac
3573                                 esac
3574                                 ;;
3575                         esac
3576                         ;;
3577                 esac
3578                 case "$redo" in
3579                 '')
3580                         case "$type" in
3581                         File)
3582                                 for fp in $gfpth; do
3583                                         if test "X$fp" = X.; then
3584                                             pf="$ansexp"
3585                                         else    
3586                                             pf="$fp/$ansexp"
3587                                         fi
3588                                         if test -f "$pf"; then
3589                                                 type=''
3590                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3591                                         then
3592                                                 echo "($value is not a plain file, but that's ok.)"
3593                                                 type=''
3594                                         fi
3595                                         if test X"$type" = X; then
3596                                             value="$pf"
3597                                             break
3598                                         fi
3599                                 done
3600                                 ;;
3601                         Directory)
3602                                 for fp in $gfpth; do
3603                                         if test "X$fp" = X.; then
3604                                             dir="$ans"
3605                                             direxp="$ansexp"
3606                                         else    
3607                                             dir="$fp/$ansexp"
3608                                             direxp="$fp/$ansexp"
3609                                         fi
3610                                         if test -d "$direxp"; then
3611                                                 type=''
3612                                                 value="$dir"
3613                                                 break
3614                                         fi
3615                                 done
3616                                 ;;
3617                         Locate)
3618                                 if test -d "$ansexp"; then
3619                                         echo "(Looking for $loc_file in directory $value.)"
3620                                         value="$value/$loc_file"
3621                                         ansexp="$ansexp/$loc_file"
3622                                 fi
3623                                 if test -f "$ansexp"; then
3624                                         type=''
3625                                 fi
3626                                 case "$nopath_ok" in
3627                                 true)   case "$value" in
3628                                         */*) ;;
3629                                         *)      echo "Assuming $value will be in people's path."
3630                                                 type=''
3631                                                 ;;
3632                                         esac
3633                                         ;;
3634                                 esac
3635                                 ;;
3636                         esac
3637
3638                         case "$skip" in
3639                         true) type='';
3640                         esac
3641
3642                         case "$type" in
3643                         '') ;;
3644                         *)
3645                                 if test "$fastread" = yes; then
3646                                         dflt=y
3647                                 else
3648                                         dflt=n
3649                                 fi
3650                                 rp="$what $value doesn't exist.  Use that name anyway?"
3651                                 . UU/myread
3652                                 dflt=''
3653                                 case "$ans" in
3654                                 y*) type='';;
3655                                 *) echo " ";;
3656                                 esac
3657                                 ;;
3658                         esac
3659                         ;;
3660                 esac
3661                 ;;
3662         esac
3663 done
3664 cd UU
3665 ans="$value"
3666 rp="$orig_rp"
3667 dflt="$orig_dflt"
3668 rm -f getfile.ok
3669 test "X$gfpthkeep" != Xy && gfpth=""
3670 EOSC
3671
3672 : What should the include directory be ?
3673 echo " "
3674 $echo $n "Hmm...  $c"
3675 dflt='/usr/include'
3676 incpath=''
3677 mips_type=''
3678 if $test -f /bin/mips && /bin/mips; then
3679         echo "Looks like a MIPS system..."
3680         $cat >usr.c <<'EOCP'
3681 #ifdef SYSTYPE_BSD43
3682 /bsd43
3683 #endif
3684 EOCP
3685         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3686                 dflt='/bsd43/usr/include'
3687                 incpath='/bsd43'
3688                 mips_type='BSD 4.3'
3689         else
3690                 mips_type='System V'
3691         fi
3692         $rm -f usr.c usr.out
3693         echo "and you're compiling with the $mips_type compiler and libraries."
3694         xxx_prompt=y
3695         echo "exit 0" >mips
3696 else
3697         echo "Doesn't look like a MIPS system."
3698         xxx_prompt=n
3699         echo "exit 1" >mips
3700 fi
3701 chmod +x mips
3702 $eunicefix mips
3703 case "$usrinc" in
3704 '') ;;
3705 *) dflt="$usrinc";;
3706 esac
3707 case "$xxx_prompt" in
3708 y)      fn=d/
3709         echo " "
3710         rp='Where are the include files you want to use?'
3711         . ./getfile
3712         usrinc="$ans"
3713         ;;
3714 *)      usrinc="$dflt"
3715         ;;
3716 esac
3717
3718 : Set private lib path
3719 case "$plibpth" in
3720 '') if ./mips; then
3721                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3722         fi;;
3723 esac
3724 case "$libpth" in
3725 ' ') dlist='';;
3726 '') dlist="$loclibpth $plibpth $glibpth";;
3727 *) dlist="$libpth";;
3728 esac
3729
3730 : Now check and see which directories actually exist, avoiding duplicates
3731 libpth=''
3732 for xxx in $dlist
3733 do
3734     if $test -d $xxx; then
3735                 case " $libpth " in
3736                 *" $xxx "*) ;;
3737                 *) libpth="$libpth $xxx";;
3738                 esac
3739     fi
3740 done
3741 $cat <<'EOM'
3742
3743 Some systems have incompatible or broken versions of libraries.  Among
3744 the directories listed in the question below, please remove any you
3745 know not to be holding relevant libraries, and add any that are needed.
3746 Say "none" for none.
3747
3748 EOM
3749 case "$libpth" in
3750 '') dflt='none';;
3751 *)
3752         set X $libpth
3753         shift
3754         dflt=${1+"$@"}
3755         ;;
3756 esac
3757 rp="Directories to use for library searches?"
3758 . ./myread
3759 case "$ans" in
3760 none) libpth=' ';;
3761 *) libpth="$ans";;
3762 esac
3763
3764 : compute shared library extension
3765 case "$so" in
3766 '')
3767         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3768                 dflt='sl'
3769         else
3770                 dflt='so'
3771         fi
3772         ;;
3773 *) dflt="$so";;
3774 esac
3775 $cat <<EOM
3776
3777 On some systems, shared libraries may be available.  Answer 'none' if
3778 you want to suppress searching of shared libraries for the remainder
3779 of this configuration.
3780
3781 EOM
3782 rp='What is the file extension used for shared libraries?'
3783 . ./myread
3784 so="$ans"
3785
3786 : Define several unixisms.
3787 : Hints files or command line option can be used to override them.
3788 : The convoluted testing is in case hints files set either the old
3789 : or the new name.
3790 case "$_exe" in
3791 '')     case "$exe_ext" in
3792     '') ;;
3793         *)      _exe="$exe_ext" ;;
3794         esac
3795         ;;
3796 esac
3797 case "$_a" in
3798 '')     case "$lib_ext" in
3799     '') _a='.a';;
3800         *)      _a="$lib_ext" ;;
3801         esac
3802         ;;
3803 esac
3804 case "$_o" in
3805 '') case "$obj_ext" in
3806         '')     _o='.o';;
3807         *)      _o="$obj_ext";;
3808         esac
3809         ;;
3810 esac
3811 case "$p_" in
3812 '') case "$path_sep" in
3813         '')     p_=':';;
3814         *)      p_="$path_sep";;
3815         esac
3816         ;;
3817 esac
3818 exe_ext=$_exe
3819 lib_ext=$_a
3820 obj_ext=$_o
3821 path_sep=$p_
3822
3823 : Which makefile gets called first.  This is used by make depend.
3824 case "$firstmakefile" in
3825 '') firstmakefile='makefile';;
3826 esac
3827
3828 case "$usesocks" in
3829 $define|true|[yY]*)     dflt='y';;
3830 *) dflt='n';;
3831 esac
3832 cat <<EOM
3833
3834 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3835 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3836 to use the PerlIO abstraction layer, this will be implicitly selected.
3837
3838 If this doesn't make any sense to you, just accept the default '$dflt'.
3839 EOM
3840 rp='Build Perl for SOCKS?'
3841 . ./myread
3842 case "$ans" in
3843 y|Y)    val="$define" ;;     
3844 *)      val="$undef" ;;
3845 esac
3846 set usesocks
3847 eval $setvar
3848
3849 case "$usesocks" in
3850 $define|true|[yY]*) useperlio="$define";;
3851 esac
3852
3853 : Looking for optional libraries
3854 echo " "
3855 echo "Checking for optional libraries..." >&4
3856 case "$libs" in
3857 ' '|'') dflt='';;
3858 *) dflt="$libs";;
3859 esac
3860 case "$libswanted" in
3861 '') libswanted='c_s';;
3862 esac
3863 case "$usesocks" in
3864 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3865 esac
3866 libsfound=''
3867 libsfiles=''
3868 libsdirs=''
3869 libspath=''
3870 for thisdir in $libpth $xlibpth; do
3871   test -d $thisdir && libspath="$libspath $thisdir"
3872 done
3873 for thislib in $libswanted; do
3874         for thisdir in $libspath; do
3875             xxx=''
3876             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3877                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3878                 $test -f "$xxx" && eval $libscheck
3879                 $test -f "$xxx" && libstyle=shared
3880             fi
3881             if test ! -f "$xxx"; then
3882                 xxx=$thisdir/lib$thislib.$so
3883                 $test -f "$xxx" && eval $libscheck
3884                 $test -f "$xxx" && libstyle=shared
3885             fi  
3886             if test ! -f "$xxx"; then
3887                 xxx=$thisdir/lib$thislib$_a
3888                 $test -f "$xxx" && eval $libscheck
3889                 $test -f "$xxx" && libstyle=static
3890             fi
3891             if test ! -f "$xxx"; then
3892                 xxx=$thisdir/$thislib$_a
3893                 $test -f "$xxx" && eval $libscheck
3894                 $test -f "$xxx" && libstyle=static
3895             fi
3896             if test ! -f "$xxx"; then
3897                 xxx=$thisdir/lib${thislib}_s$_a
3898                 $test -f "$xxx" && eval $libscheck
3899                 $test -f "$xxx" && libstyle=static
3900                 $test -f "$xxx" && thislib=${thislib}_s
3901             fi
3902             if test ! -f "$xxx"; then
3903                 xxx=$thisdir/Slib$thislib$_a
3904                 $test -f "$xxx" && eval $libscheck
3905                 $test -f "$xxx" && libstyle=static
3906             fi
3907             if $test -f "$xxx"; then
3908                 case "$libstyle" in
3909                 shared) echo "Found -l$thislib (shared)." ;;
3910                 static) echo "Found -l$thislib." ;;
3911                 *)      echo "Found -l$thislib ($libstyle)." ;;
3912                 esac
3913                 case " $dflt " in
3914                 *"-l$thislib "*);;
3915                 *) dflt="$dflt -l$thislib"
3916                    libsfound="$libsfound $xxx"
3917                    yyy=`basename $xxx`
3918                    libsfiles="$libsfiles $yyy"
3919                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3920                    case " $libsdirs " in
3921                    *" $yyy "*) ;;
3922                    *) libsdirs="$libsdirs $yyy" ;;
3923                    esac
3924                    ;;
3925                 esac
3926                 break
3927             fi  
3928         done
3929         if $test ! -f "$xxx"; then
3930             echo "No -l$thislib."
3931         fi
3932 done
3933 set X $dflt
3934 shift
3935 dflt="$*"
3936 case "$libs" in
3937 '') dflt="$dflt";;
3938 *) dflt="$libs";;
3939 esac
3940 case "$dflt" in
3941 ' '|'') dflt='none';;
3942 esac
3943
3944 $cat <<EOM
3945
3946 In order to compile $package on your machine, a number of libraries
3947 are usually needed.  Include any other special libraries here as well.
3948 Say "none" for none.  The default list is almost always right.
3949 EOM
3950
3951 echo " "
3952 rp="What libraries to use?"
3953 . ./myread
3954 case "$ans" in
3955 none) libs=' ';;
3956 *) libs="$ans";;
3957 esac
3958
3959 : determine optimization, if desired, or use for debug flag also
3960 case "$optimize" in
3961 ' '|$undef) dflt='none';;
3962 '') dflt='-O';;
3963 *) dflt="$optimize";;
3964 esac
3965 $cat <<EOH
3966
3967 By default, $package compiles with the -O flag to use the optimizer.
3968 Alternately, you might want to use the symbolic debugger, which uses
3969 the -g flag (on traditional Unix systems).  Either flag can be
3970 specified here.  To use neither flag, specify the word "none".
3971
3972 EOH
3973 rp="What optimizer/debugger flag should be used?"
3974 . ./myread
3975 optimize="$ans"
3976 case "$optimize" in
3977 'none') optimize=" ";;
3978 esac
3979
3980 dflt=''
3981 : We will not override a previous value, but we might want to
3982 : augment a hint file
3983 case "$hint" in
3984 default|recommended)
3985         case "$gccversion" in
3986         1*) dflt='-fpcc-struct-return' ;;
3987         esac
3988         case "$optimize" in
3989         *-g*) dflt="$dflt -DDEBUGGING";;
3990         esac
3991         case "$gccversion" in
3992         2*) if test -d /etc/conf/kconfig.d &&
3993                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3994                 then
3995                         dflt="$dflt -posix"
3996                 fi
3997                 ;;
3998         esac
3999         case "$gccversion" in
4000         1*) ;;
4001         2.[0-8]*) ;;
4002         ?*)     echo " "
4003                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4004                 echo 'int main(void) { return 0; }' > gcctest.c
4005                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4006                         echo "Yes, it does." 2>&1
4007                         case "$ccflags" in
4008                         *strict-aliasing*) 
4009                                 echo "Leaving current flags $ccflags alone." 2>&1
4010                                 ;;
4011                         *) dflt="$dflt -fno-strict-aliasing" ;;
4012                         esac
4013                 else
4014                         echo "Nope, it doesn't, but that's ok." 2>&1
4015                 fi
4016                 ;;
4017         esac
4018         ;;
4019 esac
4020
4021 case "$mips_type" in
4022 *BSD*|'') inclwanted="$locincpth $usrinc";;
4023 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4024 esac
4025 for thisincl in $inclwanted; do
4026         if $test -d $thisincl; then
4027                 if $test x$thisincl != x$usrinc; then
4028                         case "$dflt" in
4029                         *" -I$thisincl "*);;
4030                         *) dflt="$dflt -I$thisincl ";;
4031                         esac
4032                 fi
4033         fi
4034 done
4035
4036 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4037         xxx=true;
4038 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4039         xxx=true;
4040 else
4041         xxx=false;
4042 fi;
4043 if $xxx; then
4044         case "$dflt" in
4045         *$2*);;
4046         *) dflt="$dflt -D$2";;
4047         esac;
4048 fi'
4049
4050 set signal.h LANGUAGE_C; eval $inctest
4051
4052 case "$usesocks" in
4053 $define)
4054         ccflags="$ccflags -DSOCKS"
4055         ;;
4056 esac
4057
4058 case "$hint" in
4059 default|recommended) dflt="$ccflags $dflt" ;;
4060 *) dflt="$ccflags";;
4061 esac
4062
4063 case "$dflt" in
4064 ''|' ') dflt=none;;
4065 esac
4066
4067 $cat <<EOH
4068
4069 Your C compiler may want other flags.  For this question you should include
4070 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4071 but you should NOT include libraries or ld flags like -lwhatever.  If you
4072 want $package to honor its debug switch, you should include -DDEBUGGING here.
4073 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4074
4075 To use no flags, specify the word "none".
4076
4077 EOH
4078 set X $dflt
4079 shift
4080 dflt=${1+"$@"}
4081 rp="Any additional cc flags?"
4082 . ./myread
4083 case "$ans" in
4084 none) ccflags='';;
4085 *) ccflags="$ans";;
4086 esac
4087
4088 : the following weeds options from ccflags that are of no interest to cpp
4089 case "$cppflags" in
4090 '') cppflags="$ccflags" ;;
4091 *)  cppflags="$cppflags $ccflags" ;;
4092 esac
4093 case "$gccversion" in
4094 1*) cppflags="$cppflags -D__GNUC__"
4095 esac
4096 case "$mips_type" in
4097 '');;
4098 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4099 esac
4100 case "$cppflags" in
4101 '');;
4102 *)
4103         echo " "
4104         echo "Let me guess what the preprocessor flags are..." >&4
4105         set X $cppflags
4106         shift
4107         cppflags=''
4108         $cat >cpp.c <<'EOM'
4109 #define BLURFL foo
4110
4111 BLURFL xx LFRULB
4112 EOM
4113         previous=''
4114         for flag in $*
4115         do
4116                 case "$flag" in
4117                 -*) ftry="$flag";;
4118                 *) ftry="$previous $flag";;
4119                 esac
4120                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4121                         >cpp1.out 2>/dev/null && \
4122                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4123                         >cpp2.out 2>/dev/null && \
4124                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4125                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4126                 then
4127                         cppflags="$cppflags $ftry"
4128                         previous=''
4129                 else
4130                         previous="$flag"
4131                 fi
4132         done
4133         set X $cppflags
4134         shift
4135         cppflags=${1+"$@"}
4136         case "$cppflags" in
4137         *-*)  echo "They appear to be: $cppflags";;
4138         esac
4139         $rm -f cpp.c cpp?.out
4140         ;;
4141 esac
4142
4143 : flags used in final linking phase
4144 case "$ldflags" in
4145 '') if ./venix; then
4146                 dflt='-i -z'
4147         else
4148                 dflt=''
4149         fi
4150         case "$ccflags" in
4151         *-posix*) dflt="$dflt -posix" ;;
4152         esac
4153         ;;
4154 *) dflt="$ldflags";;
4155 esac
4156
4157 : Try to guess additional flags to pick up local libraries.
4158 for thislibdir in $libpth; do
4159         case " $loclibpth " in
4160         *" $thislibdir "*)
4161                 case "$dflt " in 
4162                 *"-L$thislibdir "*) ;;
4163                 *)  dflt="$dflt -L$thislibdir" ;;
4164                 esac
4165                 ;;
4166         esac
4167 done
4168
4169 case "$dflt" in
4170 '') dflt='none' ;;
4171 esac
4172
4173 $cat <<EOH
4174
4175 Your C linker may need flags.  For this question you should
4176 include -L/whatever and any other flags used by the C linker, but you
4177 should NOT include libraries like -lwhatever.
4178
4179 Make sure you include the appropriate -L/path flags if your C linker
4180 does not normally search all of the directories you specified above,
4181 namely
4182         $libpth
4183 To use no flags, specify the word "none".
4184
4185 EOH
4186
4187 rp="Any additional ld flags (NOT including libraries)?"
4188 . ./myread
4189 case "$ans" in
4190 none) ldflags='';;
4191 *) ldflags="$ans";;
4192 esac
4193 rmlist="$rmlist pdp11"
4194
4195 : coherency check
4196 echo " "
4197 echo "Checking your choice of C compiler and flags for coherency..." >&4
4198 $cat > try.c <<'EOF'
4199 #include <stdio.h>
4200 int main() { printf("Ok\n"); exit(0); }
4201 EOF
4202 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4203 shift
4204 $cat >try.msg <<'EOM'
4205 I've tried to compile and run the following simple program:
4206
4207 EOM
4208 $cat try.c >> try.msg
4209
4210 $cat >> try.msg <<EOM
4211
4212 I used the command:
4213
4214         $*
4215         ./try
4216
4217 and I got the following output:
4218
4219 EOM
4220 dflt=y
4221 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4222         if $sh -c './try' >>try.msg 2>&1; then
4223                 xxx=`./try`
4224                 case "$xxx" in
4225                 "Ok") dflt=n ;;
4226                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4227                         case " $libs " in
4228                         *" -lsfio "*)
4229                                 cat >> try.msg <<'EOQS'
4230 If $libs contains -lsfio, and sfio is mis-configured, then it
4231 sometimes (apparently) runs and exits with a 0 status, but with no
4232 output!  It may have to do with sfio's use of _exit vs. exit.
4233
4234 EOQS
4235                                 rp="You have a big problem.  Shall I abort Configure"
4236                                 dflt=y
4237                                 ;;
4238                         esac
4239                         ;;
4240                 esac
4241         else
4242                 echo "The program compiled OK, but exited with status $?." >>try.msg
4243                 rp="You have a problem.  Shall I abort Configure"
4244                 dflt=y
4245         fi
4246 else
4247         echo "I can't compile the test program." >>try.msg
4248         rp="You have a BIG problem.  Shall I abort Configure"
4249         dflt=y
4250 fi
4251 case "$dflt" in
4252 y)
4253         $cat try.msg >&4
4254         case "$knowitall" in
4255         '')
4256                 echo "(The supplied flags or libraries might be incorrect.)"
4257                 ;;
4258         *) dflt=n;;
4259         esac
4260         echo " "
4261         . ./myread
4262         case "$ans" in
4263         n*|N*) ;;
4264         *)      echo "Ok.  Stopping Configure." >&4
4265                 exit 1
4266                 ;;
4267         esac
4268         ;;
4269 n) echo "OK, that should do.";;
4270 esac
4271 $rm -f try try.* core
4272
4273 : define an is-a-typedef? function
4274 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4275 case "$inclist" in
4276 "") inclist="sys/types.h";;
4277 esac;
4278 eval "varval=\$$var";
4279 case "$varval" in
4280 "")
4281         $rm -f temp.c;
4282         for inc in $inclist; do
4283                 echo "#include <$inc>" >>temp.c;
4284         done;
4285         echo "#ifdef $type" >> temp.c;
4286         echo "printf(\"We have $type\");" >> temp.c;
4287         echo "#endif" >> temp.c;
4288         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4289         if $contains $type temp.E >/dev/null 2>&1; then
4290                 eval "$var=\$type";
4291         else
4292                 eval "$var=\$def";
4293         fi;
4294         $rm -f temp.?;;
4295 *) eval "$var=\$varval";;
4296 esac'
4297
4298 : define an is-a-typedef? function that prompts if the type is not available.
4299 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4300 case "$inclist" in
4301 "") inclist="sys/types.h";;
4302 esac;
4303 eval "varval=\$$var";
4304 case "$varval" in
4305 "")
4306         $rm -f temp.c;
4307         for inc in $inclist; do
4308                 echo "#include <$inc>" >>temp.c;
4309         done;
4310         echo "#ifdef $type" >> temp.c;
4311         echo "printf(\"We have $type\");" >> temp.c;
4312         echo "#endif" >> temp.c;
4313         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4314         echo " " ;
4315         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4316         if $contains $type temp.E >/dev/null 2>&1; then
4317                 echo "$type found." >&4;
4318                 eval "$var=\$type";
4319         else
4320                 echo "$type NOT found." >&4;
4321                 dflt="$def";
4322                 . ./myread ;
4323                 eval "$var=\$ans";
4324         fi;
4325         $rm -f temp.?;;
4326 *) eval "$var=\$varval";;
4327 esac'
4328
4329 : define a shorthand compile call
4330 compile='
4331 mc_file=$1;
4332 shift;
4333 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4334 : define a shorthand compile call for compilations that should be ok.
4335 compile_ok='
4336 mc_file=$1;
4337 shift;
4338 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4339
4340 : check for lengths of integral types
4341 echo " "
4342 case "$intsize" in
4343 '')
4344         echo "Checking to see how big your integers are..." >&4
4345         $cat >intsize.c <<'EOCP'
4346 #include <stdio.h>
4347 int main()
4348 {
4349         printf("intsize=%d;\n", (int)sizeof(int));
4350         printf("longsize=%d;\n", (int)sizeof(long));
4351         printf("shortsize=%d;\n", (int)sizeof(short));
4352         exit(0);
4353 }
4354 EOCP
4355         set intsize
4356         if eval $compile_ok && ./intsize > /dev/null; then
4357                 eval `./intsize`
4358                 echo "Your integers are $intsize bytes long."
4359                 echo "Your long integers are $longsize bytes long."
4360                 echo "Your short integers are $shortsize bytes long."
4361         else
4362                 $cat >&4 <<EOM
4363 !
4364 Help! I can't compile and run the intsize test program: please enlighten me!
4365 (This is probably a misconfiguration in your system or libraries, and
4366 you really ought to fix it.  Still, I'll try anyway.)
4367 !
4368 EOM
4369                 dflt=4
4370                 rp="What is the size of an integer (in bytes)?"
4371                 . ./myread
4372                 intsize="$ans"
4373                 dflt=$intsize
4374                 rp="What is the size of a long integer (in bytes)?"
4375                 . ./myread
4376                 longsize="$ans"
4377                 dflt=2
4378                 rp="What is the size of a short integer (in bytes)?"
4379                 . ./myread
4380                 shortsize="$ans"
4381         fi
4382         ;;
4383 esac
4384 $rm -f intsize intsize.*
4385
4386 : see what type lseek is declared as in the kernel
4387 rp="What is the type used for lseek's offset on this system?"
4388 set off_t lseektype long stdio.h sys/types.h
4389 eval $typedef_ask
4390
4391 echo " "
4392 echo "Checking to see how big your file offsets are..." >&4
4393 $cat >try.c <<EOCP
4394 #include <sys/types.h>
4395 #include <stdio.h>
4396 int main()
4397 {
4398     printf("%d\n", (int)sizeof($lseektype));
4399     return(0); 
4400 }
4401 EOCP
4402 set try
4403 if eval $compile_ok; then
4404         lseeksize=`./try`
4405         echo "Your file offsets are $lseeksize bytes long."
4406 else
4407         dflt=$longsize
4408         echo " "
4409         echo "(I can't seem to compile the test program.  Guessing...)"
4410         rp="What is the size of your file offsets (in bytes)?"
4411         . ./myread
4412         lseeksize="$ans"
4413 fi
4414 $rm -f try.c try
4415
4416 : see what type file positions are declared as in the library
4417 rp="What is the type for file position used by fsetpos()?"
4418 set fpos_t fpostype long stdio.h sys/types.h
4419 eval $typedef_ask
4420
4421 echo " "
4422 case "$fpostype" in
4423 *_t) zzz="$fpostype"    ;;
4424 *)   zzz="fpos_t"       ;;
4425 esac
4426 echo "Checking the size of $zzz..." >&4 
4427 cat > try.c <<EOCP
4428 #include <sys/types.h>
4429 #include <stdio.h>
4430 int main() {
4431     printf("%d\n", (int)sizeof($fpostype));
4432     exit(0);
4433 }
4434 EOCP
4435 set try
4436 if eval $compile_ok; then
4437         yyy=`./try`
4438         case "$yyy" in
4439         '')     fpossize=4
4440                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4441                 ;;
4442         *)      fpossize=$yyy
4443                 echo "Your $zzz is $fpossize bytes long."
4444                 ;;
4445         esac
4446 else
4447         dflt="$longsize"
4448         echo " " >&4
4449         echo "(I can't compile the test program.  Guessing...)" >&4
4450         rp="What is the size of your file positions (in bytes)?"
4451         . ./myread
4452         fpossize="$ans"
4453 fi
4454
4455
4456
4457 # Backward compatibility (uselfs is deprecated).
4458 case "$uselfs" in
4459 "$define"|true|[yY]*)
4460         cat <<EOM >&4
4461
4462 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4463 EOM
4464         uselargefiles="$define"
4465         ;;
4466 esac                          
4467
4468 case "$lseeksize:$fpossize" in
4469 8:8) cat <<EOM
4470
4471 You can have files larger than 2 gigabytes.
4472 EOM
4473    val="$define" ;;
4474 *)    case "$uselargefiles" in
4475    "$undef"|false|[nN]*) dflt='n' ;;
4476    *)   dflt='y' ;;
4477    esac
4478    cat <<EOM
4479
4480 Perl can be built to understand large files (files larger than 2 gigabytes)
4481 on some systems.  To do so, Configure can be run with -Duselargefiles.
4482
4483 If this doesn't make any sense to you, just accept the default '$dflt'.
4484 EOM
4485    rp='Try to understand large files, if available?'
4486    . ./myread
4487    case "$ans" in
4488    y|Y)         val="$define" ;;
4489    *)           val="$undef"  ;;
4490    esac
4491    ;;
4492 esac
4493 set uselargefiles
4494 eval $setvar
4495 case "$uselargefiles" in
4496 "$define")
4497 : Look for a hint-file generated 'call-back-unit'.  If the
4498 : user has specified that a large files perl is to be built,
4499 : we may need to set or change some other defaults.
4500         if $test -f uselargefiles.cbu; then
4501                 echo "Your platform has some specific hints for large file builds, using them..."
4502                 . ./uselargefiles.cbu
4503                 echo " "
4504                 echo "Rechecking to see how big your file offsets are..." >&4
4505                 $cat >try.c <<EOCP
4506 #include <sys/types.h>
4507 #include <stdio.h>
4508 int main()
4509 {
4510     printf("%d\n", (int)sizeof($lseektype));
4511     return(0); 
4512 }
4513 EOCP
4514                 set try
4515                 if eval $compile_ok; then
4516                         lseeksize=`./try`
4517                         $echo "Your file offsets are now $lseeksize bytes long."
4518                 else
4519                         dflt="$lseeksize"
4520                         echo " "
4521                         echo "(I can't seem to compile the test program.  Guessing...)"
4522                         rp="What is the size of your file offsets (in bytes)?"
4523                         . ./myread
4524                         lseeksize="$ans"
4525                 fi
4526                 case "$fpostype" in
4527                 *_t) zzz="$fpostype"    ;;
4528                 *)   zzz="fpos_t"       ;;
4529                 esac
4530                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4531                 $cat > try.c <<EOCP
4532 #include <sys/types.h>
4533 #include <stdio.h>
4534 int main() {
4535     printf("%d\n", (int)sizeof($fpostype));
4536     exit(0);
4537 }
4538 EOCP
4539                 set try
4540                 if eval $compile_ok; then
4541                         yyy=`./try`
4542                         dflt="$lseeksize"
4543                         case "$yyy" in
4544                         '')     echo " "
4545                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4546                                 ;;
4547                         *)      fpossize=$yyy
4548                                 echo " $fpossize bytes." >&4
4549                                 ;;
4550                         esac
4551                 else
4552                         dflt="$fpossize"
4553                         echo " "
4554                         echo "(I can't compile the test program.  Guessing...)" >&4
4555                         rp="What is the size of your file positions (in bytes)?"
4556                         . ./myread
4557                         fpossize="$ans"
4558                 fi
4559                 $rm -f try.c try
4560         fi
4561         ;;
4562 esac
4563
4564
4565 case "$usemorebits" in
4566 "$define"|true|[yY]*)
4567         use64bitint="$define"
4568         uselongdouble="$define"
4569         usemorebits="$define"
4570         ;;
4571 *)      usemorebits="$undef"
4572         ;;
4573 esac
4574
4575 : check for void type
4576 echo " "
4577 echo "Checking to see how well your C compiler groks the void type..." >&4
4578 case "$voidflags" in
4579 '')
4580         $cat >try.c <<'EOCP'
4581 #if TRY & 1
4582 void sub() {
4583 #else
4584 sub() {
4585 #endif
4586         extern void moo();      /* function returning void */
4587         void (*goo)();          /* ptr to func returning void */
4588 #if TRY & 8
4589         void *hue;              /* generic ptr */
4590 #endif
4591 #if TRY & 2
4592         void (*foo[10])();
4593 #endif
4594
4595 #if TRY & 4
4596         if(goo == moo) {
4597                 exit(0);
4598         }
4599 #endif
4600         exit(0);
4601 }
4602 int main() { sub(); }
4603 EOCP
4604         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4605                 voidflags=$defvoidused
4606         echo "Good.  It appears to support void to the level $package wants.">&4
4607                 if $contains warning .out >/dev/null 2>&1; then
4608                         echo "However, you might get some warnings that look like this:"
4609                         $cat .out
4610                 fi
4611         else
4612 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4613                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4614                         echo "It supports 1..."
4615                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4616                                 echo "It also supports 2..."
4617                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4618                                         voidflags=7
4619                                         echo "And it supports 4 but not 8 definitely."
4620                                 else
4621                                         echo "It doesn't support 4..."
4622                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4623                                                 voidflags=11
4624                                                 echo "But it supports 8."
4625                                         else
4626                                                 voidflags=3
4627                                                 echo "Neither does it support 8."
4628                                         fi
4629                                 fi
4630                         else
4631                                 echo "It does not support 2..."
4632                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633                                         voidflags=13
4634                                         echo "But it supports 4 and 8."
4635                                 else
4636                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4637                                                 voidflags=5
4638                                                 echo "And it supports 4 but has not heard about 8."
4639                                         else
4640                                                 echo "However it supports 8 but not 4."
4641                                         fi
4642                                 fi
4643                         fi
4644                 else
4645                         echo "There is no support at all for void."
4646                         voidflags=0
4647                 fi
4648         fi
4649 esac
4650 case "$voidflags" in
4651 "$defvoidused") ;;
4652 *)      $cat >&4 <<'EOM'
4653   Support flag bits are:
4654     1: basic void declarations.
4655     2: arrays of pointers to functions returning void.
4656     4: operations between pointers to and addresses of void functions.
4657     8: generic void pointers.
4658 EOM
4659         dflt="$voidflags";
4660         rp="Your void support flags add up to what?"
4661         . ./myread
4662         voidflags="$ans"
4663         ;;
4664 esac
4665 $rm -f try.* .out
4666
4667 : check for length of pointer
4668 echo " "
4669 case "$ptrsize" in
4670 '')
4671         echo "Checking to see how big your pointers are..." >&4
4672         if test "$voidflags" -gt 7; then
4673                 echo '#define VOID_PTR char *' > try.c
4674         else
4675                 echo '#define VOID_PTR void *' > try.c
4676         fi
4677         $cat >>try.c <<'EOCP'
4678 #include <stdio.h>
4679 int main()
4680 {
4681     printf("%d\n", (int)sizeof(VOID_PTR));
4682     exit(0);
4683 }
4684 EOCP
4685         set try
4686         if eval $compile_ok; then
4687                 ptrsize=`./try`
4688                 echo "Your pointers are $ptrsize bytes long."
4689         else
4690                 dflt='4'
4691                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4692                 rp="What is the size of a pointer (in bytes)?"
4693                 . ./myread
4694                 ptrsize="$ans"
4695         fi
4696         ;;
4697 esac
4698 $rm -f try.c try
4699
4700 : check for long long
4701 echo " "
4702 echo "Checking to see if you have long long..." >&4
4703 echo 'int main() { long long x = 7; return 0; }' > try.c
4704 set try
4705 if eval $compile; then
4706         val="$define"
4707         echo "You have long long."
4708 else
4709         val="$undef"
4710         echo "You do not have long long."
4711 fi
4712 $rm try.*
4713 set d_longlong
4714 eval $setvar
4715
4716 : check for length of long long
4717 case "${d_longlong}${longlongsize}" in
4718 $define)
4719         echo " "
4720         echo "Checking to see how big your long longs are..." >&4
4721         $cat >try.c <<'EOCP'
4722 #include <stdio.h>
4723 int main()
4724 {
4725     printf("%d\n", (int)sizeof(long long));
4726     return(0);
4727 }
4728 EOCP
4729         set try
4730         if eval $compile_ok; then
4731                 longlongsize=`./try$exe_ext`
4732                 echo "Your long longs are $longlongsize bytes long."
4733         else
4734                 dflt='8'
4735                 echo " "
4736                 echo "(I can't seem to compile the test program.  Guessing...)"
4737                 rp="What is the size of a long long (in bytes)?"
4738                 . ./myread
4739                 longlongsize="$ans"
4740         fi
4741         if $test "X$longsize" = "X$longlongsize"; then
4742                 echo "(That isn't any different from an ordinary long.)"
4743         fi      
4744         ;;
4745 esac
4746 $rm -f try.* try
4747
4748 : determine filename position in cpp output
4749 echo " "
4750 echo "Computing filename position in cpp output for #include directives..." >&4
4751 echo '#include <stdio.h>' > foo.c
4752 $cat >fieldn <<EOF
4753 $startsh
4754 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4755 $grep '^[       ]*#.*stdio\.h' | \
4756 while read cline; do
4757         pos=1
4758         set \$cline
4759         while $test \$# -gt 0; do
4760                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4761                         echo "\$pos"
4762                         exit 0
4763                 fi
4764                 shift
4765                 pos=\`expr \$pos + 1\`
4766         done
4767 done
4768 EOF
4769 chmod +x fieldn
4770 fieldn=`./fieldn`
4771 $rm -f foo.c fieldn
4772 case $fieldn in
4773 '') pos='???';;
4774 1) pos=first;;
4775 2) pos=second;;
4776 3) pos=third;;
4777 *) pos="${fieldn}th";;
4778 esac
4779 echo "Your cpp writes the filename in the $pos field of the line."
4780
4781 : locate header file
4782 $cat >findhdr <<EOF
4783 $startsh
4784 wanted=\$1
4785 name=''
4786 for usrincdir in $usrinc
4787 do
4788         if test -f \$usrincdir/\$wanted; then
4789                 echo "\$usrincdir/\$wanted"
4790                 exit 0
4791         fi
4792 done
4793 awkprg='{ print \$$fieldn }'
4794 echo "#include <\$wanted>" > foo\$\$.c
4795 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4796 $grep "^[       ]*#.*\$wanted" | \
4797 while read cline; do
4798         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4799         case "\$name" in
4800         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4801         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4802         *) exit 2;;
4803         esac;
4804 done;
4805 #
4806 # status = 0: grep returned 0 lines, case statement not executed
4807 # status = 1: headerfile found
4808 # status = 2: while loop executed, no headerfile found
4809 #
4810 status=\$?
4811 $rm -f foo\$\$.c;
4812 if test \$status -eq 1; then
4813         exit 0;
4814 fi
4815 exit 1
4816 EOF
4817 chmod +x findhdr
4818
4819 : define an alternate in-header-list? function
4820 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4821 cont=true; xxf="echo \"<\$1> found.\" >&4";
4822 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4823 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4824 esac;
4825 case $# in 4) instead=instead;; *) instead="at last";; esac;
4826 while $test "$cont"; do
4827         xxx=`./findhdr $1`
4828         var=$2; eval "was=\$$2";
4829         if $test "$xxx" && $test -r "$xxx";
4830         then eval $xxf;
4831         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4832                 cont="";
4833         else eval $xxnf;
4834         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4835         set $yyy; shift; shift; yyy=$@;
4836         case $# in 0) cont="";;
4837         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4838                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4839         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4840                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4841         esac;
4842 done;
4843 while $test "$yyy";
4844 do set $yyy; var=$2; eval "was=\$$2";
4845         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4846         set $yyy; shift; shift; yyy=$@;
4847 done'
4848
4849 : see if inttypes.h is available
4850 : we want a real compile instead of Inhdr because some systems
4851 : have an inttypes.h which includes non-existent headers
4852 echo " "
4853 $cat >try.c <<EOCP
4854 #include <inttypes.h>
4855 int main() {
4856         static int32_t foo32 = 0x12345678;
4857 }
4858 EOCP
4859 set try
4860 if eval $compile; then
4861         echo "<inttypes.h> found." >&4
4862         val="$define"
4863 else
4864         echo "<inttypes.h> NOT found." >&4
4865         val="$undef"
4866 fi
4867 $rm -f try.c try
4868 set i_inttypes
4869 eval $setvar
4870
4871 : check for int64_t
4872 echo " "
4873 echo "Checking to see if you have int64_t..." >&4
4874 $cat >try.c <<EOCP
4875 #include <sys/types.h>
4876 #$i_inttypes I_INTTYPES
4877 #ifdef I_INTTYPES
4878 #include <inttypes.h>
4879 #endif
4880 int main() { int64_t x = 7; }
4881 EOCP
4882 set try
4883 if eval $compile; then
4884         val="$define"
4885         echo "You have int64_t."
4886 else
4887         val="$undef"
4888         echo "You do not have int64_t."
4889 fi
4890 $rm -f try try.*
4891 set d_int64_t
4892 eval $setvar
4893
4894
4895 echo " "
4896 echo "Checking which 64-bit integer type we could use..." >&4
4897
4898 case "$intsize" in
4899 8) val=int
4900    set quadtype
4901    eval $setvar
4902    val='"unsigned int"'
4903    set uquadtype
4904    eval $setvar
4905    quadkind=1
4906    ;;
4907 *) case "$longsize" in
4908    8) val=long
4909       set quadtype
4910       eval $setvar
4911       val='"unsigned long"'
4912       set uquadtype
4913       eval $setvar
4914       quadkind=2
4915       ;;
4916    *) case "$d_longlong:$longlongsize" in
4917       define:8)
4918         val='"long long"'
4919         set quadtype
4920         eval $setvar
4921         val='"unsigned long long"'
4922         set uquadtype
4923         eval $setvar
4924         quadkind=3
4925         ;;
4926       *) case "$d_int64_t" in
4927          define)
4928            val=int64_t
4929            set quadtype
4930            eval $setvar
4931            val=uint64_t
4932            set uquadtype
4933            eval $setvar
4934            quadkind=4
4935            ;;
4936          esac
4937          ;;
4938       esac
4939       ;;
4940    esac
4941    ;;
4942 esac
4943
4944 case "$quadtype" in
4945 '')     echo "Alas, no 64-bit integer types in sight." >&4
4946         d_quad="$undef"
4947         ;;
4948 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4949         d_quad="$define"
4950         ;;
4951 esac
4952
4953
4954 case "$uselonglong" in
4955 "$define"|true|[yY]*)
4956         cat <<EOM >&4
4957
4958 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4959 EOM
4960         use64bitint="$define"
4961         ;;
4962 esac                          
4963 case "$use64bits" in
4964 "$define"|true|[yY]*)
4965         cat <<EOM >&4
4966
4967 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4968 EOM
4969         use64bitint="$define"
4970         ;;
4971 esac                          
4972 case "$use64bitints" in
4973 "$define"|true|[yY]*)
4974         cat <<EOM >&4
4975
4976 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4977 EOM
4978         use64bitint="$define"
4979         ;;
4980 esac                          
4981 case "$use64bitsint" in
4982 "$define"|true|[yY]*)
4983         cat <<EOM >&4
4984
4985 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4986 EOM
4987         use64bitint="$define"
4988         ;;
4989 esac                          
4990 case "$uselonglongs" in
4991 "$define"|true|[yY]*)
4992         cat <<EOM >&4
4993
4994 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4995 EOM
4996         use64bitint="$define"
4997         ;;
4998 esac                          
4999 case "$use64bitsall" in
5000 "$define"|true|[yY]*)
5001         cat <<EOM >&4
5002
5003 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5004 EOM
5005         use64bitall="$define"
5006         ;;
5007 esac                          
5008
5009 case "$ccflags" in
5010 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5011 esac
5012 case "$use64bitall" in
5013 "$define"|true|[yY]*) use64bitint="$define" ;;
5014 esac
5015
5016 case "$longsize" in
5017 8) cat <<EOM
5018
5019 You have natively 64-bit long integers.
5020 EOM
5021    val="$define"
5022    ;;
5023 *) case "$use64bitint" in
5024    "$define"|true|[yY]*) dflt='y';;
5025    *) dflt='n';;
5026    esac
5027    case "$d_quad" in
5028    "$define") ;;
5029    *) dflt='n' ;;
5030    esac
5031    cat <<EOM
5032
5033 Perl can be built to take advantage of 64-bit integer types
5034 on some systems.  To do so, Configure can be run with -Duse64bitint.
5035 Choosing this option will most probably introduce binary incompatibilities.
5036
5037 If this doesn't make any sense to you, just accept the default '$dflt'.
5038 (The default has been chosen based on your configuration.)
5039 EOM
5040    rp='Try to use 64-bit integers, if available?'
5041    . ./myread
5042    case "$ans" in
5043    [yY]*) val="$define" ;;
5044    *)     val="$undef"  ;;
5045    esac
5046    ;;
5047 esac
5048 set use64bitint
5049 eval $setvar
5050
5051 case "$use64bitall" in
5052 "$define"|true|[yY]*) dflt='y' ;;
5053 *) case "$longsize" in
5054    8) dflt='y' ;;
5055    *) dflt='n' ;;
5056    esac
5057    ;;
5058 esac    
5059 cat <<EOM
5060
5061 You may also choose to try maximal 64-bitness.  It means using as much
5062 64-bitness as possible on the platform.  This in turn means even more
5063 binary incompatibilities.  On the other hand, your platform may not
5064 have any more 64-bitness available than what you already have chosen.
5065
5066 If this doesn't make any sense to you, just accept the default '$dflt'.
5067 (The default has been chosen based on your configuration.)
5068 EOM
5069 rp='Try to use maximal 64-bit support, if available?'
5070 . ./myread
5071 case "$ans" in
5072 [yY]*) val="$define" ;;
5073 *)     val="$undef"  ;;
5074 esac
5075 set use64bitall
5076 eval $setvar
5077 case "$use64bitall" in
5078 "$define")
5079         case "$use64bitint" in
5080         "$undef")
5081                 cat <<EOM
5082
5083 Since you have chosen a maximally 64-bit build, I'm also turning on
5084 the use of 64-bit integers.
5085 EOM
5086                 use64bitint="$define" ;;
5087         esac
5088         ;;
5089 esac
5090
5091 case "$use64bitall" in
5092 "$define"|true|[yY]*)
5093         case "$ptrsize" in
5094         4)      cat <<EOM >&4
5095
5096 *** You have chosen a maximally 64-bit build, but your pointers
5097 *** are only 4 bytes wide, disabling maximal 64-bitness.
5098
5099 EOM
5100                 use64bitall="$undef"
5101                 case "$use64bitint" in
5102                 "$define"|true|[yY]*) ;;
5103                 *)      cat <<EOM >&4
5104
5105 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5106
5107 EOM
5108                         use64bitint="$define"
5109                         ;;
5110                 esac
5111                 ;;
5112         esac
5113         ;;
5114 esac
5115
5116 case "$use64bitint" in
5117 "$define"|true|[yY]*)
5118 : Look for a hint-file generated 'call-back-unit'.  If the
5119 : user has specified that a 64-bit perl is to be built,
5120 : we may need to set or change some other defaults.
5121         if $test -f use64bitint.cbu; then
5122                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5123                 . ./use64bitint.cbu
5124         fi
5125         case "$longsize" in
5126         4) case "$archname64" in
5127            '') archname64=64int ;;
5128            esac
5129            ;;
5130         esac
5131         ;;
5132 esac
5133
5134 case "$use64bitall" in
5135 "$define"|true|[yY]*)
5136 : Look for a hint-file generated 'call-back-unit'.  If the
5137 : user has specified that a maximally 64-bit perl is to be built,
5138 : we may need to set or change some other defaults.
5139         if $test -f use64bitall.cbu; then
5140                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5141                 . ./use64bitall.cbu
5142         fi
5143         case "$longsize" in
5144         4) case "$archname64" in
5145            ''|64int) archname64=64all ;;
5146            esac
5147            ;;
5148         esac
5149         ;;
5150 esac
5151
5152 echo " "
5153 echo "Checking for GNU C Library..." >&4
5154 cat >gnulibc.c <<EOM
5155 #include <stdio.h>
5156 int main()
5157 {
5158 #ifdef __GLIBC__
5159     exit(0);
5160 #else
5161     exit(1);
5162 #endif
5163 }
5164 EOM
5165 set gnulibc
5166 if eval $compile_ok && ./gnulibc; then
5167         val="$define"
5168         echo "You are using the GNU C Library"
5169 else
5170         val="$undef"
5171         echo "You are not using the GNU C Library"
5172 fi
5173 $rm -f gnulibc*
5174 set d_gnulibc
5175 eval $setvar
5176
5177 : see if nm is to be used to determine whether a symbol is defined or not
5178 case "$usenm" in
5179 '')
5180         dflt=''
5181         case "$d_gnulibc" in
5182         "$define")
5183                 echo " "
5184                 echo "nm probably won't work on the GNU C Library." >&4
5185                 dflt=n
5186                 ;;
5187         esac
5188         case "$dflt" in
5189         '') 
5190                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5191                         echo " "
5192                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5193                         echo "'nm' won't be sufficient on this sytem." >&4
5194                         dflt=n
5195                 fi
5196                 ;;
5197         esac
5198         case "$dflt" in
5199         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5200                 if $test $dflt -gt 20; then
5201                         dflt=y
5202                 else
5203                         dflt=n
5204                 fi
5205                 ;;
5206         esac
5207         ;;
5208 *)
5209         case "$usenm" in
5210         true|$define) dflt=y;;
5211         *) dflt=n;;
5212         esac
5213         ;;
5214 esac
5215 $cat <<EOM
5216
5217 I can use $nm to extract the symbols from your C libraries. This
5218 is a time consuming task which may generate huge output on the disk (up
5219 to 3 megabytes) but that should make the symbols extraction faster. The
5220 alternative is to skip the 'nm' extraction part and to compile a small
5221 test program instead to determine whether each symbol is present. If
5222 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5223 this may be the best solution.
5224
5225 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5226
5227 EOM
5228 rp="Shall I use $nm to extract C symbols from the libraries?"
5229 . ./myread
5230 case "$ans" in
5231 [Nn]*) usenm=false;;
5232 *) usenm=true;;
5233 esac
5234
5235 runnm=$usenm
5236 case "$reuseval" in
5237 true) runnm=false;;
5238 esac
5239
5240 : nm options which may be necessary
5241 case "$nm_opt" in
5242 '') if $test -f /mach_boot; then
5243                 nm_opt=''       # Mach
5244         elif $test -d /usr/ccs/lib; then
5245                 nm_opt='-p'     # Solaris (and SunOS?)
5246         elif $test -f /dgux; then
5247                 nm_opt='-p'     # DG-UX
5248         elif $test -f /lib64/rld; then
5249                 nm_opt='-p'     # 64-bit Irix
5250         else
5251                 nm_opt=''
5252         fi;;
5253 esac
5254
5255 : nm options which may be necessary for shared libraries but illegal
5256 : for archive libraries.  Thank you, Linux.
5257 case "$nm_so_opt" in
5258 '')     case "$myuname" in
5259         *linux*)
5260                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5261                         nm_so_opt='--dynamic'
5262                 fi
5263                 ;;
5264         esac
5265         ;;
5266 esac
5267
5268 case "$runnm" in
5269 true)
5270 : get list of predefined functions in a handy place
5271 echo " "
5272 case "$libc" in
5273 '') libc=unknown
5274         case "$libs" in
5275         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5276         esac
5277         ;;
5278 esac
5279 libnames='';
5280 case "$libs" in
5281 '') ;;
5282 *)  for thislib in $libs; do
5283         case "$thislib" in
5284         -lc|-lc_s)
5285                 : Handle C library specially below.
5286                 ;;
5287         -l*)
5288                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5289                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5290                         :
5291                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5292                         :
5293                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5294                         :
5295                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5296                         :
5297                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5298                         :
5299                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5300                         :
5301                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5302                         :
5303                 else
5304                         try=''
5305                 fi
5306                 libnames="$libnames $try"
5307                 ;;
5308         *) libnames="$libnames $thislib" ;;
5309         esac
5310         done
5311         ;;
5312 esac
5313 xxx=normal
5314 case "$libc" in
5315 unknown)
5316         set /lib/libc.$so
5317         for xxx in $libpth; do
5318                 $test -r $1 || set $xxx/libc.$so
5319                 : The messy sed command sorts on library version numbers.
5320                 $test -r $1 || \
5321                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5322                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5323                                 h
5324                                 s/[0-9][0-9]*/0000&/g
5325                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5326                                 G
5327                                 s/\n/ /' | \
5328                          $sort | $sed -e 's/^.* //'`
5329                 eval set \$$#
5330         done
5331         $test -r $1 || set /usr/ccs/lib/libc.$so
5332         $test -r $1 || set /lib/libsys_s$_a
5333         ;;
5334 *)
5335         set blurfl
5336         ;;
5337 esac
5338 if $test -r "$1"; then
5339         echo "Your (shared) C library seems to be in $1."
5340         libc="$1"
5341 elif $test -r /lib/libc && $test -r /lib/clib; then
5342         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5343         xxx=apollo
5344         libc='/lib/clib /lib/libc'
5345         if $test -r /lib/syslib; then
5346                 echo "(Your math library is in /lib/syslib.)"
5347                 libc="$libc /lib/syslib"
5348         fi
5349 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5350         echo "Your C library seems to be in $libc, as you said before."
5351 elif $test -r $incpath/usr/lib/libc$_a; then
5352         libc=$incpath/usr/lib/libc$_a;
5353         echo "Your C library seems to be in $libc.  That's fine."
5354 elif $test -r /lib/libc$_a; then
5355         libc=/lib/libc$_a;
5356         echo "Your C library seems to be in $libc.  You're normal."
5357 else
5358         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5359                 :
5360         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5361                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5362         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5363                 :
5364         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5365                 :
5366         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5367                 :
5368         else
5369                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5370         fi
5371         if $test -r "$tans"; then
5372                 echo "Your C library seems to be in $tans, of all places."
5373                 libc=$tans
5374         else
5375                 libc='blurfl'
5376         fi
5377 fi
5378 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5379         dflt="$libc"
5380         cat <<EOM
5381
5382 If the guess above is wrong (which it might be if you're using a strange
5383 compiler, or your machine supports multiple models), you can override it here.
5384
5385 EOM
5386 else
5387         dflt=''
5388         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5389         cat >&4 <<EOM
5390 I can't seem to find your C library.  I've looked in the following places:
5391
5392 EOM
5393         $sed 's/^/      /' libpath
5394         cat <<EOM
5395
5396 None of these seems to contain your C library. I need to get its name...
5397
5398 EOM
5399 fi
5400 fn=f
5401 rp='Where is your C library?'
5402 . ./getfile
5403 libc="$ans"
5404
5405 echo " "
5406 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5407 set X `cat libnames`
5408 shift
5409 xxx=files
5410 case $# in 1) xxx=file; esac
5411 echo "Extracting names from the following $xxx for later perusal:" >&4
5412 echo " "
5413 $sed 's/^/      /' libnames >&4
5414 echo " "
5415 $echo $n "This may take a while...$c" >&4
5416
5417 for file in $*; do
5418         case $file in
5419         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5420         *) $nm $nm_opt $file 2>/dev/null;;
5421         esac
5422 done >libc.tmp
5423
5424 $echo $n ".$c"
5425 $grep fprintf libc.tmp > libc.ptf
5426 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5427 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5428 xxx='[ADTSIW]'
5429 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5430         eval $xscan;\
5431         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5432                 eval $xrun
5433 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5434         eval $xscan;\
5435         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5436                 eval $xrun
5437 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5438         eval $xscan;\
5439         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5440                 eval $xrun
5441 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5442         eval $xscan;\
5443         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5444                 eval $xrun
5445 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5446         eval $xscan;\
5447         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5448                 eval $xrun
5449 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5450         eval $xscan;\
5451         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5452                 eval $xrun
5453 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5454                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5455         eval $xscan;\
5456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5457                 eval $xrun
5458 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5459         eval $xscan;\
5460         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5461                 eval $xrun
5462 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5463         eval $xscan;\
5464         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5465                 eval $xrun
5466 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5467         eval $xscan;\
5468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5469                 eval $xrun
5470 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5471         eval $xscan;\
5472         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5473                 eval $xrun
5474 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5475         eval $xscan;\
5476         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5477                 eval $xrun
5478 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5479         eval $xscan;\
5480         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5481                 eval $xrun
5482 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5483         eval $xscan;\
5484         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5485                 eval $xrun
5486 else
5487         $nm -p $* 2>/dev/null >libc.tmp
5488         $grep fprintf libc.tmp > libc.ptf
5489         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5490                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5491         then
5492                 nm_opt='-p'
5493                 eval $xrun
5494         else
5495                 echo " "
5496                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5497                 com=''
5498                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5499                         for thisname in $libnames $libc; do
5500                                 $ar t $thisname >>libc.tmp
5501                         done
5502                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5503                         echo "Ok." >&4
5504                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5505                         # Repeat libc to extract forwarders to DLL entries too
5506                         for thisname in $libnames $libc; do
5507                                 $ar tv $thisname >>libc.tmp
5508                                 # Revision 50 of EMX has bug in $ar.
5509                                 # it will not extract forwarders to DLL entries
5510                                 # Use emximp which will extract exactly them.
5511                                 emximp -o tmp.imp $thisname \
5512                                     2>/dev/null && \
5513                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5514                                     < tmp.imp >>libc.tmp
5515                                 $rm tmp.imp
5516                         done
5517                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5518                         echo "Ok." >&4
5519                 else
5520                         echo "$ar didn't seem to work right." >&4
5521                         echo "Maybe this is a Cray...trying bld instead..." >&4
5522                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5523                         then
5524                                 for thisname in $libnames; do
5525                                         bld t $libnames | \
5526                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5527                                         $ar t $thisname >>libc.tmp
5528                                 done
5529                                 echo "Ok." >&4
5530                         else
5531                                 echo "That didn't work either.  Giving up." >&4
5532                                 exit 1
5533                         fi
5534                 fi
5535         fi
5536 fi
5537 nm_extract="$com"
5538 if $test -f /lib/syscalls.exp; then
5539         echo " "
5540         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5541         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5542 fi
5543 ;;
5544 esac
5545 $rm -f libnames libpath
5546
5547 : is a C symbol defined?
5548 csym='tlook=$1;
5549 case "$3" in
5550 -v) tf=libc.tmp; tc=""; tdc="";;
5551 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5552 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5553 esac;
5554 tx=yes;
5555 case "$reuseval-$4" in
5556 true-) ;;
5557 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5558 esac;
5559 case "$tx" in
5560 yes)
5561         case "$runnm" in
5562         true)
5563                 if $contains $tlook $tf >/dev/null 2>&1;
5564                 then tval=true;
5565                 else tval=false;
5566                 fi;;
5567         *)
5568                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5569                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5570                 then tval=true;
5571                 else tval=false;
5572                 fi;
5573                 $rm -f t t.c;;
5574         esac;;
5575 *)
5576         case "$tval" in
5577         $define) tval=true;;
5578         *) tval=false;;
5579         esac;;
5580 esac;
5581 eval "$2=$tval"'
5582
5583 : define an is-in-libc? function
5584 inlibc='echo " "; td=$define; tu=$undef;
5585 sym=$1; var=$2; eval "was=\$$2";
5586 tx=yes;
5587 case "$reuseval$was" in
5588 true) ;;
5589 true*) tx=no;;
5590 esac;
5591 case "$tx" in
5592 yes)
5593         set $sym tres -f;
5594         eval $csym;
5595         case "$tres" in
5596         true)
5597                 echo "$sym() found." >&4;
5598                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5599         *)
5600                 echo "$sym() NOT found." >&4;
5601                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5602         esac;;
5603 *)
5604         case "$was" in
5605         $define) echo "$sym() found." >&4;;
5606         *) echo "$sym() NOT found." >&4;;
5607         esac;;
5608 esac'
5609
5610 : see if sqrtl exists
5611 set sqrtl d_sqrtl
5612 eval $inlibc
5613
5614 case "$ccflags" in
5615 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5616 esac
5617
5618 case "$uselongdouble" in
5619 $define|true|[yY]*)     dflt='y';;
5620 *) dflt='n';;
5621 esac
5622 cat <<EOM
5623
5624 Perl can be built to take advantage of long doubles which
5625 (if available) may give more accuracy and range for floating point numbers.
5626
5627 If this doesn't make any sense to you, just accept the default '$dflt'.
5628 EOM
5629 rp='Try to use long doubles if available?'
5630 . ./myread
5631 case "$ans" in
5632 y|Y)    val="$define"   ;;
5633 *)      val="$undef"    ;;
5634 esac
5635 set uselongdouble
5636 eval $setvar
5637
5638 case "$uselongdouble" in
5639 true|[yY]*) uselongdouble="$define" ;;
5640 esac
5641
5642 case "$uselongdouble" in
5643 $define)
5644 : Look for a hint-file generated 'call-back-unit'.  If the
5645 : user has specified that long doubles should be used,
5646 : we may need to set or change some other defaults.
5647         if $test -f uselongdouble.cbu; then
5648                 echo "Your platform has some specific hints for long doubles, using them..."
5649                 . ./uselongdouble.cbu
5650         else
5651                 $cat <<EOM
5652 (Your platform doesn't have any specific hints for long doubles.)
5653 EOM
5654         fi
5655         ;;
5656 esac
5657
5658 case "$uselongdouble:$d_sqrtl" in
5659 $define:$undef)
5660                 $cat <<EOM >&4
5661
5662 *** You requested the use of long doubles but you do not seem to have
5663 *** the mathematic functions for long doubles.  I'm disabling the use
5664 *** of long doubles.
5665
5666 EOM
5667         uselongdouble=$undef
5668         ;;
5669 esac
5670
5671 : check for length of double
5672 echo " "
5673 case "$doublesize" in
5674 '')
5675         echo "Checking to see how big your double precision numbers are..." >&4
5676         $cat >try.c <<'EOCP'
5677 #include <stdio.h>
5678 int main()
5679 {
5680     printf("%d\n", (int)sizeof(double));
5681     exit(0);
5682 }
5683 EOCP
5684         set try
5685         if eval $compile_ok; then
5686                 doublesize=`./try`
5687                 echo "Your double is $doublesize bytes long."
5688         else
5689                 dflt='8'
5690                 echo "(I can't seem to compile the test program.  Guessing...)"
5691                 rp="What is the size of a double precision number (in bytes)?"
5692                 . ./myread
5693                 doublesize="$ans"
5694         fi
5695         ;;
5696 esac
5697 $rm -f try.c try
5698
5699 : check for long doubles
5700 echo " "
5701 echo "Checking to see if you have long double..." >&4
5702 echo 'int main() { long double x = 7.0; }' > try.c
5703 set try
5704 if eval $compile; then
5705         val="$define"
5706         echo "You have long double."
5707 else
5708         val="$undef"
5709         echo "You do not have long double."
5710 fi
5711 $rm try.*
5712 set d_longdbl
5713 eval $setvar
5714
5715 : check for length of long double
5716 case "${d_longdbl}${longdblsize}" in
5717 $define)
5718         echo " "
5719         echo "Checking to see how big your long doubles are..." >&4
5720         $cat >try.c <<'EOCP'
5721 #include <stdio.h>
5722 int main()
5723 {
5724         printf("%d\n", sizeof(long double));
5725 }
5726 EOCP
5727         set try
5728         set try
5729         if eval $compile; then
5730                 longdblsize=`./try$exe_ext`
5731                 echo "Your long doubles are $longdblsize bytes long."
5732         else
5733                 dflt='8'
5734                 echo " "
5735                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5736                 rp="What is the size of a long double (in bytes)?"
5737                 . ./myread
5738                 longdblsize="$ans"
5739         fi
5740         if $test "X$doublesize" = "X$longdblsize"; then
5741                 echo "(That isn't any different from an ordinary double.)"
5742         fi      
5743         ;;
5744 esac
5745 $rm -f try.* try
5746
5747 case "$useperlio" in
5748 $define|true|[yY]*|'')  dflt='y';;
5749 *) dflt='n';;
5750 esac
5751 cat <<EOM
5752
5753 Previous version of $package used the standard IO mechanisms as
5754 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5755 alternate IO mechanisms via the PerlIO abstraction layer, but the
5756 stdio mechanism is still available if needed.  The abstraction layer
5757 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5758 Using PerlIO with sfio may cause problems with some extension modules.
5759
5760 If this doesn't make any sense to you, just accept the default '$dflt'.
5761 EOM
5762 rp='Use the PerlIO abstraction layer?'
5763 . ./myread
5764 case "$ans" in
5765 y|Y) 
5766         val="$define"
5767         ;;
5768 *)      
5769         echo "Ok, doing things the stdio way."
5770         val="$undef"
5771         ;;
5772 esac
5773 set useperlio
5774 eval $setvar 
5775
5776 case "$usesocks" in
5777 $define|true|[yY]*)
5778         case "$useperlio" in
5779         $define|true|[yY]*) ;;
5780         *)      cat >&4 <<EOM
5781
5782 You are using the SOCKS proxy protocol library which means that you
5783 should also use the PerlIO layer.  You may be headed for trouble.
5784
5785 EOM
5786                 ;;
5787         esac
5788         ;;
5789 esac
5790
5791         
5792 : determine the architecture name
5793 echo " "
5794 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5795         tarch=`arch`"-$osname"
5796 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5797         if uname -m > tmparch 2>&1 ; then
5798                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5799                         -e 's/$/'"-$osname/" tmparch`
5800         else
5801                 tarch="$osname"
5802         fi
5803         $rm -f tmparch
5804 else
5805         tarch="$osname"
5806 fi
5807 case "$myarchname" in
5808 ''|"$tarch") ;;
5809 *)
5810         echo "(Your architecture name used to be $myarchname.)"
5811         archname=''
5812         ;;
5813 esac
5814 myarchname="$tarch"
5815 case "$archname" in
5816 '') dflt="$tarch";;
5817 *) dflt="$archname";;
5818 esac
5819 rp='What is your architecture name'
5820 . ./myread
5821 archname="$ans"
5822 case "$usethreads" in
5823 $define)
5824         echo "Threads selected." >&4
5825         case "$archname" in
5826         *-thread*) echo "...and architecture name already has -thread." >&4
5827                 ;;
5828         *)      archname="$archname-thread"
5829                 echo "...setting architecture name to $archname." >&4
5830                 ;;
5831         esac
5832         ;;
5833 esac
5834 case "$usemultiplicity" in
5835 $define)
5836         echo "Multiplicity selected." >&4
5837         case "$archname" in
5838         *-multi*) echo "...and architecture name already has -multi." >&4
5839                 ;;
5840         *)      archname="$archname-multi"
5841                 echo "...setting architecture name to $archname." >&4
5842                 ;;
5843         esac
5844         ;;
5845 esac
5846 case "$use64bitint$use64bitall" in
5847 *"$define"*)
5848         case "$archname64" in
5849         '')
5850                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5851                 ;;
5852         *)
5853                 case "$use64bitint" in
5854                 "$define") echo "64 bit integers selected." >&4 ;;
5855                 esac
5856                 case "$use64bitall" in
5857                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5858                 esac
5859                 case "$archname" in
5860                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5861                         ;;
5862                 *)      archname="$archname-$archname64"
5863                         echo "...setting architecture name to $archname." >&4
5864                         ;;
5865                 esac
5866                 ;;
5867         esac
5868 esac
5869 case "$uselongdouble" in
5870 $define)
5871         echo "Long doubles selected." >&4
5872         case "$longdblsize" in
5873         $doublesize)
5874                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5875                 ;;
5876         *)
5877                 case "$archname" in
5878                 *-ld*) echo "...and architecture name already has -ld." >&4
5879                         ;;
5880                 *)      archname="$archname-ld"
5881                         echo "...setting architecture name to $archname." >&4
5882                         ;;
5883                 esac
5884                 ;;
5885         esac
5886         ;;
5887 esac
5888 case "$useperlio" in
5889 $define)
5890         echo "Perlio selected." >&4
5891         ;;
5892 *)
5893         echo "Perlio not selected, using stdio." >&4
5894         case "$archname" in
5895         *-stdio*) echo "...and architecture name already has -stdio." >&4
5896                 ;;
5897         *)      archname="$archname-stdio"
5898                 echo "...setting architecture name to $archname." >&4
5899                 ;;
5900         esac
5901         ;;
5902 esac
5903
5904 : determine root of directory hierarchy where package will be installed.
5905 case "$prefix" in
5906 '')
5907         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5908         ;;
5909 *)
5910         dflt="$prefix"
5911         ;;
5912 esac
5913 $cat <<EOM
5914
5915 By default, $package will be installed in $dflt/bin, manual pages
5916 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5917 installation directories. Typically this is something like /usr/local.
5918 If you wish to have binaries under /usr/bin but other parts of the
5919 installation under /usr/local, that's ok: you will be prompted
5920 separately for each of the installation directories, the prefix being
5921 only used to set the defaults.
5922
5923 EOM
5924 fn=d~
5925 rp='Installation prefix to use?'
5926 . ./getfile
5927 oldprefix=''
5928 case "$prefix" in
5929 '') ;;
5930 *)
5931         case "$ans" in
5932         "$prefix") ;;
5933         *) oldprefix="$prefix";;
5934         esac
5935         ;;
5936 esac
5937 prefix="$ans"
5938 prefixexp="$ansexp"
5939
5940 case "$afsroot" in
5941 '')     afsroot=/afs ;;
5942 *)      afsroot=$afsroot ;;
5943 esac
5944
5945 : is AFS running?
5946 echo " "
5947 case "$afs" in
5948 $define|true)   afs=true ;;
5949 $undef|false)   afs=false ;;
5950 *)      if test -d $afsroot; then
5951                 afs=true
5952         else
5953                 afs=false
5954         fi
5955         ;;
5956 esac
5957 if $afs; then
5958         echo "AFS may be running... I'll be extra cautious then..." >&4
5959 else
5960         echo "AFS does not seem to be running..." >&4
5961 fi
5962
5963 : determine installation prefix for where package is to be installed.
5964 if $afs; then 
5965 $cat <<EOM
5966
5967 Since you are running AFS, I need to distinguish the directory in which
5968 files will reside from the directory in which they are installed (and from
5969 which they are presumably copied to the former directory by occult means).
5970
5971 EOM
5972         case "$installprefix" in
5973         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5974         *) dflt="$installprefix";;
5975         esac
5976 else
5977 $cat <<EOM
5978
5979 In some special cases, particularly when building $package for distribution,
5980 it is convenient to distinguish between the directory in which files should 
5981 be installed from the directory ($prefix) in which they 
5982 will eventually reside.  For most users, these two directories are the same.
5983
5984 EOM
5985         case "$installprefix" in
5986         '') dflt=$prefix ;;
5987         *) dflt=$installprefix;;
5988         esac
5989 fi
5990 fn=d~
5991 rp='What installation prefix should I use for installing files?'
5992 . ./getfile
5993 installprefix="$ans"
5994 installprefixexp="$ansexp"
5995
5996 : set the prefixit variable, to compute a suitable default value
5997 prefixit='case "$3" in
5998 ""|none)
5999         case "$oldprefix" in
6000         "") eval "$1=\"\$$2\"";;
6001         *)
6002                 case "$3" in
6003                 "") eval "$1=";;
6004                 none)
6005                         eval "tp=\"\$$2\"";
6006                         case "$tp" in
6007                         ""|" ") eval "$1=\"\$$2\"";;
6008                         *) eval "$1=";;
6009                         esac;;
6010                 esac;;
6011         esac;;
6012 *)
6013         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6014         case "$tp" in
6015         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6016         /*-$oldprefix/*|\~*-$oldprefix/*)
6017                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6018         *) eval "$1=\"\$$2\"";;
6019         esac;;
6020 esac'
6021
6022
6023 : get the patchlevel
6024 echo " "
6025 echo "Getting the current patchlevel..." >&4
6026 if $test -r $rsrc/patchlevel.h;then
6027         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6028         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6029         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6030         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6031         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6032         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6033        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6034 else
6035         revision=0
6036         patchlevel=0
6037         subversion=0
6038         api_revision=0
6039         api_version=0
6040         api_subversion=0
6041         perl_patchlevel=0
6042         $echo "(You do not have patchlevel.h.  Eek.)"
6043 fi
6044 if $test -r $rsrc/.patch ; then  
6045         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6046                 perl_patchlevel=`cat $rsrc/.patch`
6047         fi
6048 fi
6049 case "$perl_patchlevel" in
6050 0)  ;;
6051 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6052 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6053 esac
6054 case "$osname" in
6055 dos|vms)
6056         : XXX Should be a Configure test for double-dots in filenames.
6057         version=`echo $revision $patchlevel $subversion | \
6058                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6059         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6060                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6061         ;;
6062 *)
6063         version=`echo $revision $patchlevel $subversion | \
6064                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6065         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6066                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6067         ;;
6068 esac
6069 : Special case the 5.005_xx maintenance series, which used 5.005
6070 : without any subversion label as a subdirectory in $sitelib
6071 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6072         api_versionstring='5.005'
6073 fi
6074
6075 : determine installation style
6076 : For now, try to deduce it from prefix unless it is already set.
6077 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6078 case "$installstyle" in
6079 '')     case "$prefix" in
6080                 *perl*) dflt='lib';;
6081                 *) dflt='lib/perl5' ;;
6082         esac
6083         ;;
6084 *)      dflt="$installstyle" ;;
6085 esac
6086 : Probably not worth prompting for this since we prompt for all
6087 : the directories individually, and the prompt would be too long and
6088 : confusing anyway.
6089 installstyle=$dflt
6090
6091 : determine where private library files go
6092 : Usual default is /usr/local/lib/perl5/$version.
6093 : Also allow things like /opt/perl/lib/$version, since 
6094 : /opt/perl/lib/perl5... would be redundant.
6095 : The default "style" setting is made in installstyle.U
6096 case "$installstyle" in
6097 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6098 *)       set dflt privlib lib/$version ;;
6099 esac
6100 eval $prefixit
6101 $cat <<EOM
6102
6103 There are some auxiliary files for $package that need to be put into a
6104 private library directory that is accessible by everyone.
6105
6106 EOM
6107 fn=d~+
6108 rp='Pathname where the private library files will reside?'
6109 . ./getfile
6110 privlib="$ans"
6111 privlibexp="$ansexp"
6112 : Change installation prefix, if necessary.
6113 if $test X"$prefix" != X"$installprefix"; then
6114         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6115 else
6116         installprivlib="$privlibexp"
6117 fi
6118
6119 : set the prefixup variable, to restore leading tilda escape
6120 prefixup='case "$prefixexp" in
6121 "$prefix") ;;
6122 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6123 esac'
6124
6125 : determine where public architecture dependent libraries go
6126 set archlib archlib
6127 eval $prefixit
6128 : privlib default is /usr/local/lib/$package/$version
6129 : archlib default is /usr/local/lib/$package/$version/$archname
6130 : privlib may have an optional trailing /share.
6131 tdflt=`echo $privlib | $sed 's,/share$,,'`
6132 tdflt=$tdflt/$archname
6133 case "$archlib" in
6134 '')     dflt=$tdflt
6135         ;;
6136 *)      dflt="$archlib"
6137     ;;
6138 esac
6139 $cat <<EOM
6140
6141 $spackage contains architecture-dependent library files.  If you are
6142 sharing libraries in a heterogeneous environment, you might store
6143 these files in a separate location.  Otherwise, you can just include
6144 them with the rest of the public library files.
6145
6146 EOM
6147 fn=d+~
6148 rp='Where do you want to put the public architecture-dependent libraries?'
6149 . ./getfile
6150 archlib="$ans"
6151 archlibexp="$ansexp"
6152 if $test X"$archlib" = X"$privlib"; then
6153         d_archlib="$undef"
6154 else
6155         d_archlib="$define"
6156 fi
6157 : Change installation prefix, if necessary.
6158 if $test X"$prefix" != X"$installprefix"; then
6159         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6160 else
6161         installarchlib="$archlibexp"
6162 fi
6163
6164
6165 : Binary compatibility with 5.005 is not possible for builds
6166 : with advanced features
6167 case "$usethreads$usemultiplicity" in
6168 *define*)
6169         bincompat5005="$undef"
6170         d_bincompat5005="$undef"
6171         ;;
6172 *)      $cat <<EOM
6173
6174 This version of Perl can be compiled for binary compatibility with 5.005.
6175 If you decide to do so, you will be able to continue using most of the
6176 extensions that were compiled for Perl 5.005.
6177
6178 EOM
6179         case "$bincompat5005$d_bincompat5005" in
6180         *"$undef"*) dflt=n ;;
6181         *) dflt=y ;;
6182         esac
6183         rp='Binary compatibility with Perl 5.005?'
6184         . ./myread
6185         case "$ans" in
6186         y*) val="$define" ;;
6187         *)  val="$undef" ;;
6188         esac
6189         set d_bincompat5005
6190         eval $setvar
6191         case "$d_bincompat5005" in
6192         "$define")
6193                 bincompat5005="$define"
6194                 ;;
6195         *)      bincompat5005="$undef"
6196                 d_bincompat5005="$undef"
6197                 ;;
6198         esac
6199         ;;
6200 esac
6201
6202
6203 : see if setuid scripts can be secure
6204 $cat <<EOM
6205
6206 Some kernels have a bug that prevents setuid #! scripts from being
6207 secure.  Some sites have disabled setuid #! scripts because of this.
6208
6209 First let's decide if your kernel supports secure setuid #! scripts.
6210 (If setuid #! scripts would be secure but have been disabled anyway,
6211 don't say that they are secure if asked.)
6212
6213 EOM
6214
6215 val="$undef"
6216 if $test -d /dev/fd; then
6217         echo "#!$ls" >reflect
6218         chmod +x,u+s reflect
6219         ./reflect >flect 2>&1
6220         if $contains "/dev/fd" flect >/dev/null; then
6221                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6222                 val="$define"
6223         else
6224                 $cat <<EOM
6225 If you are not sure if they are secure, I can check but I'll need a
6226 username and password different from the one you are using right now.
6227 If you don't have such a username or don't want me to test, simply
6228 enter 'none'.
6229
6230 EOM
6231                 rp='Other username to test security of setuid scripts with?'
6232                 dflt='none'
6233                 . ./myread
6234                 case "$ans" in
6235                 n|none)
6236                         case "$d_suidsafe" in
6237                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6238                                 dflt=n;;
6239                         "$undef")
6240                                 echo "Well, the $hint value is *not* secure." >&4
6241                                 dflt=n;;
6242                         *)      echo "Well, the $hint value *is* secure." >&4
6243                                 dflt=y;;
6244                         esac
6245                         ;;
6246                 *)
6247                         $rm -f reflect flect
6248                         echo "#!$ls" >reflect
6249                         chmod +x,u+s reflect
6250                         echo >flect
6251                         chmod a+w flect
6252                         echo '"su" will (probably) prompt you for '"$ans's password."
6253                         su $ans -c './reflect >flect'
6254                         if $contains "/dev/fd" flect >/dev/null; then
6255                                 echo "Okay, it looks like setuid scripts are secure." >&4
6256                                 dflt=y
6257                         else
6258                                 echo "I don't think setuid scripts are secure." >&4
6259                                 dflt=n
6260                         fi
6261                         ;;
6262                 esac
6263                 rp='Does your kernel have *secure* setuid scripts?'
6264                 . ./myread
6265                 case "$ans" in
6266                 [yY]*)  val="$define";;
6267                 *)      val="$undef";;
6268                 esac
6269         fi
6270 else
6271         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6272         echo "(That's for file descriptors, not floppy disks.)"
6273         val="$undef"
6274 fi
6275 set d_suidsafe
6276 eval $setvar
6277
6278 $rm -f reflect flect
6279
6280 : now see if they want to do setuid emulation
6281 echo " "
6282 val="$undef"
6283 case "$d_suidsafe" in
6284 "$define")
6285         val="$undef"
6286         echo "No need to emulate SUID scripts since they are secure here." >& 4
6287         ;;
6288 *)
6289         $cat <<EOM
6290 Some systems have disabled setuid scripts, especially systems where
6291 setuid scripts cannot be secure.  On systems where setuid scripts have
6292 been disabled, the setuid/setgid bits on scripts are currently
6293 useless.  It is possible for $package to detect those bits and emulate
6294 setuid/setgid in a secure fashion.  This emulation will only work if
6295 setuid scripts have been disabled in your kernel.
6296
6297 EOM
6298         case "$d_dosuid" in
6299         "$define") dflt=y ;;
6300         *) dflt=n ;;
6301         esac
6302         rp="Do you want to do setuid/setgid emulation?"
6303         . ./myread
6304         case "$ans" in
6305         [yY]*)  val="$define";;
6306         *)      val="$undef";;
6307         esac
6308         ;;
6309 esac
6310 set d_dosuid
6311 eval $setvar
6312
6313 : see if this is a malloc.h system
6314 set malloc.h i_malloc
6315 eval $inhdr
6316
6317 : see if stdlib is available
6318 set stdlib.h i_stdlib
6319 eval $inhdr
6320
6321 : determine which malloc to compile in
6322 echo " "
6323 case "$usemymalloc" in
6324 [yY]*|true|$define)     dflt='y' ;;
6325 [nN]*|false|$undef)     dflt='n' ;;
6326 *)      case "$ptrsize" in
6327         4) dflt='y' ;;
6328         *) dflt='n' ;;
6329         esac
6330         ;;
6331 esac
6332 rp="Do you wish to attempt to use the malloc that comes with $package?"
6333 . ./myread
6334 usemymalloc="$ans"
6335 case "$ans" in
6336 y*|true)
6337         usemymalloc='y'
6338         mallocsrc='malloc.c'
6339         mallocobj="malloc$_o"
6340         d_mymalloc="$define"
6341         case "$libs" in
6342         *-lmalloc*)
6343                 : Remove malloc from list of libraries to use
6344                 echo "Removing unneeded -lmalloc from library list" >&4
6345                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6346                 shift
6347                 libs="$*"
6348                 echo "libs = $libs" >&4
6349                 ;;
6350         esac
6351         ;;
6352 *)
6353         usemymalloc='n'
6354         mallocsrc=''
6355         mallocobj=''
6356         d_mymalloc="$undef"
6357         ;;
6358 esac
6359
6360 : compute the return types of malloc and free
6361 echo " "
6362 $cat >malloc.c <<END
6363 #$i_malloc I_MALLOC
6364 #$i_stdlib I_STDLIB
6365 #include <stdio.h>
6366 #include <sys/types.h>
6367 #ifdef I_MALLOC
6368 #include <malloc.h>
6369 #endif
6370 #ifdef I_STDLIB
6371 #include <stdlib.h>
6372 #endif
6373 #ifdef TRY_MALLOC
6374 void *malloc();
6375 #endif
6376 #ifdef TRY_FREE
6377 void free();
6378 #endif
6379 END
6380 case "$malloctype" in
6381 '')
6382         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6383                 malloctype='void *'
6384         else
6385                 malloctype='char *'
6386         fi
6387         ;;
6388 esac
6389 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6390
6391 case "$freetype" in
6392 '')
6393         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6394                 freetype='void'
6395         else
6396                 freetype='int'
6397         fi
6398         ;;
6399 esac
6400 echo "Your system uses $freetype free(), it would seem." >&4
6401 $rm -f malloc.[co]
6402 $cat <<EOM
6403
6404 After $package is installed, you may wish to install various
6405 add-on modules and utilities.  Typically, these add-ons will
6406 be installed under $prefix with the rest
6407 of this package.  However, you may wish to install such add-ons
6408 elsewhere under a different prefix.
6409
6410 If you do not wish to put everything under a single prefix, that's
6411 ok.  You will be prompted for the individual locations; this siteprefix
6412 is only used to suggest the defaults.
6413
6414 The default should be fine for most people.
6415
6416 EOM
6417 fn=d~+
6418 rp='Installation prefix to use for add-on modules and utilities?'
6419 : XXX Here might be another good place for an installstyle setting.
6420 case "$siteprefix" in
6421 '') dflt=$prefix ;;
6422 *)  dflt=$siteprefix ;;
6423 esac
6424 . ./getfile
6425 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6426 oldsiteprefix=''
6427 case "$siteprefix" in
6428 '') ;;
6429 *)      case "$ans" in
6430         "$prefix") ;;
6431         *) oldsiteprefix="$prefix";;
6432         esac
6433         ;;
6434 esac
6435 siteprefix="$ans"
6436 siteprefixexp="$ansexp"
6437
6438 : determine where site specific libraries go.
6439 : Usual default is /usr/local/lib/perl5/site_perl/$version
6440 : The default "style" setting is made in installstyle.U
6441 : XXX No longer works with Prefixit stuff.
6442 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6443 case "$sitelib" in
6444 '') case "$installstyle" in
6445         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6446         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6447         esac
6448         ;;
6449 *)      dflt="$sitelib"
6450         ;;
6451 esac
6452 $cat <<EOM
6453
6454 The installation process will create a directory for
6455 site-specific extensions and modules.  Most users find it convenient
6456 to place all site-specific files in this directory rather than in the
6457 main distribution directory.
6458
6459 EOM
6460 fn=d~+
6461 rp='Pathname for the site-specific library files?'
6462 . ./getfile
6463 sitelib="$ans"
6464 sitelibexp="$ansexp"
6465 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6466 : Change installation prefix, if necessary.
6467 if $test X"$prefix" != X"$installprefix"; then
6468         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6469 else
6470         installsitelib="$sitelibexp"
6471 fi
6472
6473 : determine where site specific architecture-dependent libraries go.
6474 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6475 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6476 : sitelib may have an optional trailing /share.
6477 case "$sitearch" in
6478 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6479         dflt="$dflt/$archname"
6480         ;;
6481 *)      dflt="$sitearch"
6482         ;;
6483 esac
6484 set sitearch sitearch none
6485 eval $prefixit
6486 $cat <<EOM
6487
6488 The installation process will also create a directory for
6489 architecture-dependent site-specific extensions and modules.
6490
6491 EOM
6492 fn=d~+
6493 rp='Pathname for the site-specific architecture-dependent library files?'
6494 . ./getfile
6495 sitearch="$ans"
6496 sitearchexp="$ansexp"
6497 : Change installation prefix, if necessary.
6498 if $test X"$prefix" != X"$installprefix"; then
6499         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6500 else
6501         installsitearch="$sitearchexp"
6502 fi
6503
6504 $cat <<EOM
6505
6506 The installation process will also create a directory for
6507 vendor-supplied add-ons.  Vendors who supply perl with their system
6508 may find it convenient to place all vendor-supplied files in this
6509 directory rather than in the main distribution directory.  This will
6510 ease upgrades between binary-compatible maintenance versions of perl.
6511
6512 Of course you may also use these directories in whatever way you see
6513 fit.  For example, you might use them to access modules shared over a
6514 company-wide network.
6515
6516 The default answer should be fine for most people.
6517 This causes further questions about vendor add-ons to be skipped
6518 and no vendor-specific directories will be configured for perl.
6519
6520 EOM
6521 rp='Do you want to configure vendor-specific add-on directories?'
6522 case "$usevendorprefix" in
6523 define|true|[yY]*) dflt=y ;;
6524 *)      : User may have set vendorprefix directly on Configure command line.
6525         case "$vendorprefix" in
6526         ''|' ') dflt=n ;;
6527         *)      dflt=y ;;
6528         esac
6529         ;;
6530 esac
6531 . ./myread
6532 case "$ans" in
6533 [yY]*)  fn=d~+
6534         rp='Installation prefix to use for vendor-supplied add-ons?'
6535         case "$vendorprefix" in
6536         '') dflt='' ;;
6537         *)  dflt=$vendorprefix ;;
6538         esac
6539         . ./getfile
6540         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6541         oldvendorprefix=''
6542         case "$vendorprefix" in
6543         '') ;;
6544         *)      case "$ans" in
6545                 "$prefix") ;;
6546                 *) oldvendorprefix="$prefix";;
6547                 esac
6548                 ;;
6549         esac
6550         usevendorprefix="$define"
6551         vendorprefix="$ans"
6552         vendorprefixexp="$ansexp"
6553         ;;
6554 *)      usevendorprefix="$undef"
6555         vendorprefix=''
6556         vendorprefixexp=''
6557         ;;
6558 esac
6559
6560 case "$vendorprefix" in
6561 '')     d_vendorlib="$undef"
6562         vendorlib=''
6563         vendorlibexp=''
6564         ;;
6565 *)      d_vendorlib="$define"
6566         : determine where vendor-supplied modules go.
6567         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6568         case "$vendorlib" in
6569         '')
6570                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6571                 case "$installstyle" in
6572                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6573                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6574                 esac
6575                 ;;
6576         *)      dflt="$vendorlib"
6577                 ;;
6578         esac
6579         fn=d~+
6580         rp='Pathname for the vendor-supplied library files?'
6581         . ./getfile
6582         vendorlib="$ans"
6583         vendorlibexp="$ansexp"
6584         ;;
6585 esac
6586 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6587 : Change installation prefix, if necessary.
6588 if $test X"$prefix" != X"$installprefix"; then
6589         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6590 else
6591         installvendorlib="$vendorlibexp"
6592 fi
6593
6594 case "$vendorprefix" in
6595 '')     d_vendorarch="$undef"
6596         vendorarch=''
6597         vendorarchexp=''
6598         ;;
6599 *)      d_vendorarch="$define"
6600         : determine where vendor-supplied architecture-dependent libraries go.
6601         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6602         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6603         : vendorlib may have an optional trailing /share.
6604         case "$vendorarch" in
6605         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6606                 dflt="$dflt/$archname"
6607                 ;;
6608         *)      dflt="$vendorarch" ;;
6609         esac
6610         fn=d~+
6611         rp='Pathname for vendor-supplied architecture-dependent files?'
6612         . ./getfile
6613         vendorarch="$ans"
6614         vendorarchexp="$ansexp"
6615         ;;
6616 esac
6617 : Change installation prefix, if necessary.
6618 if $test X"$prefix" != X"$installprefix"; then
6619         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6620 else
6621         installvendorarch="$vendorarchexp"
6622 fi
6623
6624 : Final catch-all directories to search
6625 $cat <<EOM
6626
6627 Lastly, you can have perl look in other directories for extensions and
6628 modules in addition to those already specified.
6629 These directories will be searched after 
6630         $sitearch 
6631         $sitelib 
6632 EOM
6633 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6634 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6635 echo ' '
6636 case "$otherlibdirs" in
6637 ''|' ') dflt='none' ;;
6638 *)      dflt="$otherlibdirs" ;;
6639 esac
6640 $cat <<EOM
6641 Enter a colon-separated set of extra paths to include in perl's @INC
6642 search path, or enter 'none' for no extra paths.
6643
6644 EOM
6645
6646 rp='Colon-separated list of additional directories for perl to search?'
6647 . ./myread
6648 case "$ans" in
6649 ' '|''|none)    otherlibdirs=' ' ;;     
6650 *)      otherlibdirs="$ans" ;;
6651 esac
6652 case "$otherlibdirs" in
6653 ' ') val=$undef ;;
6654 *)      val=$define ;;
6655 esac
6656 set d_perl_otherlibdirs
6657 eval $setvar
6658
6659 : Cruising for prototypes
6660 echo " "
6661 echo "Checking out function prototypes..." >&4
6662 $cat >prototype.c <<'EOCP'
6663 int main(int argc, char *argv[]) {
6664         exit(0);}
6665 EOCP
6666 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6667         echo "Your C compiler appears to support function prototypes."
6668         val="$define"
6669 else
6670         echo "Your C compiler doesn't seem to understand function prototypes."
6671         val="$undef"
6672 fi
6673 set prototype
6674 eval $setvar
6675 $rm -f prototype*
6676
6677 case "$prototype" in
6678 "$define") ;;
6679 *)      ansi2knr='ansi2knr'
6680         echo " "
6681         cat <<EOM >&4
6682
6683 $me:  FATAL ERROR:
6684 This version of $package can only be compiled by a compiler that 
6685 understands function prototypes.  Unfortunately, your C compiler 
6686         $cc $ccflags
6687 doesn't seem to understand them.  Sorry about that.
6688
6689 If GNU cc is available for your system, perhaps you could try that instead.  
6690
6691 Eventually, we hope to support building Perl with pre-ANSI compilers.
6692 If you would like to help in that effort, please contact <perlbug@perl.org>.
6693
6694 Aborting Configure now.
6695 EOM
6696         exit 2
6697         ;;
6698 esac
6699
6700 : determine where public executables go
6701 echo " "
6702 set dflt bin bin
6703 eval $prefixit
6704 fn=d~
6705 rp='Pathname where the public executables will reside?'
6706 . ./getfile
6707 if $test "X$ansexp" != "X$binexp"; then
6708         installbin=''
6709 fi
6710 bin="$ans"
6711 binexp="$ansexp"
6712 : Change installation prefix, if necessary.
6713 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6714 if $test X"$prefix" != X"$installprefix"; then
6715         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6716 else
6717         installbin="$binexp"
6718 fi
6719
6720 : Find perl5.005 or later.
6721 echo "Looking for a previously installed perl5.005 or later... "
6722 case "$perl5" in
6723 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6724                 : Check if this perl is recent and can load a simple module
6725                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6726                         perl5=$tdir/perl
6727                         break;
6728                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6729                         perl5=$tdir/perl5
6730                         break;
6731                 fi
6732         done
6733         ;;
6734 *)      perl5="$perl5"
6735         ;;
6736 esac
6737 case "$perl5" in
6738 '')     echo "None found.  That's ok.";;
6739 *)      echo "Using $perl5." ;;
6740 esac
6741
6742 : Determine list of previous versions to include in @INC
6743 $cat > getverlist <<EOPL
6744 #!$perl5 -w
6745 use File::Basename;
6746 \$api_versionstring = "$api_versionstring";
6747 \$version = "$version";
6748 \$stem = "$sitelib_stem";
6749 \$archname = "$archname";
6750 EOPL
6751         $cat >> getverlist <<'EOPL'
6752 # Can't have leading @ because metaconfig interprets it as a command!
6753 ;@inc_version_list=();
6754 # XXX Redo to do opendir/readdir? 
6755 if (-d $stem) {
6756     chdir($stem);
6757     ;@candidates = glob("5.*");
6758 }
6759 else {
6760     ;@candidates = ();
6761 }
6762
6763 # XXX ToDo:  These comparisons must be reworked when two-digit
6764 # subversions come along, so that 5.7.10 compares as greater than
6765 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6766 # widespread that we can use the built-in version vectors rather
6767 # than reinventing them here.  For 5.6.0, however, we must
6768 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6769 foreach $d (@candidates) {
6770     if ($d lt $version) {
6771         if ($d ge $api_versionstring) {
6772             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6773         }
6774         elsif ($d ge "5.005") {
6775             unshift(@inc_version_list, grep { -d } $d);
6776         }
6777     }
6778     else {
6779         # Skip newer version.  I.e. don't look in
6780         # 5.7.0 if we're installing 5.6.1.
6781     }
6782 }
6783
6784 if (@inc_version_list) {
6785     print join(' ', @inc_version_list);
6786 }
6787 else {
6788     # Blank space to preserve value for next Configure run.
6789     print " ";
6790 }
6791 EOPL
6792 chmod +x getverlist
6793 case "$inc_version_list" in
6794 '')     if test -x "$perl5$exe_ext"; then
6795                 dflt=`$perl5 getverlist`
6796         else
6797                 dflt='none'
6798         fi
6799         ;;
6800 $undef) dflt='none' ;;
6801 *)  eval dflt=\"$inc_version_list\" ;;
6802 esac
6803 case "$dflt" in
6804 ''|' ') dflt=none ;;
6805 esac
6806 case "$dflt" in
6807 5.005) case "$bincompat5005" in
6808        $define|true|[yY]*) ;;
6809        *) dflt=none ;;
6810        esac
6811        ;;
6812 esac
6813 $cat <<'EOM'
6814
6815 In order to ease the process of upgrading, this version of perl 
6816 can be configured to use modules built and installed with earlier 
6817 versions of perl that were installed under $prefix.  Specify here
6818 the list of earlier versions that this version of perl should check.
6819 If Configure detected no earlier versions of perl installed under
6820 $prefix, then the list will be empty.  Answer 'none' to tell perl
6821 to not search earlier versions.
6822
6823 The default should almost always be sensible, so if you're not sure,
6824 just accept the default.
6825 EOM
6826
6827 rp='List of earlier versions to include in @INC?'
6828 . ./myread
6829 case "$ans" in
6830 [Nn]one|''|' ') inc_version_list=' ' ;;
6831 *) inc_version_list="$ans" ;;
6832 esac
6833 case "$inc_version_list" in
6834 ''|' ') 
6835         inc_version_list_init='0';;
6836 *)      inc_version_list_init=`echo $inc_version_list |
6837                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6838         ;;
6839 esac
6840 $rm -f getverlist
6841
6842 : determine whether to install perl also as /usr/bin/perl
6843
6844 echo " "
6845 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6846         $cat <<EOM
6847 Many scripts expect perl to be installed as /usr/bin/perl.
6848 I can install the perl you are about to compile also as /usr/bin/perl
6849 (in addition to $installbin/perl).
6850 EOM
6851         case "$installusrbinperl" in
6852         "$undef"|[nN]*) dflt='n';;
6853         *)              dflt='y';;
6854         esac
6855         rp="Do you want to install perl as /usr/bin/perl?"
6856         . ./myread
6857         case "$ans" in
6858         [yY]*)  val="$define";;
6859         *)      val="$undef" ;;
6860         esac
6861 else
6862         val="$undef"
6863 fi
6864 set installusrbinperl
6865 eval $setvar
6866
6867 : see if dld is available
6868 set dld.h i_dld
6869 eval $inhdr
6870
6871 : see if dlopen exists
6872 xxx_runnm="$runnm"
6873 runnm=false
6874 set dlopen d_dlopen
6875 eval $inlibc
6876 runnm="$xxx_runnm"
6877
6878 : determine which dynamic loading, if any, to compile in
6879 echo " "
6880 dldir="ext/DynaLoader"
6881 case "$usedl" in
6882 $define|y|true)
6883         dflt='y'
6884         usedl="$define"
6885         ;;
6886 $undef|n|false)
6887         dflt='n'
6888         usedl="$undef"
6889         ;;
6890 *) 
6891         dflt='n'
6892         case "$d_dlopen" in
6893             $define) dflt='y' ;;
6894         esac
6895         case "$i_dld" in
6896             $define) dflt='y' ;;
6897         esac
6898         : Does a dl_xxx.xs file exist for this operating system
6899         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6900         ;;
6901 esac
6902 rp="Do you wish to use dynamic loading?"
6903 . ./myread
6904 usedl="$ans"
6905 case "$ans" in
6906 y*) usedl="$define"
6907         case "$dlsrc" in
6908         '')
6909                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6910                         dflt="$dldir/dl_${osname}.xs"
6911                 elif $test "$d_dlopen" = "$define" ; then
6912                         dflt="$dldir/dl_dlopen.xs"
6913                 elif $test "$i_dld" = "$define" ; then
6914                         dflt="$dldir/dl_dld.xs"
6915                 else
6916                         dflt=''
6917                 fi
6918                 ;;
6919         *)      dflt="$dldir/$dlsrc"
6920                 ;;
6921         esac
6922     echo "The following dynamic loading files are available:"
6923         : Can not go over to $dldir because getfile has path hard-coded in.
6924         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6925         rp="Source file to use for dynamic loading"
6926         fn="fne"
6927         gfpth="$src"
6928         . ./getfile
6929         usedl="$define"
6930         : emulate basename
6931         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6932
6933         $cat << EOM
6934
6935 Some systems may require passing special flags to $cc -c to
6936 compile modules that will be used to create a shared library.
6937 To use no flags, say "none".
6938
6939 EOM
6940     case "$cccdlflags" in
6941     '') case "$gccversion" in
6942                 '') case "$osname" in
6943                         hpux)   dflt='+z' ;;
6944                         next)   dflt='none' ;;
6945                         irix*)  dflt='-KPIC' ;;
6946                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6947                         sunos)  dflt='-pic' ;;
6948                         *)      dflt='none' ;;
6949                     esac
6950                         ;;
6951                 *)  case "$osname" in
6952                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6953                         *)      dflt='-fpic' ;;
6954                     esac ;;
6955             esac ;;
6956         ' ') dflt='none' ;;
6957     *)  dflt="$cccdlflags" ;;
6958     esac
6959     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6960     . ./myread
6961     case "$ans" in
6962     none) cccdlflags=' ' ;;
6963     *) cccdlflags="$ans" ;;
6964     esac
6965
6966     cat << EOM
6967
6968 Some systems use ld to create libraries that can be dynamically loaded,
6969 while other systems (such as those using ELF) use $cc.
6970
6971 EOM
6972         case "$ld" in
6973         '')     $cat >try.c <<'EOM'
6974 /* Test for whether ELF binaries are produced */
6975 #include <fcntl.h>
6976 #include <stdlib.h>
6977 int main() {
6978         char b[4];
6979         int i = open("a.out",O_RDONLY);
6980         if(i == -1) 
6981                 exit(1); /* fail */
6982         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6983                 exit(0); /* succeed (yes, it's ELF) */
6984         else
6985                 exit(1); /* fail */
6986 }
6987 EOM
6988                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6989                         cat <<EOM
6990 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6991 EOM
6992                         dflt="$cc"
6993                 else
6994                         echo "I'll use ld to build dynamic libraries."
6995                         dflt='ld'
6996                 fi
6997                 rm -f try.c a.out
6998                 ;;
6999         *)      dflt="$ld"
7000                 ;;
7001         esac
7002
7003     rp="What command should be used to create dynamic libraries?"
7004     . ./myread
7005         ld="$ans"
7006
7007     cat << EOM
7008
7009 Some systems may require passing special flags to $ld to create a
7010 library that can be dynamically loaded.  If your ld flags include
7011 -L/other/path options to locate libraries outside your loader's normal
7012 search path, you may need to specify those -L options here as well.  To
7013 use no flags, say "none".
7014
7015 EOM
7016     case "$lddlflags" in
7017     '') case "$osname" in
7018                         beos) dflt='-nostart' ;;
7019                         hpux) dflt='-b';
7020                               case "$gccversion" in
7021                               '') dflt="$dflt +vnocompatwarnings" ;;
7022                               esac
7023                               ;;        
7024                         linux|irix*)    dflt='-shared' ;;
7025                         next)  dflt='none' ;;
7026                         solaris) dflt='-G' ;;
7027                         sunos) dflt='-assert nodefinitions' ;;
7028                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7029                 *)     dflt='none' ;;
7030                         esac
7031                         ;;
7032     *) dflt="$lddlflags" ;;
7033     esac
7034
7035         : Try to guess additional flags to pick up local libraries.
7036         : Be careful not to append to a plain 'none'
7037         case "$dflt" in
7038         none) dflt='' ;;
7039         esac
7040         for thisflag in $ldflags; do
7041                 case "$thisflag" in
7042                 -L*|-R*)
7043                         case " $dflt " in
7044                         *" $thisflag "*) ;;
7045                         *) dflt="$dflt $thisflag" ;;
7046                         esac
7047                         ;;
7048                 esac
7049         done
7050
7051         case "$dflt" in
7052         ''|' ') dflt='none' ;;
7053         esac
7054
7055     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7056     . ./myread
7057     case "$ans" in
7058     none) lddlflags=' ' ;;
7059     *) lddlflags="$ans" ;;
7060     esac
7061
7062         cat <<EOM
7063
7064 Some systems may require passing special flags to $cc to indicate that
7065 the resulting executable will use dynamic linking.  To use no flags,
7066 say "none".
7067
7068 EOM
7069     case "$ccdlflags" in
7070     '') case "$osname" in
7071                 hpux)   dflt='-Wl,-E' ;;
7072                 linux)  dflt='-rdynamic' ;;
7073                 next)   dflt='none' ;;
7074                 sunos)  dflt='none' ;;
7075                 *)      dflt='none' ;;
7076             esac ;;
7077     ' ')  dflt='none' ;;
7078     *)  dflt="$ccdlflags" ;;
7079     esac
7080     rp="Any special flags to pass to $cc to use dynamic linking?"
7081     . ./myread
7082     case "$ans" in
7083     none) ccdlflags=' ' ;;
7084     *) ccdlflags="$ans" ;;
7085     esac
7086     ;;
7087 *)  usedl="$undef"
7088         ld='ld'
7089     dlsrc='dl_none.xs'
7090     lddlflags=''
7091     ccdlflags=''
7092     ;;
7093 esac
7094
7095 also=''
7096 case "$usedl" in
7097 $undef)
7098         # No dynamic loading being used, so don't bother even to prompt.
7099         useshrplib='false'
7100         ;;
7101 *)      case "$useshrplib" in
7102         '')     case "$osname" in
7103                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7104                         dflt=y
7105                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7106                         ;;
7107                 next*)
7108                         case "$osvers" in
7109                         4*)     dflt=y
7110                                 also='Building a shared libperl is needed for MAB support.'
7111                                 ;;
7112                         *)      dflt=n
7113                                 ;;
7114                         esac
7115                         ;;
7116                 *)      dflt=n
7117                         ;;
7118                 esac
7119                 ;;
7120         $define|true|[Yy]*)
7121                 dflt=y
7122                 ;;
7123         *)      dflt=n
7124                 ;;
7125         esac
7126         $cat << EOM
7127
7128 The perl executable is normally obtained by linking perlmain.c with
7129 libperl${_a}, any static extensions (usually just DynaLoader), and
7130 any other libraries needed on this system (such as -lm, etc.).  Since
7131 your system supports dynamic loading, it is probably possible to build
7132 a shared libperl.$so.  If you will have more than one executable linked
7133 to libperl.$so, this will significantly reduce the size of each
7134 executable, but it may have a noticeable affect on performance.  The
7135 default is probably sensible for your system.
7136 $also
7137
7138 EOM
7139         rp="Build a shared libperl.$so (y/n)"
7140         . ./myread
7141         case "$ans" in
7142         true|$define|[Yy]*)
7143                 useshrplib='true'  ;;
7144         *)      useshrplib='false' ;;
7145         esac
7146         ;;
7147 esac
7148
7149 case "$useshrplib" in
7150 true)
7151         case "$libperl" in
7152         '')
7153                 # Figure out a good name for libperl.so.  Since it gets stored in
7154                 # a version-specific architecture-dependent library, the version
7155                 # number isn't really that important, except for making cc/ld happy.
7156                 #
7157                 # A name such as libperl.so.3.1
7158                 majmin="libperl.$so.$patchlevel.$subversion"
7159                 # A name such as libperl.so.301
7160                 majonly=`echo $patchlevel $subversion |
7161                         $awk '{printf "%d%02d", $1, $2}'`
7162                 majonly=libperl.$so.$majonly
7163                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7164                 # rely on figuring it out from the naming of libc.
7165                 case "${osname}${osvers}" in
7166                 next4*)
7167                         dflt=libperl.5.$so
7168                         # XXX How handle the --version stuff for MAB?
7169                         ;;
7170                 linux*)  # ld won't link with a bare -lperl otherwise.
7171                         dflt=libperl.$so
7172                         ;;
7173                 cygwin*) # include version
7174                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7175                         ;;
7176                 *)      # Try to guess based on whether libc has major.minor.
7177                         case "$libc" in
7178                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7179                         *libc.$so.[0-9]*) dflt=$majonly ;;
7180                         *)      dflt=libperl.$so ;;
7181                         esac
7182                         ;;
7183                 esac
7184                 ;;
7185         *)      dflt=$libperl
7186                 ;;
7187         esac
7188         cat << EOM
7189
7190 I need to select a good name for the shared libperl.  If your system uses
7191 library names with major and minor numbers, then you might want something
7192 like $majmin.  Alternatively, if your system uses a single version
7193 number for shared libraries, then you might want to use $majonly.
7194 Or, your system might be quite happy with a simple libperl.$so.
7195
7196 Since the shared libperl will get installed into a version-specific
7197 architecture-dependent directory, the version number of the shared perl
7198 library probably isn't important, so the default should be o.k.
7199
7200 EOM
7201         rp='What name do you want to give to the shared libperl?'
7202         . ./myread
7203         libperl=$ans
7204         echo "Ok, I'll use $libperl"
7205         ;;
7206 *)
7207         libperl="libperl${_a}"
7208         ;;
7209 esac
7210
7211 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7212 case "$shrpdir" in
7213 '') ;;
7214 *)      $cat >&4 <<EOM
7215 WARNING:  Use of the shrpdir variable for the installation location of
7216 the shared $libperl is not supported.  It was never documented and
7217 will not work in this version.  Let me (perlbug@perl.org)
7218 know of any problems this may cause.
7219
7220 EOM
7221         case "$shrpdir" in
7222         "$archlibexp/CORE")
7223                 $cat >&4 <<EOM
7224 But your current setting of $shrpdir is
7225 the default anyway, so it's harmless.
7226 EOM
7227                 ;;
7228         *)
7229                 $cat >&4 <<EOM
7230 Further, your current attempted setting of $shrpdir
7231 conflicts with the value of $archlibexp/CORE
7232 that installperl will use.
7233 EOM
7234                 ;;
7235         esac
7236         ;;
7237 esac
7238
7239 # How will the perl executable find the installed shared $libperl?
7240 # Add $xxx to ccdlflags.
7241 # If we can't figure out a command-line option, use $shrpenv to
7242 # set env LD_RUN_PATH.  The main perl makefile uses this.
7243 shrpdir=$archlibexp/CORE
7244 xxx=''
7245 tmp_shrpenv=''
7246 if "$useshrplib"; then
7247     case "$osname" in 
7248         aix)
7249                 # We'll set it in Makefile.SH...
7250                 ;;
7251         solaris|netbsd)
7252                 xxx="-R $shrpdir"
7253                 ;;
7254         freebsd)
7255                 xxx="-Wl,-R$shrpdir"
7256                 ;;
7257         linux|irix*|dec_osf)
7258                 xxx="-Wl,-rpath,$shrpdir"
7259                 ;;
7260         next)
7261                 # next doesn't like the default...
7262                 ;;
7263         beos)
7264                 # beos doesn't like the default, either.
7265                 ;;
7266         hpux*)
7267                 # hpux doesn't like the default, either.
7268                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7269                 ;;
7270         *)
7271                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7272                 ;;
7273         esac
7274         case "$xxx" in
7275         '') ;;
7276         *)      
7277                 # Only add $xxx if it isn't already in ccdlflags.
7278                 case " $ccdlflags " in
7279                 *" $xxx "*)     ;;
7280                 *)      ccdlflags="$ccdlflags $xxx"
7281                         cat <<EOM >&4
7282
7283 Adding $xxx to the flags
7284 passed to $ld so that the perl executable will find the 
7285 installed shared $libperl.
7286
7287 EOM
7288                         ;;
7289                 esac
7290                 ;;
7291         esac
7292 fi
7293 # Fix ccdlflags in AIX for building external extensions.
7294 # (For building Perl itself bare -bE:perl.exp is needed,
7295 #  Makefile.SH takes care of this.)
7296 case "$osname" in
7297 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7298 esac
7299 # Respect a hint or command-line value.
7300 case "$shrpenv" in
7301 '') shrpenv="$tmp_shrpenv" ;;
7302 esac
7303 case "$ldlibpthname" in
7304 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7305 none)   ldlibpthname='' ;;
7306 esac
7307
7308 : determine where manual pages are on this system
7309 echo " "
7310 case "$sysman" in
7311 '') 
7312         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7313         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7314         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7315         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7316         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7317         sysman=`./loc . /usr/man/man1 $syspath`
7318         ;;
7319 esac
7320 if $test -d "$sysman"; then
7321         echo "System manual is in $sysman." >&4
7322 else
7323         echo "Could not find manual pages in source form." >&4
7324 fi
7325
7326 : determine where manual pages go
7327 set man1dir man1dir none
7328 eval $prefixit
7329 $cat <<EOM
7330
7331 $spackage has manual pages available in source form.
7332 EOM
7333 case "$nroff" in
7334 nroff)
7335         echo "However, you don't have nroff, so they're probably useless to you."
7336         case "$man1dir" in
7337         '') man1dir="none";;
7338         esac;;
7339 esac
7340 echo "If you don't want the manual sources installed, answer 'none'."
7341 case "$man1dir" in
7342 ' ') dflt=none
7343         ;;
7344 '')
7345         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7346         lookpath="$lookpath $prefixexp/man/p_man/man1"
7347         lookpath="$lookpath $prefixexp/man/u_man/man1"
7348         lookpath="$lookpath $prefixexp/man/man.1"
7349         case "$sysman" in
7350         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7351         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7352         esac
7353         set dflt
7354         eval $prefixup
7355         ;;
7356 *)  dflt="$man1dir"
7357         ;;
7358 esac
7359 echo " "
7360 fn=dn+~
7361 rp="Where do the main $spackage manual pages (source) go?"
7362 . ./getfile
7363 if $test "X$man1direxp" != "X$ansexp"; then
7364         installman1dir=''
7365 fi
7366 man1dir="$ans"
7367 man1direxp="$ansexp"
7368 case "$man1dir" in
7369 '')     man1dir=' '
7370         installman1dir='';;
7371 esac
7372
7373 : Change installation prefix, if necessary.
7374 if $test X"$prefix" != X"$installprefix"; then
7375         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7376 else
7377         installman1dir="$man1direxp"
7378 fi
7379
7380 : What suffix to use on installed man pages
7381
7382 case "$man1dir" in
7383 ' ')
7384         man1ext='0'
7385         ;;
7386 *)
7387         rp="What suffix should be used for the main $spackage man pages?"
7388         case "$man1ext" in
7389         '')     case "$man1dir" in
7390                 *1)  dflt=1 ;;
7391                 *1p) dflt=1p ;;
7392                 *1pm) dflt=1pm ;;
7393                 *l) dflt=l;;
7394                 *n) dflt=n;;
7395                 *o) dflt=o;;
7396                 *p) dflt=p;;
7397                 *C) dflt=C;;
7398                 *L) dflt=L;;
7399                 *L1) dflt=L1;;
7400                 *) dflt=1;;
7401                 esac
7402                 ;;
7403         *)      dflt="$man1ext";;
7404         esac
7405         . ./myread
7406         man1ext="$ans"
7407         ;;
7408 esac
7409
7410 : see if we can have long filenames
7411 echo " "
7412 first=123456789abcdef
7413 $rm -f $first
7414 if (echo hi >$first) 2>/dev/null; then
7415         if $test -f 123456789abcde; then
7416                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7417                 val="$undef"
7418         else
7419                 echo 'You can have filenames longer than 14 characters.'>&4
7420                 val="$define"
7421         fi
7422 else
7423         $cat <<'EOM'
7424 You can't have filenames longer than 14 chars.
7425 You can't even think about them!
7426 EOM
7427         val="$undef"
7428 fi 
7429 set d_flexfnam
7430 eval $setvar
7431 $rm -rf 123456789abcde*
7432
7433 : determine where library module manual pages go
7434 set man3dir man3dir none
7435 eval $prefixit
7436 $cat <<EOM
7437
7438 $spackage has manual pages for many of the library modules.
7439 EOM
7440
7441 case "$nroff" in
7442 nroff)
7443         $cat <<'EOM'
7444 However, you don't have nroff, so they're probably useless to you.
7445 EOM
7446         case "$man3dir" in
7447         '') man3dir="none";;
7448         esac;;
7449 esac
7450
7451 case "$d_flexfnam" in
7452 undef)
7453         $cat <<'EOM'
7454 However, your system can't handle the long file names like File::Basename.3. 
7455 EOM
7456         case "$man3dir" in
7457         '') man3dir="none";;
7458         esac;;
7459 esac
7460
7461 echo "If you don't want the manual sources installed, answer 'none'."
7462 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7463 case "$man3dir" in
7464 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7465         if $test -d "$privlib/man/man3"; then
7466                 cat <<EOM >&4
7467
7468 WARNING:  Previous versions of perl installed man3 pages into
7469 $privlib/man/man3.  This version will suggest a 
7470 new default of $dflt.  
7471 EOM
7472                 tdflt=$dflt
7473                 dflt='n'
7474                 rp='Do you wish to preserve the old behavior?(y/n)'
7475                 . ./myread
7476                 case "$ans" in
7477                 y*) dflt="$privlib/man/man3" ;;
7478                 *)  dflt=$tdflt ;;
7479                 esac
7480     fi
7481         ;;
7482 *)      dflt="$man3dir" ;;
7483 esac
7484 case "$dflt" in
7485 ' ') dflt=none ;;
7486 esac
7487 echo " "
7488 fn=dn+~
7489 rp="Where do the $package library man pages (source) go?"
7490 . ./getfile
7491 man3dir="$ans"
7492 man3direxp="$ansexp"
7493 case "$man3dir" in
7494 '')     man3dir=' '
7495         installman3dir='';;
7496 esac
7497
7498 : Change installation prefix, if necessary.
7499 if $test X"$prefix" != X"$installprefix"; then
7500         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7501 else
7502         installman3dir="$man3direxp"
7503 fi
7504
7505 : What suffix to use on installed man pages
7506 case "$man3dir" in
7507 ' ')
7508         man3ext='0'
7509         ;;
7510 *)
7511         rp="What suffix should be used for the $package library man pages?"
7512         case "$man3ext" in
7513         '')     case "$man3dir" in
7514                 *3)  dflt=3 ;;
7515                 *3p) dflt=3p ;;
7516                 *3pm) dflt=3pm ;;
7517                 *l) dflt=l;;
7518                 *n) dflt=n;;
7519                 *o) dflt=o;;
7520                 *p) dflt=p;;
7521                 *C) dflt=C;;
7522                 *L) dflt=L;;
7523                 *L3) dflt=L3;;
7524                 *) dflt=3;;
7525                 esac
7526                 ;;
7527         *)      dflt="$man3ext";;
7528         esac
7529         . ./myread
7530         man3ext="$ans"
7531         ;;
7532 esac
7533
7534 : see if we have to deal with yellow pages, now NIS.
7535 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7536         if $test -f /usr/etc/nibindd; then
7537                 echo " "
7538                 echo "I'm fairly confident you're on a NeXT."
7539                 echo " "
7540                 rp='Do you get the hosts file via NetInfo?'
7541                 dflt=y
7542                 case "$hostcat" in
7543                 nidump*) ;;
7544                 '') ;;
7545                 *) dflt=n;;
7546                 esac
7547                 . ./myread
7548                 case "$ans" in
7549                 y*) hostcat='nidump hosts .';;
7550                 *)      case "$hostcat" in
7551                         nidump*) hostcat='';;
7552                         esac
7553                         ;;
7554                 esac
7555         fi
7556         case "$hostcat" in
7557         nidump*) ;;
7558         *)
7559                 case "$hostcat" in
7560                 *ypcat*) dflt=y;;
7561                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7562                                 dflt=y
7563                         else
7564                                 dflt=n
7565                         fi;;
7566                 *) dflt=n;;
7567                 esac
7568                 echo " "
7569                 rp='Are you getting the hosts file via yellow pages?'
7570                 . ./myread
7571                 case "$ans" in
7572                 y*) hostcat='ypcat hosts';;
7573                 *) hostcat='cat /etc/hosts';;
7574                 esac
7575                 ;;
7576         esac
7577 fi
7578 case "$hostcat" in
7579 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7580 esac
7581 case "$groupcat" in
7582 '') test -f /etc/group && groupcat='cat /etc/group';;
7583 esac
7584 case "$passcat" in
7585 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7586 esac
7587
7588 : now get the host name
7589 echo " "
7590 echo "Figuring out host name..." >&4
7591 case "$myhostname" in
7592 '') cont=true
7593         echo 'Maybe "hostname" will work...'
7594         if tans=`sh -c hostname 2>&1` ; then
7595                 myhostname=$tans
7596                 phostname=hostname
7597                 cont=''
7598         fi
7599         ;;
7600 *) cont='';;
7601 esac
7602 if $test "$cont"; then
7603         if ./xenix; then
7604                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7605                 if tans=`cat /etc/systemid 2>&1` ; then
7606                         myhostname=$tans
7607                         phostname='cat /etc/systemid'
7608                         echo "Whadyaknow.  Xenix always was a bit strange..."
7609                         cont=''
7610                 fi
7611         elif $test -r /etc/systemid; then
7612                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7613         fi
7614 fi
7615 if $test "$cont"; then
7616         echo 'No, maybe "uuname -l" will work...'
7617         if tans=`sh -c 'uuname -l' 2>&1` ; then
7618                 myhostname=$tans
7619                 phostname='uuname -l'
7620         else
7621                 echo 'Strange.  Maybe "uname -n" will work...'
7622                 if tans=`sh -c 'uname -n' 2>&1` ; then
7623                         myhostname=$tans
7624                         phostname='uname -n'
7625                 else
7626                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7627                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7628                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7629                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7630                         else
7631                                 case "$myhostname" in
7632                                 '') echo "Does this machine have an identity crisis or something?"
7633                                         phostname='';;
7634                                 *)
7635                                         echo "Well, you said $myhostname before..."
7636                                         phostname='echo $myhostname';;
7637                                 esac
7638                         fi
7639                 fi
7640         fi
7641 fi
7642 : you do not want to know about this
7643 set $myhostname
7644 myhostname=$1
7645
7646 : verify guess
7647 if $test "$myhostname" ; then
7648         dflt=y
7649         rp='Your host name appears to be "'$myhostname'".'" Right?"
7650         . ./myread
7651         case "$ans" in
7652         y*) ;;
7653         *) myhostname='';;
7654         esac
7655 fi
7656
7657 : bad guess or no guess
7658 while $test "X$myhostname" = X ; do
7659         dflt=''
7660         rp="Please type the (one word) name of your host:"
7661         . ./myread
7662         myhostname="$ans"
7663 done
7664
7665 : translate upper to lower if necessary
7666 case "$myhostname" in
7667 *[A-Z]*)
7668         echo "(Normalizing case in your host name)"
7669         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7670         ;;
7671 esac
7672
7673 case "$myhostname" in
7674 *.*)
7675         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7676         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7677         echo "(Trimming domain name from host name--host name is now $myhostname)"
7678         ;;
7679 *) case "$mydomain" in
7680         '')
7681                 {
7682                         test "X$hostcat" = "Xypcat hosts" &&
7683                         ypmatch "$myhostname" hosts 2>/dev/null |\
7684                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7685                         $test -s hosts
7686                 } || {
7687                         test "X$hostcat" != "X" &&
7688                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7689                                         /[       ]$myhostname[  . ]/p" > hosts
7690                 }
7691                 tmp_re="[       . ]"
7692                 if $test -f hosts; then
7693                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7694                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7695                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7696                                 hosts | $sort | $uniq | \
7697                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7698                         case `$echo X$dflt` in
7699                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7700                                 dflt=.
7701                                 ;;
7702                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7703                                 ;;
7704                         esac
7705                 else
7706                         echo "(I cannot locate a hosts database anywhere)"
7707                         dflt=.
7708                 fi
7709                 case "$dflt" in
7710                 .)
7711                         tans=`./loc resolv.conf X /etc /usr/etc`
7712                         if $test -f "$tans"; then
7713                                 echo "(Attempting domain name extraction from $tans)"
7714                                 dflt=.`$sed -n -e 's/   / /g' \
7715                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7716                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7717                                 case "$dflt" in
7718                                 .) dflt=.`$sed -n -e 's/        / /g' \
7719                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7720                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7721                                         ;;
7722                                 esac
7723                         fi
7724                         ;;
7725                 esac
7726                 case "$dflt" in
7727                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7728                         dflt=.`sh -c domainname 2>/dev/null`
7729                         case "$dflt" in
7730                         '') dflt='.';;
7731                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7732                         esac
7733                         ;;
7734                 esac
7735                 case "$dflt$osname" in
7736                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7737                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7738                         ;;
7739                 esac
7740                 case "$dflt" in
7741                 .) echo "(Lost all hope -- silly guess then)"
7742                         dflt='.uucp'
7743                         ;;
7744                 esac
7745                 $rm -f hosts
7746                 ;;
7747         *) dflt="$mydomain";;
7748         esac;;
7749 esac
7750 echo " "
7751 rp="What is your domain name?"
7752 . ./myread
7753 tans="$ans"
7754 case "$ans" in
7755 '') ;;
7756 .*) ;;
7757 *) tans=".$tans";;
7758 esac
7759 mydomain="$tans"
7760
7761 : translate upper to lower if necessary
7762 case "$mydomain" in
7763 *[A-Z]*)
7764         echo "(Normalizing case in your domain name)"
7765         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7766         ;;
7767 esac
7768
7769 : a little sanity check here
7770 case "$phostname" in
7771 '') ;;
7772 *)
7773         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7774         $myhostname$mydomain|$myhostname) ;;
7775         *)
7776                 case "$phostname" in
7777                 sed*)
7778                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7779                         ;;
7780                 *)
7781                         echo "(That doesn't agree with your $phostname command, by the way.)"
7782                         ;;
7783                 esac
7784         ;;
7785         esac
7786         ;;
7787 esac
7788
7789 $cat <<EOM
7790
7791 I need to get your e-mail address in Internet format if possible, i.e.
7792 something like user@host.domain. Please answer accurately since I have
7793 no easy means to double check it. The default value provided below
7794 is most probably close to reality but may not be valid from outside
7795 your organization...
7796
7797 EOM
7798 cont=x
7799 while test "$cont"; do
7800         case "$cf_email" in
7801         '') dflt="$cf_by@$myhostname$mydomain";;
7802         *) dflt="$cf_email";;
7803         esac
7804         rp='What is your e-mail address?'
7805         . ./myread
7806         cf_email="$ans"
7807         case "$cf_email" in
7808         *@*.*) cont='' ;;
7809         *)
7810                 rp='Address does not look like an Internet one.  Use it anyway?'
7811                 case "$fastread" in
7812                 yes) dflt=y ;;
7813                 *) dflt=n ;;
7814                 esac
7815                 . ./myread
7816                 case "$ans" in
7817                 y*) cont='' ;;
7818                 *) echo " " ;;
7819                 esac
7820                 ;;
7821         esac
7822 done
7823
7824 $cat <<EOM
7825
7826 If you or somebody else will be maintaining perl at your site, please
7827 fill in the correct e-mail address here so that they may be contacted
7828 if necessary. Currently, the "perlbug" program included with perl
7829 will send mail to this address in addition to perlbug@perl.org. You may
7830 enter "none" for no administrator.
7831
7832 EOM
7833 case "$perladmin" in
7834 '') dflt="$cf_email";;
7835 *) dflt="$perladmin";;
7836 esac
7837 rp='Perl administrator e-mail address'
7838 . ./myread
7839 perladmin="$ans"
7840
7841 : determine whether to only install version-specific parts.
7842 echo " "
7843 $cat <<EOM
7844 Do you want to install only the version-specific parts of the perl
7845 distribution?  Usually you do *not* want to do this.
7846 EOM
7847 case "$versiononly" in
7848 "$define"|[Yy]*|true) dflt='y' ;;
7849 *) dflt='n';
7850 esac
7851 rp="Do you want to install only the version-specific parts of perl?"
7852 . ./myread
7853 case "$ans" in
7854 [yY]*)  val="$define";;
7855 *)      val="$undef" ;;
7856 esac
7857 set versiononly
7858 eval $setvar
7859
7860 : figure out how to guarantee perl startup
7861 case "$startperl" in
7862 '')
7863         case "$sharpbang" in
7864         *!)
7865                 $cat <<EOH
7866
7867 I can use the #! construct to start perl on your system. This will
7868 make startup of perl scripts faster, but may cause problems if you
7869 want to share those scripts and perl is not in a standard place
7870 ($binexp/perl) on all your platforms. The alternative is to force
7871 a shell by starting the script with a single ':' character.
7872
7873 EOH
7874                 case "$versiononly" in
7875                 "$define")      dflt="$binexp/perl$version";;  
7876                 *)              dflt="$binexp/perl";;
7877                 esac
7878                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7879                 . ./myread
7880                 case "$ans" in
7881                 none)   startperl=": # use perl";;
7882                 *)      startperl="#!$ans"
7883                         if $test 30 -lt `echo "$ans" | wc -c`; then
7884                                 $cat >&4 <<EOM
7885
7886 WARNING:  Some systems limit the #! command to 32 characters.
7887 If you experience difficulty running Perl scripts with #!, try
7888 installing Perl in a directory with a shorter pathname.
7889
7890 EOM
7891                         fi ;;
7892                 esac
7893                 ;;
7894         *) startperl=": # use perl"
7895                 ;;
7896         esac
7897         ;;
7898 esac
7899 echo "I'll use $startperl to start perl scripts."
7900
7901 : figure best path for perl in scripts
7902 case "$perlpath" in
7903 '')
7904         perlpath="$binexp/perl"
7905         case "$startperl" in
7906         *!*) ;;
7907         *)
7908                 $cat <<EOH
7909
7910 I will use the "eval 'exec'" idiom to start Perl on your system.
7911 I can use the full path of your Perl binary for this purpose, but
7912 doing so may cause problems if you want to share those scripts and
7913 Perl is not always in a standard place ($binexp/perl).
7914
7915 EOH
7916                 dflt="$binexp/perl"
7917                 rp="What path shall I use in \"eval 'exec'\"?"
7918                 . ./myread
7919                 perlpath="$ans"
7920                 ;;
7921         esac
7922         ;;
7923 esac
7924 case "$startperl" in
7925 *!*)    ;;
7926 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7927 esac
7928
7929 : determine where public executable scripts go
7930 set scriptdir scriptdir
7931 eval $prefixit
7932 case "$scriptdir" in
7933 '')
7934         dflt="$bin"
7935         : guess some guesses
7936         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7937         $test -d /usr/share/bin     && dflt=/usr/share/bin
7938         $test -d /usr/local/script  && dflt=/usr/local/script
7939         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7940         $test -d $prefixexp/script  && dflt=$prefixexp/script
7941         set dflt
7942         eval $prefixup
7943         ;;
7944 *)  dflt="$scriptdir"
7945         ;;
7946 esac
7947 $cat <<EOM
7948  
7949 Some installations have a separate directory just for executable scripts so
7950 that they can mount it across multiple architectures but keep the scripts in
7951 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7952 Or you might just lump your scripts in with all your other executables.
7953  
7954 EOM
7955 fn=d~
7956 rp='Where do you keep publicly executable scripts?'
7957 . ./getfile
7958 if $test "X$ansexp" != "X$scriptdirexp"; then
7959         installscript=''
7960 fi
7961 scriptdir="$ans"
7962 scriptdirexp="$ansexp"
7963 : Change installation prefix, if necessary.
7964 if $test X"$prefix" != X"$installprefix"; then
7965         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7966 else
7967         installscript="$scriptdirexp"
7968 fi
7969
7970 : determine where add-on public executables go
7971 case "$sitebin" in
7972 '')     dflt=$siteprefix/bin ;;
7973 *)      dflt=$sitebin ;;
7974 esac
7975 fn=d~
7976 rp='Pathname where the add-on public executables should be installed?'
7977 . ./getfile
7978 sitebin="$ans"
7979 sitebinexp="$ansexp"
7980 : Change installation prefix, if necessary.
7981 if $test X"$prefix" != X"$installprefix"; then
7982         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7983 else
7984         installsitebin="$sitebinexp"
7985 fi
7986
7987 case "$vendorprefix" in
7988 '')     d_vendorbin="$undef"
7989         vendorbin=''
7990         vendorbinexp=''
7991         ;;
7992 *)      d_vendorbin="$define"
7993         : determine where vendor-supplied executables go.
7994         case "$vendorbin" in
7995         '') dflt=$vendorprefix/bin ;;
7996         *)      dflt="$vendorbin" ;;
7997         esac
7998         fn=d~+
7999         rp='Pathname for the vendor-supplied executables directory?'
8000         . ./getfile
8001         vendorbin="$ans"
8002         vendorbinexp="$ansexp"
8003         ;;
8004 esac
8005 : Change installation prefix, if necessary.
8006 if $test X"$prefix" != X"$installprefix"; then
8007         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8008 else
8009         installvendorbin="$vendorbinexp"
8010 fi
8011
8012 : see if qgcvt exists
8013 set qgcvt d_qgcvt
8014 eval $inlibc
8015
8016 echo " "
8017
8018 if $test X"$d_longdbl" = X"$define"; then
8019
8020 echo "Checking how to print long doubles..." >&4
8021
8022 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8023         $cat >try.c <<'EOCP'
8024 #include <sys/types.h>
8025 #include <stdio.h>
8026 int main() {
8027   double d = 123.456;
8028   printf("%.3f\n", d);
8029 }
8030 EOCP
8031         set try
8032         if eval $compile; then
8033                 yyy=`./try$exe_ext`
8034                 case "$yyy" in
8035                 123.456)
8036                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8037                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8038                         echo "We will use %f."
8039                         ;;
8040                 esac
8041         fi
8042 fi
8043
8044 if $test X"$sPRIfldbl" = X; then
8045         $cat >try.c <<'EOCP'
8046 #include <sys/types.h>
8047 #include <stdio.h>
8048 int main() {
8049   long double d = 123.456;
8050   printf("%.3Lf\n", d);
8051 }
8052 EOCP
8053         set try
8054         if eval $compile; then
8055                 yyy=`./try$exe_ext`
8056                 case "$yyy" in
8057                 123.456)
8058                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8059                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8060                         echo "We will use %Lf."
8061                         ;;
8062                 esac
8063         fi
8064 fi
8065
8066 if $test X"$sPRIfldbl" = X; then
8067         $cat >try.c <<'EOCP'
8068 #include <sys/types.h>
8069 #include <stdio.h>
8070 int main() {
8071   long double d = 123.456;
8072   printf("%.3llf\n", d);
8073 }
8074 EOCP
8075         set try
8076         if eval $compile; then
8077                 yyy=`./try$exe_ext`
8078                 case "$yyy" in
8079                 123.456)
8080                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8081                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8082                         echo "We will use %llf."
8083                         ;;
8084                 esac
8085         fi
8086 fi
8087
8088 if $test X"$sPRIfldbl" = X; then
8089         $cat >try.c <<'EOCP'
8090 #include <sys/types.h>
8091 #include <stdio.h>
8092 int main() {
8093   long double d = 123.456;
8094   printf("%.3lf\n", d);
8095 }
8096 EOCP
8097         set try
8098         if eval $compile; then
8099                 yyy=`./try$exe_ext`
8100                 case "$yyy" in
8101                 123.456)
8102                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8103                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8104                         echo "We will use %lf."
8105                         ;;
8106                 esac
8107         fi
8108 fi
8109
8110 if $test X"$sPRIfldbl" = X; then
8111         echo "Cannot figure out how to print long doubles." >&4
8112 else
8113         sSCNfldbl=$sPRIfldbl    # expect consistency
8114 fi
8115
8116 $rm -f try try.*
8117
8118 fi # d_longdbl
8119
8120 case "$sPRIfldbl" in
8121 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8122         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8123         d_SCNfldbl="$undef";
8124         ;;
8125 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8126         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8127         d_SCNfldbl="$define";
8128         ;;
8129 esac
8130
8131 : Check how to convert floats to strings.
8132 echo " "
8133 echo "Checking for an efficient way to convert floats to strings."
8134 echo " " > try.c
8135 case "$uselongdouble" in
8136 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8137 esac
8138 case "$d_longdbl" in
8139 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8140 esac
8141 case "$d_PRIgldbl" in
8142 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8143 esac
8144 $cat >>try.c <<EOP
8145 #ifdef TRY_gconvert
8146 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8147 char *myname = "gconvert";
8148 #endif
8149 #ifdef TRY_gcvt
8150 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8151 char *myname = "gcvt";
8152 #endif
8153 #ifdef TRY_qgcvt
8154 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8155 char *myname = "qgcvt";
8156 #define DOUBLETYPE long double
8157 #endif
8158 #ifdef TRY_sprintf
8159 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8160 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8161 #else
8162 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8163 #endif
8164 char *myname = "sprintf";
8165 #endif
8166
8167 #ifndef DOUBLETYPE
8168 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8169 #define DOUBLETYPE long double
8170 #else
8171 #define DOUBLETYPE double
8172 #endif
8173 #endif
8174
8175 #include <stdio.h>
8176
8177 #define I_STDLIB $i_stdlib
8178 #ifdef I_STDLIB
8179 #include <stdlib.h>
8180 #endif
8181
8182 int
8183 checkit(expect, got)
8184 char *expect;
8185 char *got;
8186 {
8187     if (strcmp(expect, got)) {
8188                 printf("%s oddity:  Expected %s, got %s\n",
8189                         myname, expect, got);
8190                 exit(1);
8191         }
8192 }
8193
8194 int main()
8195
8196         char buf[64]; 
8197         buf[63] = '\0';
8198
8199         /* This must be 1st test on (which?) platform */
8200         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8201         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8202         checkit("0.1", buf);
8203
8204         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8205         checkit("1", buf);
8206
8207         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8208         checkit("1.1", buf);
8209
8210         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8211         checkit("1.01", buf);
8212
8213         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8214         checkit("1.001", buf);
8215
8216         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8217         checkit("1.0001", buf);
8218
8219         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8220         checkit("1.00001", buf);
8221
8222         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8223         checkit("1.000001", buf);
8224
8225         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8226         checkit("0", buf);
8227
8228         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8229         checkit("-1", buf);
8230
8231         /* Some Linux gcvt's give 1.e+5 here. */
8232         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8233         checkit("100000", buf);
8234         
8235         /* Some Linux gcvt's give -1.e+5 here. */
8236         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8237         checkit("-100000", buf);
8238
8239         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8240         checkit("123.456", buf);
8241
8242         exit(0);
8243 }
8244 EOP
8245 case "$d_Gconvert" in
8246 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8247 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8248 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8249 *) xxx_list='gconvert gcvt sprintf' ;;
8250 esac
8251
8252 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8253 "$define$define$define")
8254     # for long doubles prefer first qgcvt, then sprintf
8255     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8256     xxx_list="sprintf $xxx_list"
8257     case "$d_qgcvt" in
8258     "$define") xxx_list="qgcvt $xxx_list" ;;
8259     esac
8260     ;;
8261 esac
8262
8263 for xxx_convert in $xxx_list; do
8264         echo "Trying $xxx_convert..."
8265         $rm -f try try$_o
8266         set try -DTRY_$xxx_convert
8267         if eval $compile; then
8268                 echo "$xxx_convert() found." >&4
8269                 if ./try; then
8270                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8271                         break;
8272                 else
8273                         echo "...But $xxx_convert didn't work as I expected."
8274                 fi
8275         else
8276                 echo "$xxx_convert NOT found." >&4
8277         fi
8278 done
8279         
8280 case "$xxx_convert" in
8281 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8282 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8283 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8284 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8285    "$define$define$define")
8286       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8287    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8288    esac
8289    ;;  
8290 esac
8291
8292 : see if _fwalk exists
8293 set fwalk d__fwalk
8294 eval $inlibc
8295
8296 : Initialize h_fcntl
8297 h_fcntl=false
8298
8299 : Initialize h_sysfile
8300 h_sysfile=false
8301
8302 : access call always available on UNIX
8303 set access d_access
8304 eval $inlibc
8305
8306 : locate the flags for 'access()'
8307 case "$d_access" in
8308 "$define")
8309         echo " "
8310         $cat >access.c <<'EOCP'
8311 #include <sys/types.h>
8312 #ifdef I_FCNTL
8313 #include <fcntl.h>
8314 #endif
8315 #ifdef I_SYS_FILE
8316 #include <sys/file.h>
8317 #endif
8318 #ifdef I_UNISTD
8319 #include <unistd.h>
8320 #endif
8321 int main() {
8322         exit(R_OK);
8323 }
8324 EOCP
8325         : check sys/file.h first, no particular reason here
8326         if $test `./findhdr sys/file.h` && \
8327                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8328                 h_sysfile=true;
8329                 echo "<sys/file.h> defines the *_OK access constants." >&4
8330         elif $test `./findhdr fcntl.h` && \
8331                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8332                 h_fcntl=true;
8333                 echo "<fcntl.h> defines the *_OK access constants." >&4
8334         elif $test `./findhdr unistd.h` && \
8335                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8336                 echo "<unistd.h> defines the *_OK access constants." >&4
8337         else
8338                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8339         fi
8340         ;;
8341 esac
8342 $rm -f access*
8343
8344 : see if accessx exists
8345 set accessx d_accessx
8346 eval $inlibc
8347
8348 : see if alarm exists
8349 set alarm d_alarm
8350 eval $inlibc
8351
8352 : see if atolf exists
8353 set atolf d_atolf
8354 eval $inlibc
8355
8356 : see if atoll exists
8357 set atoll d_atoll
8358 eval $inlibc
8359
8360 : Look for GNU-cc style attribute checking
8361 echo " "
8362 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8363 $cat >attrib.c <<'EOCP'
8364 #include <stdio.h>
8365 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8366 EOCP
8367 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8368         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8369                 echo "Your C compiler doesn't fully support __attribute__."
8370                 val="$undef"
8371         else
8372                 echo "Your C compiler supports __attribute__."
8373                 val="$define"
8374         fi
8375 else
8376         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8377         val="$undef"
8378 fi
8379 set d_attribut
8380 eval $setvar
8381 $rm -f attrib*
8382
8383 : see if bcmp exists
8384 set bcmp d_bcmp
8385 eval $inlibc
8386
8387 : see if bcopy exists
8388 set bcopy d_bcopy
8389 eval $inlibc
8390
8391 : see if this is a unistd.h system
8392 set unistd.h i_unistd
8393 eval $inhdr
8394
8395 : see if getpgrp exists
8396 set getpgrp d_getpgrp
8397 eval $inlibc
8398
8399 case "$d_getpgrp" in
8400 "$define")
8401         echo " "
8402         echo "Checking to see which flavor of getpgrp is in use..."
8403         $cat >set.c <<EOP
8404 #$i_unistd I_UNISTD
8405 #include <sys/types.h>
8406 #ifdef I_UNISTD
8407 #  include <unistd.h>
8408 #endif
8409 int main()
8410 {
8411         if (getuid() == 0) {
8412                 printf("(I see you are running Configure as super-user...)\n");
8413                 setuid(1);
8414         }
8415 #ifdef TRY_BSD_PGRP
8416         if (getpgrp(1) == 0)
8417                 exit(0);
8418 #else
8419         if (getpgrp() > 0)
8420                 exit(0);
8421 #endif
8422         exit(1);
8423 }
8424 EOP
8425         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8426                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8427                 val="$define"
8428         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8429                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8430                 val="$undef"
8431         else
8432                 echo "I can't seem to compile and run the test program."
8433                 if ./usg; then
8434                         xxx="a USG one, i.e. you use getpgrp()."
8435                 else
8436                         # SVR4 systems can appear rather BSD-ish.
8437                         case "$i_unistd" in
8438                         $undef)
8439                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8440                                 val="$define"
8441                                 ;;
8442                         $define)
8443                                 xxx="probably a USG one, i.e. you use getpgrp()."
8444                                 val="$undef"
8445                                 ;;
8446                         esac
8447                 fi
8448                 echo "Assuming your getpgrp is $xxx" >&4
8449         fi
8450         ;;
8451 *) val="$undef";;
8452 esac
8453 set d_bsdgetpgrp
8454 eval $setvar
8455 $rm -f set set.c
8456
8457 : see if setpgrp exists
8458 set setpgrp d_setpgrp
8459 eval $inlibc
8460
8461 case "$d_setpgrp" in
8462 "$define")
8463         echo " "
8464         echo "Checking to see which flavor of setpgrp is in use..."
8465         $cat >set.c <<EOP
8466 #$i_unistd I_UNISTD
8467 #include <sys/types.h>
8468 #ifdef I_UNISTD
8469 #  include <unistd.h>
8470 #endif
8471 int main()
8472 {
8473         if (getuid() == 0) {
8474                 printf("(I see you are running Configure as super-user...)\n");
8475                 setuid(1);
8476         }
8477 #ifdef TRY_BSD_PGRP
8478         if (-1 == setpgrp(1, 1))
8479                 exit(0);
8480 #else
8481         if (setpgrp() != -1)
8482                 exit(0);
8483 #endif
8484         exit(1);
8485 }
8486 EOP
8487         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8488                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8489                 val="$define"
8490         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8491                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8492                 val="$undef"
8493         else
8494                 echo "(I can't seem to compile and run the test program.)"
8495                 if ./usg; then
8496                         xxx="a USG one, i.e. you use setpgrp()."
8497                 else
8498                         # SVR4 systems can appear rather BSD-ish.
8499                         case "$i_unistd" in
8500                         $undef)
8501                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8502                                 val="$define"
8503                                 ;;
8504                         $define)
8505                                 xxx="probably a USG one, i.e. you use setpgrp()."
8506                                 val="$undef"
8507                                 ;;
8508                         esac
8509                 fi
8510                 echo "Assuming your setpgrp is $xxx" >&4
8511         fi
8512         ;;
8513 *) val="$undef";;
8514 esac
8515 set d_bsdsetpgrp
8516 eval $setvar
8517 $rm -f set set.c
8518 : see if bzero exists
8519 set bzero d_bzero
8520 eval $inlibc
8521
8522 : see if signal is declared as pointer to function returning int or void
8523 echo " "
8524 xxx=`./findhdr signal.h`
8525 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8526 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8527         echo "You have int (*signal())() instead of void." >&4
8528         val="$undef"
8529 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8530         echo "You have void (*signal())()." >&4
8531         val="$define"
8532 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8533         echo "You have int (*signal())() instead of void." >&4
8534         val="$undef"
8535 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8536         echo "You have void (*signal())()." >&4
8537         val="$define"
8538 else
8539         case "$d_voidsig" in
8540         '')
8541         echo "I can't determine whether signal handler returns void or int..." >&4
8542                 dflt=void
8543                 rp="What type does your signal handler return?"
8544                 . ./myread
8545                 case "$ans" in
8546                 v*) val="$define";;
8547                 *) val="$undef";;
8548                 esac;;
8549         "$define")
8550                 echo "As you already told me, signal handler returns void." >&4
8551                 val="$define"
8552                 ;;
8553         *)      echo "As you already told me, signal handler returns int." >&4
8554                 val="$undef"
8555                 ;;
8556         esac
8557 fi
8558 set d_voidsig
8559 eval $setvar
8560 case "$d_voidsig" in
8561 "$define") signal_t="void";;
8562 *) signal_t="int";;
8563 esac
8564 $rm -f $$.tmp
8565
8566 : check for ability to cast large floats to 32-bit ints.
8567 echo " "
8568 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8569 if $test "$intsize" -ge 4; then
8570         xxx=int
8571 else
8572         xxx=long
8573 fi
8574 $cat >try.c <<EOCP
8575 #include <stdio.h>
8576 #include <sys/types.h>
8577 #include <signal.h>
8578 $signal_t blech(s) int s; { exit(3); }
8579 int main()
8580 {
8581         $xxx i32;
8582         double f, g;
8583         int result = 0;
8584         char str[16];
8585         signal(SIGFPE, blech);
8586
8587         /* Don't let compiler optimize the test away.  Store the number 
8588            in a writable string for gcc to pass to sscanf under HP/UX.
8589         */
8590         sprintf(str, "2147483647");
8591         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8592         g = 10 * f;
8593         i32  = ($xxx) g;
8594
8595         /* x86 processors will probably give 0x8000 0000, which is a
8596        sign change.  We don't want that.  We want to mimic SPARC
8597            behavior here, which is to preserve the sign and give
8598            back 0x7fff ffff.
8599         */
8600         if (i32 != ($xxx) f)
8601                 result |= 1;
8602         exit(result);
8603 }
8604 EOCP
8605 set try
8606 if eval $compile_ok; then
8607         ./try
8608         yyy=$?
8609 else
8610         echo "(I can't seem to compile the test program--assuming it can't)"
8611         yyy=1
8612 fi
8613 case "$yyy" in
8614 0)      val="$define"
8615         echo "Yup, it can."
8616         ;;
8617 *)      val="$undef"
8618         echo "Nope, it can't."
8619         ;;
8620 esac
8621 set d_casti32
8622 eval $setvar
8623 $rm -f try try.*
8624
8625 : check for ability to cast negative floats to unsigned
8626 echo " "
8627 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8628 $cat >try.c <<EOCP
8629 #include <stdio.h>
8630 #include <sys/types.h>
8631 #include <signal.h>
8632 $signal_t blech(s) int s; { exit(7); }
8633 $signal_t blech_in_list(s) int s; { exit(4); }
8634 unsigned long dummy_long(p) unsigned long p; { return p; }
8635 unsigned int dummy_int(p) unsigned int p; { return p; }
8636 unsigned short dummy_short(p) unsigned short p; { return p; }
8637 int main()
8638 {
8639         double f;
8640         unsigned long along;
8641         unsigned int aint;
8642         unsigned short ashort;
8643         int result = 0;
8644         char str[16];
8645         
8646         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8647            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8648            optimized the whole file away
8649         */
8650         /* Store the number in a writable string for gcc to pass to 
8651            sscanf under HP/UX.
8652         */
8653         sprintf(str, "-123");
8654         sscanf(str, "%lf", &f);  /* f = -123.; */
8655
8656         signal(SIGFPE, blech);
8657         along = (unsigned long)f;
8658         aint = (unsigned int)f;
8659         ashort = (unsigned short)f;
8660         if (along != (unsigned long)-123)
8661                 result |= 1;
8662         if (aint != (unsigned int)-123)
8663                 result |= 1;
8664         if (ashort != (unsigned short)-123)
8665                 result |= 1;
8666         sprintf(str, "1073741824.");
8667         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8668         f = f + f;
8669         along = 0;
8670         along = (unsigned long)f;
8671         if (along != 0x80000000)
8672                 result |= 2;
8673         f -= 1.;
8674         along = 0;
8675         along = (unsigned long)f;
8676         if (along != 0x7fffffff)
8677                 result |= 1;
8678         f += 2.;
8679         along = 0;
8680         along = (unsigned long)f;
8681         if (along != 0x80000001)
8682                 result |= 2;
8683         if (result)
8684                 exit(result);
8685         signal(SIGFPE, blech_in_list);
8686         sprintf(str, "123.");
8687         sscanf(str, "%lf", &f);  /* f = 123.; */
8688         along = dummy_long((unsigned long)f);
8689         aint = dummy_int((unsigned int)f);
8690         ashort = dummy_short((unsigned short)f);
8691         if (along != (unsigned long)123)
8692                 result |= 4;
8693         if (aint != (unsigned int)123)
8694                 result |= 4;
8695         if (ashort != (unsigned short)123)
8696                 result |= 4;
8697         exit(result);
8698
8699 }
8700 EOCP
8701 set try
8702 if eval $compile_ok; then
8703         ./try
8704         castflags=$?
8705 else
8706         echo "(I can't seem to compile the test program--assuming it can't)"
8707         castflags=7
8708 fi
8709 case "$castflags" in
8710 0)      val="$define"
8711         echo "Yup, it can."
8712         ;;
8713 *)      val="$undef"
8714         echo "Nope, it can't."
8715         ;;
8716 esac
8717 set d_castneg
8718 eval $setvar
8719 $rm -f try.*
8720
8721 : see if vprintf exists
8722 echo " "
8723 if set vprintf val -f d_vprintf; eval $csym; $val; then
8724         echo 'vprintf() found.' >&4
8725         val="$define"
8726         $cat >vprintf.c <<'EOF'
8727 #include <varargs.h>
8728
8729 int main() { xxx("foo"); }
8730
8731 xxx(va_alist)
8732 va_dcl
8733 {
8734         va_list args;
8735         char buf[10];
8736
8737         va_start(args);
8738         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8739 }
8740 EOF
8741         set vprintf
8742         if eval $compile && ./vprintf; then
8743                 echo "Your vsprintf() returns (int)." >&4
8744                 val2="$undef"
8745         else
8746                 echo "Your vsprintf() returns (char*)." >&4
8747                 val2="$define"
8748         fi
8749 else
8750         echo 'vprintf() NOT found.' >&4
8751                 val="$undef"
8752                 val2="$undef"
8753 fi
8754 set d_vprintf
8755 eval $setvar
8756 val=$val2
8757 set d_charvspr
8758 eval $setvar
8759
8760 : see if chown exists
8761 set chown d_chown
8762 eval $inlibc
8763
8764 : see if chroot exists
8765 set chroot d_chroot
8766 eval $inlibc
8767
8768 : see if chsize exists
8769 set chsize d_chsize
8770 eval $inlibc
8771
8772 hasstruct='varname=$1; struct=$2; shift; shift;
8773 while $test $# -ge 2; do
8774         case "$1" in
8775         $define) echo "#include <$2>";;
8776         esac ;
8777     shift 2;
8778 done > try.c;
8779 echo "int main () { struct $struct foo; }" >> try.c;
8780 set try;
8781 if eval $compile; then
8782         val="$define";
8783 else
8784         val="$undef";
8785 fi;
8786 set $varname;
8787 eval $setvar;
8788 $rm -f try.c try.o'
8789
8790 : see if sys/types.h has to be included
8791 set sys/types.h i_systypes
8792 eval $inhdr
8793
8794 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8795 while $test $# -ge 2; do
8796         case "$1" in
8797         $define) echo "#include <$2>";;
8798         esac ;
8799     shift 2;
8800 done > try.c;
8801 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8802 set try;
8803 if eval $compile; then
8804         val="$define";
8805 else
8806         val="$undef";
8807 fi;
8808 set $varname;
8809 eval $setvar;
8810 $rm -f try.c try.o'
8811
8812 socketlib=''
8813 sockethdr=''
8814 : see whether socket exists
8815 echo " "
8816 $echo $n "Hmm... $c" >&4
8817 if set socket val -f d_socket; eval $csym; $val; then
8818         echo "Looks like you have Berkeley networking support." >&4
8819         d_socket="$define"
8820         if set setsockopt val -f; eval $csym; $val; then
8821                 d_oldsock="$undef"
8822         else
8823                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8824                 d_oldsock="$define"
8825         fi
8826 else
8827         if $contains socklib libc.list >/dev/null 2>&1; then
8828                 echo "Looks like you have Berkeley networking support." >&4
8829                 d_socket="$define"
8830                 : we will have to assume that it supports the 4.2 BSD interface
8831                 d_oldsock="$undef"
8832         else
8833                 echo "You don't have Berkeley networking in libc$_a..." >&4
8834                 if test "X$d_socket" = "X$define"; then
8835                    echo "...but you seem to believe that you have sockets." >&4
8836                 else
8837                         for net in net socket
8838                         do
8839                                 if test -f /usr/lib/lib$net$_a; then
8840                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8841                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8842                                         if $contains socket libc.list >/dev/null 2>&1; then
8843                                                 d_socket="$define"
8844                                                 socketlib="-l$net"
8845                                                 case "$net" in
8846                                                 net)
8847                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8848                                                         sockethdr="-I/usr/netinclude"
8849                                                         ;;
8850                                                 esac
8851                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8852                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8853                                                         d_oldsock="$undef"
8854                                                 else
8855                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8856                                                         d_oldsock="$define"
8857                                                 fi
8858                                                 break
8859                                         fi
8860                                 fi
8861                         done
8862                         if test "X$d_socket" != "X$define"; then
8863                            echo "or anywhere else I see." >&4
8864                            d_socket="$undef"
8865                            d_oldsock="$undef"
8866                         fi
8867                 fi
8868         fi
8869 fi
8870
8871 : see if socketpair exists
8872 set socketpair d_sockpair
8873 eval $inlibc
8874
8875
8876 echo " "
8877 echo "Checking the availability of certain socket constants..." >& 4
8878 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8879         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8880         $cat >try.c <<EOF
8881 #include <sys/types.h>
8882 #include <sys/socket.h>
8883 int main() {
8884     int i = $ENUM;
8885 }
8886 EOF
8887         val="$undef"
8888         set try; if eval $compile; then
8889                 val="$define"
8890         fi
8891         set d_${enum}; eval $setvar
8892         $rm -f try.c try
8893 done
8894
8895 : see if this is a sys/uio.h system
8896 set sys/uio.h i_sysuio
8897 eval $inhdr
8898
8899
8900 echo " "
8901 echo "Checking to see if your system supports struct cmsghdr..." >&4
8902 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8903 eval $hasstruct
8904 case "$d_cmsghdr_s" in
8905 "$define")      echo "Yes, it does."   ;;
8906 *)              echo "No, it doesn't." ;;
8907 esac
8908
8909
8910 : check for const keyword
8911 echo " "
8912 echo 'Checking to see if your C compiler knows about "const"...' >&4
8913 $cat >const.c <<'EOCP'
8914 typedef struct spug { int drokk; } spug;
8915 int main()
8916 {
8917         const char *foo;
8918         const spug y;
8919 }
8920 EOCP
8921 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8922         val="$define"
8923         echo "Yup, it does."
8924 else
8925         val="$undef"
8926         echo "Nope, it doesn't."
8927 fi
8928 set d_const
8929 eval $setvar
8930
8931 : see if crypt exists
8932 echo " "
8933 if set crypt val -f d_crypt; eval $csym; $val; then
8934         echo 'crypt() found.' >&4
8935         val="$define"
8936         cryptlib=''
8937 else
8938         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8939         if $test -z "$cryptlib"; then
8940                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8941         else
8942                 cryptlib=-lcrypt
8943         fi
8944         if $test -z "$cryptlib"; then
8945                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8946         else
8947                 cryptlib=-lcrypt
8948         fi
8949         if $test -z "$cryptlib"; then
8950                 cryptlib=`./loc libcrypt$_a "" $libpth`
8951         else
8952                 cryptlib=-lcrypt
8953         fi
8954         if $test -z "$cryptlib"; then
8955                 echo 'crypt() NOT found.' >&4
8956                 val="$undef"
8957         else
8958                 val="$define"
8959         fi
8960 fi
8961 set d_crypt
8962 eval $setvar
8963
8964 : get csh whereabouts
8965 case "$csh" in
8966 'csh') val="$undef" ;;
8967 *) val="$define" ;;
8968 esac
8969 set d_csh
8970 eval $setvar
8971 : Respect a hint or command line value for full_csh.
8972 case "$full_csh" in
8973 '') full_csh=$csh ;;
8974 esac
8975
8976 : see if cuserid exists
8977 set cuserid d_cuserid
8978 eval $inlibc
8979
8980 : see if this is a limits.h system
8981 set limits.h i_limits
8982 eval $inhdr
8983
8984 : see if this is a float.h system
8985 set float.h i_float
8986 eval $inhdr
8987
8988 : See if number of significant digits in a double precision number is known
8989 echo " "
8990 $cat >dbl_dig.c <<EOM
8991 #$i_limits I_LIMITS
8992 #$i_float I_FLOAT
8993 #ifdef I_LIMITS
8994 #include <limits.h>
8995 #endif
8996 #ifdef I_FLOAT
8997 #include <float.h>
8998 #endif
8999 #ifdef DBL_DIG
9000 printf("Contains DBL_DIG");
9001 #endif
9002 EOM
9003 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9004 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9005         echo "DBL_DIG found." >&4
9006         val="$define"
9007 else
9008         echo "DBL_DIG NOT found." >&4
9009         val="$undef"
9010 fi
9011 $rm -f dbl_dig.?
9012 set d_dbl_dig
9013 eval $setvar
9014
9015 hasproto='varname=$1; func=$2; shift; shift;
9016 while $test $# -ge 2; do
9017         case "$1" in
9018         $define) echo "#include <$2>";;
9019         esac ;
9020     shift 2;
9021 done > try.c;
9022 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9023 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9024         echo "$func() prototype found.";
9025         val="$define";
9026 else
9027         echo "$func() prototype NOT found.";
9028         val="$undef";
9029 fi;
9030 set $varname;
9031 eval $setvar;
9032 $rm -f try.c tryout.c'
9033
9034 : see if dbm.h is available
9035 : see if dbmclose exists
9036 set dbmclose d_dbmclose
9037 eval $inlibc
9038
9039 case "$d_dbmclose" in
9040 $define)
9041         set dbm.h i_dbm
9042         eval $inhdr
9043         case "$i_dbm" in
9044         $define)
9045                 val="$undef"
9046                 set i_rpcsvcdbm
9047                 eval $setvar
9048                 ;;
9049         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9050                 eval $inhdr
9051                 ;;
9052         esac
9053         ;;
9054 *)      echo "We won't be including <dbm.h>"
9055         val="$undef"
9056         set i_dbm
9057         eval $setvar
9058         val="$undef"
9059         set i_rpcsvcdbm
9060         eval $setvar
9061         ;;
9062 esac
9063
9064 : see if prototype for dbminit is available
9065 echo " "
9066 set d_dbminitproto dbminit $i_dbm dbm.h
9067 eval $hasproto
9068
9069 : see if difftime exists
9070 set difftime d_difftime
9071 eval $inlibc
9072
9073 : see if this is a dirent system
9074 echo " "
9075 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9076         val="$define"
9077         echo "<dirent.h> found." >&4
9078 else
9079         val="$undef"
9080         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9081                 echo "<sys/dir.h> found." >&4
9082                 echo " "
9083         else
9084                 xinc=`./findhdr sys/ndir.h`
9085         fi
9086         echo "<dirent.h> NOT found." >&4
9087 fi
9088 set i_dirent
9089 eval $setvar
9090
9091 : Look for type of directory structure.
9092 echo " "
9093 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9094
9095 case "$direntrytype" in
9096 ''|' ')
9097         case "$i_dirent" in
9098         $define) guess1='struct dirent' ;;
9099         *) guess1='struct direct'  ;;
9100         esac
9101         ;;
9102 *)      guess1="$direntrytype"
9103         ;;
9104 esac
9105
9106 case "$guess1" in
9107 'struct dirent') guess2='struct direct' ;;
9108 *) guess2='struct dirent' ;;
9109 esac
9110                 
9111 if $contains "$guess1" try.c >/dev/null 2>&1; then
9112         direntrytype="$guess1"
9113         echo "Your directory entries are $direntrytype." >&4
9114 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9115         direntrytype="$guess2"
9116         echo "Your directory entries seem to be $direntrytype." >&4
9117 else
9118         echo "I don't recognize your system's directory entries." >&4
9119         rp="What type is used for directory entries on this system?"
9120         dflt="$guess1"
9121         . ./myread
9122         direntrytype="$ans"
9123 fi
9124 $rm -f try.c
9125
9126
9127 : see if the directory entry stores field length
9128 echo " "
9129 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9130 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9131         echo "Good, your directory entry keeps length information in d_namlen." >&4
9132         val="$define"
9133 else
9134         echo "Your directory entry does not know about the d_namlen field." >&4
9135         val="$undef"
9136 fi
9137 set d_dirnamlen
9138 eval $setvar
9139 $rm -f try.c
9140
9141 : see if dlerror exists
9142 xxx_runnm="$runnm"
9143 runnm=false
9144 set dlerror d_dlerror
9145 eval $inlibc
9146 runnm="$xxx_runnm"
9147
9148 : see if dlfcn is available
9149 set dlfcn.h i_dlfcn
9150 eval $inhdr
9151
9152 case "$usedl" in
9153 $define|y|true)
9154         $cat << EOM
9155
9156 On a few systems, the dynamically loaded modules that perl generates and uses
9157 will need a different extension than shared libs. The default will probably
9158 be appropriate.
9159
9160 EOM
9161         case "$dlext" in
9162         '')     dflt="$so" ;;
9163         *)      dflt="$dlext" ;;
9164         esac
9165         rp='What is the extension of dynamically loaded modules'
9166         . ./myread
9167         dlext="$ans"
9168         ;;
9169 *)
9170         dlext="none"
9171         ;;
9172 esac
9173
9174 : Check if dlsym need a leading underscore
9175 echo " "
9176 val="$undef"
9177
9178 case "$dlsrc" in
9179 dl_dlopen.xs)
9180         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9181         $cat >dyna.c <<'EOM'
9182 fred () { }
9183 EOM
9184
9185 $cat >fred.c<<EOM
9186
9187 #include <stdio.h>
9188 #$i_dlfcn I_DLFCN
9189 #ifdef I_DLFCN
9190 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9191 #else
9192 #include <sys/types.h>
9193 #include <nlist.h>
9194 #include <link.h>
9195 #endif
9196
9197 extern int fred() ;
9198
9199 int main()
9200 {
9201     void * handle ;
9202     void * symbol ;
9203 #ifndef RTLD_LAZY
9204     int mode = 1 ;
9205 #else
9206     int mode = RTLD_LAZY ;
9207 #endif
9208     handle = dlopen("./dyna.$dlext", mode) ;
9209     if (handle == NULL) {
9210         printf ("1\n") ;
9211         fflush (stdout) ;
9212         exit(0);
9213     }
9214     symbol = dlsym(handle, "fred") ;
9215     if (symbol == NULL) {
9216         /* try putting a leading underscore */
9217         symbol = dlsym(handle, "_fred") ;
9218         if (symbol == NULL) {
9219             printf ("2\n") ;
9220             fflush (stdout) ;
9221             exit(0);
9222         }
9223         printf ("3\n") ;
9224     }
9225     else
9226         printf ("4\n") ;
9227     fflush (stdout) ;
9228     exit(0);
9229 }
9230 EOM
9231         : Call the object file tmp-dyna.o in case dlext=o.
9232         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9233                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9234                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9235                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9236                 xxx=`./fred`
9237                 case $xxx in
9238                 1)      echo "Test program failed using dlopen." >&4
9239                         echo "Perhaps you should not use dynamic loading." >&4;;
9240                 2)      echo "Test program failed using dlsym." >&4
9241                         echo "Perhaps you should not use dynamic loading." >&4;;
9242                 3)      echo "dlsym needs a leading underscore" >&4
9243                         val="$define" ;;
9244                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9245                 esac
9246         else
9247                 echo "I can't compile and run the test program." >&4
9248                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9249         fi
9250         ;;
9251 esac
9252                 
9253 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9254
9255 set d_dlsymun
9256 eval $setvar
9257
9258 : see if prototype for drand48 is available
9259 echo " "
9260 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9261 eval $hasproto
9262
9263 : see if dup2 exists
9264 set dup2 d_dup2
9265 eval $inlibc
9266
9267 : see if eaccess exists
9268 set eaccess d_eaccess
9269 eval $inlibc
9270
9271 : see if endgrent exists
9272 set endgrent d_endgrent
9273 eval $inlibc
9274
9275 : see if endhostent exists
9276 set endhostent d_endhent
9277 eval $inlibc
9278
9279 : see if endnetent exists
9280 set endnetent d_endnent
9281 eval $inlibc
9282
9283 : see if endprotoent exists
9284 set endprotoent d_endpent
9285 eval $inlibc
9286
9287 : see if endpwent exists
9288 set endpwent d_endpwent
9289 eval $inlibc
9290
9291 : see if endservent exists
9292 set endservent d_endsent
9293 eval $inlibc
9294
9295 : Locate the flags for 'open()'
9296 echo " "
9297 $cat >open3.c <<'EOCP'
9298 #include <sys/types.h>
9299 #ifdef I_FCNTL
9300 #include <fcntl.h>
9301 #endif
9302 #ifdef I_SYS_FILE
9303 #include <sys/file.h>
9304 #endif
9305 int main() {
9306         if(O_RDONLY);
9307 #ifdef O_TRUNC
9308         exit(0);
9309 #else
9310         exit(1);
9311 #endif
9312 }
9313 EOCP
9314 : check sys/file.h first to get FREAD on Sun
9315 if $test `./findhdr sys/file.h` && \
9316                 set open3 -DI_SYS_FILE && eval $compile; then
9317         h_sysfile=true;
9318         echo "<sys/file.h> defines the O_* constants..." >&4
9319         if ./open3; then
9320                 echo "and you have the 3 argument form of open()." >&4
9321                 val="$define"
9322         else
9323                 echo "but not the 3 argument form of open().  Oh, well." >&4
9324                 val="$undef"
9325         fi
9326 elif $test `./findhdr fcntl.h` && \
9327                 set open3 -DI_FCNTL && eval $compile; then
9328         h_fcntl=true;
9329         echo "<fcntl.h> defines the O_* constants..." >&4
9330         if ./open3; then
9331                 echo "and you have the 3 argument form of open()." >&4
9332                 val="$define"
9333         else
9334                 echo "but not the 3 argument form of open().  Oh, well." >&4
9335                 val="$undef"
9336         fi
9337 else
9338         val="$undef"
9339         echo "I can't find the O_* constant definitions!  You got problems." >&4
9340 fi
9341 set d_open3
9342 eval $setvar
9343 $rm -f open3*
9344
9345 : see which of string.h or strings.h is needed
9346 echo " "
9347 strings=`./findhdr string.h`
9348 if $test "$strings" && $test -r "$strings"; then
9349         echo "Using <string.h> instead of <strings.h>." >&4
9350         val="$define"
9351 else
9352         val="$undef"
9353         strings=`./findhdr strings.h`
9354         if $test "$strings" && $test -r "$strings"; then
9355                 echo "Using <strings.h> instead of <string.h>." >&4
9356         else
9357                 echo "No string header found -- You'll surely have problems." >&4
9358         fi
9359 fi
9360 set i_string
9361 eval $setvar
9362 case "$i_string" in
9363 "$undef") strings=`./findhdr strings.h`;;
9364 *)        strings=`./findhdr string.h`;;
9365 esac
9366
9367 : check for non-blocking I/O stuff
9368 case "$h_sysfile" in
9369 true) echo "#include <sys/file.h>" > head.c;;
9370 *)
9371        case "$h_fcntl" in
9372        true) echo "#include <fcntl.h>" > head.c;;
9373        *) echo "#include <sys/fcntl.h>" > head.c;;
9374        esac
9375        ;;
9376 esac
9377 echo " "
9378 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9379 case "$o_nonblock" in
9380 '')
9381         $cat head.c > try.c
9382         $cat >>try.c <<'EOCP'
9383 #include <stdio.h>
9384 int main() {
9385 #ifdef O_NONBLOCK
9386         printf("O_NONBLOCK\n");
9387         exit(0);
9388 #endif
9389 #ifdef O_NDELAY
9390         printf("O_NDELAY\n");
9391         exit(0);
9392 #endif
9393 #ifdef FNDELAY
9394         printf("FNDELAY\n");
9395         exit(0);
9396 #endif
9397         exit(0);
9398 }
9399 EOCP
9400         set try
9401         if eval $compile_ok; then
9402                 o_nonblock=`./try`
9403                 case "$o_nonblock" in
9404                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9405                 *) echo "Seems like we can use $o_nonblock.";;
9406                 esac
9407         else
9408                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9409         fi
9410         ;;
9411 *) echo "Using $hint value $o_nonblock.";;
9412 esac
9413 $rm -f try try.* .out core
9414
9415 echo " "
9416 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9417 case "$eagain" in
9418 '')
9419         $cat head.c > try.c
9420         $cat >>try.c <<EOCP
9421 #include <errno.h>
9422 #include <sys/types.h>
9423 #include <signal.h>
9424 #include <stdio.h> 
9425 #define MY_O_NONBLOCK $o_nonblock
9426 #ifndef errno  /* XXX need better Configure test */
9427 extern int errno;
9428 #endif
9429 #$i_unistd I_UNISTD
9430 #ifdef I_UNISTD
9431 #include <unistd.h>
9432 #endif
9433 #$i_string I_STRING
9434 #ifdef I_STRING
9435 #include <string.h>
9436 #else
9437 #include <strings.h>
9438 #endif
9439 $signal_t blech(x) int x; { exit(3); }
9440 EOCP
9441         $cat >> try.c <<'EOCP'
9442 int main()
9443 {
9444         int pd[2];
9445         int pu[2];
9446         char buf[1];
9447         char string[100];
9448
9449         pipe(pd);       /* Down: child -> parent */
9450         pipe(pu);       /* Up: parent -> child */
9451         if (0 != fork()) {
9452                 int ret;
9453                 close(pd[1]);   /* Parent reads from pd[0] */
9454                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9455 #ifdef F_SETFL
9456                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9457                         exit(1);
9458 #else
9459                 exit(4);
9460 #endif
9461                 signal(SIGALRM, blech);
9462                 alarm(5);
9463                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9464                         exit(2);
9465                 sprintf(string, "%d\n", ret);
9466                 write(2, string, strlen(string));
9467                 alarm(0);
9468 #ifdef EAGAIN
9469                 if (errno == EAGAIN) {
9470                         printf("EAGAIN\n");
9471                         goto ok;
9472                 }
9473 #endif
9474 #ifdef EWOULDBLOCK
9475                 if (errno == EWOULDBLOCK)
9476                         printf("EWOULDBLOCK\n");
9477 #endif
9478         ok:
9479                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9480                 sleep(2);                               /* Give it time to close our pipe */
9481                 alarm(5);
9482                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9483                 alarm(0);
9484                 sprintf(string, "%d\n", ret);
9485                 write(3, string, strlen(string));
9486                 exit(0);
9487         }
9488
9489         close(pd[0]);                   /* We write to pd[1] */
9490         close(pu[1]);                   /* We read from pu[0] */
9491         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9492         close(pd[1]);                   /* Pipe pd is now fully closed! */
9493         exit(0);                                /* Bye bye, thank you for playing! */
9494 }
9495 EOCP
9496         set try
9497         if eval $compile_ok; then
9498                 echo "$startsh" >mtry
9499                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9500                 chmod +x mtry
9501                 ./mtry >/dev/null 2>&1
9502                 case $? in
9503                 0) eagain=`$cat try.out`;;
9504                 1) echo "Could not perform non-blocking setting!";;
9505                 2) echo "I did a successful read() for something that was not there!";;
9506                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9507                 4) echo "Could not find F_SETFL!";;
9508                 *) echo "Something terribly wrong happened during testing.";;
9509                 esac
9510                 rd_nodata=`$cat try.ret`
9511                 echo "A read() system call with no data present returns $rd_nodata."
9512                 case "$rd_nodata" in
9513                 0|-1) ;;
9514                 *)
9515                         echo "(That's peculiar, fixing that to be -1.)"
9516                         rd_nodata=-1
9517                         ;;
9518                 esac
9519                 case "$eagain" in
9520                 '')
9521                         echo "Forcing errno EAGAIN on read() with no data available."
9522                         eagain=EAGAIN
9523                         ;;
9524                 *)
9525                         echo "Your read() sets errno to $eagain when no data is available."
9526                         ;;
9527                 esac
9528                 status=`$cat try.err`
9529                 case "$status" in
9530                 0) echo "And it correctly returns 0 to signal EOF.";;
9531                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9532                 *) echo "However, your read() returns '$status' on EOF??";;
9533                 esac
9534                 val="$define"
9535                 if test "$status" = "$rd_nodata"; then
9536                         echo "WARNING: you can't distinguish between EOF and no data!"
9537                         val="$undef"
9538                 fi
9539         else
9540                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9541                 eagain=EAGAIN
9542         fi
9543         set d_eofnblk
9544         eval $setvar
9545         ;;
9546 *)
9547         echo "Using $hint value $eagain."
9548         echo "Your read() returns $rd_nodata when no data is present."
9549         case "$d_eofnblk" in
9550         "$define") echo "And you can see EOF because read() returns 0.";;
9551         "$undef") echo "But you can't see EOF status from read() returned value.";;
9552         *)
9553                 echo "(Assuming you can't see EOF status from read anyway.)"
9554                 d_eofnblk=$undef
9555                 ;;
9556         esac
9557         ;;
9558 esac
9559 $rm -f try try.* .out core head.c mtry
9560
9561 : see if fchmod exists
9562 set fchmod d_fchmod
9563 eval $inlibc
9564
9565 : see if fchown exists
9566 set fchown d_fchown
9567 eval $inlibc
9568
9569 : see if this is an fcntl system
9570 set fcntl d_fcntl
9571 eval $inlibc
9572
9573 echo " "
9574 : See if fcntl-based locking works.
9575 $cat >try.c <<'EOCP'
9576 #include <stdlib.h>
9577 #include <unistd.h>
9578 #include <fcntl.h>
9579 int main() {
9580 #if defined(F_SETLK) && defined(F_SETLKW)
9581      struct flock flock;
9582      int retval, fd;
9583      fd = open("try.c", O_RDONLY);
9584      flock.l_type = F_RDLCK;
9585      flock.l_whence = SEEK_SET;
9586      flock.l_start = flock.l_len = 0;
9587      retval = fcntl(fd, F_SETLK, &flock);
9588      close(fd);
9589      (retval < 0 ? exit(2) : exit(0));
9590 #else
9591      exit(2);
9592 #endif
9593 }
9594 EOCP
9595 echo "Checking if fcntl-based file locking works... "
9596 case "$d_fcntl" in
9597 "$define")
9598         set try
9599         if eval $compile_ok; then
9600                 if ./try; then
9601                         echo "Yes, it seems to work."
9602                         val="$define"
9603                 else
9604                         echo "Nope, it didn't work."
9605                         val="$undef"
9606                 fi
9607         else
9608                 echo "I'm unable to compile the test program, so I'll assume not."
9609                 val="$undef"
9610         fi
9611         ;;
9612 *) val="$undef";
9613         echo "Nope, since you don't even have fcntl()."
9614         ;;
9615 esac
9616 set d_fcntl_can_lock
9617 eval $setvar
9618 $rm -f try*
9619
9620
9621 : see if sys/select.h has to be included
9622 set sys/select.h i_sysselct
9623 eval $inhdr
9624
9625 : see if we should include time.h, sys/time.h, or both
9626 echo " "
9627 if test "X$timeincl" = X; then
9628         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9629         $echo $n "I'm now running the test program...$c"
9630         $cat >try.c <<'EOCP'
9631 #include <sys/types.h>
9632 #ifdef I_TIME
9633 #include <time.h>
9634 #endif
9635 #ifdef I_SYSTIME
9636 #ifdef SYSTIMEKERNEL
9637 #define KERNEL
9638 #endif
9639 #include <sys/time.h>
9640 #endif
9641 #ifdef I_SYSSELECT
9642 #include <sys/select.h>
9643 #endif
9644 int main()
9645 {
9646         struct tm foo;
9647 #ifdef S_TIMEVAL
9648         struct timeval bar;
9649 #endif
9650 #ifdef S_TIMEZONE
9651         struct timezone tzp;
9652 #endif
9653         if (foo.tm_sec == foo.tm_sec)
9654                 exit(0);
9655 #ifdef S_TIMEVAL
9656         if (bar.tv_sec == bar.tv_sec)
9657                 exit(0);
9658 #endif
9659         exit(1);
9660 }
9661 EOCP
9662         flags=''
9663         for s_timezone in '-DS_TIMEZONE' ''; do
9664         sysselect=''
9665         for s_timeval in '-DS_TIMEVAL' ''; do
9666         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9667         for i_time in '' '-DI_TIME'; do
9668         for i_systime in '-DI_SYSTIME' ''; do
9669                 case "$flags" in
9670                 '') $echo $n ".$c"
9671                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9672                         if eval $compile; then
9673                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9674                                 shift
9675                                 flags="$*"
9676                                 echo " "
9677                                 $echo $n "Succeeded with $flags$c"
9678                         fi
9679                         ;;
9680                 esac
9681         done
9682         done
9683         done
9684         done
9685         done
9686         timeincl=''
9687         echo " "
9688         case "$flags" in
9689         *SYSTIMEKERNEL*) i_systimek="$define"
9690                 timeincl=`./findhdr sys/time.h`
9691                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9692         *) i_systimek="$undef";;
9693         esac
9694         case "$flags" in
9695         *I_TIME*) i_time="$define"
9696                 timeincl=`./findhdr time.h`" $timeincl"
9697                 echo "We'll include <time.h>." >&4;;
9698         *) i_time="$undef";;
9699         esac
9700         case "$flags" in
9701         *I_SYSTIME*) i_systime="$define"
9702                 timeincl=`./findhdr sys/time.h`" $timeincl"
9703                 echo "We'll include <sys/time.h>." >&4;;
9704         *) i_systime="$undef";;
9705         esac
9706         $rm -f try.c try
9707 fi
9708
9709 : check for fd_set items
9710 $cat <<EOM
9711
9712 Checking to see how well your C compiler handles fd_set and friends ...
9713 EOM
9714 $cat >fd_set.c <<EOCP
9715 #$i_systime I_SYS_TIME
9716 #$i_sysselct I_SYS_SELECT
9717 #$d_socket HAS_SOCKET
9718 #include <sys/types.h>
9719 #ifdef HAS_SOCKET
9720 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9721 #endif
9722 #ifdef I_SYS_TIME
9723 #include <sys/time.h>
9724 #endif
9725 #ifdef I_SYS_SELECT
9726 #include <sys/select.h>
9727 #endif
9728 int main() {
9729         fd_set fds;
9730
9731 #ifdef TRYBITS
9732         if(fds.fds_bits);
9733 #endif
9734
9735 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9736         exit(0);
9737 #else
9738         exit(1);
9739 #endif
9740 }
9741 EOCP
9742 set fd_set -DTRYBITS
9743 if eval $compile; then
9744         d_fds_bits="$define"
9745         d_fd_set="$define"
9746         echo "Well, your system knows about the normal fd_set typedef..." >&4
9747         if ./fd_set; then
9748                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9749                 d_fd_macros="$define"
9750         else
9751                 $cat >&4 <<'EOM'
9752 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9753 EOM
9754                 d_fd_macros="$undef"
9755         fi
9756 else
9757         $cat <<'EOM'
9758 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9759 EOM
9760         set fd_set
9761         if eval $compile; then
9762                 d_fds_bits="$undef"
9763                 d_fd_set="$define"
9764                 echo "Well, your system has some sort of fd_set available..." >&4
9765                 if ./fd_set; then
9766                         echo "and you have the normal fd_set macros." >&4
9767                         d_fd_macros="$define"
9768                 else
9769                         $cat <<'EOM'
9770 but not the normal fd_set macros!  Gross!  More work for me...
9771 EOM
9772                         d_fd_macros="$undef"
9773                 fi
9774         else
9775         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9776                 d_fd_set="$undef"
9777                 d_fds_bits="$undef"
9778                 d_fd_macros="$undef"
9779         fi
9780 fi
9781 $rm -f fd_set*
9782
9783 : see if fgetpos exists
9784 set fgetpos d_fgetpos
9785 eval $inlibc
9786
9787 : see if flock exists
9788 set flock d_flock
9789 eval $inlibc
9790
9791 : see if this is a sys/file.h system
9792 val=''
9793 set sys/file.h val
9794 eval $inhdr
9795
9796 : do we need to include sys/file.h ?
9797 case "$val" in
9798 "$define")
9799         echo " "
9800         if $h_sysfile; then
9801                 val="$define"
9802                 echo "We'll be including <sys/file.h>." >&4
9803         else
9804                 val="$undef"
9805                 echo "We won't be including <sys/file.h>." >&4
9806         fi
9807         ;;
9808 *)
9809         h_sysfile=false
9810         ;;
9811 esac
9812 set i_sysfile
9813 eval $setvar
9814
9815 : see if prototype for flock is available
9816 echo " "
9817 set d_flockproto flock $i_sysfile sys/file.h
9818 eval $hasproto
9819
9820 : see if fork exists
9821 set fork d_fork
9822 eval $inlibc
9823
9824 : see if pathconf exists
9825 set pathconf d_pathconf
9826 eval $inlibc
9827
9828 : see if fpathconf exists
9829 set fpathconf d_fpathconf
9830 eval $inlibc
9831
9832
9833 : check for fpos64_t
9834 echo " "
9835 echo "Checking to see if you have fpos64_t..." >&4
9836 $cat >try.c <<EOCP
9837 #include <stdio.h>
9838 int main() { fpos64_t x = 7; }
9839 EOCP
9840 set try
9841 if eval $compile; then
9842         val="$define"
9843         echo "You have fpos64_t."
9844 else
9845         val="$undef"
9846         echo "You do not have fpos64_t."
9847         case "$fpossize" in
9848         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9849         esac
9850 fi
9851 $rm -f try.* try
9852 set d_fpos64_t
9853 eval $setvar
9854
9855 : see if frexpl exists
9856 set frexpl d_frexpl
9857 eval $inlibc
9858
9859 : see if this is a sys/param system
9860 set sys/param.h i_sysparam
9861 eval $inhdr
9862
9863 : see if this is a sys/mount.h system
9864 set sys/mount.h i_sysmount
9865 eval $inhdr
9866
9867
9868 echo " "
9869 echo "Checking to see if your system supports struct fs_data..." >&4
9870 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9871 eval $hasstruct
9872 case "$d_fs_data_s" in
9873 "$define")      echo "Yes, it does."   ;;
9874 *)              echo "No, it doesn't." ;;
9875 esac
9876
9877 : see if fseeko exists
9878 set fseeko d_fseeko
9879 eval $inlibc
9880 case "$longsize" in
9881 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9882 esac
9883
9884 : see if fsetpos exists
9885 set fsetpos d_fsetpos
9886 eval $inlibc
9887
9888
9889 : see if fstatfs exists
9890 set fstatfs d_fstatfs
9891 eval $inlibc
9892
9893
9894 : see if statvfs exists
9895 set statvfs d_statvfs
9896 eval $inlibc
9897
9898 : see if fstatvfs exists
9899 set fstatvfs d_fstatvfs
9900 eval $inlibc
9901
9902
9903 : see if fsync exists
9904 set fsync d_fsync
9905 eval $inlibc
9906
9907 : see if ftello exists
9908 set ftello d_ftello
9909 eval $inlibc
9910 case "$longsize" in
9911 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9912 esac
9913
9914 : see if getcwd exists
9915 set getcwd d_getcwd
9916 eval $inlibc
9917
9918 : see if getespwnam exists
9919 set getespwnam d_getespwnam
9920 eval $inlibc
9921
9922
9923 : see if getfsstat exists
9924 set getfsstat d_getfsstat
9925 eval $inlibc
9926
9927 : see if getgrent exists
9928 set getgrent d_getgrent
9929 eval $inlibc
9930
9931 : see if gethostbyaddr exists
9932 set gethostbyaddr d_gethbyaddr
9933 eval $inlibc
9934
9935 : see if gethostbyname exists
9936 set gethostbyname d_gethbyname
9937 eval $inlibc
9938
9939 : see if gethostent exists
9940 set gethostent d_gethent
9941 eval $inlibc
9942
9943 : see how we will look up host name
9944 echo " "
9945 call=''
9946 if set gethostname val -f d_gethname; eval $csym; $val; then
9947         echo 'gethostname() found.' >&4
9948         d_gethname="$define"
9949         call=gethostname
9950 fi
9951 if set uname val -f d_uname; eval $csym; $val; then
9952         if ./xenix; then
9953                 $cat <<'EOM'
9954 uname() was found, but you're running xenix, and older versions of xenix
9955 have a broken uname(). If you don't really know whether your xenix is old
9956 enough to have a broken system call, use the default answer.
9957
9958 EOM
9959                 dflt=y
9960                 case "$d_uname" in
9961                 "$define") dflt=n;;
9962                 esac
9963                 rp='Is your uname() broken?'
9964                 . ./myread
9965                 case "$ans" in
9966                 n*) d_uname="$define"; call=uname;;
9967                 esac
9968         else
9969                 echo 'uname() found.' >&4
9970                 d_uname="$define"
9971                 case "$call" in
9972                 '') call=uname ;;
9973                 esac
9974         fi
9975 fi
9976 case "$d_gethname" in
9977 '') d_gethname="$undef";;
9978 esac
9979 case "$d_uname" in
9980 '') d_uname="$undef";;
9981 esac
9982 case "$d_uname$d_gethname" in
9983 *define*)
9984         dflt=n
9985         cat <<EOM
9986  
9987 Every now and then someone has a $call() that lies about the hostname
9988 but can't be fixed for political or economic reasons.  If you wish, I can
9989 pretend $call() isn't there and maybe compute hostname at run-time
9990 thanks to the '$phostname' command.
9991
9992 EOM
9993         rp="Shall I ignore $call() from now on?"
9994         . ./myread
9995         case "$ans" in
9996         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9997         esac;;
9998 esac
9999 case "$phostname" in
10000 '') aphostname='';;
10001 *) case "$aphostname" in
10002         /*) ;;
10003         *) set X $phostname
10004                 shift
10005                 file=$1
10006                 shift
10007                 file=`./loc $file $file $pth`
10008                 aphostname=`echo $file $*`
10009                 ;;
10010         esac
10011         ;;
10012 esac
10013 case "$d_uname$d_gethname" in
10014 *define*) ;;
10015 *)
10016         case "$phostname" in
10017         '')
10018                 echo "There will be no way for $package to get your hostname." >&4;;
10019         *)
10020         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10021                 ;;
10022         esac;;
10023 esac
10024 case "$d_phostname" in
10025 '') d_phostname="$undef";;
10026 esac
10027
10028 : see if this is a netdb.h system
10029 set netdb.h i_netdb
10030 eval $inhdr
10031
10032 : see if prototypes for various gethostxxx netdb.h functions are available
10033 echo " "
10034 set d_gethostprotos gethostent $i_netdb netdb.h
10035 eval $hasproto
10036
10037 : see if getitimer exists
10038 set getitimer d_getitimer
10039 eval $inlibc
10040
10041 : see if getlogin exists
10042 set getlogin d_getlogin
10043 eval $inlibc
10044
10045 : see if getmnt exists
10046 set getmnt d_getmnt
10047 eval $inlibc
10048
10049 : see if getmntent exists
10050 set getmntent d_getmntent
10051 eval $inlibc
10052
10053 : see if getnetbyaddr exists
10054 set getnetbyaddr d_getnbyaddr
10055 eval $inlibc
10056
10057 : see if getnetbyname exists
10058 set getnetbyname d_getnbyname
10059 eval $inlibc
10060
10061 : see if getnetent exists
10062 set getnetent d_getnent
10063 eval $inlibc
10064
10065 : see if prototypes for various getnetxxx netdb.h functions are available
10066 echo " "
10067 set d_getnetprotos getnetent $i_netdb netdb.h
10068 eval $hasproto
10069
10070 : see if getpagesize exists
10071 set getpagesize d_getpagsz
10072 eval $inlibc
10073
10074
10075 : see if getprotobyname exists
10076 set getprotobyname d_getpbyname
10077 eval $inlibc
10078
10079 : see if getprotobynumber exists
10080 set getprotobynumber d_getpbynumber
10081 eval $inlibc
10082
10083 : see if getprotoent exists
10084 set getprotoent d_getpent
10085 eval $inlibc
10086
10087 : see if getpgid exists
10088 set getpgid d_getpgid
10089 eval $inlibc
10090
10091 : see if getpgrp2 exists
10092 set getpgrp2 d_getpgrp2
10093 eval $inlibc
10094
10095 : see if getppid exists
10096 set getppid d_getppid
10097 eval $inlibc
10098
10099 : see if getpriority exists
10100 set getpriority d_getprior
10101 eval $inlibc
10102
10103 : see if prototypes for various getprotoxxx netdb.h functions are available
10104 echo " "
10105 set d_getprotoprotos getprotoent $i_netdb netdb.h
10106 eval $hasproto
10107
10108 : see if getprpwnam exists
10109 set getprpwnam d_getprpwnam
10110 eval $inlibc
10111
10112 : see if getpwent exists
10113 set getpwent d_getpwent
10114 eval $inlibc
10115
10116
10117 : see if getservbyname exists
10118 set getservbyname d_getsbyname
10119 eval $inlibc
10120
10121 : see if getservbyport exists
10122 set getservbyport d_getsbyport
10123 eval $inlibc
10124
10125 : see if getservent exists
10126 set getservent d_getsent
10127 eval $inlibc
10128
10129 : see if prototypes for various getservxxx netdb.h functions are available
10130 echo " "
10131 set d_getservprotos getservent $i_netdb netdb.h
10132 eval $hasproto
10133
10134 : see if getspnam exists
10135 set getspnam d_getspnam
10136 eval $inlibc
10137
10138 : see if gettimeofday or ftime exists
10139 set gettimeofday d_gettimeod
10140 eval $inlibc
10141 case "$d_gettimeod" in
10142 "$undef")
10143         set ftime d_ftime 
10144         eval $inlibc
10145         ;;
10146 *)
10147         val="$undef"; set d_ftime; eval $setvar
10148         ;;
10149 esac
10150 case "$d_gettimeod$d_ftime" in
10151 "$undef$undef")
10152         echo " "
10153         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10154         ;;
10155 esac
10156
10157 : see if this is an grp system
10158 set grp.h i_grp
10159 eval $inhdr
10160
10161 case "$i_grp" in
10162 $define)
10163         xxx=`./findhdr grp.h`
10164         $cppstdin $cppflags $cppminus < $xxx >$$.h
10165
10166         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10167                 val="$define"
10168         else
10169                 val="$undef"
10170         fi
10171         set d_grpasswd
10172         eval $setvar
10173
10174         $rm -f $$.h
10175         ;;
10176 *)
10177         val="$undef";
10178         set d_grpasswd; eval $setvar
10179         ;;
10180 esac
10181
10182 : see if hasmntopt exists
10183 set hasmntopt d_hasmntopt
10184 eval $inlibc
10185
10186 : see if this is a netinet/in.h or sys/in.h system
10187 set netinet/in.h i_niin sys/in.h i_sysin
10188 eval $inhdr
10189
10190 : see if arpa/inet.h has to be included
10191 set arpa/inet.h i_arpainet
10192 eval $inhdr
10193
10194 : see if htonl --and friends-- exists
10195 val=''
10196 set htonl val
10197 eval $inlibc
10198
10199 : Maybe they are macros.
10200 case "$val" in
10201 $undef)
10202         $cat >htonl.c <<EOM
10203 #include <stdio.h>
10204 #include <sys/types.h>
10205 #$i_niin I_NETINET_IN
10206 #$i_sysin I_SYS_IN
10207 #$i_arpainet I_ARPA_INET
10208 #ifdef I_NETINET_IN
10209 #include <netinet/in.h>
10210 #endif
10211 #ifdef I_SYS_IN
10212 #include <sys/in.h>
10213 #endif
10214 #ifdef I_ARPA_INET
10215 #include <arpa/inet.h>
10216 #endif
10217 #ifdef htonl
10218 printf("Defined as a macro.");
10219 #endif
10220 EOM
10221         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10222         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10223                 val="$define"
10224                 echo "But it seems to be defined as a macro." >&4
10225         fi
10226         $rm -f htonl.?
10227         ;;
10228 esac
10229 set d_htonl
10230 eval $setvar
10231
10232 : see if iconv exists
10233 set iconv d_iconv
10234 eval $inlibc
10235
10236 : index or strchr
10237 echo " "
10238 if set index val -f; eval $csym; $val; then
10239         if set strchr val -f d_strchr; eval $csym; $val; then
10240                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10241                         val="$define"
10242                         vali="$undef"
10243                         echo "strchr() found." >&4
10244                 else
10245                         val="$undef"
10246                         vali="$define"
10247                         echo "index() found." >&4
10248                 fi
10249         else
10250                 val="$undef"
10251                 vali="$define"
10252                 echo "index() found." >&4
10253         fi
10254 else
10255         if set strchr val -f d_strchr; eval $csym; $val; then
10256                 val="$define"
10257                 vali="$undef"
10258                 echo "strchr() found." >&4
10259         else
10260                 echo "No index() or strchr() found!" >&4
10261                 val="$undef"
10262                 vali="$undef"
10263         fi
10264 fi
10265 set d_strchr; eval $setvar
10266 val="$vali"
10267 set d_index; eval $setvar
10268
10269 : check whether inet_aton exists
10270 set inet_aton d_inetaton
10271 eval $inlibc
10272
10273 : Look for isascii
10274 echo " "
10275 $cat >isascii.c <<'EOCP'
10276 #include <stdio.h>
10277 #include <ctype.h>
10278 int main() {
10279         int c = 'A';
10280         if (isascii(c))
10281                 exit(0);
10282         else
10283                 exit(1);
10284 }
10285 EOCP
10286 set isascii
10287 if eval $compile; then
10288         echo "isascii() found." >&4
10289         val="$define"
10290 else
10291         echo "isascii() NOT found." >&4
10292         val="$undef"
10293 fi
10294 set d_isascii
10295 eval $setvar
10296 $rm -f isascii*
10297
10298 : see if isnan exists
10299 set isnan d_isnan
10300 eval $inlibc
10301
10302 : see if isnanl exists
10303 set isnanl d_isnanl
10304 eval $inlibc
10305
10306 : see if killpg exists
10307 set killpg d_killpg
10308 eval $inlibc
10309
10310 : see if lchown exists
10311 echo " "
10312 $cat > try.c <<'EOCP'
10313 /* System header to define __stub macros and hopefully few prototypes,
10314     which can conflict with char lchown(); below.  */
10315 #include <assert.h>
10316 /* Override any gcc2 internal prototype to avoid an error.  */
10317 /* We use char because int might match the return type of a gcc2
10318    builtin and then its argument prototype would still apply.  */
10319 char lchown();
10320 int main() {
10321     /*  The GNU C library defines this for functions which it implements
10322         to always fail with ENOSYS.  Some functions are actually named
10323         something starting with __ and the normal name is an alias.  */
10324 #if defined (__stub_lchown) || defined (__stub___lchown)
10325 choke me
10326 #else
10327 lchown();
10328 #endif
10329 ; return 0; }
10330 EOCP
10331 set try
10332 if eval $compile; then
10333     $echo "lchown() found." >&4
10334     val="$define"
10335 else
10336     $echo "lchown() NOT found." >&4
10337     val="$undef"
10338 fi
10339 set d_lchown
10340 eval $setvar
10341
10342 : See if number of significant digits in a double precision number is known
10343 echo " "
10344 $cat >ldbl_dig.c <<EOM
10345 #$i_limits I_LIMITS
10346 #$i_float I_FLOAT
10347 #ifdef I_LIMITS
10348 #include <limits.h>
10349 #endif
10350 #ifdef I_FLOAT
10351 #include <float.h>
10352 #endif
10353 #ifdef LDBL_DIG
10354 printf("Contains LDBL_DIG");
10355 #endif
10356 EOM
10357 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10358 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10359         echo "LDBL_DIG found." >&4
10360         val="$define"
10361 else
10362         echo "LDBL_DIG NOT found." >&4
10363         val="$undef"
10364 fi
10365 $rm -f ldbl_dig.?
10366 set d_ldbl_dig
10367 eval $setvar
10368
10369 : see if link exists
10370 set link d_link
10371 eval $inlibc
10372
10373 : see if localeconv exists
10374 set localeconv d_locconv
10375 eval $inlibc
10376
10377 : see if lockf exists
10378 set lockf d_lockf
10379 eval $inlibc
10380
10381 : see if prototype for lseek is available
10382 echo " "
10383 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10384 eval $hasproto
10385
10386 : see if lstat exists
10387 set lstat d_lstat
10388 eval $inlibc
10389
10390 : see if madvise exists
10391 set madvise d_madvise
10392 eval $inlibc
10393
10394 : see if mblen exists
10395 set mblen d_mblen
10396 eval $inlibc
10397
10398 : see if mbstowcs exists
10399 set mbstowcs d_mbstowcs
10400 eval $inlibc
10401
10402 : see if mbtowc exists
10403 set mbtowc d_mbtowc
10404 eval $inlibc
10405
10406 : see if memchr exists
10407 set memchr d_memchr
10408 eval $inlibc
10409
10410 : see if memcmp exists
10411 set memcmp d_memcmp
10412 eval $inlibc
10413
10414 : see if memcpy exists
10415 set memcpy d_memcpy
10416 eval $inlibc
10417
10418 : see if memmove exists
10419 set memmove d_memmove
10420 eval $inlibc
10421
10422 : see if memset exists
10423 set memset d_memset
10424 eval $inlibc
10425
10426 : see if mkdir exists
10427 set mkdir d_mkdir
10428 eval $inlibc
10429
10430 : see if mkdtemp exists
10431 set mkdtemp d_mkdtemp
10432 eval $inlibc
10433
10434 : see if mkfifo exists
10435 set mkfifo d_mkfifo
10436 eval $inlibc
10437
10438 : see if mkstemp exists
10439 set mkstemp d_mkstemp
10440 eval $inlibc
10441
10442 : see if mkstemps exists
10443 set mkstemps d_mkstemps
10444 eval $inlibc
10445
10446 : see if mktime exists
10447 set mktime d_mktime
10448 eval $inlibc
10449
10450 : see if this is a sys/mman.h system
10451 set sys/mman.h i_sysmman
10452 eval $inhdr
10453
10454 : see if mmap exists
10455 set mmap d_mmap
10456 eval $inlibc
10457 : see what shmat returns
10458 : default to something harmless
10459 mmaptype='void *'
10460 case "$i_sysmman$d_mmap" in
10461 "$define$define")
10462         $cat >mmap.c <<'END'
10463 #include <sys/mman.h>
10464 void *mmap();
10465 END
10466         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10467                 mmaptype='void *'
10468         else
10469                 mmaptype='caddr_t'
10470         fi
10471         echo "and it returns ($mmaptype)." >&4
10472         ;;
10473 esac
10474
10475
10476
10477 : see if modfl exists
10478 set modfl d_modfl
10479 eval $inlibc
10480
10481 d_modfl_pow32_bug="$undef"
10482
10483 case "$d_longdbl$d_modfl" in
10484 $define$define)
10485         $cat <<EOM
10486 Checking to see whether your modfl() is okay for large values...
10487 EOM
10488 $cat >try.c <<EOCP
10489 #include <math.h> 
10490 #include <stdio.h>
10491 int main() {
10492     long double nv = 4294967303.15;
10493     long double v, w;
10494     v = modfl(nv, &w);         
10495 #ifdef __GLIBC__
10496     printf("glibc");
10497 #endif
10498     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10499     return 0;
10500 }
10501 EOCP
10502         case "$osname:$gccversion" in
10503         aix:)   saveccflags="$ccflags"
10504                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10505         esac
10506         set try
10507         if eval $compile; then
10508                 foo=`./try`
10509                 case "$foo" in
10510                 *" 4294967303.150000 1.150000 4294967302.000000")
10511                         echo >&4 "Your modfl() is broken for large values."
10512                         d_modfl_pow32_bug="$define"
10513                         case "$foo" in
10514                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10515                         ;;
10516                         esac
10517                         ;;
10518                 *" 4294967303.150000 0.150000 4294967303.000000")
10519                         echo >&4 "Your modfl() seems okay for large values."
10520                         ;;
10521                 *)      echo >&4 "I don't understand your modfl() at all."
10522                         d_modfl="$undef"
10523                         ;;
10524                 esac
10525                 $rm -f try.* try core core.try.*
10526         else
10527                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10528                 d_modfl="$undef"
10529         fi
10530         case "$osname:$gccversion" in
10531         aix:)   $ccflags="saveccflags" ;; # restore
10532         esac
10533         ;;
10534 esac
10535
10536 : see if mprotect exists
10537 set mprotect d_mprotect
10538 eval $inlibc
10539
10540 : see if msgctl exists
10541 set msgctl d_msgctl
10542 eval $inlibc
10543
10544 : see if msgget exists
10545 set msgget d_msgget
10546 eval $inlibc
10547
10548 : see if msgsnd exists
10549 set msgsnd d_msgsnd
10550 eval $inlibc
10551
10552 : see if msgrcv exists
10553 set msgrcv d_msgrcv
10554 eval $inlibc
10555
10556 : see how much of the 'msg*(2)' library is present.
10557 h_msg=true
10558 echo " "
10559 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10560 *"$undef"*) h_msg=false;;
10561 esac
10562 case "$osname" in
10563 freebsd)
10564     case "`ipcs 2>&1`" in
10565     "SVID messages"*"not configured"*)
10566         echo "Your $osname does not have the msg*(2) configured." >&4
10567         h_msg=false
10568         val="$undef"
10569         set msgctl d_msgctl
10570         eval $setvar
10571         set msgget d_msgget
10572         eval $setvar
10573         set msgsnd d_msgsnd
10574         eval $setvar
10575         set msgrcv d_msgrcv
10576         eval $setvar
10577         ;;
10578     esac
10579     ;;
10580 esac
10581 : we could also check for sys/ipc.h ...
10582 if $h_msg && $test `./findhdr sys/msg.h`; then
10583         echo "You have the full msg*(2) library." >&4
10584         val="$define"
10585 else
10586         echo "You don't have the full msg*(2) library." >&4
10587         val="$undef"
10588 fi
10589 set d_msg
10590 eval $setvar
10591
10592
10593 echo " "
10594 echo "Checking to see if your system supports struct msghdr..." >&4
10595 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10596 eval $hasstruct
10597 case "$d_msghdr_s" in
10598 "$define")      echo "Yes, it does."   ;;
10599 *)              echo "No, it doesn't." ;;
10600 esac
10601
10602
10603 : see if msync exists
10604 set msync d_msync
10605 eval $inlibc
10606
10607 : see if munmap exists
10608 set munmap d_munmap
10609 eval $inlibc
10610
10611 : see if nice exists
10612 set nice d_nice
10613 eval $inlibc
10614
10615 : check for length of character
10616 echo " "
10617 case "$charsize" in
10618 '')
10619         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10620         $cat >try.c <<'EOCP'
10621 #include <stdio.h>
10622 int main()
10623 {
10624     printf("%d\n", (int)sizeof(char));
10625     exit(0);
10626 }
10627 EOCP
10628         set try
10629         if eval $compile_ok; then
10630                 dflt=`./try`
10631         else
10632                 dflt='1'
10633                 echo "(I can't seem to compile the test program.  Guessing...)"
10634         fi
10635         ;;
10636 *)
10637         dflt="$charsize"
10638         ;;
10639 esac
10640 rp="What is the size of a character (in bytes)?"
10641 . ./myread
10642 charsize="$ans"
10643 $rm -f try.c try
10644
10645 : check for volatile keyword
10646 echo " "
10647 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10648 $cat >try.c <<'EOCP'
10649 int main()
10650 {
10651         typedef struct _goo_struct goo_struct;
10652         goo_struct * volatile goo = ((goo_struct *)0);
10653         struct _goo_struct {
10654                 long long_int;
10655                 int reg_int;
10656                 char char_var;
10657         };
10658         typedef unsigned short foo_t;
10659         char *volatile foo;
10660         volatile int bar;
10661         volatile foo_t blech;
10662         foo = foo;
10663 }
10664 EOCP
10665 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10666         val="$define"
10667         echo "Yup, it does."
10668 else
10669         val="$undef"
10670         echo "Nope, it doesn't."
10671 fi
10672 set d_volatile
10673 eval $setvar
10674 $rm -f try.*
10675
10676
10677 echo " "
10678 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10679
10680 case "$use64bitint:$d_quad:$quadtype" in
10681 define:define:?*)
10682         ivtype="$quadtype"
10683         uvtype="$uquadtype"
10684         ivsize=8
10685         uvsize=8
10686         ;;
10687 *)      ivtype="long"
10688         uvtype="unsigned long"
10689         ivsize=$longsize
10690         uvsize=$longsize
10691         ;;
10692 esac
10693
10694 case "$uselongdouble:$d_longdbl" in
10695 define:define)
10696         nvtype="long double"
10697         nvsize=$longdblsize
10698         ;;
10699 *)      nvtype=double
10700         nvsize=$doublesize
10701         ;;
10702 esac
10703
10704 $echo "(IV will be "$ivtype", $ivsize bytes)"
10705 $echo "(UV will be "$uvtype", $uvsize bytes)"
10706 $echo "(NV will be "$nvtype", $nvsize bytes)"
10707
10708 $cat >try.c <<EOCP
10709 #$i_inttypes I_INTTYPES
10710 #ifdef I_INTTYPES
10711 #include <inttypes.h>
10712 #endif
10713 #include <stdio.h>
10714 int main() {
10715 #ifdef INT8
10716    int8_t i =  INT8_MAX;
10717   uint8_t u = UINT8_MAX;
10718   printf("int8_t\n");
10719 #endif
10720 #ifdef INT16
10721    int16_t i =  INT16_MAX;
10722   uint16_t i = UINT16_MAX;
10723   printf("int16_t\n");
10724 #endif
10725 #ifdef INT32
10726    int32_t i =  INT32_MAX;
10727   uint32_t u = UINT32_MAX;
10728   printf("int32_t\n");
10729 #endif
10730 }
10731 EOCP
10732
10733 case "$i8type" in
10734 '')     case "$charsize" in
10735         1)      i8type=char
10736                 u8type="unsigned char"
10737                 i8size=$charsize
10738                 u8size=$charsize
10739                 ;;
10740         esac
10741         ;;
10742 esac
10743 case "$i8type" in
10744 '')     set try -DINT8
10745         if eval $compile; then
10746                 case "`./try$exe_ext`" in
10747                 int8_t) i8type=int8_t
10748                         u8type=uint8_t
10749                         i8size=1
10750                         u8size=1
10751                         ;;
10752                 esac
10753         fi
10754         ;;
10755 esac
10756 case "$i8type" in
10757 '')     if $test $charsize -ge 1; then
10758                 i8type=char
10759                 u8type="unsigned char"
10760                 i8size=$charsize
10761                 u8size=$charsize
10762         fi
10763         ;;
10764 esac
10765
10766 case "$i16type" in
10767 '')     case "$shortsize" in
10768         2)      i16type=short
10769                 u16type="unsigned short"
10770                 i16size=$shortsize
10771                 u16size=$shortsize
10772                 ;;
10773         esac
10774         ;;
10775 esac
10776 case "$i16type" in
10777 '')     set try -DINT16
10778         if eval $compile; then
10779                 case "`./try$exe_ext`" in
10780                 int16_t)
10781                         i16type=int16_t
10782                         u16type=uint16_t
10783                         i16size=2
10784                         u16size=2
10785                         ;;
10786                 esac
10787         fi
10788         ;;
10789 esac
10790 case "$i16type" in
10791 '')     if $test $shortsize -ge 2; then
10792                 i16type=short
10793                 u16type="unsigned short"
10794                 i16size=$shortsize
10795                 u16size=$shortsize
10796         fi
10797         ;;
10798 esac
10799
10800 case "$i32type" in
10801 '')     case "$longsize" in
10802         4)      i32type=long
10803                 u32type="unsigned long"
10804                 i32size=$longsize
10805                 u32size=$longsize
10806                 ;;
10807         *)      case "$intsize" in
10808                 4)      i32type=int
10809                         u32type="unsigned int"
10810                         i32size=$intsize
10811                         u32size=$intsize
10812                         ;;
10813                 esac
10814                 ;;
10815         esac
10816         ;;
10817 esac
10818 case "$i32type" in
10819 '')     set try -DINT32
10820         if eval $compile; then
10821                 case "`./try$exe_ext`" in
10822                 int32_t)
10823                         i32type=int32_t
10824                         u32type=uint32_t
10825                         i32size=4
10826                         u32size=4
10827                         ;;
10828                 esac
10829         fi
10830         ;;
10831 esac
10832 case "$i32type" in
10833 '')     if $test $intsize -ge 4; then
10834                 i32type=int
10835                 u32type="unsigned int"
10836                 i32size=$intsize
10837                 u32size=$intsize
10838         fi
10839         ;;
10840 esac
10841
10842 case "$i64type" in
10843 '')     case "$d_quad:$quadtype" in
10844         define:?*)
10845                 i64type="$quadtype"
10846                 u64type="$uquadtype"
10847                 i64size=8
10848                 u64size=8
10849                 ;;
10850         esac
10851         ;;
10852 esac
10853
10854 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10855 : volatile so that the compiler has to store it out to memory.
10856 if test X"$d_volatile" = X"$define"; then
10857         volatile=volatile
10858 fi
10859 $cat <<EOP >try.c
10860 #include <stdio.h>
10861 #include <sys/types.h>
10862 #include <signal.h>
10863 #ifdef SIGFPE
10864 $volatile int bletched = 0;
10865 $signal_t blech(s) int s; { bletched = 1; }
10866 #endif
10867 int main() {
10868     $uvtype u = 0;
10869     $nvtype d;
10870     int     n = 8 * $uvsize;
10871     int     i;
10872 #ifdef SIGFPE
10873     signal(SIGFPE, blech);
10874 #endif
10875
10876     for (i = 0; i < n; i++) {
10877       u = u << 1 | ($uvtype)1;
10878       d = ($nvtype)u;
10879       if (($uvtype)d != u)
10880         break;
10881       if (d <= 0)
10882         break;
10883       d = ($nvtype)(u - 1);
10884       if (($uvtype)d != (u - 1))
10885         break;
10886 #ifdef SIGFPE
10887       if (bletched) {
10888         break;
10889 #endif
10890       } 
10891     }
10892     printf("%d\n", ((i == n) ? -n : i));
10893     exit(0);
10894 }
10895 EOP
10896 set try
10897
10898 d_nv_preserves_uv="$undef"
10899 if eval $compile; then
10900         d_nv_preserves_uv_bits="`./try$exe_ext`"
10901 fi
10902 case "$d_nv_preserves_uv_bits" in
10903 \-[1-9]*)       
10904         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10905         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10906         d_nv_preserves_uv="$define"
10907         ;;
10908 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10909         d_nv_preserves_uv="$undef" ;;
10910 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10911         d_nv_preserves_uv_bits="$undef" ;;
10912 esac
10913
10914 $rm -f try.* try
10915
10916
10917 : check for off64_t
10918 echo " "
10919 echo "Checking to see if you have off64_t..." >&4
10920 $cat >try.c <<EOCP
10921 #include <sys/types.h>
10922 #include <unistd.h>
10923 int main() { off64_t x = 7; }
10924 EOCP
10925 set try
10926 if eval $compile; then
10927         val="$define"
10928         echo "You have off64_t."
10929 else
10930         val="$undef"
10931         echo "You do not have off64_t."
10932         case "$lseeksize" in
10933         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10934         esac
10935 fi
10936 $rm -f try.* try
10937 set d_off64_t
10938 eval $setvar
10939
10940 : see if POSIX threads are available
10941 set pthread.h i_pthread
10942 eval $inhdr
10943
10944
10945
10946
10947 : how to create joinable pthreads
10948 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10949         echo " "
10950         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10951         $cat >try.c <<'EOCP'
10952 #include <pthread.h>
10953 int main() {
10954     int detachstate = JOINABLE;
10955 }
10956 EOCP
10957         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10958         if eval $compile; then
10959                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10960                 val="$undef" # Yes, undef.
10961                 set d_old_pthread_create_joinable
10962                 eval $setvar
10963                 val=""
10964                 set old_pthread_create_joinable
10965                 eval $setvar
10966         else
10967                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10968                 if eval $compile; then
10969                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10970                         val="$define"
10971                         set d_old_pthread_create_joinable
10972                         eval $setvar
10973                         val=PTHREAD_CREATE_UNDETACHED
10974                         set old_pthread_create_joinable
10975                         eval $setvar
10976                 else            
10977                         set try -DJOINABLE=__UNDETACHED
10978                         if eval $compile; then
10979                                 echo "You seem to use __UNDETACHED." >&4
10980                                 val="$define"
10981                                 set d_old_pthread_create_joinable
10982                                 eval $setvar
10983                                 val=__UNDETACHED
10984                                 set old_pthread_create_joinable
10985                                 eval $setvar
10986                         else
10987                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10988                                 val="$define"
10989                                 set d_old_pthread_create_joinable
10990                                 eval $setvar
10991                                 val=0
10992                                 set old_pthread_create_joinable
10993                                 eval $setvar
10994                         fi
10995                 fi
10996         fi
10997         $rm -f try try.*
10998 else
10999     d_old_pthread_create_joinable="$undef"
11000     old_pthread_create_joinable=""
11001 fi
11002
11003 : see if pause exists
11004 set pause d_pause
11005 eval $inlibc
11006
11007 : see if pipe exists
11008 set pipe d_pipe
11009 eval $inlibc
11010
11011 : see if poll exists
11012 set poll d_poll
11013 eval $inlibc
11014
11015
11016 : see whether the various POSIXish _yields exist
11017 $cat >try.c <<EOP
11018 #include <pthread.h>
11019 #include <stdio.h>
11020 int main() {
11021 #ifdef SCHED_YIELD
11022         sched_yield();
11023 #else
11024 #ifdef PTHREAD_YIELD
11025         pthread_yield();
11026 #else
11027 #ifdef PTHREAD_YIELD_NULL
11028         pthread_yield(NULL);
11029 #endif
11030 #endif
11031 #endif
11032 }
11033 EOP
11034 : see if sched_yield exists
11035 set try -DSCHED_YIELD
11036 if eval $compile; then
11037     val="$define"
11038     sched_yield='sched_yield()'
11039 else
11040     val="$undef"
11041 fi
11042 case "$usethreads" in
11043 $define)
11044         case "$val" in
11045         $define) echo 'sched_yield() found.' >&4        ;;
11046         *)       echo 'sched_yield() NOT found.' >&4    ;;
11047         esac
11048 esac
11049 set d_sched_yield
11050 eval $setvar
11051
11052 : see if pthread_yield exists
11053 set try -DPTHREAD_YIELD
11054 if eval $compile; then
11055     val="$define"
11056     case "$sched_yield" in
11057     '') sched_yield='pthread_yield()' ;;
11058     esac
11059 else
11060     set try -DPTHREAD_YIELD_NULL
11061     if eval $compile; then
11062         val="$define"
11063         case "$sched_yield" in
11064         '') sched_yield='pthread_yield(NULL)' ;;
11065         esac
11066     else
11067         val="$undef"
11068     fi
11069 fi
11070 case "$usethreads" in
11071 $define)
11072         case "$val" in
11073         $define) echo 'pthread_yield() found.' >&4      ;;
11074         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11075         esac
11076         ;;
11077 esac
11078 set d_pthread_yield
11079 eval $setvar
11080
11081 case "$sched_yield" in
11082 '') sched_yield=undef ;;
11083 esac
11084
11085 $rm -f try try.*
11086
11087 : see if this is a pwd.h system
11088 set pwd.h i_pwd
11089 eval $inhdr
11090
11091 case "$i_pwd" in
11092 $define)
11093         xxx=`./findhdr pwd.h`
11094         $cppstdin $cppflags $cppminus < $xxx >$$.h
11095
11096         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11097                 val="$define"
11098         else
11099                 val="$undef"
11100         fi
11101         set d_pwquota
11102         eval $setvar
11103
11104         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11105                 val="$define"
11106         else
11107                 val="$undef"
11108         fi
11109         set d_pwage
11110         eval $setvar
11111
11112         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11113                 val="$define"
11114         else
11115                 val="$undef"
11116         fi
11117         set d_pwchange
11118         eval $setvar
11119
11120         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11121                 val="$define"
11122         else
11123                 val="$undef"
11124         fi
11125         set d_pwclass
11126         eval $setvar
11127
11128         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11129                 val="$define"
11130         else
11131                 val="$undef"
11132         fi
11133         set d_pwexpire
11134         eval $setvar
11135
11136         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11137                 val="$define"
11138         else
11139                 val="$undef"
11140         fi
11141         set d_pwcomment
11142         eval $setvar
11143
11144         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11145                 val="$define"
11146         else
11147                 val="$undef"
11148         fi
11149         set d_pwgecos
11150         eval $setvar
11151
11152         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11153                 val="$define"
11154         else
11155                 val="$undef"
11156         fi
11157         set d_pwpasswd
11158         eval $setvar
11159
11160         $rm -f $$.h
11161         ;;
11162 *)
11163         val="$undef"; 
11164         set d_pwquota; eval $setvar
11165         set d_pwage; eval $setvar
11166         set d_pwchange; eval $setvar
11167         set d_pwclass; eval $setvar
11168         set d_pwexpire; eval $setvar
11169         set d_pwcomment; eval $setvar
11170         set d_pwgecos; eval $setvar
11171         set d_pwpasswd; eval $setvar
11172         ;;
11173 esac
11174
11175 : see if readdir and friends exist
11176 set readdir d_readdir
11177 eval $inlibc
11178 set seekdir d_seekdir
11179 eval $inlibc
11180 set telldir d_telldir
11181 eval $inlibc
11182 set rewinddir d_rewinddir
11183 eval $inlibc
11184
11185 : see if readlink exists
11186 set readlink d_readlink
11187 eval $inlibc
11188
11189 : see if readv exists
11190 set readv d_readv
11191 eval $inlibc
11192
11193 : see if realpath exists
11194 set realpath d_realpath
11195 eval $inlibc
11196
11197 : see if recvmsg exists
11198 set recvmsg d_recvmsg
11199 eval $inlibc
11200
11201 : see if rename exists
11202 set rename d_rename
11203 eval $inlibc
11204
11205 : see if rmdir exists
11206 set rmdir d_rmdir
11207 eval $inlibc
11208
11209 : see if memory.h is available.
11210 val=''
11211 set memory.h val
11212 eval $inhdr
11213
11214 : See if it conflicts with string.h
11215 case "$val" in
11216 $define)
11217         case "$strings" in
11218         '') ;;
11219         *)
11220                 $cppstdin $cppflags $cppminus < $strings > mem.h
11221                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11222                         echo " "
11223                         echo "We won't be including <memory.h>."
11224                         val="$undef"
11225                 fi
11226                 $rm -f mem.h
11227                 ;;
11228         esac
11229 esac
11230 set i_memory
11231 eval $setvar
11232
11233 : can bcopy handle overlapping blocks?
11234 val="$undef"
11235 case "$d_bcopy" in
11236 "$define")
11237         echo " "
11238         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11239         $cat >try.c <<EOCP
11240 #$i_memory I_MEMORY
11241 #$i_stdlib I_STDLIB
11242 #$i_string I_STRING
11243 #$i_unistd I_UNISTD
11244 EOCP
11245         $cat >>try.c <<'EOCP'
11246 #include <stdio.h>
11247 #ifdef I_MEMORY
11248 #  include <memory.h>
11249 #endif
11250 #ifdef I_STDLIB
11251 #  include <stdlib.h>
11252 #endif
11253 #ifdef I_STRING
11254 #  include <string.h>
11255 #else
11256 #  include <strings.h>
11257 #endif
11258 #ifdef I_UNISTD
11259 #  include <unistd.h>  /* Needed for NetBSD */
11260 #endif
11261 int main()
11262 {
11263 char buf[128], abc[128];
11264 char *b;
11265 int len;
11266 int off;
11267 int align;
11268
11269 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11270
11271 for (align = 7; align >= 0; align--) {
11272         for (len = 36; len; len--) {
11273                 b = buf+align;
11274                 bcopy(abc, b, len);
11275                 for (off = 1; off <= len; off++) {
11276                         bcopy(b, b+off, len);
11277                         bcopy(b+off, b, len);
11278                         if (bcmp(b, abc, len))
11279                                 exit(1);
11280                 }
11281         }
11282 }
11283 exit(0);
11284 }
11285 EOCP
11286         set try
11287         if eval $compile_ok; then
11288                 if ./try 2>/dev/null; then
11289                         echo "Yes, it can."
11290                         val="$define"
11291                 else
11292                         echo "It can't, sorry."
11293                         case "$d_memmove" in
11294                         "$define") echo "But that's Ok since you have memmove()." ;;
11295                         esac
11296                 fi
11297         else
11298                 echo "(I can't compile the test program, so we'll assume not...)"
11299                 case "$d_memmove" in
11300                 "$define") echo "But that's Ok since you have memmove()." ;;
11301                 esac
11302         fi
11303         ;;
11304 esac
11305 $rm -f try.* try core
11306 set d_safebcpy
11307 eval $setvar
11308
11309 : can memcpy handle overlapping blocks?
11310 val="$undef"
11311 case "$d_memcpy" in
11312 "$define")
11313         echo " "
11314         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11315         $cat >try.c <<EOCP
11316 #$i_memory I_MEMORY
11317 #$i_stdlib I_STDLIB
11318 #$i_string I_STRING
11319 #$i_unistd I_UNISTD
11320 EOCP
11321         $cat >>try.c <<'EOCP'
11322 #include <stdio.h>
11323 #ifdef I_MEMORY
11324 #  include <memory.h>
11325 #endif
11326 #ifdef I_STDLIB
11327 #  include <stdlib.h>
11328 #endif
11329 #ifdef I_STRING
11330 #  include <string.h>
11331 #else
11332 #  include <strings.h>
11333 #endif
11334 #ifdef I_UNISTD
11335 #  include <unistd.h>  /* Needed for NetBSD */
11336 #endif
11337 int main()
11338 {
11339 char buf[128], abc[128];
11340 char *b;
11341 int len;
11342 int off;
11343 int align;
11344
11345 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11346    try to store the string in read-only memory. */
11347 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11348
11349 for (align = 7; align >= 0; align--) {
11350         for (len = 36; len; len--) {
11351                 b = buf+align;
11352                 memcpy(b, abc, len);
11353                 for (off = 1; off <= len; off++) {
11354                         memcpy(b+off, b, len);
11355                         memcpy(b, b+off, len);
11356                         if (memcmp(b, abc, len))
11357                                 exit(1);
11358                 }
11359         }
11360 }
11361 exit(0);
11362 }
11363 EOCP
11364         set try
11365         if eval $compile_ok; then
11366                 if ./try 2>/dev/null; then
11367                         echo "Yes, it can."
11368                         val="$define"
11369                 else
11370                         echo "It can't, sorry."
11371                         case "$d_memmove" in
11372                         "$define") echo "But that's Ok since you have memmove()." ;;
11373                         esac
11374                 fi
11375         else
11376                 echo "(I can't compile the test program, so we'll assume not...)"
11377                 case "$d_memmove" in
11378                 "$define") echo "But that's Ok since you have memmove()." ;;
11379                 esac
11380         fi
11381         ;;
11382 esac
11383 $rm -f try.* try core
11384 set d_safemcpy
11385 eval $setvar
11386
11387 : can memcmp be trusted to compare relative magnitude?
11388 val="$undef"
11389 case "$d_memcmp" in
11390 "$define")
11391         echo " "
11392         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11393         $cat >try.c <<EOCP
11394 #$i_memory I_MEMORY
11395 #$i_stdlib I_STDLIB
11396 #$i_string I_STRING
11397 #$i_unistd I_UNISTD
11398 EOCP
11399         $cat >>try.c <<'EOCP'
11400 #include <stdio.h>
11401 #ifdef I_MEMORY
11402 #  include <memory.h>
11403 #endif
11404 #ifdef I_STDLIB
11405 #  include <stdlib.h>
11406 #endif
11407 #ifdef I_STRING
11408 #  include <string.h>
11409 #else
11410 #  include <strings.h>
11411 #endif
11412 #ifdef I_UNISTD
11413 #  include <unistd.h>  /* Needed for NetBSD */
11414 #endif
11415 int main()
11416 {
11417 char a = -1;
11418 char b = 0;
11419 if ((a < b) && memcmp(&a, &b, 1) < 0)
11420         exit(1);
11421 exit(0);
11422 }
11423 EOCP
11424         set try
11425         if eval $compile_ok; then
11426                 if ./try 2>/dev/null; then
11427                         echo "Yes, it can."
11428                         val="$define"
11429                 else
11430                         echo "No, it can't (it uses signed chars)."
11431                 fi
11432         else
11433                 echo "(I can't compile the test program, so we'll assume not...)"
11434         fi
11435         ;;
11436 esac
11437 $rm -f try.* try core
11438 set d_sanemcmp
11439 eval $setvar
11440
11441 : see if prototype for sbrk is available
11442 echo " "
11443 set d_sbrkproto sbrk $i_unistd unistd.h
11444 eval $hasproto
11445
11446 : see if select exists
11447 set select d_select
11448 eval $inlibc
11449
11450 : see if semctl exists
11451 set semctl d_semctl
11452 eval $inlibc
11453
11454 : see if semget exists
11455 set semget d_semget
11456 eval $inlibc
11457
11458 : see if semop exists
11459 set semop d_semop
11460 eval $inlibc
11461
11462 : see how much of the 'sem*(2)' library is present.
11463 h_sem=true
11464 echo " "
11465 case "$d_semctl$d_semget$d_semop" in
11466 *"$undef"*) h_sem=false;;
11467 esac
11468 case "$osname" in
11469 freebsd)
11470     case "`ipcs 2>&1`" in
11471     "SVID messages"*"not configured"*)
11472         echo "Your $osname does not have the sem*(2) configured." >&4
11473         h_sem=false
11474         val="$undef"
11475         set semctl d_semctl
11476         eval $setvar
11477         set semget d_semget
11478         eval $setvar
11479         set semop d_semop
11480         eval $setvar
11481         ;;
11482     esac
11483     ;;
11484 esac
11485 : we could also check for sys/ipc.h ...
11486 if $h_sem && $test `./findhdr sys/sem.h`; then
11487         echo "You have the full sem*(2) library." >&4
11488         val="$define"
11489 else
11490         echo "You don't have the full sem*(2) library." >&4
11491         val="$undef"
11492 fi
11493 set d_sem
11494 eval $setvar
11495
11496 : see whether sys/sem.h defines union semun
11497 echo " "
11498 $cat > try.c <<'END'
11499 #include <sys/types.h>
11500 #include <sys/ipc.h>
11501 #include <sys/sem.h>
11502 int main () { union semun semun; semun.buf = 0; }
11503 END
11504 set try
11505 if eval $compile; then
11506     echo "You have union semun in <sys/sem.h>." >&4
11507     val="$define"
11508 else
11509     echo "You do not have union semun in <sys/sem.h>." >&4
11510     val="$undef"
11511 fi
11512 $rm -f try try.c try.h
11513 set d_union_semun
11514 eval $setvar
11515
11516 : see how to do semctl IPC_STAT
11517 case "$d_sem" in
11518 $define)
11519     : see whether semctl IPC_STAT can use union semun
11520     echo " "
11521     $cat > try.h <<END
11522 #ifndef S_IRUSR
11523 #   ifdef S_IREAD
11524 #       define S_IRUSR S_IREAD
11525 #       define S_IWUSR S_IWRITE
11526 #       define S_IXUSR S_IEXEC
11527 #   else
11528 #       define S_IRUSR 0400
11529 #       define S_IWUSR 0200
11530 #       define S_IXUSR 0100
11531 #   endif
11532 #   define S_IRGRP (S_IRUSR>>3)
11533 #   define S_IWGRP (S_IWUSR>>3)
11534 #   define S_IXGRP (S_IXUSR>>3)
11535 #   define S_IROTH (S_IRUSR>>6)
11536 #   define S_IWOTH (S_IWUSR>>6)
11537 #   define S_IXOTH (S_IXUSR>>6)
11538 #endif
11539 #ifndef S_IRWXU
11540 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11541 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11542 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11543 #endif
11544 END
11545
11546     $cat > try.c <<END
11547 #include <sys/types.h>
11548 #include <sys/ipc.h>
11549 #include <sys/sem.h>
11550 #include <sys/stat.h>
11551 #include <stdio.h>
11552 #include <errno.h>
11553 #include "try.h"
11554 #ifndef errno
11555 extern int errno;
11556 #endif
11557 #$d_union_semun HAS_UNION_SEMUN
11558 int main() {
11559     union semun
11560 #ifndef HAS_UNION_SEMUN
11561     {
11562         int val;
11563         struct semid_ds *buf;
11564         unsigned short *array;
11565     }
11566 #endif
11567     arg;
11568     int sem, st;
11569
11570 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11571     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11572     if (sem > -1) {
11573         struct semid_ds argbuf;
11574         arg.buf = &argbuf;
11575 #       ifdef IPC_STAT
11576         st = semctl(sem, 0, IPC_STAT, arg);
11577         if (st == 0)
11578             printf("semun\n");
11579         else
11580 #       endif /* IPC_STAT */
11581             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11582 #       ifdef IPC_RMID
11583         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11584 #       endif /* IPC_RMID */
11585             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11586     } else
11587 #endif /* IPC_PRIVATE && ... */
11588         printf("semget failed: errno = %d\n", errno);
11589   return 0;
11590 }
11591 END
11592     val="$undef"
11593     set try
11594     if eval $compile; then
11595         xxx=`./try`
11596         case "$xxx" in
11597         semun) val="$define" ;;
11598         esac
11599     fi
11600     $rm -f try try.c
11601     set d_semctl_semun
11602     eval $setvar
11603     case "$d_semctl_semun" in
11604     $define)
11605         echo "You can use union semun for semctl IPC_STAT." >&4
11606         also='also'
11607         ;;
11608     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11609         also=''
11610         ;;
11611     esac
11612
11613     : see whether semctl IPC_STAT can use struct semid_ds pointer
11614     $cat > try.c <<'END'
11615 #include <sys/types.h>
11616 #include <sys/ipc.h>
11617 #include <sys/sem.h>
11618 #include <sys/stat.h>
11619 #include "try.h"
11620 #include <stdio.h>
11621 #include <errno.h>
11622 #ifndef errno
11623 extern int errno;
11624 #endif
11625 int main() {
11626     struct semid_ds arg;
11627     int sem, st;
11628
11629 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11630     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11631     if (sem > -1) {
11632 #       ifdef IPC_STAT
11633         st = semctl(sem, 0, IPC_STAT, &arg);
11634         if (st == 0)
11635             printf("semid_ds\n");
11636         else
11637 #       endif /* IPC_STAT */
11638             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11639 #       ifdef IPC_RMID
11640         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11641 #       endif /* IPC_RMID */
11642             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11643     } else
11644 #endif /* IPC_PRIVATE && ... */
11645         printf("semget failed: errno = %d\n", errno);
11646
11647     return 0;
11648 }
11649 END
11650     val="$undef"
11651     set try
11652     if eval $compile; then
11653         xxx=`./try`
11654         case "$xxx" in
11655         semid_ds) val="$define" ;;
11656         esac
11657     fi
11658     $rm -f try try.c
11659     set d_semctl_semid_ds
11660     eval $setvar
11661     case "$d_semctl_semid_ds" in
11662     $define)
11663         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11664         ;;
11665     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11666         ;;
11667     esac
11668     $rm -f try.h
11669     ;;
11670 *)  val="$undef"
11671
11672     # We do not have the full sem*(2) library, so assume we can not
11673     # use either.
11674
11675     set d_semctl_semun
11676     eval $setvar
11677
11678     set d_semctl_semid_ds
11679     eval $setvar
11680     ;;
11681 esac
11682
11683 : see if sendmsg exists
11684 set sendmsg d_sendmsg
11685 eval $inlibc
11686
11687 : see if setegid exists
11688 set setegid d_setegid
11689 eval $inlibc
11690
11691 : see if seteuid exists
11692 set seteuid d_seteuid
11693 eval $inlibc
11694
11695 : see if setgrent exists
11696 set setgrent d_setgrent
11697 eval $inlibc
11698
11699 : see if sethostent exists
11700 set sethostent d_sethent
11701 eval $inlibc
11702
11703 : see if setitimer exists
11704 set setitimer d_setitimer
11705 eval $inlibc
11706
11707 : see if setlinebuf exists
11708 set setlinebuf d_setlinebuf
11709 eval $inlibc
11710
11711 : see if setlocale exists
11712 set setlocale d_setlocale
11713 eval $inlibc
11714
11715 : see if setnetent exists
11716 set setnetent d_setnent
11717 eval $inlibc
11718
11719 : see if setprotoent exists
11720 set setprotoent d_setpent
11721 eval $inlibc
11722
11723 : see if setpgid exists
11724 set setpgid d_setpgid
11725 eval $inlibc
11726
11727 : see if setpgrp2 exists
11728 set setpgrp2 d_setpgrp2
11729 eval $inlibc
11730
11731 : see if setpriority exists
11732 set setpriority d_setprior
11733 eval $inlibc
11734
11735 : see if setproctitle exists
11736 set setproctitle d_setproctitle
11737 eval $inlibc
11738
11739 : see if setpwent exists
11740 set setpwent d_setpwent
11741 eval $inlibc
11742
11743 : see if setregid exists
11744 set setregid d_setregid
11745 eval $inlibc
11746 set setresgid d_setresgid
11747 eval $inlibc
11748
11749 : see if setreuid exists
11750 set setreuid d_setreuid
11751 eval $inlibc
11752 set setresuid d_setresuid
11753 eval $inlibc
11754
11755 : see if setrgid exists
11756 set setrgid d_setrgid
11757 eval $inlibc
11758
11759 : see if setruid exists
11760 set setruid d_setruid
11761 eval $inlibc
11762
11763 : see if setservent exists
11764 set setservent d_setsent
11765 eval $inlibc
11766
11767 : see if setsid exists
11768 set setsid d_setsid
11769 eval $inlibc
11770
11771 : see if setvbuf exists
11772 set setvbuf d_setvbuf
11773 eval $inlibc
11774
11775 : see if sfio.h is available
11776 set sfio.h i_sfio
11777 eval $inhdr
11778
11779
11780 : see if sfio library is available
11781 case "$i_sfio" in
11782 $define)
11783         val=''
11784         set sfreserve val
11785         eval $inlibc
11786         ;;
11787 *)
11788         val="$undef"
11789         ;;
11790 esac
11791 : Ok, but do we want to use it.
11792 case "$val" in
11793 $define)
11794         case "$usesfio" in
11795         true|$define|[yY]*) dflt='y';;
11796         *) dflt='n';;
11797         esac
11798         echo "$package can use the sfio library, but it is experimental."
11799         case "$useperlio" in
11800         "$undef")
11801             echo "For sfio also the PerlIO abstraction layer is needed."
11802             echo "Earlier you said you wouldn't want that."
11803             ;;
11804         esac
11805         rp="You seem to have sfio available, do you want to try using it?"
11806         . ./myread
11807         case "$ans" in
11808         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11809                 useperlio="$define"
11810                 val="$define"
11811                 ;;
11812         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11813                 val="$undef"
11814                 ;;
11815         esac
11816         ;;
11817 *)      case "$usesfio" in
11818         true|$define|[yY]*)
11819                 echo "Sorry, cannot find sfio on this machine." >&4
11820                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11821                 val="$undef"
11822                 ;;
11823         esac
11824         ;;
11825 esac
11826 set d_sfio
11827 eval $setvar
11828 case "$d_sfio" in
11829 $define) usesfio='true';;
11830 *) usesfio='false';;
11831 esac
11832 case "$d_sfio" in
11833 $define) ;;
11834 *)      : Remove sfio from list of libraries to use
11835         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11836         shift
11837         libs="$*"
11838         echo "libs = $libs" >&4
11839 ;;
11840 esac
11841
11842
11843 : see if shmctl exists
11844 set shmctl d_shmctl
11845 eval $inlibc
11846
11847 : see if shmget exists
11848 set shmget d_shmget
11849 eval $inlibc
11850
11851 : see if shmat exists
11852 set shmat d_shmat
11853 eval $inlibc
11854 : see what shmat returns
11855 case "$d_shmat" in
11856 "$define")
11857         $cat >shmat.c <<'END'
11858 #include <sys/shm.h>
11859 void *shmat();
11860 END
11861         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11862                 shmattype='void *'
11863         else
11864                 shmattype='char *'
11865         fi
11866         echo "and it returns ($shmattype)." >&4
11867         : see if a prototype for shmat is available
11868         xxx=`./findhdr sys/shm.h`
11869         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11870         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11871                 val="$define"
11872         else
11873                 val="$undef"
11874         fi
11875         $rm -f shmat.[co]
11876         ;;
11877 *)
11878         val="$undef"
11879         ;;
11880 esac
11881 set d_shmatprototype
11882 eval $setvar
11883
11884 : see if shmdt exists
11885 set shmdt d_shmdt
11886 eval $inlibc
11887
11888 : see how much of the 'shm*(2)' library is present.
11889 h_shm=true
11890 echo " "
11891 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11892 *"$undef"*) h_shm=false;;
11893 esac
11894 case "$osname" in
11895 freebsd)
11896     case "`ipcs 2>&1`" in
11897     "SVID shared memory"*"not configured"*)
11898         echo "Your $osname does not have the shm*(2) configured." >&4
11899         h_shm=false
11900         val="$undef"
11901         set shmctl d_shmctl
11902         evat $setvar
11903         set shmget d_shmget
11904         evat $setvar
11905         set shmat d_shmat
11906         evat $setvar
11907         set shmdt d_shmdt
11908         evat $setvar
11909         ;;
11910     esac
11911     ;;
11912 esac
11913 : we could also check for sys/ipc.h ...
11914 if $h_shm && $test `./findhdr sys/shm.h`; then
11915         echo "You have the full shm*(2) library." >&4
11916         val="$define"
11917 else
11918         echo "You don't have the full shm*(2) library." >&4
11919         val="$undef"
11920 fi
11921 set d_shm
11922 eval $setvar
11923
11924 echo " "
11925 : see if we have sigaction
11926 if set sigaction val -f d_sigaction; eval $csym; $val; then
11927         echo 'sigaction() found.' >&4
11928         $cat > try.c <<'EOP'
11929 #include <stdio.h>
11930 #include <sys/types.h>
11931 #include <signal.h>
11932 int main()
11933 {
11934     struct sigaction act, oact;
11935     act.sa_flags = 0;
11936     oact.sa_handler = 0;
11937     /* so that act and oact are used */
11938     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11939 }
11940 EOP
11941         set try
11942         if eval $compile_ok; then
11943                 val="$define"
11944         else
11945                 echo "But you don't seem to have a useable struct sigaction." >&4
11946                 val="$undef"
11947         fi
11948 else
11949         echo 'sigaction NOT found.' >&4
11950         val="$undef"
11951 fi
11952 set d_sigaction; eval $setvar
11953 $rm -f try try$_o try.c
11954
11955 : see if sigprocmask exists
11956 set sigprocmask d_sigprocmask
11957 eval $inlibc
11958
11959 : see if sigsetjmp exists
11960 echo " "
11961 case "$d_sigsetjmp" in
11962 '')
11963         $cat >try.c <<'EOP'
11964 #include <setjmp.h>
11965 sigjmp_buf env;
11966 int set = 1;
11967 int main()
11968 {
11969         if (sigsetjmp(env,1))
11970                 exit(set);
11971         set = 0;
11972         siglongjmp(env, 1);
11973         exit(1);
11974 }
11975 EOP
11976         set try
11977         if eval $compile; then
11978                 if ./try >/dev/null 2>&1; then
11979                         echo "POSIX sigsetjmp found." >&4
11980                         val="$define"
11981                 else
11982                         $cat >&4 <<EOM
11983 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11984 I'll ignore them.
11985 EOM
11986                         val="$undef"
11987                 fi
11988         else
11989                 echo "sigsetjmp not found." >&4
11990                 val="$undef"
11991         fi
11992         ;;
11993 *) val="$d_sigsetjmp"
11994         case "$d_sigsetjmp" in
11995         $define) echo "POSIX sigsetjmp found." >&4;;
11996         $undef) echo "sigsetjmp not found." >&4;;
11997         esac
11998         ;;
11999 esac
12000 set d_sigsetjmp
12001 eval $setvar
12002 $rm -f try.c try
12003
12004 : see if sockatmark exists
12005 set sockatmark d_sockatmark
12006 eval $inlibc
12007
12008 : see if prototype for sockatmark is available
12009 echo " "
12010 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12011 eval $hasproto
12012
12013 : see if socks5_init exists
12014 set socks5_init d_socks5_init
12015 eval $inlibc
12016
12017 : see if prototype for setresgid is available
12018 echo " "
12019 set d_sresgproto setresgid $i_unistd unistd.h
12020 eval $hasproto
12021
12022 : see if prototype for setresuid is available
12023 echo " "
12024 set d_sresuproto setresuid $i_unistd unistd.h
12025 eval $hasproto
12026
12027 : see if sys/stat.h is available
12028 set sys/stat.h i_sysstat
12029 eval $inhdr
12030
12031
12032 : see if stat knows about block sizes
12033 echo " "
12034 echo "Checking to see if your struct stat has st_blocks field..." >&4
12035 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12036 eval $hasfield
12037
12038
12039 : see if this is a sys/vfs.h system
12040 set sys/vfs.h i_sysvfs
12041 eval $inhdr
12042
12043
12044 : see if this is a sys/statfs.h system
12045 set sys/statfs.h i_sysstatfs
12046 eval $inhdr
12047
12048
12049 echo " "
12050 echo "Checking to see if your system supports struct statfs..." >&4
12051 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
12052 eval $hasstruct
12053 case "$d_statfs_s" in
12054 "$define")      echo "Yes, it does."   ;;
12055 *)              echo "No, it doesn't." ;;
12056 esac
12057
12058
12059
12060 : see if struct statfs knows about f_flags
12061 case "$d_statfs_s" in
12062 define) 
12063         echo " "
12064         echo "Checking to see if your struct statfs has f_flags field..." >&4
12065         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
12066         eval $hasfield
12067         ;;
12068 *)      val="$undef"
12069         set d_statfs_f_flags
12070         eval $setvar
12071         ;;
12072 esac
12073 case "$d_statfs_f_flags" in
12074 "$define")      echo "Yes, it does."   ;;
12075 *)              echo "No, it doesn't." ;;
12076 esac
12077
12078 : see if _ptr and _cnt from stdio act std
12079 echo " "
12080
12081 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12082         echo "(Looks like you have stdio.h from BSD.)"
12083         case "$stdio_ptr" in
12084         '') stdio_ptr='((fp)->_p)'
12085                 ptr_lval=$define
12086                 ;;
12087         *)      ptr_lval=$d_stdio_ptr_lval;;
12088         esac
12089         case "$stdio_cnt" in
12090         '') stdio_cnt='((fp)->_r)'
12091                 cnt_lval=$define
12092                 ;;
12093         *)      cnt_lval=$d_stdio_cnt_lval;;
12094         esac
12095         case "$stdio_base" in
12096         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12097         esac
12098         case "$stdio_bufsiz" in
12099         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12100         esac
12101 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12102         echo "(Looks like you have stdio.h from Linux.)"
12103         case "$stdio_ptr" in
12104         '') stdio_ptr='((fp)->_IO_read_ptr)'
12105                 ptr_lval=$define
12106                 ;;
12107         *)      ptr_lval=$d_stdio_ptr_lval;;
12108         esac
12109         case "$stdio_cnt" in
12110         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12111                 cnt_lval=$undef
12112                 ;;
12113         *)      cnt_lval=$d_stdio_cnt_lval;;
12114         esac
12115         case "$stdio_base" in
12116         '') stdio_base='((fp)->_IO_read_base)';;
12117         esac
12118         case "$stdio_bufsiz" in
12119         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12120         esac
12121 else
12122         case "$stdio_ptr" in
12123         '') stdio_ptr='((fp)->_ptr)'
12124                 ptr_lval=$define
12125                 ;;
12126         *)      ptr_lval=$d_stdio_ptr_lval;;
12127         esac
12128         case "$stdio_cnt" in
12129         '') stdio_cnt='((fp)->_cnt)'
12130                 cnt_lval=$define
12131                 ;;
12132         *)      cnt_lval=$d_stdio_cnt_lval;;
12133         esac
12134         case "$stdio_base" in
12135         '') stdio_base='((fp)->_base)';;
12136         esac
12137         case "$stdio_bufsiz" in
12138         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12139         esac
12140 fi
12141
12142 : test whether _ptr and _cnt really work
12143 echo "Checking how std your stdio is..." >&4
12144 $cat >try.c <<EOP
12145 #include <stdio.h>
12146 #define FILE_ptr(fp)    $stdio_ptr
12147 #define FILE_cnt(fp)    $stdio_cnt
12148 int main() {
12149         FILE *fp = fopen("try.c", "r");
12150         char c = getc(fp);
12151         if (
12152                 18 <= FILE_cnt(fp) &&
12153                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12154         )
12155                 exit(0);
12156         exit(1);
12157 }
12158 EOP
12159 val="$undef"
12160 set try
12161 if eval $compile; then
12162         if ./try; then
12163                 echo "Your stdio acts pretty std."
12164                 val="$define"
12165         else
12166                 echo "Your stdio isn't very std."
12167         fi
12168 else
12169         echo "Your stdio doesn't appear very std."
12170 fi
12171 $rm -f try.c try
12172 set d_stdstdio
12173 eval $setvar
12174
12175 : Can _ptr be used as an lvalue?
12176 case "$d_stdstdio$ptr_lval" in
12177 $define$define) val=$define ;;
12178 *) val=$undef ;;
12179 esac
12180 set d_stdio_ptr_lval
12181 eval $setvar
12182
12183 : Can _cnt be used as an lvalue?
12184 case "$d_stdstdio$cnt_lval" in
12185 $define$define) val=$define ;;
12186 *) val=$undef ;;
12187 esac
12188 set d_stdio_cnt_lval
12189 eval $setvar
12190
12191
12192 : test whether setting _ptr sets _cnt as a side effect
12193 d_stdio_ptr_lval_sets_cnt="$undef"
12194 d_stdio_ptr_lval_nochange_cnt="$undef"
12195 case "$d_stdio_ptr_lval$d_stdstdio" in
12196 $define$define)
12197         echo "Checking to see what happens if we set the stdio ptr..." >&4
12198 $cat >try.c <<EOP
12199 #include <stdio.h>
12200 /* Can we scream? */
12201 /* Eat dust sed :-) */
12202 /* In the buffer space, no one can hear you scream. */
12203 #define FILE_ptr(fp)    $stdio_ptr
12204 #define FILE_cnt(fp)    $stdio_cnt
12205 #include <sys/types.h>
12206 int main() {
12207         FILE *fp = fopen("try.c", "r");
12208         int c;
12209         char *ptr;
12210         size_t cnt;
12211         if (!fp) {
12212             puts("Fail even to read");
12213             exit(1);
12214         }
12215         c = getc(fp); /* Read away the first # */
12216         if (c == EOF) {
12217             puts("Fail even to read");
12218             exit(1);
12219         }
12220         if (!(
12221                 18 <= FILE_cnt(fp) &&
12222                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12223         )) {
12224                 puts("Fail even to read");
12225                 exit (1);
12226         }
12227         ptr = (char*) FILE_ptr(fp);
12228         cnt = (size_t)FILE_cnt(fp);
12229
12230         FILE_ptr(fp) += 42;
12231
12232         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12233                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12234                 exit (1);
12235         }
12236         if (FILE_cnt(fp) <= 20) {
12237                 printf ("Fail (<20 chars to test)");
12238                 exit (1);
12239         }
12240         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12241                 puts("Fail compare");
12242                 exit (1);
12243         }
12244         if (cnt == FILE_cnt(fp)) {
12245                 puts("Pass_unchanged");
12246                 exit (0);
12247         }       
12248         if (FILE_cnt(fp) == (cnt - 42)) {
12249                 puts("Pass_changed");
12250                 exit (0);
12251         }
12252         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12253         return 1;
12254
12255 }
12256 EOP
12257         set try
12258         if eval $compile; then
12259                 case `./try$exe_ext` in
12260                 Pass_changed)
12261                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12262                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12263                 Pass_unchanged)
12264                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12265                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12266                 Fail*)
12267                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12268                 *)
12269                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12270         esac
12271         else
12272                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12273         fi
12274         $rm -f try.c try
12275         ;;
12276 esac
12277
12278 : see if _base is also standard
12279 val="$undef"
12280 case "$d_stdstdio" in
12281 $define)
12282         $cat >try.c <<EOP
12283 #include <stdio.h>
12284 #define FILE_base(fp)   $stdio_base
12285 #define FILE_bufsiz(fp) $stdio_bufsiz
12286 int main() {
12287         FILE *fp = fopen("try.c", "r");
12288         char c = getc(fp);
12289         if (
12290                 19 <= FILE_bufsiz(fp) &&
12291                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12292         )
12293                 exit(0);
12294         exit(1);
12295 }
12296 EOP
12297         set try
12298         if eval $compile; then
12299                 if ./try; then
12300                         echo "And its _base field acts std."
12301                         val="$define"
12302                 else
12303                         echo "But its _base field isn't std."
12304                 fi
12305         else
12306                 echo "However, it seems to be lacking the _base field."
12307         fi
12308         $rm -f try.c try
12309         ;;
12310 esac
12311 set d_stdiobase
12312 eval $setvar
12313
12314 $cat >&4 <<EOM
12315 Checking how to access stdio streams by file descriptor number...
12316 EOM
12317 case "$stdio_stream_array" in
12318 '')     $cat >try.c <<EOCP
12319 #include <stdio.h>
12320 int main() {
12321   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12322     printf("yes\n");
12323 }
12324 EOCP
12325         for s in _iob __iob __sF
12326         do
12327                 set try -DSTDIO_STREAM_ARRAY=$s
12328                 if eval $compile; then
12329                         case "`./try$exe_ext`" in
12330                         yes)    stdio_stream_array=$s; break ;;
12331                         esac
12332                 fi
12333         done
12334         $rm -f try.* try$exe_ext
12335 esac
12336 case "$stdio_stream_array" in
12337 '')     $cat >&4 <<EOM
12338 I can't figure out how to access stdio streams by file descriptor number.
12339 EOM
12340         d_stdio_stream_array="$undef"
12341         ;;
12342 *)      $cat >&4 <<EOM
12343 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12344 EOM
12345         d_stdio_stream_array="$define"
12346         ;;
12347 esac
12348
12349 : see if strcoll exists
12350 set strcoll d_strcoll
12351 eval $inlibc
12352
12353 : check for structure copying
12354 echo " "
12355 echo "Checking to see if your C compiler can copy structs..." >&4
12356 $cat >try.c <<'EOCP'
12357 int main()
12358 {
12359         struct blurfl {
12360                 int dyick;
12361         } foo, bar;
12362
12363         foo = bar;
12364 }
12365 EOCP
12366 if $cc -c try.c >/dev/null 2>&1 ; then
12367         val="$define"
12368         echo "Yup, it can."
12369 else
12370         val="$undef"
12371         echo "Nope, it can't."
12372 fi
12373 set d_strctcpy
12374 eval $setvar
12375 $rm -f try.*
12376
12377 : see if strerror and/or sys_errlist[] exist
12378 echo " "
12379 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12380     if set strerror val -f d_strerror; eval $csym; $val; then
12381                 echo 'strerror() found.' >&4
12382                 d_strerror="$define"
12383                 d_strerrm='strerror(e)'
12384                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12385                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12386                         d_syserrlst="$define"
12387                 else
12388                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12389                         d_syserrlst="$undef"
12390                 fi
12391     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12392                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12393                 echo 'strerror() found in string header.' >&4
12394                 d_strerror="$define"
12395                 d_strerrm='strerror(e)'
12396                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12397                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12398                                 d_syserrlst="$define"
12399                 else
12400                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12401                         d_syserrlst="$undef"
12402                 fi
12403     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12404                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12405                 d_strerror="$undef"
12406                 d_syserrlst="$define"
12407                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12408     else
12409                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12410                 d_strerror="$undef"
12411                 d_syserrlst="$undef"
12412                 d_strerrm='"unknown"'
12413     fi
12414 fi
12415
12416 : see if strftime exists
12417 set strftime d_strftime
12418 eval $inlibc
12419
12420 : see if strtod exists
12421 set strtod d_strtod
12422 eval $inlibc
12423
12424 : see if strtol exists
12425 set strtol d_strtol
12426 eval $inlibc
12427
12428 : see if strtold exists
12429 set strtold d_strtold
12430 eval $inlibc
12431
12432 : see if strtoll exists
12433 set strtoll d_strtoll
12434 eval $inlibc
12435
12436 case "$d_longlong-$d_strtoll" in
12437 "$define-$define")
12438         $cat <<EOM
12439 Checking whether your strtoll() works okay...
12440 EOM
12441         $cat >try.c <<'EOCP'
12442 #include <errno.h>
12443 #ifdef __hpux
12444 #define strtoll __strtoll
12445 #endif
12446 #ifdef __EMX__
12447 #define strtoll _strtoll
12448 #endif
12449 #include <stdio.h>
12450 extern long long int strtoll(char *s, char **, int); 
12451 static int bad = 0;
12452 int check(char *s, long long ell, int een) {
12453         long long gll;
12454         errno = 0;
12455         gll = strtoll(s, 0, 10);
12456         if (!((gll == ell) && (errno == een)))
12457                 bad++;
12458 }
12459 int main() {
12460         check(" 1",                                      1LL, 0);
12461         check(" 0",                                      0LL, 0);
12462         check("-1",                                     -1LL, 0);
12463         check("-9223372036854775808", -9223372036854775808LL, 0);
12464         check("-9223372036854775808", -9223372036854775808LL, 0);
12465         check(" 9223372036854775807",  9223372036854775807LL, 0);
12466         check("-9223372036854775808", -9223372036854775808LL, 0);
12467         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12468         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12469         if (!bad)
12470                 printf("ok\n");
12471 }
12472 EOCP
12473         set try
12474         if eval $compile; then
12475                 yyy=`./try`
12476                 case "$yyy" in
12477                 ok) echo "Your strtoll() seems to be working okay." ;;
12478                 *) cat <<EOM >&4
12479 Your strtoll() doesn't seem to be working okay.
12480 EOM
12481                    d_strtoll="$undef"
12482                    ;;
12483                 esac
12484         else
12485                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12486                 d_strtoll="$undef"
12487         fi
12488         ;;
12489 esac
12490
12491 : see if strtoq exists
12492 set strtoq d_strtoq
12493 eval $inlibc
12494
12495 : see if strtoul exists
12496 set strtoul d_strtoul
12497 eval $inlibc
12498
12499 case "$d_strtoul" in
12500 "$define")
12501         $cat <<EOM
12502 Checking whether your strtoul() works okay...
12503 EOM
12504         $cat >try.c <<'EOCP'
12505 #include <errno.h>
12506 #include <stdio.h>
12507 extern unsigned long int strtoul(char *s, char **, int); 
12508 static int bad = 0;
12509 void check(char *s, unsigned long eul, int een) {
12510         unsigned long gul;
12511         errno = 0;
12512         gul = strtoul(s, 0, 10);
12513         if (!((gul == eul) && (errno == een)))
12514                 bad++;
12515 }
12516 int main() {
12517         check(" 1", 1L, 0);
12518         check(" 0", 0L, 0);
12519 EOCP
12520         case "$longsize" in
12521         8)
12522             $cat >>try.c <<'EOCP'
12523         check("18446744073709551615", 18446744073709551615UL, 0);
12524         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12525 #if 0 /* strtoul() for /^-/ strings is undefined. */
12526         check("-1", 18446744073709551615UL, 0);
12527         check("-18446744073709551614", 2, 0);
12528         check("-18446744073709551615", 1, 0);
12529         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12530         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12531 #endif
12532 EOCP
12533                 ;;
12534         4)
12535                     $cat >>try.c <<'EOCP'
12536         check("4294967295", 4294967295UL, 0);
12537         check("4294967296", 4294967295UL, ERANGE);
12538 #if 0 /* strtoul() for /^-/ strings is undefined. */
12539         check("-1", 4294967295UL, 0);
12540         check("-4294967294", 2, 0);
12541         check("-4294967295", 1, 0);
12542         check("-4294967296", 4294967295UL, ERANGE);
12543         check("-4294967297", 4294967295UL, ERANGE);
12544 #endif
12545 EOCP
12546                 ;;
12547         *)
12548 : Should we write these tests to be more portable by sprintf-ing
12549 : ~0 and then manipulating that char string as input for strtol?
12550                 ;;
12551         esac
12552         $cat >>try.c <<'EOCP'
12553         if (!bad)
12554                 printf("ok\n");
12555         return 0;
12556 }
12557 EOCP
12558         set try
12559         if eval $compile; then
12560                 case "`./try`" in
12561                 ok) echo "Your strtoul() seems to be working okay." ;;
12562                 *) cat <<EOM >&4
12563 Your strtoul() doesn't seem to be working okay.
12564 EOM
12565                    d_strtoul="$undef"
12566                    ;;
12567                 esac
12568         fi
12569         ;;
12570 esac
12571
12572 : see if strtoull exists
12573 set strtoull d_strtoull
12574 eval $inlibc
12575
12576 case "$d_longlong-$d_strtoull" in
12577 "$define-$define")
12578         $cat <<EOM
12579 Checking whether your strtoull() works okay...
12580 EOM
12581         $cat >try.c <<'EOCP'
12582 #include <errno.h>
12583 #ifdef __hpux
12584 #define strtoull __strtoull
12585 #endif
12586 #include <stdio.h>
12587 extern unsigned long long int strtoull(char *s, char **, int); 
12588 static int bad = 0;
12589 int check(char *s, long long eull, int een) {
12590         long long gull;
12591         errno = 0;
12592         gull = strtoull(s, 0, 10);
12593         if (!((gull == eull) && (errno == een)))
12594                 bad++;
12595 }
12596 int main() {
12597         check(" 1",                                        1LL, 0);
12598         check(" 0",                                        0LL, 0);
12599         check("18446744073709551615",  18446744073709551615ULL, 0);
12600         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12601 #if 0 /* strtoull() for /^-/ strings is undefined. */
12602         check("-1",                    18446744073709551615ULL, 0);
12603         check("-18446744073709551614",                     2LL, 0);
12604         check("-18446744073709551615",                     1LL, 0);
12605         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12606         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12607 #endif
12608         if (!bad)
12609                 printf("ok\n");
12610 }
12611 EOCP
12612         set try
12613         if eval $compile; then
12614                 case "`./try`" in
12615                 ok) echo "Your strtoull() seems to be working okay." ;;
12616                 *) cat <<EOM >&4
12617 Your strtoull() doesn't seem to be working okay.
12618 EOM
12619                    d_strtoull="$undef"
12620                    ;;
12621                 esac
12622         fi
12623         ;;
12624 esac
12625
12626 : see if strtouq exists
12627 set strtouq d_strtouq
12628 eval $inlibc
12629
12630 case "$d_strtouq" in
12631 "$define")
12632         $cat <<EOM
12633 Checking whether your strtouq() works okay...
12634 EOM
12635         $cat >try.c <<'EOCP'
12636 #include <errno.h>
12637 #include <stdio.h>
12638 extern unsigned long long int strtouq(char *s, char **, int); 
12639 static int bad = 0;
12640 void check(char *s, unsigned long long eull, int een) {
12641         unsigned long long gull;
12642         errno = 0;
12643         gull = strtouq(s, 0, 10);
12644         if (!((gull == eull) && (errno == een)))
12645                 bad++;
12646 }
12647 int main() {
12648         check(" 1",                                        1LL, 0);
12649         check(" 0",                                        0LL, 0);
12650         check("18446744073709551615",  18446744073709551615ULL, 0);
12651         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12652 #if 0 /* strtouq() for /^-/ strings is undefined. */
12653         check("-1",                    18446744073709551615ULL, 0);
12654         check("-18446744073709551614",                     2LL, 0);
12655         check("-18446744073709551615",                     1LL, 0);
12656         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12657         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12658 #endif
12659         if (!bad)
12660                 printf("ok\n");
12661         return 0;
12662 }
12663 EOCP
12664         set try
12665         if eval $compile; then
12666                 case "`./try`" in
12667                 ok) echo "Your strtouq() seems to be working okay." ;;
12668                 *) cat <<EOM >&4
12669 Your strtouq() doesn't seem to be working okay.
12670 EOM
12671                    d_strtouq="$undef"
12672                    ;;
12673                 esac
12674         fi
12675         ;;
12676 esac
12677
12678 : see if strxfrm exists
12679 set strxfrm d_strxfrm
12680 eval $inlibc
12681
12682 : see if symlink exists
12683 set symlink d_symlink
12684 eval $inlibc
12685
12686 : see if syscall exists
12687 set syscall d_syscall
12688 eval $inlibc
12689
12690 : see if prototype for syscall is available
12691 echo " "
12692 set d_syscallproto syscall $i_unistd unistd.h
12693 eval $hasproto
12694
12695 : see if sysconf exists
12696 set sysconf d_sysconf
12697 eval $inlibc
12698
12699 : see if system exists
12700 set system d_system
12701 eval $inlibc
12702
12703 : see if tcgetpgrp exists
12704 set tcgetpgrp d_tcgetpgrp
12705 eval $inlibc
12706
12707 : see if tcsetpgrp exists
12708 set tcsetpgrp d_tcsetpgrp
12709 eval $inlibc
12710
12711 : see if prototype for telldir is available
12712 echo " "
12713 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12714 eval $hasproto
12715
12716 : see if this is a sys/times.h system
12717 set sys/times.h i_systimes
12718 eval $inhdr
12719
12720 : see if times exists
12721 echo " "
12722 if set times val -f d_times; eval $csym; $val; then
12723         echo 'times() found.' >&4
12724         d_times="$define"
12725         inc=''
12726         case "$i_systimes" in
12727         "$define") inc='sys/times.h';;
12728         esac
12729         rp="What is the type returned by times() on this system?"
12730         set clock_t clocktype long stdio.h sys/types.h $inc
12731         eval $typedef_ask
12732 else
12733         echo 'times() NOT found, hope that will do.' >&4
12734         d_times="$undef"
12735         clocktype='int'
12736 fi
12737
12738 : see if truncate exists
12739 set truncate d_truncate
12740 eval $inlibc
12741
12742 : see if tzname[] exists
12743 echo " "
12744 if set tzname val -a d_tzname; eval $csym; $val; then
12745         val="$define"
12746         echo 'tzname[] found.' >&4
12747 else
12748         val="$undef"
12749         echo 'tzname[] NOT found.' >&4
12750 fi
12751 set d_tzname
12752 eval $setvar
12753
12754 case "$crosscompile" in
12755 ''|[nN]*) crosscompile="$undef" ;;
12756 esac
12757
12758 case "$osname" in
12759 next|rhapsody|darwin) multiarch="$define" ;;
12760 esac
12761 case "$multiarch" in
12762 ''|[nN]*) multiarch="$undef" ;;
12763 esac
12764
12765 : check for ordering of bytes in a long
12766 echo " "
12767 case "$crosscompile$multiarch" in
12768 *$define*)
12769         $cat <<EOM
12770 You seem to be either cross-compiling or doing a multiarchitecture build,
12771 skipping the byteorder check.
12772
12773 EOM
12774         byteorder='0xffff'
12775         ;;
12776 *)
12777         case "$byteorder" in
12778         '')
12779                 $cat <<'EOM'
12780 In the following, larger digits indicate more significance.  A big-endian
12781 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12782 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12783 machines may have weird orders like 3412.  A Cray will report 87654321,
12784 an Alpha will report 12345678. If the test program works the default is
12785 probably right.
12786 I'm now running the test program...
12787 EOM
12788                 $cat >try.c <<'EOCP'
12789 #include <stdio.h>
12790 int main()
12791 {
12792         int i;
12793         union {
12794                 unsigned long l;
12795                 char c[sizeof(long)];
12796         } u;
12797
12798         if (sizeof(long) > 4)
12799                 u.l = (0x08070605L << 32) | 0x04030201L;
12800         else
12801                 u.l = 0x04030201L;
12802         for (i = 0; i < sizeof(long); i++)
12803                 printf("%c", u.c[i]+'0');
12804         printf("\n");
12805         exit(0);
12806 }
12807 EOCP
12808                 xxx_prompt=y
12809                 set try
12810                 if eval $compile && ./try > /dev/null; then
12811                         dflt=`./try`
12812                         case "$dflt" in
12813                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12814                                 echo "(The test program ran ok.)"
12815                                 echo "byteorder=$dflt"
12816                                 xxx_prompt=n
12817                         ;;
12818                         ????|????????) echo "(The test program ran ok.)" ;;
12819                         *) echo "(The test program didn't run right for some reason.)" ;;
12820                         esac
12821                 else
12822                         dflt='4321'
12823                         cat <<'EOM'
12824 (I can't seem to compile the test program.  Guessing big-endian...)
12825 EOM
12826                 fi
12827                 case "$xxx_prompt" in
12828                 y)
12829                         rp="What is the order of bytes in a long?"
12830                         . ./myread
12831                         byteorder="$ans"
12832                         ;;
12833                 *)      byteorder=$dflt
12834                         ;;
12835                 esac
12836                 ;;
12837         esac
12838         $rm -f try.c try
12839         ;;
12840 esac
12841
12842
12843 $cat <<EOM
12844
12845 Checking to see whether you can access character data unalignedly...
12846 EOM
12847 $cat >try.c <<EOCP
12848 #include <stdio.h>
12849 #define U32 $u32type
12850 #define BYTEORDER $byteorder
12851 int main() {
12852 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12853     U8 buf[] = "\0\0\0\1\0\0\0\0";
12854     U32 *up;
12855     int i;
12856
12857     if (sizeof(U32) != 4) {
12858         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12859         exit(1);
12860     }
12861
12862     fflush(stdout);
12863
12864     for (i = 0; i < 4; i++) {
12865         up = (U32*)(buf + i);
12866         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12867                (*up == 1 << (8*(3-i)))  /* little-endian */
12868               )
12869            )
12870         {
12871             printf("read failed (%x)\n", *up);
12872             exit(2);
12873         }
12874     }
12875
12876     /* write test */
12877     for (i = 0; i < 4; i++) {
12878         up = (U32*)(buf + i);
12879         *up = 0xBeef;
12880         if (*up != 0xBeef) {
12881             printf("write failed (%x)\n", *up);
12882             exit(3);
12883         }
12884     }
12885
12886     exit(0);
12887 #else
12888     printf("1\n");
12889     exit(1);
12890 #endif
12891     return 0;
12892 }
12893 EOCP
12894 set try
12895 if eval $compile_ok; then
12896         echo "(Testign for character data alignment may dump core.)" >&4
12897         ./try 2>&1 >/dev/null
12898         case "$?" in
12899         0)      cat >&4 <<EOM
12900 You can access character data pretty unalignedly.
12901 EOM
12902                 d_u32align="$undef"
12903                 ;;
12904         *)      cat >&4 <<EOM
12905 It seems that you must access character data in an aligned manner.
12906 EOM
12907                 d_u32align="$define"
12908                 ;;
12909         esac
12910         $rm -f core core.try.* try.core
12911 else
12912         rp='Can you access character data at unaligned addresses?'
12913         dflt='n'
12914         . ./myread
12915         case "$ans" in
12916         [yY]*)  d_u32align="$undef"  ;;
12917         *)      d_u32align="$define" ;;
12918         esac
12919 fi
12920
12921 : see if ualarm exists
12922 set ualarm d_ualarm
12923 eval $inlibc
12924
12925 : see if umask exists
12926 set umask d_umask
12927 eval $inlibc
12928
12929 : see if usleep exists
12930 set usleep d_usleep
12931 eval $inlibc
12932
12933 : see if prototype for usleep is available
12934 echo " "
12935 set d_usleepproto usleep $i_unistd unistd.h
12936 eval $hasproto
12937
12938 : see if ustat exists
12939 set ustat d_ustat
12940 eval $inlibc
12941
12942 : backward compatibility for d_hvfork
12943 if test X$d_hvfork != X; then
12944         d_vfork="$d_hvfork"
12945         d_hvfork=''
12946 fi
12947 : see if there is a vfork
12948 val=''
12949 set vfork val
12950 eval $inlibc
12951
12952 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12953 : perl on Solaris 2.x, and probably elsewhere.
12954 case "$val" in
12955 $define)
12956         echo " "
12957         case "$usevfork" in
12958         false) dflt='n';;
12959         *) dflt='y';;
12960         esac
12961         cat <<'EOM'
12962  
12963 Perl can only use a vfork() that doesn't suffer from strict
12964 restrictions on calling functions or modifying global data in
12965 the child.  For example, glibc-2.1 contains such a vfork()
12966 that is unsuitable.  If your system provides a proper fork()
12967 call, chances are that you do NOT want perl to use vfork().
12968
12969 EOM
12970         rp="Do you still want to use vfork()?"
12971         . ./myread
12972         case "$ans" in
12973         y|Y) ;;
12974         *)
12975                 echo "Ok, we won't use vfork()."
12976                 val="$undef"
12977                 ;;
12978         esac
12979         ;;
12980 esac
12981 set d_vfork
12982 eval $setvar
12983 case "$d_vfork" in
12984 $define) usevfork='true';;
12985 *) usevfork='false';;
12986 esac
12987
12988 : see if this is an sysdir system
12989 set sys/dir.h i_sysdir
12990 eval $inhdr
12991
12992 : see if this is an sysndir system
12993 set sys/ndir.h i_sysndir
12994 eval $inhdr
12995
12996 : see if closedir exists
12997 set closedir d_closedir
12998 eval $inlibc
12999
13000 case "$d_closedir" in
13001 "$define")
13002         echo " "
13003         echo "Checking whether closedir() returns a status..." >&4
13004         cat > closedir.c <<EOM
13005 #$i_dirent I_DIRENT             /**/
13006 #$i_sysdir I_SYS_DIR            /**/
13007 #$i_sysndir I_SYS_NDIR          /**/
13008 #$i_systypes I_SYS_TYPES        /**/
13009
13010 #if defined(I_SYS_TYPES)
13011 #include <sys/types.h>
13012 #endif
13013 #if defined(I_DIRENT)
13014 #include <dirent.h>
13015 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13016 #include <sys/dir.h>
13017 #endif
13018 #else
13019 #ifdef I_SYS_NDIR
13020 #include <sys/ndir.h>
13021 #else
13022 #ifdef I_SYS_DIR
13023 #ifdef hp9000s500
13024 #include <ndir.h>       /* may be wrong in the future */
13025 #else
13026 #include <sys/dir.h>
13027 #endif
13028 #endif
13029 #endif
13030 #endif 
13031 int main() { return closedir(opendir(".")); }
13032 EOM
13033         set closedir
13034         if eval $compile_ok; then
13035                 if ./closedir > /dev/null 2>&1 ; then
13036                         echo "Yes, it does."
13037                         val="$undef"
13038                 else
13039                         echo "No, it doesn't."
13040                         val="$define"
13041                 fi
13042         else
13043                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13044                 val="$define"
13045         fi
13046         ;;
13047 *)
13048         val="$undef";
13049         ;;
13050 esac
13051 set d_void_closedir
13052 eval $setvar
13053 $rm -f closedir*
13054 : see if there is a wait4
13055 set wait4 d_wait4
13056 eval $inlibc
13057
13058 : see if waitpid exists
13059 set waitpid d_waitpid
13060 eval $inlibc
13061
13062 : see if wcstombs exists
13063 set wcstombs d_wcstombs
13064 eval $inlibc
13065
13066 : see if wctomb exists
13067 set wctomb d_wctomb
13068 eval $inlibc
13069
13070 : see if writev exists
13071 set writev d_writev
13072 eval $inlibc
13073
13074 : preserve RCS keywords in files with variable substitution, grrr
13075 Date='$Date'
13076 Id='$Id'
13077 Log='$Log'
13078 RCSfile='$RCSfile'
13079 Revision='$Revision'
13080
13081 : check for alignment requirements
13082 echo " "
13083 case "$crosscompile$multiarch" in
13084 *$define*)
13085         $cat <<EOM
13086 You seem to be either cross-compiling or doing a multiarchitecture build,
13087 skipping the memory alignment check.
13088
13089 EOM
13090         case "$alignbytes" in
13091         '') alignbytes=8 ;;
13092         esac
13093         ;;
13094 *)
13095         case "$alignbytes" in
13096         '') echo "Checking alignment constraints..." >&4
13097                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13098                         $cat >try.c <<'EOCP'
13099 typedef long double NV;
13100 EOCP
13101                 else
13102                         $cat >try.c <<'EOCP'
13103 typedef double NV;
13104 EOCP
13105                 fi
13106                 $cat >>try.c <<'EOCP'
13107 #include <stdio.h>
13108 struct foobar {
13109         char foo;
13110         NV bar;
13111 } try_algn;
13112 int main()
13113 {
13114     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13115     return(0);
13116 }
13117 EOCP
13118                 set try
13119                 if eval $compile_ok; then
13120                         dflt=`./try`
13121                 else
13122                         dflt='8'
13123                         echo "(I can't seem to compile the test program...)"
13124                 fi
13125                 ;;
13126         *) dflt="$alignbytes"
13127                 ;;
13128         esac
13129         rp="Doubles must be aligned on a how-many-byte boundary?"
13130         . ./myread
13131         alignbytes="$ans"
13132         $rm -f try.c try
13133         ;;
13134 esac
13135
13136
13137 : set the base revision
13138 baserev=5.0
13139
13140 : how do we catenate cpp tokens here?
13141 echo " "
13142 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13143 $cat >cpp_stuff.c <<'EOCP'
13144 #define RCAT(a,b)a/**/b
13145 #define ACAT(a,b)a ## b
13146 RCAT(Rei,ser)
13147 ACAT(Cir,cus)
13148 EOCP
13149 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13150 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13151         echo "Oh!  Smells like ANSI's been here." >&4
13152         echo "We can catify or stringify, separately or together!"
13153         cpp_stuff=42
13154 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13155         echo "Ah, yes!  The good old days!" >&4
13156         echo "However, in the good old days we don't know how to stringify and"
13157         echo "catify at the same time."
13158         cpp_stuff=1
13159 else
13160         $cat >&4 <<EOM
13161 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13162 to have to edit the values of CAT[2-5] in config.h...
13163 EOM
13164         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13165 fi
13166 $rm -f cpp_stuff.*
13167
13168 : see if this is a db.h system
13169 set db.h i_db
13170 eval $inhdr
13171
13172 case "$i_db" in
13173 $define)
13174         : Check db version.
13175         echo " "
13176         echo "Checking Berkeley DB version ..." >&4
13177         $cat >try.c <<EOCP
13178 #$d_const HASCONST
13179 #ifndef HASCONST
13180 #define const
13181 #endif
13182 #include <sys/types.h>
13183 #include <stdio.h>
13184 #include <db.h>
13185 int main(int argc, char *argv[])
13186 {
13187 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13188     int Major, Minor, Patch ;
13189     unsigned long Version ;
13190     (void)db_version(&Major, &Minor, &Patch) ;
13191     if (argc == 2) {
13192         printf("%d %d %d %d %d %d\n",
13193                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13194                Major, Minor, Patch);
13195         exit(0);
13196     }
13197     printf("You have Berkeley DB Version 2 or greater.\n");
13198
13199     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13200                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13201     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13202                 Major, Minor, Patch) ;
13203
13204     /* check that db.h & libdb are compatible */
13205     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13206         printf("db.h and libdb are incompatible.\n") ;
13207         exit(3);        
13208     }
13209
13210     printf("db.h and libdb are compatible.\n") ;
13211
13212     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13213                 + DB_VERSION_PATCH ;
13214
13215     /* needs to be >= 2.3.4 */
13216     if (Version < 2003004) {
13217     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13218         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13219         exit(2);        
13220     }
13221
13222     exit(0);
13223 #else
13224 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13225     if (argc == 2) {
13226         printf("1 0 0\n");
13227         exit(0);
13228     }
13229     printf("You have Berkeley DB Version 1.\n");
13230     exit(0);    /* DB version < 2: the coast is clear. */
13231 #else
13232     exit(1);    /* <db.h> not Berkeley DB? */
13233 #endif
13234 #endif
13235 }
13236 EOCP
13237         set try
13238         if eval $compile_ok && ./try; then
13239                 echo 'Looks OK.' >&4
13240                 set `./try 1`
13241                 db_version_major=$1
13242                 db_version_minor=$2
13243                 db_version_patch=$3
13244         else
13245                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13246                 i_db=$undef
13247                 case " $libs " in
13248                 *"-ldb "*)
13249                         : Remove db from list of libraries to use
13250                         echo "Removing unusable -ldb from library list" >&4
13251                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13252                         shift
13253                         libs="$*"
13254                         echo "libs = $libs" >&4
13255                         ;;
13256                 esac
13257         fi
13258         $rm -f try.*
13259         ;;
13260 esac
13261
13262 case "$i_db" in
13263 define)
13264         : Check the return type needed for hash 
13265         echo " "
13266         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13267         $cat >try.c <<EOCP
13268 #$d_const HASCONST
13269 #ifndef HASCONST
13270 #define const
13271 #endif
13272 #include <sys/types.h>
13273 #include <db.h>
13274
13275 #ifndef DB_VERSION_MAJOR
13276 u_int32_t hash_cb (ptr, size)
13277 const void *ptr;
13278 size_t size;
13279 {
13280 }
13281 HASHINFO info;
13282 int main()
13283 {
13284         info.hash = hash_cb;
13285 }
13286 #endif
13287 EOCP
13288         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13289                 if $contains warning try.out >>/dev/null 2>&1 ; then
13290                         db_hashtype='int'
13291                 else
13292                         db_hashtype='u_int32_t'
13293                 fi
13294         else
13295                 : XXX Maybe we should just give up here.
13296                 db_hashtype=u_int32_t
13297                 $cat try.out >&4
13298                 echo "Help:  I can't seem to compile the db test program." >&4
13299                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13300         fi
13301         $rm -f try.*
13302         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13303         ;;
13304 *)      db_hashtype=u_int32_t
13305         ;;
13306 esac
13307 case "$i_db" in
13308 define)
13309         : Check the return type needed for prefix 
13310         echo " "
13311         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13312         cat >try.c <<EOCP
13313 #$d_const HASCONST
13314 #ifndef HASCONST
13315 #define const
13316 #endif
13317 #include <sys/types.h>
13318 #include <db.h>
13319
13320 #ifndef DB_VERSION_MAJOR
13321 size_t prefix_cb (key1, key2)
13322 const DBT *key1;
13323 const DBT *key2;
13324 {
13325 }
13326 BTREEINFO info;
13327 int main()
13328 {
13329         info.prefix = prefix_cb;
13330 }
13331 #endif
13332 EOCP
13333         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13334                 if $contains warning try.out >>/dev/null 2>&1 ; then
13335                         db_prefixtype='int'
13336                 else
13337                         db_prefixtype='size_t'
13338                 fi
13339         else
13340                 db_prefixtype='size_t'
13341                 : XXX Maybe we should just give up here.
13342                 $cat try.out >&4
13343                 echo "Help:  I can't seem to compile the db test program." >&4
13344                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13345         fi
13346         $rm -f try.*
13347         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13348         ;;
13349 *)      db_prefixtype='size_t'
13350         ;;
13351 esac
13352
13353
13354 : How can we generate normalized random numbers ?
13355 echo " "
13356 echo "Looking for a random number function..." >&4
13357 case "$randfunc" in
13358 '')
13359         if set drand48 val -f; eval $csym; $val; then
13360                 dflt="drand48"
13361                 echo "Good, found drand48()." >&4
13362         elif set random val -f; eval $csym; $val; then
13363                 dflt="random"
13364                 echo "OK, found random()." >&4
13365         else
13366                 dflt="rand"
13367                 echo "Yick, looks like I have to use rand()." >&4
13368         fi
13369         echo " "
13370         ;;
13371 *)
13372         dflt="$randfunc"
13373         ;;
13374 esac
13375 cont=true
13376
13377 case "$ccflags" in
13378 *-Dmy_rand=*|*-Dmy_srand=*)
13379         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13380         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13381         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13382         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13383         ;;
13384 esac
13385
13386 while $test "$cont"; do
13387         rp="Use which function to generate random numbers?"
13388         . ./myread
13389         if $test "$ans" = "$dflt"; then
13390                 : null
13391         else
13392                 randbits=''
13393         fi
13394         randfunc="$ans"
13395         if set $ans val -f; eval $csym; $val; then
13396                 cont=''
13397         else
13398                 dflt=y
13399                 rp="I cannot find function $ans. Use that name anyway?"
13400                 . ./myread
13401                 dflt=rand
13402                 case "$ans" in
13403                         [yY]*) cont='';;
13404                 esac
13405         fi
13406         case "$cont" in
13407         '')
13408                 case "$randfunc" in
13409                 drand48)
13410                         drand01="drand48()"
13411                         seedfunc="srand48"
13412                         randbits=48
13413                         randseedtype=long
13414                         ;;
13415                 rand|random)
13416                         case "$randbits" in
13417                         '')
13418 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13419                                 $cat >try.c <<EOCP
13420 #$i_unistd I_UNISTD
13421 #$i_stdlib I_STDLIB
13422 #include <stdio.h>
13423 #ifdef I_UNISTD
13424 #  include <unistd.h>
13425 #endif
13426 #ifdef I_STDLIB
13427 #  include <stdlib.h>
13428 #endif
13429 int main()
13430 {
13431         register int i;
13432         register unsigned long tmp;
13433         register unsigned long max = 0L;
13434
13435         for (i = 1000; i; i--) {
13436                 tmp = (unsigned long) $randfunc();
13437                 if (tmp > max) max = tmp;
13438         }
13439         for (i = 0; max; i++)
13440                 max /= 2;
13441         printf("%d\n",i);
13442 }
13443 EOCP
13444                                 set try
13445                                 if eval $compile_ok; then
13446                                         dflt=`try`
13447                                 else
13448                                         dflt='?'
13449                                         echo "(I can't seem to compile the test program...)"
13450                                 fi
13451                                 ;;
13452                         *)
13453                                 dflt="$randbits"
13454                                 ;;
13455                         esac
13456                         rp="How many bits does your $randfunc() function produce?"
13457                         . ./myread
13458                         randbits="$ans"
13459                         $rm -f try.c try
13460                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13461                         seedfunc="s$randfunc"
13462                         randseedtype=unsigned
13463                         ;;
13464                 *)
13465                         dflt="31"
13466                         rp="How many bits does your $randfunc() function produce?"
13467                         . ./myread
13468                         randbits="$ans"
13469                         seedfunc="s$randfunc"
13470                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13471                         if set $seedfunc val -f; eval $csym; $val; then
13472                                 echo "(Using $seedfunc() to seed random generator)"
13473                         else
13474                                 echo "(Warning: no $seedfunc() to seed random generator)"
13475                                 seedfunc=rand
13476                         fi
13477                         randseedtype=unsigned
13478                         ;;
13479                 esac
13480                 ;;
13481         esac
13482 done
13483
13484 echo " "
13485 echo "Determining whether or not we are on an EBCDIC system..." >&4
13486 $cat >tebcdic.c <<'EOM'
13487 int main()
13488 {
13489   if ('M'==0xd4) return 0;
13490   return 1;
13491 }
13492 EOM
13493
13494 val=$undef
13495 set tebcdic
13496 if eval $compile_ok; then
13497         if ./tebcdic; then
13498                 echo "You seem to speak EBCDIC." >&4
13499                 val="$define"
13500         else
13501                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13502         fi
13503 else
13504         echo "I'm unable to compile the test program." >&4
13505         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13506 fi
13507 $rm -f tebcdic.c tebcdic
13508 set ebcdic
13509 eval $setvar
13510
13511 echo " "
13512 $cat >&4 <<EOM
13513 Checking how to flush all pending stdio output...
13514 EOM
13515 # I only know how to find the first 32 possibly open files on SunOS.
13516 # See also hints/sunos_4_1.sh and util.c  --AD
13517 case "$osname" in
13518 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13519 esac
13520 $cat >>try.c <<EOCP
13521 #include <stdio.h>
13522 #$i_unistd I_UNISTD
13523 #ifdef I_UNISTD
13524 # include <unistd.h>
13525 #endif
13526 #$d_sysconf HAS_SYSCONF
13527 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13528 #ifdef HAS_STDIO_STREAM_ARRAY
13529 # define STDIO_STREAM_ARRAY $stdio_stream_array
13530 #endif
13531 int main() {
13532   FILE* p = fopen("try.out", "w");
13533 #ifdef TRY_FPUTC
13534   fputc('x', p);
13535 #else
13536 # ifdef TRY_FPRINTF
13537   fprintf(p, "x");
13538 # endif
13539 #endif
13540 #ifdef TRY_FFLUSH_NULL
13541   fflush(NULL);
13542 #endif
13543 #ifdef TRY_FFLUSH_ALL
13544   {
13545     long open_max = -1;
13546 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13547     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13548 # else
13549 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13550     open_max = sysconf(_SC_OPEN_MAX);
13551 #  else
13552 #   ifdef FOPEN_MAX
13553     open_max = FOPEN_MAX;
13554 #   else
13555 #    ifdef OPEN_MAX
13556     open_max = OPEN_MAX;
13557 #    else
13558 #     ifdef _NFILE
13559     open_max = _NFILE;
13560 #     endif
13561 #    endif
13562 #   endif
13563 #  endif
13564 # endif 
13565 # ifdef HAS_STDIO_STREAM_ARRAY
13566     if (open_max > 0) {
13567       long i;
13568       for (i = 0; i < open_max; i++)
13569             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13570                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13571                 STDIO_STREAM_ARRAY[i]._flag)
13572                 fflush(&STDIO_STREAM_ARRAY[i]);
13573     }   
13574   }
13575 # endif
13576 #endif
13577   _exit(42);
13578 }
13579 EOCP
13580 : first we have to find out how _not_ to flush
13581 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13582     output=''
13583     set try -DTRY_FPUTC
13584     if eval $compile; then
13585             $rm -f try.out
13586             ./try$exe_ext 2>/dev/null
13587             if $test ! -s try.out -a "X$?" = X42; then
13588                 output=-DTRY_FPUTC
13589             fi
13590     fi
13591     case "$output" in
13592     '')
13593             set try -DTRY_FPRINTF
13594             $rm -f try.out
13595             if eval $compile; then
13596                     $rm -f try.out
13597                     ./try$exe_ext 2>/dev/null
13598                     if $test ! -s try.out -a "X$?" = X42; then
13599                         output=-DTRY_FPRINTF
13600                     fi
13601             fi
13602         ;;
13603     esac
13604 fi
13605 : check for fflush NULL behaviour
13606 case "$fflushNULL" in
13607 '')     set try -DTRY_FFLUSH_NULL $output
13608         if eval $compile; then
13609                 $rm -f try.out
13610                 ./try$exe_ext 2>/dev/null
13611                 code="$?"
13612                 if $test -s try.out -a "X$code" = X42; then
13613                         fflushNULL="`$cat try.out`"
13614                 else
13615                         if $test "X$code" != X42; then
13616                                 $cat >&4 <<EOM
13617 (If this test failed, don't worry, we'll try another method shortly.)
13618 EOM
13619                         fi
13620                 fi
13621         fi
13622         $rm -f core try.core core.try.*
13623         case "$fflushNULL" in
13624         x)      $cat >&4 <<EOM
13625 Your fflush(NULL) works okay for output streams.
13626 Let's see if it clobbers input pipes...
13627 EOM
13628 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13629 # bug that improperly flushes the input end of pipes.  So we avoid the
13630 # autoflush on fork/system/exec support for now. :-(
13631 $cat >tryp.c <<EOCP
13632 #include <stdio.h>
13633 int
13634 main(int argc, char **argv)
13635 {
13636     char buf[1024];
13637     int i;
13638     char *bp = buf;
13639     while (1) {
13640         while ((i = getc(stdin)) != -1
13641                && (*bp++ = i) != '\n'
13642                && bp < &buf[1024])
13643         /* DO NOTHING */ ;
13644         *bp = '\0';
13645         fprintf(stdout, "%s", buf);
13646         fflush(NULL);
13647         if (i == -1)
13648             return 0;
13649         bp = buf;
13650     }
13651 }
13652 EOCP
13653                 fflushNULL="$define"
13654                 set tryp
13655                 if eval $compile; then
13656                     $rm -f tryp.out
13657                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13658                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13659                        $cat >&4 <<EOM
13660 fflush(NULL) seems to behave okay with input streams.
13661 EOM
13662                         fflushNULL="$define"
13663                     else
13664                         $cat >&4 <<EOM
13665 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13666 EOM
13667                         fflushNULL="$undef"
13668                     fi
13669                 fi
13670                 $rm -f core tryp.c tryp.core core.tryp.*
13671                 ;;
13672         '')     $cat >&4 <<EOM
13673 Your fflush(NULL) isn't working (contrary to ANSI C).
13674 EOM
13675                 fflushNULL="$undef"
13676                 ;;
13677         *)      $cat >&4 <<EOM
13678 Cannot figure out whether your fflush(NULL) works or not.
13679 I'm assuming it doesn't (contrary to ANSI C).
13680 EOM
13681                 fflushNULL="$undef"
13682                 ;;
13683         esac
13684         ;;
13685 $define|true|[yY]*)
13686         fflushNULL="$define"
13687         ;;
13688 *)
13689         fflushNULL="$undef"
13690         ;;
13691 esac
13692 : check explicit looping only if NULL did not work, and if the pipe
13693 : bug does not show up on an explicit flush too
13694 case "$fflushNULL" in
13695 "$undef")
13696         $cat >tryp.c <<EOCP
13697 #include <stdio.h>
13698 int
13699 main(int argc, char **argv)
13700 {
13701     char buf[1024];
13702     int i;
13703     char *bp = buf;
13704     while (1) {
13705         while ((i = getc(stdin)) != -1
13706                && (*bp++ = i) != '\n'
13707                && bp < &buf[1024])
13708         /* DO NOTHING */ ;
13709         *bp = '\0';
13710         fprintf(stdout, "%s", buf);
13711         fflush(stdin);
13712         if (i == -1)
13713             return 0;
13714         bp = buf;
13715     }
13716 }
13717 EOCP
13718         set tryp
13719         if eval $compile; then
13720             $rm -f tryp.out
13721             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13722             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13723                $cat >&4 <<EOM
13724 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13725 EOM
13726                 : now check for fflushall behaviour
13727                 case "$fflushall" in
13728                 '')     set try -DTRY_FFLUSH_ALL $output
13729                         if eval $compile; then
13730                                 $cat >&4 <<EOM
13731 (Now testing the other method--but note that this also may fail.)
13732 EOM
13733                                 $rm -f try.out
13734                                 ./try$exe_ext 2>/dev/null
13735                                 if $test -s try.out -a "X$?" = X42; then
13736                                         fflushall="`$cat try.out`"
13737                                 fi
13738                         fi
13739                         $rm -f core try.core core.try.*
13740                         case "$fflushall" in
13741                         x)      $cat >&4 <<EOM
13742 Whew. Flushing explicitly all the stdio streams works.
13743 EOM
13744                                 fflushall="$define"
13745                                 ;;
13746                         '')     $cat >&4 <<EOM
13747 Sigh. Flushing explicitly all the stdio streams doesn't work.
13748 EOM
13749                                 fflushall="$undef"
13750                                 ;;
13751                         *)      $cat >&4 <<EOM
13752 Cannot figure out whether flushing stdio streams explicitly works or not.
13753 I'm assuming it doesn't.
13754 EOM
13755                                 fflushall="$undef"
13756                                 ;;
13757                         esac
13758                         ;;
13759                 "$define"|true|[yY]*)
13760                         fflushall="$define"
13761                         ;;
13762                 *)
13763                         fflushall="$undef"
13764                         ;;
13765                 esac
13766             else
13767                 $cat >&4 <<EOM
13768 All is futile.  Even fflush(stdin) clobbers input pipes!
13769 EOM
13770                 fflushall="$undef"
13771             fi
13772         else
13773             fflushall="$undef"
13774         fi
13775         $rm -f core tryp.c tryp.core core.tryp.*
13776         ;;
13777 *)      fflushall="$undef"
13778         ;;
13779 esac
13780
13781 case "$fflushNULL$fflushall" in
13782 undefundef)
13783         $cat <<EOM
13784 OK, I give up.  I cannot figure out how to flush pending stdio output.
13785 We won't be flushing handles at all before fork/exec/popen.
13786 EOM
13787         ;;
13788 esac
13789 $rm -f try.* try$exe_ext
13790
13791 : Store the full pathname to the ar program for use in the C program
13792 : Respect a hint or command line value for full_ar.
13793 case "$full_ar" in
13794 '') full_ar=$ar ;;
13795 esac
13796
13797 : Store the full pathname to the sed program for use in the C program
13798 full_sed=$sed
13799
13800 : see what type gids are declared as in the kernel
13801 echo " "
13802 echo "Looking for the type for group ids returned by getgid()."
13803 set gid_t gidtype xxx stdio.h sys/types.h
13804 eval $typedef
13805 case "$gidtype" in
13806 xxx)
13807         xxx=`./findhdr sys/user.h`
13808         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13809         case $1 in
13810         unsigned) dflt="$1 $2" ;;
13811         *) dflt="$1" ;;
13812         esac
13813         ;;
13814 *) dflt="$gidtype";;
13815 esac
13816 case "$gidtype" in
13817 gid_t) echo "gid_t found." ;;
13818 *)      rp="What is the type for group ids returned by getgid()?"
13819         . ./myread
13820         gidtype="$ans"
13821         ;;
13822 esac
13823
13824 echo " "
13825 case "$gidtype" in
13826 *_t) zzz="$gidtype"     ;;
13827 *)   zzz="gid"          ;;
13828 esac
13829 echo "Checking the size of $zzz..." >&4 
13830 cat > try.c <<EOCP
13831 #include <sys/types.h>
13832 #include <stdio.h>
13833 int main() {
13834     printf("%d\n", (int)sizeof($gidtype));
13835     exit(0);
13836 }
13837 EOCP
13838 set try
13839 if eval $compile_ok; then
13840         yyy=`./try`
13841         case "$yyy" in
13842         '')     gidsize=4
13843                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13844                 ;;
13845         *)      gidsize=$yyy
13846                 echo "Your $zzz is $gidsize bytes long."
13847                 ;;
13848         esac
13849 else
13850         gidsize=4
13851         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13852 fi
13853
13854
13855 echo " "
13856 case "$gidtype" in
13857 *_t) zzz="$gidtype"     ;;
13858 *)   zzz="gid"          ;;
13859 esac
13860 echo "Checking the sign of $zzz..." >&4 
13861 cat > try.c <<EOCP
13862 #include <sys/types.h>
13863 #include <stdio.h>
13864 int main() {
13865         $gidtype foo = -1;
13866         if (foo < 0)
13867                 printf("-1\n");
13868         else
13869                 printf("1\n");
13870 }
13871 EOCP
13872 set try
13873 if eval $compile; then
13874         yyy=`./try`
13875         case "$yyy" in
13876         '')     gidsign=1
13877                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13878                 ;;
13879         *)      gidsign=$yyy
13880                 case "$gidsign" in
13881                  1) echo "Your $zzz is unsigned." ;;
13882                 -1) echo "Your $zzz is signed."   ;;
13883                 esac
13884                 ;;
13885         esac
13886 else
13887         gidsign=1
13888         echo "(I can't compile the test program--guessing unsigned.)" >&4
13889 fi
13890
13891
13892 echo " "
13893
13894 if $test X"$quadtype" != X; then
13895
13896 echo "Checking how to print 64-bit integers..." >&4
13897
13898 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13899         $cat >try.c <<'EOCP'
13900 #include <sys/types.h>
13901 #include <stdio.h>
13902 int main() {
13903   int q = 12345678901;
13904   printf("%ld\n", q);
13905 }
13906 EOCP
13907         set try
13908         if eval $compile; then
13909                 yyy=`./try$exe_ext`
13910                 case "$yyy" in
13911                 12345678901)
13912                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13913                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13914                         echo "We will use %d."
13915                         ;;
13916                 esac
13917         fi
13918 fi
13919
13920 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13921         $cat >try.c <<'EOCP'
13922 #include <sys/types.h>
13923 #include <stdio.h>
13924 int main() {
13925   long q = 12345678901;
13926   printf("%ld\n", q);
13927 }
13928 EOCP
13929         set try
13930         if eval $compile; then
13931                 yyy=`./try$exe_ext`
13932                 case "$yyy" in
13933                 12345678901)
13934                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13935                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13936                         echo "We will use %ld."
13937                         ;;
13938                 esac
13939         fi
13940 fi
13941
13942 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13943         $cat >try.c <<'EOCP'
13944 #include <sys/types.h>
13945 #include <inttypes.h>
13946 #include <stdio.h>
13947 int main() {
13948   int64_t q = 12345678901;
13949   printf("%" PRId64 "\n", q);
13950 }
13951 EOCP
13952         set try
13953         if eval $compile; then
13954                 yyy=`./try$exe_ext`
13955                 case "$yyy" in
13956                 12345678901)
13957                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13958                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13959                         echo "We will use the C9X style."
13960                         ;;
13961                 esac
13962         fi
13963 fi
13964
13965 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13966         $cat >try.c <<EOCP
13967 #include <sys/types.h>
13968 #include <stdio.h>
13969 int main() {
13970   $quadtype q = 12345678901;
13971   printf("%Ld\n", q);
13972 }
13973 EOCP
13974         set try
13975         if eval $compile; then
13976                 yyy=`./try$exe_ext`
13977                 case "$yyy" in
13978                 12345678901)
13979                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13980                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13981                         echo "We will use %Ld."
13982                         ;;
13983                 esac
13984         fi
13985 fi
13986
13987 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13988         $cat >try.c <<'EOCP'
13989 #include <sys/types.h>
13990 #include <stdio.h>
13991 int main() {
13992   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13993   printf("%lld\n", q);
13994 }
13995 EOCP
13996         set try
13997         if eval $compile; then
13998                 yyy=`./try$exe_ext`
13999                 case "$yyy" in
14000                 12345678901)
14001                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14002                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14003                         echo "We will use the %lld style."
14004                         ;;
14005                 esac
14006         fi
14007 fi
14008
14009 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14010         $cat >try.c <<EOCP
14011 #include <sys/types.h>
14012 #include <stdio.h>
14013 int main() {
14014   $quadtype q = 12345678901;
14015   printf("%qd\n", q);
14016 }
14017 EOCP
14018         set try
14019         if eval $compile; then
14020                 yyy=`./try$exe_ext`
14021                 case "$yyy" in
14022                 12345678901)
14023                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14024                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14025                         echo "We will use %qd."
14026                         ;;
14027                 esac
14028         fi
14029 fi
14030
14031 if $test X"$sPRId64" = X; then
14032         echo "Cannot figure out how to print 64-bit integers." >&4
14033 fi
14034
14035 $rm -f try try.*
14036
14037 fi
14038
14039 case "$sPRId64" in
14040 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14041         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14042         ;;
14043 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14044         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14045         ;;
14046 esac
14047
14048
14049 echo " "
14050 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14051
14052 if $test X"$ivsize" = X8; then
14053         ivdformat="$sPRId64"
14054         uvuformat="$sPRIu64"
14055         uvoformat="$sPRIo64"
14056         uvxformat="$sPRIx64"
14057         uvXUformat="$sPRIXU64"
14058 else
14059         if $test X"$ivsize" = X"$longsize"; then
14060                 ivdformat='"ld"'
14061                 uvuformat='"lu"'
14062                 uvoformat='"lo"'
14063                 uvxformat='"lx"'
14064                 uvXUformat='"lX"'
14065         else
14066                 if $test X"$ivsize" = X"$intsize"; then
14067                         ivdformat='"d"'
14068                         uvuformat='"u"'
14069                         uvoformat='"o"'
14070                         uvxformat='"x"'
14071                         uvXUformat='"X"'
14072                 else
14073                         : far out
14074                         if $test X"$ivsize" = X"$shortsize"; then
14075                                 ivdformat='"hd"'
14076                                 uvuformat='"hu"'
14077                                 uvoformat='"ho"'
14078                                 uvxformat='"hx"'
14079                                 uvXUformat='"hX"'
14080                         fi
14081                 fi
14082         fi
14083 fi
14084
14085 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14086         nveformat="$sPRIeldbl"
14087         nvfformat="$sPRIfldbl"
14088         nvgformat="$sPRIgldbl"
14089         nvEUformat="$sPRIEUldbl"
14090         nvFUformat="$sPRIFUldbl"
14091         nvGUformat="$sPRIGUldbl"
14092 else
14093         nveformat='"e"'
14094         nvfformat='"f"'
14095         nvgformat='"g"'
14096         nvEUformat='"E"'
14097         nvFUformat='"F"'
14098         nvGUformat='"G"'
14099 fi
14100
14101 case "$ivdformat" in
14102 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14103     exit 1
14104     ;;
14105 esac
14106
14107
14108 echo " "
14109 $echo "Checking the format string to be used for gids..." >&4
14110
14111 case "$gidsign" in
14112 -1)     if $test X"$gidsize" = X"$ivsize"; then
14113                 gidformat="$ivdformat"
14114         else
14115                 if $test X"$gidsize" = X"$longsize"; then
14116                         gidformat='"ld"'
14117                 else
14118                         if $test X"$gidsize" = X"$intsize"; then
14119                                 gidformat='"d"'
14120                         else
14121                                 if $test X"$gidsize" = X"$shortsize"; then
14122                                         gidformat='"hd"'
14123                                 fi
14124                         fi
14125                 fi
14126         fi
14127         ;;
14128 *)      if $test X"$gidsize" = X"$uvsize"; then
14129                 gidformat="$uvuformat"
14130         else
14131                 if $test X"$gidsize" = X"$longsize"; then
14132                         gidformat='"lu"'
14133                 else
14134                         if $test X"$gidsize" = X"$intsize"; then
14135                                 gidformat='"u"'
14136                         else
14137                                 if $test X"$gidsize" = X"$shortsize"; then
14138                                         gidformat='"hu"'
14139                                 fi
14140                         fi
14141                 fi
14142         fi
14143         ;;
14144 esac
14145
14146 : see if getgroups exists
14147 set getgroups d_getgrps
14148 eval $inlibc
14149
14150 : see if setgroups exists
14151 set setgroups d_setgrps
14152 eval $inlibc
14153
14154
14155 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14156 echo " "
14157 case "$d_getgrps$d_setgrps" in
14158 *define*)
14159         case "$groupstype" in
14160         '') dflt="$gidtype" ;;
14161         *)  dflt="$groupstype" ;;
14162         esac
14163         $cat <<EOM
14164 What type of pointer is the second argument to getgroups() and setgroups()?
14165 Usually this is the same as group ids, $gidtype, but not always.
14166
14167 EOM
14168         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14169         . ./myread
14170         groupstype="$ans"
14171         ;;
14172 *)  groupstype="$gidtype";;
14173 esac
14174
14175 echo " "
14176 echo "Checking if your $make program sets \$(MAKE)..." >&4
14177 case "$make_set_make" in
14178 '')
14179         $sed 's/^X //' > testmake.mak << 'EOF'
14180 Xall:
14181 X       @echo 'maketemp="$(MAKE)"'
14182 EOF
14183         case "`$make -f testmake.mak 2>/dev/null`" in
14184         *maketemp=*) make_set_make='#' ;;
14185         *)      make_set_make="MAKE=$make" ;;
14186         esac
14187         $rm -f testmake.mak
14188         ;;
14189 esac
14190 case "$make_set_make" in
14191 '#') echo "Yup, it does.";;
14192 *) echo "Nope, it doesn't.";;
14193 esac
14194
14195 : see what type is used for mode_t
14196 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14197 set mode_t modetype int stdio.h sys/types.h
14198 eval $typedef_ask
14199
14200 : see if stdarg is available
14201 echo " "
14202 if $test `./findhdr stdarg.h`; then
14203         echo "<stdarg.h> found." >&4
14204         valstd="$define"
14205 else
14206         echo "<stdarg.h> NOT found." >&4
14207         valstd="$undef"
14208 fi
14209
14210 : see if varags is available
14211 echo " "
14212 if $test `./findhdr varargs.h`; then
14213         echo "<varargs.h> found." >&4
14214 else
14215         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14216 fi
14217
14218 : set up the varargs testing programs
14219 $cat > varargs.c <<EOP
14220 #ifdef I_STDARG
14221 #include <stdarg.h>
14222 #endif
14223 #ifdef I_VARARGS
14224 #include <varargs.h>
14225 #endif
14226
14227 #ifdef I_STDARG
14228 int f(char *p, ...)
14229 #else
14230 int f(va_alist)
14231 va_dcl
14232 #endif
14233 {
14234         va_list ap;
14235 #ifndef I_STDARG
14236         char *p;
14237 #endif
14238 #ifdef I_STDARG
14239         va_start(ap,p);
14240 #else
14241         va_start(ap);
14242         p = va_arg(ap, char *);
14243 #endif
14244         va_end(ap);
14245 }
14246 EOP
14247 $cat > varargs <<EOP
14248 $startsh
14249 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14250         echo "true"
14251 else
14252         echo "false"
14253 fi
14254 $rm -f varargs$_o
14255 EOP
14256 chmod +x varargs
14257
14258 : now check which varargs header should be included
14259 echo " "
14260 i_varhdr=''
14261 case "$valstd" in
14262 "$define")
14263         if `./varargs I_STDARG`; then
14264                 val='stdarg.h'
14265         elif `./varargs I_VARARGS`; then
14266                 val='varargs.h'
14267         fi
14268         ;;
14269 *)
14270         if `./varargs I_VARARGS`; then
14271                 val='varargs.h'
14272         fi
14273         ;;
14274 esac
14275 case "$val" in
14276 '')
14277 echo "I could not find the definition for va_dcl... You have problems..." >&4
14278         val="$undef"; set i_stdarg; eval $setvar
14279         val="$undef"; set i_varargs; eval $setvar
14280         ;;
14281 *) 
14282         set i_varhdr
14283         eval $setvar
14284         case "$i_varhdr" in
14285         stdarg.h)
14286                 val="$define"; set i_stdarg; eval $setvar
14287                 val="$undef"; set i_varargs; eval $setvar
14288                 ;;
14289         varargs.h)
14290                 val="$undef"; set i_stdarg; eval $setvar
14291                 val="$define"; set i_varargs; eval $setvar
14292                 ;;
14293         esac
14294         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14295 esac
14296 $rm -f varargs*
14297
14298 : see if we need va_copy
14299 echo " "
14300 case "$i_stdarg" in
14301 "$define")
14302         $cat >try.c <<EOCP
14303 #include <stdarg.h>
14304 #include <stdio.h>
14305 #$i_stdlib I_STDLIB
14306 #ifdef I_STDLIB
14307 #include <stdlib.h>
14308 #endif
14309 #include <signal.h>
14310
14311 int
14312 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14313 {
14314   return vfprintf(f, fmt, *valp);
14315 }
14316  
14317 int    
14318 myvfprintf(FILE *f, const  char *fmt, va_list val)
14319 {
14320   return ivfprintf(f, fmt, &val);
14321 }
14322       
14323 int
14324 myprintf(char *fmt, ...) 
14325 {
14326   va_list val;
14327   va_start(val, fmt);
14328   return myvfprintf(stdout, fmt, val); 
14329 }         
14330
14331 int
14332 main(int ac, char **av)
14333 {
14334   signal(SIGSEGV, exit);
14335
14336   myprintf("%s%cs all right, then\n", "that", '\'');                            
14337   exit(0);      
14338 }
14339 EOCP
14340         set try
14341         if eval $compile && ./try 2>&1 >/dev/null; then
14342                 case "`./try`" in
14343                 "that's all right, then")
14344                         okay=yes
14345                         ;;
14346                 esac
14347         fi
14348         case "$okay" in
14349         yes)    echo "It seems that you don't need va_copy()." >&4
14350                 need_va_copy="$undef"
14351                 ;;
14352         *)      echo "It seems that va_copy() or similar will be needed." >&4
14353                 need_va_copy="$define"
14354                 ;;
14355         esac
14356         $rm -f try.* core core.* *.core *.core.*
14357         ;;
14358 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14359         ;;
14360 esac
14361
14362 : define a fucntion to check prototypes
14363 $cat > protochk <<EOSH
14364 $startsh
14365 cc="$cc"
14366 optimize="$optimize"
14367 ccflags="$ccflags"
14368 prototype="$prototype"
14369 define="$define"
14370 rm=$rm
14371 EOSH
14372
14373 $cat >> protochk <<'EOSH'
14374
14375 $rm -f try.c
14376 foo="$1"
14377 shift
14378 while test $# -ge 2; do
14379         case "$1" in
14380                 $define) echo "#include <$2>" >> try.c ;;
14381                 literal) echo "$2" >> try.c ;;
14382         esac
14383     shift 2
14384 done
14385 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14386 cat >> try.c <<'EOCP'
14387 #ifdef CAN_PROTOTYPE
14388 #define _(args) args
14389 #else
14390 #define _(args) ()
14391 #endif
14392 EOCP
14393 echo "$foo" >> try.c
14394 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14395 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14396 status=$?
14397 $rm -f try.[co]
14398 exit $status
14399 EOSH
14400 chmod +x protochk
14401 $eunicefix protochk
14402
14403 : see what type is used for size_t
14404 rp="What is the type used for the length parameter for string functions?"
14405 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14406 eval $typedef_ask
14407
14408 : check for type of arguments to gethostbyaddr. 
14409 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14410         case "$d_gethbyaddr" in
14411         $define)
14412                 $cat <<EOM
14413
14414 Checking to see what type of arguments are accepted by gethostbyaddr().
14415 EOM
14416                 hdrs="$define sys/types.h
14417                         $d_socket sys/socket.h 
14418                         $i_niin netinet/in.h 
14419                         $i_netdb netdb.h
14420                         $i_unistd unistd.h"
14421                 : The first arg can 'char *' or 'void *'
14422                 : The second arg is some of integral type
14423                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14424                         for yyy in size_t long int; do
14425                                 case "$netdb_host_type" in
14426                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14427                                         if ./protochk "$try" $hdrs; then
14428                                                 echo "Your system accepts $xxx for the first arg."
14429                                                 echo "...and $yyy for the second arg."
14430                                                 netdb_host_type="$xxx"
14431                                                 netdb_hlen_type="$yyy"
14432                                         fi
14433                                         ;;
14434                                 esac
14435                         done
14436                 done
14437                 : In case none of those worked, prompt the user.
14438                 case "$netdb_host_type" in
14439                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14440                         dflt='char *'
14441                         . ./myread
14442                         netdb_host_type=$ans
14443                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14444                         dflt="$sizetype"
14445                         . ./myread
14446                         netdb_hlen_type=$ans
14447                         ;;
14448                 esac
14449                 ;;
14450         *)      : no gethostbyaddr, so pick harmless defaults
14451                 netdb_host_type='char *'
14452                 netdb_hlen_type="$sizetype"
14453                 ;;
14454         esac
14455         # Remove the "const" if needed. -- but then we'll have a 
14456         # prototype clash!
14457         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14458 fi
14459
14460 : check for type of argument to gethostbyname. 
14461 if test "X$netdb_name_type" = X ; then
14462         case "$d_gethbyname" in
14463         $define)
14464                 $cat <<EOM
14465
14466 Checking to see what type of argument is accepted by gethostbyname().
14467 EOM
14468                 hdrs="$define sys/types.h
14469                         $d_socket sys/socket.h 
14470                         $i_niin netinet/in.h 
14471                         $i_netdb netdb.h
14472                         $i_unistd unistd.h"
14473                 for xxx in "const char *" "char *"; do
14474                         case "$netdb_name_type" in
14475                         '')     try="extern struct hostent *gethostbyname($xxx);"
14476                                 if ./protochk "$try" $hdrs; then
14477                                         echo "Your system accepts $xxx."
14478                                         netdb_name_type="$xxx"
14479                                 fi
14480                                 ;;
14481                         esac
14482                 done
14483                 : In case none of those worked, prompt the user.
14484                 case "$netdb_name_type" in
14485                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14486                         dflt='char *'
14487                         . ./myread
14488                         netdb_name_type=$ans
14489                         ;;
14490                 esac
14491                 ;;
14492         *)      : no gethostbyname, so pick harmless default
14493                 netdb_name_type='char *'
14494                 ;;
14495         esac
14496 fi
14497
14498 : check for type of 1st argument to getnetbyaddr. 
14499 if test "X$netdb_net_type" = X ; then
14500         case "$d_getnbyaddr" in
14501         $define)
14502                 $cat <<EOM
14503
14504 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14505 EOM
14506                 hdrs="$define sys/types.h
14507                         $d_socket sys/socket.h 
14508                         $i_niin netinet/in.h 
14509                         $i_netdb netdb.h
14510                         $i_unistd unistd.h"
14511                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14512                         case "$netdb_net_type" in
14513                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14514                                 if ./protochk "$try" $hdrs; then
14515                                         echo "Your system accepts $xxx."
14516                                         netdb_net_type="$xxx"
14517                                 fi
14518                                 ;;
14519                         esac
14520                 done
14521                 : In case none of those worked, prompt the user.
14522                 case "$netdb_net_type" in
14523                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14524                         dflt='long'
14525                         . ./myread
14526                         netdb_net_type=$ans
14527                         ;;
14528                 esac
14529                 ;;
14530         *)      : no getnetbyaddr, so pick harmless default
14531                 netdb_net_type='long'
14532                 ;;
14533         esac
14534 fi
14535 : locate the preferred pager for this system
14536 case "$pager" in
14537 '')
14538         dflt=''
14539         case "$pg" in
14540         /*) dflt=$pg;;
14541         [a-zA-Z]:/*) dflt=$pg;;
14542         esac
14543         case "$more" in
14544         /*) dflt=$more;;
14545         [a-zA-Z]:/*) dflt=$more;;
14546         esac
14547         case "$less" in
14548         /*) dflt=$less;;
14549         [a-zA-Z]:/*) dflt=$less;;
14550         esac
14551         case "$dflt" in
14552         '') dflt=/usr/ucb/more;;
14553         esac
14554         ;;
14555 *) dflt="$pager";;
14556 esac
14557 echo " "
14558 fn=f/
14559 rp='What pager is used on your system?'
14560 . ./getfile
14561 pager="$ans"
14562
14563 : see what type pids are declared as in the kernel
14564 rp="What is the type of process ids on this system?"
14565 set pid_t pidtype int stdio.h sys/types.h
14566 eval $typedef_ask
14567
14568 : Find earliest binary compatible site_perl subdirectory perl can use.
14569 case "$bincompat5005" in
14570 "$define") xs_apiversion='5.005' ;;
14571 *) xs_apiversion=$version ;;   # The current site_perl version.
14572 esac
14573 : Find earliest pure perl site_perl subdirectory perl can use.
14574 : The versioned directories started at 5.005.
14575 pm_apiversion='5.005'
14576
14577 : see if ar generates random libraries by itself
14578 echo " "
14579 echo "Checking how to generate random libraries on your machine..." >&4
14580 echo 'int bar1() { return bar2(); }' > bar1.c
14581 echo 'int bar2() { return 2; }' > bar2.c
14582 $cat > foo.c <<'EOP'
14583 int main() { printf("%d\n", bar1()); exit(0); }
14584 EOP
14585 $cc $ccflags -c bar1.c >/dev/null 2>&1
14586 $cc $ccflags -c bar2.c >/dev/null 2>&1
14587 $cc $ccflags -c foo.c >/dev/null 2>&1
14588 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14589 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14590         ./foobar >/dev/null 2>&1; then
14591         echo "$ar appears to generate random libraries itself."
14592         orderlib=false
14593         ranlib=":"
14594 elif $ar ts bar$_a >/dev/null 2>&1 &&
14595         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14596         ./foobar >/dev/null 2>&1; then
14597                 echo "a table of contents needs to be added with '$ar ts'."
14598                 orderlib=false
14599                 ranlib="$ar ts"
14600 else
14601         case "$ranlib" in
14602         :) ranlib='';;
14603         '')
14604                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14605                 $test -f $ranlib || ranlib=''
14606                 ;;
14607         esac
14608         if $test -n "$ranlib"; then
14609                 echo "your system has '$ranlib'; we'll use that."
14610                 orderlib=false
14611         else
14612                 echo "your system doesn't seem to support random libraries"
14613                 echo "so we'll use lorder and tsort to order the libraries."
14614                 orderlib=true
14615                 ranlib=":"
14616         fi
14617 fi
14618 $rm -f foo* bar* 
14619
14620 : check for type of arguments to select. 
14621 case "$selecttype" in
14622 '') case "$d_select" in
14623         $define)
14624                 echo " "
14625                 $cat <<EOM
14626 Checking to see what type of arguments are accepted by select().
14627 EOM
14628                 hdrs="$define sys/types.h
14629                         $i_systime sys/time.h 
14630                         $i_sysselct sys/select.h
14631                         $d_socket sys/socket.h"
14632                 : The first arg can be int, unsigned, or size_t
14633                 : The last arg may or may not be 'const'
14634                 val=''
14635                 : void pointer has been seen but using that
14636                 : breaks the selectminbits test
14637                 for xxx in 'fd_set *' 'int *'; do
14638                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14639                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14640                                         case "$val" in
14641                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14642                                                 if ./protochk "$try" $hdrs; then
14643                                                         echo "Your system accepts $xxx."
14644                                                         val="$xxx"
14645                                                 fi
14646                                                 ;;
14647                                         esac
14648                                 done
14649                         done
14650                 done
14651                 case "$val" in
14652                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14653                         case "$d_fd_set" in
14654                                 $define) dflt="fd_set *" ;;
14655                                 *)              dflt="int *" ;;
14656                         esac
14657                         . ./myread
14658                         val=$ans
14659                         ;;
14660                 esac
14661                 selecttype="$val"
14662                 ;;
14663         *)      : no select, so pick a harmless default
14664                 selecttype='int *'
14665                 ;;
14666         esac
14667         ;;
14668 esac
14669
14670 : check for the select 'width'
14671 case "$selectminbits" in
14672 '') case "$d_select" in
14673         $define)
14674                 $cat <<EOM
14675
14676 Checking to see on how many bits at a time your select() operates...
14677 EOM
14678                 $cat >try.c <<EOCP
14679 #include <sys/types.h>
14680 #$i_time I_TIME
14681 #$i_systime I_SYS_TIME
14682 #$i_systimek I_SYS_TIME_KERNEL
14683 #ifdef I_TIME
14684 #   include <time.h>
14685 #endif
14686 #ifdef I_SYS_TIME
14687 #   ifdef I_SYS_TIME_KERNEL
14688 #       define KERNEL
14689 #   endif
14690 #   include <sys/time.h>
14691 #   ifdef I_SYS_TIME_KERNEL
14692 #       undef KERNEL
14693 #   endif
14694 #endif
14695 #$i_sysselct I_SYS_SELECT
14696 #ifdef I_SYS_SELECT
14697 #include <sys/select.h>
14698 #endif
14699 #$d_socket HAS_SOCKET
14700 #ifdef HAS_SOCKET
14701 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14702 #endif
14703 #include <stdio.h>
14704 $selecttype b;
14705 #define S sizeof(*(b))
14706 #define MINBITS 64
14707 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14708 #define NBITS  (NBYTES * 8)
14709 int main() {
14710     char s[NBYTES];
14711     struct timeval t;
14712     int i;
14713     FILE* fp;
14714     int fd;
14715
14716     fclose(stdin);
14717     fp = fopen("try.c", "r");
14718     if (fp == 0)
14719       exit(1);
14720     fd = fileno(fp);
14721     if (fd < 0)
14722       exit(2);
14723     b = ($selecttype)s;
14724     for (i = 0; i < NBITS; i++)
14725         FD_SET(i, b);
14726     t.tv_sec  = 0;
14727     t.tv_usec = 0;
14728     select(fd + 1, b, 0, 0, &t);
14729     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14730     printf("%d\n", i + 1);
14731     return 0;
14732 }
14733 EOCP
14734                 set try
14735                 if eval $compile_ok; then
14736                         selectminbits=`./try`
14737                         case "$selectminbits" in
14738                         '')     cat >&4 <<EOM
14739 Cannot figure out on how many bits at a time your select() operates.
14740 I'll play safe and guess it is 32 bits.
14741 EOM
14742                                 selectminbits=32
14743                                 bits="32 bits"
14744                                 ;;
14745                         1)      bits="1 bit" ;;
14746                         *)      bits="$selectminbits bits" ;;
14747                         esac
14748                         echo "Your select() operates on $bits at a time." >&4
14749                 else
14750                         rp='What is the minimum number of bits your select() operates on?'
14751                         case "$byteorder" in
14752                         1234|12345678)  dflt=32 ;;
14753                         *)              dflt=1  ;;
14754                         esac
14755                         . ./myread
14756                         val=$ans
14757                         selectminbits="$val"
14758                 fi
14759                 $rm -f try.* try
14760                 ;;
14761         *)      : no select, so pick a harmless default
14762                 selectminbits='32'
14763                 ;;
14764         esac
14765         ;;
14766 esac
14767
14768 : Trace out the files included by signal.h, then look for SIGxxx names.
14769 : Remove SIGARRAYSIZE used by HPUX.
14770 : Remove SIGSTKSIZE used by Linux.
14771 : Remove SIGSTKSZ used by Posix.
14772 : Remove SIGTYP void lines used by OS2.
14773 : Some cpps, like os390, dont give the file name anywhere
14774 if [ "X$fieldn" = X ]; then
14775         : Just make some guesses.  We check them later.
14776         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14777 else
14778         xxx=`echo '#include <signal.h>' |
14779         $cppstdin $cppminus $cppflags 2>/dev/null |
14780         $grep '^[       ]*#.*include' | 
14781         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14782 fi
14783 : Check this list of files to be sure we have parsed the cpp output ok.
14784 : This will also avoid potentially non-existent files, such 
14785 : as ../foo/bar.h
14786 xxxfiles=''
14787 for xx in $xxx /dev/null ; do
14788         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14789 done
14790 : If we have found no files, at least try signal.h
14791 case "$xxxfiles" in
14792 '')     xxxfiles=`./findhdr signal.h` ;;
14793 esac
14794 xxx=`awk '
14795 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14796         print substr($2, 4, 20)
14797 }
14798 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14799         print substr($3, 4, 20)
14800 }' $xxxfiles`
14801 : Append some common names just in case the awk scan failed.
14802 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14803 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14804 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14805 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14806 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14807
14808 : generate a few handy files for later
14809 $cat > signal.c <<'EOCP'
14810 #include <sys/types.h>
14811 #include <signal.h>
14812 #include <stdio.h>
14813 int main() {
14814
14815 /* Strange style to avoid deeply-nested #if/#else/#endif */
14816 #ifndef NSIG
14817 #  ifdef _NSIG
14818 #    define NSIG (_NSIG)
14819 #  endif
14820 #endif
14821
14822 #ifndef NSIG
14823 #  ifdef SIGMAX
14824 #    define NSIG (SIGMAX+1)
14825 #  endif
14826 #endif
14827
14828 #ifndef NSIG
14829 #  ifdef SIG_MAX
14830 #    define NSIG (SIG_MAX+1)
14831 #  endif
14832 #endif
14833
14834 #ifndef NSIG
14835 #  ifdef MAXSIG
14836 #    define NSIG (MAXSIG+1)
14837 #  endif
14838 #endif
14839
14840 #ifndef NSIG
14841 #  ifdef MAX_SIG
14842 #    define NSIG (MAX_SIG+1)
14843 #  endif
14844 #endif
14845
14846 #ifndef NSIG
14847 #  ifdef SIGARRAYSIZE
14848 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14849 #  endif
14850 #endif
14851
14852 #ifndef NSIG
14853 #  ifdef _sys_nsig
14854 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14855 #  endif
14856 #endif
14857
14858 /* Default to some arbitrary number that's big enough to get most
14859    of the common signals.
14860 */
14861 #ifndef NSIG
14862 #    define NSIG 50
14863 #endif
14864
14865 printf("NSIG %d\n", NSIG);
14866
14867 #ifndef JUST_NSIG
14868
14869 EOCP
14870
14871 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14872 {
14873         printf "#ifdef SIG"; printf $1; printf "\n"
14874         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14875         printf $1; printf ");\n"
14876         printf "#endif\n"
14877 }
14878 END {
14879         printf "#endif /* JUST_NSIG */\n";
14880         printf "exit(0);\n}\n";
14881 }
14882 ' >>signal.c
14883 $cat >signal.awk <<'EOP'
14884 BEGIN { ndups = 0 }
14885 $1 ~ /^NSIG$/ { nsig = $2 }
14886 ($1 !~ /^NSIG$/) && (NF == 2) {
14887     if ($2 > maxsig) { maxsig = $2 }
14888     if (sig_name[$2]) {
14889         dup_name[ndups] = $1
14890         dup_num[ndups] = $2
14891         ndups++ 
14892     }
14893     else {
14894         sig_name[$2] = $1
14895         sig_num[$2] = $2
14896     }
14897 }
14898 END { 
14899     if (nsig == 0) {
14900         nsig = maxsig + 1
14901     }
14902     printf("NSIG %d\n", nsig);
14903     for (n = 1; n < nsig; n++) {
14904         if (sig_name[n]) {
14905             printf("%s %d\n", sig_name[n], sig_num[n])
14906         }
14907         else {
14908             printf("NUM%d %d\n", n, n) 
14909         }
14910     }
14911     for (n = 0; n < ndups; n++) {
14912         printf("%s %d\n", dup_name[n], dup_num[n])
14913     }
14914 }
14915 EOP
14916 $cat >signal_cmd <<EOS
14917 $startsh
14918 if $test -s signal.lst; then
14919     echo "Using your existing signal.lst file"
14920         exit 0
14921 fi
14922 xxx="$xxx"
14923 EOS
14924 $cat >>signal_cmd <<'EOS'
14925
14926 set signal
14927 if eval $compile_ok; then
14928         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14929 else
14930         echo "(I can't seem be able to compile the whole test program)" >&4
14931         echo "(I'll try it in little pieces.)" >&4
14932         set signal -DJUST_NSIG
14933         if eval $compile_ok; then
14934                 ./signal$_exe > signal.nsg
14935                 $cat signal.nsg
14936         else
14937                 echo "I can't seem to figure out how many signals you have." >&4
14938                 echo "Guessing 50." >&4
14939                 echo 'NSIG 50' > signal.nsg
14940         fi
14941         : Now look at all the signal names, one at a time.
14942         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14943                 $cat > signal.c <<EOCP
14944 #include <sys/types.h>
14945 #include <signal.h>
14946 #include <stdio.h>
14947 int main() {
14948 printf("$xx %d\n", SIG${xx});
14949 return 0;
14950 }
14951 EOCP
14952                 set signal
14953                 if eval $compile; then
14954                         echo "SIG${xx} found."
14955                         ./signal$_exe  >> signal.ls1
14956                 else
14957                         echo "SIG${xx} NOT found."
14958                 fi
14959         done
14960         if $test -s signal.ls1; then
14961                 $cat signal.nsg signal.ls1 |
14962                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14963         fi
14964
14965 fi
14966 if $test -s signal.lst; then
14967         :
14968 else
14969         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14970         echo 'kill -l' >signal
14971         set X `csh -f <signal`
14972         $rm -f signal
14973         shift
14974         case $# in
14975         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14976         esac
14977         echo $@ | $tr ' ' $trnl | \
14978             $awk '{ printf "%s %d\n", $1, ++s; }
14979                   END { printf "NSIG %d\n", ++s }' >signal.lst
14980 fi
14981 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14982 EOS
14983 chmod a+x signal_cmd
14984 $eunicefix signal_cmd
14985
14986 : generate list of signal names
14987 echo " "
14988 case "$sig_name_init" in
14989 '') doinit=yes ;;
14990 *)  case "$sig_num_init" in
14991     ''|*,*) doinit=yes ;;
14992     esac ;;
14993 esac
14994 case "$doinit" in
14995 yes)
14996         echo "Generating a list of signal names and numbers..." >&4
14997         . ./signal_cmd
14998         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14999         sig_name=`$awk 'BEGIN { printf "ZERO " }
15000                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15001         sig_num=`$awk  'BEGIN { printf "0 " }
15002                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15003         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15004                              !/^NSIG/   { printf "\"%s\", ", $1 }
15005                              END        { printf "0\n" }' signal.lst`
15006         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15007                              !/^NSIG/   { printf "%d, ", $2}
15008                              END        { printf "0\n"}' signal.lst`
15009         ;;
15010 esac
15011 echo "The following $sig_count signals are available:"
15012 echo " "
15013 echo $sig_name | $awk \
15014 'BEGIN { linelen = 0 }
15015 {
15016         for (i = 1; i <= NF; i++) {
15017                 name = "SIG" $i " "
15018                 linelen = linelen + length(name)
15019                 if (linelen > 70) {
15020                         printf "\n"
15021                         linelen = length(name)
15022                 }
15023                 printf "%s", name
15024         }
15025         printf "\n"
15026 }'
15027 sig_size=`echo $sig_name | awk '{print NF}'`
15028 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15029
15030 echo " "
15031 case "$sizetype" in
15032 *_t) zzz="$sizetype"    ;;
15033 *)   zzz="filesize"     ;;
15034 esac
15035 echo "Checking the size of $zzz..." >&4 
15036 cat > try.c <<EOCP
15037 #include <sys/types.h>
15038 #include <stdio.h>
15039 int main() {
15040     printf("%d\n", (int)sizeof($sizetype));
15041     exit(0);
15042 }
15043 EOCP
15044 set try
15045 if eval $compile_ok; then
15046         yyy=`./try`
15047         case "$yyy" in
15048         '')     sizesize=4
15049                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15050                 ;;
15051         *)      sizesize=$yyy
15052                 echo "Your $zzz size is $sizesize bytes."
15053                 ;;
15054         esac
15055 else
15056         sizesize=4
15057         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15058 fi
15059
15060
15061 : check for socklen_t
15062 echo " "
15063 echo "Checking to see if you have socklen_t..." >&4
15064 $cat >try.c <<EOCP
15065 #include <sys/types.h>
15066 #$d_socket HAS_SOCKET
15067 #ifdef HAS_SOCKET
15068 #include <sys/socket.h>
15069 #endif
15070 int main() { socklen_t x = 16; }
15071 EOCP
15072 set try
15073 if eval $compile; then
15074         val="$define"
15075         echo "You have socklen_t."
15076 else
15077         val="$undef"
15078         echo "You do not have socklen_t."
15079         case "$sizetype" in
15080         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15081         esac
15082 fi
15083 $rm -f try try.*
15084 set d_socklen_t
15085 eval $setvar
15086
15087 : see if this is a socks.h system
15088 set socks.h i_socks
15089 eval $inhdr
15090
15091 : check for type of the size argument to socket calls
15092 case "$d_socket" in
15093 "$define")
15094         $cat <<EOM
15095
15096 Checking to see what type is the last argument of accept().
15097 EOM
15098         yyy=''
15099         case "$d_socklen_t" in
15100         "$define") yyy="$yyy socklen_t"
15101         esac
15102         yyy="$yyy $sizetype int long unsigned"
15103         for xxx in $yyy; do
15104                 case "$socksizetype" in
15105                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15106                         case "$usesocks" in
15107                         "$define")
15108                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15109                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15110                                         socksizetype="$xxx"
15111                                 fi
15112                                 ;;
15113                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15114                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15115                                         socksizetype="$xxx"
15116                                 fi
15117                                 ;;
15118                         esac
15119                         ;;
15120                 esac
15121         done
15122 : In case none of those worked, prompt the user.
15123         case "$socksizetype" in
15124         '')     rp='What is the type for socket address structure sizes?'
15125                 dflt='int'
15126                 . ./myread
15127                 socksizetype=$ans
15128                 ;;
15129         esac
15130         ;;
15131 *)      : no sockets, so pick relatively harmless default
15132         socksizetype='int'
15133         ;;
15134 esac
15135
15136 : see what type is used for signed size_t
15137 set ssize_t ssizetype int stdio.h sys/types.h
15138 eval $typedef
15139 dflt="$ssizetype"
15140 $cat > ssize.c <<EOM
15141 #include <stdio.h>
15142 #include <sys/types.h>
15143 #define Size_t $sizetype
15144 #define SSize_t $dflt
15145 int main()
15146 {
15147         if (sizeof(Size_t) == sizeof(SSize_t))
15148                 printf("$dflt\n");
15149         else if (sizeof(Size_t) == sizeof(int))
15150                 printf("int\n");
15151         else 
15152                 printf("long\n");
15153         exit(0);
15154 }
15155 EOM
15156 echo " "
15157 set ssize
15158 if eval $compile_ok && ./ssize > /dev/null; then
15159         ssizetype=`./ssize`
15160         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15161 else
15162         $cat >&4 <<EOM
15163 Help! I can't compile and run the ssize_t test program: please enlighten me!
15164 (This is probably a misconfiguration in your system or libraries, and
15165 you really ought to fix it.  Still, I'll try anyway.)
15166
15167 I need a type that is the same size as $sizetype, but is guaranteed to
15168 be signed.  Common values are ssize_t, int and long.
15169
15170 EOM
15171         rp="What signed type is the same size as $sizetype?"
15172         . ./myread
15173         ssizetype="$ans"
15174 fi
15175 $rm -f ssize ssize.*
15176
15177 : see what type of char stdio uses.
15178 echo " "
15179 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15180 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15181         echo "Your stdio uses unsigned chars." >&4
15182         stdchar="unsigned char"
15183 else
15184         echo "Your stdio uses signed chars." >&4
15185         stdchar="char"
15186 fi
15187 $rm -f stdioh
15188
15189
15190
15191 : see if time exists
15192 echo " "
15193 if test "X$d_time" = X -o X"$timetype" = X; then
15194     if set time val -f d_time; eval $csym; $val; then
15195                 echo 'time() found.' >&4
15196                 val="$define"
15197                 rp="What is the type returned by time() on this system?"
15198                 set time_t timetype long stdio.h sys/types.h
15199                 eval $typedef_ask
15200     else
15201                 echo 'time() not found, hope that will do.' >&4
15202                 val="$undef"
15203                 timetype='int';
15204     fi
15205     set d_time
15206     eval $setvar
15207 fi
15208
15209 : see what type uids are declared as in the kernel
15210 echo " "
15211 echo "Looking for the type for user ids returned by getuid()."
15212 set uid_t uidtype xxx stdio.h sys/types.h
15213 eval $typedef
15214 case "$uidtype" in
15215 xxx)
15216         xxx=`./findhdr sys/user.h`
15217         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15218         case $1 in
15219         unsigned) dflt="$1 $2" ;;
15220         *) dflt="$1" ;;
15221         esac
15222         ;;
15223 *) dflt="$uidtype";;
15224 esac
15225 case "$uidtype" in
15226 uid_t)  echo "uid_t found." ;;
15227 *)      rp="What is the type for user ids returned by getuid()?"
15228         . ./myread
15229         uidtype="$ans"
15230         ;;
15231 esac
15232
15233 echo " "
15234 case "$uidtype" in
15235 *_t) zzz="$uidtype"     ;;
15236 *)   zzz="uid"          ;;
15237 esac
15238 echo "Checking the size of $zzz..." >&4 
15239 cat > try.c <<EOCP
15240 #include <sys/types.h>
15241 #include <stdio.h>
15242 int main() {
15243     printf("%d\n", (int)sizeof($uidtype));
15244     exit(0);
15245 }
15246 EOCP
15247 set try
15248 if eval $compile_ok; then
15249         yyy=`./try`
15250         case "$yyy" in
15251         '')     uidsize=4
15252                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15253                 ;;
15254         *)      uidsize=$yyy
15255                 echo "Your $zzz is $uidsize bytes long."
15256                 ;;
15257         esac
15258 else
15259         uidsize=4
15260         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15261 fi
15262
15263 echo " "
15264 case "$uidtype" in
15265 *_t) zzz="$uidtype"     ;;
15266 *)   zzz="uid"          ;;
15267 esac
15268 echo "Checking the sign of $zzz..." >&4
15269 cat > try.c <<EOCP
15270 #include <sys/types.h>
15271 #include <stdio.h>
15272 int main() {
15273         $uidtype foo = -1;
15274         if (foo < 0)
15275                 printf("-1\n");
15276         else
15277                 printf("1\n");
15278 }
15279 EOCP
15280 set try
15281 if eval $compile; then
15282         yyy=`./try`
15283         case "$yyy" in
15284         '')     uidsign=1
15285                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15286                 ;;
15287         *)      uidsign=$yyy
15288                 case "$uidsign" in
15289                  1) echo "Your $zzz is unsigned." ;;
15290                 -1) echo "Your $zzz is signed."   ;;
15291                 esac
15292                 ;;
15293         esac
15294 else
15295         uidsign=1
15296         echo "(I can't compile the test program--guessing unsigned.)" >&4
15297 fi
15298
15299
15300
15301 echo " "
15302 $echo "Checking the format string to be used for uids..." >&4
15303
15304 case "$uidsign" in
15305 -1)     if $test X"$uidsize" = X"$ivsize"; then
15306                 uidformat="$ivdformat"
15307         else
15308                 if $test X"$uidsize" = X"$longsize"; then
15309                         uidformat='"ld"'
15310                 else
15311                         if $test X"$uidsize" = X"$intsize"; then
15312                                 uidformat='"d"'
15313                         else
15314                                 if $test X"$uidsize" = X"$shortsize"; then
15315                                         uidformat='"hd"'
15316                                 fi
15317                         fi
15318                 fi
15319         fi
15320         ;;
15321 *)      if $test X"$uidsize" = X"$uvsize"; then
15322                 uidformat="$uvuformat"
15323         else
15324                 if $test X"$uidsize" = X"$longsize"; then
15325                         uidformat='"lu"'
15326                 else
15327                         if $test X"$uidsize" = X"$intsize"; then
15328                                 uidformat='"u"'
15329                         else
15330                                 if $test X"$uidsize" = X"$shortsize"; then
15331                                         uidformat='"hu"'
15332                                 fi
15333                         fi
15334                 fi
15335         fi
15336         ;;
15337 esac
15338
15339 : determine compiler compiler
15340 case "$yacc" in
15341 '')
15342         dflt=yacc;;
15343 *)
15344         dflt="$yacc";;
15345 esac
15346 echo " "
15347 comp='yacc'
15348 if $test -f "$byacc"; then
15349         dflt="$byacc"
15350         comp="byacc or $comp"
15351 fi
15352 if $test -f "$bison"; then
15353         comp="$comp or bison -y"
15354 fi
15355 rp="Which compiler compiler ($comp) shall I use?"
15356 . ./myread
15357 yacc="$ans"
15358 case "$yacc" in
15359 *bis*)
15360         case "$yacc" in
15361         *-y*) ;;
15362         *)
15363                 yacc="$yacc -y"
15364                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15365                 ;;
15366         esac
15367         ;;
15368 esac
15369
15370 : see if fcntl.h is there
15371 val=''
15372 set fcntl.h val
15373 eval $inhdr
15374
15375 : see if we can include fcntl.h
15376 case "$val" in
15377 "$define")
15378         echo " "
15379         if $h_fcntl; then
15380                 val="$define"
15381                 echo "We'll be including <fcntl.h>." >&4
15382         else
15383                 val="$undef"
15384                 if $h_sysfile; then
15385         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15386                 else
15387                         echo "We won't be including <fcntl.h>." >&4
15388                 fi
15389         fi
15390         ;;
15391 *)
15392         h_fcntl=false
15393         val="$undef"
15394         ;;
15395 esac
15396 set i_fcntl
15397 eval $setvar
15398
15399 : see if this is a iconv.h system
15400 set iconv.h i_iconv
15401 eval $inhdr
15402
15403 : see if this is a ieeefp.h system
15404 set ieeefp.h i_ieeefp
15405 eval $inhdr
15406
15407 : see if this is a libutil.h system
15408 set libutil.h i_libutil
15409 eval $inhdr
15410
15411 : see if locale.h is available
15412 set locale.h i_locale
15413 eval $inhdr
15414
15415 : see if mach cthreads are available
15416 if test "X$usethreads" = "X$define"; then
15417         set mach/cthreads.h i_machcthr
15418         eval $inhdr
15419 else
15420         i_machcthr="$undef"
15421 fi
15422
15423
15424
15425 : see if this is a math.h system
15426 set math.h i_math
15427 eval $inhdr
15428
15429 : see if this is a mntent.h system
15430 set mntent.h i_mntent
15431 eval $inhdr
15432
15433 : see if ndbm.h is available
15434 set ndbm.h t_ndbm
15435 eval $inhdr
15436 case "$t_ndbm" in
15437 $define)
15438         : see if dbm_open exists
15439         set dbm_open d_dbm_open
15440         eval $inlibc
15441         case "$d_dbm_open" in
15442         $undef)
15443                 t_ndbm="$undef"
15444                 echo "We won't be including <ndbm.h>"
15445                 ;;
15446         esac
15447         ;;
15448 esac
15449 val="$t_ndbm"
15450 set i_ndbm
15451 eval $setvar
15452
15453 : see if net/errno.h is available
15454 val=''
15455 set net/errno.h val
15456 eval $inhdr
15457
15458 : Unfortunately, it causes problems on some systems.  Arrgh.
15459 case "$val" in
15460 $define)
15461         cat > try.c <<'EOM'
15462 #include <stdio.h>
15463 #include <errno.h>
15464 #include <net/errno.h>
15465 int func()
15466 {
15467         return ENOTSOCK;
15468 }
15469 EOM
15470         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15471                 echo "We'll be including <net/errno.h>." >&4
15472         else
15473                 echo "We won't be including <net/errno.h>." >&4
15474                 val="$undef"
15475         fi
15476         $rm -f try.* try
15477         ;;
15478 esac
15479 set i_neterrno
15480 eval $setvar
15481
15482 : see if netinet/tcp.h is available
15483 set netinet/tcp.h i_netinettcp
15484 eval $inhdr
15485
15486 : see if this is a poll.h system
15487 set poll.h i_poll
15488 eval $inhdr
15489
15490 : see if this is a prot.h system
15491 set prot.h i_prot
15492 eval $inhdr
15493
15494 echo " "
15495 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15496 $cat <<'EOSH' > Cppsym.know
15497 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15498 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15499 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15500 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15501 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15502 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15503 bull c cadmus clipper CMU COFF COMPILER_VERSION
15504 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15505 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15506 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15507 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15508 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15509 H3050R H3050RX hbullx20 hcx host_mips
15510 hp200 hp300 hp700 HP700 hp800 hp9000
15511 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15512 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15513 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15514 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15515 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15516 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15517 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15518 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15519 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15520 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15521 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15522 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15523 MATH_HAS_NO_SIDE_EFFECTS
15524 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15525 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15526 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15527 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15528 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15529 NetBSD news1500 news1700 news1800 news1900 news3700
15530 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15531 ns32016 ns32332 ns32k nsc32000
15532 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15533 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15534 pc532 pdp11 PGC PIC plexus PORTAR posix
15535 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15536 POSIX_C_SOURCE POSIX_SOURCE POWER
15537 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15538 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15539 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15540 sony sony_news sonyrisc sparc sparclite spectrum
15541 stardent stdc STDC_EXT stratos sun sun3 sun386
15542 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15543 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15544 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15545 sysV68 sysV88 Tek4132 Tek4300 titan
15546 TM3200 TM5400 TM5600
15547 tower tower32 tower32_200 tower32_600 tower32_700
15548 tower32_800 tower32_850 tss
15549 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15550 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15551 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15552 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15553 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15554 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15555 z8000
15556 EOSH
15557 # Maybe put other stuff here too.
15558 cat <<EOSH >>Cppsym.know
15559 $osname
15560 EOSH
15561 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15562 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15563 $cat Cppsym.know > Cppsym.c
15564 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15565 $rm -f Cppsym.a Cppsym.b Cppsym.c
15566 cat <<EOSH > Cppsym
15567 $startsh
15568 if $test \$# -gt 0; then
15569     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15570     if $test -s Cppsym.got; then
15571         $rm -f Cppsym.got
15572         exit 0
15573     fi
15574     $rm -f Cppsym.got
15575     exit 1
15576 else
15577     $tr " " "$trnl" | ./Cppsym.try
15578     exit 0
15579 fi
15580 EOSH
15581 chmod +x Cppsym
15582 $eunicefix Cppsym
15583 cat <<EOSH > Cppsym.try
15584 $startsh
15585 cat <<'EOCP' > try.c
15586 #include <stdio.h>
15587 int main() {
15588 EOCP
15589 $awk \\
15590 EOSH
15591 cat <<'EOSH' >> Cppsym.try
15592 'length($1) > 0 {
15593     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15594     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15595     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15596     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 }'       >> try.c
15598 echo 'return 0;}' >> try.c
15599 EOSH
15600 cat <<EOSH >> Cppsym.try
15601 ccflags="$ccflags"
15602 case "$osname-$gccversion" in
15603 irix-) ccflags="\$ccflags -woff 1178" ;;
15604 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15605 esac
15606 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15607 EOSH
15608 chmod +x Cppsym.try
15609 $eunicefix Cppsym.try
15610 ./Cppsym < Cppsym.know > Cppsym.true
15611 : now check the C compiler for additional symbols
15612 postprocess_cc_v=''
15613 case "$osname" in
15614 aix) postprocess_cc_v="|$tr , ' '" ;;
15615 esac
15616 $cat >ccsym <<EOS
15617 $startsh
15618 $cat >tmp.c <<EOF
15619 extern int foo;
15620 EOF
15621 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15622 do
15623         case "\$i" in
15624         -D*) echo "\$i" | $sed 's/^-D//';;
15625         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15626         esac
15627 done
15628 $rm -f try.c
15629 EOS
15630 postprocess_cc_v=''
15631 chmod +x ccsym
15632 $eunicefix ccsym
15633 ./ccsym > ccsym1.raw
15634 if $test -s ccsym1.raw; then
15635        $sort ccsym1.raw | $uniq >ccsym.raw
15636 else
15637        mv ccsym1.raw ccsym.raw
15638 fi
15639
15640 $awk '/\=/ { print $0; next }
15641         { print $0"=1" }' ccsym.raw >ccsym.list
15642 $awk '/\=/ { print $0; next }
15643         { print $0"=1" }' Cppsym.true >ccsym.true
15644 $comm -13 ccsym.true ccsym.list >ccsym.own
15645 $comm -12 ccsym.true ccsym.list >ccsym.com
15646 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15647 also=''
15648 if $test -z ccsym.raw; then
15649         echo "Your C compiler doesn't seem to define any symbols!" >&4
15650         echo " "
15651         echo "However, your C preprocessor defines the following symbols:"
15652         $cat Cppsym.true
15653         ccsymbols=''
15654         cppsymbols=`$cat Cppsym.true`
15655         cppsymbols=`echo $cppsymbols`
15656         cppccsymbols="$cppsymbols"
15657 else
15658         if $test -s ccsym.com; then
15659                 echo "Your C compiler and pre-processor define these symbols:"
15660                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15661                 also='also '
15662                 symbols='ones'
15663                 cppccsymbols=`$cat ccsym.com`
15664                 cppccsymbols=`echo $cppccsymbols`
15665                 $test "$silent" || sleep 1
15666         fi
15667         if $test -s ccsym.cpp; then
15668                 $test "$also" && echo " "
15669                 echo "Your C pre-processor ${also}defines the following symbols:"
15670                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15671                 also='further '
15672                 cppsymbols=`$cat ccsym.cpp`
15673                 cppsymbols=`echo $cppsymbols`
15674                 $test "$silent" || sleep 1
15675         fi
15676         if $test -s ccsym.own; then
15677                 $test "$also" && echo " "
15678                 echo "Your C compiler ${also}defines the following cpp symbols:"
15679                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15680                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15681                 ccsymbols=`$cat ccsym.own`
15682                 ccsymbols=`echo $ccsymbols`
15683                 $test "$silent" || sleep 1
15684         fi
15685 fi
15686 $rm -f ccsym* Cppsym.*
15687
15688 : see if this is a termio system
15689 val="$undef"
15690 val2="$undef"
15691 val3="$undef"
15692 if $test `./findhdr termios.h`; then
15693         set tcsetattr i_termios
15694         eval $inlibc
15695         val3="$i_termios"
15696 fi
15697 echo " "
15698 case "$val3" in
15699 "$define") echo "You have POSIX termios.h... good!" >&4;;
15700 *) if ./Cppsym pyr; then
15701                 case "`/bin/universe`" in
15702                 ucb) if $test `./findhdr sgtty.h`; then
15703                                 val2="$define"
15704                                 echo "<sgtty.h> found." >&4
15705                         else
15706                                 echo "System is pyramid with BSD universe."
15707                                 echo "<sgtty.h> not found--you could have problems." >&4
15708                         fi;;
15709                 *) if $test `./findhdr termio.h`; then
15710                                 val="$define"
15711                                 echo "<termio.h> found." >&4
15712                         else
15713                                 echo "System is pyramid with USG universe."
15714                                 echo "<termio.h> not found--you could have problems." >&4
15715                         fi;;
15716                 esac
15717         elif ./usg; then
15718                 if $test `./findhdr termio.h`; then
15719                         echo "<termio.h> found." >&4
15720                         val="$define"
15721                 elif $test `./findhdr sgtty.h`; then
15722                         echo "<sgtty.h> found." >&4
15723                         val2="$define"
15724                 else
15725 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15726                 fi
15727         else
15728                 if $test `./findhdr sgtty.h`; then
15729                         echo "<sgtty.h> found." >&4
15730                         val2="$define"
15731                 elif $test `./findhdr termio.h`; then
15732                         echo "<termio.h> found." >&4
15733                         val="$define"
15734                 else
15735 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15736                 fi
15737         fi;;
15738 esac
15739 set i_termio; eval $setvar
15740 val=$val2; set i_sgtty; eval $setvar
15741 val=$val3; set i_termios; eval $setvar
15742
15743 : see if this is a shadow.h system
15744 set shadow.h i_shadow
15745 eval $inhdr
15746
15747 : see if stddef is available
15748 set stddef.h i_stddef
15749 eval $inhdr
15750
15751 : see if this is a sunmath.h system
15752 set sunmath.h i_sunmath
15753 eval $inhdr
15754
15755 : see if sys/access.h is available
15756 set sys/access.h i_sysaccess
15757 eval $inhdr
15758
15759 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15760 set sys/filio.h i_sysfilio
15761 eval $inhdr
15762 echo " "
15763 if $test `./findhdr sys/ioctl.h`; then
15764         val="$define"
15765         echo '<sys/ioctl.h> found.' >&4
15766 else
15767         val="$undef"
15768         if $test $i_sysfilio = "$define"; then
15769             echo '<sys/ioctl.h> NOT found.' >&4
15770         else
15771                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15772                 $test $i_termio = "$define" && xxx="termio.h"
15773                 $test $i_termios = "$define" && xxx="termios.h"
15774 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15775         fi
15776 fi
15777 set i_sysioctl
15778 eval $setvar
15779
15780 : see if socket ioctl defs are in sys/sockio.h
15781 echo " "
15782 xxx=`./findhdr sys/sockio.h`
15783 if $test "$xxx"; then
15784         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15785                 val="$define"
15786                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15787         else
15788                 val="$undef"
15789                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15790         fi
15791 else
15792         val="$undef"
15793         $cat <<EOM
15794 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15795 EOM
15796 fi
15797 set i_syssockio
15798 eval $setvar
15799
15800
15801 : see if this is a syslog.h system
15802 set syslog.h i_syslog
15803 eval $inhdr
15804
15805
15806 : see if this is a sys/mode.h system
15807 set sys/mode.h i_sysmode
15808 eval $inhdr
15809
15810 : see if sys/resource.h has to be included
15811 set sys/resource.h i_sysresrc
15812 eval $inhdr
15813
15814 : see if sys/security.h is available
15815 set sys/security.h i_syssecrt
15816 eval $inhdr
15817
15818 : see if this is a sys/statvfs.h system
15819 set sys/statvfs.h i_sysstatvfs
15820 eval $inhdr
15821
15822 : see if this is a sys/un.h system
15823 set sys/un.h i_sysun
15824 eval $inhdr
15825
15826
15827 : see if this is a sys/utsname.h system
15828 set sys/utsname.h i_sysutsname
15829 eval $inhdr
15830
15831 : see if this is a syswait system
15832 set sys/wait.h i_syswait
15833 eval $inhdr
15834
15835 : see if this is a ustat.h system
15836 set ustat.h i_ustat
15837 eval $inhdr
15838
15839 : see if this is an utime system
15840 set utime.h i_utime
15841 eval $inhdr
15842
15843 : see if this is a values.h system
15844 set values.h i_values
15845 eval $inhdr
15846
15847 : see if this is a vfork system
15848 case "$d_vfork" in
15849 "$define")
15850         set vfork.h i_vfork
15851         eval $inhdr
15852         ;;
15853 *)
15854         i_vfork="$undef"
15855         ;;
15856 esac
15857
15858 : see if gdbm.h is available
15859 set gdbm.h t_gdbm
15860 eval $inhdr
15861 case "$t_gdbm" in
15862 $define)
15863         : see if gdbm_open exists
15864         set gdbm_open d_gdbm_open
15865         eval $inlibc
15866         case "$d_gdbm_open" in
15867         $undef)
15868                 t_gdbm="$undef"
15869                 echo "We won't be including <gdbm.h>"
15870                 ;;
15871         esac
15872         ;;
15873 esac
15874 val="$t_gdbm"
15875 set i_gdbm
15876 eval $setvar
15877
15878 echo " "
15879 echo "Looking for extensions..." >&4
15880 : If we are using the old config.sh, known_extensions may contain
15881 : old or inaccurate or duplicate values.
15882 known_extensions=''
15883 nonxs_extensions=''
15884 : We do not use find because it might not be available.
15885 : We do not just use MANIFEST because the user may have dropped
15886 : some additional extensions into the source tree and expect them
15887 : to be built.
15888
15889 : Function to recursively find available extensions, ignoring DynaLoader
15890 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15891 find_extensions='
15892     for xxx in *; do
15893        case "$xxx" in
15894            DynaLoader|dynaload) ;;
15895            *)
15896            if $test -f $xxx/$xxx.xs; then
15897                known_extensions="$known_extensions $1$xxx";
15898            elif $test -f $xxx/Makefile.PL; then
15899                nonxs_extensions="$nonxs_extensions $1$xxx";
15900            else
15901                if $test -d $xxx -a $# -lt 10; then
15902                    set $1$xxx/ $*;
15903                    cd $xxx;
15904                    eval $find_extensions;
15905                    cd ..;
15906                    shift;
15907                fi;
15908            fi
15909            ;;
15910        esac;
15911     done'
15912 tdir=`pwd`
15913 cd $rsrc/ext
15914 set X
15915 shift
15916 eval $find_extensions
15917 set X $nonxs_extensions
15918 shift
15919 nonxs_extensions="$*"
15920 set X $known_extensions
15921 shift
15922 known_extensions="$*"
15923 cd $tdir
15924
15925 : Now see which are supported on this system.
15926 avail_ext=''
15927 for xxx in $known_extensions ; do
15928         case "$xxx" in
15929         DB_File|db_file)
15930                 case "$i_db" in
15931                 $define) avail_ext="$avail_ext $xxx" ;;
15932                 esac
15933                 ;;
15934         GDBM_File|gdbm_fil)
15935                 case "$i_gdbm" in 
15936                 $define) avail_ext="$avail_ext $xxx" ;;
15937                 esac
15938                 ;;
15939         NDBM_File|ndbm_fil)
15940                 case "$i_ndbm" in
15941                 $define)
15942                     case "$osname-$use64bitint" in
15943                     hpux-define)
15944                         case "$libs" in
15945                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15946                         esac
15947                         ;;
15948                     *) avail_ext="$avail_ext $xxx" ;;
15949                     esac
15950                     ;;
15951                 esac
15952                 ;;
15953         ODBM_File|odbm_fil) 
15954                 case "${i_dbm}${i_rpcsvcdbm}" in
15955                 *"${define}"*)
15956                     case "$osname-$use64bitint" in
15957                     hpux-define)
15958                         case "$libs" in
15959                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15960                         esac
15961                         ;;
15962                     *) avail_ext="$avail_ext $xxx" ;;
15963                     esac
15964                     ;;
15965                 esac
15966                 ;;
15967         POSIX|posix)
15968                 case "$useposix" in
15969                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15970                 esac
15971                 ;;
15972         Opcode|opcode)
15973                 case "$useopcode" in
15974                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15975                 esac
15976                 ;;
15977         Socket|socket)
15978                 case "$d_socket" in 
15979                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15980                 esac
15981                 ;;
15982         Sys/Syslog|sys/syslog)
15983                 : XXX syslog requires socket
15984                 case "$d_socket" in 
15985                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15986                 esac
15987                 ;;
15988         Thread|thread)
15989                 case "$usethreads" in
15990                 true|$define|y)
15991                         case "$useithreads" in
15992                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
15993                         esac
15994                 esac
15995                 ;;
15996         IPC/SysV|ipc/sysv)
15997                 : XXX Do we need a useipcsysv variable here
15998                 case "${d_msg}${d_sem}${d_shm}" in 
15999                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16000                 esac
16001                 ;;
16002         *)      avail_ext="$avail_ext $xxx"
16003                 ;;
16004         esac
16005 done
16006
16007 set X $avail_ext
16008 shift
16009 avail_ext="$*"
16010
16011 : Now see which nonxs extensions are supported on this system.
16012 : For now assume all are.
16013 nonxs_ext=''
16014 for xxx in $nonxs_extensions ; do
16015         case "$xxx" in
16016         *)      nonxs_ext="$nonxs_ext $xxx"
16017                 ;;
16018         esac
16019 done
16020
16021 set X $nonxs_ext
16022 shift
16023 nonxs_ext="$*"
16024
16025 case $usedl in
16026 $define)
16027         $cat <<EOM
16028 A number of extensions are supplied with $package.  You may choose to
16029 compile these extensions for dynamic loading (the default), compile
16030 them into the $package executable (static loading), or not include
16031 them at all.  Answer "none" to include no extensions.
16032 Note that DynaLoader is always built and need not be mentioned here.
16033
16034 EOM
16035         case "$dynamic_ext" in
16036         '') dflt="$avail_ext" ;;
16037         *)      dflt="$dynamic_ext"
16038                 # Perhaps we are reusing an old out-of-date config.sh.
16039                 case "$hint" in
16040                 previous)
16041                         if test X"$dynamic_ext" != X"$avail_ext"; then
16042                                 $cat <<EOM
16043 NOTICE:  Your previous config.sh list may be incorrect. 
16044 The extensions now available to you are 
16045         ${avail_ext}
16046 but the default list from your previous config.sh is
16047         ${dynamic_ext} 
16048
16049 EOM
16050                         fi
16051                         ;;
16052                 esac
16053                 ;;
16054         esac
16055         case "$dflt" in
16056         '')     dflt=none;;
16057         esac
16058         rp="What extensions do you wish to load dynamically?"
16059         . ./myread
16060         case "$ans" in
16061         none) dynamic_ext=' ' ;;
16062         *) dynamic_ext="$ans" ;;
16063         esac
16064
16065         case "$static_ext" in
16066         '')
16067                 : Exclude those already listed in dynamic linking
16068                 dflt=''
16069                 for xxx in $avail_ext; do
16070                         case " $dynamic_ext " in
16071                         *" $xxx "*) ;;
16072                         *) dflt="$dflt $xxx" ;;
16073                         esac
16074                 done
16075                 set X $dflt
16076                 shift
16077                 dflt="$*"
16078                 ;;
16079         *)  dflt="$static_ext" 
16080                 ;;
16081         esac
16082
16083         case "$dflt" in
16084         '')     dflt=none;;
16085         esac
16086         rp="What extensions do you wish to load statically?"
16087         . ./myread
16088         case "$ans" in
16089         none) static_ext=' ' ;;
16090         *) static_ext="$ans" ;;
16091         esac
16092         ;;
16093 *)
16094         $cat <<EOM
16095 A number of extensions are supplied with $package.  Answer "none" 
16096 to include no extensions. 
16097 Note that DynaLoader is always built and need not be mentioned here.
16098
16099 EOM
16100         case "$static_ext" in
16101         '') dflt="$avail_ext" ;;
16102         *)      dflt="$static_ext"
16103                 # Perhaps we are reusing an old out-of-date config.sh.
16104                 case "$hint" in
16105                 previous)
16106                         if test X"$static_ext" != X"$avail_ext"; then
16107                                 $cat <<EOM
16108 NOTICE:  Your previous config.sh list may be incorrect. 
16109 The extensions now available to you are 
16110         ${avail_ext}
16111 but the default list from your previous config.sh is
16112         ${static_ext} 
16113
16114 EOM
16115                         fi
16116                         ;;
16117                 esac
16118                 ;;
16119         esac
16120         : Exclude those that are not xs extensions
16121         case "$dflt" in
16122         '')     dflt=none;;
16123         esac
16124         rp="What extensions do you wish to include?"
16125         . ./myread
16126         case "$ans" in
16127         none) static_ext=' ' ;;
16128         *) static_ext="$ans" ;;
16129         esac
16130         ;;
16131 esac
16132
16133 set X $dynamic_ext $static_ext $nonxs_ext
16134 shift
16135 extensions="$*"
16136
16137 : Remove libraries needed only for extensions
16138 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16139 : The exception is SunOS 4.x, which needs them.
16140 case "${osname}X${osvers}" in
16141 sunos*X4*)
16142     perllibs="$libs"
16143     ;;
16144 *) case "$usedl" in
16145     $define|true|[yY]*)
16146             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16147             shift
16148             perllibs="$*"
16149             ;;
16150     *)  perllibs="$libs"
16151             ;;
16152     esac
16153     ;;
16154 esac
16155
16156 : Remove build directory name from cppstdin so it can be used from
16157 : either the present location or the final installed location.
16158 echo " "
16159 : Get out of the UU directory to get correct path name.
16160 cd ..
16161 case "$cppstdin" in
16162 `pwd`/cppstdin)
16163         echo "Stripping down cppstdin path name"
16164         cppstdin=cppstdin
16165         ;;
16166 esac
16167 cd UU
16168
16169 : end of configuration questions
16170 echo " "
16171 echo "End of configuration questions."
16172 echo " "
16173
16174 : back to where it started
16175 if test -d ../UU; then
16176         cd ..
16177 fi
16178
16179 : configuration may be patched via a 'config.over' file
16180 if $test -f config.over; then
16181         echo " "
16182         dflt=y
16183         rp='I see a config.over file.  Do you wish to load it?'
16184         . UU/myread
16185         case "$ans" in
16186         n*) echo "OK, I'll ignore it.";;
16187         *)      . ./config.over
16188                 echo "Configuration override changes have been loaded."
16189                 ;;
16190         esac
16191 fi
16192
16193 : in case they want portability, strip down executable paths
16194 case "$d_portable" in
16195 "$define")
16196         echo " "
16197         echo "Stripping down executable paths..." >&4
16198         for file in $loclist $trylist; do
16199                 eval temp=\$$file
16200                 eval $file=`basename $temp`
16201         done
16202         ;;
16203 esac
16204
16205 : create config.sh file
16206 echo " "
16207 echo "Creating config.sh..." >&4
16208 $spitshell <<EOT >config.sh
16209 $startsh
16210 #
16211 # This file was produced by running the Configure script. It holds all the
16212 # definitions figured out by Configure. Should you modify one of these values,
16213 # do not forget to propagate your changes by running "Configure -der". You may
16214 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16215 #
16216
16217 # Package name      : $package
16218 # Source directory  : $src
16219 # Configuration time: $cf_time
16220 # Configured by     : $cf_by
16221 # Target system     : $myuname
16222
16223 Author='$Author'
16224 Date='$Date'
16225 Header='$Header'
16226 Id='$Id'
16227 Locker='$Locker'
16228 Log='$Log'
16229 Mcc='$Mcc'
16230 RCSfile='$RCSfile'
16231 Revision='$Revision'
16232 Source='$Source'
16233 State='$State'
16234 _a='$_a'
16235 _exe='$_exe'
16236 _o='$_o'
16237 afs='$afs'
16238 afsroot='$afsroot'
16239 alignbytes='$alignbytes'
16240 ansi2knr='$ansi2knr'
16241 aphostname='$aphostname'
16242 api_revision='$api_revision'
16243 api_subversion='$api_subversion'
16244 api_version='$api_version'
16245 api_versionstring='$api_versionstring'
16246 ar='$ar'
16247 archlib='$archlib'
16248 archlibexp='$archlibexp'
16249 archname64='$archname64'
16250 archname='$archname'
16251 archobjs='$archobjs'
16252 awk='$awk'
16253 baserev='$baserev'
16254 bash='$bash'
16255 bin='$bin'
16256 bincompat5005='$bincompat5005'
16257 binexp='$binexp'
16258 bison='$bison'
16259 byacc='$byacc'
16260 byteorder='$byteorder'
16261 c='$c'
16262 castflags='$castflags'
16263 cat='$cat'
16264 cc='$cc'
16265 cccdlflags='$cccdlflags'
16266 ccdlflags='$ccdlflags'
16267 ccflags='$ccflags'
16268 ccflags_uselargefiles='$ccflags_uselargefiles'
16269 ccname='$ccname'
16270 ccsymbols='$ccsymbols'
16271 ccversion='$ccversion'
16272 cf_by='$cf_by'
16273 cf_email='$cf_email'
16274 cf_time='$cf_time'
16275 charsize='$charsize'
16276 chgrp='$chgrp'
16277 chmod='$chmod'
16278 chown='$chown'
16279 clocktype='$clocktype'
16280 comm='$comm'
16281 compress='$compress'
16282 contains='$contains'
16283 cp='$cp'
16284 cpio='$cpio'
16285 cpp='$cpp'
16286 cpp_stuff='$cpp_stuff'
16287 cppccsymbols='$cppccsymbols'
16288 cppflags='$cppflags'
16289 cpplast='$cpplast'
16290 cppminus='$cppminus'
16291 cpprun='$cpprun'
16292 cppstdin='$cppstdin'
16293 cppsymbols='$cppsymbols'
16294 crosscompile='$crosscompile'
16295 cryptlib='$cryptlib'
16296 csh='$csh'
16297 d_Gconvert='$d_Gconvert'
16298 d_PRIEUldbl='$d_PRIEUldbl'
16299 d_PRIFUldbl='$d_PRIFUldbl'
16300 d_PRIGUldbl='$d_PRIGUldbl'
16301 d_PRIXU64='$d_PRIXU64'
16302 d_PRId64='$d_PRId64'
16303 d_PRIeldbl='$d_PRIeldbl'
16304 d_PRIfldbl='$d_PRIfldbl'
16305 d_PRIgldbl='$d_PRIgldbl'
16306 d_PRIi64='$d_PRIi64'
16307 d_PRIo64='$d_PRIo64'
16308 d_PRIu64='$d_PRIu64'
16309 d_PRIx64='$d_PRIx64'
16310 d_SCNfldbl='$d_SCNfldbl'
16311 d__fwalk='$d__fwalk'
16312 d_access='$d_access'
16313 d_accessx='$d_accessx'
16314 d_alarm='$d_alarm'
16315 d_archlib='$d_archlib'
16316 d_atolf='$d_atolf'
16317 d_atoll='$d_atoll'
16318 d_attribut='$d_attribut'
16319 d_bcmp='$d_bcmp'
16320 d_bcopy='$d_bcopy'
16321 d_bincompat5005='$d_bincompat5005'
16322 d_bsd='$d_bsd'
16323 d_bsdgetpgrp='$d_bsdgetpgrp'
16324 d_bsdsetpgrp='$d_bsdsetpgrp'
16325 d_bzero='$d_bzero'
16326 d_casti32='$d_casti32'
16327 d_castneg='$d_castneg'
16328 d_charvspr='$d_charvspr'
16329 d_chown='$d_chown'
16330 d_chroot='$d_chroot'
16331 d_chsize='$d_chsize'
16332 d_closedir='$d_closedir'
16333 d_cmsghdr_s='$d_cmsghdr_s'
16334 d_const='$d_const'
16335 d_crypt='$d_crypt'
16336 d_csh='$d_csh'
16337 d_cuserid='$d_cuserid'
16338 d_dbl_dig='$d_dbl_dig'
16339 d_dbminitproto='$d_dbminitproto'
16340 d_difftime='$d_difftime'
16341 d_dirnamlen='$d_dirnamlen'
16342 d_dlerror='$d_dlerror'
16343 d_dlopen='$d_dlopen'
16344 d_dlsymun='$d_dlsymun'
16345 d_dosuid='$d_dosuid'
16346 d_drand48proto='$d_drand48proto'
16347 d_dup2='$d_dup2'
16348 d_eaccess='$d_eaccess'
16349 d_endgrent='$d_endgrent'
16350 d_endhent='$d_endhent'
16351 d_endnent='$d_endnent'
16352 d_endpent='$d_endpent'
16353 d_endpwent='$d_endpwent'
16354 d_endsent='$d_endsent'
16355 d_eofnblk='$d_eofnblk'
16356 d_eunice='$d_eunice'
16357 d_fchmod='$d_fchmod'
16358 d_fchown='$d_fchown'
16359 d_fcntl='$d_fcntl'
16360 d_fcntl_can_lock='$d_fcntl_can_lock'
16361 d_fd_macros='$d_fd_macros'
16362 d_fd_set='$d_fd_set'
16363 d_fds_bits='$d_fds_bits'
16364 d_fgetpos='$d_fgetpos'
16365 d_flexfnam='$d_flexfnam'
16366 d_flock='$d_flock'
16367 d_flockproto='$d_flockproto'
16368 d_fork='$d_fork'
16369 d_fpathconf='$d_fpathconf'
16370 d_fpos64_t='$d_fpos64_t'
16371 d_frexpl='$d_frexpl'
16372 d_fs_data_s='$d_fs_data_s'
16373 d_fseeko='$d_fseeko'
16374 d_fsetpos='$d_fsetpos'
16375 d_fstatfs='$d_fstatfs'
16376 d_fstatvfs='$d_fstatvfs'
16377 d_fsync='$d_fsync'
16378 d_ftello='$d_ftello'
16379 d_ftime='$d_ftime'
16380 d_getcwd='$d_getcwd'
16381 d_getespwnam='$d_getespwnam'
16382 d_getfsstat='$d_getfsstat'
16383 d_getgrent='$d_getgrent'
16384 d_getgrps='$d_getgrps'
16385 d_gethbyaddr='$d_gethbyaddr'
16386 d_gethbyname='$d_gethbyname'
16387 d_gethent='$d_gethent'
16388 d_gethname='$d_gethname'
16389 d_gethostprotos='$d_gethostprotos'
16390 d_getitimer='$d_getitimer'
16391 d_getlogin='$d_getlogin'
16392 d_getmnt='$d_getmnt'
16393 d_getmntent='$d_getmntent'
16394 d_getnbyaddr='$d_getnbyaddr'
16395 d_getnbyname='$d_getnbyname'
16396 d_getnent='$d_getnent'
16397 d_getnetprotos='$d_getnetprotos'
16398 d_getpagsz='$d_getpagsz'
16399 d_getpbyname='$d_getpbyname'
16400 d_getpbynumber='$d_getpbynumber'
16401 d_getpent='$d_getpent'
16402 d_getpgid='$d_getpgid'
16403 d_getpgrp2='$d_getpgrp2'
16404 d_getpgrp='$d_getpgrp'
16405 d_getppid='$d_getppid'
16406 d_getprior='$d_getprior'
16407 d_getprotoprotos='$d_getprotoprotos'
16408 d_getprpwnam='$d_getprpwnam'
16409 d_getpwent='$d_getpwent'
16410 d_getsbyname='$d_getsbyname'
16411 d_getsbyport='$d_getsbyport'
16412 d_getsent='$d_getsent'
16413 d_getservprotos='$d_getservprotos'
16414 d_getspnam='$d_getspnam'
16415 d_gettimeod='$d_gettimeod'
16416 d_gnulibc='$d_gnulibc'
16417 d_grpasswd='$d_grpasswd'
16418 d_hasmntopt='$d_hasmntopt'
16419 d_htonl='$d_htonl'
16420 d_iconv='$d_iconv'
16421 d_index='$d_index'
16422 d_inetaton='$d_inetaton'
16423 d_int64_t='$d_int64_t'
16424 d_isascii='$d_isascii'
16425 d_isnan='$d_isnan'
16426 d_isnanl='$d_isnanl'
16427 d_killpg='$d_killpg'
16428 d_lchown='$d_lchown'
16429 d_ldbl_dig='$d_ldbl_dig'
16430 d_link='$d_link'
16431 d_locconv='$d_locconv'
16432 d_lockf='$d_lockf'
16433 d_longdbl='$d_longdbl'
16434 d_longlong='$d_longlong'
16435 d_lseekproto='$d_lseekproto'
16436 d_lstat='$d_lstat'
16437 d_madvise='$d_madvise'
16438 d_mblen='$d_mblen'
16439 d_mbstowcs='$d_mbstowcs'
16440 d_mbtowc='$d_mbtowc'
16441 d_memchr='$d_memchr'
16442 d_memcmp='$d_memcmp'
16443 d_memcpy='$d_memcpy'
16444 d_memmove='$d_memmove'
16445 d_memset='$d_memset'
16446 d_mkdir='$d_mkdir'
16447 d_mkdtemp='$d_mkdtemp'
16448 d_mkfifo='$d_mkfifo'
16449 d_mkstemp='$d_mkstemp'
16450 d_mkstemps='$d_mkstemps'
16451 d_mktime='$d_mktime'
16452 d_mmap='$d_mmap'
16453 d_modfl='$d_modfl'
16454 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16455 d_mprotect='$d_mprotect'
16456 d_msg='$d_msg'
16457 d_msg_ctrunc='$d_msg_ctrunc'
16458 d_msg_dontroute='$d_msg_dontroute'
16459 d_msg_oob='$d_msg_oob'
16460 d_msg_peek='$d_msg_peek'
16461 d_msg_proxy='$d_msg_proxy'
16462 d_msgctl='$d_msgctl'
16463 d_msgget='$d_msgget'
16464 d_msghdr_s='$d_msghdr_s'
16465 d_msgrcv='$d_msgrcv'
16466 d_msgsnd='$d_msgsnd'
16467 d_msync='$d_msync'
16468 d_munmap='$d_munmap'
16469 d_mymalloc='$d_mymalloc'
16470 d_nice='$d_nice'
16471 d_nv_preserves_uv='$d_nv_preserves_uv'
16472 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16473 d_off64_t='$d_off64_t'
16474 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16475 d_oldpthreads='$d_oldpthreads'
16476 d_oldsock='$d_oldsock'
16477 d_open3='$d_open3'
16478 d_pathconf='$d_pathconf'
16479 d_pause='$d_pause'
16480 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16481 d_phostname='$d_phostname'
16482 d_pipe='$d_pipe'
16483 d_poll='$d_poll'
16484 d_portable='$d_portable'
16485 d_pthread_yield='$d_pthread_yield'
16486 d_pwage='$d_pwage'
16487 d_pwchange='$d_pwchange'
16488 d_pwclass='$d_pwclass'
16489 d_pwcomment='$d_pwcomment'
16490 d_pwexpire='$d_pwexpire'
16491 d_pwgecos='$d_pwgecos'
16492 d_pwpasswd='$d_pwpasswd'
16493 d_pwquota='$d_pwquota'
16494 d_qgcvt='$d_qgcvt'
16495 d_quad='$d_quad'
16496 d_readdir='$d_readdir'
16497 d_readlink='$d_readlink'
16498 d_readv='$d_readv'
16499 d_realpath='$d_realpath'
16500 d_recvmsg='$d_recvmsg'
16501 d_rename='$d_rename'
16502 d_rewinddir='$d_rewinddir'
16503 d_rmdir='$d_rmdir'
16504 d_safebcpy='$d_safebcpy'
16505 d_safemcpy='$d_safemcpy'
16506 d_sanemcmp='$d_sanemcmp'
16507 d_sbrkproto='$d_sbrkproto'
16508 d_sched_yield='$d_sched_yield'
16509 d_scm_rights='$d_scm_rights'
16510 d_seekdir='$d_seekdir'
16511 d_select='$d_select'
16512 d_sem='$d_sem'
16513 d_semctl='$d_semctl'
16514 d_semctl_semid_ds='$d_semctl_semid_ds'
16515 d_semctl_semun='$d_semctl_semun'
16516 d_semget='$d_semget'
16517 d_semop='$d_semop'
16518 d_sendmsg='$d_sendmsg'
16519 d_setegid='$d_setegid'
16520 d_seteuid='$d_seteuid'
16521 d_setgrent='$d_setgrent'
16522 d_setgrps='$d_setgrps'
16523 d_sethent='$d_sethent'
16524 d_setitimer='$d_setitimer'
16525 d_setlinebuf='$d_setlinebuf'
16526 d_setlocale='$d_setlocale'
16527 d_setnent='$d_setnent'
16528 d_setpent='$d_setpent'
16529 d_setpgid='$d_setpgid'
16530 d_setpgrp2='$d_setpgrp2'
16531 d_setpgrp='$d_setpgrp'
16532 d_setprior='$d_setprior'
16533 d_setproctitle='$d_setproctitle'
16534 d_setpwent='$d_setpwent'
16535 d_setregid='$d_setregid'
16536 d_setresgid='$d_setresgid'
16537 d_setresuid='$d_setresuid'
16538 d_setreuid='$d_setreuid'
16539 d_setrgid='$d_setrgid'
16540 d_setruid='$d_setruid'
16541 d_setsent='$d_setsent'
16542 d_setsid='$d_setsid'
16543 d_setvbuf='$d_setvbuf'
16544 d_sfio='$d_sfio'
16545 d_shm='$d_shm'
16546 d_shmat='$d_shmat'
16547 d_shmatprototype='$d_shmatprototype'
16548 d_shmctl='$d_shmctl'
16549 d_shmdt='$d_shmdt'
16550 d_shmget='$d_shmget'
16551 d_sigaction='$d_sigaction'
16552 d_sigprocmask='$d_sigprocmask'
16553 d_sigsetjmp='$d_sigsetjmp'
16554 d_sockatmark='$d_sockatmark'
16555 d_sockatmarkproto='$d_sockatmarkproto'
16556 d_socket='$d_socket'
16557 d_socklen_t='$d_socklen_t'
16558 d_sockpair='$d_sockpair'
16559 d_socks5_init='$d_socks5_init'
16560 d_sqrtl='$d_sqrtl'
16561 d_sresgproto='$d_sresgproto'
16562 d_sresuproto='$d_sresuproto'
16563 d_statblks='$d_statblks'
16564 d_statfs_f_flags='$d_statfs_f_flags'
16565 d_statfs_s='$d_statfs_s'
16566 d_statvfs='$d_statvfs'
16567 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16568 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16569 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16570 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16571 d_stdio_stream_array='$d_stdio_stream_array'
16572 d_stdiobase='$d_stdiobase'
16573 d_stdstdio='$d_stdstdio'
16574 d_strchr='$d_strchr'
16575 d_strcoll='$d_strcoll'
16576 d_strctcpy='$d_strctcpy'
16577 d_strerrm='$d_strerrm'
16578 d_strerror='$d_strerror'
16579 d_strftime='$d_strftime'
16580 d_strtod='$d_strtod'
16581 d_strtol='$d_strtol'
16582 d_strtold='$d_strtold'
16583 d_strtoll='$d_strtoll'
16584 d_strtoq='$d_strtoq'
16585 d_strtoul='$d_strtoul'
16586 d_strtoull='$d_strtoull'
16587 d_strtouq='$d_strtouq'
16588 d_strxfrm='$d_strxfrm'
16589 d_suidsafe='$d_suidsafe'
16590 d_symlink='$d_symlink'
16591 d_syscall='$d_syscall'
16592 d_syscallproto='$d_syscallproto'
16593 d_sysconf='$d_sysconf'
16594 d_sysernlst='$d_sysernlst'
16595 d_syserrlst='$d_syserrlst'
16596 d_system='$d_system'
16597 d_tcgetpgrp='$d_tcgetpgrp'
16598 d_tcsetpgrp='$d_tcsetpgrp'
16599 d_telldir='$d_telldir'
16600 d_telldirproto='$d_telldirproto'
16601 d_time='$d_time'
16602 d_times='$d_times'
16603 d_truncate='$d_truncate'
16604 d_tzname='$d_tzname'
16605 d_u32align='$d_u32align'
16606 d_ualarm='$d_ualarm'
16607 d_umask='$d_umask'
16608 d_uname='$d_uname'
16609 d_union_semun='$d_union_semun'
16610 d_usleep='$d_usleep'
16611 d_usleepproto='$d_usleepproto'
16612 d_ustat='$d_ustat'
16613 d_vendorarch='$d_vendorarch'
16614 d_vendorbin='$d_vendorbin'
16615 d_vendorlib='$d_vendorlib'
16616 d_vfork='$d_vfork'
16617 d_void_closedir='$d_void_closedir'
16618 d_voidsig='$d_voidsig'
16619 d_voidtty='$d_voidtty'
16620 d_volatile='$d_volatile'
16621 d_vprintf='$d_vprintf'
16622 d_wait4='$d_wait4'
16623 d_waitpid='$d_waitpid'
16624 d_wcstombs='$d_wcstombs'
16625 d_wctomb='$d_wctomb'
16626 d_writev='$d_writev'
16627 d_xenix='$d_xenix'
16628 date='$date'
16629 db_hashtype='$db_hashtype'
16630 db_prefixtype='$db_prefixtype'
16631 db_version_major='$db_version_major'
16632 db_version_minor='$db_version_minor'
16633 db_version_patch='$db_version_patch'
16634 defvoidused='$defvoidused'
16635 direntrytype='$direntrytype'
16636 dlext='$dlext'
16637 dlsrc='$dlsrc'
16638 doublesize='$doublesize'
16639 drand01='$drand01'
16640 dynamic_ext='$dynamic_ext'
16641 eagain='$eagain'
16642 ebcdic='$ebcdic'
16643 echo='$echo'
16644 egrep='$egrep'
16645 emacs='$emacs'
16646 eunicefix='$eunicefix'
16647 exe_ext='$exe_ext'
16648 expr='$expr'
16649 extensions='$extensions'
16650 fflushNULL='$fflushNULL'
16651 fflushall='$fflushall'
16652 find='$find'
16653 firstmakefile='$firstmakefile'
16654 flex='$flex'
16655 fpossize='$fpossize'
16656 fpostype='$fpostype'
16657 freetype='$freetype'
16658 full_ar='$full_ar'
16659 full_csh='$full_csh'
16660 full_sed='$full_sed'
16661 gccosandvers='$gccosandvers'
16662 gccversion='$gccversion'
16663 gidformat='$gidformat'
16664 gidsign='$gidsign'
16665 gidsize='$gidsize'
16666 gidtype='$gidtype'
16667 glibpth='$glibpth'
16668 grep='$grep'
16669 groupcat='$groupcat'
16670 groupstype='$groupstype'
16671 gzip='$gzip'
16672 h_fcntl='$h_fcntl'
16673 h_sysfile='$h_sysfile'
16674 hint='$hint'
16675 hostcat='$hostcat'
16676 i16size='$i16size'
16677 i16type='$i16type'
16678 i32size='$i32size'
16679 i32type='$i32type'
16680 i64size='$i64size'
16681 i64type='$i64type'
16682 i8size='$i8size'
16683 i8type='$i8type'
16684 i_arpainet='$i_arpainet'
16685 i_bsdioctl='$i_bsdioctl'
16686 i_db='$i_db'
16687 i_dbm='$i_dbm'
16688 i_dirent='$i_dirent'
16689 i_dld='$i_dld'
16690 i_dlfcn='$i_dlfcn'
16691 i_fcntl='$i_fcntl'
16692 i_float='$i_float'
16693 i_gdbm='$i_gdbm'
16694 i_grp='$i_grp'
16695 i_iconv='$i_iconv'
16696 i_ieeefp='$i_ieeefp'
16697 i_inttypes='$i_inttypes'
16698 i_libutil='$i_libutil'
16699 i_limits='$i_limits'
16700 i_locale='$i_locale'
16701 i_machcthr='$i_machcthr'
16702 i_malloc='$i_malloc'
16703 i_math='$i_math'
16704 i_memory='$i_memory'
16705 i_mntent='$i_mntent'
16706 i_ndbm='$i_ndbm'
16707 i_netdb='$i_netdb'
16708 i_neterrno='$i_neterrno'
16709 i_netinettcp='$i_netinettcp'
16710 i_niin='$i_niin'
16711 i_poll='$i_poll'
16712 i_prot='$i_prot'
16713 i_pthread='$i_pthread'
16714 i_pwd='$i_pwd'
16715 i_rpcsvcdbm='$i_rpcsvcdbm'
16716 i_sfio='$i_sfio'
16717 i_sgtty='$i_sgtty'
16718 i_shadow='$i_shadow'
16719 i_socks='$i_socks'
16720 i_stdarg='$i_stdarg'
16721 i_stddef='$i_stddef'
16722 i_stdlib='$i_stdlib'
16723 i_string='$i_string'
16724 i_sunmath='$i_sunmath'
16725 i_sysaccess='$i_sysaccess'
16726 i_sysdir='$i_sysdir'
16727 i_sysfile='$i_sysfile'
16728 i_sysfilio='$i_sysfilio'
16729 i_sysin='$i_sysin'
16730 i_sysioctl='$i_sysioctl'
16731 i_syslog='$i_syslog'
16732 i_sysmman='$i_sysmman'
16733 i_sysmode='$i_sysmode'
16734 i_sysmount='$i_sysmount'
16735 i_sysndir='$i_sysndir'
16736 i_sysparam='$i_sysparam'
16737 i_sysresrc='$i_sysresrc'
16738 i_syssecrt='$i_syssecrt'
16739 i_sysselct='$i_sysselct'
16740 i_syssockio='$i_syssockio'
16741 i_sysstat='$i_sysstat'
16742 i_sysstatfs='$i_sysstatfs'
16743 i_sysstatvfs='$i_sysstatvfs'
16744 i_systime='$i_systime'
16745 i_systimek='$i_systimek'
16746 i_systimes='$i_systimes'
16747 i_systypes='$i_systypes'
16748 i_sysuio='$i_sysuio'
16749 i_sysun='$i_sysun'
16750 i_sysutsname='$i_sysutsname'
16751 i_sysvfs='$i_sysvfs'
16752 i_syswait='$i_syswait'
16753 i_termio='$i_termio'
16754 i_termios='$i_termios'
16755 i_time='$i_time'
16756 i_unistd='$i_unistd'
16757 i_ustat='$i_ustat'
16758 i_utime='$i_utime'
16759 i_values='$i_values'
16760 i_varargs='$i_varargs'
16761 i_varhdr='$i_varhdr'
16762 i_vfork='$i_vfork'
16763 ignore_versioned_solibs='$ignore_versioned_solibs'
16764 inc_version_list='$inc_version_list'
16765 inc_version_list_init='$inc_version_list_init'
16766 incpath='$incpath'
16767 inews='$inews'
16768 installarchlib='$installarchlib'
16769 installbin='$installbin'
16770 installman1dir='$installman1dir'
16771 installman3dir='$installman3dir'
16772 installprefix='$installprefix'
16773 installprefixexp='$installprefixexp'
16774 installprivlib='$installprivlib'
16775 installscript='$installscript'
16776 installsitearch='$installsitearch'
16777 installsitebin='$installsitebin'
16778 installsitelib='$installsitelib'
16779 installstyle='$installstyle'
16780 installusrbinperl='$installusrbinperl'
16781 installvendorarch='$installvendorarch'
16782 installvendorbin='$installvendorbin'
16783 installvendorlib='$installvendorlib'
16784 intsize='$intsize'
16785 issymlink='$issymlink'
16786 ivdformat='$ivdformat'
16787 ivsize='$ivsize'
16788 ivtype='$ivtype'
16789 known_extensions='$known_extensions'
16790 ksh='$ksh'
16791 ld='$ld'
16792 lddlflags='$lddlflags'
16793 ldflags='$ldflags'
16794 ldflags_uselargefiles='$ldflags_uselargefiles'
16795 ldlibpthname='$ldlibpthname'
16796 less='$less'
16797 lib_ext='$lib_ext'
16798 libc='$libc'
16799 libperl='$libperl'
16800 libpth='$libpth'
16801 libs='$libs'
16802 libsdirs='$libsdirs'
16803 libsfiles='$libsfiles'
16804 libsfound='$libsfound'
16805 libspath='$libspath'
16806 libswanted='$libswanted'
16807 libswanted_uselargefiles='$libswanted_uselargefiles'
16808 line='$line'
16809 lint='$lint'
16810 lkflags='$lkflags'
16811 ln='$ln'
16812 lns='$lns'
16813 locincpth='$locincpth'
16814 loclibpth='$loclibpth'
16815 longdblsize='$longdblsize'
16816 longlongsize='$longlongsize'
16817 longsize='$longsize'
16818 lp='$lp'
16819 lpr='$lpr'
16820 ls='$ls'
16821 lseeksize='$lseeksize'
16822 lseektype='$lseektype'
16823 mail='$mail'
16824 mailx='$mailx'
16825 make='$make'
16826 make_set_make='$make_set_make'
16827 mallocobj='$mallocobj'
16828 mallocsrc='$mallocsrc'
16829 malloctype='$malloctype'
16830 man1dir='$man1dir'
16831 man1direxp='$man1direxp'
16832 man1ext='$man1ext'
16833 man3dir='$man3dir'
16834 man3direxp='$man3direxp'
16835 man3ext='$man3ext'
16836 mips_type='$mips_type'
16837 mkdir='$mkdir'
16838 mmaptype='$mmaptype'
16839 modetype='$modetype'
16840 more='$more'
16841 multiarch='$multiarch'
16842 mv='$mv'
16843 myarchname='$myarchname'
16844 mydomain='$mydomain'
16845 myhostname='$myhostname'
16846 myuname='$myuname'
16847 n='$n'
16848 need_va_copy='$need_va_copy'
16849 netdb_hlen_type='$netdb_hlen_type'
16850 netdb_host_type='$netdb_host_type'
16851 netdb_name_type='$netdb_name_type'
16852 netdb_net_type='$netdb_net_type'
16853 nm='$nm'
16854 nm_opt='$nm_opt'
16855 nm_so_opt='$nm_so_opt'
16856 nonxs_ext='$nonxs_ext'
16857 nroff='$nroff'
16858 nvEUformat='$nvEUformat'
16859 nvFUformat='$nvFUformat'
16860 nvGUformat='$nvGUformat'
16861 nveformat='$nveformat'
16862 nvfformat='$nvfformat'
16863 nvgformat='$nvgformat'
16864 nvsize='$nvsize'
16865 nvtype='$nvtype'
16866 o_nonblock='$o_nonblock'
16867 obj_ext='$obj_ext'
16868 old_pthread_create_joinable='$old_pthread_create_joinable'
16869 optimize='$optimize'
16870 orderlib='$orderlib'
16871 osname='$osname'
16872 osvers='$osvers'
16873 otherlibdirs='$otherlibdirs'
16874 package='$package'
16875 pager='$pager'
16876 passcat='$passcat'
16877 patchlevel='$patchlevel'
16878 path_sep='$path_sep'
16879 perl5='$perl5'
16880 perl='$perl'
16881 perl_patchlevel='$perl_patchlevel'
16882 perladmin='$perladmin'
16883 perllibs='$perllibs'
16884 perlpath='$perlpath'
16885 pg='$pg'
16886 phostname='$phostname'
16887 pidtype='$pidtype'
16888 plibpth='$plibpth'
16889 pm_apiversion='$pm_apiversion'
16890 pmake='$pmake'
16891 pr='$pr'
16892 prefix='$prefix'
16893 prefixexp='$prefixexp'
16894 privlib='$privlib'
16895 privlibexp='$privlibexp'
16896 prototype='$prototype'
16897 ptrsize='$ptrsize'
16898 quadkind='$quadkind'
16899 quadtype='$quadtype'
16900 randbits='$randbits'
16901 randfunc='$randfunc'
16902 randseedtype='$randseedtype'
16903 ranlib='$ranlib'
16904 rd_nodata='$rd_nodata'
16905 revision='$revision'
16906 rm='$rm'
16907 rmail='$rmail'
16908 runnm='$runnm'
16909 sPRIEUldbl='$sPRIEUldbl'
16910 sPRIFUldbl='$sPRIFUldbl'
16911 sPRIGUldbl='$sPRIGUldbl'
16912 sPRIXU64='$sPRIXU64'
16913 sPRId64='$sPRId64'
16914 sPRIeldbl='$sPRIeldbl'
16915 sPRIfldbl='$sPRIfldbl'
16916 sPRIgldbl='$sPRIgldbl'
16917 sPRIi64='$sPRIi64'
16918 sPRIo64='$sPRIo64'
16919 sPRIu64='$sPRIu64'
16920 sPRIx64='$sPRIx64'
16921 sSCNfldbl='$sSCNfldbl'
16922 sched_yield='$sched_yield'
16923 scriptdir='$scriptdir'
16924 scriptdirexp='$scriptdirexp'
16925 sed='$sed'
16926 seedfunc='$seedfunc'
16927 selectminbits='$selectminbits'
16928 selecttype='$selecttype'
16929 sendmail='$sendmail'
16930 sh='$sh'
16931 shar='$shar'
16932 sharpbang='$sharpbang'
16933 shmattype='$shmattype'
16934 shortsize='$shortsize'
16935 shrpenv='$shrpenv'
16936 shsharp='$shsharp'
16937 sig_count='$sig_count'
16938 sig_name='$sig_name'
16939 sig_name_init='$sig_name_init'
16940 sig_num='$sig_num'
16941 sig_num_init='$sig_num_init'
16942 sig_size='$sig_size'
16943 signal_t='$signal_t'
16944 sitearch='$sitearch'
16945 sitearchexp='$sitearchexp'
16946 sitebin='$sitebin'
16947 sitebinexp='$sitebinexp'
16948 sitelib='$sitelib'
16949 sitelib_stem='$sitelib_stem'
16950 sitelibexp='$sitelibexp'
16951 siteprefix='$siteprefix'
16952 siteprefixexp='$siteprefixexp'
16953 sizesize='$sizesize'
16954 sizetype='$sizetype'
16955 sleep='$sleep'
16956 smail='$smail'
16957 so='$so'
16958 sockethdr='$sockethdr'
16959 socketlib='$socketlib'
16960 socksizetype='$socksizetype'
16961 sort='$sort'
16962 spackage='$spackage'
16963 spitshell='$spitshell'
16964 src='$src'
16965 ssizetype='$ssizetype'
16966 startperl='$startperl'
16967 startsh='$startsh'
16968 static_ext='$static_ext'
16969 stdchar='$stdchar'
16970 stdio_base='$stdio_base'
16971 stdio_bufsiz='$stdio_bufsiz'
16972 stdio_cnt='$stdio_cnt'
16973 stdio_filbuf='$stdio_filbuf'
16974 stdio_ptr='$stdio_ptr'
16975 stdio_stream_array='$stdio_stream_array'
16976 strings='$strings'
16977 submit='$submit'
16978 subversion='$subversion'
16979 sysman='$sysman'
16980 tail='$tail'
16981 tar='$tar'
16982 tbl='$tbl'
16983 tee='$tee'
16984 test='$test'
16985 timeincl='$timeincl'
16986 timetype='$timetype'
16987 touch='$touch'
16988 tr='$tr'
16989 trnl='$trnl'
16990 troff='$troff'
16991 u16size='$u16size'
16992 u16type='$u16type'
16993 u32size='$u32size'
16994 u32type='$u32type'
16995 u64size='$u64size'
16996 u64type='$u64type'
16997 u8size='$u8size'
16998 u8type='$u8type'
16999 uidformat='$uidformat'
17000 uidsign='$uidsign'
17001 uidsize='$uidsize'
17002 uidtype='$uidtype'
17003 uname='$uname'
17004 uniq='$uniq'
17005 uquadtype='$uquadtype'
17006 use5005threads='$use5005threads'
17007 use64bitall='$use64bitall'
17008 use64bitint='$use64bitint'
17009 usedl='$usedl'
17010 useithreads='$useithreads'
17011 uselargefiles='$uselargefiles'
17012 uselongdouble='$uselongdouble'
17013 usemorebits='$usemorebits'
17014 usemultiplicity='$usemultiplicity'
17015 usemymalloc='$usemymalloc'
17016 usenm='$usenm'
17017 useopcode='$useopcode'
17018 useperlio='$useperlio'
17019 useposix='$useposix'
17020 usereentrant='$usereentrant'
17021 usesfio='$usesfio'
17022 useshrplib='$useshrplib'
17023 usesocks='$usesocks'
17024 usethreads='$usethreads'
17025 usevendorprefix='$usevendorprefix'
17026 usevfork='$usevfork'
17027 usrinc='$usrinc'
17028 uuname='$uuname'
17029 uvXUformat='$uvXUformat'
17030 uvoformat='$uvoformat'
17031 uvsize='$uvsize'
17032 uvtype='$uvtype'
17033 uvuformat='$uvuformat'
17034 uvxformat='$uvxformat'
17035 vendorarch='$vendorarch'
17036 vendorarchexp='$vendorarchexp'
17037 vendorbin='$vendorbin'
17038 vendorbinexp='$vendorbinexp'
17039 vendorlib='$vendorlib'
17040 vendorlib_stem='$vendorlib_stem'
17041 vendorlibexp='$vendorlibexp'
17042 vendorprefix='$vendorprefix'
17043 vendorprefixexp='$vendorprefixexp'
17044 version='$version'
17045 versiononly='$versiononly'
17046 vi='$vi'
17047 voidflags='$voidflags'
17048 xlibpth='$xlibpth'
17049 xs_apiversion='$xs_apiversion'
17050 yacc='$yacc'
17051 yaccflags='$yaccflags'
17052 zcat='$zcat'
17053 zip='$zip'
17054 EOT
17055
17056 : Add in command line options if available
17057 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17058
17059 : add special variables
17060 $test -f $src/patchlevel.h && \
17061 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17062 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17063 echo "PERL_CONFIG_SH=true" >>config.sh
17064
17065 : propagate old symbols
17066 if $test -f UU/config.sh; then
17067         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17068         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17069         $sort | $uniq -u >UU/oldsyms
17070         set X `cat UU/oldsyms`
17071         shift
17072         case $# in
17073         0) ;;
17074         *)
17075                 cat <<EOM
17076 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17077 EOM
17078                 echo "# Variables propagated from previous config.sh file." >>config.sh
17079                 for sym in `cat UU/oldsyms`; do
17080                         echo "    Propagating $hint variable "'$'"$sym..."
17081                         eval 'tmp="$'"${sym}"'"'
17082                         echo "$tmp" | \
17083                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17084                 done
17085                 ;;
17086         esac
17087 fi
17088
17089 : Finish up by extracting the .SH files
17090 case "$alldone" in
17091 exit)
17092         $rm -rf UU
17093         echo "Extraction done."
17094         exit 0
17095         ;;
17096 cont)
17097         ;;
17098 '')
17099         dflt=''
17100         nostick=true
17101         $cat <<EOM
17102
17103 If you'd like to make any changes to the config.sh file before I begin
17104 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17105
17106 EOM
17107         rp="Press return or use a shell escape to edit config.sh:"
17108         . UU/myread
17109         nostick=''
17110         case "$ans" in
17111         '') ;;
17112         *) : in case they cannot read
17113                 sh 1>&4 -c "$ans";;
17114         esac
17115         ;;
17116 esac
17117
17118 : if this fails, just run all the .SH files by hand
17119 . ./config.sh
17120
17121 echo " "
17122 exec 1>&4
17123 . ./UU/extract
17124
17125 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17126         dflt=y
17127         case "$silent" in
17128         true) ;;
17129         *)
17130                 $cat <<EOM
17131
17132 Now you need to generate make dependencies by running "$make depend".
17133 You might prefer to run it in background: "$make depend > makedepend.out &"
17134 It can take a while, so you might not want to run it right now.
17135
17136 EOM
17137                 ;;
17138         esac
17139         rp="Run $make depend now?"
17140         . UU/myread
17141         case "$ans" in
17142         y*)
17143                 $make depend && echo "Now you must run '$make'."
17144                 ;;
17145         *)
17146                 echo "You must run '$make depend' then '$make'."
17147                 ;;
17148         esac
17149 elif test -f [Mm]akefile; then
17150         echo " "
17151         echo "Now you must run a $make."
17152 else
17153         echo "Configure done."
17154 fi
17155
17156 if $test -f Policy.sh; then
17157     $cat <<EOM
17158
17159 If you compile $package on a different machine or from a different object
17160 directory, copy the Policy.sh file from this object directory to the
17161 new one before you run Configure -- this will help you with most of
17162 the policy defaults.
17163
17164 EOM
17165 fi
17166 if $test -f config.msg; then
17167     echo "Hmm.  I also noted the following information while running:"
17168     echo " "
17169     $cat config.msg >&4
17170     $rm -f config.msg
17171 fi
17172 $rm -f kit*isdone ark*isdone
17173 $rm -rf UU
17174
17175 : End of Configure
17176