BeOS has socket() but not enough to build a working Socket.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Dec 11 08:22:11 EET 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                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84
85 for p in $paths
86 do
87         case "$p_$PATH$p_" in
88         *$p_$p$p_*) ;;
89         *) test -d $p && PATH=$PATH$p_$p ;;
90         esac
91 done
92
93 PATH=.$p_$PATH
94 export PATH
95
96 : shall we be using ksh?
97 inksh=''
98 needksh=''
99 avoidksh=''
100 newsh=/bin/ksh
101 changesh=''
102 if (PATH=.; alias -x) >/dev/null 2>&1; then
103                 inksh=true
104 fi
105 if test -f /hp-ux -a -f /bin/ksh; then
106         needksh='to avoid sh bug in "here document" expansion'
107 fi
108 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
109         if test X`/usr/bin/uname -v` = X4; then
110                 avoidksh="to avoid AIX 4's /bin/sh"
111                 newsh=/usr/bin/bsh
112         fi
113 fi
114 if test -f /osf_boot -a -f /usr/sbin/setld; then
115         if test X`/usr/bin/uname -s` = XOSF1; then
116                 avoidksh="to avoid Digital UNIX' ksh"
117                 newsh=/bin/sh
118                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
119         fi
120 fi
121 case "$inksh/$needksh" in
122 /[a-z]*)
123                 ENV=''
124                 changesh=true
125                 reason="$needksh"
126         ;;
127 esac
128 case "$inksh/$avoidksh" in
129 true/[a-z]*)
130         changesh=true
131         reason="$avoidksh"
132         ;;
133 esac
134 case "$inksh/$needksh-$avoidksh-" in
135 true/--)
136                 cat <<EOM
137 (I see you are using the Korn shell.  Some ksh's blow up on $me,
138 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
139 EOM
140         ;;
141 esac
142 case "$changesh" in
143 true)
144         export newsh
145         echo "(Feeding myself to $newsh $reason.)"
146         case "$0" in
147         Configure|*/Configure) exec $newsh $0 "$@";;
148         *) exec $newsh Configure "$@";;
149         esac
150         ;;
151 esac
152
153 : if needed set CDPATH to a harmless value that is not chatty
154 : avoid bash 2.02 problems with empty CDPATH.
155 case "$CDPATH" in
156 '')     ;;
157 *)      case "$SHELL" in
158         *bash*) CDPATH='.' ;;
159         *)              CDPATH='' ;;
160         esac
161         ;;
162 esac
163 : Configure runs within the UU subdirectory
164 test -d UU || mkdir UU
165 cd UU && rm -f ./*
166
167 ccname=''
168 ccversion=''
169 ccsymbols=''
170 cppccsymbols=''
171 cppsymbols=''
172 from=''
173 run=''
174 targetarch=''
175 to=''
176 usecrosscompile=''
177 perllibs=''
178 dynamic_ext=''
179 extensions=''
180 known_extensions=''
181 nonxs_ext=''
182 static_ext=''
183 useopcode=''
184 useposix=''
185 extras=''
186 d_bsd=''
187 d_eunice=''
188 d_xenix=''
189 eunicefix=''
190 Mcc=''
191 ar=''
192 awk=''
193 bash=''
194 bison=''
195 byacc=''
196 cat=''
197 chgrp=''
198 chmod=''
199 chown=''
200 comm=''
201 compress=''
202 cp=''
203 cpio=''
204 cpp=''
205 csh=''
206 date=''
207 echo=''
208 egrep=''
209 emacs=''
210 expr=''
211 find=''
212 flex=''
213 grep=''
214 gzip=''
215 inews=''
216 ksh=''
217 less=''
218 line=''
219 lint=''
220 ln=''
221 lp=''
222 lpr=''
223 ls=''
224 mail=''
225 mailx=''
226 make=''
227 mkdir=''
228 more=''
229 mv=''
230 nm=''
231 nroff=''
232 perl=''
233 pg=''
234 pmake=''
235 pr=''
236 rm=''
237 rmail=''
238 sed=''
239 sendmail=''
240 shar=''
241 sleep=''
242 smail=''
243 sort=''
244 submit=''
245 tail=''
246 tar=''
247 tbl=''
248 tee=''
249 test=''
250 touch=''
251 tr=''
252 troff=''
253 uname=''
254 uniq=''
255 uuname=''
256 vi=''
257 zcat=''
258 zip=''
259 full_ar=''
260 full_sed=''
261 libswanted=''
262 hint=''
263 myuname=''
264 osname=''
265 osvers=''
266 Author=''
267 Date=''
268 Header=''
269 Id=''
270 Locker=''
271 Log=''
272 RCSfile=''
273 Revision=''
274 Source=''
275 State=''
276 _a=''
277 _exe=''
278 _o=''
279 archobjs=''
280 exe_ext=''
281 firstmakefile=''
282 lib_ext=''
283 obj_ext=''
284 path_sep=''
285 afs=''
286 afsroot=''
287 alignbytes=''
288 ansi2knr=''
289 archlib=''
290 archlibexp=''
291 d_archlib=''
292 installarchlib=''
293 archname=''
294 myarchname=''
295 d_atolf=''
296 d_atoll=''
297 baserev=''
298 bin=''
299 binexp=''
300 installbin=''
301 bincompat5005=''
302 d_bincompat5005=''
303 byteorder=''
304 cc=''
305 ccflags=''
306 cppflags=''
307 ldflags=''
308 lkflags=''
309 locincpth=''
310 optimize=''
311 cf_email=''
312 cf_by=''
313 cf_time=''
314 charsize=''
315 contains=''
316 cpp_stuff=''
317 cpplast=''
318 cppminus=''
319 cpprun=''
320 cppstdin=''
321 d__fwalk=''
322 d_access=''
323 d_accessx=''
324 d_alarm=''
325 d_attribut=''
326 d_bcmp=''
327 d_bcopy=''
328 d_bzero=''
329 d_casti32=''
330 castflags=''
331 d_castneg=''
332 d_chown=''
333 d_chroot=''
334 d_chsize=''
335 d_class=''
336 d_closedir=''
337 d_void_closedir=''
338 d_cmsghdr_s=''
339 d_const=''
340 cryptlib=''
341 d_crypt=''
342 d_csh=''
343 full_csh=''
344 d_cuserid=''
345 d_dbl_dig=''
346 d_dbminitproto=''
347 d_difftime=''
348 d_dirfd=''
349 d_dlerror=''
350 d_dlopen=''
351 d_dlsymun=''
352 d_dosuid=''
353 d_suidsafe=''
354 d_drand48proto=''
355 d_dup2=''
356 d_eaccess=''
357 d_endgrent=''
358 d_endhent=''
359 d_endnent=''
360 d_endpent=''
361 d_endpwent=''
362 d_endsent=''
363 d_fchdir=''
364 d_fchmod=''
365 d_fchown=''
366 d_fcntl=''
367 d_fcntl_can_lock=''
368 d_fd_macros=''
369 d_fd_set=''
370 d_fds_bits=''
371 d_fgetpos=''
372 d_finite=''
373 d_finitel=''
374 d_flexfnam=''
375 d_flock=''
376 d_flockproto=''
377 d_fork=''
378 d_fp_class=''
379 d_fpclass=''
380 d_fpclassify=''
381 d_fpclassl=''
382 d_fpos64_t=''
383 d_frexpl=''
384 d_fs_data_s=''
385 d_fseeko=''
386 d_fsetpos=''
387 d_fstatfs=''
388 d_fsync=''
389 d_ftello=''
390 d_ftime=''
391 d_gettimeod=''
392 d_Gconvert=''
393 d_getcwd=''
394 d_getespwnam=''
395 d_getfsstat=''
396 d_getgrent=''
397 d_getgrps=''
398 d_gethbyaddr=''
399 d_gethbyname=''
400 d_gethent=''
401 aphostname=''
402 d_gethname=''
403 d_phostname=''
404 d_uname=''
405 d_gethostprotos=''
406 d_getitimer=''
407 d_getlogin=''
408 d_getmnt=''
409 d_getmntent=''
410 d_getnbyaddr=''
411 d_getnbyname=''
412 d_getnent=''
413 d_getnetprotos=''
414 d_getpagsz=''
415 d_getpent=''
416 d_getpgid=''
417 d_getpgrp2=''
418 d_bsdgetpgrp=''
419 d_getpgrp=''
420 d_getppid=''
421 d_getprior=''
422 d_getpbyname=''
423 d_getpbynumber=''
424 d_getprotoprotos=''
425 d_getprpwnam=''
426 d_getpwent=''
427 d_getsent=''
428 d_getservprotos=''
429 d_getspnam=''
430 d_getsbyname=''
431 d_getsbyport=''
432 d_gnulibc=''
433 d_hasmntopt=''
434 d_htonl=''
435 d_inetaton=''
436 d_int64_t=''
437 d_isascii=''
438 d_isfinite=''
439 d_isinf=''
440 d_isnan=''
441 d_isnanl=''
442 d_killpg=''
443 d_lchown=''
444 d_ldbl_dig=''
445 d_link=''
446 d_locconv=''
447 d_lockf=''
448 d_longdbl=''
449 longdblsize=''
450 d_longlong=''
451 longlongsize=''
452 d_lseekproto=''
453 d_lstat=''
454 d_madvise=''
455 d_mblen=''
456 d_mbstowcs=''
457 d_mbtowc=''
458 d_memchr=''
459 d_memcmp=''
460 d_memcpy=''
461 d_memmove=''
462 d_memset=''
463 d_mkdir=''
464 d_mkdtemp=''
465 d_mkfifo=''
466 d_mkstemp=''
467 d_mkstemps=''
468 d_mktime=''
469 d_mmap=''
470 mmaptype=''
471 d_modfl=''
472 d_modfl_pow32_bug=''
473 d_mprotect=''
474 d_msg=''
475 d_msgctl=''
476 d_msgget=''
477 d_msghdr_s=''
478 d_msgrcv=''
479 d_msgsnd=''
480 d_msync=''
481 d_munmap=''
482 d_nice=''
483 d_nl_langinfo=''
484 d_off64_t=''
485 d_open3=''
486 d_fpathconf=''
487 d_pathconf=''
488 d_pause=''
489 d_pipe=''
490 d_poll=''
491 d_portable=''
492 d_procselfexe=''
493 procselfexe=''
494 d_old_pthread_create_joinable=''
495 old_pthread_create_joinable=''
496 d_pthread_atfork=''
497 d_pthread_yield=''
498 d_sched_yield=''
499 sched_yield=''
500 d_qgcvt=''
501 d_readdir=''
502 d_rewinddir=''
503 d_seekdir=''
504 d_telldir=''
505 d_readlink=''
506 d_readv=''
507 d_recvmsg=''
508 d_rename=''
509 d_rmdir=''
510 d_safebcpy=''
511 d_safemcpy=''
512 d_sanemcmp=''
513 d_sbrkproto=''
514 d_select=''
515 d_sem=''
516 d_semctl=''
517 d_semget=''
518 d_semop=''
519 d_sendmsg=''
520 d_setegid=''
521 d_seteuid=''
522 d_setgrent=''
523 d_setgrps=''
524 d_sethent=''
525 d_setitimer=''
526 d_setlinebuf=''
527 d_setlocale=''
528 d_setnent=''
529 d_setpent=''
530 d_setpgid=''
531 d_setpgrp2=''
532 d_bsdsetpgrp=''
533 d_setpgrp=''
534 d_setprior=''
535 d_setproctitle=''
536 d_setpwent=''
537 d_setregid=''
538 d_setresgid=''
539 d_setresuid=''
540 d_setreuid=''
541 d_setrgid=''
542 d_setruid=''
543 d_setsent=''
544 d_setsid=''
545 d_setvbuf=''
546 d_sfio=''
547 usesfio=''
548 d_shm=''
549 d_shmat=''
550 d_shmatprototype=''
551 shmattype=''
552 d_shmctl=''
553 d_shmdt=''
554 d_shmget=''
555 d_sigaction=''
556 d_sigprocmask=''
557 d_sigsetjmp=''
558 d_sockatmark=''
559 d_sockatmarkproto=''
560 d_msg_ctrunc=''
561 d_msg_dontroute=''
562 d_msg_oob=''
563 d_msg_peek=''
564 d_msg_proxy=''
565 d_oldsock=''
566 d_scm_rights=''
567 d_socket=''
568 d_sockpair=''
569 sockethdr=''
570 socketlib=''
571 d_socklen_t=''
572 d_socks5_init=''
573 d_sqrtl=''
574 d_sresgproto=''
575 d_sresuproto=''
576 d_statblks=''
577 d_statfs_f_flags=''
578 d_statfs_s=''
579 d_fstatvfs=''
580 d_statvfs=''
581 d_stdio_cnt_lval=''
582 d_stdio_ptr_lval=''
583 d_stdio_ptr_lval_nochange_cnt=''
584 d_stdio_ptr_lval_sets_cnt=''
585 d_stdiobase=''
586 d_stdstdio=''
587 stdio_base=''
588 stdio_bufsiz=''
589 stdio_cnt=''
590 stdio_filbuf=''
591 stdio_ptr=''
592 d_index=''
593 d_strchr=''
594 d_strcoll=''
595 d_strctcpy=''
596 d_strerrm=''
597 d_strerror=''
598 d_sysernlst=''
599 d_syserrlst=''
600 d_strftime=''
601 d_strtod=''
602 d_strtol=''
603 d_strtold=''
604 d_strtoll=''
605 d_strtoq=''
606 d_strtoul=''
607 d_strtoull=''
608 d_strtouq=''
609 d_strxfrm=''
610 d_symlink=''
611 d_syscall=''
612 d_syscallproto=''
613 d_sysconf=''
614 d_system=''
615 d_tcgetpgrp=''
616 d_tcsetpgrp=''
617 d_telldirproto=''
618 d_time=''
619 timetype=''
620 clocktype=''
621 d_times=''
622 d_truncate=''
623 d_tzname=''
624 d_u32align=''
625 d_ualarm=''
626 d_umask=''
627 d_semctl_semid_ds=''
628 d_semctl_semun=''
629 d_union_semun=''
630 d_unordered=''
631 d_usleep=''
632 d_usleepproto=''
633 d_ustat=''
634 d_vfork=''
635 usevfork=''
636 d_voidsig=''
637 signal_t=''
638 d_volatile=''
639 d_charvspr=''
640 d_vprintf=''
641 d_wait4=''
642 d_waitpid=''
643 d_wcstombs=''
644 d_wctomb=''
645 d_writev=''
646 dlext=''
647 cccdlflags=''
648 ccdlflags=''
649 dlsrc=''
650 ld=''
651 lddlflags=''
652 usedl=''
653 doublesize=''
654 ebcdic=''
655 fflushNULL=''
656 fflushall=''
657 fpossize=''
658 fpostype=''
659 gccosandvers=''
660 gccversion=''
661 gidformat=''
662 gidsign=''
663 gidsize=''
664 gidtype=''
665 groupstype=''
666 h_fcntl=''
667 h_sysfile=''
668 i_arpainet=''
669 db_hashtype=''
670 db_prefixtype=''
671 db_version_major=''
672 db_version_minor=''
673 db_version_patch=''
674 i_db=''
675 i_dbm=''
676 i_rpcsvcdbm=''
677 d_dirnamlen=''
678 direntrytype=''
679 i_dirent=''
680 i_dld=''
681 i_dlfcn=''
682 i_fcntl=''
683 i_float=''
684 i_fp=''
685 i_fp_class=''
686 i_gdbm=''
687 d_grpasswd=''
688 i_grp=''
689 i_ieeefp=''
690 i_inttypes=''
691 i_langinfo=''
692 i_libutil=''
693 i_limits=''
694 i_locale=''
695 i_machcthr=''
696 i_malloc=''
697 i_math=''
698 i_memory=''
699 i_mntent=''
700 i_ndbm=''
701 i_netdb=''
702 i_neterrno=''
703 i_netinettcp=''
704 i_niin=''
705 i_sysin=''
706 i_poll=''
707 i_prot=''
708 i_pthread=''
709 d_pwage=''
710 d_pwchange=''
711 d_pwclass=''
712 d_pwcomment=''
713 d_pwexpire=''
714 d_pwgecos=''
715 d_pwpasswd=''
716 d_pwquota=''
717 i_pwd=''
718 i_sfio=''
719 i_shadow=''
720 i_socks=''
721 i_stddef=''
722 i_stdlib=''
723 i_string=''
724 strings=''
725 i_sunmath=''
726 i_sysaccess=''
727 i_sysdir=''
728 i_sysfile=''
729 d_voidtty=''
730 i_bsdioctl=''
731 i_sysfilio=''
732 i_sysioctl=''
733 i_syssockio=''
734 i_syslog=''
735 i_sysmman=''
736 i_sysmode=''
737 i_sysmount=''
738 i_sysndir=''
739 i_sysparam=''
740 i_sysresrc=''
741 i_syssecrt=''
742 i_sysselct=''
743 i_sysstat=''
744 i_sysstatfs=''
745 i_sysstatvfs=''
746 i_systimes=''
747 i_systypes=''
748 i_sysuio=''
749 i_sysun=''
750 i_sysutsname=''
751 i_sysvfs=''
752 i_syswait=''
753 i_sgtty=''
754 i_termio=''
755 i_termios=''
756 i_systime=''
757 i_systimek=''
758 i_time=''
759 timeincl=''
760 i_unistd=''
761 i_ustat=''
762 i_utime=''
763 i_values=''
764 i_stdarg=''
765 i_varargs=''
766 i_varhdr=''
767 i_vfork=''
768 inc_version_list=''
769 inc_version_list_init=''
770 installprefix=''
771 installprefixexp=''
772 installstyle=''
773 installusrbinperl=''
774 intsize=''
775 longsize=''
776 shortsize=''
777 issymlink=''
778 libc=''
779 ldlibpthname=''
780 libperl=''
781 shrpenv=''
782 useshrplib=''
783 glibpth=''
784 libpth=''
785 loclibpth=''
786 plibpth=''
787 xlibpth=''
788 ignore_versioned_solibs=''
789 libs=''
790 libsdirs=''
791 libsfiles=''
792 libsfound=''
793 libspath=''
794 lns=''
795 d_PRIEUldbl=''
796 d_PRIFUldbl=''
797 d_PRIGUldbl=''
798 d_PRIeldbl=''
799 d_PRIfldbl=''
800 d_PRIgldbl=''
801 d_SCNfldbl=''
802 sPRIEUldbl=''
803 sPRIFUldbl=''
804 sPRIGUldbl=''
805 sPRIeldbl=''
806 sPRIfldbl=''
807 sPRIgldbl=''
808 sSCNfldbl=''
809 lseeksize=''
810 lseektype=''
811 make_set_make=''
812 d_mymalloc=''
813 freetype=''
814 mallocobj=''
815 mallocsrc=''
816 malloctype=''
817 usemymalloc=''
818 installman1dir=''
819 man1dir=''
820 man1direxp=''
821 man1ext=''
822 installman3dir=''
823 man3dir=''
824 man3direxp=''
825 man3ext=''
826 modetype=''
827 multiarch=''
828 mydomain=''
829 myhostname=''
830 phostname=''
831 c=''
832 n=''
833 d_eofnblk=''
834 eagain=''
835 o_nonblock=''
836 rd_nodata=''
837 need_va_copy=''
838 netdb_hlen_type=''
839 netdb_host_type=''
840 netdb_name_type=''
841 netdb_net_type=''
842 groupcat=''
843 hostcat=''
844 passcat=''
845 orderlib=''
846 ranlib=''
847 d_perl_otherlibdirs=''
848 otherlibdirs=''
849 package=''
850 spackage=''
851 pager=''
852 api_revision=''
853 api_subversion=''
854 api_version=''
855 api_versionstring=''
856 patchlevel=''
857 perl_patchlevel=''
858 revision=''
859 subversion=''
860 version=''
861 version_patchlevel_string=''
862 perl5=''
863 perladmin=''
864 perlpath=''
865 d_nv_preserves_uv=''
866 d_nv_preserves_uv_bits=''
867 i16size=''
868 i16type=''
869 i32size=''
870 i32type=''
871 i64size=''
872 i64type=''
873 i8size=''
874 i8type=''
875 ivsize=''
876 ivtype=''
877 nvsize=''
878 nvtype=''
879 u16size=''
880 u16type=''
881 u32size=''
882 u32type=''
883 u64size=''
884 u64type=''
885 u8size=''
886 u8type=''
887 uvsize=''
888 uvtype=''
889 ivdformat=''
890 nvEUformat=''
891 nvFUformat=''
892 nvGUformat=''
893 nveformat=''
894 nvfformat=''
895 nvgformat=''
896 uvXUformat=''
897 uvoformat=''
898 uvuformat=''
899 uvxformat=''
900 pidtype=''
901 prefix=''
902 prefixexp=''
903 installprivlib=''
904 privlib=''
905 privlibexp=''
906 prototype=''
907 ptrsize=''
908 d_PRIXU64=''
909 d_PRId64=''
910 d_PRIi64=''
911 d_PRIo64=''
912 d_PRIu64=''
913 d_PRIx64=''
914 sPRIXU64=''
915 sPRId64=''
916 sPRIi64=''
917 sPRIo64=''
918 sPRIu64=''
919 sPRIx64=''
920 d_quad=''
921 quadkind=''
922 quadtype=''
923 uquadtype=''
924 drand01=''
925 randbits=''
926 randfunc=''
927 randseedtype=''
928 seedfunc=''
929 installscript=''
930 scriptdir=''
931 scriptdirexp=''
932 selectminbits=''
933 selecttype=''
934 sh=''
935 sig_count=''
936 sig_name=''
937 sig_name_init=''
938 sig_num=''
939 sig_num_init=''
940 sig_size=''
941 installsitearch=''
942 sitearch=''
943 sitearchexp=''
944 installsitebin=''
945 sitebin=''
946 sitebinexp=''
947 installsitelib=''
948 sitelib=''
949 sitelib_stem=''
950 sitelibexp=''
951 siteprefix=''
952 siteprefixexp=''
953 sizesize=''
954 sizetype=''
955 so=''
956 socksizetype=''
957 sharpbang=''
958 shsharp=''
959 spitshell=''
960 src=''
961 ssizetype=''
962 startperl=''
963 startsh=''
964 stdchar=''
965 d_stdio_stream_array=''
966 stdio_stream_array=''
967 sysman=''
968 trnl=''
969 uidformat=''
970 uidsign=''
971 uidsize=''
972 uidtype=''
973 archname64=''
974 use64bitall=''
975 use64bitint=''
976 ccflags_uselargefiles=''
977 ldflags_uselargefiles=''
978 libswanted_uselargefiles=''
979 uselargefiles=''
980 uselongdouble=''
981 usemorebits=''
982 usemultiplicity=''
983 nm_opt=''
984 nm_so_opt=''
985 runnm=''
986 usenm=''
987 useperlio=''
988 usesocks=''
989 d_oldpthreads=''
990 use5005threads=''
991 useithreads=''
992 usereentrant=''
993 usethreads=''
994 incpath=''
995 mips_type=''
996 usrinc=''
997 d_vendorarch=''
998 installvendorarch=''
999 vendorarch=''
1000 vendorarchexp=''
1001 d_vendorbin=''
1002 installvendorbin=''
1003 vendorbin=''
1004 vendorbinexp=''
1005 d_vendorlib=''
1006 installvendorlib=''
1007 vendorlib=''
1008 vendorlib_stem=''
1009 vendorlibexp=''
1010 usevendorprefix=''
1011 vendorprefix=''
1012 vendorprefixexp=''
1013 versiononly=''
1014 defvoidused=''
1015 voidflags=''
1016 pm_apiversion=''
1017 xs_apiversion=''
1018 yacc=''
1019 yaccflags=''
1020 CONFIG=''
1021
1022 define='define'
1023 undef='undef'
1024 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1025 rmlist=''
1026
1027 : We must find out about Eunice early
1028 eunicefix=':'
1029 if test -f /etc/unixtovms; then
1030         eunicefix=/etc/unixtovms
1031 fi
1032 if test -f /etc/unixtovms.exe; then
1033         eunicefix=/etc/unixtovms.exe
1034 fi
1035
1036 i_whoami=''
1037 ccname=''
1038 ccversion=''
1039 perllibs=''
1040 : set useposix=false in your hint file to disable the POSIX extension.
1041 useposix=true
1042 : set useopcode=false in your hint file to disable the Opcode extension.
1043 useopcode=true
1044 : Trailing extension.  Override this in a hint file, if needed.
1045 _exe=''
1046 : Extra object files, if any, needed on this platform.
1047 archobjs=''
1048 archname=''
1049 : Possible local include directories to search.
1050 : Set locincpth to "" in a hint file to defeat local include searches.
1051 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1052 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1053 :
1054 : no include file wanted by default
1055 inclwanted=''
1056
1057 groupstype=''
1058 libnames=''
1059 : change the next line if compiling for Xenix/286 on Xenix/386
1060 xlibpth='/usr/lib/386 /lib/386'
1061 : Possible local library directories to search.
1062 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1063 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1064
1065 : general looking path for locating libraries
1066 glibpth="/lib /usr/lib $xlibpth"
1067 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1068 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1069 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1070
1071 : Private path used by Configure to find libraries.  Its value
1072 : is prepended to libpth. This variable takes care of special
1073 : machines, like the mips.  Usually, it should be empty.
1074 plibpth=''
1075
1076 : default library list
1077 libswanted=''
1078 : some systems want to use only the non-versioned libso:s
1079 ignore_versioned_solibs=''
1080 archname64=''
1081 ccflags_uselargefiles=''
1082 ldflags_uselargefiles=''
1083 libswanted_uselargefiles=''
1084 : set usemultiplicity on the Configure command line to enable multiplicity.
1085 : set usesocks on the Configure command line to enable socks.
1086 : set usethreads on the Configure command line to enable threads.
1087 usereentrant='undef'
1088 : full support for void wanted by default
1089 defvoidused=15
1090
1091 : List of libraries we want.
1092 : If anyone needs -lnet, put it in a hint file.
1093 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1094 libswanted="$libswanted dld ld sun m c cposix posix"
1095 libswanted="$libswanted ndir dir crypt sec"
1096 libswanted="$libswanted ucb bsd BSD PW x util"
1097 : We probably want to search /usr/shlib before most other libraries.
1098 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1099 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1100 glibpth="/usr/shlib $glibpth"
1101 : Do not use vfork unless overridden by a hint file.
1102 usevfork=false
1103
1104 : Find the basic shell for Bourne shell scripts
1105 case "$sh" in
1106 '')
1107         case "$SYSTYPE" in
1108         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1109         *) xxx='/bin/sh';;
1110         esac
1111         if test -f "$xxx"; then
1112                 sh="$xxx"
1113         else
1114                 : Build up a list and do a single loop so we can 'break' out.
1115                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1116                 for xxx in sh bash ksh pdksh ash; do
1117                         for p in $pth; do
1118                                 try="$try ${p}/${xxx}"
1119                         done
1120                 done
1121                 for xxx in $try; do
1122                         if test -f "$xxx"; then
1123                                 sh="$xxx";
1124                                 break
1125                         elif test -f "$xxx.exe"; then
1126                                 sh="$xxx";
1127                                 break
1128                         fi
1129                 done
1130         fi
1131         ;;
1132 esac
1133
1134 case "$sh" in
1135 '')     cat >&2 <<EOM
1136 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1137
1138 Usually it's in /bin/sh.  How did you even get this far?
1139 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1140 we'll try to straighten this all out.
1141 EOM
1142         exit 1
1143         ;;
1144 esac
1145
1146 : see if sh knows # comments
1147 if `$sh -c '#' >/dev/null 2>&1`; then
1148         shsharp=true
1149         spitshell=cat
1150         xcat=/bin/cat
1151         test -f $xcat || xcat=/usr/bin/cat
1152         echo "#!$xcat" >sharp
1153         $eunicefix sharp
1154         chmod +x sharp
1155         ./sharp > today
1156         if test -s today; then
1157                 sharpbang='#!'
1158         else
1159                 echo "#! $xcat" > sharp
1160                 $eunicefix sharp
1161                 chmod +x sharp
1162                 ./sharp > today
1163                 if test -s today; then
1164                         sharpbang='#! '
1165                 else
1166                         sharpbang=': use '
1167                 fi
1168         fi
1169 else
1170         echo " "
1171         echo "Your $sh doesn't grok # comments--I will strip them later on."
1172         shsharp=false
1173         cd ..
1174         echo "exec grep -v '^[  ]*#'" >spitshell
1175         chmod +x spitshell
1176         $eunicefix spitshell
1177         spitshell=`pwd`/spitshell
1178         cd UU
1179         echo "I presume that if # doesn't work, #! won't work either!"
1180         sharpbang=': use '
1181 fi
1182 rm -f sharp today
1183
1184 : figure out how to guarantee sh startup
1185 case "$startsh" in
1186 '') startsh=${sharpbang}${sh} ;;
1187 *)
1188 esac
1189 cat >sharp <<EOSS
1190 $startsh
1191 set abc
1192 test "$?abc" != 1
1193 EOSS
1194
1195 chmod +x sharp
1196 $eunicefix sharp
1197 if ./sharp; then
1198         : echo "Yup, it does."
1199 else
1200         echo "Hmm... '$startsh' does not guarantee sh startup..."
1201         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1202 fi
1203 rm -f sharp
1204
1205
1206 : Save command line options in file UU/cmdline.opt for later use in
1207 : generating config.sh.
1208 cat > cmdline.opt <<EOSH
1209 # Configure command line arguments.
1210 config_arg0='$0'
1211 config_args='$*'
1212 config_argc=$#
1213 EOSH
1214 argn=1
1215 args_exp=''
1216 args_sep=''
1217 for arg in "$@"; do
1218         cat >>cmdline.opt <<EOSH
1219 config_arg$argn='$arg'
1220 EOSH
1221         # Extreme backslashitis: replace each ' by '"'"'
1222         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1223 $arg
1224 EOC
1225         arg_exp=`cat cmdl.opt`
1226         args_exp="$args_exp$args_sep'$arg_exp'"
1227         argn=`expr $argn + 1`
1228         args_sep=' '
1229 done
1230 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1231 # used by ./hints/os2.sh
1232 rm -f cmdl.opt
1233
1234 : produce awk script to parse command line options
1235 cat >options.awk <<'EOF'
1236 BEGIN {
1237         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1238
1239         len = length(optstr);
1240         for (i = 1; i <= len; i++) {
1241                 c = substr(optstr, i, 1);
1242                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1243                 if (a == ":") {
1244                         arg[c] = 1;
1245                         i++;
1246                 }
1247                 opt[c] = 1;
1248         }
1249 }
1250 {
1251         expect = 0;
1252         str = $0;
1253         if (substr(str, 1, 1) != "-") {
1254                 printf("'%s'\n", str);
1255                 next;
1256         }
1257         len = length($0);
1258         for (i = 2; i <= len; i++) {
1259                 c = substr(str, i, 1);
1260                 if (!opt[c]) {
1261                         printf("-%s\n", substr(str, i));
1262                         next;
1263                 }
1264                 printf("-%s\n", c);
1265                 if (arg[c]) {
1266                         if (i < len)
1267                                 printf("'%s'\n", substr(str, i + 1));
1268                         else
1269                                 expect = 1;
1270                         next;
1271                 }
1272         }
1273 }
1274 END {
1275         if (expect)
1276                 print "?";
1277 }
1278 EOF
1279
1280 : process the command line options
1281 set X `for arg in "$@"; do echo "X$arg"; done |
1282         sed -e s/X// | awk -f options.awk`
1283 eval "set $*"
1284 shift
1285 rm -f options.awk
1286
1287 : set up default values
1288 fastread=''
1289 reuseval=false
1290 config_sh=''
1291 alldone=''
1292 error=''
1293 silent=''
1294 extractsh=''
1295 override=''
1296 knowitall=''
1297 rm -f optdef.sh posthint.sh
1298 cat >optdef.sh <<EOS
1299 $startsh
1300 EOS
1301
1302
1303 : option parsing
1304 while test $# -gt 0; do
1305         case "$1" in
1306         -d) shift; fastread=yes;;
1307         -e) shift; alldone=cont;;
1308         -f)
1309                 shift
1310                 cd ..
1311                 if test -r "$1"; then
1312                         config_sh="$1"
1313                 else
1314                         echo "$me: cannot read config file $1." >&2
1315                         error=true
1316                 fi
1317                 cd UU
1318                 shift;;
1319         -h) shift; error=true;;
1320         -r) shift; reuseval=true;;
1321         -s) shift; silent=true; realsilent=true;;
1322         -E) shift; alldone=exit;;
1323         -K) shift; knowitall=true;;
1324         -O) shift; override=true;;
1325         -S) shift; silent=true; extractsh=true;;
1326         -D)
1327                 shift
1328                 case "$1" in
1329                 *=)
1330                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1331                         echo "$me: ignoring -D $1" >&2
1332                         ;;
1333                 *=*) echo "$1" | \
1334                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1335                 *) echo "$1='define'" >> optdef.sh;;
1336                 esac
1337                 shift
1338                 ;;
1339         -U)
1340                 shift
1341                 case "$1" in
1342                 *=) echo "$1" >> optdef.sh;;
1343                 *=*)
1344                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1345                         echo "$me: ignoring -U $1" >&2
1346                         ;;
1347                 *) echo "$1='undef'" >> optdef.sh;;
1348                 esac
1349                 shift
1350                 ;;
1351         -A)
1352             shift
1353             xxx=''
1354             yyy="$1"
1355             zzz=''
1356             uuu=undef
1357             case "$yyy" in
1358             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1359                  case "$zzz" in
1360                  *:*) zzz='' ;;
1361                  *)   xxx=append
1362                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1363                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1364                  esac
1365                  ;;
1366             esac
1367             case "$xxx" in
1368             '')  case "$yyy" in
1369                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1370                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1371                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1372                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1373                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1374                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1375                  esac
1376                  ;;       
1377             esac
1378             case "$xxx" in
1379             append)
1380                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1381             clear)
1382                 echo "$yyy=''"                  >> posthint.sh ;;
1383             define)
1384                 case "$zzz" in
1385                 '') zzz=define ;;
1386                 esac
1387                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1388             eval)
1389                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1390             prepend)
1391                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1392             undef)
1393                 case "$zzz" in
1394                 '') zzz="$uuu" ;;
1395                 esac
1396                 echo "$yyy=$zzz"                >> posthint.sh ;;
1397             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1398             esac
1399             shift
1400             ;;
1401         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1402             exit 0;;
1403         --) break;;
1404         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1405         *) break;;
1406         esac
1407 done
1408
1409 case "$error" in
1410 true)
1411         cat >&2 <<EOM
1412 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1413                  [-U symbol] [-U symbol=] [-A command:symbol...]
1414   -d : use defaults for all answers.
1415   -e : go on without questioning past the production of config.sh.
1416   -f : specify an alternate default configuration file.
1417   -h : print this help message and exit (with an error status).
1418   -r : reuse C symbols value if possible (skips costly nm extraction).
1419   -s : silent mode, only echoes questions and essential information.
1420   -D : define symbol to have some value:
1421          -D symbol         symbol gets the value 'define'
1422          -D symbol=value   symbol gets the value 'value'
1423   -E : stop at the end of questions, after having produced config.sh.
1424   -K : do not use unless you know what you are doing.
1425   -O : let -D and -U override definitions from loaded configuration file.
1426   -S : perform variable substitutions on all .SH files (can mix with -f)
1427   -U : undefine symbol:
1428          -U symbol    symbol gets the value 'undef'
1429          -U symbol=   symbol gets completely empty
1430   -A : manipulate symbol after the platform specific hints have been applied:
1431          -A symbol=value                append " "value to symbol
1432          -A append:symbol=value         append value to symbol
1433          -A define:symbol=value         define symbol to have value
1434          -A clear:symbol                define symbol to be ''
1435          -A define:symbol               define symbol to be 'define'
1436          -A eval:symbol=value           define symbol to be eval of value
1437          -A prepend:symbol=value        prepend value to symbol
1438          -A undef:symbol                define symbol to be 'undef'
1439          -A undef:symbol=               define symbol to be ''
1440   -V : print version number and exit (with a zero status).
1441 EOM
1442         exit 1
1443         ;;
1444 esac
1445
1446 : Sanity checks
1447 case "$fastread$alldone" in
1448 yescont|yesexit) ;;
1449 *)
1450         case "$extractsh" in
1451         true) ;;
1452         *)
1453                 if test ! -t 0; then
1454                         echo "Say 'sh Configure', not 'sh <Configure'"
1455                         exit 1
1456                 fi
1457                 ;;
1458         esac
1459         ;;
1460 esac
1461
1462 exec 4>&1
1463 case "$silent" in
1464 true) exec 1>/dev/null;;
1465 esac
1466
1467 : run the defines and the undefines, if any, but leave the file out there...
1468 touch optdef.sh
1469 . ./optdef.sh
1470 : create the posthint manipulation script and leave the file out there...
1471 touch posthint.sh
1472
1473 : set package name
1474 package=perl5
1475 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1476 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1477 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1478 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1479 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1480 esac
1481
1482 : Some greps do not return status, grrr.
1483 echo "grimblepritz" >grimble
1484 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1485         contains=contains
1486 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1487         contains=grep
1488 else
1489         contains=contains
1490 fi
1491 rm -f grimble
1492 : the following should work in any shell
1493 case "$contains" in
1494 contains*)
1495         echo " "
1496         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1497         cat >contains <<'EOSS'
1498 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1499 EOSS
1500 chmod +x contains
1501 esac
1502
1503 : Find the path to the source tree
1504 case "$src" in
1505 '') case "$0" in
1506     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1507          case "$src" in
1508          /*)    ;;
1509          .)     ;;
1510          *)     src=`cd ../$src && pwd` ;;
1511          esac
1512          ;;
1513     *)   src='.';;
1514     esac;;
1515 esac
1516 case "$src" in
1517 '')     src=/
1518         rsrc=/
1519         ;;
1520 /*) rsrc="$src";;
1521 *) rsrc="../$src";;
1522 esac
1523 if test -f $rsrc/Configure && \
1524         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1525 then
1526    : found it, so we are ok.
1527 else
1528         rsrc=''
1529         for src in . .. ../.. ../../.. ../../../..; do
1530                 if test -f ../$src/Configure && \
1531                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1532                 then
1533                         rsrc=../$src
1534                         break
1535                 fi
1536         done
1537 fi
1538 case "$rsrc" in
1539 '')
1540         cat <<EOM >&4
1541
1542 Sorry, I can't seem to locate the source dir for $package.  Please start
1543 Configure with an explicit path -- i.e. /some/path/Configure.
1544
1545 EOM
1546         exit 1
1547         ;;
1548 ../.)   rsrc='..';;
1549 *)
1550         echo " "
1551         echo "Sources for $package found in \"$src\"." >&4
1552         ;;
1553 esac
1554
1555 : script used to extract .SH files with variable substitutions
1556 cat >extract <<'EOS'
1557 PERL_CONFIG_SH=true
1558 echo "Doing variable substitutions on .SH files..."
1559 if test -f MANIFEST; then
1560         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1561 else
1562         echo "(Looking for .SH files under the source directory.)"
1563         set x `(cd $src; find . -name "*.SH" -print)`
1564 fi
1565 shift
1566 case $# in
1567 0) set x `(cd $src; echo *.SH)`; shift;;
1568 esac
1569 if test ! -f $src/$1; then
1570         shift
1571 fi
1572 mkdir_p='
1573 name=$1;
1574 create="";
1575 while test $name; do
1576         if test ! -d "$name"; then
1577                 create="$name $create";
1578                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1579                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1580         else
1581                 name="";
1582         fi;
1583 done;
1584 for file in $create; do
1585         mkdir $file;
1586 done
1587 '
1588 for file in $*; do
1589         case "$src" in
1590         ".")
1591                 case "$file" in
1592                 */*)
1593                         dir=`expr X$file : 'X\(.*\)/'`
1594                         file=`expr X$file : 'X.*/\(.*\)'`
1595                         (cd $dir && . ./$file)
1596                         ;;
1597                 *)
1598                         . ./$file
1599                         ;;
1600                 esac
1601                 ;;
1602         *)
1603                 case "$file" in
1604                 */*)
1605                         dir=`expr X$file : 'X\(.*\)/'`
1606                         file=`expr X$file : 'X.*/\(.*\)'`
1607                         (set x $dir; shift; eval $mkdir_p)
1608                         sh <$src/$dir/$file
1609                         ;;
1610                 *)
1611                         sh <$src/$file
1612                         ;;
1613                 esac
1614                 ;;
1615         esac
1616 done
1617 if test -f $src/config_h.SH; then
1618         if test ! -f config.h; then
1619         : oops, they left it out of MANIFEST, probably, so do it anyway.
1620         . $src/config_h.SH
1621         fi
1622 fi
1623 EOS
1624
1625 : extract files and exit if asked to do so
1626 case "$extractsh" in
1627 true)
1628         case "$realsilent" in
1629         true) ;;
1630         *) exec 1>&4;;
1631         esac
1632         case "$config_sh" in
1633         '') config_sh='config.sh';;
1634         esac
1635         echo " "
1636         echo "Fetching answers from $config_sh..."
1637         cd ..
1638         . $config_sh
1639         test "$override" && . ./optdef.sh
1640         echo " "
1641         . UU/extract
1642         rm -rf UU
1643         echo "Extraction done."
1644         exit 0
1645         ;;
1646 esac
1647
1648 : Eunice requires " " instead of "", can you believe it
1649 echo " "
1650 : Here we go...
1651 echo "Beginning of configuration questions for $package."
1652
1653 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1654
1655 : first determine how to suppress newline on echo command
1656 echo " "
1657 echo "Checking echo to see how to suppress newlines..."
1658 (echo "hi there\c" ; echo " ") >.echotmp
1659 if $contains c .echotmp >/dev/null 2>&1 ; then
1660         echo "...using -n."
1661         n='-n'
1662         c=''
1663 else
1664         cat <<'EOM'
1665 ...using \c
1666 EOM
1667         n=''
1668         c='\c'
1669 fi
1670 echo $n "The star should be here-->$c"
1671 echo '*'
1672 rm -f .echotmp
1673
1674 : Now test for existence of everything in MANIFEST
1675 echo " "
1676 if test -f $rsrc/MANIFEST; then
1677         echo "First let's make sure your kit is complete.  Checking..." >&4
1678         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1679         rm -f missing
1680         tmppwd=`pwd`
1681         for filelist in x??; do
1682                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1683         done
1684         if test -s missing; then
1685                 cat missing >&4
1686                 cat >&4 <<'EOM'
1687
1688 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1689
1690 You have the option of continuing the configuration process, despite the
1691 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1692 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1693 and contact the author (perlbug@perl.org).
1694
1695 EOM
1696                 echo $n "Continue? [n] $c" >&4
1697                 read ans
1698                 case "$ans" in
1699                 y*)
1700                         echo "Continuing..." >&4
1701                         rm -f missing
1702                         ;;
1703                 *)
1704                         echo "ABORTING..." >&4
1705                         kill $$
1706                         ;;
1707                 esac
1708         else
1709                 echo "Looks good..."
1710         fi
1711 else
1712         echo "There is no MANIFEST file.  I hope your kit is complete !"
1713 fi
1714 rm -f missing x??
1715
1716 echo " "
1717 : Find the appropriate value for a newline for tr
1718 if test -n "$DJGPP"; then
1719        trnl='\012'
1720 fi
1721 if test X"$trnl" = X; then
1722         case "`echo foo|tr '\n' x 2>/dev/null`" in
1723         foox) trnl='\n' ;;
1724         esac
1725 fi
1726 if test X"$trnl" = X; then
1727         case "`echo foo|tr '\012' x 2>/dev/null`" in
1728         foox) trnl='\012' ;;
1729         esac
1730 fi
1731 if test X"$trnl" = X; then
1732         cat <<EOM >&2
1733
1734 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1735
1736 EOM
1737         exit 1
1738 fi
1739
1740 : compute the number of columns on the terminal for proper question formatting
1741 case "$COLUMNS" in
1742 '') COLUMNS='80';;
1743 esac
1744
1745 : set up the echo used in my read
1746 myecho="case \"\$xxxm\" in
1747 '') echo $n \"\$rp $c\" >&4;;
1748 *) case \"\$rp\" in
1749         '') echo $n \"[\$xxxm] $c\";;
1750         *)
1751                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1752                         echo \"\$rp\" >&4
1753                         echo $n \"[\$xxxm] $c\" >&4
1754                 else
1755                         echo $n \"\$rp [\$xxxm] $c\" >&4
1756                 fi
1757                 ;;
1758         esac;;
1759 esac"
1760
1761 : now set up to do reads with possible shell escape and default assignment
1762 cat <<EOSC >myread
1763 $startsh
1764 xxxm=\$dflt
1765 $myecho
1766 ans='!'
1767 case "\$fastread" in
1768 yes) case "\$dflt" in
1769         '') ;;
1770         *) ans='';
1771                 case "\$silent-\$rp" in
1772                 true-) ;;
1773                 *) echo " " >&4;;
1774                 esac;;
1775         esac;;
1776 *) case "\$silent" in
1777         true) case "\$rp" in
1778                 '') ans='';;
1779                 esac;;
1780         esac;;
1781 esac
1782 while expr "X\$ans" : "X!" >/dev/null; do
1783         read answ
1784         set x \$xxxm
1785         shift
1786         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1787         case  "\$answ" in
1788         "!")
1789                 sh 1>&4
1790                 echo " "
1791                 $myecho
1792                 ;;
1793         !*)
1794                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1795                 shift
1796                 sh 1>&4 -c "\$*"
1797                 echo " "
1798                 $myecho
1799                 ;;
1800         "\$ans")
1801                 case "\$ans" in
1802                 \\&*)
1803                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1804                         shift
1805                         case "\$1" in
1806                         -d)
1807                                 fastread=yes
1808                                 echo "(OK, I'll run with -d after this question.)" >&4
1809                                 ;;
1810                         -*)
1811                                 echo "*** Sorry, \$1 not supported yet." >&4
1812                                 ;;
1813                         esac
1814                         $myecho
1815                         ans=!
1816                         ;;
1817                 esac;;
1818         *)
1819                 case "\$aok" in
1820                 y)
1821                         echo "*** Substitution done -- please confirm."
1822                         xxxm="\$ans"
1823                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1824                         xxxm="\$ans"
1825                         ans=!
1826                         ;;
1827                 *)
1828                         echo "*** Error -- try again."
1829                         ans=!
1830                         ;;
1831                 esac
1832                 $myecho
1833                 ;;
1834         esac
1835         case "\$ans\$xxxm\$nostick" in
1836         '')
1837                 ans=!
1838                 $myecho
1839                 ;;
1840         esac
1841 done
1842 case "\$ans" in
1843 '') ans="\$xxxm";;
1844 esac
1845 EOSC
1846
1847 : create .config dir to save info across Configure sessions
1848 test -d ../.config || mkdir ../.config
1849 cat >../.config/README <<EOF
1850 This directory created by Configure to save information that should
1851 persist across sessions for $package.
1852
1853 You may safely delete it if you wish.
1854 EOF
1855
1856 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1857 case "$usedevel" in
1858 $define|true|[yY]*) ;;
1859 *) case "$xversion" in
1860    *[13579])
1861         cat >&4 <<EOH
1862 *** WHOA THERE!!! ***
1863
1864     This is an UNSTABLE DEVELOPMENT release.
1865     The version of this $package distribution is $xversion, that is, odd,
1866     (as opposed to even) and that signifies a development release.
1867     If you want a maintenance release, you want an even-numbered version.
1868
1869     Do ***NOT*** install this into production use.
1870     Data corruption and crashes are possible.
1871
1872     It is most seriously suggested that you do not continue any further
1873     unless you want to help in developing and debugging Perl.
1874
1875     If you *still* want to build perl, you can answer 'y' now,
1876     or pass -Dusedevel to Configure.
1877
1878 EOH
1879         rp='Do you really want to continue?'
1880         dflt='n'
1881         . ./myread
1882         case "$ans" in
1883         [yY]) echo >&4 "Okay, continuing."
1884               usedevel="$define" ;;
1885         *) echo >&4 "Okay, bye."
1886            exit 1
1887            ;;
1888         esac
1889         ;;
1890     esac
1891     ;;
1892 esac
1893 case "$usedevel" in
1894 $define|true|[yY]*)
1895         case "$versiononly" in
1896         '') versiononly="$define" ;;
1897         esac
1898         case "$installusrbinperl" in
1899         '') installusrbinperl="$undef" ;;
1900         esac
1901         ;;
1902 esac
1903
1904 : general instructions
1905 needman=true
1906 firsttime=true
1907 user=`(logname) 2>/dev/null`
1908 case "$user" in
1909 '') user=`whoami 2>&1`;;
1910 esac
1911 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1912         firsttime=false
1913         echo " "
1914         rp='Would you like to see the instructions?'
1915         dflt=n
1916         . ./myread
1917         case "$ans" in
1918         [yY]*) ;;
1919         *) needman=false;;
1920         esac
1921 fi
1922 if $needman; then
1923         cat <<EOH
1924
1925 This installation shell script will examine your system and ask you questions
1926 to determine how the perl5 package should be installed. If you get
1927 stuck on a question, you may use a ! shell escape to start a subshell or
1928 execute a command.  Many of the questions will have default answers in square
1929 brackets; typing carriage return will give you the default.
1930
1931 On some of the questions which ask for file or directory names you are allowed
1932 to use the ~name construct to specify the login directory belonging to "name",
1933 even if you don't have a shell which knows about that.  Questions where this is
1934 allowed will be marked "(~name ok)".
1935
1936 EOH
1937         rp=''
1938         dflt='Type carriage return to continue'
1939         . ./myread
1940         cat <<'EOH'
1941
1942 The prompter used in this script allows you to use shell variables and
1943 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1944 in the default answer, as if the default line was a set of arguments given to a
1945 script shell.  This means you may also use $* to repeat the whole default line,
1946 so you do not have to re-type everything to add something to the default.
1947
1948 Everytime there is a substitution, you will have to confirm.  If there is an
1949 error (e.g. an unmatched backtick), the default answer will remain unchanged
1950 and you will be prompted again.
1951
1952 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1953 the questions and use the computed defaults (or the previous answers if there
1954 was already a config.sh file). Type 'Configure -h' for a list of options.
1955 You may also start interactively and then answer '& -d' at any prompt to turn
1956 on the non-interactive behaviour for the remainder of the execution.
1957
1958 EOH
1959         . ./myread
1960         cat <<EOH
1961
1962 Much effort has been expended to ensure that this shell script will run on any
1963 Unix system.  If despite that it blows up on yours, your best bet is to edit
1964 Configure and run it again.  If you can't run Configure for some reason,
1965 you'll have to generate a config.sh file by hand.  Whatever problems you
1966 have, let me (perlbug@perl.org) know how I blew it.
1967
1968 This installation script affects things in two ways:
1969
1970 1) it may do direct variable substitutions on some of the files included
1971    in this kit.
1972 2) it builds a config.h file for inclusion in C programs.  You may edit
1973    any of these files as the need arises after running this script.
1974
1975 If you make a mistake on a question, there is no easy way to back up to it
1976 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1977 files.  Configure will offer to let you do this before it runs the SH files.
1978
1979 EOH
1980         dflt='Type carriage return to continue'
1981         . ./myread
1982         case "$firsttime" in
1983         true) echo $user >>../.config/instruct;;
1984         esac
1985 fi
1986
1987 : find out where common programs are
1988 echo " "
1989 echo "Locating common programs..." >&4
1990 cat <<EOSC >loc
1991 $startsh
1992 case \$# in
1993 0) exit 1;;
1994 esac
1995 thing=\$1
1996 shift
1997 dflt=\$1
1998 shift
1999 for dir in \$*; do
2000         case "\$thing" in
2001         .)
2002         if test -d \$dir/\$thing; then
2003                 echo \$dir
2004                 exit 0
2005         fi
2006         ;;
2007         *)
2008         for thisthing in \$dir/\$thing; do
2009                 : just loop through to pick last item
2010         done
2011         if test -f \$thisthing; then
2012                 echo \$thisthing
2013                 exit 0
2014         elif test -f \$dir/\$thing.exe; then
2015                 if test -n "$DJGPP"; then
2016                         echo \$dir/\$thing.exe
2017                 else
2018                         : on Eunice apparently
2019                         echo \$dir/\$thing
2020                 fi
2021                 exit 0
2022         fi
2023         ;;
2024         esac
2025 done
2026 echo \$dflt
2027 exit 1
2028 EOSC
2029 chmod +x loc
2030 $eunicefix loc
2031 loclist="
2032 awk
2033 cat
2034 chmod
2035 comm
2036 cp
2037 echo
2038 expr
2039 grep
2040 ls
2041 make
2042 mkdir
2043 rm
2044 sed
2045 sort
2046 touch
2047 tr
2048 uniq
2049 "
2050 trylist="
2051 Mcc
2052 ar
2053 bison
2054 byacc
2055 cpp
2056 csh
2057 date
2058 egrep
2059 gzip
2060 less
2061 ln
2062 more
2063 nm
2064 nroff
2065 pg
2066 test
2067 uname
2068 zip
2069 "
2070 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2071 pth="$pth /lib /usr/lib"
2072 for file in $loclist; do
2073         eval xxx=\$$file
2074         case "$xxx" in
2075         /*|?:[\\/]*)
2076                 if test -f "$xxx"; then
2077                         : ok
2078                 else
2079                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2080                         xxx=`./loc $file $file $pth`
2081                 fi
2082                 ;;
2083         '') xxx=`./loc $file $file $pth`;;
2084         *) xxx=`./loc $xxx $xxx $pth`;;
2085         esac
2086         eval $file=$xxx
2087         eval _$file=$xxx
2088         case "$xxx" in
2089         /*)
2090                 echo $file is in $xxx.
2091                 ;;
2092         ?:[\\/]*)
2093                 echo $file is in $xxx.
2094                 ;;
2095         *)
2096                 echo "I don't know where '$file' is, and my life depends on it." >&4
2097                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2098                 exit 1
2099                 ;;
2100         esac
2101 done
2102 echo " "
2103 echo "Don't worry if any of the following aren't found..."
2104 say=offhand
2105 for file in $trylist; do
2106         eval xxx=\$$file
2107         case "$xxx" in
2108         /*|?:[\\/]*)
2109                 if test -f "$xxx"; then
2110                         : ok
2111                 else
2112                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2113                         xxx=`./loc $file $file $pth`
2114                 fi
2115                 ;;
2116         '') xxx=`./loc $file $file $pth`;;
2117         *) xxx=`./loc $xxx $xxx $pth`;;
2118         esac
2119         eval $file=$xxx
2120         eval _$file=$xxx
2121         case "$xxx" in
2122         /*)
2123                 echo $file is in $xxx.
2124                 ;;
2125         ?:[\\/]*)
2126                 echo $file is in $xxx.
2127                 ;;
2128         *)
2129                 echo "I don't see $file out there, $say."
2130                 say=either
2131                 ;;
2132         esac
2133 done
2134 case "$egrep" in
2135 egrep)
2136         echo "Substituting grep for egrep."
2137         egrep=$grep
2138         ;;
2139 esac
2140 case "$ln" in
2141 ln)
2142         echo "Substituting cp for ln."
2143         ln=$cp
2144         ;;
2145 esac
2146 case "$test" in
2147 test)
2148         echo "Hopefully test is built into your sh."
2149         ;;
2150 *)
2151         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2152                 echo "Using the test built into your sh."
2153                 test=test
2154                 _test=test
2155         fi
2156         ;;
2157 esac
2158 case "$echo" in
2159 echo)
2160         echo "Hopefully echo is built into your sh."
2161         ;;
2162 '') ;;
2163 *)
2164         echo " "
2165 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2166         $echo $n "hi there$c" >foo1
2167         echo $n "hi there$c" >foo2
2168         if cmp foo1 foo2 >/dev/null 2>&1; then
2169                 echo "They are compatible.  In fact, they may be identical."
2170         else
2171                 case "$n" in
2172                 '-n') n='' c='\c';;
2173                 *) n='-n' c='';;
2174                 esac
2175                 cat <<FOO
2176 They are not compatible!  You are probably running ksh on a non-USG system.
2177 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2178 have echo built in and we may have to run some Bourne shell scripts.  That
2179 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2180
2181 FOO
2182                 $echo $n "The star should be here-->$c"
2183                 $echo "*"
2184         fi
2185         $rm -f foo1 foo2
2186         ;;
2187 esac
2188
2189 cat <<EOS >checkcc
2190 $startsh
2191 EOS
2192 cat <<'EOSC' >>checkcc
2193 case "$cc" in
2194 '') ;;
2195 *)  $rm -f try try.*
2196     $cat >try.c <<EOM
2197 int main(int argc, char *argv[]) {
2198   return 0;
2199 }
2200 EOM
2201     if $cc -o try $ccflags $ldflags try.c; then
2202        :
2203     else
2204         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2205         despair=yes
2206         trygcc=yes
2207         case "$cc" in
2208         *gcc*) trygcc=no ;;
2209         esac
2210         case "`$cc -v -c try.c 2>&1`" in
2211         *gcc*) trygcc=no ;;
2212         esac
2213         if $test X"$trygcc" = Xyes; then
2214             if gcc -o try -c try.c; then
2215                 echo " "
2216                 echo "You seem to have a working gcc, though." >&4
2217                 rp="Would you like to use it?"
2218                 dflt=y
2219                 if $test -f myread; then
2220                     . ./myread
2221                 else
2222                     if $test -f UU/myread; then
2223                         . ./UU/myread
2224                     else
2225                         echo "Cannot find myread, sorry.  Aborting." >&2
2226                         exit 1
2227                     fi
2228                 fi  
2229                 case "$ans" in
2230                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2231                 esac
2232             fi
2233         fi
2234         if $test X"$despair" = Xyes; then
2235             $cat >&4 <<EOM
2236 You need to find a working C compiler.
2237 Either (purchase and) install the C compiler supplied by your OS vendor,
2238 or for a free C compiler try http://gcc.gnu.org/
2239 I cannot continue any further, aborting.
2240 EOM
2241             exit 1
2242         fi
2243     fi
2244     $rm -f try try.*
2245     ;;
2246 esac
2247 EOSC
2248
2249 : determine whether symbolic links are supported
2250 echo " "
2251 $touch blurfl
2252 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2253         echo "Symbolic links are supported." >&4
2254         lns="$ln -s"
2255 else
2256         echo "Symbolic links are NOT supported." >&4
2257         lns="$ln"
2258 fi
2259 $rm -f blurfl sym
2260
2261 : determine whether symbolic links are supported
2262 echo " "
2263 case "$lns" in
2264 *"ln -s")
2265         echo "Checking how to test for symbolic links..." >&4
2266         $lns blurfl sym
2267         if $test "X$issymlink" = X; then
2268                 case "$newsh" in
2269                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2270                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2271                 esac
2272                 if test $? = 0; then
2273                         issymlink="test -h"
2274                 else
2275                         echo "Your builtin 'test -h' may be broken." >&4
2276                         case "$test" in
2277                         /*)     ;;
2278                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2279                                 for p in $pth
2280                                 do
2281                                         if test -f "$p/$test"; then
2282                                                 test="$p/$test"
2283                                                 break
2284                                         fi
2285                                 done
2286                                 ;;
2287                         esac
2288                         case "$test" in
2289                         /*)
2290                                 echo "Trying external '$test -h'." >&4
2291                                 issymlink="$test -h"
2292                                 if $test ! -h sym >/dev/null 2>&1; then
2293                                         echo "External '$test -h' is broken, too." >& 4
2294                                         issymlink=''
2295                                 fi
2296                                 ;;
2297                         *)      issymlink='' ;;
2298                         esac
2299                 fi              
2300         fi
2301         if $test "X$issymlink" = X; then
2302                 if $test -L sym 2>/dev/null; then
2303                         issymlink="$test -L"
2304                         echo "The builtin '$test -L' worked." >&4
2305                 fi
2306         fi
2307         if $test "X$issymlink" != X; then
2308                 echo "You can test for symbolic links with '$issymlink'." >&4
2309         else
2310                 echo "I do not know how you can test for symbolic links." >&4
2311         fi
2312         $rm -f blurfl sym
2313         ;;
2314 *)      echo "No symbolic links, so not testing for their testing..." >&4
2315         ;;
2316 esac
2317 echo " "
2318
2319
2320 case "$mksymlinks" in
2321 $define|true|[yY]*)
2322         case "$src" in
2323         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2324                 exit 1
2325                 ;;
2326         *)      case "$lns:$issymlink" in
2327                 *"ln -s:"*"test -"?)
2328                         echo "Creating the symbolic links..." >&4
2329                         echo "(First creating the subdirectories...)" >&4
2330                         cd ..
2331                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2332                                 read directory
2333                                 test -z "$directory" && break
2334                                 mkdir -p $directory
2335                         done
2336                         # Sanity check 1.
2337                         if test ! -d t/base; then
2338                                 echo "Failed to create the subdirectories.  Aborting." >&4
2339                                 exit 1
2340                         fi
2341                         echo "(Then creating the symlinks...)" >&4
2342                         awk '{print $1}' $src/MANIFEST | while true; do
2343                                 read filename
2344                                 test -z "$filename" && break
2345                                 if test -f $filename; then
2346                                         if $issymlink $filename; then
2347                                                 rm -f $filename
2348                                         fi
2349                                 fi
2350                                 if test -f $filename; then
2351                                         echo "$filename already exists, not symlinking."
2352                                 else
2353                                         ln -s $src/$filename $filename
2354                                 fi
2355                         done
2356                         # Sanity check 2.
2357                         if test ! -f t/base/lex.t; then
2358                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2359                                 exit 1
2360                         fi
2361                         cd UU
2362                         ;;
2363                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2364                         ;;
2365                 esac
2366                 ;;
2367         esac
2368         ;;
2369 esac
2370
2371
2372 case "$usecrosscompile" in
2373 $define|true|[yY]*)
2374         $echo "Cross-compiling..."
2375         croak=''
2376         case "$cc" in
2377         *-*-gcc) # A cross-compiling gcc, probably.
2378             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2379             ar=$targetarch-ar
2380             # leave out ld, choosing it is more complex
2381             nm=$targetarch-nm
2382             ranlib=$targetarch-ranlib
2383             $echo 'extern int foo;' > try.c
2384             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2385             shift
2386             if $test $# -gt 0; then
2387                 incpth="$incpth $*"
2388                 incpth="`$echo $incpth|$sed 's/^ //'`"
2389                 echo "Guessing incpth '$incpth'." >&4
2390                 for i in $*; do
2391                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2392                     if $test -d $j; then
2393                         libpth="$libpth $j"
2394                     fi
2395                 done   
2396                 libpth="`$echo $libpth|$sed 's/^ //'`"
2397                 echo "Guessing libpth '$libpth'." >&4
2398             fi
2399             $rm -f try.c
2400             ;;
2401         esac
2402         case "$targetarch" in
2403         '') echo "Targetarch not defined." >&4; croak=y ;;
2404         *)  echo "Using targetarch $targetarch." >&4 ;;
2405         esac
2406         case "$incpth" in
2407         '') echo "Incpth not defined." >&4; croak=y ;;
2408         *)  echo "Using incpth '$incpth'." >&4 ;;
2409         esac
2410         case "$libpth" in
2411         '') echo "Libpth not defined." >&4; croak=y ;;
2412         *)  echo "Using libpth '$libpth'." >&4 ;;
2413         esac
2414         case "$usrinc" in
2415         '') for i in $incpth; do
2416                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2417                     usrinc=$i
2418                     echo "Guessing usrinc $usrinc." >&4
2419                     break
2420                 fi
2421             done
2422             case "$usrinc" in
2423             '') echo "Usrinc not defined." >&4; croak=y ;;
2424             esac
2425             ;;
2426         *)  echo "Using usrinc $usrinc." >&4 ;;
2427         esac
2428         case "$targethost" in
2429         '') echo "Targethost not defined." >&4; croak=y ;;
2430         *)  echo "Using targethost $targethost." >&4
2431         esac
2432         locincpth=' '
2433         loclibpth=' '
2434         case "$croak" in
2435         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2436         esac
2437         case "$src" in
2438         /*) run=$src/Cross/run
2439             targetmkdir=$src/Cross/mkdir
2440             to=$src/Cross/to
2441             from=$src/Cross/from
2442             ;;
2443         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2444             run=$pwd/Cross/run
2445             targetmkdir=$pwd/Cross/mkdir
2446             to=$pwd/Cross/to
2447             from=$pwd/Cross/from
2448             ;;
2449         esac
2450         case "$targetrun" in
2451         '') targetrun=ssh ;;
2452         esac
2453         case "$targetto" in
2454         '') targetto=scp ;;
2455         esac
2456         case "$targetfrom" in
2457         '') targetfrom=scp ;;
2458         esac
2459         run=$run-$targetrun
2460         to=$to-$targetto
2461         from=$from-$targetfrom
2462         case "$targetdir" in
2463         '')  targetdir=/tmp
2464              echo "Guessing targetdir $targetdir." >&4
2465              ;;
2466         esac
2467         case "$targetuser" in
2468         '')  targetuser=root
2469              echo "Guessing targetuser $targetuser." >&4
2470              ;;
2471         esac
2472         case "$targetfrom" in
2473         scp)    q=-q ;;
2474         *)      q='' ;;
2475         esac
2476         case "$targetrun" in
2477         ssh|rsh)
2478             cat >$run <<EOF
2479 #!/bin/sh
2480 case "\$1" in
2481 -cwd)
2482   shift
2483   cwd=\$1
2484   shift
2485   ;;
2486 esac
2487 case "\$cwd" in
2488 '') cwd=$targetdir ;;
2489 esac
2490 exe=\$1
2491 shift
2492 if $test ! -f \$exe.xok; then
2493   $to \$exe
2494   $touch \$exe.xok
2495 fi
2496 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2497 EOF
2498             ;;
2499         *)  echo "Unknown targetrun '$targetrun'" >&4
2500             exit 1
2501             ;;
2502         esac
2503         case "$targetmkdir" in
2504         */Cross/mkdir)
2505             cat >$targetmkdir <<EOF
2506 #!/bin/sh
2507 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2508 EOF
2509             $chmod a+rx $targetmkdir
2510             ;;
2511         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2512             exit 1
2513             ;;
2514         esac
2515         case "$targetto" in
2516         scp|rcp)
2517             cat >$to <<EOF
2518 #!/bin/sh
2519 for f in \$@
2520 do
2521   case "\$f" in
2522   /*)
2523     $targetmkdir \`dirname \$f\`
2524     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2525     ;;
2526   *)
2527     $targetmkdir $targetdir/\`dirname \$f\`
2528     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2529     ;;
2530   esac
2531 done
2532 exit 0
2533 EOF
2534             ;;
2535         cp) cat >$to <<EOF
2536 #!/bin/sh
2537 for f in \$@
2538 do
2539   case "\$f" in
2540   /*)
2541     $mkdir -p $targetdir/\`dirname \$f\`
2542     $cp \$f $targetdir/\$f || exit 1
2543     ;;
2544   *)
2545     $targetmkdir $targetdir/\`dirname \$f\`
2546     $cp \$f $targetdir/\$f || exit 1
2547     ;;
2548   esac
2549 done
2550 exit 0
2551 EOF
2552             ;;
2553         *)  echo "Unknown targetto '$targetto'" >&4
2554             exit 1
2555             ;;
2556         esac
2557         case "$targetfrom" in
2558         scp|rcp)
2559           cat >$from <<EOF
2560 #!/bin/sh
2561 for f in \$@
2562 do
2563   $rm -f \$f
2564   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2565 done
2566 exit 0
2567 EOF
2568             ;;
2569         cp) cat >$from <<EOF
2570 #!/bin/sh
2571 for f in \$@
2572 do
2573   $rm -f \$f
2574   cp $targetdir/\$f . || exit 1
2575 done
2576 exit 0
2577 EOF
2578             ;;
2579         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2580             exit 1
2581             ;;
2582         esac
2583         if $test ! -f $run; then
2584             echo "Target 'run' script '$run' not found." >&4
2585         else
2586             $chmod a+rx $run
2587         fi
2588         if $test ! -f $to; then
2589             echo "Target 'to' script '$to' not found." >&4
2590         else
2591             $chmod a+rx $to
2592         fi
2593         if $test ! -f $from; then
2594             echo "Target 'from' script '$from' not found." >&4
2595         else
2596             $chmod a+rx $from
2597         fi
2598         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2599             exit 1
2600         fi
2601         cat >&4 <<EOF
2602 Using '$run' for remote execution,
2603 and '$from' and '$to'
2604 for remote file transfer.
2605 EOF
2606         ;;
2607 *)      run=''
2608         to=:
2609         from=:
2610         usecrosscompile='undef'
2611         targetarch=''
2612         ;;
2613 esac
2614
2615 : see whether [:lower:] and [:upper:] are supported character classes
2616 echo " "
2617 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2618 ABYZ)
2619         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2620         up='[:upper:]'
2621         low='[:lower:]'
2622         ;;
2623 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2624         # (0xc9 and 0xd1), therefore that is a nice testing point.
2625         if test "X$up" = X -o "X$low" = X; then
2626             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2627             ij) up='[A-Z]'
2628                 low='[a-z]'
2629                 ;;
2630             esac
2631         fi
2632         if test "X$up" = X -o "X$low" = X; then
2633             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2634             ij) up='A-Z'
2635                 low='a-z'
2636                 ;;
2637             esac
2638         fi
2639         if test "X$up" = X -o "X$low" = X; then
2640             case "`echo IJ | od -x 2>/dev/null`" in
2641             *C9D1*|*c9d1*)
2642                 echo "Hey, this might be EBCDIC." >&4
2643                 if test "X$up" = X -o "X$low" = X; then
2644                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2645                     ij) up='[A-IJ-RS-Z]'
2646                         low='[a-ij-rs-z]'
2647                         ;;
2648                     esac
2649                 fi
2650                 if test "X$up" = X -o "X$low" = X; then
2651                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2652                     ij) up='A-IJ-RS-Z'
2653                         low='a-ij-rs-z'
2654                         ;;
2655                     esac
2656                 fi
2657                 ;;
2658             esac
2659         fi
2660 esac
2661 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2662 ij)
2663     echo "Using $up and $low to convert case." >&4
2664     ;;
2665 *)
2666     echo "I don't know how to translate letters from upper to lower case." >&4
2667     echo "Your tr is not acting any way I know of." >&4
2668     exit 1
2669     ;;
2670 esac
2671 : set up the translation script tr, must be called with ./tr of course
2672 cat >tr <<EOSC
2673 $startsh
2674 case "\$1\$2" in
2675 '[A-Z][a-z]') exec $tr '$up' '$low';;
2676 '[a-z][A-Z]') exec $tr '$low' '$up';;
2677 esac
2678 exec $tr "\$@"
2679 EOSC
2680 chmod +x tr
2681 $eunicefix tr
2682
2683 : Try to determine whether config.sh was made on this system
2684 case "$config_sh" in
2685 '')
2686 myuname=`$uname -a 2>/dev/null`
2687 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2688 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2689 # because the A-Z/a-z are not consecutive.
2690 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2691         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2692 newmyuname="$myuname"
2693 dflt=n
2694 case "$knowitall" in
2695 '')
2696         if test -f ../config.sh; then
2697                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2698                         eval "`grep myuname= ../config.sh`"
2699                 fi
2700                 if test "X$myuname" = "X$newmyuname"; then
2701                         dflt=y
2702                 fi
2703         fi
2704         ;;
2705 *) dflt=y;;
2706 esac
2707
2708 : Get old answers from old config file if Configure was run on the
2709 : same system, otherwise use the hints.
2710 hint=default
2711 cd ..
2712 if test -f config.sh; then
2713         echo " "
2714         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2715         . UU/myread
2716         case "$ans" in
2717         n*|N*) echo "OK, I'll ignore it."
2718                 mv config.sh config.sh.old
2719                 myuname="$newmyuname"
2720                 ;;
2721         *)  echo "Fetching default answers from your old config.sh file..." >&4
2722                 tmp_n="$n"
2723                 tmp_c="$c"
2724                 tmp_sh="$sh"
2725                 . ./config.sh
2726                 cp config.sh UU
2727                 n="$tmp_n"
2728                 c="$tmp_c"
2729                 : Older versions did not always set $sh.  Catch re-use of such
2730                 : an old config.sh.
2731                 case "$sh" in
2732                 '') sh="$tmp_sh" ;;
2733                 esac
2734                 hint=previous
2735                 ;;
2736         esac
2737 fi
2738 . ./UU/checkcc
2739 if test ! -f config.sh; then
2740         $cat <<EOM
2741
2742 First time through, eh?  I have some defaults handy for some systems
2743 that need some extra help getting the Configure answers right:
2744
2745 EOM
2746         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2747         dflt=''
2748         : Half the following guesses are probably wrong... If you have better
2749         : tests or hints, please send them to perlbug@perl.org
2750         : The metaconfig authors would also appreciate a copy...
2751         $test -f /irix && osname=irix
2752         $test -f /xenix && osname=sco_xenix
2753         $test -f /dynix && osname=dynix
2754         $test -f /dnix && osname=dnix
2755         $test -f /lynx.os && osname=lynxos
2756         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2757         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2758         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2759         $test -f /bin/mips && /bin/mips && osname=mips
2760         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2761                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2762         $test -d /usr/apollo/bin && osname=apollo
2763         $test -f /etc/saf/_sactab && osname=svr4
2764         $test -d /usr/include/minix && osname=minix
2765         if $test -d /MachTen -o -d /MachTen_Folder; then
2766                 osname=machten
2767                 if $test -x /sbin/version; then
2768                         osvers=`/sbin/version | $awk '{print $2}' |
2769                         $sed -e 's/[A-Za-z]$//'`
2770                 elif $test -x /usr/etc/version; then
2771                         osvers=`/usr/etc/version | $awk '{print $2}' |
2772                         $sed -e 's/[A-Za-z]$//'`
2773                 else
2774                         osvers="$2.$3"
2775                 fi
2776         fi
2777
2778         $test -f /sys/posix.dll &&
2779                 $test -f /usr/bin/what &&
2780                 set X `/usr/bin/what /sys/posix.dll` &&
2781                 $test "$3" = UWIN &&
2782                 osname=uwin &&
2783                 osvers="$5"
2784
2785         if $test -f $uname; then
2786                 set X $myuname
2787                 shift
2788
2789                 case "$5" in
2790                 fps*) osname=fps ;;
2791                 mips*)
2792                         case "$4" in
2793                         umips) osname=umips ;;
2794                         *) osname=mips ;;
2795                         esac;;
2796                 [23]100) osname=mips ;;
2797                 next*) osname=next ;;
2798                 i386*)
2799                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2800                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2801                                 osname='sco'
2802                                 osvers=$tmp
2803                         elif $test -f /etc/kconfig; then
2804                                 osname=isc
2805                                 if test "$lns" = "$ln -s"; then
2806                                         osvers=4
2807                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2808                                         osvers=3
2809                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2810                                         osvers=2
2811                                 fi
2812                         fi
2813                         tmp=''
2814                         ;;
2815                 pc*)
2816                         if test -n "$DJGPP"; then
2817                                 osname=dos
2818                                 osvers=djgpp
2819                         fi
2820                         ;;
2821                 esac
2822
2823                 case "$1" in
2824                 aix) osname=aix
2825                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2826                         case "$tmp" in
2827                         'not found') osvers="$4"."$3" ;;
2828                         '<3240'|'<>3240') osvers=3.2.0 ;;
2829                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2830                         '=3250'|'>3250') osvers=3.2.5 ;;
2831                         *) osvers=$tmp;;
2832                         esac
2833                         ;;
2834                 bsd386) osname=bsd386
2835                         osvers=`$uname -r`
2836                         ;;
2837                 cygwin*) osname=cygwin
2838                         osvers="$3"
2839                         ;;
2840                 *dc.osx) osname=dcosx
2841                         osvers="$3"
2842                         ;;
2843                 dnix) osname=dnix
2844                         osvers="$3"
2845                         ;;
2846                 domainos) osname=apollo
2847                         osvers="$3"
2848                         ;;
2849                 dgux) osname=dgux 
2850                         osvers="$3"
2851                         ;;
2852                 dynixptx*) osname=dynixptx
2853                         osvers=`echo "$4"|sed 's/^v//'`
2854                         ;;
2855                 freebsd) osname=freebsd 
2856                         osvers="$3" ;;
2857                 genix) osname=genix ;;
2858                 hp*) osname=hpux 
2859                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2860                         ;;
2861                 irix*) osname=irix
2862                         case "$3" in
2863                         4*) osvers=4 ;;
2864                         5*) osvers=5 ;;
2865                         *)      osvers="$3" ;;
2866                         esac
2867                         ;;
2868                 linux) osname=linux
2869                         case "$3" in
2870                         *)      osvers="$3" ;;
2871                         esac
2872                         ;;
2873                 MiNT) osname=mint
2874                         ;;
2875                 netbsd*) osname=netbsd
2876                         osvers="$3"
2877                         ;;
2878                 news-os) osvers="$3"
2879                         case "$3" in
2880                         4*) osname=newsos4 ;;
2881                         *) osname=newsos ;;
2882                         esac
2883                         ;;
2884                 next*) osname=next ;;
2885                 nonstop-ux) osname=nonstopux ;;
2886                 POSIX-BC | posix-bc ) osname=posix-bc
2887                         osvers="$3"
2888                         ;;
2889                 powerux | power_ux | powermax_os | powermaxos | \
2890                 powerunix | power_unix) osname=powerux
2891                         osvers="$3"
2892                         ;;
2893                 qnx) osname=qnx
2894                         osvers="$4"
2895                         ;;
2896                 solaris) osname=solaris
2897                         case "$3" in
2898                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2899                         *)      osvers="$3" ;;
2900                         esac
2901                         ;;
2902                 sunos) osname=sunos
2903                         case "$3" in
2904                         5*) osname=solaris
2905                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2906                         *)      osvers="$3" ;;
2907                         esac
2908                         ;;
2909                 titanos) osname=titanos
2910                         case "$3" in
2911                         1*) osvers=1 ;;
2912                         2*) osvers=2 ;;
2913                         3*) osvers=3 ;;
2914                         4*) osvers=4 ;;
2915                         *)      osvers="$3" ;;
2916                         esac
2917                         ;;
2918                 ultrix) osname=ultrix
2919                         osvers="$3"
2920                         ;;
2921                 osf1|mls+)      case "$5" in
2922                                 alpha)
2923                                         osname=dec_osf
2924                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2925                                         case "$osvers" in
2926                                         [1-9].[0-9]*) ;;
2927                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2928                                         esac
2929                                         ;;
2930                         hp*)    osname=hp_osf1  ;;
2931                         mips)   osname=mips_osf1 ;;
2932                         esac
2933                         ;;
2934                 unixware) osname=svr5
2935                         osvers="$4"
2936                         ;;
2937                 uts) osname=uts
2938                         osvers="$3"
2939                         ;;
2940                 $2) case "$osname" in
2941                         *isc*) ;;
2942                         *freebsd*) ;;
2943                         svr*)
2944                                 : svr4.x or possibly later
2945                                 case "svr$3" in 
2946                                 ${osname}*)
2947                                         osname=svr$3
2948                                         osvers=$4
2949                                         ;;
2950                                 esac
2951                                 case "$osname" in
2952                                 svr4.0)
2953                                         : Check for ESIX
2954                                         if test -f /stand/boot ; then
2955                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2956                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2957                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2958                                                         if test -n "$isesix"; then
2959                                                                 osname=esix4
2960                                                         fi
2961                                                 fi
2962                                         fi
2963                                         ;;
2964                                 esac
2965                                 ;;
2966                         *)      if test -f /etc/systemid; then
2967                                         osname=sco
2968                                         set `echo $3 | $sed 's/\./ /g'` $4
2969                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2970                                                 osvers=$1.$2.$3
2971                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2972                                                 osvers=$1.$2
2973                                         elif $test -f $src/hints/sco_$1.sh; then
2974                                                 osvers=$1
2975                                         fi
2976                                 else
2977                                         case "$osname" in
2978                                         '') : Still unknown.  Probably a generic Sys V.
2979                                                 osname="sysv"
2980                                                 osvers="$3"
2981                                                 ;;
2982                                         esac
2983                                 fi
2984                                 ;;
2985                         esac
2986                         ;;
2987                 *)      case "$osname" in
2988                         '') : Still unknown.  Probably a generic BSD.
2989                                 osname="$1"
2990                                 osvers="$3"
2991                                 ;;
2992                         esac
2993                         ;;
2994                 esac
2995         else
2996                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2997                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2998                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2999                                 osname=news_os
3000                         fi
3001                         $rm -f UU/kernel.what
3002                 elif test -d c:/.; then
3003                         set X $myuname
3004                         osname=os2
3005                         osvers="$5"
3006                 fi
3007         fi
3008         
3009         case "$targetarch" in
3010         '') ;;
3011         *)  hostarch=$osname
3012             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3013             osvers=''
3014             ;;
3015         esac
3016
3017         : Now look for a hint file osname_osvers, unless one has been
3018         : specified already.
3019         case "$hintfile" in
3020         ''|' ')
3021                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3022                 : Also try without trailing minor version numbers.
3023                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3024                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3025                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3026                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3027                 case "$file" in
3028                 '') dflt=none ;;
3029                 *)  case "$osvers" in
3030                         '') dflt=$file
3031                                 ;;
3032                         *)  if $test -f $src/hints/$file.sh ; then
3033                                         dflt=$file
3034                                 elif $test -f $src/hints/$xfile.sh ; then
3035                                         dflt=$xfile
3036                                 elif $test -f $src/hints/$xxfile.sh ; then
3037                                         dflt=$xxfile
3038                                 elif $test -f $src/hints/$xxxfile.sh ; then
3039                                         dflt=$xxxfile
3040                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3041                                         dflt=$xxxxfile
3042                                 elif $test -f "$src/hints/${osname}.sh" ; then
3043                                         dflt="${osname}"
3044                                 else
3045                                         dflt=none
3046                                 fi
3047                                 ;;
3048                         esac
3049                         ;;
3050                 esac
3051                 if $test -f Policy.sh ; then
3052                         case "$dflt" in
3053                         *Policy*) ;;
3054                         none) dflt="Policy" ;;
3055                         *) dflt="Policy $dflt" ;;
3056                         esac
3057                 fi
3058                 ;;
3059         *)
3060                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3061                 ;;
3062         esac
3063
3064         if $test -f Policy.sh ; then
3065                 $cat <<EOM
3066
3067 There's also a Policy hint file available, which should make the
3068 site-specific (policy) questions easier to answer.
3069 EOM
3070
3071         fi
3072
3073         $cat <<EOM
3074
3075 You may give one or more space-separated answers, or "none" if appropriate.
3076 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3077 is a good thing.  DO NOT give a wrong version or a wrong OS.
3078
3079 EOM
3080
3081         rp="Which of these apply, if any?"
3082         . UU/myread
3083         tans=$ans
3084         for file in $tans; do
3085                 if $test X$file = XPolicy -a -f Policy.sh; then
3086                         . Policy.sh
3087                         $cat Policy.sh >> UU/config.sh
3088                 elif $test -f $src/hints/$file.sh; then
3089                         . $src/hints/$file.sh
3090                         $cat $src/hints/$file.sh >> UU/config.sh
3091                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3092                         : nothing
3093                 else
3094                         : Give one chance to correct a possible typo.
3095                         echo "$file.sh does not exist"
3096                         dflt=$file
3097                         rp="hint to use instead?"
3098                         . UU/myread
3099                         for file in $ans; do
3100                                 if $test -f "$src/hints/$file.sh"; then
3101                                         . $src/hints/$file.sh
3102                                         $cat $src/hints/$file.sh >> UU/config.sh
3103                                 elif $test X$ans = X -o X$ans = Xnone ; then
3104                                         : nothing
3105                                 else
3106                                         echo "$file.sh does not exist -- ignored."
3107                                 fi
3108                         done
3109                 fi
3110         done
3111
3112         hint=recommended
3113         : Remember our hint file for later.
3114         if $test -f "$src/hints/$file.sh" ; then
3115                 hintfile="$file"
3116         else
3117                 hintfile=''
3118         fi
3119 fi
3120 cd UU
3121 ;;
3122 *)
3123         echo " "
3124         echo "Fetching default answers from $config_sh..." >&4
3125         tmp_n="$n"
3126         tmp_c="$c"
3127         cd ..
3128         cp $config_sh config.sh 2>/dev/null
3129         chmod +w config.sh
3130         . ./config.sh
3131         cd UU
3132         cp ../config.sh .
3133         n="$tmp_n"
3134         c="$tmp_c"
3135         hint=previous
3136         ;;
3137 esac
3138 test "$override" && . ./optdef.sh
3139
3140 : Restore computed paths
3141 for file in $loclist $trylist; do
3142         eval $file="\$_$file"
3143 done
3144
3145 cat << EOM
3146
3147 Configure uses the operating system name and version to set some defaults.
3148 The default value is probably right if the name rings a bell. Otherwise,
3149 since spelling matters for me, either accept the default or answer "none"
3150 to leave it blank.
3151
3152 EOM
3153 case "$osname" in
3154         ''|' ')
3155                 case "$hintfile" in
3156                 ''|' '|none) dflt=none ;;
3157                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3158                 esac
3159                 ;;
3160         *) dflt="$osname" ;;
3161 esac
3162 rp="Operating system name?"
3163 . ./myread
3164 case "$ans" in
3165 none)  osname='' ;;
3166 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3167 esac
3168 echo " "
3169 case "$osvers" in
3170         ''|' ')
3171                 case "$hintfile" in
3172                 ''|' '|none) dflt=none ;;
3173                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3174                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3175                         case "$dflt" in
3176                         ''|' ') dflt=none ;;
3177                         esac
3178                         ;;
3179                 esac
3180                 ;;
3181         *) dflt="$osvers" ;;
3182 esac
3183 rp="Operating system version?"
3184 . ./myread
3185 case "$ans" in
3186 none)  osvers='' ;;
3187 *) osvers="$ans" ;;
3188 esac
3189
3190
3191 . ./posthint.sh
3192
3193 : who configured the system
3194 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3195 cf_by=`(logname) 2>/dev/null`
3196 case "$cf_by" in
3197 "")
3198         cf_by=`(whoami) 2>/dev/null`
3199         case "$cf_by" in
3200         "") cf_by=unknown ;;
3201         esac ;;
3202 esac
3203
3204 : set up the script used to warn in case of inconsistency
3205 cat <<EOS >whoa
3206 $startsh
3207 EOS
3208 cat <<'EOSC' >>whoa
3209 dflt=y
3210 echo " "
3211 echo "*** WHOA THERE!!! ***" >&4
3212 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3213 rp="    Keep the $hint value?"
3214 . ./myread
3215 case "$ans" in
3216 y) td=$was; tu=$was;;
3217 esac
3218 EOSC
3219
3220 : function used to set $1 to $val
3221 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3222 case "$val$was" in
3223 $define$undef) . ./whoa; eval "$var=\$td";;
3224 $undef$define) . ./whoa; eval "$var=\$tu";;
3225 *) eval "$var=$val";;
3226 esac'
3227
3228 case "$usethreads" in
3229 $define|true|[yY]*)     dflt='y';;
3230 *) dflt='n';;
3231 esac
3232 cat <<EOM
3233
3234 Perl can be built to take advantage of threads on some systems.
3235 To do so, Configure can be run with -Dusethreads.
3236
3237 Note that threading is a highly experimental feature, and
3238 some known race conditions still remain.  If you choose to try
3239 it, be very sure to not actually deploy it for production
3240 purposes.  README.threads has more details, and is required
3241 reading if you enable threads.
3242
3243 If this doesn't make any sense to you, just accept the default '$dflt'.
3244 EOM
3245 rp='Build a threading Perl?'
3246 . ./myread
3247 case "$ans" in
3248 y|Y)    val="$define" ;;
3249 *)      val="$undef" ;;
3250 esac
3251 set usethreads
3252 eval $setvar
3253
3254 case "$usethreads" in
3255 $define)
3256         $cat <<EOM
3257
3258 As of 5.5.640, Perl has two different internal threading implementations,
3259 the 5.005 version (5005threads) and an interpreter-based version
3260 (ithreads) that has one interpreter per thread.  Both are very 
3261 experimental.  This arrangement exists to help developers work out
3262 which one is better.
3263
3264 If you're a casual user, you probably don't want interpreter-threads
3265 at this time.  But if you do, the 'threads' module allows their use,
3266 and the 'Thread' module offers an interface to both 5005threads and
3267 ithreads (whichever has been configured).
3268 EOM
3269         : Default to ithreads unless overridden on command line or with
3270         : old config.sh
3271         dflt='y'
3272         case "$use5005threads" in
3273                 $define|true|[yY]*) dflt='n';;
3274         esac
3275         case "$useithreads" in
3276                 $undef|false|[nN]*) dflt='n';;
3277         esac
3278         rp='Use interpreter-based ithreads?'
3279         . ./myread
3280         case "$ans" in
3281         y|Y)    val="$define" ;;
3282         *)      val="$undef" ;;
3283         esac
3284         set useithreads
3285         eval $setvar
3286         : Now set use5005threads to the opposite value.
3287         case "$useithreads" in
3288         $define) val="$undef" ;;
3289         *) val="$define" ;;
3290         esac
3291         set use5005threads
3292         eval $setvar
3293         ;;
3294 *)
3295         useithreads="$undef"
3296         use5005threads="$undef"
3297         ;;
3298 esac
3299
3300 case "$useithreads$use5005threads" in
3301 "$define$define")
3302         $cat >&4 <<EOM
3303
3304 You cannot have both the ithreads and the 5.005 threads enabled
3305 at the same time.  Disabling the 5.005 threads since they are
3306 much less stable than the ithreads.
3307
3308 EOM
3309         use5005threads="$undef"
3310         ;;
3311 esac
3312
3313 case "$d_oldpthreads" in
3314 '')     : Configure tests would be welcome here.  For now, assume undef.
3315         val="$undef" ;;
3316 *)      val="$d_oldpthreads" ;;
3317 esac
3318 set d_oldpthreads
3319 eval $setvar
3320
3321
3322 case "$usethreads" in
3323 "$define"|true|[yY]*)
3324 : Look for a hint-file generated 'call-back-unit'.  If the
3325 : user has specified that a threading perl is to be built,
3326 : we may need to set or change some other defaults.
3327         if $test -f usethreads.cbu; then
3328                 echo "Your platform has some specific hints for threaded builds, using them..."
3329                 . ./usethreads.cbu
3330         else
3331                 $cat <<EOM
3332 (Your platform doesn't have any specific hints for threaded builds.
3333  Assuming POSIX threads, then.)
3334 EOM
3335         fi
3336         ;;
3337 esac
3338
3339 cat <<EOM
3340
3341 Perl can be built so that multiple Perl interpreters can coexist
3342 within the same Perl executable.
3343 EOM
3344
3345 case "$useithreads" in
3346 $define)
3347         cat <<EOM
3348 This multiple interpreter support is required for interpreter-based threads.
3349 EOM
3350         val="$define"
3351         ;;
3352 *)      case "$usemultiplicity" in
3353         $define|true|[yY]*)     dflt='y';;
3354         *) dflt='n';;
3355         esac
3356         echo " "
3357         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3358         rp='Build Perl for multiplicity?'
3359         . ./myread
3360         case "$ans" in
3361         y|Y)    val="$define" ;;
3362         *)      val="$undef" ;;
3363         esac
3364         ;;
3365 esac
3366 set usemultiplicity
3367 eval $setvar
3368
3369
3370 case "$usemorebits" in
3371 "$define"|true|[yY]*)
3372         use64bitint="$define"
3373         uselongdouble="$define"
3374         usemorebits="$define"
3375         ;;
3376 *)      usemorebits="$undef"
3377         ;;
3378 esac
3379
3380 : make some quick guesses about what we are up against
3381 echo " "
3382 $echo $n "Hmm...  $c"
3383 echo exit 1 >bsd
3384 echo exit 1 >usg
3385 echo exit 1 >v7
3386 echo exit 1 >osf1
3387 echo exit 1 >eunice
3388 echo exit 1 >xenix
3389 echo exit 1 >venix
3390 echo exit 1 >os2
3391 d_bsd="$undef"
3392 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3393 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3394 then
3395         echo "Looks kind of like an OSF/1 system, but we'll see..."
3396         echo exit 0 >osf1
3397 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3398         xxx=`./loc addbib blurfl $pth`
3399         if $test -f $xxx; then
3400         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3401                 echo exit 0 >bsd
3402                 echo exit 0 >usg
3403         else
3404                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3405                         echo "Looks kind of like an extended USG system, but we'll see..."
3406                 else
3407                         echo "Looks kind of like a USG system, but we'll see..."
3408                 fi
3409                 echo exit 0 >usg
3410         fi
3411 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3412         echo "Looks kind of like a BSD system, but we'll see..."
3413         d_bsd="$define"
3414         echo exit 0 >bsd
3415 else
3416         echo "Looks kind of like a Version 7 system, but we'll see..."
3417         echo exit 0 >v7
3418 fi
3419 case "$eunicefix" in
3420 *unixtovms*)
3421         $cat <<'EOI'
3422 There is, however, a strange, musty smell in the air that reminds me of
3423 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3424 EOI
3425         echo exit 0 >eunice
3426         d_eunice="$define"
3427 : it so happens the Eunice I know will not run shell scripts in Unix format
3428         ;;
3429 *)
3430         echo " "
3431         echo "Congratulations.  You aren't running Eunice."
3432         d_eunice="$undef"
3433         ;;
3434 esac
3435 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3436 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3437 : semicolon as a patch separator
3438 case "$p_" in
3439 :) ;;
3440 *)
3441         $cat <<'EOI'
3442 I have the feeling something is not exactly right, however...don't tell me...
3443 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3444 (Or you may be running DOS with DJGPP.)
3445 EOI
3446         echo exit 0 >os2
3447         ;;
3448 esac
3449 if test -f /xenix; then
3450         echo "Actually, this looks more like a XENIX system..."
3451         echo exit 0 >xenix
3452         d_xenix="$define"
3453 else
3454         echo " "
3455         echo "It's not Xenix..."
3456         d_xenix="$undef"
3457 fi
3458 chmod +x xenix
3459 $eunicefix xenix
3460 if test -f /venix; then
3461         echo "Actually, this looks more like a VENIX system..."
3462         echo exit 0 >venix
3463 else
3464         echo " "
3465         if ./xenix; then
3466                 : null
3467         else
3468                 echo "Nor is it Venix..."
3469         fi
3470 fi
3471 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3472 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3473 $rm -f foo
3474
3475 case "$cc" in
3476 '') dflt=cc;;
3477 *) dflt="$cc";;
3478 esac
3479 rp="Use which C compiler?"
3480 . ./myread
3481 cc="$ans"
3482 : Look for a hint-file generated 'call-back-unit'.  Now that the
3483 : user has specified the compiler, we may need to set or change some
3484 : other defaults.
3485 if $test -f cc.cbu; then
3486     . ./cc.cbu
3487 fi
3488 . ./checkcc
3489
3490 echo " "
3491 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3492 $cat >try.c <<EOM
3493 #include <stdio.h>
3494 int main() {
3495 #ifdef __GNUC__
3496 #ifdef __VERSION__
3497         printf("%s\n", __VERSION__);
3498 #else
3499         printf("%s\n", "1");
3500 #endif
3501 #endif
3502         exit(0);
3503 }
3504 EOM
3505 if $cc -o try $ccflags $ldflags try.c; then
3506         gccversion=`$run ./try`
3507         case "$gccversion" in
3508         '') echo "You are not using GNU cc." ;;
3509         *)  echo "You are using GNU cc $gccversion."
3510             ccname=gcc  
3511             ;;
3512         esac
3513 else
3514         echo " "
3515         echo "*** WHOA THERE!!! ***" >&4
3516         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3517         case "$knowitall" in
3518         '')
3519         echo "    You'd better start hunting for one and let me know about it." >&4
3520                 exit 1
3521                 ;;
3522         esac
3523 fi
3524 $rm -f try try.*
3525 case "$gccversion" in
3526 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3527 esac
3528 case "$gccversion" in
3529 '') gccosandvers='' ;;
3530 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3531    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3532    gccshortvers=''
3533    case "$gccosandvers" in
3534    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3535    $osname$osvers) ;; # looking good
3536    $osname*) cat <<EOM >&4
3537
3538 *** WHOA THERE!!! ***
3539
3540     Your gcc has not been compiled for the exact release of
3541     your operating system ($gccosandvers versus $osname$osvers).
3542
3543     In general it is a good idea to keep gcc synchronized with
3544     the operating system because otherwise serious problems
3545     may ensue when trying to compile software, like Perl.
3546
3547     I'm trying to be optimistic here, though, and will continue.
3548     If later during the configuration and build icky compilation
3549     problems appear (headerfile conflicts being the most common
3550     manifestation), I suggest reinstalling the gcc to match
3551     your operating system release.
3552
3553 EOM
3554       ;;
3555    *) gccosandvers='' ;; # failed to parse, better be silent
3556    esac
3557    ;;
3558 esac
3559 case "$ccname" in
3560 '') ccname="$cc" ;;
3561 esac
3562
3563
3564 : decide how portable to be.  Allow command line overrides.
3565 case "$d_portable" in
3566 "$undef") ;;
3567 *)      d_portable="$define" ;;
3568 esac
3569
3570 : set up shell script to do ~ expansion
3571 cat >filexp <<EOSS
3572 $startsh
3573 : expand filename
3574 case "\$1" in
3575  ~/*|~)
3576         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3577         ;;
3578  ~*)
3579         if $test -f /bin/csh; then
3580                 /bin/csh -f -c "glob \$1"
3581                 failed=\$?
3582                 echo ""
3583                 exit \$failed
3584         else
3585                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3586                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3587                 if $test ! -d "\$dir"; then
3588                         me=\`basename \$0\`
3589                         echo "\$me: can't locate home directory for: \$name" >&2
3590                         exit 1
3591                 fi
3592                 case "\$1" in
3593                 */*)
3594                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3595                         ;;
3596                 *)
3597                         echo \$dir
3598                         ;;
3599                 esac
3600         fi
3601         ;;
3602 *)
3603         echo \$1
3604         ;;
3605 esac
3606 EOSS
3607 chmod +x filexp
3608 $eunicefix filexp
3609
3610 : now set up to get a file name
3611 cat <<EOS >getfile
3612 $startsh
3613 EOS
3614 cat <<'EOSC' >>getfile
3615 tilde=''
3616 fullpath=''
3617 already=''
3618 skip=''
3619 none_ok=''
3620 exp_file=''
3621 nopath_ok=''
3622 orig_rp="$rp"
3623 orig_dflt="$dflt"
3624 case "$gfpth" in
3625 '') gfpth='.' ;;
3626 esac
3627
3628 case "$fn" in
3629 *\(*)
3630         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3631         fn=`echo $fn | sed 's/(.*)//'`
3632         ;;
3633 esac
3634
3635 case "$fn" in
3636 *:*)
3637         loc_file=`expr $fn : '.*:\(.*\)'`
3638         fn=`expr $fn : '\(.*\):.*'`
3639         ;;
3640 esac
3641
3642 case "$fn" in
3643 *~*) tilde=true;;
3644 esac
3645 case "$fn" in
3646 */*) fullpath=true;;
3647 esac
3648 case "$fn" in
3649 *+*) skip=true;;
3650 esac
3651 case "$fn" in
3652 *n*) none_ok=true;;
3653 esac
3654 case "$fn" in
3655 *e*) exp_file=true;;
3656 esac
3657 case "$fn" in
3658 *p*) nopath_ok=true;;
3659 esac
3660
3661 case "$fn" in
3662 *f*) type='File';;
3663 *d*) type='Directory';;
3664 *l*) type='Locate';;
3665 esac
3666
3667 what="$type"
3668 case "$what" in
3669 Locate) what='File';;
3670 esac
3671
3672 case "$exp_file" in
3673 '')
3674         case "$d_portable" in
3675         "$define") ;;
3676         *) exp_file=true;;
3677         esac
3678         ;;
3679 esac
3680
3681 cd ..
3682 while test "$type"; do
3683         redo=''
3684         rp="$orig_rp"
3685         dflt="$orig_dflt"
3686         case "$tilde" in
3687         true) rp="$rp (~name ok)";;
3688         esac
3689         . UU/myread
3690         if test -f UU/getfile.ok && \
3691                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3692         then
3693                 value="$ans"
3694                 ansexp="$ans"
3695                 break
3696         fi
3697         case "$ans" in
3698         none)
3699                 value=''
3700                 ansexp=''
3701                 case "$none_ok" in
3702                 true) type='';;
3703                 esac
3704                 ;;
3705         *)
3706                 case "$tilde" in
3707                 '') value="$ans"
3708                         ansexp="$ans";;
3709                 *)
3710                         value=`UU/filexp $ans`
3711                         case $? in
3712                         0)
3713                                 if test "$ans" != "$value"; then
3714                                         echo "(That expands to $value on this system.)"
3715                                 fi
3716                                 ;;
3717                         *) value="$ans";;
3718                         esac
3719                         ansexp="$value"
3720                         case "$exp_file" in
3721                         '') value="$ans";;
3722                         esac
3723                         ;;
3724                 esac
3725                 case "$fullpath" in
3726                 true)
3727                         case "$ansexp" in
3728                         /*) value="$ansexp" ;;
3729                         [a-zA-Z]:/*) value="$ansexp" ;;
3730                         *)
3731                                 redo=true
3732                                 case "$already" in
3733                                 true)
3734                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3735                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3736                                         ;;
3737                                 *)
3738                                 echo "Please give a full path name, starting with slash." >&4
3739                                         case "$tilde" in
3740                                         true)
3741                                 echo "Note that using ~name is ok provided it expands well." >&4
3742                                                 already=true
3743                                                 ;;
3744                                         esac
3745                                 esac
3746                                 ;;
3747                         esac
3748                         ;;
3749                 esac
3750                 case "$redo" in
3751                 '')
3752                         case "$type" in
3753                         File)
3754                                 for fp in $gfpth; do
3755                                         if test "X$fp" = X.; then
3756                                             pf="$ansexp"
3757                                         else    
3758                                             pf="$fp/$ansexp"
3759                                         fi
3760                                         if test -f "$pf"; then
3761                                                 type=''
3762                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3763                                         then
3764                                                 echo "($value is not a plain file, but that's ok.)"
3765                                                 type=''
3766                                         fi
3767                                         if test X"$type" = X; then
3768                                             value="$pf"
3769                                             break
3770                                         fi
3771                                 done
3772                                 ;;
3773                         Directory)
3774                                 for fp in $gfpth; do
3775                                         if test "X$fp" = X.; then
3776                                             dir="$ans"
3777                                             direxp="$ansexp"
3778                                         else    
3779                                             dir="$fp/$ansexp"
3780                                             direxp="$fp/$ansexp"
3781                                         fi
3782                                         if test -d "$direxp"; then
3783                                                 type=''
3784                                                 value="$dir"
3785                                                 break
3786                                         fi
3787                                 done
3788                                 ;;
3789                         Locate)
3790                                 if test -d "$ansexp"; then
3791                                         echo "(Looking for $loc_file in directory $value.)"
3792                                         value="$value/$loc_file"
3793                                         ansexp="$ansexp/$loc_file"
3794                                 fi
3795                                 if test -f "$ansexp"; then
3796                                         type=''
3797                                 fi
3798                                 case "$nopath_ok" in
3799                                 true)   case "$value" in
3800                                         */*) ;;
3801                                         *)      echo "Assuming $value will be in people's path."
3802                                                 type=''
3803                                                 ;;
3804                                         esac
3805                                         ;;
3806                                 esac
3807                                 ;;
3808                         esac
3809
3810                         case "$skip" in
3811                         true) type='';
3812                         esac
3813
3814                         case "$type" in
3815                         '') ;;
3816                         *)
3817                                 if test "$fastread" = yes; then
3818                                         dflt=y
3819                                 else
3820                                         dflt=n
3821                                 fi
3822                                 rp="$what $value doesn't exist.  Use that name anyway?"
3823                                 . UU/myread
3824                                 dflt=''
3825                                 case "$ans" in
3826                                 y*) type='';;
3827                                 *) echo " ";;
3828                                 esac
3829                                 ;;
3830                         esac
3831                         ;;
3832                 esac
3833                 ;;
3834         esac
3835 done
3836 cd UU
3837 ans="$value"
3838 rp="$orig_rp"
3839 dflt="$orig_dflt"
3840 rm -f getfile.ok
3841 test "X$gfpthkeep" != Xy && gfpth=""
3842 EOSC
3843
3844 : What should the include directory be ?
3845 echo " "
3846 $echo $n "Hmm...  $c"
3847 dflt='/usr/include'
3848 incpath=''
3849 mips_type=''
3850 if $test -f /bin/mips && /bin/mips; then
3851         echo "Looks like a MIPS system..."
3852         $cat >usr.c <<'EOCP'
3853 #ifdef SYSTYPE_BSD43
3854 /bsd43
3855 #endif
3856 EOCP
3857         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3858                 dflt='/bsd43/usr/include'
3859                 incpath='/bsd43'
3860                 mips_type='BSD 4.3'
3861         else
3862                 mips_type='System V'
3863         fi
3864         $rm -f usr.c usr.out
3865         echo "and you're compiling with the $mips_type compiler and libraries."
3866         xxx_prompt=y
3867         echo "exit 0" >mips
3868 else
3869         echo "Doesn't look like a MIPS system."
3870         xxx_prompt=n
3871         echo "exit 1" >mips
3872 fi
3873 chmod +x mips
3874 $eunicefix mips
3875 case "$usrinc" in
3876 '') ;;
3877 *) dflt="$usrinc";;
3878 esac
3879 case "$xxx_prompt" in
3880 y)      fn=d/
3881         echo " "
3882         rp='Where are the include files you want to use?'
3883         . ./getfile
3884         usrinc="$ans"
3885         ;;
3886 *)      usrinc="$dflt"
3887         ;;
3888 esac
3889
3890 : see how we invoke the C preprocessor
3891 echo " "
3892 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3893 cat <<'EOT' >testcpp.c
3894 #define ABC abc
3895 #define XYZ xyz
3896 ABC.XYZ
3897 EOT
3898 cd ..
3899 if test ! -f cppstdin; then
3900         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3901                 # AIX cc -E doesn't show the absolute headerfile
3902                 # locations but we'll cheat by using the -M flag.
3903                 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
3904         else
3905                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3906         fi
3907 else
3908         echo "Keeping your $hint cppstdin wrapper."
3909 fi
3910 chmod 755 cppstdin
3911 wrapper=`pwd`/cppstdin
3912 ok='false'
3913 cd UU
3914
3915 if $test "X$cppstdin" != "X" && \
3916         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3917         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3918 then
3919         echo "You used to use $cppstdin $cppminus so we'll use that again."
3920         case "$cpprun" in
3921         '') echo "But let's see if we can live without a wrapper..." ;;
3922         *)
3923                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3924                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3925                 then
3926                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3927                         ok='true'
3928                 else
3929                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3930                 fi
3931                 ;;
3932         esac
3933 else
3934         case "$cppstdin" in
3935         '') ;;
3936         *)
3937                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3938                 ;;
3939         esac
3940 fi
3941
3942 if $ok; then
3943         : nothing
3944 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3945         $cc -E <testcpp.c >testcpp.out 2>&1; \
3946         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3947         echo "Yup, it does."
3948         x_cpp="$cc -E"
3949         x_minus='';
3950 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3951         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3952         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3953         echo "Yup, it does."
3954         x_cpp="$cc -E"
3955         x_minus='-';
3956 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3957         $cc -P <testcpp.c >testcpp.out 2>&1; \
3958         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3959         echo "Yipee, that works!"
3960         x_cpp="$cc -P"
3961         x_minus='';
3962 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3963         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3964         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3965         echo "At long last!"
3966         x_cpp="$cc -P"
3967         x_minus='-';
3968 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3969         $cpp <testcpp.c >testcpp.out 2>&1; \
3970         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3971         echo "It works!"
3972         x_cpp="$cpp"
3973         x_minus='';
3974 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3975         $cpp - <testcpp.c >testcpp.out 2>&1; \
3976         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3977         echo "Hooray, it works!  I was beginning to wonder."
3978         x_cpp="$cpp"
3979         x_minus='-';
3980 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3981         $wrapper <testcpp.c >testcpp.out 2>&1; \
3982         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3983         x_cpp="$wrapper"
3984         x_minus=''
3985         echo "Eureka!"
3986 else
3987         dflt=''
3988         rp="No dice.  I can't find a C preprocessor.  Name one:"
3989         . ./myread
3990         x_cpp="$ans"
3991         x_minus=''
3992         $x_cpp <testcpp.c >testcpp.out 2>&1
3993         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3994                 echo "OK, that will do." >&4
3995         else
3996 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3997                 exit 1
3998         fi
3999 fi
4000
4001 case "$ok" in
4002 false)
4003         cppstdin="$x_cpp"
4004         cppminus="$x_minus"
4005         cpprun="$x_cpp"
4006         cpplast="$x_minus"
4007         set X $x_cpp
4008         shift
4009         case "$1" in
4010         "$cpp")
4011                 echo "Perhaps can we force $cc -E using a wrapper..."
4012                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4013                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4014                 then
4015                         echo "Yup, we can."
4016                         cppstdin="$wrapper"
4017                         cppminus='';
4018                 else
4019                         echo "Nope, we'll have to live without it..."
4020                 fi
4021                 ;;
4022         esac
4023         case "$cpprun" in
4024         "$wrapper")
4025                 cpprun=''
4026                 cpplast=''
4027                 ;;
4028         esac
4029         ;;
4030 esac
4031
4032 case "$cppstdin" in
4033 "$wrapper"|'cppstdin') ;;
4034 *) $rm -f $wrapper;;
4035 esac
4036 $rm -f testcpp.c testcpp.out
4037
4038 : Set private lib path
4039 case "$plibpth" in
4040 '') if ./mips; then
4041                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4042         fi;;
4043 esac
4044 case "$libpth" in
4045 ' ') dlist='';;
4046 '') dlist="$loclibpth $plibpth $glibpth";;
4047 *) dlist="$libpth";;
4048 esac
4049
4050 : Now check and see which directories actually exist, avoiding duplicates
4051 libpth=''
4052 for xxx in $dlist
4053 do
4054     if $test -d $xxx; then
4055                 case " $libpth " in
4056                 *" $xxx "*) ;;
4057                 *) libpth="$libpth $xxx";;
4058                 esac
4059     fi
4060 done
4061 $cat <<'EOM'
4062
4063 Some systems have incompatible or broken versions of libraries.  Among
4064 the directories listed in the question below, please remove any you
4065 know not to be holding relevant libraries, and add any that are needed.
4066 Say "none" for none.
4067
4068 EOM
4069 case "$libpth" in
4070 '') dflt='none';;
4071 *)
4072         set X $libpth
4073         shift
4074         dflt=${1+"$@"}
4075         ;;
4076 esac
4077 rp="Directories to use for library searches?"
4078 . ./myread
4079 case "$ans" in
4080 none) libpth=' ';;
4081 *) libpth="$ans";;
4082 esac
4083
4084 : compute shared library extension
4085 case "$so" in
4086 '')
4087         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4088                 dflt='sl'
4089         else
4090                 dflt='so'
4091         fi
4092         ;;
4093 *) dflt="$so";;
4094 esac
4095 $cat <<EOM
4096
4097 On some systems, shared libraries may be available.  Answer 'none' if
4098 you want to suppress searching of shared libraries for the remainder
4099 of this configuration.
4100
4101 EOM
4102 rp='What is the file extension used for shared libraries?'
4103 . ./myread
4104 so="$ans"
4105
4106 : Define several unixisms.
4107 : Hints files or command line option can be used to override them.
4108 : The convoluted testing is in case hints files set either the old
4109 : or the new name.
4110 case "$_exe" in
4111 '')     case "$exe_ext" in
4112     '') ;;
4113         *)      _exe="$exe_ext" ;;
4114         esac
4115         ;;
4116 esac
4117 case "$_a" in
4118 '')     case "$lib_ext" in
4119     '') _a='.a';;
4120         *)      _a="$lib_ext" ;;
4121         esac
4122         ;;
4123 esac
4124 case "$_o" in
4125 '') case "$obj_ext" in
4126         '')     _o='.o';;
4127         *)      _o="$obj_ext";;
4128         esac
4129         ;;
4130 esac
4131 case "$p_" in
4132 '') case "$path_sep" in
4133         '')     p_=':';;
4134         *)      p_="$path_sep";;
4135         esac
4136         ;;
4137 esac
4138 exe_ext=$_exe
4139 lib_ext=$_a
4140 obj_ext=$_o
4141 path_sep=$p_
4142
4143 : Which makefile gets called first.  This is used by make depend.
4144 case "$firstmakefile" in
4145 '') firstmakefile='makefile';;
4146 esac
4147
4148 case "$usesocks" in
4149 $define|true|[yY]*)     dflt='y';;
4150 *) dflt='n';;
4151 esac
4152 cat <<EOM
4153
4154 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4155 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4156 to use the PerlIO abstraction layer, this will be implicitly selected.
4157
4158 If this doesn't make any sense to you, just accept the default '$dflt'.
4159 EOM
4160 rp='Build Perl for SOCKS?'
4161 . ./myread
4162 case "$ans" in
4163 y|Y)    val="$define" ;;     
4164 *)      val="$undef" ;;
4165 esac
4166 set usesocks
4167 eval $setvar
4168
4169 case "$usesocks" in
4170 $define|true|[yY]*) useperlio="$define";;
4171 esac
4172
4173 : Looking for optional libraries
4174 echo " "
4175 echo "Checking for optional libraries..." >&4
4176 case "$libs" in
4177 ' '|'') dflt='';;
4178 *) dflt="$libs";;
4179 esac
4180 case "$libswanted" in
4181 '') libswanted='c_s';;
4182 esac
4183 case "$usesocks" in
4184 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4185 esac
4186 libsfound=''
4187 libsfiles=''
4188 libsdirs=''
4189 libspath=''
4190 for thisdir in $libpth $xlibpth; do
4191   test -d $thisdir && libspath="$libspath $thisdir"
4192 done
4193 for thislib in $libswanted; do
4194         for thisdir in $libspath; do
4195             xxx=''
4196             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4197                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4198                 $test -f "$xxx" && eval $libscheck
4199                 $test -f "$xxx" && libstyle=shared
4200             fi
4201             if test ! -f "$xxx"; then
4202                 xxx=$thisdir/lib$thislib.$so
4203                 $test -f "$xxx" && eval $libscheck
4204                 $test -f "$xxx" && libstyle=shared
4205             fi  
4206             if test ! -f "$xxx"; then
4207                 xxx=$thisdir/lib$thislib$_a
4208                 $test -f "$xxx" && eval $libscheck
4209                 $test -f "$xxx" && libstyle=static
4210             fi
4211             if test ! -f "$xxx"; then
4212                 xxx=$thisdir/$thislib$_a
4213                 $test -f "$xxx" && eval $libscheck
4214                 $test -f "$xxx" && libstyle=static
4215             fi
4216             if test ! -f "$xxx"; then
4217                 xxx=$thisdir/lib${thislib}_s$_a
4218                 $test -f "$xxx" && eval $libscheck
4219                 $test -f "$xxx" && libstyle=static
4220                 $test -f "$xxx" && thislib=${thislib}_s
4221             fi
4222             if test ! -f "$xxx"; then
4223                 xxx=$thisdir/Slib$thislib$_a
4224                 $test -f "$xxx" && eval $libscheck
4225                 $test -f "$xxx" && libstyle=static
4226             fi
4227             if $test -f "$xxx"; then
4228                 case "$libstyle" in
4229                 shared) echo "Found -l$thislib (shared)." ;;
4230                 static) echo "Found -l$thislib." ;;
4231                 *)      echo "Found -l$thislib ($libstyle)." ;;
4232                 esac
4233                 case " $dflt " in
4234                 *"-l$thislib "*);;
4235                 *) dflt="$dflt -l$thislib"
4236                    libsfound="$libsfound $xxx"
4237                    yyy=`basename $xxx`
4238                    libsfiles="$libsfiles $yyy"
4239                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4240                    case " $libsdirs " in
4241                    *" $yyy "*) ;;
4242                    *) libsdirs="$libsdirs $yyy" ;;
4243                    esac
4244                    ;;
4245                 esac
4246                 break
4247             fi  
4248         done
4249         if $test ! -f "$xxx"; then
4250             echo "No -l$thislib."
4251         fi
4252 done
4253 set X $dflt
4254 shift
4255 dflt="$*"
4256 case "$libs" in
4257 '') dflt="$dflt";;
4258 *) dflt="$libs";;
4259 esac
4260 case "$dflt" in
4261 ' '|'') dflt='none';;
4262 esac
4263
4264 $cat <<EOM
4265
4266 In order to compile $package on your machine, a number of libraries
4267 are usually needed.  Include any other special libraries here as well.
4268 Say "none" for none.  The default list is almost always right.
4269 EOM
4270
4271 echo " "
4272 rp="What libraries to use?"
4273 . ./myread
4274 case "$ans" in
4275 none) libs=' ';;
4276 *) libs="$ans";;
4277 esac
4278
4279 : determine optimization, if desired, or use for debug flag also
4280 case "$optimize" in
4281 ' '|$undef) dflt='none';;
4282 '') dflt='-O';;
4283 *) dflt="$optimize";;
4284 esac
4285 $cat <<EOH
4286
4287 By default, $package compiles with the -O flag to use the optimizer.
4288 Alternately, you might want to use the symbolic debugger, which uses
4289 the -g flag (on traditional Unix systems).  Either flag can be
4290 specified here.  To use neither flag, specify the word "none".
4291
4292 EOH
4293 rp="What optimizer/debugger flag should be used?"
4294 . ./myread
4295 optimize="$ans"
4296 case "$optimize" in
4297 'none') optimize=" ";;
4298 esac
4299
4300 dflt=''
4301 : We will not override a previous value, but we might want to
4302 : augment a hint file
4303 case "$hint" in
4304 default|recommended)
4305         case "$gccversion" in
4306         1*) dflt='-fpcc-struct-return' ;;
4307         esac
4308         case "$optimize" in
4309         *-g*) dflt="$dflt -DDEBUGGING";;
4310         esac
4311         case "$gccversion" in
4312         2*) if test -d /etc/conf/kconfig.d &&
4313                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4314                 then
4315                         dflt="$dflt -posix"
4316                 fi
4317                 ;;
4318         esac
4319         case "$gccversion" in
4320         1*) ;;
4321         2.[0-8]*) ;;
4322         ?*)     echo " "
4323                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4324                 echo 'int main(void) { return 0; }' > gcctest.c
4325                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4326                         echo "Yes, it does." 2>&1
4327                         case "$ccflags" in
4328                         *strict-aliasing*) 
4329                                 echo "Leaving current flags $ccflags alone." 2>&1
4330                                 ;;
4331                         *) dflt="$dflt -fno-strict-aliasing" ;;
4332                         esac
4333                 else
4334                         echo "Nope, it doesn't, but that's ok." 2>&1
4335                 fi
4336                 ;;
4337         esac
4338         ;;
4339 esac
4340
4341 case "$mips_type" in
4342 *BSD*|'') inclwanted="$locincpth $usrinc";;
4343 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4344 esac
4345 for thisincl in $inclwanted; do
4346         if $test -d $thisincl; then
4347                 if $test x$thisincl != x$usrinc; then
4348                         case "$dflt" in
4349                         *" -I$thisincl "*);;
4350                         *) dflt="$dflt -I$thisincl ";;
4351                         esac
4352                 fi
4353         fi
4354 done
4355
4356 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4357         xxx=true;
4358 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4359         xxx=true;
4360 else
4361         xxx=false;
4362 fi;
4363 if $xxx; then
4364         case "$dflt" in
4365         *$2*);;
4366         *) dflt="$dflt -D$2";;
4367         esac;
4368 fi'
4369
4370 set signal.h LANGUAGE_C; eval $inctest
4371
4372 case "$usesocks" in
4373 $define)
4374         ccflags="$ccflags -DSOCKS"
4375         ;;
4376 esac
4377
4378 case "$hint" in
4379 default|recommended) dflt="$ccflags $dflt" ;;
4380 *) dflt="$ccflags";;
4381 esac
4382
4383 case "$dflt" in
4384 ''|' ') dflt=none;;
4385 esac
4386
4387 $cat <<EOH
4388
4389 Your C compiler may want other flags.  For this question you should include
4390 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4391 but you should NOT include libraries or ld flags like -lwhatever.  If you
4392 want $package to honor its debug switch, you should include -DDEBUGGING here.
4393 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4394
4395 To use no flags, specify the word "none".
4396
4397 EOH
4398 set X $dflt
4399 shift
4400 dflt=${1+"$@"}
4401 rp="Any additional cc flags?"
4402 . ./myread
4403 case "$ans" in
4404 none) ccflags='';;
4405 *) ccflags="$ans";;
4406 esac
4407
4408 : the following weeds options from ccflags that are of no interest to cpp
4409 case "$cppflags" in
4410 '') cppflags="$ccflags" ;;
4411 *)  cppflags="$cppflags $ccflags" ;;
4412 esac
4413 case "$gccversion" in
4414 1*) cppflags="$cppflags -D__GNUC__"
4415 esac
4416 case "$mips_type" in
4417 '');;
4418 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4419 esac
4420 case "$cppflags" in
4421 '');;
4422 *)
4423         echo " "
4424         echo "Let me guess what the preprocessor flags are..." >&4
4425         set X $cppflags
4426         shift
4427         cppflags=''
4428         $cat >cpp.c <<'EOM'
4429 #define BLURFL foo
4430
4431 BLURFL xx LFRULB
4432 EOM
4433         previous=''
4434         for flag in $*
4435         do
4436                 case "$flag" in
4437                 -*) ftry="$flag";;
4438                 *) ftry="$previous $flag";;
4439                 esac
4440                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4441                         >cpp1.out 2>/dev/null && \
4442                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4443                         >cpp2.out 2>/dev/null && \
4444                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4445                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4446                 then
4447                         cppflags="$cppflags $ftry"
4448                         previous=''
4449                 else
4450                         previous="$flag"
4451                 fi
4452         done
4453         set X $cppflags
4454         shift
4455         cppflags=${1+"$@"}
4456         case "$cppflags" in
4457         *-*)  echo "They appear to be: $cppflags";;
4458         esac
4459         $rm -f cpp.c cpp?.out
4460         ;;
4461 esac
4462
4463 : flags used in final linking phase
4464 case "$ldflags" in
4465 '') if ./venix; then
4466                 dflt='-i -z'
4467         else
4468                 dflt=''
4469         fi
4470         case "$ccflags" in
4471         *-posix*) dflt="$dflt -posix" ;;
4472         esac
4473         ;;
4474 *) dflt="$ldflags";;
4475 esac
4476
4477 : Try to guess additional flags to pick up local libraries.
4478 for thislibdir in $libpth; do
4479         case " $loclibpth " in
4480         *" $thislibdir "*)
4481                 case "$dflt " in 
4482                 *"-L$thislibdir "*) ;;
4483                 *)  dflt="$dflt -L$thislibdir" ;;
4484                 esac
4485                 ;;
4486         esac
4487 done
4488
4489 case "$dflt" in
4490 '') dflt='none' ;;
4491 esac
4492
4493 $cat <<EOH
4494
4495 Your C linker may need flags.  For this question you should
4496 include -L/whatever and any other flags used by the C linker, but you
4497 should NOT include libraries like -lwhatever.
4498
4499 Make sure you include the appropriate -L/path flags if your C linker
4500 does not normally search all of the directories you specified above,
4501 namely
4502         $libpth
4503 To use no flags, specify the word "none".
4504
4505 EOH
4506
4507 rp="Any additional ld flags (NOT including libraries)?"
4508 . ./myread
4509 case "$ans" in
4510 none) ldflags='';;
4511 *) ldflags="$ans";;
4512 esac
4513 rmlist="$rmlist pdp11"
4514
4515 : coherency check
4516 echo " "
4517 echo "Checking your choice of C compiler and flags for coherency..." >&4
4518 $cat > try.c <<'EOF'
4519 #include <stdio.h>
4520 int main() { printf("Ok\n"); exit(0); }
4521 EOF
4522 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4523 shift
4524 $cat >try.msg <<'EOM'
4525 I've tried to compile and run the following simple program:
4526
4527 EOM
4528 $cat try.c >> try.msg
4529
4530 $cat >> try.msg <<EOM
4531
4532 I used the command:
4533
4534         $*
4535         $run ./try
4536
4537 and I got the following output:
4538
4539 EOM
4540 dflt=y
4541 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4542         if $sh -c "$run ./try" >>try.msg 2>&1; then
4543                 xxx=`$run ./try`
4544                 case "$xxx" in
4545                 "Ok") dflt=n ;;
4546                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4547                         case " $libs " in
4548                         *" -lsfio "*)
4549                                 cat >> try.msg <<'EOQS'
4550 If $libs contains -lsfio, and sfio is mis-configured, then it
4551 sometimes (apparently) runs and exits with a 0 status, but with no
4552 output!  It may have to do with sfio's use of _exit vs. exit.
4553
4554 EOQS
4555                                 rp="You have a big problem.  Shall I abort Configure"
4556                                 dflt=y
4557                                 ;;
4558                         esac
4559                         ;;
4560                 esac
4561         else
4562                 echo "The program compiled OK, but exited with status $?." >>try.msg
4563                 rp="You have a problem.  Shall I abort Configure"
4564                 dflt=y
4565         fi
4566 else
4567         echo "I can't compile the test program." >>try.msg
4568         rp="You have a BIG problem.  Shall I abort Configure"
4569         dflt=y
4570 fi
4571 case "$dflt" in
4572 y)
4573         $cat try.msg >&4
4574         case "$knowitall" in
4575         '')
4576                 echo "(The supplied flags or libraries might be incorrect.)"
4577                 ;;
4578         *) dflt=n;;
4579         esac
4580         echo " "
4581         . ./myread
4582         case "$ans" in
4583         n*|N*) ;;
4584         *)      echo "Ok.  Stopping Configure." >&4
4585                 exit 1
4586                 ;;
4587         esac
4588         ;;
4589 n) echo "OK, that should do.";;
4590 esac
4591 $rm -f try try.* core
4592
4593 : define a shorthand compile call
4594 compile='
4595 mc_file=$1;
4596 shift;
4597 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4598 : define a shorthand compile call for compilations that should be ok.
4599 compile_ok='
4600 mc_file=$1;
4601 shift;
4602 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4603
4604 : check for lengths of integral types
4605 echo " "
4606 case "$intsize" in
4607 '')
4608         echo "Checking to see how big your integers are..." >&4
4609         $cat >try.c <<'EOCP'
4610 #include <stdio.h>
4611 int main()
4612 {
4613         printf("intsize=%d;\n", (int)sizeof(int));
4614         printf("longsize=%d;\n", (int)sizeof(long));
4615         printf("shortsize=%d;\n", (int)sizeof(short));
4616         exit(0);
4617 }
4618 EOCP
4619         set try
4620         if eval $compile_ok && $run ./try > /dev/null; then
4621                 eval `$run ./try`
4622                 echo "Your integers are $intsize bytes long."
4623                 echo "Your long integers are $longsize bytes long."
4624                 echo "Your short integers are $shortsize bytes long."
4625         else
4626                 $cat >&4 <<EOM
4627 !
4628 Help! I can't compile and run the intsize test program: please enlighten me!
4629 (This is probably a misconfiguration in your system or libraries, and
4630 you really ought to fix it.  Still, I'll try anyway.)
4631 !
4632 EOM
4633                 dflt=4
4634                 rp="What is the size of an integer (in bytes)?"
4635                 . ./myread
4636                 intsize="$ans"
4637                 dflt=$intsize
4638                 rp="What is the size of a long integer (in bytes)?"
4639                 . ./myread
4640                 longsize="$ans"
4641                 dflt=2
4642                 rp="What is the size of a short integer (in bytes)?"
4643                 . ./myread
4644                 shortsize="$ans"
4645         fi
4646         ;;
4647 esac
4648 $rm -f try try.*
4649
4650 : check for void type
4651 echo " "
4652 echo "Checking to see how well your C compiler groks the void type..." >&4
4653 case "$voidflags" in
4654 '')
4655         $cat >try.c <<'EOCP'
4656 #if TRY & 1
4657 void sub() {
4658 #else
4659 sub() {
4660 #endif
4661         extern void moo();      /* function returning void */
4662         void (*goo)();          /* ptr to func returning void */
4663 #if TRY & 8
4664         void *hue;              /* generic ptr */
4665 #endif
4666 #if TRY & 2
4667         void (*foo[10])();
4668 #endif
4669
4670 #if TRY & 4
4671         if(goo == moo) {
4672                 exit(0);
4673         }
4674 #endif
4675         exit(0);
4676 }
4677 int main() { sub(); }
4678 EOCP
4679         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4680                 voidflags=$defvoidused
4681         echo "Good.  It appears to support void to the level $package wants.">&4
4682                 if $contains warning .out >/dev/null 2>&1; then
4683                         echo "However, you might get some warnings that look like this:"
4684                         $cat .out
4685                 fi
4686         else
4687 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4688                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4689                         echo "It supports 1..."
4690                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4691                                 echo "It also supports 2..."
4692                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4693                                         voidflags=7
4694                                         echo "And it supports 4 but not 8 definitely."
4695                                 else
4696                                         echo "It doesn't support 4..."
4697                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4698                                                 voidflags=11
4699                                                 echo "But it supports 8."
4700                                         else
4701                                                 voidflags=3
4702                                                 echo "Neither does it support 8."
4703                                         fi
4704                                 fi
4705                         else
4706                                 echo "It does not support 2..."
4707                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4708                                         voidflags=13
4709                                         echo "But it supports 4 and 8."
4710                                 else
4711                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4712                                                 voidflags=5
4713                                                 echo "And it supports 4 but has not heard about 8."
4714                                         else
4715                                                 echo "However it supports 8 but not 4."
4716                                         fi
4717                                 fi
4718                         fi
4719                 else
4720                         echo "There is no support at all for void."
4721                         voidflags=0
4722                 fi
4723         fi
4724 esac
4725 case "$voidflags" in
4726 "$defvoidused") ;;
4727 *)      $cat >&4 <<'EOM'
4728   Support flag bits are:
4729     1: basic void declarations.
4730     2: arrays of pointers to functions returning void.
4731     4: operations between pointers to and addresses of void functions.
4732     8: generic void pointers.
4733 EOM
4734         dflt="$voidflags";
4735         rp="Your void support flags add up to what?"
4736         . ./myread
4737         voidflags="$ans"
4738         ;;
4739 esac
4740 $rm -f try.* .out
4741
4742 : check for length of pointer
4743 echo " "
4744 case "$ptrsize" in
4745 '')
4746         echo "Checking to see how big your pointers are..." >&4
4747         if test "$voidflags" -gt 7; then
4748                 echo '#define VOID_PTR char *' > try.c
4749         else
4750                 echo '#define VOID_PTR void *' > try.c
4751         fi
4752         $cat >>try.c <<'EOCP'
4753 #include <stdio.h>
4754 int main()
4755 {
4756     printf("%d\n", (int)sizeof(VOID_PTR));
4757     exit(0);
4758 }
4759 EOCP
4760         set try
4761         if eval $compile_ok; then
4762                 ptrsize=`$run ./try`
4763                 echo "Your pointers are $ptrsize bytes long."
4764         else
4765                 dflt='4'
4766                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4767                 rp="What is the size of a pointer (in bytes)?"
4768                 . ./myread
4769                 ptrsize="$ans"
4770         fi
4771         ;;
4772 esac
4773 $rm -f try.c try
4774
4775 : check for long long
4776 echo " "
4777 echo "Checking to see if you have long long..." >&4
4778 echo 'int main() { long long x = 7; return 0; }' > try.c
4779 set try
4780 if eval $compile; then
4781         val="$define"
4782         echo "You have long long."
4783 else
4784         val="$undef"
4785         echo "You do not have long long."
4786 fi
4787 $rm try.*
4788 set d_longlong
4789 eval $setvar
4790
4791 : check for length of long long
4792 case "${d_longlong}${longlongsize}" in
4793 $define)
4794         echo " "
4795         echo "Checking to see how big your long longs are..." >&4
4796         $cat >try.c <<'EOCP'
4797 #include <stdio.h>
4798 int main()
4799 {
4800     printf("%d\n", (int)sizeof(long long));
4801     return(0);
4802 }
4803 EOCP
4804         set try
4805         if eval $compile_ok; then
4806                 longlongsize=`$run ./try`
4807                 echo "Your long longs are $longlongsize bytes long."
4808         else
4809                 dflt='8'
4810                 echo " "
4811                 echo "(I can't seem to compile the test program.  Guessing...)"
4812                 rp="What is the size of a long long (in bytes)?"
4813                 . ./myread
4814                 longlongsize="$ans"
4815         fi
4816         if $test "X$longsize" = "X$longlongsize"; then
4817                 echo "(That isn't any different from an ordinary long.)"
4818         fi      
4819         ;;
4820 esac
4821 $rm -f try.* try
4822
4823 : determine filename position in cpp output
4824 echo " "
4825 echo "Computing filename position in cpp output for #include directives..." >&4
4826 echo '#include <stdio.h>' > foo.c
4827 $cat >fieldn <<EOF
4828 $startsh
4829 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4830 $grep '^[       ]*#.*stdio\.h' | \
4831 while read cline; do
4832         pos=1
4833         set \$cline
4834         while $test \$# -gt 0; do
4835                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4836                         echo "\$pos"
4837                         exit 0
4838                 fi
4839                 shift
4840                 pos=\`expr \$pos + 1\`
4841         done
4842 done
4843 EOF
4844 chmod +x fieldn
4845 fieldn=`./fieldn`
4846 $rm -f foo.c fieldn
4847 case $fieldn in
4848 '') pos='???';;
4849 1) pos=first;;
4850 2) pos=second;;
4851 3) pos=third;;
4852 *) pos="${fieldn}th";;
4853 esac
4854 echo "Your cpp writes the filename in the $pos field of the line."
4855
4856 : locate header file
4857 $cat >findhdr <<EOF
4858 $startsh
4859 wanted=\$1
4860 name=''
4861 for usrincdir in $usrinc
4862 do
4863         if test -f \$usrincdir/\$wanted; then
4864                 echo "\$usrincdir/\$wanted"
4865                 exit 0
4866         fi
4867 done
4868 awkprg='{ print \$$fieldn }'
4869 echo "#include <\$wanted>" > foo\$\$.c
4870 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4871 $grep "^[       ]*#.*\$wanted" | \
4872 while read cline; do
4873         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4874         case "\$name" in
4875         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4876         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4877         *) exit 2;;
4878         esac;
4879 done;
4880 #
4881 # status = 0: grep returned 0 lines, case statement not executed
4882 # status = 1: headerfile found
4883 # status = 2: while loop executed, no headerfile found
4884 #
4885 status=\$?
4886 $rm -f foo\$\$.c;
4887 if test \$status -eq 1; then
4888         exit 0;
4889 fi
4890 exit 1
4891 EOF
4892 chmod +x findhdr
4893
4894 : define an alternate in-header-list? function
4895 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4896 cont=true; xxf="echo \"<\$1> found.\" >&4";
4897 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4898 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4899 esac;
4900 case $# in 4) instead=instead;; *) instead="at last";; esac;
4901 while $test "$cont"; do
4902         xxx=`./findhdr $1`
4903         var=$2; eval "was=\$$2";
4904         if $test "$xxx" && $test -r "$xxx";
4905         then eval $xxf;
4906         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4907                 cont="";
4908         else eval $xxnf;
4909         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4910         set $yyy; shift; shift; yyy=$@;
4911         case $# in 0) cont="";;
4912         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4913                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4914         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4915                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4916         esac;
4917 done;
4918 while $test "$yyy";
4919 do set $yyy; var=$2; eval "was=\$$2";
4920         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4921         set $yyy; shift; shift; yyy=$@;
4922 done'
4923
4924 : see if inttypes.h is available
4925 : we want a real compile instead of Inhdr because some systems
4926 : have an inttypes.h which includes non-existent headers
4927 echo " "
4928 $cat >try.c <<EOCP
4929 #include <inttypes.h>
4930 int main() {
4931         static int32_t foo32 = 0x12345678;
4932 }
4933 EOCP
4934 set try
4935 if eval $compile; then
4936         echo "<inttypes.h> found." >&4
4937         val="$define"
4938 else
4939         echo "<inttypes.h> NOT found." >&4
4940         val="$undef"
4941 fi
4942 $rm -f try.c try
4943 set i_inttypes
4944 eval $setvar
4945
4946 : check for int64_t
4947 echo " "
4948 echo "Checking to see if you have int64_t..." >&4
4949 $cat >try.c <<EOCP
4950 #include <sys/types.h>
4951 #$i_inttypes I_INTTYPES
4952 #ifdef I_INTTYPES
4953 #include <inttypes.h>
4954 #endif
4955 int main() { int64_t x = 7; }
4956 EOCP
4957 set try
4958 if eval $compile; then
4959         val="$define"
4960         echo "You have int64_t."
4961 else
4962         val="$undef"
4963         echo "You do not have int64_t."
4964 fi
4965 $rm -f try try.*
4966 set d_int64_t
4967 eval $setvar
4968
4969
4970 echo " "
4971 echo "Checking which 64-bit integer type we could use..." >&4
4972
4973 case "$intsize" in
4974 8) val=int
4975    set quadtype
4976    eval $setvar
4977    val='"unsigned int"'
4978    set uquadtype
4979    eval $setvar
4980    quadkind=1
4981    ;;
4982 *) case "$longsize" in
4983    8) val=long
4984       set quadtype
4985       eval $setvar
4986       val='"unsigned long"'
4987       set uquadtype
4988       eval $setvar
4989       quadkind=2
4990       ;;
4991    *) case "$d_longlong:$longlongsize" in
4992       define:8)
4993         val='"long long"'
4994         set quadtype
4995         eval $setvar
4996         val='"unsigned long long"'
4997         set uquadtype
4998         eval $setvar
4999         quadkind=3
5000         ;;
5001       *) case "$d_int64_t" in
5002          define)
5003            val=int64_t
5004            set quadtype
5005            eval $setvar
5006            val=uint64_t
5007            set uquadtype
5008            eval $setvar
5009            quadkind=4
5010            ;;
5011          esac
5012          ;;
5013       esac
5014       ;;
5015    esac
5016    ;;
5017 esac
5018
5019 case "$quadtype" in
5020 '')     echo "Alas, no 64-bit integer types in sight." >&4
5021         d_quad="$undef"
5022         ;;
5023 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5024         d_quad="$define"
5025         ;;
5026 esac
5027
5028
5029 case "$uselonglong" in
5030 "$define"|true|[yY]*)
5031         cat <<EOM >&4
5032
5033 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5034 EOM
5035         use64bitint="$define"
5036         ;;
5037 esac                          
5038 case "$use64bits" in
5039 "$define"|true|[yY]*)
5040         cat <<EOM >&4
5041
5042 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5043 EOM
5044         use64bitint="$define"
5045         ;;
5046 esac                          
5047 case "$use64bitints" in
5048 "$define"|true|[yY]*)
5049         cat <<EOM >&4
5050
5051 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5052 EOM
5053         use64bitint="$define"
5054         ;;
5055 esac                          
5056 case "$use64bitsint" in
5057 "$define"|true|[yY]*)
5058         cat <<EOM >&4
5059
5060 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5061 EOM
5062         use64bitint="$define"
5063         ;;
5064 esac                          
5065 case "$uselonglongs" in
5066 "$define"|true|[yY]*)
5067         cat <<EOM >&4
5068
5069 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5070 EOM
5071         use64bitint="$define"
5072         ;;
5073 esac                          
5074 case "$use64bitsall" in
5075 "$define"|true|[yY]*)
5076         cat <<EOM >&4
5077
5078 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5079 EOM
5080         use64bitall="$define"
5081         ;;
5082 esac                          
5083
5084 case "$ccflags" in
5085 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5086 esac
5087 case "$use64bitall" in
5088 "$define"|true|[yY]*) use64bitint="$define" ;;
5089 esac
5090
5091 case "$longsize" in
5092 8) cat <<EOM
5093
5094 You have natively 64-bit long integers.
5095 EOM
5096    val="$define"
5097    ;;
5098 *) case "$use64bitint" in
5099    "$define"|true|[yY]*) dflt='y';;
5100    *) dflt='n';;
5101    esac
5102    case "$d_quad" in
5103    "$define") ;;
5104    *) dflt='n' ;;
5105    esac
5106    cat <<EOM
5107
5108 Perl can be built to take advantage of 64-bit integer types
5109 on some systems.  To do so, Configure can be run with -Duse64bitint.
5110 Choosing this option will most probably introduce binary incompatibilities.
5111
5112 If this doesn't make any sense to you, just accept the default '$dflt'.
5113 (The default has been chosen based on your configuration.)
5114 EOM
5115    rp='Try to use 64-bit integers, if available?'
5116    . ./myread
5117    case "$ans" in
5118    [yY]*) val="$define" ;;
5119    *)     val="$undef"  ;;
5120    esac
5121    ;;
5122 esac
5123 set use64bitint
5124 eval $setvar
5125
5126 case "$use64bitall" in
5127 "$define"|true|[yY]*) dflt='y' ;;
5128 *) case "$longsize" in
5129    8) dflt='y' ;;
5130    *) dflt='n' ;;
5131    esac
5132    ;;
5133 esac    
5134 cat <<EOM
5135
5136 You may also choose to try maximal 64-bitness.  It means using as much
5137 64-bitness as possible on the platform.  This in turn means even more
5138 binary incompatibilities.  On the other hand, your platform may not
5139 have any more 64-bitness available than what you already have chosen.
5140
5141 If this doesn't make any sense to you, just accept the default '$dflt'.
5142 (The default has been chosen based on your configuration.)
5143 EOM
5144 rp='Try to use maximal 64-bit support, if available?'
5145 . ./myread
5146 case "$ans" in
5147 [yY]*) val="$define" ;;
5148 *)     val="$undef"  ;;
5149 esac
5150 set use64bitall
5151 eval $setvar
5152 case "$use64bitall" in
5153 "$define")
5154         case "$use64bitint" in
5155         "$undef")
5156                 cat <<EOM
5157
5158 Since you have chosen a maximally 64-bit build, I'm also turning on
5159 the use of 64-bit integers.
5160 EOM
5161                 use64bitint="$define" ;;
5162         esac
5163         ;;
5164 esac
5165
5166 case "$use64bitall" in
5167 "$define"|true|[yY]*)
5168         case "$ptrsize" in
5169         4)      cat <<EOM >&4
5170
5171 *** You have chosen a maximally 64-bit build, but your pointers
5172 *** are only 4 bytes wide, disabling maximal 64-bitness.
5173
5174 EOM
5175                 use64bitall="$undef"
5176                 case "$use64bitint" in
5177                 "$define"|true|[yY]*) ;;
5178                 *)      cat <<EOM >&4
5179
5180 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5181
5182 EOM
5183                         use64bitint="$define"
5184                         ;;
5185                 esac
5186                 ;;
5187         esac
5188         ;;
5189 esac
5190
5191 case "$use64bitint" in
5192 "$define"|true|[yY]*)
5193 : Look for a hint-file generated 'call-back-unit'.  If the
5194 : user has specified that a 64-bit perl is to be built,
5195 : we may need to set or change some other defaults.
5196         if $test -f use64bitint.cbu; then
5197                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5198                 . ./use64bitint.cbu
5199         fi
5200         case "$longsize" in
5201         4) case "$archname64" in
5202            '') archname64=64int ;;
5203            esac
5204            ;;
5205         esac
5206         ;;
5207 esac
5208
5209 case "$use64bitall" in
5210 "$define"|true|[yY]*)
5211 : Look for a hint-file generated 'call-back-unit'.  If the
5212 : user has specified that a maximally 64-bit perl is to be built,
5213 : we may need to set or change some other defaults.
5214         if $test -f use64bitall.cbu; then
5215                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5216                 . ./use64bitall.cbu
5217         fi
5218         case "$longsize" in
5219         4) case "$archname64" in
5220            ''|64int) archname64=64all ;;
5221            esac
5222            ;;
5223         esac
5224         ;;
5225 esac
5226
5227 echo " "
5228 echo "Checking for GNU C Library..." >&4
5229 cat >try.c <<EOM
5230 #include <stdio.h>
5231 int main()
5232 {
5233 #ifdef __GLIBC__
5234     exit(0);
5235 #else
5236     exit(1);
5237 #endif
5238 }
5239 EOM
5240 set try
5241 if eval $compile_ok && $run ./try; then
5242         val="$define"
5243         echo "You are using the GNU C Library"
5244 else
5245         val="$undef"
5246         echo "You are not using the GNU C Library"
5247 fi
5248 $rm -f try try.*
5249 set d_gnulibc
5250 eval $setvar
5251
5252 : see if nm is to be used to determine whether a symbol is defined or not
5253 case "$usenm" in
5254 '')
5255         dflt=''
5256         case "$d_gnulibc" in
5257         "$define")
5258                 echo " "
5259                 echo "nm probably won't work on the GNU C Library." >&4
5260                 dflt=n
5261                 ;;
5262         esac
5263         case "$dflt" in
5264         '') 
5265                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5266                         echo " "
5267                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5268                         echo "'nm' won't be sufficient on this sytem." >&4
5269                         dflt=n
5270                 fi
5271                 ;;
5272         esac
5273         case "$dflt" in
5274         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5275                 if $test $dflt -gt 20; then
5276                         dflt=y
5277                 else
5278                         dflt=n
5279                 fi
5280                 ;;
5281         esac
5282         ;;
5283 *)
5284         case "$usenm" in
5285         true|$define) dflt=y;;
5286         *) dflt=n;;
5287         esac
5288         ;;
5289 esac
5290 $cat <<EOM
5291
5292 I can use $nm to extract the symbols from your C libraries. This
5293 is a time consuming task which may generate huge output on the disk (up
5294 to 3 megabytes) but that should make the symbols extraction faster. The
5295 alternative is to skip the 'nm' extraction part and to compile a small
5296 test program instead to determine whether each symbol is present. If
5297 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5298 this may be the best solution.
5299
5300 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5301
5302 EOM
5303 rp="Shall I use $nm to extract C symbols from the libraries?"
5304 . ./myread
5305 case "$ans" in
5306 [Nn]*) usenm=false;;
5307 *) usenm=true;;
5308 esac
5309
5310 runnm=$usenm
5311 case "$reuseval" in
5312 true) runnm=false;;
5313 esac
5314
5315 : nm options which may be necessary
5316 case "$nm_opt" in
5317 '') if $test -f /mach_boot; then
5318                 nm_opt=''       # Mach
5319         elif $test -d /usr/ccs/lib; then
5320                 nm_opt='-p'     # Solaris (and SunOS?)
5321         elif $test -f /dgux; then
5322                 nm_opt='-p'     # DG-UX
5323         elif $test -f /lib64/rld; then
5324                 nm_opt='-p'     # 64-bit Irix
5325         else
5326                 nm_opt=''
5327         fi;;
5328 esac
5329
5330 : nm options which may be necessary for shared libraries but illegal
5331 : for archive libraries.  Thank you, Linux.
5332 case "$nm_so_opt" in
5333 '')     case "$myuname" in
5334         *linux*)
5335                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5336                         nm_so_opt='--dynamic'
5337                 fi
5338                 ;;
5339         esac
5340         ;;
5341 esac
5342
5343 case "$runnm" in
5344 true)
5345 : get list of predefined functions in a handy place
5346 echo " "
5347 case "$libc" in
5348 '') libc=unknown
5349         case "$libs" in
5350         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5351         esac
5352         ;;
5353 esac
5354 case "$libs" in
5355 '') ;;
5356 *)  for thislib in $libs; do
5357         case "$thislib" in
5358         -lc|-lc_s)
5359                 : Handle C library specially below.
5360                 ;;
5361         -l*)
5362                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5363                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5364                         :
5365                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5366                         :
5367                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5368                         :
5369                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5370                         :
5371                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5372                         :
5373                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5374                         :
5375                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5376                         :
5377                 else
5378                         try=''
5379                 fi
5380                 libnames="$libnames $try"
5381                 ;;
5382         *) libnames="$libnames $thislib" ;;
5383         esac
5384         done
5385         ;;
5386 esac
5387 xxx=normal
5388 case "$libc" in
5389 unknown)
5390         set /lib/libc.$so
5391         for xxx in $libpth; do
5392                 $test -r $1 || set $xxx/libc.$so
5393                 : The messy sed command sorts on library version numbers.
5394                 $test -r $1 || \
5395                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5396                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5397                                 h
5398                                 s/[0-9][0-9]*/0000&/g
5399                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5400                                 G
5401                                 s/\n/ /' | \
5402                          $sort | $sed -e 's/^.* //'`
5403                 eval set \$$#
5404         done
5405         $test -r $1 || set /usr/ccs/lib/libc.$so
5406         $test -r $1 || set /lib/libsys_s$_a
5407         ;;
5408 *)
5409         set blurfl
5410         ;;
5411 esac
5412 if $test -r "$1"; then
5413         echo "Your (shared) C library seems to be in $1."
5414         libc="$1"
5415 elif $test -r /lib/libc && $test -r /lib/clib; then
5416         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5417         xxx=apollo
5418         libc='/lib/clib /lib/libc'
5419         if $test -r /lib/syslib; then
5420                 echo "(Your math library is in /lib/syslib.)"
5421                 libc="$libc /lib/syslib"
5422         fi
5423 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5424         echo "Your C library seems to be in $libc, as you said before."
5425 elif $test -r $incpath/usr/lib/libc$_a; then
5426         libc=$incpath/usr/lib/libc$_a;
5427         echo "Your C library seems to be in $libc.  That's fine."
5428 elif $test -r /lib/libc$_a; then
5429         libc=/lib/libc$_a;
5430         echo "Your C library seems to be in $libc.  You're normal."
5431 else
5432         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5433                 :
5434         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5435                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5436         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5437                 :
5438         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5439                 :
5440         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5441                 :
5442         else
5443                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5444         fi
5445         if $test -r "$tans"; then
5446                 echo "Your C library seems to be in $tans, of all places."
5447                 libc=$tans
5448         else
5449                 libc='blurfl'
5450         fi
5451 fi
5452 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5453         dflt="$libc"
5454         cat <<EOM
5455
5456 If the guess above is wrong (which it might be if you're using a strange
5457 compiler, or your machine supports multiple models), you can override it here.
5458
5459 EOM
5460 else
5461         dflt=''
5462         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5463         cat >&4 <<EOM
5464 I can't seem to find your C library.  I've looked in the following places:
5465
5466 EOM
5467         $sed 's/^/      /' libpath
5468         cat <<EOM
5469
5470 None of these seems to contain your C library. I need to get its name...
5471
5472 EOM
5473 fi
5474 fn=f
5475 rp='Where is your C library?'
5476 . ./getfile
5477 libc="$ans"
5478
5479 echo " "
5480 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5481 set X `cat libnames`
5482 shift
5483 xxx=files
5484 case $# in 1) xxx=file; esac
5485 echo "Extracting names from the following $xxx for later perusal:" >&4
5486 echo " "
5487 $sed 's/^/      /' libnames >&4
5488 echo " "
5489 $echo $n "This may take a while...$c" >&4
5490
5491 for file in $*; do
5492         case $file in
5493         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5494         *) $nm $nm_opt $file 2>/dev/null;;
5495         esac
5496 done >libc.tmp
5497
5498 $echo $n ".$c"
5499 $grep fprintf libc.tmp > libc.ptf
5500 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5501 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5502 xxx='[ADTSIW]'
5503 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5504         eval $xscan;\
5505         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5506                 eval $xrun
5507 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5508         eval $xscan;\
5509         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5510                 eval $xrun
5511 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5512         eval $xscan;\
5513         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5514                 eval $xrun
5515 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5516         eval $xscan;\
5517         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5518                 eval $xrun
5519 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5520         eval $xscan;\
5521         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5522                 eval $xrun
5523 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5524         eval $xscan;\
5525         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5526                 eval $xrun
5527 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5528                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5529         eval $xscan;\
5530         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5531                 eval $xrun
5532 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5533         eval $xscan;\
5534         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5535                 eval $xrun
5536 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5537         eval $xscan;\
5538         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5539                 eval $xrun
5540 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5541         eval $xscan;\
5542         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5543                 eval $xrun
5544 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5545         eval $xscan;\
5546         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5547                 eval $xrun
5548 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5549         eval $xscan;\
5550         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5551                 eval $xrun
5552 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5553         eval $xscan;\
5554         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5555                 eval $xrun
5556 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5557         eval $xscan;\
5558         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5559                 eval $xrun
5560 else
5561         $nm -p $* 2>/dev/null >libc.tmp
5562         $grep fprintf libc.tmp > libc.ptf
5563         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5564                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5565         then
5566                 nm_opt='-p'
5567                 eval $xrun
5568         else
5569                 echo " "
5570                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5571                 com=''
5572                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5573                         for thisname in $libnames $libc; do
5574                                 $ar t $thisname >>libc.tmp
5575                         done
5576                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5577                         echo "Ok." >&4
5578                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5579                         # Repeat libc to extract forwarders to DLL entries too
5580                         for thisname in $libnames $libc; do
5581                                 $ar tv $thisname >>libc.tmp
5582                                 # Revision 50 of EMX has bug in $ar.
5583                                 # it will not extract forwarders to DLL entries
5584                                 # Use emximp which will extract exactly them.
5585                                 emximp -o tmp.imp $thisname \
5586                                     2>/dev/null && \
5587                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5588                                     < tmp.imp >>libc.tmp
5589                                 $rm tmp.imp
5590                         done
5591                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5592                         echo "Ok." >&4
5593                 else
5594                         echo "$ar didn't seem to work right." >&4
5595                         echo "Maybe this is a Cray...trying bld instead..." >&4
5596                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5597                         then
5598                                 for thisname in $libnames; do
5599                                         bld t $libnames | \
5600                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5601                                         $ar t $thisname >>libc.tmp
5602                                 done
5603                                 echo "Ok." >&4
5604                         else
5605                                 echo "That didn't work either.  Giving up." >&4
5606                                 exit 1
5607                         fi
5608                 fi
5609         fi
5610 fi
5611 nm_extract="$com"
5612 if $test -f /lib/syscalls.exp; then
5613         echo " "
5614         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5615         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5616 fi
5617 ;;
5618 esac
5619 $rm -f libnames libpath
5620
5621 : is a C symbol defined?
5622 csym='tlook=$1;
5623 case "$3" in
5624 -v) tf=libc.tmp; tc=""; tdc="";;
5625 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5626 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5627 esac;
5628 tx=yes;
5629 case "$reuseval-$4" in
5630 true-) ;;
5631 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5632 esac;
5633 case "$tx" in
5634 yes)
5635         case "$runnm" in
5636         true)
5637                 if $contains $tlook $tf >/dev/null 2>&1;
5638                 then tval=true;
5639                 else tval=false;
5640                 fi;;
5641         *)
5642                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5643                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5644                 then tval=true;
5645                 else tval=false;
5646                 fi;
5647                 $rm -f t t.c;;
5648         esac;;
5649 *)
5650         case "$tval" in
5651         $define) tval=true;;
5652         *) tval=false;;
5653         esac;;
5654 esac;
5655 eval "$2=$tval"'
5656
5657 : define an is-in-libc? function
5658 inlibc='echo " "; td=$define; tu=$undef;
5659 sym=$1; var=$2; eval "was=\$$2";
5660 tx=yes;
5661 case "$reuseval$was" in
5662 true) ;;
5663 true*) tx=no;;
5664 esac;
5665 case "$tx" in
5666 yes)
5667         set $sym tres -f;
5668         eval $csym;
5669         case "$tres" in
5670         true)
5671                 echo "$sym() found." >&4;
5672                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5673         *)
5674                 echo "$sym() NOT found." >&4;
5675                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5676         esac;;
5677 *)
5678         case "$was" in
5679         $define) echo "$sym() found." >&4;;
5680         *) echo "$sym() NOT found." >&4;;
5681         esac;;
5682 esac'
5683
5684 : see if sqrtl exists
5685 set sqrtl d_sqrtl
5686 eval $inlibc
5687
5688 case "$ccflags" in
5689 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5690 esac
5691
5692 case "$uselongdouble" in
5693 $define|true|[yY]*)     dflt='y';;
5694 *) dflt='n';;
5695 esac
5696 cat <<EOM
5697
5698 Perl can be built to take advantage of long doubles which
5699 (if available) may give more accuracy and range for floating point numbers.
5700
5701 If this doesn't make any sense to you, just accept the default '$dflt'.
5702 EOM
5703 rp='Try to use long doubles if available?'
5704 . ./myread
5705 case "$ans" in
5706 y|Y)    val="$define"   ;;
5707 *)      val="$undef"    ;;
5708 esac
5709 set uselongdouble
5710 eval $setvar
5711
5712 case "$uselongdouble" in
5713 true|[yY]*) uselongdouble="$define" ;;
5714 esac
5715
5716 case "$uselongdouble" in
5717 $define)
5718 : Look for a hint-file generated 'call-back-unit'.  If the
5719 : user has specified that long doubles should be used,
5720 : we may need to set or change some other defaults.
5721         if $test -f uselongdouble.cbu; then
5722                 echo "Your platform has some specific hints for long doubles, using them..."
5723                 . ./uselongdouble.cbu
5724         else
5725                 $cat <<EOM
5726 (Your platform doesn't have any specific hints for long doubles.)
5727 EOM
5728         fi
5729         ;;
5730 esac
5731
5732 case "$uselongdouble:$d_sqrtl" in
5733 $define:$undef)
5734                 $cat <<EOM >&4
5735
5736 *** You requested the use of long doubles but you do not seem to have
5737 *** the mathematic functions for long doubles.  I'm disabling the use
5738 *** of long doubles.
5739
5740 EOM
5741         uselongdouble=$undef
5742         ;;
5743 esac
5744
5745 : check for length of double
5746 echo " "
5747 case "$doublesize" in
5748 '')
5749         echo "Checking to see how big your double precision numbers are..." >&4
5750         $cat >try.c <<'EOCP'
5751 #include <stdio.h>
5752 int main()
5753 {
5754     printf("%d\n", (int)sizeof(double));
5755     exit(0);
5756 }
5757 EOCP
5758         set try
5759         if eval $compile_ok; then
5760                 doublesize=`$run ./try`
5761                 echo "Your double is $doublesize bytes long."
5762         else
5763                 dflt='8'
5764                 echo "(I can't seem to compile the test program.  Guessing...)"
5765                 rp="What is the size of a double precision number (in bytes)?"
5766                 . ./myread
5767                 doublesize="$ans"
5768         fi
5769         ;;
5770 esac
5771 $rm -f try.c try
5772
5773 : check for long doubles
5774 echo " "
5775 echo "Checking to see if you have long double..." >&4
5776 echo 'int main() { long double x = 7.0; }' > try.c
5777 set try
5778 if eval $compile; then
5779         val="$define"
5780         echo "You have long double."
5781 else
5782         val="$undef"
5783         echo "You do not have long double."
5784 fi
5785 $rm try.*
5786 set d_longdbl
5787 eval $setvar
5788
5789 : check for length of long double
5790 case "${d_longdbl}${longdblsize}" in
5791 $define)
5792         echo " "
5793         echo "Checking to see how big your long doubles are..." >&4
5794         $cat >try.c <<'EOCP'
5795 #include <stdio.h>
5796 int main()
5797 {
5798         printf("%d\n", sizeof(long double));
5799 }
5800 EOCP
5801         set try
5802         set try
5803         if eval $compile; then
5804                 longdblsize=`$run ./try`
5805                 echo "Your long doubles are $longdblsize bytes long."
5806         else
5807                 dflt='8'
5808                 echo " "
5809                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5810                 rp="What is the size of a long double (in bytes)?"
5811                 . ./myread
5812                 longdblsize="$ans"
5813         fi
5814         if $test "X$doublesize" = "X$longdblsize"; then
5815                 echo "(That isn't any different from an ordinary double.)"
5816         fi      
5817         ;;
5818 esac
5819 $rm -f try.* try
5820
5821 case "$useperlio" in
5822 $define|true|[yY]*|'')  dflt='y';;
5823 *) dflt='n';;
5824 esac
5825 cat <<EOM
5826
5827 Previous version of $package used the standard IO mechanisms as
5828 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5829 alternate IO mechanisms via the PerlIO abstraction layer, but the
5830 stdio mechanism is still available if needed.  The abstraction layer
5831 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5832 Using PerlIO with sfio may cause problems with some extension modules.
5833
5834 If this doesn't make any sense to you, just accept the default '$dflt'.
5835 EOM
5836 rp='Use the PerlIO abstraction layer?'
5837 . ./myread
5838 case "$ans" in
5839 y|Y) 
5840         val="$define"
5841         ;;
5842 *)      
5843         echo "Ok, doing things the stdio way."
5844         val="$undef"
5845         ;;
5846 esac
5847 set useperlio
5848 eval $setvar 
5849
5850 case "$usesocks" in
5851 $define|true|[yY]*)
5852         case "$useperlio" in
5853         $define|true|[yY]*) ;;
5854         *)      cat >&4 <<EOM
5855
5856 You are using the SOCKS proxy protocol library which means that you
5857 should also use the PerlIO layer.  You may be headed for trouble.
5858
5859 EOM
5860                 ;;
5861         esac
5862         ;;
5863 esac
5864
5865         
5866 : determine the architecture name
5867 echo " "
5868 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5869         tarch=`arch`"-$osname"
5870 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5871         if uname -m > tmparch 2>&1 ; then
5872                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5873                         -e 's/$/'"-$osname/" tmparch`
5874         else
5875                 tarch="$osname"
5876         fi
5877         $rm -f tmparch
5878 else
5879         tarch="$osname"
5880 fi
5881 case "$myarchname" in
5882 ''|"$tarch") ;;
5883 *)
5884         echo "(Your architecture name used to be $myarchname.)"
5885         archname=''
5886         ;;
5887 esac
5888 case "$targetarch" in
5889 '') ;;
5890 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5891 esac
5892 myarchname="$tarch"
5893 case "$archname" in
5894 '') dflt="$tarch";;
5895 *) dflt="$archname";;
5896 esac
5897 rp='What is your architecture name'
5898 . ./myread
5899 archname="$ans"
5900 case "$usethreads" in
5901 $define)
5902         echo "Threads selected." >&4
5903         case "$archname" in
5904         *-thread*) echo "...and architecture name already has -thread." >&4
5905                 ;;
5906         *)      archname="$archname-thread"
5907                 echo "...setting architecture name to $archname." >&4
5908                 ;;
5909         esac
5910         ;;
5911 esac
5912 case "$usemultiplicity" in
5913 $define)
5914         echo "Multiplicity selected." >&4
5915         case "$archname" in
5916         *-multi*) echo "...and architecture name already has -multi." >&4
5917                 ;;
5918         *)      archname="$archname-multi"
5919                 echo "...setting architecture name to $archname." >&4
5920                 ;;
5921         esac
5922         ;;
5923 esac
5924 case "$use64bitint$use64bitall" in
5925 *"$define"*)
5926         case "$archname64" in
5927         '')
5928                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5929                 ;;
5930         *)
5931                 case "$use64bitint" in
5932                 "$define") echo "64 bit integers selected." >&4 ;;
5933                 esac
5934                 case "$use64bitall" in
5935                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5936                 esac
5937                 case "$archname" in
5938                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5939                         ;;
5940                 *)      archname="$archname-$archname64"
5941                         echo "...setting architecture name to $archname." >&4
5942                         ;;
5943                 esac
5944                 ;;
5945         esac
5946 esac
5947 case "$uselongdouble" in
5948 $define)
5949         echo "Long doubles selected." >&4
5950         case "$longdblsize" in
5951         $doublesize)
5952                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5953                 ;;
5954         *)
5955                 case "$archname" in
5956                 *-ld*) echo "...and architecture name already has -ld." >&4
5957                         ;;
5958                 *)      archname="$archname-ld"
5959                         echo "...setting architecture name to $archname." >&4
5960                         ;;
5961                 esac
5962                 ;;
5963         esac
5964         ;;
5965 esac
5966 case "$useperlio" in
5967 $define)
5968         echo "Perlio selected." >&4
5969         ;;
5970 *)
5971         echo "Perlio not selected, using stdio." >&4
5972         case "$archname" in
5973         *-stdio*) echo "...and architecture name already has -stdio." >&4
5974                 ;;
5975         *)      archname="$archname-stdio"
5976                 echo "...setting architecture name to $archname." >&4
5977                 ;;
5978         esac
5979         ;;
5980 esac
5981
5982 : determine root of directory hierarchy where package will be installed.
5983 case "$prefix" in
5984 '')
5985         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5986         ;;
5987 *)
5988         dflt="$prefix"
5989         ;;
5990 esac
5991 $cat <<EOM
5992
5993 By default, $package will be installed in $dflt/bin, manual pages
5994 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5995 installation directories. Typically this is something like /usr/local.
5996 If you wish to have binaries under /usr/bin but other parts of the
5997 installation under /usr/local, that's ok: you will be prompted
5998 separately for each of the installation directories, the prefix being
5999 only used to set the defaults.
6000
6001 EOM
6002 fn=d~
6003 rp='Installation prefix to use?'
6004 . ./getfile
6005 oldprefix=''
6006 case "$prefix" in
6007 '') ;;
6008 *)
6009         case "$ans" in
6010         "$prefix") ;;
6011         *) oldprefix="$prefix";;
6012         esac
6013         ;;
6014 esac
6015 prefix="$ans"
6016 prefixexp="$ansexp"
6017
6018 case "$afsroot" in
6019 '')     afsroot=/afs ;;
6020 *)      afsroot=$afsroot ;;
6021 esac
6022
6023 : is AFS running?
6024 echo " "
6025 case "$afs" in
6026 $define|true)   afs=true ;;
6027 $undef|false)   afs=false ;;
6028 *)      if test -d $afsroot; then
6029                 afs=true
6030         else
6031                 afs=false
6032         fi
6033         ;;
6034 esac
6035 if $afs; then
6036         echo "AFS may be running... I'll be extra cautious then..." >&4
6037 else
6038         echo "AFS does not seem to be running..." >&4
6039 fi
6040
6041 : determine installation prefix for where package is to be installed.
6042 if $afs; then 
6043 $cat <<EOM
6044
6045 Since you are running AFS, I need to distinguish the directory in which
6046 files will reside from the directory in which they are installed (and from
6047 which they are presumably copied to the former directory by occult means).
6048
6049 EOM
6050         case "$installprefix" in
6051         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6052         *) dflt="$installprefix";;
6053         esac
6054 else
6055 $cat <<EOM
6056
6057 In some special cases, particularly when building $package for distribution,
6058 it is convenient to distinguish between the directory in which files should 
6059 be installed from the directory ($prefix) in which they 
6060 will eventually reside.  For most users, these two directories are the same.
6061
6062 EOM
6063         case "$installprefix" in
6064         '') dflt=$prefix ;;
6065         *) dflt=$installprefix;;
6066         esac
6067 fi
6068 fn=d~
6069 rp='What installation prefix should I use for installing files?'
6070 . ./getfile
6071 installprefix="$ans"
6072 installprefixexp="$ansexp"
6073
6074 : set the prefixit variable, to compute a suitable default value
6075 prefixit='case "$3" in
6076 ""|none)
6077         case "$oldprefix" in
6078         "") eval "$1=\"\$$2\"";;
6079         *)
6080                 case "$3" in
6081                 "") eval "$1=";;
6082                 none)
6083                         eval "tp=\"\$$2\"";
6084                         case "$tp" in
6085                         ""|" ") eval "$1=\"\$$2\"";;
6086                         *) eval "$1=";;
6087                         esac;;
6088                 esac;;
6089         esac;;
6090 *)
6091         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6092         case "$tp" in
6093         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6094         /*-$oldprefix/*|\~*-$oldprefix/*)
6095                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6096         *) eval "$1=\"\$$2\"";;
6097         esac;;
6098 esac'
6099
6100 : get the patchlevel
6101 echo " "
6102 echo "Getting the current patchlevel..." >&4
6103 if $test -r $rsrc/patchlevel.h;then
6104         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6105         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6106         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6107         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6108         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6109         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6110        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6111 else
6112         revision=0
6113         patchlevel=0
6114         subversion=0
6115         api_revision=0
6116         api_version=0
6117         api_subversion=0
6118         perl_patchlevel=0
6119         $echo "(You do not have patchlevel.h.  Eek.)"
6120 fi
6121 if $test -r $rsrc/.patch ; then  
6122         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6123                 perl_patchlevel=`cat $rsrc/.patch`
6124         fi
6125 fi
6126 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6127 version_patchlevel_string="version $patchlevel subversion $subversion"
6128 case "$perl_patchlevel" in
6129 0|'') ;;
6130 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6131 esac
6132
6133 $echo "(You have $package $version_patchlevel_string.)"
6134
6135 case "$osname" in
6136 dos|vms)
6137         : XXX Should be a Configure test for double-dots in filenames.
6138         version=`echo $revision $patchlevel $subversion | \
6139                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6140         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6141                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6142         ;;
6143 *)
6144         version=`echo $revision $patchlevel $subversion | \
6145                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6146         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6147                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6148         ;;
6149 esac
6150 : Special case the 5.005_xx maintenance series, which used 5.005
6151 : without any subversion label as a subdirectory in $sitelib
6152 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6153         api_versionstring='5.005'
6154 fi
6155
6156 : determine installation style
6157 : For now, try to deduce it from prefix unless it is already set.
6158 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6159 case "$installstyle" in
6160 '')     case "$prefix" in
6161                 *perl*) dflt='lib';;
6162                 *) dflt='lib/perl5' ;;
6163         esac
6164         ;;
6165 *)      dflt="$installstyle" ;;
6166 esac
6167 : Probably not worth prompting for this since we prompt for all
6168 : the directories individually, and the prompt would be too long and
6169 : confusing anyway.
6170 installstyle=$dflt
6171
6172 : determine where private library files go
6173 : Usual default is /usr/local/lib/perl5/$version.
6174 : Also allow things like /opt/perl/lib/$version, since 
6175 : /opt/perl/lib/perl5... would be redundant.
6176 : The default "style" setting is made in installstyle.U
6177 case "$installstyle" in
6178 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6179 *)       set dflt privlib lib/$version ;;
6180 esac
6181 eval $prefixit
6182 $cat <<EOM
6183
6184 There are some auxiliary files for $package that need to be put into a
6185 private library directory that is accessible by everyone.
6186
6187 EOM
6188 fn=d~+
6189 rp='Pathname where the private library files will reside?'
6190 . ./getfile
6191 privlib="$ans"
6192 privlibexp="$ansexp"
6193 : Change installation prefix, if necessary.
6194 if $test X"$prefix" != X"$installprefix"; then
6195         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6196 else
6197         installprivlib="$privlibexp"
6198 fi
6199
6200 : set the prefixup variable, to restore leading tilda escape
6201 prefixup='case "$prefixexp" in
6202 "$prefix") ;;
6203 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6204 esac'
6205
6206 : determine where public architecture dependent libraries go
6207 set archlib archlib
6208 eval $prefixit
6209 : privlib default is /usr/local/lib/$package/$version
6210 : archlib default is /usr/local/lib/$package/$version/$archname
6211 : privlib may have an optional trailing /share.
6212 tdflt=`echo $privlib | $sed 's,/share$,,'`
6213 tdflt=$tdflt/$archname
6214 case "$archlib" in
6215 '')     dflt=$tdflt
6216         ;;
6217 *)      dflt="$archlib"
6218     ;;
6219 esac
6220 $cat <<EOM
6221
6222 $spackage contains architecture-dependent library files.  If you are
6223 sharing libraries in a heterogeneous environment, you might store
6224 these files in a separate location.  Otherwise, you can just include
6225 them with the rest of the public library files.
6226
6227 EOM
6228 fn=d+~
6229 rp='Where do you want to put the public architecture-dependent libraries?'
6230 . ./getfile
6231 archlib="$ans"
6232 archlibexp="$ansexp"
6233 if $test X"$archlib" = X"$privlib"; then
6234         d_archlib="$undef"
6235 else
6236         d_archlib="$define"
6237 fi
6238 : Change installation prefix, if necessary.
6239 if $test X"$prefix" != X"$installprefix"; then
6240         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6241 else
6242         installarchlib="$archlibexp"
6243 fi
6244
6245
6246 : Binary compatibility with 5.005 is not possible for builds
6247 : with advanced features
6248 case "$usethreads$usemultiplicity" in
6249 *define*)
6250         bincompat5005="$undef"
6251         d_bincompat5005="$undef"
6252         ;;
6253 *)      $cat <<EOM
6254
6255 This version of Perl can be compiled for binary compatibility with 5.005.
6256 If you decide to do so, you will be able to continue using most of the
6257 extensions that were compiled for Perl 5.005.
6258
6259 EOM
6260         case "$bincompat5005$d_bincompat5005" in
6261         *"$undef"*) dflt=n ;;
6262         *) dflt=y ;;
6263         esac
6264         rp='Binary compatibility with Perl 5.005?'
6265         . ./myread
6266         case "$ans" in
6267         y*) val="$define" ;;
6268         *)  val="$undef" ;;
6269         esac
6270         set d_bincompat5005
6271         eval $setvar
6272         case "$d_bincompat5005" in
6273         "$define")
6274                 bincompat5005="$define"
6275                 ;;
6276         *)      bincompat5005="$undef"
6277                 d_bincompat5005="$undef"
6278                 ;;
6279         esac
6280         ;;
6281 esac
6282
6283
6284 : see if setuid scripts can be secure
6285 $cat <<EOM
6286
6287 Some kernels have a bug that prevents setuid #! scripts from being
6288 secure.  Some sites have disabled setuid #! scripts because of this.
6289
6290 First let's decide if your kernel supports secure setuid #! scripts.
6291 (If setuid #! scripts would be secure but have been disabled anyway,
6292 don't say that they are secure if asked.)
6293
6294 EOM
6295
6296 val="$undef"
6297 if $test -d /dev/fd; then
6298         echo "#!$ls" >reflect
6299         chmod +x,u+s reflect
6300         ./reflect >flect 2>&1
6301         if $contains "/dev/fd" flect >/dev/null; then
6302                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6303                 val="$define"
6304         else
6305                 $cat <<EOM
6306 If you are not sure if they are secure, I can check but I'll need a
6307 username and password different from the one you are using right now.
6308 If you don't have such a username or don't want me to test, simply
6309 enter 'none'.
6310
6311 EOM
6312                 rp='Other username to test security of setuid scripts with?'
6313                 dflt='none'
6314                 . ./myread
6315                 case "$ans" in
6316                 n|none)
6317                         case "$d_suidsafe" in
6318                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6319                                 dflt=n;;
6320                         "$undef")
6321                                 echo "Well, the $hint value is *not* secure." >&4
6322                                 dflt=n;;
6323                         *)      echo "Well, the $hint value *is* secure." >&4
6324                                 dflt=y;;
6325                         esac
6326                         ;;
6327                 *)
6328                         $rm -f reflect flect
6329                         echo "#!$ls" >reflect
6330                         chmod +x,u+s reflect
6331                         echo >flect
6332                         chmod a+w flect
6333                         echo '"su" will (probably) prompt you for '"$ans's password."
6334                         su $ans -c './reflect >flect'
6335                         if $contains "/dev/fd" flect >/dev/null; then
6336                                 echo "Okay, it looks like setuid scripts are secure." >&4
6337                                 dflt=y
6338                         else
6339                                 echo "I don't think setuid scripts are secure." >&4
6340                                 dflt=n
6341                         fi
6342                         ;;
6343                 esac
6344                 rp='Does your kernel have *secure* setuid scripts?'
6345                 . ./myread
6346                 case "$ans" in
6347                 [yY]*)  val="$define";;
6348                 *)      val="$undef";;
6349                 esac
6350         fi
6351 else
6352         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6353         echo "(That's for file descriptors, not floppy disks.)"
6354         val="$undef"
6355 fi
6356 set d_suidsafe
6357 eval $setvar
6358
6359 $rm -f reflect flect
6360
6361 : now see if they want to do setuid emulation
6362 echo " "
6363 val="$undef"
6364 case "$d_suidsafe" in
6365 "$define")
6366         val="$undef"
6367         echo "No need to emulate SUID scripts since they are secure here." >& 4
6368         ;;
6369 *)
6370         $cat <<EOM
6371 Some systems have disabled setuid scripts, especially systems where
6372 setuid scripts cannot be secure.  On systems where setuid scripts have
6373 been disabled, the setuid/setgid bits on scripts are currently
6374 useless.  It is possible for $package to detect those bits and emulate
6375 setuid/setgid in a secure fashion.  This emulation will only work if
6376 setuid scripts have been disabled in your kernel.
6377
6378 EOM
6379         case "$d_dosuid" in
6380         "$define") dflt=y ;;
6381         *) dflt=n ;;
6382         esac
6383         rp="Do you want to do setuid/setgid emulation?"
6384         . ./myread
6385         case "$ans" in
6386         [yY]*)  val="$define";;
6387         *)      val="$undef";;
6388         esac
6389         ;;
6390 esac
6391 set d_dosuid
6392 eval $setvar
6393
6394 : see if this is a malloc.h system
6395 set malloc.h i_malloc
6396 eval $inhdr
6397
6398 : see if stdlib is available
6399 set stdlib.h i_stdlib
6400 eval $inhdr
6401
6402 : determine which malloc to compile in
6403 echo " "
6404 case "$usemymalloc" in
6405 [yY]*|true|$define)     dflt='y' ;;
6406 [nN]*|false|$undef)     dflt='n' ;;
6407 *)      case "$ptrsize" in
6408         4) dflt='y' ;;
6409         *) dflt='n' ;;
6410         esac
6411         ;;
6412 esac
6413 rp="Do you wish to attempt to use the malloc that comes with $package?"
6414 . ./myread
6415 usemymalloc="$ans"
6416 case "$ans" in
6417 y*|true)
6418         usemymalloc='y'
6419         mallocsrc='malloc.c'
6420         mallocobj="malloc$_o"
6421         d_mymalloc="$define"
6422         case "$libs" in
6423         *-lmalloc*)
6424                 : Remove malloc from list of libraries to use
6425                 echo "Removing unneeded -lmalloc from library list" >&4
6426                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6427                 shift
6428                 libs="$*"
6429                 echo "libs = $libs" >&4
6430                 ;;
6431         esac
6432         ;;
6433 *)
6434         usemymalloc='n'
6435         mallocsrc=''
6436         mallocobj=''
6437         d_mymalloc="$undef"
6438         ;;
6439 esac
6440
6441 : compute the return types of malloc and free
6442 echo " "
6443 $cat >malloc.c <<END
6444 #$i_malloc I_MALLOC
6445 #$i_stdlib I_STDLIB
6446 #include <stdio.h>
6447 #include <sys/types.h>
6448 #ifdef I_MALLOC
6449 #include <malloc.h>
6450 #endif
6451 #ifdef I_STDLIB
6452 #include <stdlib.h>
6453 #endif
6454 #ifdef TRY_MALLOC
6455 void *malloc();
6456 #endif
6457 #ifdef TRY_FREE
6458 void free();
6459 #endif
6460 END
6461 case "$malloctype" in
6462 '')
6463         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6464                 malloctype='void *'
6465         else
6466                 malloctype='char *'
6467         fi
6468         ;;
6469 esac
6470 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6471
6472 case "$freetype" in
6473 '')
6474         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6475                 freetype='void'
6476         else
6477                 freetype='int'
6478         fi
6479         ;;
6480 esac
6481 echo "Your system uses $freetype free(), it would seem." >&4
6482 $rm -f malloc.[co]
6483 $cat <<EOM
6484
6485 After $package is installed, you may wish to install various
6486 add-on modules and utilities.  Typically, these add-ons will
6487 be installed under $prefix with the rest
6488 of this package.  However, you may wish to install such add-ons
6489 elsewhere under a different prefix.
6490
6491 If you do not wish to put everything under a single prefix, that's
6492 ok.  You will be prompted for the individual locations; this siteprefix
6493 is only used to suggest the defaults.
6494
6495 The default should be fine for most people.
6496
6497 EOM
6498 fn=d~+
6499 rp='Installation prefix to use for add-on modules and utilities?'
6500 : XXX Here might be another good place for an installstyle setting.
6501 case "$siteprefix" in
6502 '') dflt=$prefix ;;
6503 *)  dflt=$siteprefix ;;
6504 esac
6505 . ./getfile
6506 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6507 oldsiteprefix=''
6508 case "$siteprefix" in
6509 '') ;;
6510 *)      case "$ans" in
6511         "$prefix") ;;
6512         *) oldsiteprefix="$prefix";;
6513         esac
6514         ;;
6515 esac
6516 siteprefix="$ans"
6517 siteprefixexp="$ansexp"
6518
6519 : determine where site specific libraries go.
6520 : Usual default is /usr/local/lib/perl5/site_perl/$version
6521 : The default "style" setting is made in installstyle.U
6522 : XXX No longer works with Prefixit stuff.
6523 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6524 case "$sitelib" in
6525 '') case "$installstyle" in
6526         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6527         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6528         esac
6529         ;;
6530 *)      dflt="$sitelib"
6531         ;;
6532 esac
6533 $cat <<EOM
6534
6535 The installation process will create a directory for
6536 site-specific extensions and modules.  Most users find it convenient
6537 to place all site-specific files in this directory rather than in the
6538 main distribution directory.
6539
6540 EOM
6541 fn=d~+
6542 rp='Pathname for the site-specific library files?'
6543 . ./getfile
6544 sitelib="$ans"
6545 sitelibexp="$ansexp"
6546 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6547 : Change installation prefix, if necessary.
6548 if $test X"$prefix" != X"$installprefix"; then
6549         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6550 else
6551         installsitelib="$sitelibexp"
6552 fi
6553
6554 : determine where site specific architecture-dependent libraries go.
6555 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6556 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6557 : sitelib may have an optional trailing /share.
6558 case "$sitearch" in
6559 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6560         dflt="$dflt/$archname"
6561         ;;
6562 *)      dflt="$sitearch"
6563         ;;
6564 esac
6565 set sitearch sitearch none
6566 eval $prefixit
6567 $cat <<EOM
6568
6569 The installation process will also create a directory for
6570 architecture-dependent site-specific extensions and modules.
6571
6572 EOM
6573 fn=d~+
6574 rp='Pathname for the site-specific architecture-dependent library files?'
6575 . ./getfile
6576 sitearch="$ans"
6577 sitearchexp="$ansexp"
6578 : Change installation prefix, if necessary.
6579 if $test X"$prefix" != X"$installprefix"; then
6580         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6581 else
6582         installsitearch="$sitearchexp"
6583 fi
6584
6585 $cat <<EOM
6586
6587 The installation process will also create a directory for
6588 vendor-supplied add-ons.  Vendors who supply perl with their system
6589 may find it convenient to place all vendor-supplied files in this
6590 directory rather than in the main distribution directory.  This will
6591 ease upgrades between binary-compatible maintenance versions of perl.
6592
6593 Of course you may also use these directories in whatever way you see
6594 fit.  For example, you might use them to access modules shared over a
6595 company-wide network.
6596
6597 The default answer should be fine for most people.
6598 This causes further questions about vendor add-ons to be skipped
6599 and no vendor-specific directories will be configured for perl.
6600
6601 EOM
6602 rp='Do you want to configure vendor-specific add-on directories?'
6603 case "$usevendorprefix" in
6604 define|true|[yY]*) dflt=y ;;
6605 *)      : User may have set vendorprefix directly on Configure command line.
6606         case "$vendorprefix" in
6607         ''|' ') dflt=n ;;
6608         *)      dflt=y ;;
6609         esac
6610         ;;
6611 esac
6612 . ./myread
6613 case "$ans" in
6614 [yY]*)  fn=d~+
6615         rp='Installation prefix to use for vendor-supplied add-ons?'
6616         case "$vendorprefix" in
6617         '') dflt='' ;;
6618         *)  dflt=$vendorprefix ;;
6619         esac
6620         . ./getfile
6621         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6622         oldvendorprefix=''
6623         case "$vendorprefix" in
6624         '') ;;
6625         *)      case "$ans" in
6626                 "$prefix") ;;
6627                 *) oldvendorprefix="$prefix";;
6628                 esac
6629                 ;;
6630         esac
6631         usevendorprefix="$define"
6632         vendorprefix="$ans"
6633         vendorprefixexp="$ansexp"
6634         ;;
6635 *)      usevendorprefix="$undef"
6636         vendorprefix=''
6637         vendorprefixexp=''
6638         ;;
6639 esac
6640
6641 case "$vendorprefix" in
6642 '')     d_vendorlib="$undef"
6643         vendorlib=''
6644         vendorlibexp=''
6645         ;;
6646 *)      d_vendorlib="$define"
6647         : determine where vendor-supplied modules go.
6648         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6649         case "$vendorlib" in
6650         '')
6651                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6652                 case "$installstyle" in
6653                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6654                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6655                 esac
6656                 ;;
6657         *)      dflt="$vendorlib"
6658                 ;;
6659         esac
6660         fn=d~+
6661         rp='Pathname for the vendor-supplied library files?'
6662         . ./getfile
6663         vendorlib="$ans"
6664         vendorlibexp="$ansexp"
6665         ;;
6666 esac
6667 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6668 : Change installation prefix, if necessary.
6669 if $test X"$prefix" != X"$installprefix"; then
6670         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6671 else
6672         installvendorlib="$vendorlibexp"
6673 fi
6674
6675 case "$vendorprefix" in
6676 '')     d_vendorarch="$undef"
6677         vendorarch=''
6678         vendorarchexp=''
6679         ;;
6680 *)      d_vendorarch="$define"
6681         : determine where vendor-supplied architecture-dependent libraries go.
6682         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6683         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6684         : vendorlib may have an optional trailing /share.
6685         case "$vendorarch" in
6686         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6687                 dflt="$dflt/$archname"
6688                 ;;
6689         *)      dflt="$vendorarch" ;;
6690         esac
6691         fn=d~+
6692         rp='Pathname for vendor-supplied architecture-dependent files?'
6693         . ./getfile
6694         vendorarch="$ans"
6695         vendorarchexp="$ansexp"
6696         ;;
6697 esac
6698 : Change installation prefix, if necessary.
6699 if $test X"$prefix" != X"$installprefix"; then
6700         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6701 else
6702         installvendorarch="$vendorarchexp"
6703 fi
6704
6705 : Final catch-all directories to search
6706 $cat <<EOM
6707
6708 Lastly, you can have perl look in other directories for extensions and
6709 modules in addition to those already specified.
6710 These directories will be searched after 
6711         $sitearch 
6712         $sitelib 
6713 EOM
6714 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6715 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6716 echo ' '
6717 case "$otherlibdirs" in
6718 ''|' ') dflt='none' ;;
6719 *)      dflt="$otherlibdirs" ;;
6720 esac
6721 $cat <<EOM
6722 Enter a colon-separated set of extra paths to include in perl's @INC
6723 search path, or enter 'none' for no extra paths.
6724
6725 EOM
6726
6727 rp='Colon-separated list of additional directories for perl to search?'
6728 . ./myread
6729 case "$ans" in
6730 ' '|''|none)    otherlibdirs=' ' ;;     
6731 *)      otherlibdirs="$ans" ;;
6732 esac
6733 case "$otherlibdirs" in
6734 ' ') val=$undef ;;
6735 *)      val=$define ;;
6736 esac
6737 set d_perl_otherlibdirs
6738 eval $setvar
6739
6740 : Cruising for prototypes
6741 echo " "
6742 echo "Checking out function prototypes..." >&4
6743 $cat >prototype.c <<'EOCP'
6744 int main(int argc, char *argv[]) {
6745         exit(0);}
6746 EOCP
6747 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6748         echo "Your C compiler appears to support function prototypes."
6749         val="$define"
6750 else
6751         echo "Your C compiler doesn't seem to understand function prototypes."
6752         val="$undef"
6753 fi
6754 set prototype
6755 eval $setvar
6756 $rm -f prototype*
6757
6758 case "$prototype" in
6759 "$define") ;;
6760 *)      ansi2knr='ansi2knr'
6761         echo " "
6762         cat <<EOM >&4
6763
6764 $me:  FATAL ERROR:
6765 This version of $package can only be compiled by a compiler that 
6766 understands function prototypes.  Unfortunately, your C compiler 
6767         $cc $ccflags
6768 doesn't seem to understand them.  Sorry about that.
6769
6770 If GNU cc is available for your system, perhaps you could try that instead.  
6771
6772 Eventually, we hope to support building Perl with pre-ANSI compilers.
6773 If you would like to help in that effort, please contact <perlbug@perl.org>.
6774
6775 Aborting Configure now.
6776 EOM
6777         exit 2
6778         ;;
6779 esac
6780
6781 : determine where public executables go
6782 echo " "
6783 set dflt bin bin
6784 eval $prefixit
6785 fn=d~
6786 rp='Pathname where the public executables will reside?'
6787 . ./getfile
6788 if $test "X$ansexp" != "X$binexp"; then
6789         installbin=''
6790 fi
6791 bin="$ans"
6792 binexp="$ansexp"
6793 : Change installation prefix, if necessary.
6794 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6795 if $test X"$prefix" != X"$installprefix"; then
6796         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6797 else
6798         installbin="$binexp"
6799 fi
6800
6801 echo " "
6802 case "$extras" in
6803 '') dflt='n';;
6804 *) dflt='y';;
6805 esac
6806 cat <<EOM
6807 Perl can be built with extra modules or bundles of modules which
6808 will be fetched from the CPAN and installed alongside Perl.
6809
6810 Notice that you will need access to the CPAN; either via the Internet,
6811 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6812 be asked later to configure the CPAN.pm module which will in turn do
6813 the installation of the rest of the extra modules or bundles.)
6814
6815 Notice also that if the modules require any external software such as
6816 libraries and headers (the libz library and the zlib.h header for the
6817 Compress::Zlib module, for example) you MUST have any such software
6818 already installed, this configuration process will NOT install such
6819 things for you.
6820
6821 If this doesn't make any sense to you, just accept the default '$dflt'.
6822 EOM
6823 rp='Install any extra modules (y or n)?'
6824 . ./myread
6825 case "$ans" in
6826 y|Y)
6827         cat <<EOM
6828
6829 Please list any extra modules or bundles to be installed from CPAN,
6830 with spaces between the names.  The names can be in any format the
6831 'install' command of CPAN.pm will understand.  (Answer 'none',
6832 without the quotes, to install no extra modules or bundles.)
6833 EOM
6834         rp='Extras?'
6835         dflt="$extras"
6836         . ./myread
6837         extras="$ans"
6838 esac
6839 case "$extras" in
6840 ''|'none')
6841         val=''
6842         $rm -f ../extras.lst
6843         ;;
6844 *)      echo "(Saving the list of extras for later...)"
6845         echo "$extras" > ../extras.lst
6846         val="'$extras'"
6847         ;;
6848 esac
6849 set extras
6850 eval $setvar
6851 echo " "
6852
6853 : Find perl5.005 or later.
6854 echo "Looking for a previously installed perl5.005 or later... "
6855 case "$perl5" in
6856 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6857                 : Check if this perl is recent and can load a simple module
6858                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6859                         perl5=$tdir/perl
6860                         break;
6861                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6862                         perl5=$tdir/perl5
6863                         break;
6864                 fi
6865         done
6866         ;;
6867 *)      perl5="$perl5"
6868         ;;
6869 esac
6870 case "$perl5" in
6871 '')     echo "None found.  That's ok.";;
6872 *)      echo "Using $perl5." ;;
6873 esac
6874
6875 : Determine list of previous versions to include in @INC
6876 $cat > getverlist <<EOPL
6877 #!$perl5 -w
6878 use File::Basename;
6879 \$api_versionstring = "$api_versionstring";
6880 \$version = "$version";
6881 \$stem = "$sitelib_stem";
6882 \$archname = "$archname";
6883 EOPL
6884         $cat >> getverlist <<'EOPL'
6885 # Can't have leading @ because metaconfig interprets it as a command!
6886 ;@inc_version_list=();
6887 # XXX Redo to do opendir/readdir? 
6888 if (-d $stem) {
6889     chdir($stem);
6890     ;@candidates = glob("5.*");
6891 }
6892 else {
6893     ;@candidates = ();
6894 }
6895
6896 # XXX ToDo:  These comparisons must be reworked when two-digit
6897 # subversions come along, so that 5.7.10 compares as greater than
6898 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6899 # widespread that we can use the built-in version vectors rather
6900 # than reinventing them here.  For 5.6.0, however, we must
6901 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6902 foreach $d (@candidates) {
6903     if ($d lt $version) {
6904         if ($d ge $api_versionstring) {
6905             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6906         }
6907         elsif ($d ge "5.005") {
6908             unshift(@inc_version_list, grep { -d } $d);
6909         }
6910     }
6911     else {
6912         # Skip newer version.  I.e. don't look in
6913         # 5.7.0 if we're installing 5.6.1.
6914     }
6915 }
6916
6917 if (@inc_version_list) {
6918     print join(' ', @inc_version_list);
6919 }
6920 else {
6921     # Blank space to preserve value for next Configure run.
6922     print " ";
6923 }
6924 EOPL
6925 chmod +x getverlist
6926 case "$inc_version_list" in
6927 '')     if test -x "$perl5$exe_ext"; then
6928                 dflt=`$perl5 getverlist`
6929         else
6930                 dflt='none'
6931         fi
6932         ;;
6933 $undef) dflt='none' ;;
6934 *)  eval dflt=\"$inc_version_list\" ;;
6935 esac
6936 case "$dflt" in
6937 ''|' ') dflt=none ;;
6938 esac
6939 case "$dflt" in
6940 5.005) case "$bincompat5005" in
6941        $define|true|[yY]*) ;;
6942        *) dflt=none ;;
6943        esac
6944        ;;
6945 esac
6946 $cat <<'EOM'
6947
6948 In order to ease the process of upgrading, this version of perl 
6949 can be configured to use modules built and installed with earlier 
6950 versions of perl that were installed under $prefix.  Specify here
6951 the list of earlier versions that this version of perl should check.
6952 If Configure detected no earlier versions of perl installed under
6953 $prefix, then the list will be empty.  Answer 'none' to tell perl
6954 to not search earlier versions.
6955
6956 The default should almost always be sensible, so if you're not sure,
6957 just accept the default.
6958 EOM
6959
6960 rp='List of earlier versions to include in @INC?'
6961 . ./myread
6962 case "$ans" in
6963 [Nn]one|''|' ') inc_version_list=' ' ;;
6964 *) inc_version_list="$ans" ;;
6965 esac
6966 case "$inc_version_list" in
6967 ''|' ') 
6968         inc_version_list_init='0';;
6969 *)      inc_version_list_init=`echo $inc_version_list |
6970                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6971         ;;
6972 esac
6973 $rm -f getverlist
6974
6975 : determine whether to install perl also as /usr/bin/perl
6976
6977 echo " "
6978 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6979         $cat <<EOM
6980 Many scripts expect perl to be installed as /usr/bin/perl.
6981 I can install the perl you are about to compile also as /usr/bin/perl
6982 (in addition to $installbin/perl).
6983 EOM
6984         case "$installusrbinperl" in
6985         "$undef"|[nN]*) dflt='n';;
6986         *)              dflt='y';;
6987         esac
6988         rp="Do you want to install perl as /usr/bin/perl?"
6989         . ./myread
6990         case "$ans" in
6991         [yY]*)  val="$define";;
6992         *)      val="$undef" ;;
6993         esac
6994 else
6995         val="$undef"
6996 fi
6997 set installusrbinperl
6998 eval $setvar
6999
7000 : see if dld is available
7001 set dld.h i_dld
7002 eval $inhdr
7003
7004 : see if dlopen exists
7005 xxx_runnm="$runnm"
7006 runnm=false
7007 set dlopen d_dlopen
7008 eval $inlibc
7009 runnm="$xxx_runnm"
7010
7011 : determine which dynamic loading, if any, to compile in
7012 echo " "
7013 dldir="ext/DynaLoader"
7014 case "$usedl" in
7015 $define|y|true)
7016         dflt='y'
7017         usedl="$define"
7018         ;;
7019 $undef|n|false)
7020         dflt='n'
7021         usedl="$undef"
7022         ;;
7023 *) 
7024         dflt='n'
7025         case "$d_dlopen" in
7026             $define) dflt='y' ;;
7027         esac
7028         case "$i_dld" in
7029             $define) dflt='y' ;;
7030         esac
7031         : Does a dl_xxx.xs file exist for this operating system
7032         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7033         ;;
7034 esac
7035 rp="Do you wish to use dynamic loading?"
7036 . ./myread
7037 usedl="$ans"
7038 case "$ans" in
7039 y*) usedl="$define"
7040         case "$dlsrc" in
7041         '')
7042                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7043                         dflt="$dldir/dl_${osname}.xs"
7044                 elif $test "$d_dlopen" = "$define" ; then
7045                         dflt="$dldir/dl_dlopen.xs"
7046                 elif $test "$i_dld" = "$define" ; then
7047                         dflt="$dldir/dl_dld.xs"
7048                 else
7049                         dflt=''
7050                 fi
7051                 ;;
7052         *)      dflt="$dldir/$dlsrc"
7053                 ;;
7054         esac
7055     echo "The following dynamic loading files are available:"
7056         : Can not go over to $dldir because getfile has path hard-coded in.
7057         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7058         rp="Source file to use for dynamic loading"
7059         fn="fne"
7060         gfpth="$src"
7061         . ./getfile
7062         usedl="$define"
7063         : emulate basename
7064         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7065
7066         $cat << EOM
7067
7068 Some systems may require passing special flags to $cc -c to
7069 compile modules that will be used to create a shared library.
7070 To use no flags, say "none".
7071
7072 EOM
7073     case "$cccdlflags" in
7074     '') case "$gccversion" in
7075                 '') case "$osname" in
7076                         hpux)   dflt='+z' ;;
7077                         next)   dflt='none' ;;
7078                         irix*)  dflt='-KPIC' ;;
7079                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7080                         sunos)  dflt='-pic' ;;
7081                         *)      dflt='none' ;;
7082                     esac
7083                         ;;
7084                 *)  case "$osname" in
7085                         darwin) dflt='none' ;;
7086                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7087                         *)      dflt='-fpic' ;;
7088                     esac ;;
7089             esac ;;
7090         ' ') dflt='none' ;;
7091     *)  dflt="$cccdlflags" ;;
7092     esac
7093     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7094     . ./myread
7095     case "$ans" in
7096     none) cccdlflags=' ' ;;
7097     *) cccdlflags="$ans" ;;
7098     esac
7099
7100     cat << EOM
7101
7102 Some systems use ld to create libraries that can be dynamically loaded,
7103 while other systems (such as those using ELF) use $cc.
7104
7105 EOM
7106         case "$ld" in
7107         '')     $cat >try.c <<'EOM'
7108 /* Test for whether ELF binaries are produced */
7109 #include <fcntl.h>
7110 #include <stdlib.h>
7111 int main() {
7112         char b[4];
7113         int i = open("a.out",O_RDONLY);
7114         if(i == -1) 
7115                 exit(1); /* fail */
7116         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7117                 exit(0); /* succeed (yes, it's ELF) */
7118         else
7119                 exit(1); /* fail */
7120 }
7121 EOM
7122                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7123                         cat <<EOM
7124 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7125 EOM
7126                         dflt="$cc"
7127                 else
7128                         echo "I'll use ld to build dynamic libraries."
7129                         dflt='ld'
7130                 fi
7131                 rm -f try.c a.out
7132                 ;;
7133         *)      dflt="$ld"
7134                 ;;
7135         esac
7136
7137     rp="What command should be used to create dynamic libraries?"
7138     . ./myread
7139         ld="$ans"
7140
7141     cat << EOM
7142
7143 Some systems may require passing special flags to $ld to create a
7144 library that can be dynamically loaded.  If your ld flags include
7145 -L/other/path options to locate libraries outside your loader's normal
7146 search path, you may need to specify those -L options here as well.  To
7147 use no flags, say "none".
7148
7149 EOM
7150     case "$lddlflags" in
7151     '') case "$osname" in
7152                         beos) dflt='-nostart' ;;
7153                         hpux) dflt='-b';
7154                               case "$gccversion" in
7155                               '') dflt="$dflt +vnocompatwarnings" ;;
7156                               esac
7157                               ;;        
7158                         linux|irix*)    dflt='-shared' ;;
7159                         next)  dflt='none' ;;
7160                         solaris) dflt='-G' ;;
7161                         sunos) dflt='-assert nodefinitions' ;;
7162                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7163                 *)     dflt='none' ;;
7164                         esac
7165                         ;;
7166     *) dflt="$lddlflags" ;;
7167     esac
7168
7169         : Try to guess additional flags to pick up local libraries.
7170         : Be careful not to append to a plain 'none'
7171         case "$dflt" in
7172         none) dflt='' ;;
7173         esac
7174         for thisflag in $ldflags; do
7175                 case "$thisflag" in
7176                 -L*|-R*|-Wl,-R*)
7177                         case " $dflt " in
7178                         *" $thisflag "*) ;;
7179                         *) dflt="$dflt $thisflag" ;;
7180                         esac
7181                         ;;
7182                 esac
7183         done
7184
7185         case "$dflt" in
7186         ''|' ') dflt='none' ;;
7187         esac
7188
7189     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7190     . ./myread
7191     case "$ans" in
7192     none) lddlflags=' ' ;;
7193     *) lddlflags="$ans" ;;
7194     esac
7195
7196         cat <<EOM
7197
7198 Some systems may require passing special flags to $cc to indicate that
7199 the resulting executable will use dynamic linking.  To use no flags,
7200 say "none".
7201
7202 EOM
7203     case "$ccdlflags" in
7204     '') case "$osname" in
7205                 hpux)   dflt='-Wl,-E' ;;
7206                 linux)  dflt='-rdynamic' ;;
7207                 next)   dflt='none' ;;
7208                 sunos)  dflt='none' ;;
7209                 *)      dflt='none' ;;
7210             esac ;;
7211     ' ')  dflt='none' ;;
7212     *)  dflt="$ccdlflags" ;;
7213     esac
7214     rp="Any special flags to pass to $cc to use dynamic linking?"
7215     . ./myread
7216     case "$ans" in
7217     none) ccdlflags=' ' ;;
7218     *) ccdlflags="$ans" ;;
7219     esac
7220     ;;
7221 *)  usedl="$undef"
7222         ld='ld'
7223     dlsrc='dl_none.xs'
7224     lddlflags=''
7225     ccdlflags=''
7226     ;;
7227 esac
7228
7229 also=''
7230 case "$usedl" in
7231 $undef)
7232         # No dynamic loading being used, so don't bother even to prompt.
7233         useshrplib='false'
7234         ;;
7235 *)      case "$useshrplib" in
7236         '')     case "$osname" in
7237                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7238                         dflt=y
7239                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7240                         ;;
7241                 next*)
7242                         case "$osvers" in
7243                         4*)     dflt=y
7244                                 also='Building a shared libperl is needed for MAB support.'
7245                                 ;;
7246                         *)      dflt=n
7247                                 ;;
7248                         esac
7249                         ;;
7250                 *)      dflt=n
7251                         ;;
7252                 esac
7253                 ;;
7254         $define|true|[Yy]*)
7255                 dflt=y
7256                 ;;
7257         *)      dflt=n
7258                 ;;
7259         esac
7260         $cat << EOM
7261
7262 The perl executable is normally obtained by linking perlmain.c with
7263 libperl${_a}, any static extensions (usually just DynaLoader), and
7264 any other libraries needed on this system (such as -lm, etc.).  Since
7265 your system supports dynamic loading, it is probably possible to build
7266 a shared libperl.$so.  If you will have more than one executable linked
7267 to libperl.$so, this will significantly reduce the size of each
7268 executable, but it may have a noticeable affect on performance.  The
7269 default is probably sensible for your system.
7270 $also
7271
7272 EOM
7273         rp="Build a shared libperl.$so (y/n)"
7274         . ./myread
7275         case "$ans" in
7276         true|$define|[Yy]*)
7277                 useshrplib='true'  ;;
7278         *)      useshrplib='false' ;;
7279         esac
7280         ;;
7281 esac
7282
7283 case "$useshrplib" in
7284 true)
7285         case "$libperl" in
7286         '')
7287                 # Figure out a good name for libperl.so.  Since it gets stored in
7288                 # a version-specific architecture-dependent library, the version
7289                 # number isn't really that important, except for making cc/ld happy.
7290                 #
7291                 # A name such as libperl.so.3.1
7292                 majmin="libperl.$so.$patchlevel.$subversion"
7293                 # A name such as libperl.so.301
7294                 majonly=`echo $patchlevel $subversion |
7295                         $awk '{printf "%d%02d", $1, $2}'`
7296                 majonly=libperl.$so.$majonly
7297                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7298                 # rely on figuring it out from the naming of libc.
7299                 case "${osname}${osvers}" in
7300                 next4*)
7301                         dflt=libperl.5.$so
7302                         # XXX How handle the --version stuff for MAB?
7303                         ;;
7304                 linux*)  # ld won't link with a bare -lperl otherwise.
7305                         dflt=libperl.$so
7306                         ;;
7307                 cygwin*) # include version
7308                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7309                         ;;
7310                 *)      # Try to guess based on whether libc has major.minor.
7311                         case "$libc" in
7312                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7313                         *libc.$so.[0-9]*) dflt=$majonly ;;
7314                         *)      dflt=libperl.$so ;;
7315                         esac
7316                         ;;
7317                 esac
7318                 ;;
7319         *)      dflt=$libperl
7320                 ;;
7321         esac
7322         cat << EOM
7323
7324 I need to select a good name for the shared libperl.  If your system uses
7325 library names with major and minor numbers, then you might want something
7326 like $majmin.  Alternatively, if your system uses a single version
7327 number for shared libraries, then you might want to use $majonly.
7328 Or, your system might be quite happy with a simple libperl.$so.
7329
7330 Since the shared libperl will get installed into a version-specific
7331 architecture-dependent directory, the version number of the shared perl
7332 library probably isn't important, so the default should be o.k.
7333
7334 EOM
7335         rp='What name do you want to give to the shared libperl?'
7336         . ./myread
7337         libperl=$ans
7338         echo "Ok, I'll use $libperl"
7339         ;;
7340 *)
7341         libperl="libperl${_a}"
7342         ;;
7343 esac
7344
7345 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7346 case "$shrpdir" in
7347 '') ;;
7348 *)      $cat >&4 <<EOM
7349 WARNING:  Use of the shrpdir variable for the installation location of
7350 the shared $libperl is not supported.  It was never documented and
7351 will not work in this version.  Let me (perlbug@perl.org)
7352 know of any problems this may cause.
7353
7354 EOM
7355         case "$shrpdir" in
7356         "$archlibexp/CORE")
7357                 $cat >&4 <<EOM
7358 But your current setting of $shrpdir is
7359 the default anyway, so it's harmless.
7360 EOM
7361                 ;;
7362         *)
7363                 $cat >&4 <<EOM
7364 Further, your current attempted setting of $shrpdir
7365 conflicts with the value of $archlibexp/CORE
7366 that installperl will use.
7367 EOM
7368                 ;;
7369         esac
7370         ;;
7371 esac
7372
7373 # How will the perl executable find the installed shared $libperl?
7374 # Add $xxx to ccdlflags.
7375 # If we can't figure out a command-line option, use $shrpenv to
7376 # set env LD_RUN_PATH.  The main perl makefile uses this.
7377 shrpdir=$archlibexp/CORE
7378 xxx=''
7379 tmp_shrpenv=''
7380 if "$useshrplib"; then
7381     case "$osname" in 
7382         aix)
7383                 # We'll set it in Makefile.SH...
7384                 ;;
7385         solaris)
7386                 xxx="-R $shrpdir"
7387                 ;;
7388         freebsd|netbsd)
7389                 xxx="-Wl,-R$shrpdir"
7390                 ;;
7391         linux|irix*|dec_osf)
7392                 xxx="-Wl,-rpath,$shrpdir"
7393                 ;;
7394         next)
7395                 # next doesn't like the default...
7396                 ;;
7397         beos)
7398                 # beos doesn't like the default, either.
7399                 ;;
7400         hpux*)
7401                 # hpux doesn't like the default, either.
7402                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7403                 ;;
7404         *)
7405                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7406                 ;;
7407         esac
7408         case "$xxx" in
7409         '') ;;
7410         *)      
7411                 # Only add $xxx if it isn't already in ccdlflags.
7412                 case " $ccdlflags " in
7413                 *" $xxx "*)     ;;
7414                 *)      ccdlflags="$ccdlflags $xxx"
7415                         cat <<EOM >&4
7416
7417 Adding $xxx to the flags
7418 passed to $ld so that the perl executable will find the 
7419 installed shared $libperl.
7420
7421 EOM
7422                         ;;
7423                 esac
7424                 ;;
7425         esac
7426 fi
7427 # Fix ccdlflags in AIX for building external extensions.
7428 # (For building Perl itself bare -bE:perl.exp is needed,
7429 #  Makefile.SH takes care of this.)
7430 case "$osname" in
7431 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7432 esac
7433 # Respect a hint or command-line value.
7434 case "$shrpenv" in
7435 '') shrpenv="$tmp_shrpenv" ;;
7436 esac
7437 case "$ldlibpthname" in
7438 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7439 none)   ldlibpthname='' ;;
7440 esac
7441
7442 : determine where manual pages are on this system
7443 echo " "
7444 case "$sysman" in
7445 '') 
7446         syspath='/usr/share/man/man1 /usr/man/man1'
7447         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7448         syspath="$syspath /usr/man/u_man/man1"
7449         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7450         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7451         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7452         sysman=`./loc . /usr/man/man1 $syspath`
7453         ;;
7454 esac
7455 if $test -d "$sysman"; then
7456         echo "System manual is in $sysman." >&4
7457 else
7458         echo "Could not find manual pages in source form." >&4
7459 fi
7460
7461 : determine where manual pages go
7462 set man1dir man1dir none
7463 eval $prefixit
7464 $cat <<EOM
7465
7466 $spackage has manual pages available in source form.
7467 EOM
7468 case "$nroff" in
7469 nroff)
7470         echo "However, you don't have nroff, so they're probably useless to you."
7471         case "$man1dir" in
7472         '') man1dir="none";;
7473         esac;;
7474 esac
7475 echo "If you don't want the manual sources installed, answer 'none'."
7476 case "$man1dir" in
7477 ' ') dflt=none
7478         ;;
7479 '')
7480         lookpath="$prefixexp/share/man/man1"
7481         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7482         lookpath="$lookpath $prefixexp/man/p_man/man1"
7483         lookpath="$lookpath $prefixexp/man/u_man/man1"
7484         lookpath="$lookpath $prefixexp/man/man.1"
7485         case "$sysman" in
7486         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7487         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7488         esac
7489         set dflt
7490         eval $prefixup
7491         ;;
7492 *)  dflt="$man1dir"
7493         ;;
7494 esac
7495 echo " "
7496 fn=dn+~
7497 rp="Where do the main $spackage manual pages (source) go?"
7498 . ./getfile
7499 if $test "X$man1direxp" != "X$ansexp"; then
7500         installman1dir=''
7501 fi
7502 man1dir="$ans"
7503 man1direxp="$ansexp"
7504 case "$man1dir" in
7505 '')     man1dir=' '
7506         installman1dir='';;
7507 esac
7508
7509 : Change installation prefix, if necessary.
7510 if $test X"$prefix" != X"$installprefix"; then
7511         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7512 else
7513         installman1dir="$man1direxp"
7514 fi
7515
7516 : What suffix to use on installed man pages
7517
7518 case "$man1dir" in
7519 ' ')
7520         man1ext='0'
7521         ;;
7522 *)
7523         rp="What suffix should be used for the main $spackage man pages?"
7524         case "$man1ext" in
7525         '')     case "$man1dir" in
7526                 *1)  dflt=1 ;;
7527                 *1p) dflt=1p ;;
7528                 *1pm) dflt=1pm ;;
7529                 *l) dflt=l;;
7530                 *n) dflt=n;;
7531                 *o) dflt=o;;
7532                 *p) dflt=p;;
7533                 *C) dflt=C;;
7534                 *L) dflt=L;;
7535                 *L1) dflt=L1;;
7536                 *) dflt=1;;
7537                 esac
7538                 ;;
7539         *)      dflt="$man1ext";;
7540         esac
7541         . ./myread
7542         man1ext="$ans"
7543         ;;
7544 esac
7545
7546 : see if we can have long filenames
7547 echo " "
7548 first=123456789abcdef
7549 $rm -f $first
7550 if (echo hi >$first) 2>/dev/null; then
7551         if $test -f 123456789abcde; then
7552                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7553                 val="$undef"
7554         else
7555                 echo 'You can have filenames longer than 14 characters.'>&4
7556                 val="$define"
7557         fi
7558 else
7559         $cat <<'EOM'
7560 You can't have filenames longer than 14 chars.
7561 You can't even think about them!
7562 EOM
7563         val="$undef"
7564 fi 
7565 set d_flexfnam
7566 eval $setvar
7567 $rm -rf 123456789abcde*
7568
7569 : determine where library module manual pages go
7570 set man3dir man3dir none
7571 eval $prefixit
7572 $cat <<EOM
7573
7574 $spackage has manual pages for many of the library modules.
7575 EOM
7576
7577 case "$nroff" in
7578 nroff)
7579         $cat <<'EOM'
7580 However, you don't have nroff, so they're probably useless to you.
7581 EOM
7582         case "$man3dir" in
7583         '') man3dir="none";;
7584         esac;;
7585 esac
7586
7587 case "$d_flexfnam" in
7588 undef)
7589         $cat <<'EOM'
7590 However, your system can't handle the long file names like File::Basename.3. 
7591 EOM
7592         case "$man3dir" in
7593         '') man3dir="none";;
7594         esac;;
7595 esac
7596
7597 echo "If you don't want the manual sources installed, answer 'none'."
7598 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7599 case "$man3dir" in
7600 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7601         if $test -d "$privlib/man/man3"; then
7602                 cat <<EOM >&4
7603
7604 WARNING:  Previous versions of perl installed man3 pages into
7605 $privlib/man/man3.  This version will suggest a 
7606 new default of $dflt.  
7607 EOM
7608                 tdflt=$dflt
7609                 dflt='n'
7610                 rp='Do you wish to preserve the old behavior?(y/n)'
7611                 . ./myread
7612                 case "$ans" in
7613                 y*) dflt="$privlib/man/man3" ;;
7614                 *)  dflt=$tdflt ;;
7615                 esac
7616     fi
7617         ;;
7618 *)      dflt="$man3dir" ;;
7619 esac
7620 case "$dflt" in
7621 ' ') dflt=none ;;
7622 esac
7623 echo " "
7624 fn=dn+~
7625 rp="Where do the $package library man pages (source) go?"
7626 . ./getfile
7627 man3dir="$ans"
7628 man3direxp="$ansexp"
7629 case "$man3dir" in
7630 '')     man3dir=' '
7631         installman3dir='';;
7632 esac
7633
7634 : Change installation prefix, if necessary.
7635 if $test X"$prefix" != X"$installprefix"; then
7636         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7637 else
7638         installman3dir="$man3direxp"
7639 fi
7640
7641 : What suffix to use on installed man pages
7642 case "$man3dir" in
7643 ' ')
7644         man3ext='0'
7645         ;;
7646 *)
7647         rp="What suffix should be used for the $package library man pages?"
7648         case "$man3ext" in
7649         '')     case "$man3dir" in
7650                 *3)  dflt=3 ;;
7651                 *3p) dflt=3p ;;
7652                 *3pm) dflt=3pm ;;
7653                 *l) dflt=l;;
7654                 *n) dflt=n;;
7655                 *o) dflt=o;;
7656                 *p) dflt=p;;
7657                 *C) dflt=C;;
7658                 *L) dflt=L;;
7659                 *L3) dflt=L3;;
7660                 *) dflt=3;;
7661                 esac
7662                 ;;
7663         *)      dflt="$man3ext";;
7664         esac
7665         . ./myread
7666         man3ext="$ans"
7667         ;;
7668 esac
7669
7670 : see if we have to deal with yellow pages, now NIS.
7671 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7672         if $test -f /usr/etc/nibindd; then
7673                 echo " "
7674                 echo "I'm fairly confident you're on a NeXT."
7675                 echo " "
7676                 rp='Do you get the hosts file via NetInfo?'
7677                 dflt=y
7678                 case "$hostcat" in
7679                 nidump*) ;;
7680                 '') ;;
7681                 *) dflt=n;;
7682                 esac
7683                 . ./myread
7684                 case "$ans" in
7685                 y*) hostcat='nidump hosts .';;
7686                 *)      case "$hostcat" in
7687                         nidump*) hostcat='';;
7688                         esac
7689                         ;;
7690                 esac
7691         fi
7692         case "$hostcat" in
7693         nidump*) ;;
7694         *)
7695                 case "$hostcat" in
7696                 *ypcat*) dflt=y;;
7697                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7698                                 dflt=y
7699                         else
7700                                 dflt=n
7701                         fi;;
7702                 *) dflt=n;;
7703                 esac
7704                 echo " "
7705                 rp='Are you getting the hosts file via yellow pages?'
7706                 . ./myread
7707                 case "$ans" in
7708                 y*) hostcat='ypcat hosts';;
7709                 *) hostcat='cat /etc/hosts';;
7710                 esac
7711                 ;;
7712         esac
7713 fi
7714 case "$hostcat" in
7715 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7716 esac
7717 case "$groupcat" in
7718 '') test -f /etc/group && groupcat='cat /etc/group';;
7719 esac
7720 case "$passcat" in
7721 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7722 esac
7723
7724 : now get the host name
7725 echo " "
7726 echo "Figuring out host name..." >&4
7727 case "$myhostname" in
7728 '') cont=true
7729         echo 'Maybe "hostname" will work...'
7730         if tans=`sh -c hostname 2>&1` ; then
7731                 myhostname=$tans
7732                 phostname=hostname
7733                 cont=''
7734         fi
7735         ;;
7736 *) cont='';;
7737 esac
7738 if $test "$cont"; then
7739         if ./xenix; then
7740                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7741                 if tans=`cat /etc/systemid 2>&1` ; then
7742                         myhostname=$tans
7743                         phostname='cat /etc/systemid'
7744                         echo "Whadyaknow.  Xenix always was a bit strange..."
7745                         cont=''
7746                 fi
7747         elif $test -r /etc/systemid; then
7748                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7749         fi
7750 fi
7751 if $test "$cont"; then
7752         echo 'No, maybe "uuname -l" will work...'
7753         if tans=`sh -c 'uuname -l' 2>&1` ; then
7754                 myhostname=$tans
7755                 phostname='uuname -l'
7756         else
7757                 echo 'Strange.  Maybe "uname -n" will work...'
7758                 if tans=`sh -c 'uname -n' 2>&1` ; then
7759                         myhostname=$tans
7760                         phostname='uname -n'
7761                 else
7762                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7763                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7764                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7765                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7766                         else
7767                                 case "$myhostname" in
7768                                 '') echo "Does this machine have an identity crisis or something?"
7769                                         phostname='';;
7770                                 *)
7771                                         echo "Well, you said $myhostname before..."
7772                                         phostname='echo $myhostname';;
7773                                 esac
7774                         fi
7775                 fi
7776         fi
7777 fi
7778 : you do not want to know about this
7779 set $myhostname
7780 myhostname=$1
7781
7782 : verify guess
7783 if $test "$myhostname" ; then
7784         dflt=y
7785         rp='Your host name appears to be "'$myhostname'".'" Right?"
7786         . ./myread
7787         case "$ans" in
7788         y*) ;;
7789         *) myhostname='';;
7790         esac
7791 fi
7792
7793 : bad guess or no guess
7794 while $test "X$myhostname" = X ; do
7795         dflt=''
7796         rp="Please type the (one word) name of your host:"
7797         . ./myread
7798         myhostname="$ans"
7799 done
7800
7801 : translate upper to lower if necessary
7802 case "$myhostname" in
7803 *[A-Z]*)
7804         echo "(Normalizing case in your host name)"
7805         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7806         ;;
7807 esac
7808
7809 case "$myhostname" in
7810 *.*)
7811         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7812         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7813         echo "(Trimming domain name from host name--host name is now $myhostname)"
7814         ;;
7815 *) case "$mydomain" in
7816         '')
7817                 {
7818                         test "X$hostcat" = "Xypcat hosts" &&
7819                         ypmatch "$myhostname" hosts 2>/dev/null |\
7820                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7821                         $test -s hosts
7822                 } || {
7823                         test "X$hostcat" != "X" &&
7824                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7825                                         /[       ]$myhostname[  . ]/p" > hosts
7826                 }
7827                 tmp_re="[       . ]"
7828                 if $test -f hosts; then
7829                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7830                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7831                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7832                                 hosts | $sort | $uniq | \
7833                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7834                         case `$echo X$dflt` in
7835                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7836                                 dflt=.
7837                                 ;;
7838                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7839                                 ;;
7840                         esac
7841                 else
7842                         echo "(I cannot locate a hosts database anywhere)"
7843                         dflt=.
7844                 fi
7845                 case "$dflt" in
7846                 .)
7847                         tans=`./loc resolv.conf X /etc /usr/etc`
7848                         if $test -f "$tans"; then
7849                                 echo "(Attempting domain name extraction from $tans)"
7850                                 dflt=.`$sed -n -e 's/   / /g' \
7851                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7852                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7853                                 case "$dflt" in
7854                                 .) dflt=.`$sed -n -e 's/        / /g' \
7855                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7856                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7857                                         ;;
7858                                 esac
7859                         fi
7860                         ;;
7861                 esac
7862                 case "$dflt" in
7863                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7864                         dflt=.`sh -c domainname 2>/dev/null`
7865                         case "$dflt" in
7866                         '') dflt='.';;
7867                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7868                         esac
7869                         ;;
7870                 esac
7871                 case "$dflt$osname" in
7872                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7873                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7874                         ;;
7875                 esac
7876                 case "$dflt" in
7877                 .) echo "(Lost all hope -- silly guess then)"
7878                         dflt='.uucp'
7879                         ;;
7880                 esac
7881                 $rm -f hosts
7882                 ;;
7883         *) dflt="$mydomain";;
7884         esac;;
7885 esac
7886 echo " "
7887 rp="What is your domain name?"
7888 . ./myread
7889 tans="$ans"
7890 case "$ans" in
7891 '') ;;
7892 .*) ;;
7893 *) tans=".$tans";;
7894 esac
7895 mydomain="$tans"
7896
7897 : translate upper to lower if necessary
7898 case "$mydomain" in
7899 *[A-Z]*)
7900         echo "(Normalizing case in your domain name)"
7901         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7902         ;;
7903 esac
7904
7905 : a little sanity check here
7906 case "$phostname" in
7907 '') ;;
7908 *)
7909         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7910         $myhostname$mydomain|$myhostname) ;;
7911         *)
7912                 case "$phostname" in
7913                 sed*)
7914                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7915                         ;;
7916                 *)
7917                         echo "(That doesn't agree with your $phostname command, by the way.)"
7918                         ;;
7919                 esac
7920         ;;
7921         esac
7922         ;;
7923 esac
7924
7925 $cat <<EOM
7926
7927 I need to get your e-mail address in Internet format if possible, i.e.
7928 something like user@host.domain. Please answer accurately since I have
7929 no easy means to double check it. The default value provided below
7930 is most probably close to reality but may not be valid from outside
7931 your organization...
7932
7933 EOM
7934 cont=x
7935 while test "$cont"; do
7936         case "$cf_email" in
7937         '') dflt="$cf_by@$myhostname$mydomain";;
7938         *) dflt="$cf_email";;
7939         esac
7940         rp='What is your e-mail address?'
7941         . ./myread
7942         cf_email="$ans"
7943         case "$cf_email" in
7944         *@*.*) cont='' ;;
7945         *)
7946                 rp='Address does not look like an Internet one.  Use it anyway?'
7947                 case "$fastread" in
7948                 yes) dflt=y ;;
7949                 *) dflt=n ;;
7950                 esac
7951                 . ./myread
7952                 case "$ans" in
7953                 y*) cont='' ;;
7954                 *) echo " " ;;
7955                 esac
7956                 ;;
7957         esac
7958 done
7959
7960 $cat <<EOM
7961
7962 If you or somebody else will be maintaining perl at your site, please
7963 fill in the correct e-mail address here so that they may be contacted
7964 if necessary. Currently, the "perlbug" program included with perl
7965 will send mail to this address in addition to perlbug@perl.org. You may
7966 enter "none" for no administrator.
7967
7968 EOM
7969 case "$perladmin" in
7970 '') dflt="$cf_email";;
7971 *) dflt="$perladmin";;
7972 esac
7973 rp='Perl administrator e-mail address'
7974 . ./myread
7975 perladmin="$ans"
7976
7977 : determine whether to only install version-specific parts.
7978 echo " "
7979 $cat <<EOM
7980 Do you want to install only the version-specific parts of the perl
7981 distribution?  Usually you do *not* want to do this.
7982 EOM
7983 case "$versiononly" in
7984 "$define"|[Yy]*|true) dflt='y' ;;
7985 *) dflt='n';
7986 esac
7987 rp="Do you want to install only the version-specific parts of perl?"
7988 . ./myread
7989 case "$ans" in
7990 [yY]*)  val="$define";;
7991 *)      val="$undef" ;;
7992 esac
7993 set versiononly
7994 eval $setvar
7995
7996 : figure out how to guarantee perl startup
7997 case "$startperl" in
7998 '')
7999         case "$sharpbang" in
8000         *!)
8001                 $cat <<EOH
8002
8003 I can use the #! construct to start perl on your system. This will
8004 make startup of perl scripts faster, but may cause problems if you
8005 want to share those scripts and perl is not in a standard place
8006 ($binexp/perl) on all your platforms. The alternative is to force
8007 a shell by starting the script with a single ':' character.
8008
8009 EOH
8010                 case "$versiononly" in
8011                 "$define")      dflt="$binexp/perl$version";;  
8012                 *)              dflt="$binexp/perl";;
8013                 esac
8014                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8015                 . ./myread
8016                 case "$ans" in
8017                 none)   startperl=": # use perl";;
8018                 *)      startperl="#!$ans"
8019                         if $test 30 -lt `echo "$ans" | wc -c`; then
8020                                 $cat >&4 <<EOM
8021
8022 WARNING:  Some systems limit the #! command to 32 characters.
8023 If you experience difficulty running Perl scripts with #!, try
8024 installing Perl in a directory with a shorter pathname.
8025
8026 EOM
8027                         fi ;;
8028                 esac
8029                 ;;
8030         *) startperl=": # use perl"
8031                 ;;
8032         esac
8033         ;;
8034 esac
8035 echo "I'll use $startperl to start perl scripts."
8036
8037 : figure best path for perl in scripts
8038 case "$perlpath" in
8039 '')
8040         perlpath="$binexp/perl"
8041         case "$startperl" in
8042         *!*) ;;
8043         *)
8044                 $cat <<EOH
8045
8046 I will use the "eval 'exec'" idiom to start Perl on your system.
8047 I can use the full path of your Perl binary for this purpose, but
8048 doing so may cause problems if you want to share those scripts and
8049 Perl is not always in a standard place ($binexp/perl).
8050
8051 EOH
8052                 dflt="$binexp/perl"
8053                 rp="What path shall I use in \"eval 'exec'\"?"
8054                 . ./myread
8055                 perlpath="$ans"
8056                 ;;
8057         esac
8058         ;;
8059 esac
8060 case "$startperl" in
8061 *!*)    ;;
8062 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8063 esac
8064
8065 : determine where public executable scripts go
8066 set scriptdir scriptdir
8067 eval $prefixit
8068 case "$scriptdir" in
8069 '')
8070         dflt="$bin"
8071         : guess some guesses
8072         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8073         $test -d /usr/share/bin     && dflt=/usr/share/bin
8074         $test -d /usr/local/script  && dflt=/usr/local/script
8075         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8076         $test -d $prefixexp/script  && dflt=$prefixexp/script
8077         set dflt
8078         eval $prefixup
8079         ;;
8080 *)  dflt="$scriptdir"
8081         ;;
8082 esac
8083 $cat <<EOM
8084  
8085 Some installations have a separate directory just for executable scripts so
8086 that they can mount it across multiple architectures but keep the scripts in
8087 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8088 Or you might just lump your scripts in with all your other executables.
8089  
8090 EOM
8091 fn=d~
8092 rp='Where do you keep publicly executable scripts?'
8093 . ./getfile
8094 if $test "X$ansexp" != "X$scriptdirexp"; then
8095         installscript=''
8096 fi
8097 scriptdir="$ans"
8098 scriptdirexp="$ansexp"
8099 : Change installation prefix, if necessary.
8100 if $test X"$prefix" != X"$installprefix"; then
8101         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8102 else
8103         installscript="$scriptdirexp"
8104 fi
8105
8106 : determine where add-on public executables go
8107 case "$sitebin" in
8108 '')     dflt=$siteprefix/bin ;;
8109 *)      dflt=$sitebin ;;
8110 esac
8111 fn=d~
8112 rp='Pathname where the add-on public executables should be installed?'
8113 . ./getfile
8114 sitebin="$ans"
8115 sitebinexp="$ansexp"
8116 : Change installation prefix, if necessary.
8117 if $test X"$prefix" != X"$installprefix"; then
8118         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8119 else
8120         installsitebin="$sitebinexp"
8121 fi
8122
8123 : define an is-a-typedef? function
8124 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8125 case "$inclist" in
8126 "") inclist="sys/types.h";;
8127 esac;
8128 eval "varval=\$$var";
8129 case "$varval" in
8130 "")
8131         $rm -f temp.c;
8132         for inc in $inclist; do
8133                 echo "#include <$inc>" >>temp.c;
8134         done;
8135         echo "#ifdef $type" >> temp.c;
8136         echo "printf(\"We have $type\");" >> temp.c;
8137         echo "#endif" >> temp.c;
8138         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8139         if $contains $type temp.E >/dev/null 2>&1; then
8140                 eval "$var=\$type";
8141         else
8142                 eval "$var=\$def";
8143         fi;
8144         $rm -f temp.?;;
8145 *) eval "$var=\$varval";;
8146 esac'
8147
8148 : define an is-a-typedef? function that prompts if the type is not available.
8149 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8150 case "$inclist" in
8151 "") inclist="sys/types.h";;
8152 esac;
8153 eval "varval=\$$var";
8154 case "$varval" in
8155 "")
8156         $rm -f temp.c;
8157         for inc in $inclist; do
8158                 echo "#include <$inc>" >>temp.c;
8159         done;
8160         echo "#ifdef $type" >> temp.c;
8161         echo "printf(\"We have $type\");" >> temp.c;
8162         echo "#endif" >> temp.c;
8163         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8164         echo " " ;
8165         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8166         if $contains $type temp.E >/dev/null 2>&1; then
8167                 echo "$type found." >&4;
8168                 eval "$var=\$type";
8169         else
8170                 echo "$type NOT found." >&4;
8171                 dflt="$def";
8172                 . ./myread ;
8173                 eval "$var=\$ans";
8174         fi;
8175         $rm -f temp.?;;
8176 *) eval "$var=\$varval";;
8177 esac'
8178
8179 : see what type lseek is declared as in the kernel
8180 rp="What is the type used for lseek's offset on this system?"
8181 set off_t lseektype long stdio.h sys/types.h
8182 eval $typedef_ask
8183
8184 echo " "
8185 echo "Checking to see how big your file offsets are..." >&4
8186 $cat >try.c <<EOCP
8187 #include <sys/types.h>
8188 #include <stdio.h>
8189 int main()
8190 {
8191     printf("%d\n", (int)sizeof($lseektype));
8192     return(0); 
8193 }
8194 EOCP
8195 set try
8196 if eval $compile_ok; then
8197         lseeksize=`$run ./try`
8198         echo "Your file offsets are $lseeksize bytes long."
8199 else
8200         dflt=$longsize
8201         echo " "
8202         echo "(I can't seem to compile the test program.  Guessing...)"
8203         rp="What is the size of your file offsets (in bytes)?"
8204         . ./myread
8205         lseeksize="$ans"
8206 fi
8207 $rm -f try.c try
8208
8209 : see what type file positions are declared as in the library
8210 rp="What is the type for file position used by fsetpos()?"
8211 set fpos_t fpostype long stdio.h sys/types.h
8212 eval $typedef_ask
8213
8214 echo " "
8215 case "$fpostype" in
8216 *_t) zzz="$fpostype"    ;;
8217 *)   zzz="fpos_t"       ;;
8218 esac
8219 echo "Checking the size of $zzz..." >&4 
8220 cat > try.c <<EOCP
8221 #include <sys/types.h>
8222 #include <stdio.h>
8223 int main() {
8224     printf("%d\n", (int)sizeof($fpostype));
8225     exit(0);
8226 }
8227 EOCP
8228 set try
8229 if eval $compile_ok; then
8230         yyy=`$run ./try`
8231         case "$yyy" in
8232         '')     fpossize=4
8233                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8234                 ;;
8235         *)      fpossize=$yyy
8236                 echo "Your $zzz is $fpossize bytes long."
8237                 ;;
8238         esac
8239 else
8240         dflt="$longsize"
8241         echo " " >&4
8242         echo "(I can't compile the test program.  Guessing...)" >&4
8243         rp="What is the size of your file positions (in bytes)?"
8244         . ./myread
8245         fpossize="$ans"
8246 fi
8247
8248
8249
8250 # Backward compatibility (uselfs is deprecated).
8251 case "$uselfs" in
8252 "$define"|true|[yY]*)
8253         cat <<EOM >&4
8254
8255 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8256 EOM
8257         uselargefiles="$define"
8258         ;;
8259 esac                          
8260
8261 case "$lseeksize:$fpossize" in
8262 8:8) cat <<EOM
8263
8264 You can have files larger than 2 gigabytes.
8265 EOM
8266    val="$define" ;;
8267 *)    case "$uselargefiles" in
8268    "$undef"|false|[nN]*) dflt='n' ;;
8269    *)   dflt='y' ;;
8270    esac
8271    cat <<EOM
8272
8273 Perl can be built to understand large files (files larger than 2 gigabytes)
8274 on some systems.  To do so, Configure can be run with -Duselargefiles.
8275
8276 If this doesn't make any sense to you, just accept the default '$dflt'.
8277 EOM
8278    rp='Try to understand large files, if available?'
8279    . ./myread
8280    case "$ans" in
8281    y|Y)         val="$define" ;;
8282    *)           val="$undef"  ;;
8283    esac
8284    ;;
8285 esac
8286 set uselargefiles
8287 eval $setvar
8288 case "$uselargefiles" in
8289 "$define")
8290 : Look for a hint-file generated 'call-back-unit'.  If the
8291 : user has specified that a large files perl is to be built,
8292 : we may need to set or change some other defaults.
8293         if $test -f uselargefiles.cbu; then
8294                 echo "Your platform has some specific hints for large file builds, using them..."
8295                 . ./uselargefiles.cbu
8296                 echo " "
8297                 echo "Rechecking to see how big your file offsets are..." >&4
8298                 $cat >try.c <<EOCP
8299 #include <sys/types.h>
8300 #include <stdio.h>
8301 int main()
8302 {
8303     printf("%d\n", (int)sizeof($lseektype));
8304     return(0); 
8305 }
8306 EOCP
8307                 set try
8308                 if eval $compile_ok; then
8309                         lseeksize=`$run ./try`
8310                         $echo "Your file offsets are now $lseeksize bytes long."
8311                 else
8312                         dflt="$lseeksize"
8313                         echo " "
8314                         echo "(I can't seem to compile the test program.  Guessing...)"
8315                         rp="What is the size of your file offsets (in bytes)?"
8316                         . ./myread
8317                         lseeksize="$ans"
8318                 fi
8319                 case "$fpostype" in
8320                 *_t) zzz="$fpostype"    ;;
8321                 *)   zzz="fpos_t"       ;;
8322                 esac
8323                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8324                 $cat > try.c <<EOCP
8325 #include <sys/types.h>
8326 #include <stdio.h>
8327 int main() {
8328     printf("%d\n", (int)sizeof($fpostype));
8329     exit(0);
8330 }
8331 EOCP
8332                 set try
8333                 if eval $compile_ok; then
8334                         yyy=`$run ./try`
8335                         dflt="$lseeksize"
8336                         case "$yyy" in
8337                         '')     echo " "
8338                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8339                                 ;;
8340                         *)      fpossize=$yyy
8341                                 echo " $fpossize bytes." >&4
8342                                 ;;
8343                         esac
8344                 else
8345                         dflt="$fpossize"
8346                         echo " "
8347                         echo "(I can't compile the test program.  Guessing...)" >&4
8348                         rp="What is the size of your file positions (in bytes)?"
8349                         . ./myread
8350                         fpossize="$ans"
8351                 fi
8352                 $rm -f try.c try
8353         fi
8354         ;;
8355 esac
8356
8357 case "$vendorprefix" in
8358 '')     d_vendorbin="$undef"
8359         vendorbin=''
8360         vendorbinexp=''
8361         ;;
8362 *)      d_vendorbin="$define"
8363         : determine where vendor-supplied executables go.
8364         case "$vendorbin" in
8365         '') dflt=$vendorprefix/bin ;;
8366         *)      dflt="$vendorbin" ;;
8367         esac
8368         fn=d~+
8369         rp='Pathname for the vendor-supplied executables directory?'
8370         . ./getfile
8371         vendorbin="$ans"
8372         vendorbinexp="$ansexp"
8373         ;;
8374 esac
8375 : Change installation prefix, if necessary.
8376 if $test X"$prefix" != X"$installprefix"; then
8377         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8378 else
8379         installvendorbin="$vendorbinexp"
8380 fi
8381
8382 : see if qgcvt exists
8383 set qgcvt d_qgcvt
8384 eval $inlibc
8385
8386 echo " "
8387
8388 if $test X"$d_longdbl" = X"$define"; then
8389
8390 echo "Checking how to print long doubles..." >&4
8391
8392 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8393         $cat >try.c <<'EOCP'
8394 #include <sys/types.h>
8395 #include <stdio.h>
8396 int main() {
8397   double d = 123.456;
8398   printf("%.3f\n", d);
8399 }
8400 EOCP
8401         set try
8402         if eval $compile; then
8403                 yyy=`$run ./try`
8404                 case "$yyy" in
8405                 123.456)
8406                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8407                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8408                         echo "We will use %f."
8409                         ;;
8410                 esac
8411         fi
8412 fi
8413
8414 if $test X"$sPRIfldbl" = X; then
8415         $cat >try.c <<'EOCP'
8416 #include <sys/types.h>
8417 #include <stdio.h>
8418 int main() {
8419   long double d = 123.456;
8420   printf("%.3Lf\n", d);
8421 }
8422 EOCP
8423         set try
8424         if eval $compile; then
8425                 yyy=`$run ./try`
8426                 case "$yyy" in
8427                 123.456)
8428                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8429                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8430                         echo "We will use %Lf."
8431                         ;;
8432                 esac
8433         fi
8434 fi
8435
8436 if $test X"$sPRIfldbl" = X; then
8437         $cat >try.c <<'EOCP'
8438 #include <sys/types.h>
8439 #include <stdio.h>
8440 int main() {
8441   long double d = 123.456;
8442   printf("%.3llf\n", d);
8443 }
8444 EOCP
8445         set try
8446         if eval $compile; then
8447                 yyy=`$run ./try`
8448                 case "$yyy" in
8449                 123.456)
8450                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8451                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8452                         echo "We will use %llf."
8453                         ;;
8454                 esac
8455         fi
8456 fi
8457
8458 if $test X"$sPRIfldbl" = X; then
8459         $cat >try.c <<'EOCP'
8460 #include <sys/types.h>
8461 #include <stdio.h>
8462 int main() {
8463   long double d = 123.456;
8464   printf("%.3lf\n", d);
8465 }
8466 EOCP
8467         set try
8468         if eval $compile; then
8469                 yyy=`$run ./try`
8470                 case "$yyy" in
8471                 123.456)
8472                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8473                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8474                         echo "We will use %lf."
8475                         ;;
8476                 esac
8477         fi
8478 fi
8479
8480 if $test X"$sPRIfldbl" = X; then
8481         echo "Cannot figure out how to print long doubles." >&4
8482 else
8483         sSCNfldbl=$sPRIfldbl    # expect consistency
8484 fi
8485
8486 $rm -f try try.*
8487
8488 fi # d_longdbl
8489
8490 case "$sPRIfldbl" in
8491 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8492         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8493         d_SCNfldbl="$undef";
8494         ;;
8495 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8496         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8497         d_SCNfldbl="$define";
8498         ;;
8499 esac
8500
8501 : Check how to convert floats to strings.
8502 echo " "
8503 echo "Checking for an efficient way to convert floats to strings."
8504 echo " " > try.c
8505 case "$uselongdouble" in
8506 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8507 esac
8508 case "$d_longdbl" in
8509 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8510 esac
8511 case "$d_PRIgldbl" in
8512 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8513 esac
8514 $cat >>try.c <<EOP
8515 #ifdef TRY_gconvert
8516 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8517 char *myname = "gconvert";
8518 #endif
8519 #ifdef TRY_gcvt
8520 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8521 char *myname = "gcvt";
8522 #endif
8523 #ifdef TRY_qgcvt
8524 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8525 char *myname = "qgcvt";
8526 #define DOUBLETYPE long double
8527 #endif
8528 #ifdef TRY_sprintf
8529 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8530 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8531 #else
8532 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8533 #endif
8534 char *myname = "sprintf";
8535 #endif
8536
8537 #ifndef DOUBLETYPE
8538 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8539 #define DOUBLETYPE long double
8540 #else
8541 #define DOUBLETYPE double
8542 #endif
8543 #endif
8544
8545 #include <stdio.h>
8546
8547 #define I_STDLIB $i_stdlib
8548 #ifdef I_STDLIB
8549 #include <stdlib.h>
8550 #endif
8551
8552 int
8553 checkit(expect, got)
8554 char *expect;
8555 char *got;
8556 {
8557     if (strcmp(expect, got)) {
8558                 printf("%s oddity:  Expected %s, got %s\n",
8559                         myname, expect, got);
8560                 exit(1);
8561         }
8562 }
8563
8564 int main()
8565
8566         char buf[64]; 
8567         buf[63] = '\0';
8568
8569         /* This must be 1st test on (which?) platform */
8570         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8571         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8572         checkit("0.1", buf);
8573
8574         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8575         checkit("1", buf);
8576
8577         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8578         checkit("1.1", buf);
8579
8580         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8581         checkit("1.01", buf);
8582
8583         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8584         checkit("1.001", buf);
8585
8586         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8587         checkit("1.0001", buf);
8588
8589         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8590         checkit("1.00001", buf);
8591
8592         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8593         checkit("1.000001", buf);
8594
8595         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8596         checkit("0", buf);
8597
8598         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8599         checkit("-1", buf);
8600
8601         /* Some Linux gcvt's give 1.e+5 here. */
8602         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8603         checkit("100000", buf);
8604         
8605         /* Some Linux gcvt's give -1.e+5 here. */
8606         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8607         checkit("-100000", buf);
8608
8609         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8610         checkit("123.456", buf);
8611
8612         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8613         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8614         if (strlen(buf) > 5)
8615             checkit("1e+030", buf); /* for Microsoft */
8616         else
8617             checkit("1e+30", buf);
8618
8619         exit(0);
8620 }
8621 EOP
8622 case "$d_Gconvert" in
8623 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8624 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8625 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8626 *) xxx_list='gconvert gcvt sprintf' ;;
8627 esac
8628
8629 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8630 "$define$define$define")
8631     # for long doubles prefer first qgcvt, then sprintf
8632     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8633     xxx_list="sprintf $xxx_list"
8634     case "$d_qgcvt" in
8635     "$define") xxx_list="qgcvt $xxx_list" ;;
8636     esac
8637     ;;
8638 esac
8639
8640 for xxx_convert in $xxx_list; do
8641         echo "Trying $xxx_convert..."
8642         $rm -f try try$_o
8643         set try -DTRY_$xxx_convert
8644         if eval $compile; then
8645                 echo "$xxx_convert() found." >&4
8646                 if $run ./try; then
8647                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8648                         break;
8649                 else
8650                         echo "...But $xxx_convert didn't work as I expected."
8651                 fi
8652         else
8653                 echo "$xxx_convert NOT found." >&4
8654         fi
8655 done
8656         
8657 case "$xxx_convert" in
8658 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8659 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8660 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8661 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8662    "$define$define$define")
8663       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8664    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8665    esac
8666    ;;  
8667 esac
8668
8669 : see if _fwalk exists
8670 set fwalk d__fwalk
8671 eval $inlibc
8672
8673 : Initialize h_fcntl
8674 h_fcntl=false
8675
8676 : Initialize h_sysfile
8677 h_sysfile=false
8678
8679 : access call always available on UNIX
8680 set access d_access
8681 eval $inlibc
8682
8683 : locate the flags for 'access()'
8684 case "$d_access" in
8685 "$define")
8686         echo " "
8687         $cat >access.c <<'EOCP'
8688 #include <sys/types.h>
8689 #ifdef I_FCNTL
8690 #include <fcntl.h>
8691 #endif
8692 #ifdef I_SYS_FILE
8693 #include <sys/file.h>
8694 #endif
8695 #ifdef I_UNISTD
8696 #include <unistd.h>
8697 #endif
8698 int main() {
8699         exit(R_OK);
8700 }
8701 EOCP
8702         : check sys/file.h first, no particular reason here
8703         if $test `./findhdr sys/file.h` && \
8704                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8705                 h_sysfile=true;
8706                 echo "<sys/file.h> defines the *_OK access constants." >&4
8707         elif $test `./findhdr fcntl.h` && \
8708                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8709                 h_fcntl=true;
8710                 echo "<fcntl.h> defines the *_OK access constants." >&4
8711         elif $test `./findhdr unistd.h` && \
8712                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8713                 echo "<unistd.h> defines the *_OK access constants." >&4
8714         else
8715                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8716         fi
8717         ;;
8718 esac
8719 $rm -f access*
8720
8721 : see if accessx exists
8722 set accessx d_accessx
8723 eval $inlibc
8724
8725 : see if alarm exists
8726 set alarm d_alarm
8727 eval $inlibc
8728
8729 : see if atolf exists
8730 set atolf d_atolf
8731 eval $inlibc
8732
8733 : see if atoll exists
8734 set atoll d_atoll
8735 eval $inlibc
8736
8737 : Look for GNU-cc style attribute checking
8738 echo " "
8739 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8740 $cat >attrib.c <<'EOCP'
8741 #include <stdio.h>
8742 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8743 EOCP
8744 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8745         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8746                 echo "Your C compiler doesn't fully support __attribute__."
8747                 val="$undef"
8748         else
8749                 echo "Your C compiler supports __attribute__."
8750                 val="$define"
8751         fi
8752 else
8753         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8754         val="$undef"
8755 fi
8756 set d_attribut
8757 eval $setvar
8758 $rm -f attrib*
8759
8760 : see if bcmp exists
8761 set bcmp d_bcmp
8762 eval $inlibc
8763
8764 : see if bcopy exists
8765 set bcopy d_bcopy
8766 eval $inlibc
8767
8768 : see if this is a unistd.h system
8769 set unistd.h i_unistd
8770 eval $inhdr
8771
8772 : see if getpgrp exists
8773 set getpgrp d_getpgrp
8774 eval $inlibc
8775
8776 case "$d_getpgrp" in
8777 "$define")
8778         echo " "
8779         echo "Checking to see which flavor of getpgrp is in use..."
8780         $cat >try.c <<EOP
8781 #$i_unistd I_UNISTD
8782 #include <sys/types.h>
8783 #ifdef I_UNISTD
8784 #  include <unistd.h>
8785 #endif
8786 int main()
8787 {
8788         if (getuid() == 0) {
8789                 printf("(I see you are running Configure as super-user...)\n");
8790                 setuid(1);
8791         }
8792 #ifdef TRY_BSD_PGRP
8793         if (getpgrp(1) == 0)
8794                 exit(0);
8795 #else
8796         if (getpgrp() > 0)
8797                 exit(0);
8798 #endif
8799         exit(1);
8800 }
8801 EOP
8802         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8803                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8804                 val="$define"
8805         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8806                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8807                 val="$undef"
8808         else
8809                 echo "I can't seem to compile and run the test program."
8810                 if ./usg; then
8811                         xxx="a USG one, i.e. you use getpgrp()."
8812                 else
8813                         # SVR4 systems can appear rather BSD-ish.
8814                         case "$i_unistd" in
8815                         $undef)
8816                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8817                                 val="$define"
8818                                 ;;
8819                         $define)
8820                                 xxx="probably a USG one, i.e. you use getpgrp()."
8821                                 val="$undef"
8822                                 ;;
8823                         esac
8824                 fi
8825                 echo "Assuming your getpgrp is $xxx" >&4
8826         fi
8827         ;;
8828 *) val="$undef";;
8829 esac
8830 set d_bsdgetpgrp
8831 eval $setvar
8832 $rm -f try try.*
8833
8834 : see if setpgrp exists
8835 set setpgrp d_setpgrp
8836 eval $inlibc
8837
8838 case "$d_setpgrp" in
8839 "$define")
8840         echo " "
8841         echo "Checking to see which flavor of setpgrp is in use..."
8842         $cat >try.c <<EOP
8843 #$i_unistd I_UNISTD
8844 #include <sys/types.h>
8845 #ifdef I_UNISTD
8846 #  include <unistd.h>
8847 #endif
8848 int main()
8849 {
8850         if (getuid() == 0) {
8851                 printf("(I see you are running Configure as super-user...)\n");
8852                 setuid(1);
8853         }
8854 #ifdef TRY_BSD_PGRP
8855         if (-1 == setpgrp(1, 1))
8856                 exit(0);
8857 #else
8858         if (setpgrp() != -1)
8859                 exit(0);
8860 #endif
8861         exit(1);
8862 }
8863 EOP
8864         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8865                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8866                 val="$define"
8867         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8868                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8869                 val="$undef"
8870         else
8871                 echo "(I can't seem to compile and run the test program.)"
8872                 if ./usg; then
8873                         xxx="a USG one, i.e. you use setpgrp()."
8874                 else
8875                         # SVR4 systems can appear rather BSD-ish.
8876                         case "$i_unistd" in
8877                         $undef)
8878                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8879                                 val="$define"
8880                                 ;;
8881                         $define)
8882                                 xxx="probably a USG one, i.e. you use setpgrp()."
8883                                 val="$undef"
8884                                 ;;
8885                         esac
8886                 fi
8887                 echo "Assuming your setpgrp is $xxx" >&4
8888         fi
8889         ;;
8890 *) val="$undef";;
8891 esac
8892 set d_bsdsetpgrp
8893 eval $setvar
8894 $rm -f try try.*
8895 : see if bzero exists
8896 set bzero d_bzero
8897 eval $inlibc
8898
8899 : see if signal is declared as pointer to function returning int or void
8900 echo " "
8901 xxx=`./findhdr signal.h`
8902 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8903 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8904         echo "You have int (*signal())() instead of void." >&4
8905         val="$undef"
8906 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8907         echo "You have void (*signal())()." >&4
8908         val="$define"
8909 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8910         echo "You have int (*signal())() instead of void." >&4
8911         val="$undef"
8912 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8913         echo "You have void (*signal())()." >&4
8914         val="$define"
8915 else
8916         case "$d_voidsig" in
8917         '')
8918         echo "I can't determine whether signal handler returns void or int..." >&4
8919                 dflt=void
8920                 rp="What type does your signal handler return?"
8921                 . ./myread
8922                 case "$ans" in
8923                 v*) val="$define";;
8924                 *) val="$undef";;
8925                 esac;;
8926         "$define")
8927                 echo "As you already told me, signal handler returns void." >&4
8928                 val="$define"
8929                 ;;
8930         *)      echo "As you already told me, signal handler returns int." >&4
8931                 val="$undef"
8932                 ;;
8933         esac
8934 fi
8935 set d_voidsig
8936 eval $setvar
8937 case "$d_voidsig" in
8938 "$define") signal_t="void";;
8939 *) signal_t="int";;
8940 esac
8941 $rm -f $$.tmp
8942
8943 : check for ability to cast large floats to 32-bit ints.
8944 echo " "
8945 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8946 if $test "$intsize" -ge 4; then
8947         xxx=int
8948 else
8949         xxx=long
8950 fi
8951 $cat >try.c <<EOCP
8952 #include <stdio.h>
8953 #include <sys/types.h>
8954 #include <signal.h>
8955 $signal_t blech(s) int s; { exit(3); }
8956 int main()
8957 {
8958         $xxx i32;
8959         double f, g;
8960         int result = 0;
8961         char str[16];
8962         signal(SIGFPE, blech);
8963
8964         /* Don't let compiler optimize the test away.  Store the number 
8965            in a writable string for gcc to pass to sscanf under HP/UX.
8966         */
8967         sprintf(str, "2147483647");
8968         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8969         g = 10 * f;
8970         i32  = ($xxx) g;
8971
8972         /* x86 processors will probably give 0x8000 0000, which is a
8973        sign change.  We don't want that.  We want to mimic SPARC
8974            behavior here, which is to preserve the sign and give
8975            back 0x7fff ffff.
8976         */
8977         if (i32 != ($xxx) f)
8978                 result |= 1;
8979         exit(result);
8980 }
8981 EOCP
8982 set try
8983 if eval $compile_ok; then
8984         $run ./try
8985         yyy=$?
8986 else
8987         echo "(I can't seem to compile the test program--assuming it can't)"
8988         yyy=1
8989 fi
8990 case "$yyy" in
8991 0)      val="$define"
8992         echo "Yup, it can."
8993         ;;
8994 *)      val="$undef"
8995         echo "Nope, it can't."
8996         ;;
8997 esac
8998 set d_casti32
8999 eval $setvar
9000 $rm -f try try.*
9001
9002 : check for ability to cast negative floats to unsigned
9003 echo " "
9004 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9005 $cat >try.c <<EOCP
9006 #include <stdio.h>
9007 #include <sys/types.h>
9008 #include <signal.h>
9009 $signal_t blech(s) int s; { exit(7); }
9010 $signal_t blech_in_list(s) int s; { exit(4); }
9011 unsigned long dummy_long(p) unsigned long p; { return p; }
9012 unsigned int dummy_int(p) unsigned int p; { return p; }
9013 unsigned short dummy_short(p) unsigned short p; { return p; }
9014 int main()
9015 {
9016         double f;
9017         unsigned long along;
9018         unsigned int aint;
9019         unsigned short ashort;
9020         int result = 0;
9021         char str[16];
9022         
9023         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9024            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9025            optimized the whole file away
9026         */
9027         /* Store the number in a writable string for gcc to pass to 
9028            sscanf under HP/UX.
9029         */
9030         sprintf(str, "-123");
9031         sscanf(str, "%lf", &f);  /* f = -123.; */
9032
9033         signal(SIGFPE, blech);
9034         along = (unsigned long)f;
9035         aint = (unsigned int)f;
9036         ashort = (unsigned short)f;
9037         if (along != (unsigned long)-123)
9038                 result |= 1;
9039         if (aint != (unsigned int)-123)
9040                 result |= 1;
9041         if (ashort != (unsigned short)-123)
9042                 result |= 1;
9043         sprintf(str, "1073741824.");
9044         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9045         f = f + f;
9046         along = 0;
9047         along = (unsigned long)f;
9048         if (along != 0x80000000)
9049                 result |= 2;
9050         f -= 1.;
9051         along = 0;
9052         along = (unsigned long)f;
9053         if (along != 0x7fffffff)
9054                 result |= 1;
9055         f += 2.;
9056         along = 0;
9057         along = (unsigned long)f;
9058         if (along != 0x80000001)
9059                 result |= 2;
9060         if (result)
9061                 exit(result);
9062         signal(SIGFPE, blech_in_list);
9063         sprintf(str, "123.");
9064         sscanf(str, "%lf", &f);  /* f = 123.; */
9065         along = dummy_long((unsigned long)f);
9066         aint = dummy_int((unsigned int)f);
9067         ashort = dummy_short((unsigned short)f);
9068         if (along != (unsigned long)123)
9069                 result |= 4;
9070         if (aint != (unsigned int)123)
9071                 result |= 4;
9072         if (ashort != (unsigned short)123)
9073                 result |= 4;
9074         exit(result);
9075
9076 }
9077 EOCP
9078 set try
9079 if eval $compile_ok; then
9080         $run ./try
9081         castflags=$?
9082 else
9083         echo "(I can't seem to compile the test program--assuming it can't)"
9084         castflags=7
9085 fi
9086 case "$castflags" in
9087 0)      val="$define"
9088         echo "Yup, it can."
9089         ;;
9090 *)      val="$undef"
9091         echo "Nope, it can't."
9092         ;;
9093 esac
9094 set d_castneg
9095 eval $setvar
9096 $rm -f try.*
9097
9098 : see if vprintf exists
9099 echo " "
9100 if set vprintf val -f d_vprintf; eval $csym; $val; then
9101         echo 'vprintf() found.' >&4
9102         val="$define"
9103         $cat >try.c <<'EOF'
9104 #include <varargs.h>
9105
9106 int main() { xxx("foo"); }
9107
9108 xxx(va_alist)
9109 va_dcl
9110 {
9111         va_list args;
9112         char buf[10];
9113
9114         va_start(args);
9115         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9116 }
9117 EOF
9118         set try
9119         if eval $compile && $run ./try; then
9120                 echo "Your vsprintf() returns (int)." >&4
9121                 val2="$undef"
9122         else
9123                 echo "Your vsprintf() returns (char*)." >&4
9124                 val2="$define"
9125         fi
9126 else
9127         echo 'vprintf() NOT found.' >&4
9128                 val="$undef"
9129                 val2="$undef"
9130 fi
9131 $rm -f try try.*
9132 set d_vprintf
9133 eval $setvar
9134 val=$val2
9135 set d_charvspr
9136 eval $setvar
9137
9138 : see if chown exists
9139 set chown d_chown
9140 eval $inlibc
9141
9142 : see if chroot exists
9143 set chroot d_chroot
9144 eval $inlibc
9145
9146 : see if chsize exists
9147 set chsize d_chsize
9148 eval $inlibc
9149
9150 : see if class exists
9151 set class d_class
9152 eval $inlibc
9153
9154 hasstruct='varname=$1; struct=$2; shift; shift;
9155 while $test $# -ge 2; do
9156         case "$1" in
9157         $define) echo "#include <$2>";;
9158         esac ;
9159     shift 2;
9160 done > try.c;
9161 echo "int main () { struct $struct foo; }" >> try.c;
9162 set try;
9163 if eval $compile; then
9164         val="$define";
9165 else
9166         val="$undef";
9167 fi;
9168 set $varname;
9169 eval $setvar;
9170 $rm -f try.c try.o'
9171
9172 : see if sys/types.h has to be included
9173 set sys/types.h i_systypes
9174 eval $inhdr
9175
9176 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9177 while $test $# -ge 2; do
9178         case "$1" in
9179         $define) echo "#include <$2>";;
9180         esac ;
9181     shift 2;
9182 done > try.c;
9183 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9184 set try;
9185 if eval $compile; then
9186         val="$define";
9187 else
9188         val="$undef";
9189 fi;
9190 set $varname;
9191 eval $setvar;
9192 $rm -f try.c try.o'
9193
9194 socketlib=''
9195 sockethdr=''
9196 : see whether socket exists
9197 echo " "
9198 $echo $n "Hmm... $c" >&4
9199 if set socket val -f d_socket; eval $csym; $val; then
9200         echo "Looks like you have Berkeley networking support." >&4
9201         d_socket="$define"
9202         if set setsockopt val -f; eval $csym; $val; then
9203                 d_oldsock="$undef"
9204         else
9205                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9206                 d_oldsock="$define"
9207         fi
9208 else
9209         if $contains socklib libc.list >/dev/null 2>&1; then
9210                 echo "Looks like you have Berkeley networking support." >&4
9211                 d_socket="$define"
9212                 : we will have to assume that it supports the 4.2 BSD interface
9213                 d_oldsock="$undef"
9214         else
9215                 echo "You don't have Berkeley networking in libc$_a..." >&4
9216                 if test "X$d_socket" = "X$define"; then
9217                    echo "...but you seem to believe that you have sockets." >&4
9218                 else
9219                         for net in net socket
9220                         do
9221                                 if test -f /usr/lib/lib$net$_a; then
9222                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9223                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9224                                         if $contains socket libc.list >/dev/null 2>&1; then
9225                                                 d_socket="$define"
9226                                                 socketlib="-l$net"
9227                                                 case "$net" in
9228                                                 net)
9229                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9230                                                         sockethdr="-I/usr/netinclude"
9231                                                         ;;
9232                                                 esac
9233                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9234                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9235                                                         d_oldsock="$undef"
9236                                                 else
9237                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9238                                                         d_oldsock="$define"
9239                                                 fi
9240                                                 break
9241                                         fi
9242                                 fi
9243                         done
9244                         if test "X$d_socket" != "X$define"; then
9245                            echo "or anywhere else I see." >&4
9246                            d_socket="$undef"
9247                            d_oldsock="$undef"
9248                         fi
9249                 fi
9250         fi
9251 fi
9252
9253 : see if socketpair exists
9254 set socketpair d_sockpair
9255 eval $inlibc
9256
9257
9258 echo " "
9259 echo "Checking the availability of certain socket constants..." >& 4
9260 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9261         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9262         $cat >try.c <<EOF
9263 #include <sys/types.h>
9264 #include <sys/socket.h>
9265 int main() {
9266     int i = $ENUM;
9267 }
9268 EOF
9269         val="$undef"
9270         set try; if eval $compile; then
9271                 val="$define"
9272         fi
9273         set d_${enum}; eval $setvar
9274         $rm -f try.c try
9275 done
9276
9277 : see if this is a sys/uio.h system
9278 set sys/uio.h i_sysuio
9279 eval $inhdr
9280
9281
9282 echo " "
9283 echo "Checking to see if your system supports struct cmsghdr..." >&4
9284 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9285 eval $hasstruct
9286 case "$d_cmsghdr_s" in
9287 "$define")      echo "Yes, it does."   ;;
9288 *)              echo "No, it doesn't." ;;
9289 esac
9290
9291
9292 : check for const keyword
9293 echo " "
9294 echo 'Checking to see if your C compiler knows about "const"...' >&4
9295 $cat >const.c <<'EOCP'
9296 typedef struct spug { int drokk; } spug;
9297 int main()
9298 {
9299         const char *foo;
9300         const spug y;
9301 }
9302 EOCP
9303 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9304         val="$define"
9305         echo "Yup, it does."
9306 else
9307         val="$undef"
9308         echo "Nope, it doesn't."
9309 fi
9310 set d_const
9311 eval $setvar
9312
9313 : see if crypt exists
9314 echo " "
9315 if set crypt val -f d_crypt; eval $csym; $val; then
9316         echo 'crypt() found.' >&4
9317         val="$define"
9318         cryptlib=''
9319 else
9320         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9321         if $test -z "$cryptlib"; then
9322                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9323         else
9324                 cryptlib=-lcrypt
9325         fi
9326         if $test -z "$cryptlib"; then
9327                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9328         else
9329                 cryptlib=-lcrypt
9330         fi
9331         if $test -z "$cryptlib"; then
9332                 cryptlib=`./loc libcrypt$_a "" $libpth`
9333         else
9334                 cryptlib=-lcrypt
9335         fi
9336         if $test -z "$cryptlib"; then
9337                 echo 'crypt() NOT found.' >&4
9338                 val="$undef"
9339         else
9340                 val="$define"
9341         fi
9342 fi
9343 set d_crypt
9344 eval $setvar
9345
9346 : get csh whereabouts
9347 case "$csh" in
9348 'csh') val="$undef" ;;
9349 *) val="$define" ;;
9350 esac
9351 set d_csh
9352 eval $setvar
9353 : Respect a hint or command line value for full_csh.
9354 case "$full_csh" in
9355 '') full_csh=$csh ;;
9356 esac
9357
9358 : see if cuserid exists
9359 set cuserid d_cuserid
9360 eval $inlibc
9361
9362 : see if this is a limits.h system
9363 set limits.h i_limits
9364 eval $inhdr
9365
9366 : see if this is a float.h system
9367 set float.h i_float
9368 eval $inhdr
9369
9370 : See if number of significant digits in a double precision number is known
9371 echo " "
9372 $cat >dbl_dig.c <<EOM
9373 #$i_limits I_LIMITS
9374 #$i_float I_FLOAT
9375 #ifdef I_LIMITS
9376 #include <limits.h>
9377 #endif
9378 #ifdef I_FLOAT
9379 #include <float.h>
9380 #endif
9381 #ifdef DBL_DIG
9382 printf("Contains DBL_DIG");
9383 #endif
9384 EOM
9385 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9386 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9387         echo "DBL_DIG found." >&4
9388         val="$define"
9389 else
9390         echo "DBL_DIG NOT found." >&4
9391         val="$undef"
9392 fi
9393 $rm -f dbl_dig.?
9394 set d_dbl_dig
9395 eval $setvar
9396
9397 hasproto='varname=$1; func=$2; shift; shift;
9398 while $test $# -ge 2; do
9399         case "$1" in
9400         $define) echo "#include <$2>";;
9401         esac ;
9402     shift 2;
9403 done > try.c;
9404 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9405 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9406         echo "$func() prototype found.";
9407         val="$define";
9408 else
9409         echo "$func() prototype NOT found.";
9410         val="$undef";
9411 fi;
9412 set $varname;
9413 eval $setvar;
9414 $rm -f try.c tryout.c'
9415
9416 : see if dbm.h is available
9417 : see if dbmclose exists
9418 set dbmclose d_dbmclose
9419 eval $inlibc
9420
9421 case "$d_dbmclose" in
9422 $define)
9423         set dbm.h i_dbm
9424         eval $inhdr
9425         case "$i_dbm" in
9426         $define)
9427                 val="$undef"
9428                 set i_rpcsvcdbm
9429                 eval $setvar
9430                 ;;
9431         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9432                 eval $inhdr
9433                 ;;
9434         esac
9435         ;;
9436 *)      echo "We won't be including <dbm.h>"
9437         val="$undef"
9438         set i_dbm
9439         eval $setvar
9440         val="$undef"
9441         set i_rpcsvcdbm
9442         eval $setvar
9443         ;;
9444 esac
9445
9446 : see if prototype for dbminit is available
9447 echo " "
9448 set d_dbminitproto dbminit $i_dbm dbm.h
9449 eval $hasproto
9450
9451 : see if difftime exists
9452 set difftime d_difftime
9453 eval $inlibc
9454
9455 : see if this is a dirent system
9456 echo " "
9457 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9458         val="$define"
9459         echo "<dirent.h> found." >&4
9460 else
9461         val="$undef"
9462         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9463                 echo "<sys/dir.h> found." >&4
9464                 echo " "
9465         else
9466                 xinc=`./findhdr sys/ndir.h`
9467         fi
9468         echo "<dirent.h> NOT found." >&4
9469 fi
9470 set i_dirent
9471 eval $setvar
9472
9473 : Look for type of directory structure.
9474 echo " "
9475 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9476
9477 case "$direntrytype" in
9478 ''|' ')
9479         case "$i_dirent" in
9480         $define) guess1='struct dirent' ;;
9481         *) guess1='struct direct'  ;;
9482         esac
9483         ;;
9484 *)      guess1="$direntrytype"
9485         ;;
9486 esac
9487
9488 case "$guess1" in
9489 'struct dirent') guess2='struct direct' ;;
9490 *) guess2='struct dirent' ;;
9491 esac
9492                 
9493 if $contains "$guess1" try.c >/dev/null 2>&1; then
9494         direntrytype="$guess1"
9495         echo "Your directory entries are $direntrytype." >&4
9496 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9497         direntrytype="$guess2"
9498         echo "Your directory entries seem to be $direntrytype." >&4
9499 else
9500         echo "I don't recognize your system's directory entries." >&4
9501         rp="What type is used for directory entries on this system?"
9502         dflt="$guess1"
9503         . ./myread
9504         direntrytype="$ans"
9505 fi
9506 $rm -f try.c
9507
9508
9509 : see if the directory entry stores field length
9510 echo " "
9511 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9512 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9513         echo "Good, your directory entry keeps length information in d_namlen." >&4
9514         val="$define"
9515 else
9516         echo "Your directory entry does not know about the d_namlen field." >&4
9517         val="$undef"
9518 fi
9519 set d_dirnamlen
9520 eval $setvar
9521 $rm -f try.c
9522
9523 : see if this is an sysdir system
9524 set sys/dir.h i_sysdir
9525 eval $inhdr
9526
9527 : see if this is an sysndir system
9528 set sys/ndir.h i_sysndir
9529 eval $inhdr
9530
9531 : Look for dirfd
9532 echo " "
9533 $cat >dirfd.c <<EOM
9534 #include <stdio.h>
9535 #$i_dirent I_DIRENT             /**/
9536 #$i_sysdir I_SYS_DIR            /**/
9537 #$i_sysndir I_SYS_NDIR          /**/
9538 #$i_systypes I_SYS_TYPES        /**/
9539 #if defined(I_SYS_TYPES)
9540 #include <sys/types.h>
9541 #endif
9542 #if defined(I_DIRENT)
9543 #include <dirent.h>
9544 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
9545 #include <sys/dir.h>
9546 #endif
9547 #else
9548 #ifdef I_SYS_NDIR
9549 #include <sys/ndir.h>
9550 #else
9551 #ifdef I_SYS_DIR
9552 #ifdef hp9000s500
9553 #include <ndir.h>       /* may be wrong in the future */
9554 #else
9555 #include <sys/dir.h>
9556 #endif
9557 #endif
9558 #endif
9559 #endif 
9560 int main() {
9561         DIR *dirp = opendir(".");
9562         if (dirfd(dirp) >= 0)
9563                 exit(0);
9564         else
9565                 exit(1);
9566 }
9567 EOM
9568 set dirfd
9569 if eval $compile; then
9570         val="$define"
9571 fi
9572 case "$val" in
9573 $define)        echo "dirfd() found." >&4       ;;
9574 *)              echo "dirfd() NOT found." >&4   ;;
9575 esac
9576 set d_dirfd
9577 eval $setvar
9578 $rm -f dirfd*
9579
9580 : see if dlerror exists
9581 xxx_runnm="$runnm"
9582 runnm=false
9583 set dlerror d_dlerror
9584 eval $inlibc
9585 runnm="$xxx_runnm"
9586
9587 : see if dlfcn is available
9588 set dlfcn.h i_dlfcn
9589 eval $inhdr
9590
9591 case "$usedl" in
9592 $define|y|true)
9593         $cat << EOM
9594
9595 On a few systems, the dynamically loaded modules that perl generates and uses
9596 will need a different extension than shared libs. The default will probably
9597 be appropriate.
9598
9599 EOM
9600         case "$dlext" in
9601         '')     dflt="$so" ;;
9602         *)      dflt="$dlext" ;;
9603         esac
9604         rp='What is the extension of dynamically loaded modules'
9605         . ./myread
9606         dlext="$ans"
9607         ;;
9608 *)
9609         dlext="none"
9610         ;;
9611 esac
9612
9613 : Check if dlsym need a leading underscore
9614 echo " "
9615 val="$undef"
9616
9617 case "$dlsrc" in
9618 dl_dlopen.xs)
9619         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9620         $cat >dyna.c <<'EOM'
9621 fred () { }
9622 EOM
9623
9624 $cat >fred.c<<EOM
9625
9626 #include <stdio.h>
9627 #$i_dlfcn I_DLFCN
9628 #ifdef I_DLFCN
9629 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9630 #else
9631 #include <sys/types.h>
9632 #include <nlist.h>
9633 #include <link.h>
9634 #endif
9635
9636 extern int fred() ;
9637
9638 int main()
9639 {
9640     void * handle ;
9641     void * symbol ;
9642 #ifndef RTLD_LAZY
9643     int mode = 1 ;
9644 #else
9645     int mode = RTLD_LAZY ;
9646 #endif
9647     handle = dlopen("./dyna.$dlext", mode) ;
9648     if (handle == NULL) {
9649         printf ("1\n") ;
9650         fflush (stdout) ;
9651         exit(0);
9652     }
9653     symbol = dlsym(handle, "fred") ;
9654     if (symbol == NULL) {
9655         /* try putting a leading underscore */
9656         symbol = dlsym(handle, "_fred") ;
9657         if (symbol == NULL) {
9658             printf ("2\n") ;
9659             fflush (stdout) ;
9660             exit(0);
9661         }
9662         printf ("3\n") ;
9663     }
9664     else
9665         printf ("4\n") ;
9666     fflush (stdout) ;
9667     exit(0);
9668 }
9669 EOM
9670         : Call the object file tmp-dyna.o in case dlext=o.
9671         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9672                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9673                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9674                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9675                 xxx=`$run ./fred`
9676                 case $xxx in
9677                 1)      echo "Test program failed using dlopen." >&4
9678                         echo "Perhaps you should not use dynamic loading." >&4;;
9679                 2)      echo "Test program failed using dlsym." >&4
9680                         echo "Perhaps you should not use dynamic loading." >&4;;
9681                 3)      echo "dlsym needs a leading underscore" >&4
9682                         val="$define" ;;
9683                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9684                 esac
9685         else
9686                 echo "I can't compile and run the test program." >&4
9687                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9688         fi
9689         ;;
9690 esac
9691                 
9692 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9693
9694 set d_dlsymun
9695 eval $setvar
9696
9697 : see if prototype for drand48 is available
9698 echo " "
9699 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9700 eval $hasproto
9701
9702 : see if dup2 exists
9703 set dup2 d_dup2
9704 eval $inlibc
9705
9706 : see if eaccess exists
9707 set eaccess d_eaccess
9708 eval $inlibc
9709
9710 : see if endgrent exists
9711 set endgrent d_endgrent
9712 eval $inlibc
9713
9714 : see if endhostent exists
9715 set endhostent d_endhent
9716 eval $inlibc
9717
9718 : see if endnetent exists
9719 set endnetent d_endnent
9720 eval $inlibc
9721
9722 : see if endprotoent exists
9723 set endprotoent d_endpent
9724 eval $inlibc
9725
9726 : see if endpwent exists
9727 set endpwent d_endpwent
9728 eval $inlibc
9729
9730 : see if endservent exists
9731 set endservent d_endsent
9732 eval $inlibc
9733
9734 : Locate the flags for 'open()'
9735 echo " "
9736 $cat >try.c <<'EOCP'
9737 #include <sys/types.h>
9738 #ifdef I_FCNTL
9739 #include <fcntl.h>
9740 #endif
9741 #ifdef I_SYS_FILE
9742 #include <sys/file.h>
9743 #endif
9744 int main() {
9745         if(O_RDONLY);
9746 #ifdef O_TRUNC
9747         exit(0);
9748 #else
9749         exit(1);
9750 #endif
9751 }
9752 EOCP
9753 : check sys/file.h first to get FREAD on Sun
9754 if $test `./findhdr sys/file.h` && \
9755                 set try -DI_SYS_FILE && eval $compile; then
9756         h_sysfile=true;
9757         echo "<sys/file.h> defines the O_* constants..." >&4
9758         if $run ./try; then
9759                 echo "and you have the 3 argument form of open()." >&4
9760                 val="$define"
9761         else
9762                 echo "but not the 3 argument form of open().  Oh, well." >&4
9763                 val="$undef"
9764         fi
9765 elif $test `./findhdr fcntl.h` && \
9766                 set try -DI_FCNTL && eval $compile; then
9767         h_fcntl=true;
9768         echo "<fcntl.h> defines the O_* constants..." >&4
9769         if $run ./try; then
9770                 echo "and you have the 3 argument form of open()." >&4
9771                 val="$define"
9772         else
9773                 echo "but not the 3 argument form of open().  Oh, well." >&4
9774                 val="$undef"
9775         fi
9776 else
9777         val="$undef"
9778         echo "I can't find the O_* constant definitions!  You got problems." >&4
9779 fi
9780 set d_open3
9781 eval $setvar
9782 $rm -f try try.*
9783
9784 : see which of string.h or strings.h is needed
9785 echo " "
9786 strings=`./findhdr string.h`
9787 if $test "$strings" && $test -r "$strings"; then
9788         echo "Using <string.h> instead of <strings.h>." >&4
9789         val="$define"
9790 else
9791         val="$undef"
9792         strings=`./findhdr strings.h`
9793         if $test "$strings" && $test -r "$strings"; then
9794                 echo "Using <strings.h> instead of <string.h>." >&4
9795         else
9796                 echo "No string header found -- You'll surely have problems." >&4
9797         fi
9798 fi
9799 set i_string
9800 eval $setvar
9801 case "$i_string" in
9802 "$undef") strings=`./findhdr strings.h`;;
9803 *)        strings=`./findhdr string.h`;;
9804 esac
9805
9806 : check for non-blocking I/O stuff
9807 case "$h_sysfile" in
9808 true) echo "#include <sys/file.h>" > head.c;;
9809 *)
9810        case "$h_fcntl" in
9811        true) echo "#include <fcntl.h>" > head.c;;
9812        *) echo "#include <sys/fcntl.h>" > head.c;;
9813        esac
9814        ;;
9815 esac
9816 echo " "
9817 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9818 case "$o_nonblock" in
9819 '')
9820         $cat head.c > try.c
9821         $cat >>try.c <<'EOCP'
9822 #include <stdio.h>
9823 #include <stdlib.h>
9824 int main() {
9825 #ifdef O_NONBLOCK
9826         printf("O_NONBLOCK\n");
9827         exit(0);
9828 #endif
9829 #ifdef O_NDELAY
9830         printf("O_NDELAY\n");
9831         exit(0);
9832 #endif
9833 #ifdef FNDELAY
9834         printf("FNDELAY\n");
9835         exit(0);
9836 #endif
9837         exit(0);
9838 }
9839 EOCP
9840         set try
9841         if eval $compile_ok; then
9842                 o_nonblock=`$run ./try`
9843                 case "$o_nonblock" in
9844                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9845                 *) echo "Seems like we can use $o_nonblock.";;
9846                 esac
9847         else
9848                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9849         fi
9850         ;;
9851 *) echo "Using $hint value $o_nonblock.";;
9852 esac
9853 $rm -f try try.* .out core
9854
9855 echo " "
9856 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9857 case "$eagain" in
9858 '')
9859         $cat head.c > try.c
9860         $cat >>try.c <<EOCP
9861 #include <errno.h>
9862 #include <sys/types.h>
9863 #include <signal.h>
9864 #include <stdio.h> 
9865 #include <stdlib.h> 
9866 #define MY_O_NONBLOCK $o_nonblock
9867 #ifndef errno  /* XXX need better Configure test */
9868 extern int errno;
9869 #endif
9870 #$i_unistd I_UNISTD
9871 #ifdef I_UNISTD
9872 #include <unistd.h>
9873 #endif
9874 #$i_string I_STRING
9875 #ifdef I_STRING
9876 #include <string.h>
9877 #else
9878 #include <strings.h>
9879 #endif
9880 $signal_t blech(x) int x; { exit(3); }
9881 EOCP
9882         $cat >> try.c <<'EOCP'
9883 int main()
9884 {
9885         int pd[2];
9886         int pu[2];
9887         char buf[1];
9888         char string[100];
9889
9890         pipe(pd);       /* Down: child -> parent */
9891         pipe(pu);       /* Up: parent -> child */
9892         if (0 != fork()) {
9893                 int ret;
9894                 close(pd[1]);   /* Parent reads from pd[0] */
9895                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9896 #ifdef F_SETFL
9897                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9898                         exit(1);
9899 #else
9900                 exit(4);
9901 #endif
9902                 signal(SIGALRM, blech);
9903                 alarm(5);
9904                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9905                         exit(2);
9906                 sprintf(string, "%d\n", ret);
9907                 write(2, string, strlen(string));
9908                 alarm(0);
9909 #ifdef EAGAIN
9910                 if (errno == EAGAIN) {
9911                         printf("EAGAIN\n");
9912                         goto ok;
9913                 }
9914 #endif
9915 #ifdef EWOULDBLOCK
9916                 if (errno == EWOULDBLOCK)
9917                         printf("EWOULDBLOCK\n");
9918 #endif
9919         ok:
9920                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9921                 sleep(2);                               /* Give it time to close our pipe */
9922                 alarm(5);
9923                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9924                 alarm(0);
9925                 sprintf(string, "%d\n", ret);
9926                 write(3, string, strlen(string));
9927                 exit(0);
9928         }
9929
9930         close(pd[0]);                   /* We write to pd[1] */
9931         close(pu[1]);                   /* We read from pu[0] */
9932         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9933         close(pd[1]);                   /* Pipe pd is now fully closed! */
9934         exit(0);                                /* Bye bye, thank you for playing! */
9935 }
9936 EOCP
9937         set try
9938         if eval $compile_ok; then
9939                 echo "$startsh" >mtry
9940                 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9941                 chmod +x mtry
9942                 ./mtry >/dev/null 2>&1
9943                 case $? in
9944                 0) eagain=`$cat try.out`;;
9945                 1) echo "Could not perform non-blocking setting!";;
9946                 2) echo "I did a successful read() for something that was not there!";;
9947                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9948                 4) echo "Could not find F_SETFL!";;
9949                 *) echo "Something terribly wrong happened during testing.";;
9950                 esac
9951                 rd_nodata=`$cat try.ret`
9952                 echo "A read() system call with no data present returns $rd_nodata."
9953                 case "$rd_nodata" in
9954                 0|-1) ;;
9955                 *)
9956                         echo "(That's peculiar, fixing that to be -1.)"
9957                         rd_nodata=-1
9958                         ;;
9959                 esac
9960                 case "$eagain" in
9961                 '')
9962                         echo "Forcing errno EAGAIN on read() with no data available."
9963                         eagain=EAGAIN
9964                         ;;
9965                 *)
9966                         echo "Your read() sets errno to $eagain when no data is available."
9967                         ;;
9968                 esac
9969                 status=`$cat try.err`
9970                 case "$status" in
9971                 0) echo "And it correctly returns 0 to signal EOF.";;
9972                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9973                 *) echo "However, your read() returns '$status' on EOF??";;
9974                 esac
9975                 val="$define"
9976                 if test "$status" = "$rd_nodata"; then
9977                         echo "WARNING: you can't distinguish between EOF and no data!"
9978                         val="$undef"
9979                 fi
9980         else
9981                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9982                 eagain=EAGAIN
9983         fi
9984         set d_eofnblk
9985         eval $setvar
9986         ;;
9987 *)
9988         echo "Using $hint value $eagain."
9989         echo "Your read() returns $rd_nodata when no data is present."
9990         case "$d_eofnblk" in
9991         "$define") echo "And you can see EOF because read() returns 0.";;
9992         "$undef") echo "But you can't see EOF status from read() returned value.";;
9993         *)
9994                 echo "(Assuming you can't see EOF status from read anyway.)"
9995                 d_eofnblk=$undef
9996                 ;;
9997         esac
9998         ;;
9999 esac
10000 $rm -f try try.* .out core head.c mtry
10001
10002 : see if fchdir exists
10003 set fchdir d_fchdir
10004 eval $inlibc
10005
10006 : see if fchmod exists
10007 set fchmod d_fchmod
10008 eval $inlibc
10009
10010 : see if fchown exists
10011 set fchown d_fchown
10012 eval $inlibc
10013
10014 : see if this is an fcntl system
10015 set fcntl d_fcntl
10016 eval $inlibc
10017
10018 echo " "
10019 : See if fcntl-based locking works.
10020 $cat >try.c <<EOCP
10021 #include <stdlib.h>
10022 #include <unistd.h>
10023 #include <fcntl.h>
10024 #include <signal.h>
10025 $signal_t blech(x) int x; { exit(3); }
10026 int main() {
10027 #if defined(F_SETLK) && defined(F_SETLKW)
10028      struct flock flock;
10029      int retval, fd;
10030      fd = open("try.c", O_RDONLY);
10031      flock.l_type = F_RDLCK;
10032      flock.l_whence = SEEK_SET;
10033      flock.l_start = flock.l_len = 0;
10034      signal(SIGALRM, blech);
10035      alarm(10);
10036      retval = fcntl(fd, F_SETLK, &flock);
10037      close(fd);
10038      (retval < 0 ? exit(2) : exit(0));
10039 #else
10040      exit(2);
10041 #endif
10042 }
10043 EOCP
10044 echo "Checking if fcntl-based file locking works... "
10045 case "$d_fcntl" in
10046 "$define")
10047         set try
10048         if eval $compile_ok; then
10049                 if $run ./try; then
10050                         echo "Yes, it seems to work."
10051                         val="$define"
10052                 else
10053                         echo "Nope, it didn't work."
10054                         val="$undef"
10055                         case "$?" in
10056                         3) $cat >&4 <<EOM
10057 ***
10058 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
10059 *** This is (almost) impossible.
10060 *** If your NFS lock daemons are not feeling well, something like
10061 *** this may happen, please investigate.  Cannot continue, aborting.
10062 ***
10063 EOM
10064                                 exit 1
10065                                 ;;
10066                         esac
10067                 fi
10068         else
10069                 echo "I'm unable to compile the test program, so I'll assume not."
10070                 val="$undef"
10071         fi
10072         ;;
10073 *) val="$undef";
10074         echo "Nope, since you don't even have fcntl()."
10075         ;;
10076 esac
10077 set d_fcntl_can_lock
10078 eval $setvar
10079 $rm -f try*
10080
10081
10082 : see if sys/select.h has to be included
10083 set sys/select.h i_sysselct
10084 eval $inhdr
10085
10086 : see if we should include time.h, sys/time.h, or both
10087 echo " "
10088 if test "X$timeincl" = X; then
10089         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10090         $echo $n "I'm now running the test program...$c"
10091         $cat >try.c <<'EOCP'
10092 #include <sys/types.h>
10093 #ifdef I_TIME
10094 #include <time.h>
10095 #endif
10096 #ifdef I_SYSTIME
10097 #ifdef SYSTIMEKERNEL
10098 #define KERNEL
10099 #endif
10100 #include <sys/time.h>
10101 #endif
10102 #ifdef I_SYSSELECT
10103 #include <sys/select.h>
10104 #endif
10105 int main()
10106 {
10107         struct tm foo;
10108 #ifdef S_TIMEVAL
10109         struct timeval bar;
10110 #endif
10111 #ifdef S_TIMEZONE
10112         struct timezone tzp;
10113 #endif
10114         if (foo.tm_sec == foo.tm_sec)
10115                 exit(0);
10116 #ifdef S_TIMEVAL
10117         if (bar.tv_sec == bar.tv_sec)
10118                 exit(0);
10119 #endif
10120         exit(1);
10121 }
10122 EOCP
10123         flags=''
10124         for s_timezone in '-DS_TIMEZONE' ''; do
10125         sysselect=''
10126         for s_timeval in '-DS_TIMEVAL' ''; do
10127         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10128         for i_time in '' '-DI_TIME'; do
10129         for i_systime in '-DI_SYSTIME' ''; do
10130                 case "$flags" in
10131                 '') $echo $n ".$c"
10132                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10133                         if eval $compile; then
10134                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10135                                 shift
10136                                 flags="$*"
10137                                 echo " "
10138                                 $echo $n "Succeeded with $flags$c"
10139                         fi
10140                         ;;
10141                 esac
10142         done
10143         done
10144         done
10145         done
10146         done
10147         timeincl=''
10148         echo " "
10149         case "$flags" in
10150         *SYSTIMEKERNEL*) i_systimek="$define"
10151                 timeincl=`./findhdr sys/time.h`
10152                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10153         *) i_systimek="$undef";;
10154         esac
10155         case "$flags" in
10156         *I_TIME*) i_time="$define"
10157                 timeincl=`./findhdr time.h`" $timeincl"
10158                 echo "We'll include <time.h>." >&4;;
10159         *) i_time="$undef";;
10160         esac
10161         case "$flags" in
10162         *I_SYSTIME*) i_systime="$define"
10163                 timeincl=`./findhdr sys/time.h`" $timeincl"
10164                 echo "We'll include <sys/time.h>." >&4;;
10165         *) i_systime="$undef";;
10166         esac
10167         $rm -f try.c try
10168 fi
10169
10170 : check for fd_set items
10171 $cat <<EOM
10172
10173 Checking to see how well your C compiler handles fd_set and friends ...
10174 EOM
10175 $cat >try.c <<EOCP
10176 #$i_systime I_SYS_TIME
10177 #$i_sysselct I_SYS_SELECT
10178 #$d_socket HAS_SOCKET
10179 #include <sys/types.h>
10180 #ifdef HAS_SOCKET
10181 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10182 #endif
10183 #ifdef I_SYS_TIME
10184 #include <sys/time.h>
10185 #endif
10186 #ifdef I_SYS_SELECT
10187 #include <sys/select.h>
10188 #endif
10189 int main() {
10190         fd_set fds;
10191
10192 #ifdef TRYBITS
10193         if(fds.fds_bits);
10194 #endif
10195
10196 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10197         exit(0);
10198 #else
10199         exit(1);
10200 #endif
10201 }
10202 EOCP
10203 set try -DTRYBITS
10204 if eval $compile; then
10205         d_fds_bits="$define"
10206         d_fd_set="$define"
10207         echo "Well, your system knows about the normal fd_set typedef..." >&4
10208         if $run ./try; then
10209                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10210                 d_fd_macros="$define"
10211         else
10212                 $cat >&4 <<'EOM'
10213 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10214 EOM
10215                 d_fd_macros="$undef"
10216         fi
10217 else
10218         $cat <<'EOM'
10219 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10220 EOM
10221         set try
10222         if eval $compile; then
10223                 d_fds_bits="$undef"
10224                 d_fd_set="$define"
10225                 echo "Well, your system has some sort of fd_set available..." >&4
10226                 if $run ./try; then
10227                         echo "and you have the normal fd_set macros." >&4
10228                         d_fd_macros="$define"
10229                 else
10230                         $cat <<'EOM'
10231 but not the normal fd_set macros!  Gross!  More work for me...
10232 EOM
10233                         d_fd_macros="$undef"
10234                 fi
10235         else
10236         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10237                 d_fd_set="$undef"
10238                 d_fds_bits="$undef"
10239                 d_fd_macros="$undef"
10240         fi
10241 fi
10242 $rm -f try try.*
10243
10244 : see if fgetpos exists
10245 set fgetpos d_fgetpos
10246 eval $inlibc
10247
10248 : see if finite exists
10249 set finite d_finite
10250 eval $inlibc
10251
10252 : see if finitel exists
10253 set finitel d_finitel
10254 eval $inlibc
10255
10256 : see if flock exists
10257 set flock d_flock
10258 eval $inlibc
10259
10260 : see if this is a sys/file.h system
10261 val=''
10262 set sys/file.h val
10263 eval $inhdr
10264
10265 : do we need to include sys/file.h ?
10266 case "$val" in
10267 "$define")
10268         echo " "
10269         if $h_sysfile; then
10270                 val="$define"
10271                 echo "We'll be including <sys/file.h>." >&4
10272         else
10273                 val="$undef"
10274                 echo "We won't be including <sys/file.h>." >&4
10275         fi
10276         ;;
10277 *)
10278         h_sysfile=false
10279         ;;
10280 esac
10281 set i_sysfile
10282 eval $setvar
10283
10284 : see if prototype for flock is available
10285 echo " "
10286 set d_flockproto flock $i_sysfile sys/file.h
10287 eval $hasproto
10288
10289 : see if fork exists
10290 set fork d_fork
10291 eval $inlibc
10292
10293 : see if fp_class exists
10294 set fp_class d_fp_class
10295 eval $inlibc
10296
10297 : see if pathconf exists
10298 set pathconf d_pathconf
10299 eval $inlibc
10300
10301 : see if fpathconf exists
10302 set fpathconf d_fpathconf
10303 eval $inlibc
10304
10305 : see if fpclass exists
10306 set fpclass d_fpclass
10307 eval $inlibc
10308
10309 : see if fpclassify exists
10310 set fpclassify d_fpclassify
10311 eval $inlibc
10312
10313 : see if fpclassl exists
10314 set fpclassl d_fpclassl
10315 eval $inlibc
10316
10317
10318 : check for fpos64_t
10319 echo " "
10320 echo "Checking to see if you have fpos64_t..." >&4
10321 $cat >try.c <<EOCP
10322 #include <stdio.h>
10323 int main() { fpos64_t x = 7; }
10324 EOCP
10325 set try
10326 if eval $compile; then
10327         val="$define"
10328         echo "You have fpos64_t."
10329 else
10330         val="$undef"
10331         echo "You do not have fpos64_t."
10332         case "$fpossize" in
10333         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10334         esac
10335 fi
10336 $rm -f try.* try
10337 set d_fpos64_t
10338 eval $setvar
10339
10340 : see if frexpl exists
10341 set frexpl d_frexpl
10342 eval $inlibc
10343
10344 : see if this is a sys/param system
10345 set sys/param.h i_sysparam
10346 eval $inhdr
10347
10348 : see if this is a sys/mount.h system
10349 set sys/mount.h i_sysmount
10350 eval $inhdr
10351
10352
10353 echo " "
10354 echo "Checking to see if your system supports struct fs_data..." >&4
10355 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10356 eval $hasstruct
10357 case "$d_fs_data_s" in
10358 "$define")      echo "Yes, it does."   ;;
10359 *)              echo "No, it doesn't." ;;
10360 esac
10361
10362 : see if fseeko exists
10363 set fseeko d_fseeko
10364 eval $inlibc
10365 case "$longsize" in
10366 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10367 esac
10368
10369 : see if fsetpos exists
10370 set fsetpos d_fsetpos
10371 eval $inlibc
10372
10373
10374 : see if fstatfs exists
10375 set fstatfs d_fstatfs
10376 eval $inlibc
10377
10378
10379 : see if statvfs exists
10380 set statvfs d_statvfs
10381 eval $inlibc
10382
10383 : see if fstatvfs exists
10384 set fstatvfs d_fstatvfs
10385 eval $inlibc
10386
10387
10388 : see if fsync exists
10389 set fsync d_fsync
10390 eval $inlibc
10391
10392 : see if ftello exists
10393 set ftello d_ftello
10394 eval $inlibc
10395 case "$longsize" in
10396 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10397 esac
10398
10399 : see if getcwd exists
10400 set getcwd d_getcwd
10401 eval $inlibc
10402
10403 : see if getespwnam exists
10404 set getespwnam d_getespwnam
10405 eval $inlibc
10406
10407
10408 : see if getfsstat exists
10409 set getfsstat d_getfsstat
10410 eval $inlibc
10411
10412 : see if getgrent exists
10413 set getgrent d_getgrent
10414 eval $inlibc
10415
10416 : see if gethostbyaddr exists
10417 set gethostbyaddr d_gethbyaddr
10418 eval $inlibc
10419
10420 : see if gethostbyname exists
10421 set gethostbyname d_gethbyname
10422 eval $inlibc
10423
10424 : see if gethostent exists
10425 set gethostent d_gethent
10426 eval $inlibc
10427
10428 : see how we will look up host name
10429 echo " "
10430 call=''
10431 if set gethostname val -f d_gethname; eval $csym; $val; then
10432         echo 'gethostname() found.' >&4
10433         d_gethname="$define"
10434         call=gethostname
10435 fi
10436 if set uname val -f d_uname; eval $csym; $val; then
10437         if ./xenix; then
10438                 $cat <<'EOM'
10439 uname() was found, but you're running xenix, and older versions of xenix
10440 have a broken uname(). If you don't really know whether your xenix is old
10441 enough to have a broken system call, use the default answer.
10442
10443 EOM
10444                 dflt=y
10445                 case "$d_uname" in
10446                 "$define") dflt=n;;
10447                 esac
10448                 rp='Is your uname() broken?'
10449                 . ./myread
10450                 case "$ans" in
10451                 n*) d_uname="$define"; call=uname;;
10452                 esac
10453         else
10454                 echo 'uname() found.' >&4
10455                 d_uname="$define"
10456                 case "$call" in
10457                 '') call=uname ;;
10458                 esac
10459         fi
10460 fi
10461 case "$d_gethname" in
10462 '') d_gethname="$undef";;
10463 esac
10464 case "$d_uname" in
10465 '') d_uname="$undef";;
10466 esac
10467 case "$d_uname$d_gethname" in
10468 *define*)
10469         dflt=n
10470         cat <<EOM
10471  
10472 Every now and then someone has a $call() that lies about the hostname
10473 but can't be fixed for political or economic reasons.  If you wish, I can
10474 pretend $call() isn't there and maybe compute hostname at run-time
10475 thanks to the '$phostname' command.
10476
10477 EOM
10478         rp="Shall I ignore $call() from now on?"
10479         . ./myread
10480         case "$ans" in
10481         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10482         esac;;
10483 esac
10484 case "$phostname" in
10485 '') aphostname='';;
10486 *) case "$aphostname" in
10487         /*) ;;
10488         *) set X $phostname
10489                 shift
10490                 file=$1
10491                 shift
10492                 file=`./loc $file $file $pth`
10493                 aphostname=`echo $file $*`
10494                 ;;
10495         esac
10496         ;;
10497 esac
10498 case "$d_uname$d_gethname" in
10499 *define*) ;;
10500 *)
10501         case "$phostname" in
10502         '')
10503                 echo "There will be no way for $package to get your hostname." >&4;;
10504         *)
10505         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10506                 ;;
10507         esac;;
10508 esac
10509 case "$d_phostname" in
10510 '') d_phostname="$undef";;
10511 esac
10512
10513 : see if this is a netdb.h system
10514 set netdb.h i_netdb
10515 eval $inhdr
10516
10517 : see if prototypes for various gethostxxx netdb.h functions are available
10518 echo " "
10519 set d_gethostprotos gethostent $i_netdb netdb.h
10520 eval $hasproto
10521
10522 : see if getitimer exists
10523 set getitimer d_getitimer
10524 eval $inlibc
10525
10526 : see if getlogin exists
10527 set getlogin d_getlogin
10528 eval $inlibc
10529
10530 : see if getmnt exists
10531 set getmnt d_getmnt
10532 eval $inlibc
10533
10534 : see if getmntent exists
10535 set getmntent d_getmntent
10536 eval $inlibc
10537
10538 : see if getnetbyaddr exists
10539 set getnetbyaddr d_getnbyaddr
10540 eval $inlibc
10541
10542 : see if getnetbyname exists
10543 set getnetbyname d_getnbyname
10544 eval $inlibc
10545
10546 : see if getnetent exists
10547 set getnetent d_getnent
10548 eval $inlibc
10549
10550 : see if prototypes for various getnetxxx netdb.h functions are available
10551 echo " "
10552 set d_getnetprotos getnetent $i_netdb netdb.h
10553 eval $hasproto
10554
10555 : see if getpagesize exists
10556 set getpagesize d_getpagsz
10557 eval $inlibc
10558
10559
10560 : see if getprotobyname exists
10561 set getprotobyname d_getpbyname
10562 eval $inlibc
10563
10564 : see if getprotobynumber exists
10565 set getprotobynumber d_getpbynumber
10566 eval $inlibc
10567
10568 : see if getprotoent exists
10569 set getprotoent d_getpent
10570 eval $inlibc
10571
10572 : see if getpgid exists
10573 set getpgid d_getpgid
10574 eval $inlibc
10575
10576 : see if getpgrp2 exists
10577 set getpgrp2 d_getpgrp2
10578 eval $inlibc
10579
10580 : see if getppid exists
10581 set getppid d_getppid
10582 eval $inlibc
10583
10584 : see if getpriority exists
10585 set getpriority d_getprior
10586 eval $inlibc
10587
10588 : see if prototypes for various getprotoxxx netdb.h functions are available
10589 echo " "
10590 set d_getprotoprotos getprotoent $i_netdb netdb.h
10591 eval $hasproto
10592
10593 : see if getprpwnam exists
10594 set getprpwnam d_getprpwnam
10595 eval $inlibc
10596
10597 : see if getpwent exists
10598 set getpwent d_getpwent
10599 eval $inlibc
10600
10601
10602 : see if getservbyname exists
10603 set getservbyname d_getsbyname
10604 eval $inlibc
10605
10606 : see if getservbyport exists
10607 set getservbyport d_getsbyport
10608 eval $inlibc
10609
10610 : see if getservent exists
10611 set getservent d_getsent
10612 eval $inlibc
10613
10614 : see if prototypes for various getservxxx netdb.h functions are available
10615 echo " "
10616 set d_getservprotos getservent $i_netdb netdb.h
10617 eval $hasproto
10618
10619 : see if getspnam exists
10620 set getspnam d_getspnam
10621 eval $inlibc
10622
10623 : see if gettimeofday or ftime exists
10624 set gettimeofday d_gettimeod
10625 eval $inlibc
10626 case "$d_gettimeod" in
10627 "$undef")
10628         set ftime d_ftime 
10629         eval $inlibc
10630         ;;
10631 *)
10632         val="$undef"; set d_ftime; eval $setvar
10633         ;;
10634 esac
10635 case "$d_gettimeod$d_ftime" in
10636 "$undef$undef")
10637         echo " "
10638         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10639         ;;
10640 esac
10641
10642 : see if this is an grp system
10643 set grp.h i_grp
10644 eval $inhdr
10645
10646 case "$i_grp" in
10647 $define)
10648         xxx=`./findhdr grp.h`
10649         $cppstdin $cppflags $cppminus < $xxx >$$.h
10650
10651         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10652                 val="$define"
10653         else
10654                 val="$undef"
10655         fi
10656         set d_grpasswd
10657         eval $setvar
10658
10659         $rm -f $$.h
10660         ;;
10661 *)
10662         val="$undef";
10663         set d_grpasswd; eval $setvar
10664         ;;
10665 esac
10666
10667 : see if hasmntopt exists
10668 set hasmntopt d_hasmntopt
10669 eval $inlibc
10670
10671 : see if this is a netinet/in.h or sys/in.h system
10672 set netinet/in.h i_niin sys/in.h i_sysin
10673 eval $inhdr
10674
10675 : see if arpa/inet.h has to be included
10676 set arpa/inet.h i_arpainet
10677 eval $inhdr
10678
10679 : see if htonl --and friends-- exists
10680 val=''
10681 set htonl val
10682 eval $inlibc
10683
10684 : Maybe they are macros.
10685 case "$val" in
10686 $undef)
10687         $cat >htonl.c <<EOM
10688 #include <stdio.h>
10689 #include <sys/types.h>
10690 #$i_niin I_NETINET_IN
10691 #$i_sysin I_SYS_IN
10692 #$i_arpainet I_ARPA_INET
10693 #ifdef I_NETINET_IN
10694 #include <netinet/in.h>
10695 #endif
10696 #ifdef I_SYS_IN
10697 #include <sys/in.h>
10698 #endif
10699 #ifdef I_ARPA_INET
10700 #include <arpa/inet.h>
10701 #endif
10702 #ifdef htonl
10703 printf("Defined as a macro.");
10704 #endif
10705 EOM
10706         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10707         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10708                 val="$define"
10709                 echo "But it seems to be defined as a macro." >&4
10710         fi
10711         $rm -f htonl.?
10712         ;;
10713 esac
10714 set d_htonl
10715 eval $setvar
10716
10717 : index or strchr
10718 echo " "
10719 if set index val -f; eval $csym; $val; then
10720         if set strchr val -f d_strchr; eval $csym; $val; then
10721                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10722                         val="$define"
10723                         vali="$undef"
10724                         echo "strchr() found." >&4
10725                 else
10726                         val="$undef"
10727                         vali="$define"
10728                         echo "index() found." >&4
10729                 fi
10730         else
10731                 val="$undef"
10732                 vali="$define"
10733                 echo "index() found." >&4
10734         fi
10735 else
10736         if set strchr val -f d_strchr; eval $csym; $val; then
10737                 val="$define"
10738                 vali="$undef"
10739                 echo "strchr() found." >&4
10740         else
10741                 echo "No index() or strchr() found!" >&4
10742                 val="$undef"
10743                 vali="$undef"
10744         fi
10745 fi
10746 set d_strchr; eval $setvar
10747 val="$vali"
10748 set d_index; eval $setvar
10749
10750 : check whether inet_aton exists
10751 set inet_aton d_inetaton
10752 eval $inlibc
10753
10754 : Look for isascii
10755 echo " "
10756 $cat >isascii.c <<'EOCP'
10757 #include <stdio.h>
10758 #include <ctype.h>
10759 int main() {
10760         int c = 'A';
10761         if (isascii(c))
10762                 exit(0);
10763         else
10764                 exit(1);
10765 }
10766 EOCP
10767 set isascii
10768 if eval $compile; then
10769         echo "isascii() found." >&4
10770         val="$define"
10771 else
10772         echo "isascii() NOT found." >&4
10773         val="$undef"
10774 fi
10775 set d_isascii
10776 eval $setvar
10777 $rm -f isascii*
10778
10779 : see if isfinite exists
10780 set isfinite d_isfinite
10781 eval $inlibc
10782
10783 : see if isinf exists
10784 set isinf d_isinf
10785 eval $inlibc
10786
10787 : see if isnan exists
10788 set isnan d_isnan
10789 eval $inlibc
10790
10791 : see if isnanl exists
10792 set isnanl d_isnanl
10793 eval $inlibc
10794
10795 : see if killpg exists
10796 set killpg d_killpg
10797 eval $inlibc
10798
10799 : see if lchown exists
10800 echo " "
10801 $cat > try.c <<'EOCP'
10802 /* System header to define __stub macros and hopefully few prototypes,
10803     which can conflict with char lchown(); below.  */
10804 #include <assert.h>
10805 /* Override any gcc2 internal prototype to avoid an error.  */
10806 /* We use char because int might match the return type of a gcc2
10807    builtin and then its argument prototype would still apply.  */
10808 char lchown();
10809 int main() {
10810     /*  The GNU C library defines this for functions which it implements
10811         to always fail with ENOSYS.  Some functions are actually named
10812         something starting with __ and the normal name is an alias.  */
10813 #if defined (__stub_lchown) || defined (__stub___lchown)
10814 choke me
10815 #else
10816 lchown();
10817 #endif
10818 ; return 0; }
10819 EOCP
10820 set try
10821 if eval $compile; then
10822     $echo "lchown() found." >&4
10823     val="$define"
10824 else
10825     $echo "lchown() NOT found." >&4
10826     val="$undef"
10827 fi
10828 set d_lchown
10829 eval $setvar
10830
10831 : See if number of significant digits in a double precision number is known
10832 echo " "
10833 $cat >ldbl_dig.c <<EOM
10834 #$i_limits I_LIMITS
10835 #$i_float I_FLOAT
10836 #ifdef I_LIMITS
10837 #include <limits.h>
10838 #endif
10839 #ifdef I_FLOAT
10840 #include <float.h>
10841 #endif
10842 #ifdef LDBL_DIG
10843 printf("Contains LDBL_DIG");
10844 #endif
10845 EOM
10846 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10847 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10848         echo "LDBL_DIG found." >&4
10849         val="$define"
10850 else
10851         echo "LDBL_DIG NOT found." >&4
10852         val="$undef"
10853 fi
10854 $rm -f ldbl_dig.?
10855 set d_ldbl_dig
10856 eval $setvar
10857
10858 : see if link exists
10859 set link d_link
10860 eval $inlibc
10861
10862 : see if localeconv exists
10863 set localeconv d_locconv
10864 eval $inlibc
10865
10866 : see if lockf exists
10867 set lockf d_lockf
10868 eval $inlibc
10869
10870 : see if prototype for lseek is available
10871 echo " "
10872 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10873 eval $hasproto
10874
10875 : see if lstat exists
10876 set lstat d_lstat
10877 eval $inlibc
10878
10879 : see if madvise exists
10880 set madvise d_madvise
10881 eval $inlibc
10882
10883 : see if mblen exists
10884 set mblen d_mblen
10885 eval $inlibc
10886
10887 : see if mbstowcs exists
10888 set mbstowcs d_mbstowcs
10889 eval $inlibc
10890
10891 : see if mbtowc exists
10892 set mbtowc d_mbtowc
10893 eval $inlibc
10894
10895 : see if memchr exists
10896 set memchr d_memchr
10897 eval $inlibc
10898
10899 : see if memcmp exists
10900 set memcmp d_memcmp
10901 eval $inlibc
10902
10903 : see if memcpy exists
10904 set memcpy d_memcpy
10905 eval $inlibc
10906
10907 : see if memmove exists
10908 set memmove d_memmove
10909 eval $inlibc
10910
10911 : see if memset exists
10912 set memset d_memset
10913 eval $inlibc
10914
10915 : see if mkdir exists
10916 set mkdir d_mkdir
10917 eval $inlibc
10918
10919 : see if mkdtemp exists
10920 set mkdtemp d_mkdtemp
10921 eval $inlibc
10922
10923 : see if mkfifo exists
10924 set mkfifo d_mkfifo
10925 eval $inlibc
10926
10927 : see if mkstemp exists
10928 set mkstemp d_mkstemp
10929 eval $inlibc
10930
10931 : see if mkstemps exists
10932 set mkstemps d_mkstemps
10933 eval $inlibc
10934
10935 : see if mktime exists
10936 set mktime d_mktime
10937 eval $inlibc
10938
10939 : see if this is a sys/mman.h system
10940 set sys/mman.h i_sysmman
10941 eval $inhdr
10942
10943 : see if mmap exists
10944 set mmap d_mmap
10945 eval $inlibc
10946 : see what shmat returns
10947 : default to something harmless
10948 mmaptype='void *'
10949 case "$i_sysmman$d_mmap" in
10950 "$define$define")
10951         $cat >mmap.c <<'END'
10952 #include <sys/mman.h>
10953 void *mmap();
10954 END
10955         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10956                 mmaptype='void *'
10957         else
10958                 mmaptype='caddr_t'
10959         fi
10960         echo "and it returns ($mmaptype)." >&4
10961         ;;
10962 esac
10963
10964
10965
10966 : see if modfl exists
10967 set modfl d_modfl
10968 eval $inlibc
10969
10970 d_modfl_pow32_bug="$undef"
10971
10972 case "$d_longdbl$d_modfl" in
10973 $define$define)
10974         $cat <<EOM
10975 Checking to see whether your modfl() is okay for large values...
10976 EOM
10977 $cat >try.c <<EOCP
10978 #include <math.h> 
10979 #include <stdio.h>
10980 int main() {
10981     long double nv = 4294967303.15;
10982     long double v, w;
10983     v = modfl(nv, &w);         
10984 #ifdef __GLIBC__
10985     printf("glibc");
10986 #endif
10987     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10988     return 0;
10989 }
10990 EOCP
10991         case "$osname:$gccversion" in
10992         aix:)   saveccflags="$ccflags"
10993                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10994         esac
10995         set try
10996         if eval $compile; then
10997                 foo=`$run ./try`
10998                 case "$foo" in
10999                 *" 4294967303.150000 1.150000 4294967302.000000")
11000                         echo >&4 "Your modfl() is broken for large values."
11001                         d_modfl_pow32_bug="$define"
11002                         case "$foo" in
11003                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
11004                         ;;
11005                         esac
11006                         ;;
11007                 *" 4294967303.150000 0.150000 4294967303.000000")
11008                         echo >&4 "Your modfl() seems okay for large values."
11009                         ;;
11010                 *)      echo >&4 "I don't understand your modfl() at all."
11011                         d_modfl="$undef"
11012                         ;;
11013                 esac
11014                 $rm -f try.* try core core.try.*
11015         else
11016                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
11017                 d_modfl="$undef"
11018         fi
11019         case "$osname:$gccversion" in
11020         aix:)   ccflags="$saveccflags" ;; # restore
11021         esac
11022         ;;
11023 esac
11024
11025 : see if mprotect exists
11026 set mprotect d_mprotect
11027 eval $inlibc
11028
11029 : see if msgctl exists
11030 set msgctl d_msgctl
11031 eval $inlibc
11032
11033 : see if msgget exists
11034 set msgget d_msgget
11035 eval $inlibc
11036
11037 : see if msgsnd exists
11038 set msgsnd d_msgsnd
11039 eval $inlibc
11040
11041 : see if msgrcv exists
11042 set msgrcv d_msgrcv
11043 eval $inlibc
11044
11045 : see how much of the 'msg*(2)' library is present.
11046 h_msg=true
11047 echo " "
11048 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
11049 *"$undef"*) h_msg=false;;
11050 esac
11051 case "$osname" in
11052 freebsd)
11053     case "`ipcs 2>&1`" in
11054     "SVID messages"*"not configured"*)
11055         echo "Your $osname does not have the msg*(2) configured." >&4
11056         h_msg=false
11057         val="$undef"
11058         set msgctl d_msgctl
11059         eval $setvar
11060         set msgget d_msgget
11061         eval $setvar
11062         set msgsnd d_msgsnd
11063         eval $setvar
11064         set msgrcv d_msgrcv
11065         eval $setvar
11066         ;;
11067     esac
11068     ;;
11069 esac
11070 : we could also check for sys/ipc.h ...
11071 if $h_msg && $test `./findhdr sys/msg.h`; then
11072         echo "You have the full msg*(2) library." >&4
11073         val="$define"
11074 else
11075         echo "You don't have the full msg*(2) library." >&4
11076         val="$undef"
11077 fi
11078 set d_msg
11079 eval $setvar
11080
11081
11082 echo " "
11083 echo "Checking to see if your system supports struct msghdr..." >&4
11084 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11085 eval $hasstruct
11086 case "$d_msghdr_s" in
11087 "$define")      echo "Yes, it does."   ;;
11088 *)              echo "No, it doesn't." ;;
11089 esac
11090
11091
11092 : see if msync exists
11093 set msync d_msync
11094 eval $inlibc
11095
11096 : see if munmap exists
11097 set munmap d_munmap
11098 eval $inlibc
11099
11100 : see if nice exists
11101 set nice d_nice
11102 eval $inlibc
11103
11104 : see if this is a langinfo.h system
11105 set langinfo.h i_langinfo
11106 eval $inhdr
11107
11108 : see if nl_langinfo exists
11109 set nl_langinfo d_nl_langinfo
11110 eval $inlibc
11111
11112 : check for length of character
11113 echo " "
11114 case "$charsize" in
11115 '')
11116         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11117         $cat >try.c <<'EOCP'
11118 #include <stdio.h>
11119 int main()
11120 {
11121     printf("%d\n", (int)sizeof(char));
11122     exit(0);
11123 }
11124 EOCP
11125         set try
11126         if eval $compile_ok; then
11127                 dflt=`$run ./try`
11128         else
11129                 dflt='1'
11130                 echo "(I can't seem to compile the test program.  Guessing...)"
11131         fi
11132         ;;
11133 *)
11134         dflt="$charsize"
11135         ;;
11136 esac
11137 rp="What is the size of a character (in bytes)?"
11138 . ./myread
11139 charsize="$ans"
11140 $rm -f try.c try
11141
11142 : check for volatile keyword
11143 echo " "
11144 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11145 $cat >try.c <<'EOCP'
11146 int main()
11147 {
11148         typedef struct _goo_struct goo_struct;
11149         goo_struct * volatile goo = ((goo_struct *)0);
11150         struct _goo_struct {
11151                 long long_int;
11152                 int reg_int;
11153                 char char_var;
11154         };
11155         typedef unsigned short foo_t;
11156         char *volatile foo;
11157         volatile int bar;
11158         volatile foo_t blech;
11159         foo = foo;
11160 }
11161 EOCP
11162 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11163         val="$define"
11164         echo "Yup, it does."
11165 else
11166         val="$undef"
11167         echo "Nope, it doesn't."
11168 fi
11169 set d_volatile
11170 eval $setvar
11171 $rm -f try.*
11172
11173
11174 echo " "
11175 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11176
11177 case "$use64bitint:$d_quad:$quadtype" in
11178 define:define:?*)
11179         ivtype="$quadtype"
11180         uvtype="$uquadtype"
11181         ivsize=8
11182         uvsize=8
11183         ;;
11184 *)      ivtype="long"
11185         uvtype="unsigned long"
11186         ivsize=$longsize
11187         uvsize=$longsize
11188         ;;
11189 esac
11190
11191 case "$uselongdouble:$d_longdbl" in
11192 define:define)
11193         nvtype="long double"
11194         nvsize=$longdblsize
11195         ;;
11196 *)      nvtype=double
11197         nvsize=$doublesize
11198         ;;
11199 esac
11200
11201 $echo "(IV will be "$ivtype", $ivsize bytes)"
11202 $echo "(UV will be "$uvtype", $uvsize bytes)"
11203 $echo "(NV will be "$nvtype", $nvsize bytes)"
11204
11205 $cat >try.c <<EOCP
11206 #$i_inttypes I_INTTYPES
11207 #ifdef I_INTTYPES
11208 #include <inttypes.h>
11209 #endif
11210 #include <stdio.h>
11211 int main() {
11212 #ifdef INT8
11213    int8_t i =  INT8_MAX;
11214   uint8_t u = UINT8_MAX;
11215   printf("int8_t\n");
11216 #endif
11217 #ifdef INT16
11218    int16_t i =  INT16_MAX;
11219   uint16_t i = UINT16_MAX;
11220   printf("int16_t\n");
11221 #endif
11222 #ifdef INT32
11223    int32_t i =  INT32_MAX;
11224   uint32_t u = UINT32_MAX;
11225   printf("int32_t\n");
11226 #endif
11227 }
11228 EOCP
11229
11230 case "$i8type" in
11231 '')     case "$charsize" in
11232         1)      i8type=char
11233                 u8type="unsigned char"
11234                 i8size=$charsize
11235                 u8size=$charsize
11236                 ;;
11237         esac
11238         ;;
11239 esac
11240 case "$i8type" in
11241 '')     set try -DINT8
11242         if eval $compile; then
11243                 case "`$run ./try`" in
11244                 int8_t) i8type=int8_t
11245                         u8type=uint8_t
11246                         i8size=1
11247                         u8size=1
11248                         ;;
11249                 esac
11250         fi
11251         ;;
11252 esac
11253 case "$i8type" in
11254 '')     if $test $charsize -ge 1; then
11255                 i8type=char
11256                 u8type="unsigned char"
11257                 i8size=$charsize
11258                 u8size=$charsize
11259         fi
11260         ;;
11261 esac
11262
11263 case "$i16type" in
11264 '')     case "$shortsize" in
11265         2)      i16type=short
11266                 u16type="unsigned short"
11267                 i16size=$shortsize
11268                 u16size=$shortsize
11269                 ;;
11270         esac
11271         ;;
11272 esac
11273 case "$i16type" in
11274 '')     set try -DINT16
11275         if eval $compile; then
11276                 case "`$run ./try`" in
11277                 int16_t)
11278                         i16type=int16_t
11279                         u16type=uint16_t
11280                         i16size=2
11281                         u16size=2
11282                         ;;
11283                 esac
11284         fi
11285         ;;
11286 esac
11287 case "$i16type" in
11288 '')     if $test $shortsize -ge 2; then
11289                 i16type=short
11290                 u16type="unsigned short"
11291                 i16size=$shortsize
11292                 u16size=$shortsize
11293         fi
11294         ;;
11295 esac
11296
11297 case "$i32type" in
11298 '')     case "$longsize" in
11299         4)      i32type=long
11300                 u32type="unsigned long"
11301                 i32size=$longsize
11302                 u32size=$longsize
11303                 ;;
11304         *)      case "$intsize" in
11305                 4)      i32type=int
11306                         u32type="unsigned int"
11307                         i32size=$intsize
11308                         u32size=$intsize
11309                         ;;
11310                 esac
11311                 ;;
11312         esac
11313         ;;
11314 esac
11315 case "$i32type" in
11316 '')     set try -DINT32
11317         if eval $compile; then
11318                 case "`$run ./try`" in
11319                 int32_t)
11320                         i32type=int32_t
11321                         u32type=uint32_t
11322                         i32size=4
11323                         u32size=4
11324                         ;;
11325                 esac
11326         fi
11327         ;;
11328 esac
11329 case "$i32type" in
11330 '')     if $test $intsize -ge 4; then
11331                 i32type=int
11332                 u32type="unsigned int"
11333                 i32size=$intsize
11334                 u32size=$intsize
11335         fi
11336         ;;
11337 esac
11338
11339 case "$i64type" in
11340 '')     case "$d_quad:$quadtype" in
11341         define:?*)
11342                 i64type="$quadtype"
11343                 u64type="$uquadtype"
11344                 i64size=8
11345                 u64size=8
11346                 ;;
11347         esac
11348         ;;
11349 esac
11350
11351 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11352 : volatile so that the compiler has to store it out to memory.
11353 if test X"$d_volatile" = X"$define"; then
11354         volatile=volatile
11355 fi
11356 $cat <<EOP >try.c
11357 #include <stdio.h>
11358 #include <sys/types.h>
11359 #include <signal.h>
11360 #ifdef SIGFPE
11361 $volatile int bletched = 0;
11362 $signal_t blech(s) int s; { bletched = 1; }
11363 #endif
11364 int main() {
11365     $uvtype u = 0;
11366     $nvtype d;
11367     int     n = 8 * $uvsize;
11368     int     i;
11369 #ifdef SIGFPE
11370     signal(SIGFPE, blech);
11371 #endif
11372
11373     for (i = 0; i < n; i++) {
11374       u = u << 1 | ($uvtype)1;
11375       d = ($nvtype)u;
11376       if (($uvtype)d != u)
11377         break;
11378       if (d <= 0)
11379         break;
11380       d = ($nvtype)(u - 1);
11381       if (($uvtype)d != (u - 1))
11382         break;
11383 #ifdef SIGFPE
11384       if (bletched) {
11385         break;
11386 #endif
11387       } 
11388     }
11389     printf("%d\n", ((i == n) ? -n : i));
11390     exit(0);
11391 }
11392 EOP
11393 set try
11394
11395 d_nv_preserves_uv="$undef"
11396 if eval $compile; then
11397         d_nv_preserves_uv_bits="`$run ./try`"
11398 fi
11399 case "$d_nv_preserves_uv_bits" in
11400 \-[1-9]*)       
11401         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11402         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11403         d_nv_preserves_uv="$define"
11404         ;;
11405 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11406         d_nv_preserves_uv="$undef" ;;
11407 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11408         d_nv_preserves_uv_bits="$undef" ;;
11409 esac
11410
11411 $rm -f try.* try
11412
11413
11414 : check for off64_t
11415 echo " "
11416 echo "Checking to see if you have off64_t..." >&4
11417 $cat >try.c <<EOCP
11418 #include <sys/types.h>
11419 #include <unistd.h>
11420 int main() { off64_t x = 7; }
11421 EOCP
11422 set try
11423 if eval $compile; then
11424         val="$define"
11425         echo "You have off64_t."
11426 else
11427         val="$undef"
11428         echo "You do not have off64_t."
11429         case "$lseeksize" in
11430         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11431         esac
11432 fi
11433 $rm -f try.* try
11434 set d_off64_t
11435 eval $setvar
11436
11437 : see if POSIX threads are available
11438 set pthread.h i_pthread
11439 eval $inhdr
11440
11441
11442
11443
11444 : how to create joinable pthreads
11445 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11446         echo " "
11447         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11448         $cat >try.c <<'EOCP'
11449 #include <pthread.h>
11450 int main() {
11451     int detachstate = JOINABLE;
11452 }
11453 EOCP
11454         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11455         if eval $compile; then
11456                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11457                 val="$undef" # Yes, undef.
11458                 set d_old_pthread_create_joinable
11459                 eval $setvar
11460                 val=""
11461                 set old_pthread_create_joinable
11462                 eval $setvar
11463         else
11464                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11465                 if eval $compile; then
11466                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11467                         val="$define"
11468                         set d_old_pthread_create_joinable
11469                         eval $setvar
11470                         val=PTHREAD_CREATE_UNDETACHED
11471                         set old_pthread_create_joinable
11472                         eval $setvar
11473                 else            
11474                         set try -DJOINABLE=__UNDETACHED
11475                         if eval $compile; then
11476                                 echo "You seem to use __UNDETACHED." >&4
11477                                 val="$define"
11478                                 set d_old_pthread_create_joinable
11479                                 eval $setvar
11480                                 val=__UNDETACHED
11481                                 set old_pthread_create_joinable
11482                                 eval $setvar
11483                         else
11484                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11485                                 val="$define"
11486                                 set d_old_pthread_create_joinable
11487                                 eval $setvar
11488                                 val=0
11489                                 set old_pthread_create_joinable
11490                                 eval $setvar
11491                         fi
11492                 fi
11493         fi
11494         $rm -f try try.*
11495 else
11496     d_old_pthread_create_joinable="$undef"
11497     old_pthread_create_joinable=""
11498 fi
11499
11500 : see if pause exists
11501 set pause d_pause
11502 eval $inlibc
11503
11504 : see if pipe exists
11505 set pipe d_pipe
11506 eval $inlibc
11507
11508 : see if poll exists
11509 set poll d_poll
11510 eval $inlibc
11511
11512 : see if readlink exists
11513 set readlink d_readlink
11514 eval $inlibc
11515
11516 echo " "
11517 procselfexe=''
11518 val="$undef"
11519 case "$d_readlink" in
11520 "$define")
11521         if $issymlink /proc/self/exe ; then
11522                 $ls -l /proc/self/exe > reflect
11523                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11524                         echo "You have Linux-like /proc/self/exe."
11525                         procselfexe='"/proc/self/exe"'
11526                         val="$define"
11527                 fi
11528         fi
11529         if $issymlink /proc/curproc/file ; then
11530                 $ls -l /proc/curproc/file > reflect
11531                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11532                         echo "You have BSD-like /proc/curproc/file."
11533                         procselfexe='"/proc/curproc/file"'
11534                         val="$define"
11535                 fi
11536         fi
11537         ;;
11538 esac
11539 $rm -f reflect
11540 set d_procselfexe
11541 eval $setvar
11542
11543 : see if pthread_atfork exists
11544 set pthread_atfork d_pthread_atfork
11545 eval $inlibc
11546
11547
11548 : see whether the various POSIXish _yields exist
11549 $cat >try.c <<EOP
11550 #include <pthread.h>
11551 #include <stdio.h>
11552 int main() {
11553 #ifdef SCHED_YIELD
11554         sched_yield();
11555 #else
11556 #ifdef PTHREAD_YIELD
11557         pthread_yield();
11558 #else
11559 #ifdef PTHREAD_YIELD_NULL
11560         pthread_yield(NULL);
11561 #endif
11562 #endif
11563 #endif
11564 }
11565 EOP
11566 : see if sched_yield exists
11567 set try -DSCHED_YIELD
11568 if eval $compile; then
11569     val="$define"
11570     sched_yield='sched_yield()'
11571 else
11572     val="$undef"
11573 fi
11574 case "$usethreads" in
11575 $define)
11576         case "$val" in
11577         $define) echo 'sched_yield() found.' >&4        ;;
11578         *)       echo 'sched_yield() NOT found.' >&4    ;;
11579         esac
11580 esac
11581 set d_sched_yield
11582 eval $setvar
11583
11584 : see if pthread_yield exists
11585 set try -DPTHREAD_YIELD
11586 if eval $compile; then
11587     val="$define"
11588     case "$sched_yield" in
11589     '') sched_yield='pthread_yield()' ;;
11590     esac
11591 else
11592     set try -DPTHREAD_YIELD_NULL
11593     if eval $compile; then
11594         val="$define"
11595         case "$sched_yield" in
11596         '') sched_yield='pthread_yield(NULL)' ;;
11597         esac
11598     else
11599         val="$undef"
11600     fi
11601 fi
11602 case "$usethreads" in
11603 $define)
11604         case "$val" in
11605         $define) echo 'pthread_yield() found.' >&4      ;;
11606         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11607         esac
11608         ;;
11609 esac
11610 set d_pthread_yield
11611 eval $setvar
11612
11613 case "$sched_yield" in
11614 '') sched_yield=undef ;;
11615 esac
11616
11617 $rm -f try try.*
11618
11619 : see if this is a pwd.h system
11620 set pwd.h i_pwd
11621 eval $inhdr
11622
11623 case "$i_pwd" in
11624 $define)
11625         xxx=`./findhdr pwd.h`
11626         $cppstdin $cppflags $cppminus < $xxx >$$.h
11627
11628         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11629                 val="$define"
11630         else
11631                 val="$undef"
11632         fi
11633         set d_pwquota
11634         eval $setvar
11635
11636         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11637                 val="$define"
11638         else
11639                 val="$undef"
11640         fi
11641         set d_pwage
11642         eval $setvar
11643
11644         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11645                 val="$define"
11646         else
11647                 val="$undef"
11648         fi
11649         set d_pwchange
11650         eval $setvar
11651
11652         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11653                 val="$define"
11654         else
11655                 val="$undef"
11656         fi
11657         set d_pwclass
11658         eval $setvar
11659
11660         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11661                 val="$define"
11662         else
11663                 val="$undef"
11664         fi
11665         set d_pwexpire
11666         eval $setvar
11667
11668         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11669                 val="$define"
11670         else
11671                 val="$undef"
11672         fi
11673         set d_pwcomment
11674         eval $setvar
11675
11676         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11677                 val="$define"
11678         else
11679                 val="$undef"
11680         fi
11681         set d_pwgecos
11682         eval $setvar
11683
11684         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11685                 val="$define"
11686         else
11687                 val="$undef"
11688         fi
11689         set d_pwpasswd
11690         eval $setvar
11691
11692         $rm -f $$.h
11693         ;;
11694 *)
11695         val="$undef"; 
11696         set d_pwquota; eval $setvar
11697         set d_pwage; eval $setvar
11698         set d_pwchange; eval $setvar
11699         set d_pwclass; eval $setvar
11700         set d_pwexpire; eval $setvar
11701         set d_pwcomment; eval $setvar
11702         set d_pwgecos; eval $setvar
11703         set d_pwpasswd; eval $setvar
11704         ;;
11705 esac
11706
11707 : see if readdir and friends exist
11708 set readdir d_readdir
11709 eval $inlibc
11710 set seekdir d_seekdir
11711 eval $inlibc
11712 set telldir d_telldir
11713 eval $inlibc
11714 set rewinddir d_rewinddir
11715 eval $inlibc
11716
11717 : see if readv exists
11718 set readv d_readv
11719 eval $inlibc
11720
11721 : see if recvmsg exists
11722 set recvmsg d_recvmsg
11723 eval $inlibc
11724
11725 : see if rename exists
11726 set rename d_rename
11727 eval $inlibc
11728
11729 : see if rmdir exists
11730 set rmdir d_rmdir
11731 eval $inlibc
11732
11733 : see if memory.h is available.
11734 val=''
11735 set memory.h val
11736 eval $inhdr
11737
11738 : See if it conflicts with string.h
11739 case "$val" in
11740 $define)
11741         case "$strings" in
11742         '') ;;
11743         *)
11744                 $cppstdin $cppflags $cppminus < $strings > mem.h
11745                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11746                         echo " "
11747                         echo "We won't be including <memory.h>."
11748                         val="$undef"
11749                 fi
11750                 $rm -f mem.h
11751                 ;;
11752         esac
11753 esac
11754 set i_memory
11755 eval $setvar
11756
11757 : can bcopy handle overlapping blocks?
11758 echo " "
11759 val="$undef"
11760 case "$d_memmove" in
11761 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11762 *)      case "$d_bcopy" in
11763         "$define")
11764                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11765                 $cat >try.c <<EOCP
11766 #$i_memory I_MEMORY
11767 #$i_stdlib I_STDLIB
11768 #$i_string I_STRING
11769 #$i_unistd I_UNISTD
11770 EOCP
11771         $cat >>try.c <<'EOCP'
11772 #include <stdio.h>
11773 #ifdef I_MEMORY
11774 #  include <memory.h>
11775 #endif
11776 #ifdef I_STDLIB
11777 #  include <stdlib.h>
11778 #endif
11779 #ifdef I_STRING
11780 #  include <string.h>
11781 #else
11782 #  include <strings.h>
11783 #endif
11784 #ifdef I_UNISTD
11785 #  include <unistd.h>  /* Needed for NetBSD */
11786 #endif
11787 int main()
11788 {
11789 char buf[128], abc[128];
11790 char *b;
11791 int len;
11792 int off;
11793 int align;
11794
11795 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11796    try to store the string in read-only memory. */
11797 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11798
11799 for (align = 7; align >= 0; align--) {
11800         for (len = 36; len; len--) {
11801                 b = buf+align;
11802                 bcopy(abc, b, len);
11803                 for (off = 1; off <= len; off++) {
11804                         bcopy(b, b+off, len);
11805                         bcopy(b+off, b, len);
11806                         if (bcmp(b, abc, len))
11807                                 exit(1);
11808                 }
11809         }
11810 }
11811 exit(0);
11812 }
11813 EOCP
11814                 set try
11815                 if eval $compile_ok; then
11816                         if ./try 2>/dev/null; then
11817                                 echo "Yes, it can."
11818                                 val="$define"
11819                         else
11820                                 echo "It can't, sorry."
11821                         fi
11822                 else
11823                         echo "(I can't compile the test program, so we'll assume not...)"
11824                 fi
11825                 ;;
11826         esac
11827         $rm -f try.* try core
11828         ;;
11829 esac
11830 set d_safebcpy
11831 eval $setvar
11832
11833 : can memcpy handle overlapping blocks?
11834 echo " "
11835 val="$undef"
11836 case "$d_memmove" in
11837 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11838 *)      case "$d_memcpy" in
11839         "$define")
11840                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11841                 $cat >try.c <<EOCP
11842 #$i_memory I_MEMORY
11843 #$i_stdlib I_STDLIB
11844 #$i_string I_STRING
11845 #$i_unistd I_UNISTD
11846 EOCP
11847         $cat >>try.c <<'EOCP'
11848 #include <stdio.h>
11849 #ifdef I_MEMORY
11850 #  include <memory.h>
11851 #endif
11852 #ifdef I_STDLIB
11853 #  include <stdlib.h>
11854 #endif
11855 #ifdef I_STRING
11856 #  include <string.h>
11857 #else
11858 #  include <strings.h>
11859 #endif
11860 #ifdef I_UNISTD
11861 #  include <unistd.h>  /* Needed for NetBSD */
11862 #endif
11863 int main()
11864 {
11865 char buf[128], abc[128];
11866 char *b;
11867 int len;
11868 int off;
11869 int align;
11870
11871 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11872    try to store the string in read-only memory. */
11873 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11874
11875 for (align = 7; align >= 0; align--) {
11876         for (len = 36; len; len--) {
11877                 b = buf+align;
11878                 memcpy(b, abc, len);
11879                 for (off = 1; off <= len; off++) {
11880                         memcpy(b+off, b, len);
11881                         memcpy(b, b+off, len);
11882                         if (memcmp(b, abc, len))
11883                                 exit(1);
11884                 }
11885         }
11886 }
11887 exit(0);
11888 }
11889 EOCP
11890                 set try
11891                 if eval $compile_ok; then
11892                         if ./try 2>/dev/null; then
11893                                 echo "Yes, it can."
11894                                 val="$define"
11895                         else
11896                                 echo "It can't, sorry."
11897                         fi
11898                 else
11899                         echo "(I can't compile the test program, so we'll assume not...)"
11900                 fi
11901                 ;;
11902         esac
11903         $rm -f try.* try core
11904         ;;
11905 esac
11906 set d_safemcpy
11907 eval $setvar
11908
11909 : can memcmp be trusted to compare relative magnitude?
11910 val="$undef"
11911 case "$d_memcmp" in
11912 "$define")
11913         echo " "
11914         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11915         $cat >try.c <<EOCP
11916 #$i_memory I_MEMORY
11917 #$i_stdlib I_STDLIB
11918 #$i_string I_STRING
11919 #$i_unistd I_UNISTD
11920 EOCP
11921         $cat >>try.c <<'EOCP'
11922 #include <stdio.h>
11923 #ifdef I_MEMORY
11924 #  include <memory.h>
11925 #endif
11926 #ifdef I_STDLIB
11927 #  include <stdlib.h>
11928 #endif
11929 #ifdef I_STRING
11930 #  include <string.h>
11931 #else
11932 #  include <strings.h>
11933 #endif
11934 #ifdef I_UNISTD
11935 #  include <unistd.h>  /* Needed for NetBSD */
11936 #endif
11937 int main()
11938 {
11939 char a = -1;
11940 char b = 0;
11941 if ((a < b) && memcmp(&a, &b, 1) < 0)
11942         exit(1);
11943 exit(0);
11944 }
11945 EOCP
11946         set try
11947         if eval $compile_ok; then
11948                 if $run ./try 2>/dev/null; then
11949                         echo "Yes, it can."
11950                         val="$define"
11951                 else
11952                         echo "No, it can't (it uses signed chars)."
11953                 fi
11954         else
11955                 echo "(I can't compile the test program, so we'll assume not...)"
11956         fi
11957         ;;
11958 esac
11959 $rm -f try.* try core
11960 set d_sanemcmp
11961 eval $setvar
11962
11963 : see if prototype for sbrk is available
11964 echo " "
11965 set d_sbrkproto sbrk $i_unistd unistd.h
11966 eval $hasproto
11967
11968 : see if select exists
11969 set select d_select
11970 eval $inlibc
11971
11972 : see if semctl exists
11973 set semctl d_semctl
11974 eval $inlibc
11975
11976 : see if semget exists
11977 set semget d_semget
11978 eval $inlibc
11979
11980 : see if semop exists
11981 set semop d_semop
11982 eval $inlibc
11983
11984 : see how much of the 'sem*(2)' library is present.
11985 h_sem=true
11986 echo " "
11987 case "$d_semctl$d_semget$d_semop" in
11988 *"$undef"*) h_sem=false;;
11989 esac
11990 case "$osname" in
11991 freebsd)
11992     case "`ipcs 2>&1`" in
11993     "SVID messages"*"not configured"*)
11994         echo "Your $osname does not have the sem*(2) configured." >&4
11995         h_sem=false
11996         val="$undef"
11997         set semctl d_semctl
11998         eval $setvar
11999         set semget d_semget
12000         eval $setvar
12001         set semop d_semop
12002         eval $setvar
12003         ;;
12004     esac
12005     ;;
12006 esac
12007 : we could also check for sys/ipc.h ...
12008 if $h_sem && $test `./findhdr sys/sem.h`; then
12009         echo "You have the full sem*(2) library." >&4
12010         val="$define"
12011 else
12012         echo "You don't have the full sem*(2) library." >&4
12013         val="$undef"
12014 fi
12015 set d_sem
12016 eval $setvar
12017
12018 : see whether sys/sem.h defines union semun
12019 echo " "
12020 $cat > try.c <<'END'
12021 #include <sys/types.h>
12022 #include <sys/ipc.h>
12023 #include <sys/sem.h>
12024 int main () { union semun semun; semun.buf = 0; }
12025 END
12026 set try
12027 if eval $compile; then
12028     echo "You have union semun in <sys/sem.h>." >&4
12029     val="$define"
12030 else
12031     echo "You do not have union semun in <sys/sem.h>." >&4
12032     val="$undef"
12033 fi
12034 $rm -f try try.c try.h
12035 set d_union_semun
12036 eval $setvar
12037
12038 : see how to do semctl IPC_STAT
12039 case "$d_sem" in
12040 $define)
12041     : see whether semctl IPC_STAT can use union semun
12042     echo " "
12043     $cat > try.h <<END
12044 #ifndef S_IRUSR
12045 #   ifdef S_IREAD
12046 #       define S_IRUSR S_IREAD
12047 #       define S_IWUSR S_IWRITE
12048 #       define S_IXUSR S_IEXEC
12049 #   else
12050 #       define S_IRUSR 0400
12051 #       define S_IWUSR 0200
12052 #       define S_IXUSR 0100
12053 #   endif
12054 #   define S_IRGRP (S_IRUSR>>3)
12055 #   define S_IWGRP (S_IWUSR>>3)
12056 #   define S_IXGRP (S_IXUSR>>3)
12057 #   define S_IROTH (S_IRUSR>>6)
12058 #   define S_IWOTH (S_IWUSR>>6)
12059 #   define S_IXOTH (S_IXUSR>>6)
12060 #endif
12061 #ifndef S_IRWXU
12062 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
12063 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
12064 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
12065 #endif
12066 END
12067
12068     $cat > try.c <<END
12069 #include <sys/types.h>
12070 #include <sys/ipc.h>
12071 #include <sys/sem.h>
12072 #include <sys/stat.h>
12073 #include <stdio.h>
12074 #include <errno.h>
12075 #include "try.h"
12076 #ifndef errno
12077 extern int errno;
12078 #endif
12079 #$d_union_semun HAS_UNION_SEMUN
12080 int main() {
12081     union semun
12082 #ifndef HAS_UNION_SEMUN
12083     {
12084         int val;
12085         struct semid_ds *buf;
12086         unsigned short *array;
12087     }
12088 #endif
12089     arg;
12090     int sem, st;
12091
12092 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
12093     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12094     if (sem > -1) {
12095         struct semid_ds argbuf;
12096         arg.buf = &argbuf;
12097 #       ifdef IPC_STAT
12098         st = semctl(sem, 0, IPC_STAT, arg);
12099         if (st == 0)
12100             printf("semun\n");
12101         else
12102 #       endif /* IPC_STAT */
12103             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12104 #       ifdef IPC_RMID
12105         if (semctl(sem, 0, IPC_RMID, arg) != 0)
12106 #       endif /* IPC_RMID */
12107             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12108     } else
12109 #endif /* IPC_PRIVATE && ... */
12110         printf("semget failed: errno = %d\n", errno);
12111   return 0;
12112 }
12113 END
12114     val="$undef"
12115     set try
12116     if eval $compile; then
12117         xxx=`$run ./try`
12118         case "$xxx" in
12119         semun) val="$define" ;;
12120         esac
12121     fi
12122     $rm -f try try.c
12123     set d_semctl_semun
12124     eval $setvar
12125     case "$d_semctl_semun" in
12126     $define)
12127         echo "You can use union semun for semctl IPC_STAT." >&4
12128         also='also'
12129         ;;
12130     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
12131         also=''
12132         ;;
12133     esac
12134
12135     : see whether semctl IPC_STAT can use struct semid_ds pointer
12136     $cat > try.c <<'END'
12137 #include <sys/types.h>
12138 #include <sys/ipc.h>
12139 #include <sys/sem.h>
12140 #include <sys/stat.h>
12141 #include "try.h"
12142 #include <stdio.h>
12143 #include <errno.h>
12144 #ifndef errno
12145 extern int errno;
12146 #endif
12147 int main() {
12148     struct semid_ds arg;
12149     int sem, st;
12150
12151 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
12152     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12153     if (sem > -1) {
12154 #       ifdef IPC_STAT
12155         st = semctl(sem, 0, IPC_STAT, &arg);
12156         if (st == 0)
12157             printf("semid_ds\n");
12158         else
12159 #       endif /* IPC_STAT */
12160             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12161 #       ifdef IPC_RMID
12162         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
12163 #       endif /* IPC_RMID */
12164             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12165     } else
12166 #endif /* IPC_PRIVATE && ... */
12167         printf("semget failed: errno = %d\n", errno);
12168
12169     return 0;
12170 }
12171 END
12172     val="$undef"
12173     set try
12174     if eval $compile; then
12175         xxx=`$run ./try`
12176         case "$xxx" in
12177         semid_ds) val="$define" ;;
12178         esac
12179     fi
12180     $rm -f try try.c
12181     set d_semctl_semid_ds
12182     eval $setvar
12183     case "$d_semctl_semid_ds" in
12184     $define)
12185         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
12186         ;;
12187     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
12188         ;;
12189     esac
12190     $rm -f try.h
12191     ;;
12192 *)  val="$undef"
12193
12194     # We do not have the full sem*(2) library, so assume we can not
12195     # use either.
12196
12197     set d_semctl_semun
12198     eval $setvar
12199
12200     set d_semctl_semid_ds
12201     eval $setvar
12202     ;;
12203 esac
12204
12205 : see if sendmsg exists
12206 set sendmsg d_sendmsg
12207 eval $inlibc
12208
12209 : see if setegid exists
12210 set setegid d_setegid
12211 eval $inlibc
12212
12213 : see if seteuid exists
12214 set seteuid d_seteuid
12215 eval $inlibc
12216
12217 : see if setgrent exists
12218 set setgrent d_setgrent
12219 eval $inlibc
12220
12221 : see if sethostent exists
12222 set sethostent d_sethent
12223 eval $inlibc
12224
12225 : see if setitimer exists
12226 set setitimer d_setitimer
12227 eval $inlibc
12228
12229 : see if setlinebuf exists
12230 set setlinebuf d_setlinebuf
12231 eval $inlibc
12232
12233 : see if setlocale exists
12234 set setlocale d_setlocale
12235 eval $inlibc
12236
12237 : see if setnetent exists
12238 set setnetent d_setnent
12239 eval $inlibc
12240
12241 : see if setprotoent exists
12242 set setprotoent d_setpent
12243 eval $inlibc
12244
12245 : see if setpgid exists
12246 set setpgid d_setpgid
12247 eval $inlibc
12248
12249 : see if setpgrp2 exists
12250 set setpgrp2 d_setpgrp2
12251 eval $inlibc
12252
12253 : see if setpriority exists
12254 set setpriority d_setprior
12255 eval $inlibc
12256
12257 : see if setproctitle exists
12258 set setproctitle d_setproctitle
12259 eval $inlibc
12260
12261 : see if setpwent exists
12262 set setpwent d_setpwent
12263 eval $inlibc
12264
12265 : see if setregid exists
12266 set setregid d_setregid
12267 eval $inlibc
12268 set setresgid d_setresgid
12269 eval $inlibc
12270
12271 : see if setreuid exists
12272 set setreuid d_setreuid
12273 eval $inlibc
12274 set setresuid d_setresuid
12275 eval $inlibc
12276
12277 : see if setrgid exists
12278 set setrgid d_setrgid
12279 eval $inlibc
12280
12281 : see if setruid exists
12282 set setruid d_setruid
12283 eval $inlibc
12284
12285 : see if setservent exists
12286 set setservent d_setsent
12287 eval $inlibc
12288
12289 : see if setsid exists
12290 set setsid d_setsid
12291 eval $inlibc
12292
12293 : see if setvbuf exists
12294 set setvbuf d_setvbuf
12295 eval $inlibc
12296
12297 : see if sfio.h is available
12298 set sfio.h i_sfio
12299 eval $inhdr
12300
12301
12302 : see if sfio library is available
12303 case "$i_sfio" in
12304 $define)
12305         val=''
12306         set sfreserve val
12307         eval $inlibc
12308         ;;
12309 *)
12310         val="$undef"
12311         ;;
12312 esac
12313 : Ok, but do we want to use it.
12314 case "$val" in
12315 $define)
12316         case "$usesfio" in
12317         true|$define|[yY]*) dflt='y';;
12318         *) dflt='n';;
12319         esac
12320         echo "$package can use the sfio library, but it is experimental."
12321         case "$useperlio" in
12322         "$undef")
12323             echo "For sfio also the PerlIO abstraction layer is needed."
12324             echo "Earlier you said you wouldn't want that."
12325             ;;
12326         esac
12327         rp="You seem to have sfio available, do you want to try using it?"
12328         . ./myread
12329         case "$ans" in
12330         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12331                 useperlio="$define"
12332                 val="$define"
12333                 ;;
12334         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12335                 val="$undef"
12336                 ;;
12337         esac
12338         ;;
12339 *)      case "$usesfio" in
12340         true|$define|[yY]*)
12341                 echo "Sorry, cannot find sfio on this machine." >&4
12342                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12343                 val="$undef"
12344                 ;;
12345         esac
12346         ;;
12347 esac
12348 set d_sfio
12349 eval $setvar
12350 case "$d_sfio" in
12351 $define) usesfio='true';;
12352 *) usesfio='false';;
12353 esac
12354 case "$d_sfio" in
12355 $define) ;;
12356 *)      : Remove sfio from list of libraries to use
12357         case "$libs" in
12358         *-lsfio*)
12359                 echo "Removing unneeded -lsfio from library list" >&4
12360                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12361                 shift
12362                 libs="$*"
12363                 echo "libs = $libs" >&4
12364                 ;;
12365         esac
12366 ;;
12367 esac
12368
12369
12370 : see if shmctl exists
12371 set shmctl d_shmctl
12372 eval $inlibc
12373
12374 : see if shmget exists
12375 set shmget d_shmget
12376 eval $inlibc
12377
12378 : see if shmat exists
12379 set shmat d_shmat
12380 eval $inlibc
12381 : see what shmat returns
12382 case "$d_shmat" in
12383 "$define")
12384         $cat >shmat.c <<'END'
12385 #include <sys/shm.h>
12386 void *shmat();
12387 END
12388         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12389                 shmattype='void *'
12390         else
12391                 shmattype='char *'
12392         fi
12393         echo "and it returns ($shmattype)." >&4
12394         : see if a prototype for shmat is available
12395         xxx=`./findhdr sys/shm.h`
12396         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12397         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12398                 val="$define"
12399         else
12400                 val="$undef"
12401         fi
12402         $rm -f shmat.[co]
12403         ;;
12404 *)
12405         val="$undef"
12406         ;;
12407 esac
12408 set d_shmatprototype
12409 eval $setvar
12410
12411 : see if shmdt exists
12412 set shmdt d_shmdt
12413 eval $inlibc
12414
12415 : see how much of the 'shm*(2)' library is present.
12416 h_shm=true
12417 echo " "
12418 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12419 *"$undef"*) h_shm=false;;
12420 esac
12421 case "$osname" in
12422 freebsd)
12423     case "`ipcs 2>&1`" in
12424     "SVID shared memory"*"not configured"*)
12425         echo "Your $osname does not have the shm*(2) configured." >&4
12426         h_shm=false
12427         val="$undef"
12428         set shmctl d_shmctl
12429         evat $setvar
12430         set shmget d_shmget
12431         evat $setvar
12432         set shmat d_shmat
12433         evat $setvar
12434         set shmdt d_shmdt
12435         evat $setvar
12436         ;;
12437     esac
12438     ;;
12439 esac
12440 : we could also check for sys/ipc.h ...
12441 if $h_shm && $test `./findhdr sys/shm.h`; then
12442         echo "You have the full shm*(2) library." >&4
12443         val="$define"
12444 else
12445         echo "You don't have the full shm*(2) library." >&4
12446         val="$undef"
12447 fi
12448 set d_shm
12449 eval $setvar
12450
12451 echo " "
12452 : see if we have sigaction
12453 if set sigaction val -f d_sigaction; eval $csym; $val; then
12454         echo 'sigaction() found.' >&4
12455         $cat > try.c <<'EOP'
12456 #include <stdio.h>
12457 #include <sys/types.h>
12458 #include <signal.h>
12459 int main()
12460 {
12461     struct sigaction act, oact;
12462     act.sa_flags = 0;
12463     oact.sa_handler = 0;
12464     /* so that act and oact are used */
12465     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12466 }
12467 EOP
12468         set try
12469         if eval $compile_ok; then
12470                 val="$define"
12471         else
12472                 echo "But you don't seem to have a useable struct sigaction." >&4
12473                 val="$undef"
12474         fi
12475 else
12476         echo 'sigaction NOT found.' >&4
12477         val="$undef"
12478 fi
12479 set d_sigaction; eval $setvar
12480 $rm -f try try$_o try.c
12481
12482 : see if sigprocmask exists
12483 set sigprocmask d_sigprocmask
12484 eval $inlibc
12485
12486 : see if sigsetjmp exists
12487 echo " "
12488 case "$d_sigsetjmp" in
12489 '')
12490         $cat >try.c <<'EOP'
12491 #include <setjmp.h>
12492 sigjmp_buf env;
12493 int set = 1;
12494 int main()
12495 {
12496         if (sigsetjmp(env,1))
12497                 exit(set);
12498         set = 0;
12499         siglongjmp(env, 1);
12500         exit(1);
12501 }
12502 EOP
12503         set try
12504         if eval $compile; then
12505                 if $run ./try >/dev/null 2>&1; then
12506                         echo "POSIX sigsetjmp found." >&4
12507                         val="$define"
12508                 else
12509                         $cat >&4 <<EOM
12510 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12511 I'll ignore them.
12512 EOM
12513                         val="$undef"
12514                 fi
12515         else
12516                 echo "sigsetjmp not found." >&4
12517                 val="$undef"
12518         fi
12519         ;;
12520 *) val="$d_sigsetjmp"
12521         case "$d_sigsetjmp" in
12522         $define) echo "POSIX sigsetjmp found." >&4;;
12523         $undef) echo "sigsetjmp not found." >&4;;
12524         esac
12525         ;;
12526 esac
12527 set d_sigsetjmp
12528 eval $setvar
12529 $rm -f try.c try
12530
12531 : see if sockatmark exists
12532 set sockatmark d_sockatmark
12533 eval $inlibc
12534
12535 : see if prototype for sockatmark is available
12536 echo " "
12537 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12538 eval $hasproto
12539
12540 : see if socks5_init exists
12541 set socks5_init d_socks5_init
12542 eval $inlibc
12543
12544 : see if prototype for setresgid is available
12545 echo " "
12546 set d_sresgproto setresgid $i_unistd unistd.h
12547 eval $hasproto
12548
12549 : see if prototype for setresuid is available
12550 echo " "
12551 set d_sresuproto setresuid $i_unistd unistd.h
12552 eval $hasproto
12553
12554 : see if sys/stat.h is available
12555 set sys/stat.h i_sysstat
12556 eval $inhdr
12557
12558
12559 : see if stat knows about block sizes
12560 echo " "
12561 echo "Checking to see if your struct stat has st_blocks field..." >&4
12562 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12563 eval $hasfield
12564
12565
12566 : see if this is a sys/vfs.h system
12567 set sys/vfs.h i_sysvfs
12568 eval $inhdr
12569
12570
12571 : see if this is a sys/statfs.h system
12572 set sys/statfs.h i_sysstatfs
12573 eval $inhdr
12574
12575
12576 echo " "
12577 echo "Checking to see if your system supports struct statfs..." >&4
12578 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
12579 eval $hasstruct
12580 case "$d_statfs_s" in
12581 "$define")      echo "Yes, it does."   ;;
12582 *)              echo "No, it doesn't." ;;
12583 esac
12584
12585
12586
12587 : see if struct statfs knows about f_flags
12588 case "$d_statfs_s" in
12589 define) 
12590         echo " "
12591         echo "Checking to see if your struct statfs has f_flags field..." >&4
12592         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
12593         eval $hasfield
12594         ;;
12595 *)      val="$undef"
12596         set d_statfs_f_flags
12597         eval $setvar
12598         ;;
12599 esac
12600 case "$d_statfs_f_flags" in
12601 "$define")      echo "Yes, it does."   ;;
12602 *)              echo "No, it doesn't." ;;
12603 esac
12604
12605 : see if _ptr and _cnt from stdio act std
12606 echo " "
12607
12608 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12609         echo "(Looks like you have stdio.h from BSD.)"
12610         case "$stdio_ptr" in
12611         '') stdio_ptr='((fp)->_p)'
12612                 ptr_lval=$define
12613                 ;;
12614         *)      ptr_lval=$d_stdio_ptr_lval;;
12615         esac
12616         case "$stdio_cnt" in
12617         '') stdio_cnt='((fp)->_r)'
12618                 cnt_lval=$define
12619                 ;;
12620         *)      cnt_lval=$d_stdio_cnt_lval;;
12621         esac
12622         case "$stdio_base" in
12623         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12624         esac
12625         case "$stdio_bufsiz" in
12626         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12627         esac
12628 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12629         echo "(Looks like you have stdio.h from Linux.)"
12630         case "$stdio_ptr" in
12631         '') stdio_ptr='((fp)->_IO_read_ptr)'
12632                 ptr_lval=$define
12633                 ;;
12634         *)      ptr_lval=$d_stdio_ptr_lval;;
12635         esac
12636         case "$stdio_cnt" in
12637         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12638                 cnt_lval=$undef
12639                 ;;
12640         *)      cnt_lval=$d_stdio_cnt_lval;;
12641         esac
12642         case "$stdio_base" in
12643         '') stdio_base='((fp)->_IO_read_base)';;
12644         esac
12645         case "$stdio_bufsiz" in
12646         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12647         esac
12648 else
12649         case "$stdio_ptr" in
12650         '') stdio_ptr='((fp)->_ptr)'
12651                 ptr_lval=$define
12652                 ;;
12653         *)      ptr_lval=$d_stdio_ptr_lval;;
12654         esac
12655         case "$stdio_cnt" in
12656         '') stdio_cnt='((fp)->_cnt)'
12657                 cnt_lval=$define
12658                 ;;
12659         *)      cnt_lval=$d_stdio_cnt_lval;;
12660         esac
12661         case "$stdio_base" in
12662         '') stdio_base='((fp)->_base)';;
12663         esac
12664         case "$stdio_bufsiz" in
12665         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12666         esac
12667 fi
12668
12669 : test whether _ptr and _cnt really work
12670 echo "Checking how std your stdio is..." >&4
12671 $cat >try.c <<EOP
12672 #include <stdio.h>
12673 #define FILE_ptr(fp)    $stdio_ptr
12674 #define FILE_cnt(fp)    $stdio_cnt
12675 int main() {
12676         FILE *fp = fopen("try.c", "r");
12677         char c = getc(fp);
12678         if (
12679                 18 <= FILE_cnt(fp) &&
12680                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12681         )
12682                 exit(0);
12683         exit(1);
12684 }
12685 EOP
12686 val="$undef"
12687 set try
12688 if eval $compile && $to try.c; then
12689         if $run ./try; then
12690                 echo "Your stdio acts pretty std."
12691                 val="$define"
12692         else
12693                 echo "Your stdio isn't very std."
12694         fi
12695 else
12696         echo "Your stdio doesn't appear very std."
12697 fi
12698 $rm -f try.c try
12699 set d_stdstdio
12700 eval $setvar
12701
12702 : Can _ptr be used as an lvalue?
12703 case "$d_stdstdio$ptr_lval" in
12704 $define$define) val=$define ;;
12705 *) val=$undef ;;
12706 esac
12707 set d_stdio_ptr_lval
12708 eval $setvar
12709
12710 : Can _cnt be used as an lvalue?
12711 case "$d_stdstdio$cnt_lval" in
12712 $define$define) val=$define ;;
12713 *) val=$undef ;;
12714 esac
12715 set d_stdio_cnt_lval
12716 eval $setvar
12717
12718
12719 : test whether setting _ptr sets _cnt as a side effect
12720 d_stdio_ptr_lval_sets_cnt="$undef"
12721 d_stdio_ptr_lval_nochange_cnt="$undef"
12722 case "$d_stdio_ptr_lval$d_stdstdio" in
12723 $define$define)
12724         echo "Checking to see what happens if we set the stdio ptr..." >&4
12725 $cat >try.c <<EOP
12726 #include <stdio.h>
12727 /* Can we scream? */
12728 /* Eat dust sed :-) */
12729 /* In the buffer space, no one can hear you scream. */
12730 #define FILE_ptr(fp)    $stdio_ptr
12731 #define FILE_cnt(fp)    $stdio_cnt
12732 #include <sys/types.h>
12733 int main() {
12734         FILE *fp = fopen("try.c", "r");
12735         int c;
12736         char *ptr;
12737         size_t cnt;
12738         if (!fp) {
12739             puts("Fail even to read");
12740             exit(1);
12741         }
12742         c = getc(fp); /* Read away the first # */
12743         if (c == EOF) {
12744             puts("Fail even to read");
12745             exit(1);
12746         }
12747         if (!(
12748                 18 <= FILE_cnt(fp) &&
12749                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12750         )) {
12751                 puts("Fail even to read");
12752                 exit (1);
12753         }
12754         ptr = (char*) FILE_ptr(fp);
12755         cnt = (size_t)FILE_cnt(fp);
12756
12757         FILE_ptr(fp) += 42;
12758
12759         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12760                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12761                 exit (1);
12762         }
12763         if (FILE_cnt(fp) <= 20) {
12764                 printf ("Fail (<20 chars to test)");
12765                 exit (1);
12766         }
12767         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12768                 puts("Fail compare");
12769                 exit (1);
12770         }
12771         if (cnt == FILE_cnt(fp)) {
12772                 puts("Pass_unchanged");
12773                 exit (0);
12774         }       
12775         if (FILE_cnt(fp) == (cnt - 42)) {
12776                 puts("Pass_changed");
12777                 exit (0);
12778         }
12779         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12780         return 1;
12781
12782 }
12783 EOP
12784         set try
12785         if eval $compile && $to try.c; then
12786                 case `$run ./try` in
12787                 Pass_changed)
12788                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12789                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12790                 Pass_unchanged)
12791                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12792                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12793                 Fail*)
12794                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12795                 *)
12796                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12797         esac
12798         else
12799                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12800         fi
12801         $rm -f try.c try
12802         ;;
12803 esac
12804
12805 : see if _base is also standard
12806 val="$undef"
12807 case "$d_stdstdio" in
12808 $define)
12809         $cat >try.c <<EOP
12810 #include <stdio.h>
12811 #define FILE_base(fp)   $stdio_base
12812 #define FILE_bufsiz(fp) $stdio_bufsiz
12813 int main() {
12814         FILE *fp = fopen("try.c", "r");
12815         char c = getc(fp);
12816         if (
12817                 19 <= FILE_bufsiz(fp) &&
12818                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12819         )
12820                 exit(0);
12821         exit(1);
12822 }
12823 EOP
12824         set try
12825         if eval $compile && $to try.c; then
12826                 if $run ./try; then
12827                         echo "And its _base field acts std."
12828                         val="$define"
12829                 else
12830                         echo "But its _base field isn't std."
12831                 fi
12832         else
12833                 echo "However, it seems to be lacking the _base field."
12834         fi
12835         $rm -f try.c try
12836         ;;
12837 esac
12838 set d_stdiobase
12839 eval $setvar
12840
12841 $cat >&4 <<EOM
12842 Checking how to access stdio streams by file descriptor number...
12843 EOM
12844 case "$stdio_stream_array" in
12845 '')     $cat >try.c <<EOCP
12846 #include <stdio.h>
12847 int main() {
12848   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12849     printf("yes\n");
12850 }
12851 EOCP
12852         for s in _iob __iob __sF
12853         do
12854                 set try -DSTDIO_STREAM_ARRAY=$s
12855                 if eval $compile; then
12856                         case "`$run ./try`" in
12857                         yes)    stdio_stream_array=$s; break ;;
12858                         esac
12859                 fi
12860         done
12861         $rm -f try.* try$exe_ext
12862 esac
12863 case "$stdio_stream_array" in
12864 '')     $cat >&4 <<EOM
12865 I can't figure out how to access stdio streams by file descriptor number.
12866 EOM
12867         d_stdio_stream_array="$undef"
12868         ;;
12869 *)      $cat >&4 <<EOM
12870 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12871 EOM
12872         d_stdio_stream_array="$define"
12873         ;;
12874 esac
12875
12876 : see if strcoll exists
12877 set strcoll d_strcoll
12878 eval $inlibc
12879
12880 : check for structure copying
12881 echo " "
12882 echo "Checking to see if your C compiler can copy structs..." >&4
12883 $cat >try.c <<'EOCP'
12884 int main()
12885 {
12886         struct blurfl {
12887                 int dyick;
12888         } foo, bar;
12889
12890         foo = bar;
12891 }
12892 EOCP
12893 if $cc -c try.c >/dev/null 2>&1 ; then
12894         val="$define"
12895         echo "Yup, it can."
12896 else
12897         val="$undef"
12898         echo "Nope, it can't."
12899 fi
12900 set d_strctcpy
12901 eval $setvar
12902 $rm -f try.*
12903
12904 : see if strerror and/or sys_errlist[] exist
12905 echo " "
12906 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12907     if set strerror val -f d_strerror; eval $csym; $val; then
12908                 echo 'strerror() found.' >&4
12909                 d_strerror="$define"
12910                 d_strerrm='strerror(e)'
12911                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12912                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12913                         d_syserrlst="$define"
12914                 else
12915                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12916                         d_syserrlst="$undef"
12917                 fi
12918     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12919                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12920                 echo 'strerror() found in string header.' >&4
12921                 d_strerror="$define"
12922                 d_strerrm='strerror(e)'
12923                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12924                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12925                                 d_syserrlst="$define"
12926                 else
12927                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12928                         d_syserrlst="$undef"
12929                 fi
12930     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12931                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12932                 d_strerror="$undef"
12933                 d_syserrlst="$define"
12934                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12935     else
12936                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12937                 d_strerror="$undef"
12938                 d_syserrlst="$undef"
12939                 d_strerrm='"unknown"'
12940     fi
12941 fi
12942
12943 : see if strftime exists
12944 set strftime d_strftime
12945 eval $inlibc
12946
12947 : see if strtod exists
12948 set strtod d_strtod
12949 eval $inlibc
12950
12951 : see if strtol exists
12952 set strtol d_strtol
12953 eval $inlibc
12954
12955 : see if strtold exists
12956 set strtold d_strtold
12957 eval $inlibc
12958
12959 : see if strtoll exists
12960 set strtoll d_strtoll
12961 eval $inlibc
12962
12963 case "$d_longlong-$d_strtoll" in
12964 "$define-$define")
12965         $cat <<EOM
12966 Checking whether your strtoll() works okay...
12967 EOM
12968         $cat >try.c <<'EOCP'
12969 #include <errno.h>
12970 #ifdef __hpux
12971 #define strtoll __strtoll
12972 #endif
12973 #ifdef __EMX__
12974 #define strtoll _strtoll
12975 #endif
12976 #include <stdio.h>
12977 extern long long int strtoll(char *s, char **, int); 
12978 static int bad = 0;
12979 int check(char *s, long long ell, int een) {
12980         long long gll;
12981         errno = 0;
12982         gll = strtoll(s, 0, 10);
12983         if (!((gll == ell) && (errno == een)))
12984                 bad++;
12985 }
12986 int main() {
12987         check(" 1",                                      1LL, 0);
12988         check(" 0",                                      0LL, 0);
12989         check("-1",                                     -1LL, 0);
12990         check("-9223372036854775808", -9223372036854775808LL, 0);
12991         check("-9223372036854775808", -9223372036854775808LL, 0);
12992         check(" 9223372036854775807",  9223372036854775807LL, 0);
12993         check("-9223372036854775808", -9223372036854775808LL, 0);
12994         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12995         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12996         if (!bad)
12997                 printf("ok\n");
12998 }
12999 EOCP
13000         set try
13001         if eval $compile; then
13002                 yyy=`$run ./try`
13003                 case "$yyy" in
13004                 ok) echo "Your strtoll() seems to be working okay." ;;
13005                 *) cat <<EOM >&4
13006 Your strtoll() doesn't seem to be working okay.
13007 EOM
13008                    d_strtoll="$undef"
13009                    ;;
13010                 esac
13011         else
13012                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13013                 d_strtoll="$undef"
13014         fi
13015         ;;
13016 esac
13017
13018 : see if strtoq exists
13019 set strtoq d_strtoq
13020 eval $inlibc
13021
13022 : see if strtoul exists
13023 set strtoul d_strtoul
13024 eval $inlibc
13025
13026 case "$d_strtoul" in
13027 "$define")
13028         $cat <<EOM
13029 Checking whether your strtoul() works okay...
13030 EOM
13031         $cat >try.c <<'EOCP'
13032 #include <errno.h>
13033 #include <stdio.h>
13034 extern unsigned long int strtoul(char *s, char **, int); 
13035 static int bad = 0;
13036 void check(char *s, unsigned long eul, int een) {
13037         unsigned long gul;
13038         errno = 0;
13039         gul = strtoul(s, 0, 10);
13040         if (!((gul == eul) && (errno == een)))
13041                 bad++;
13042 }
13043 int main() {
13044         check(" 1", 1L, 0);
13045         check(" 0", 0L, 0);
13046 EOCP
13047         case "$longsize" in
13048         8)
13049             $cat >>try.c <<'EOCP'
13050         check("18446744073709551615", 18446744073709551615UL, 0);
13051         check("18446744073709551616", 18446744073709551615UL, ERANGE);
13052 #if 0 /* strtoul() for /^-/ strings is undefined. */
13053         check("-1", 18446744073709551615UL, 0);
13054         check("-18446744073709551614", 2, 0);
13055         check("-18446744073709551615", 1, 0);
13056         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
13057         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
13058 #endif
13059 EOCP
13060                 ;;
13061         4)
13062                     $cat >>try.c <<'EOCP'
13063         check("4294967295", 4294967295UL, 0);
13064         check("4294967296", 4294967295UL, ERANGE);
13065 #if 0 /* strtoul() for /^-/ strings is undefined. */
13066         check("-1", 4294967295UL, 0);
13067         check("-4294967294", 2, 0);
13068         check("-4294967295", 1, 0);
13069         check("-4294967296", 4294967295UL, ERANGE);
13070         check("-4294967297", 4294967295UL, ERANGE);
13071 #endif
13072 EOCP
13073                 ;;
13074         *)
13075 : Should we write these tests to be more portable by sprintf-ing
13076 : ~0 and then manipulating that char string as input for strtol?
13077                 ;;
13078         esac
13079         $cat >>try.c <<'EOCP'
13080         if (!bad)
13081                 printf("ok\n");
13082         return 0;
13083 }
13084 EOCP
13085         set try
13086         if eval $compile; then
13087                 case "`$run ./try`" in
13088                 ok) echo "Your strtoul() seems to be working okay." ;;
13089                 *) cat <<EOM >&4
13090 Your strtoul() doesn't seem to be working okay.
13091 EOM
13092                    d_strtoul="$undef"
13093                    ;;
13094                 esac
13095         fi
13096         ;;
13097 esac
13098
13099 : see if strtoull exists
13100 set strtoull d_strtoull
13101 eval $inlibc
13102
13103 case "$d_longlong-$d_strtoull" in
13104 "$define-$define")
13105         $cat <<EOM
13106 Checking whether your strtoull() works okay...
13107 EOM
13108         $cat >try.c <<'EOCP'
13109 #include <errno.h>
13110 #ifdef __hpux
13111 #define strtoull __strtoull
13112 #endif
13113 #include <stdio.h>
13114 extern unsigned long long int strtoull(char *s, char **, int); 
13115 static int bad = 0;
13116 int check(char *s, long long eull, int een) {
13117         long long gull;
13118         errno = 0;
13119         gull = strtoull(s, 0, 10);
13120         if (!((gull == eull) && (errno == een)))
13121                 bad++;
13122 }
13123 int main() {
13124         check(" 1",                                        1LL, 0);
13125         check(" 0",                                        0LL, 0);
13126         check("18446744073709551615",  18446744073709551615ULL, 0);
13127         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13128 #if 0 /* strtoull() for /^-/ strings is undefined. */
13129         check("-1",                    18446744073709551615ULL, 0);
13130         check("-18446744073709551614",                     2LL, 0);
13131         check("-18446744073709551615",                     1LL, 0);
13132         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13133         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13134 #endif
13135         if (!bad)
13136                 printf("ok\n");
13137 }
13138 EOCP
13139         set try
13140         if eval $compile; then
13141                 case "`$run ./try`" in
13142                 ok) echo "Your strtoull() seems to be working okay." ;;
13143                 *) cat <<EOM >&4
13144 Your strtoull() doesn't seem to be working okay.
13145 EOM
13146                    d_strtoull="$undef"
13147                    ;;
13148                 esac
13149         fi
13150         ;;
13151 esac
13152
13153 : see if strtouq exists
13154 set strtouq d_strtouq
13155 eval $inlibc
13156
13157 case "$d_strtouq" in
13158 "$define")
13159         $cat <<EOM
13160 Checking whether your strtouq() works okay...
13161 EOM
13162         $cat >try.c <<'EOCP'
13163 #include <errno.h>
13164 #include <stdio.h>
13165 extern unsigned long long int strtouq(char *s, char **, int); 
13166 static int bad = 0;
13167 void check(char *s, unsigned long long eull, int een) {
13168         unsigned long long gull;
13169         errno = 0;
13170         gull = strtouq(s, 0, 10);
13171         if (!((gull == eull) && (errno == een)))
13172                 bad++;
13173 }
13174 int main() {
13175         check(" 1",                                        1LL, 0);
13176         check(" 0",                                        0LL, 0);
13177         check("18446744073709551615",  18446744073709551615ULL, 0);
13178         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13179 #if 0 /* strtouq() for /^-/ strings is undefined. */
13180         check("-1",                    18446744073709551615ULL, 0);
13181         check("-18446744073709551614",                     2LL, 0);
13182         check("-18446744073709551615",                     1LL, 0);
13183         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13184         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13185 #endif
13186         if (!bad)
13187                 printf("ok\n");
13188         return 0;
13189 }
13190 EOCP
13191         set try
13192         if eval $compile; then
13193                 case "`$run ./try`" in
13194                 ok) echo "Your strtouq() seems to be working okay." ;;
13195                 *) cat <<EOM >&4
13196 Your strtouq() doesn't seem to be working okay.
13197 EOM
13198                    d_strtouq="$undef"
13199                    ;;
13200                 esac
13201         fi
13202         ;;
13203 esac
13204
13205 : see if strxfrm exists
13206 set strxfrm d_strxfrm
13207 eval $inlibc
13208
13209 : see if symlink exists
13210 set symlink d_symlink
13211 eval $inlibc
13212
13213 : see if syscall exists
13214 set syscall d_syscall
13215 eval $inlibc
13216
13217 : see if prototype for syscall is available
13218 echo " "
13219 set d_syscallproto syscall $i_unistd unistd.h
13220 eval $hasproto
13221
13222 : see if sysconf exists
13223 set sysconf d_sysconf
13224 eval $inlibc
13225
13226 : see if system exists
13227 set system d_system
13228 eval $inlibc
13229
13230 : see if tcgetpgrp exists
13231 set tcgetpgrp d_tcgetpgrp
13232 eval $inlibc
13233
13234 : see if tcsetpgrp exists
13235 set tcsetpgrp d_tcsetpgrp
13236 eval $inlibc
13237
13238 : see if prototype for telldir is available
13239 echo " "
13240 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13241 eval $hasproto
13242
13243 : see if this is a sys/times.h system
13244 set sys/times.h i_systimes
13245 eval $inhdr
13246
13247 : see if times exists
13248 echo " "
13249 if set times val -f d_times; eval $csym; $val; then
13250         echo 'times() found.' >&4
13251         d_times="$define"
13252         inc=''
13253         case "$i_systimes" in
13254         "$define") inc='sys/times.h';;
13255         esac
13256         rp="What is the type returned by times() on this system?"
13257         set clock_t clocktype long stdio.h sys/types.h $inc
13258         eval $typedef_ask
13259 else
13260         echo 'times() NOT found, hope that will do.' >&4
13261         d_times="$undef"
13262         clocktype='int'
13263 fi
13264
13265 : see if truncate exists
13266 set truncate d_truncate
13267 eval $inlibc
13268
13269 : see if tzname[] exists
13270 echo " "
13271 if set tzname val -a d_tzname; eval $csym; $val; then
13272         val="$define"
13273         echo 'tzname[] found.' >&4
13274 else
13275         val="$undef"
13276         echo 'tzname[] NOT found.' >&4
13277 fi
13278 set d_tzname
13279 eval $setvar
13280
13281 case "$osname" in
13282 next|rhapsody|darwin) multiarch="$define" ;;
13283 esac
13284 case "$multiarch" in
13285 ''|[nN]*) multiarch="$undef" ;;
13286 esac
13287
13288 : check for ordering of bytes in a long
13289 echo " "
13290 case "$usecrosscompile$multiarch" in
13291 *$define*)
13292         $cat <<EOM
13293 You seem to be either cross-compiling or doing a multiarchitecture build,
13294 skipping the byteorder check.
13295
13296 EOM
13297         byteorder='ffff'
13298         ;;
13299 *)
13300         case "$byteorder" in
13301         '')
13302                 $cat <<'EOM'
13303 In the following, larger digits indicate more significance.  A big-endian
13304 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13305 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13306 machines may have weird orders like 3412.  A Cray will report 87654321,
13307 an Alpha will report 12345678. If the test program works the default is
13308 probably right.
13309 I'm now running the test program...
13310 EOM
13311                 $cat >try.c <<'EOCP'
13312 #include <stdio.h>
13313 int main()
13314 {
13315         int i;
13316         union {
13317                 unsigned long l;
13318                 char c[sizeof(long)];
13319         } u;
13320
13321         if (sizeof(long) > 4)
13322                 u.l = (0x08070605L << 32) | 0x04030201L;
13323         else
13324                 u.l = 0x04030201L;
13325         for (i = 0; i < sizeof(long); i++)
13326                 printf("%c", u.c[i]+'0');
13327         printf("\n");
13328         exit(0);
13329 }
13330 EOCP
13331                 xxx_prompt=y
13332                 set try
13333                 if eval $compile && ./try > /dev/null; then
13334                         dflt=`$run ./try`
13335                         case "$dflt" in
13336                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13337                                 echo "(The test program ran ok.)"
13338                                 echo "byteorder=$dflt"
13339                                 xxx_prompt=n
13340                         ;;
13341                         ????|????????) echo "(The test program ran ok.)" ;;
13342                         *) echo "(The test program didn't run right for some reason.)" ;;
13343                         esac
13344                 else
13345                         dflt='4321'
13346                         cat <<'EOM'
13347 (I can't seem to compile the test program.  Guessing big-endian...)
13348 EOM
13349                 fi
13350                 case "$xxx_prompt" in
13351                 y)
13352                         rp="What is the order of bytes in a long?"
13353                         . ./myread
13354                         byteorder="$ans"
13355                         ;;
13356                 *)      byteorder=$dflt
13357                         ;;
13358                 esac
13359                 ;;
13360         esac
13361         $rm -f try.c try
13362         ;;
13363 esac
13364
13365
13366 $cat <<EOM
13367
13368 Checking to see whether you can access character data unalignedly...
13369 EOM
13370 $cat >try.c <<EOCP
13371 #include <stdio.h>
13372 #define U32 $u32type
13373 #define BYTEORDER $byteorder
13374 int main() {
13375 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13376     U8 buf[] = "\0\0\0\1\0\0\0\0";
13377     U32 *up;
13378     int i;
13379
13380     if (sizeof(U32) != 4) {
13381         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13382         exit(1);
13383     }
13384
13385     fflush(stdout);
13386
13387     for (i = 0; i < 4; i++) {
13388         up = (U32*)(buf + i);
13389         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13390                (*up == 1 << (8*(3-i)))  /* little-endian */
13391               )
13392            )
13393         {
13394             printf("read failed (%x)\n", *up);
13395             exit(2);
13396         }
13397     }
13398
13399     /* write test */
13400     for (i = 0; i < 4; i++) {
13401         up = (U32*)(buf + i);
13402         *up = 0xBeef;
13403         if (*up != 0xBeef) {
13404             printf("write failed (%x)\n", *up);
13405             exit(3);
13406         }
13407     }
13408
13409     exit(0);
13410 #else
13411     printf("1\n");
13412     exit(1);
13413 #endif
13414     return 0;
13415 }
13416 EOCP
13417 set try
13418 if eval $compile_ok; then
13419         echo "(Testing for character data alignment may dump core.)" >&4
13420         $run ./try 2>&1 >/dev/null
13421         case "$?" in
13422         0)      cat >&4 <<EOM
13423 You can access character data pretty unalignedly.
13424 EOM
13425                 d_u32align="$undef"
13426                 ;;
13427         *)      cat >&4 <<EOM
13428 It seems that you must access character data in an aligned manner.
13429 EOM
13430                 d_u32align="$define"
13431                 ;;
13432         esac
13433         $rm -f core core.try.* try.core
13434 else
13435         rp='Can you access character data at unaligned addresses?'
13436         dflt='n'
13437         . ./myread
13438         case "$ans" in
13439         [yY]*)  d_u32align="$undef"  ;;
13440         *)      d_u32align="$define" ;;
13441         esac
13442 fi
13443
13444 : see if ualarm exists
13445 set ualarm d_ualarm
13446 eval $inlibc
13447
13448 : see if umask exists
13449 set umask d_umask
13450 eval $inlibc
13451
13452 : see if unordered exists
13453 set unordered d_unordered
13454 eval $inlibc
13455
13456 : see if usleep exists
13457 set usleep d_usleep
13458 eval $inlibc
13459
13460 : see if prototype for usleep is available
13461 echo " "
13462 set d_usleepproto usleep $i_unistd unistd.h
13463 eval $hasproto
13464
13465 : see if ustat exists
13466 set ustat d_ustat
13467 eval $inlibc
13468
13469 : backward compatibility for d_hvfork
13470 if test X$d_hvfork != X; then
13471         d_vfork="$d_hvfork"
13472         d_hvfork=''
13473 fi
13474 : see if there is a vfork
13475 val=''
13476 set vfork val
13477 eval $inlibc
13478
13479 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13480 : perl on Solaris 2.x, and probably elsewhere.
13481 case "$val" in
13482 $define)
13483         echo " "
13484         case "$usevfork" in
13485         false) dflt='n';;
13486         *) dflt='y';;
13487         esac
13488         cat <<'EOM'
13489  
13490 Perl can only use a vfork() that doesn't suffer from strict
13491 restrictions on calling functions or modifying global data in
13492 the child.  For example, glibc-2.1 contains such a vfork()
13493 that is unsuitable.  If your system provides a proper fork()
13494 call, chances are that you do NOT want perl to use vfork().
13495
13496 EOM
13497         rp="Do you still want to use vfork()?"
13498         . ./myread
13499         case "$ans" in
13500         y|Y) ;;
13501         *)
13502                 echo "Ok, we won't use vfork()."
13503                 val="$undef"
13504                 ;;
13505         esac
13506         ;;
13507 esac
13508 set d_vfork
13509 eval $setvar
13510 case "$d_vfork" in
13511 $define) usevfork='true';;
13512 *) usevfork='false';;
13513 esac
13514
13515 : see if closedir exists
13516 set closedir d_closedir
13517 eval $inlibc
13518
13519 case "$d_closedir" in
13520 "$define")
13521         echo " "
13522         echo "Checking whether closedir() returns a status..." >&4
13523         cat > try.c <<EOM
13524 #$i_dirent I_DIRENT             /**/
13525 #$i_sysdir I_SYS_DIR            /**/
13526 #$i_sysndir I_SYS_NDIR          /**/
13527 #$i_systypes I_SYS_TYPES        /**/
13528
13529 #if defined(I_SYS_TYPES)
13530 #include <sys/types.h>
13531 #endif
13532 #if defined(I_DIRENT)
13533 #include <dirent.h>
13534 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13535 #include <sys/dir.h>
13536 #endif
13537 #else
13538 #ifdef I_SYS_NDIR
13539 #include <sys/ndir.h>
13540 #else
13541 #ifdef I_SYS_DIR
13542 #ifdef hp9000s500
13543 #include <ndir.h>       /* may be wrong in the future */
13544 #else
13545 #include <sys/dir.h>
13546 #endif
13547 #endif
13548 #endif
13549 #endif 
13550 int main() { return closedir(opendir(".")); }
13551 EOM
13552         set try
13553         if eval $compile_ok; then
13554                 if $run ./try > /dev/null 2>&1 ; then
13555                         echo "Yes, it does."
13556                         val="$undef"
13557                 else
13558                         echo "No, it doesn't."
13559                         val="$define"
13560                 fi
13561         else
13562                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13563                 val="$define"
13564         fi
13565         ;;
13566 *)
13567         val="$undef";
13568         ;;
13569 esac
13570 set d_void_closedir
13571 eval $setvar
13572 $rm -f try try.*
13573 : see if there is a wait4
13574 set wait4 d_wait4
13575 eval $inlibc
13576
13577 : see if waitpid exists
13578 set waitpid d_waitpid
13579 eval $inlibc
13580
13581 : see if wcstombs exists
13582 set wcstombs d_wcstombs
13583 eval $inlibc
13584
13585 : see if wctomb exists
13586 set wctomb d_wctomb
13587 eval $inlibc
13588
13589 : see if writev exists
13590 set writev d_writev
13591 eval $inlibc
13592
13593 : preserve RCS keywords in files with variable substitution, grrr
13594 Date='$Date'
13595 Id='$Id'
13596 Log='$Log'
13597 RCSfile='$RCSfile'
13598 Revision='$Revision'
13599
13600 : check for alignment requirements
13601 echo " "
13602 case "$usecrosscompile$multiarch" in
13603 *$define*)
13604         $cat <<EOM
13605 You seem to be either cross-compiling or doing a multiarchitecture build,
13606 skipping the memory alignment check.
13607
13608 EOM
13609         case "$alignbytes" in
13610         '') alignbytes=8 ;;
13611         esac
13612         ;;
13613 *)
13614         case "$alignbytes" in
13615         '') echo "Checking alignment constraints..." >&4
13616                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13617                         $cat >try.c <<'EOCP'
13618 typedef long double NV;
13619 EOCP
13620                 else
13621                         $cat >try.c <<'EOCP'
13622 typedef double NV;
13623 EOCP
13624                 fi
13625                 $cat >>try.c <<'EOCP'
13626 #include <stdio.h>
13627 struct foobar {
13628         char foo;
13629         NV bar;
13630 } try_algn;
13631 int main()
13632 {
13633     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13634     return(0);
13635 }
13636 EOCP
13637                 set try
13638                 if eval $compile_ok; then
13639                         dflt=`$run ./try`
13640                 else
13641                         dflt='8'
13642                         echo "(I can't seem to compile the test program...)"
13643                 fi
13644                 ;;
13645         *) dflt="$alignbytes"
13646                 ;;
13647         esac
13648         rp="Doubles must be aligned on a how-many-byte boundary?"
13649         . ./myread
13650         alignbytes="$ans"
13651         $rm -f try.c try
13652         ;;
13653 esac
13654
13655
13656 : set the base revision
13657 baserev=5.0
13658
13659 : how do we catenate cpp tokens here?
13660 echo " "
13661 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13662 $cat >cpp_stuff.c <<'EOCP'
13663 #define RCAT(a,b)a/**/b
13664 #define ACAT(a,b)a ## b
13665 RCAT(Rei,ser)
13666 ACAT(Cir,cus)
13667 EOCP
13668 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13669 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13670         echo "Oh!  Smells like ANSI's been here." >&4
13671         echo "We can catify or stringify, separately or together!"
13672         cpp_stuff=42
13673 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13674         echo "Ah, yes!  The good old days!" >&4
13675         echo "However, in the good old days we don't know how to stringify and"
13676         echo "catify at the same time."
13677         cpp_stuff=1
13678 else
13679         $cat >&4 <<EOM
13680 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13681 to have to edit the values of CAT[2-5] in config.h...
13682 EOM
13683         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13684 fi
13685 $rm -f cpp_stuff.*
13686
13687 : see if this is a db.h system
13688 set db.h i_db
13689 eval $inhdr
13690
13691 case "$i_db" in
13692 $define)
13693         : Check db version.
13694         echo " "
13695         echo "Checking Berkeley DB version ..." >&4
13696         $cat >try.c <<EOCP
13697 #$d_const HASCONST
13698 #ifndef HASCONST
13699 #define const
13700 #endif
13701 #include <sys/types.h>
13702 #include <stdio.h>
13703 #include <db.h>
13704 int main(int argc, char *argv[])
13705 {
13706 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13707     int Major, Minor, Patch ;
13708     unsigned long Version ;
13709     (void)db_version(&Major, &Minor, &Patch) ;
13710     if (argc == 2) {
13711         printf("%d %d %d %d %d %d\n",
13712                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13713                Major, Minor, Patch);
13714         exit(0);
13715     }
13716     printf("You have Berkeley DB Version 2 or greater.\n");
13717
13718     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13719                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13720     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13721                 Major, Minor, Patch) ;
13722
13723     /* check that db.h & libdb are compatible */
13724     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13725         printf("db.h and libdb are incompatible.\n") ;
13726         exit(3);        
13727     }
13728
13729     printf("db.h and libdb are compatible.\n") ;
13730
13731     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13732                 + DB_VERSION_PATCH ;
13733
13734     /* needs to be >= 2.3.4 */
13735     if (Version < 2003004) {
13736     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13737         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13738         exit(2);        
13739     }
13740
13741     exit(0);
13742 #else
13743 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13744     if (argc == 2) {
13745         printf("1 0 0\n");
13746         exit(0);
13747     }
13748     printf("You have Berkeley DB Version 1.\n");
13749     exit(0);    /* DB version < 2: the coast is clear. */
13750 #else
13751     exit(1);    /* <db.h> not Berkeley DB? */
13752 #endif
13753 #endif
13754 }
13755 EOCP
13756         set try
13757         if eval $compile_ok && $run ./try; then
13758                 echo 'Looks OK.' >&4
13759                 set `$run ./try 1`
13760                 db_version_major=$1
13761                 db_version_minor=$2
13762                 db_version_patch=$3
13763         else
13764                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13765                 i_db=$undef
13766                 case " $libs " in
13767                 *"-ldb "*)
13768                         : Remove db from list of libraries to use
13769                         echo "Removing unusable -ldb from library list" >&4
13770                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13771                         shift
13772                         libs="$*"
13773                         echo "libs = $libs" >&4
13774                         ;;
13775                 esac
13776         fi
13777         $rm -f try.*
13778         ;;
13779 esac
13780
13781 case "$i_db" in
13782 define)
13783         : Check the return type needed for hash 
13784         echo " "
13785         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13786         $cat >try.c <<EOCP
13787 #$d_const HASCONST
13788 #ifndef HASCONST
13789 #define const
13790 #endif
13791 #include <sys/types.h>
13792 #include <db.h>
13793
13794 #ifndef DB_VERSION_MAJOR
13795 u_int32_t hash_cb (ptr, size)
13796 const void *ptr;
13797 size_t size;
13798 {
13799 }
13800 HASHINFO info;
13801 int main()
13802 {
13803         info.hash = hash_cb;
13804 }
13805 #endif
13806 EOCP
13807         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13808                 if $contains warning try.out >>/dev/null 2>&1 ; then
13809                         db_hashtype='int'
13810                 else
13811                         db_hashtype='u_int32_t'
13812                 fi
13813         else
13814                 : XXX Maybe we should just give up here.
13815                 db_hashtype=u_int32_t
13816                 $cat try.out >&4
13817                 echo "Help:  I can't seem to compile the db test program." >&4
13818                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13819         fi
13820         $rm -f try.*
13821         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13822         ;;
13823 *)      db_hashtype=u_int32_t
13824         ;;
13825 esac
13826 case "$i_db" in
13827 define)
13828         : Check the return type needed for prefix 
13829         echo " "
13830         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13831         cat >try.c <<EOCP
13832 #$d_const HASCONST
13833 #ifndef HASCONST
13834 #define const
13835 #endif
13836 #include <sys/types.h>
13837 #include <db.h>
13838
13839 #ifndef DB_VERSION_MAJOR
13840 size_t prefix_cb (key1, key2)
13841 const DBT *key1;
13842 const DBT *key2;
13843 {
13844 }
13845 BTREEINFO info;
13846 int main()
13847 {
13848         info.prefix = prefix_cb;
13849 }
13850 #endif
13851 EOCP
13852         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13853                 if $contains warning try.out >>/dev/null 2>&1 ; then
13854                         db_prefixtype='int'
13855                 else
13856                         db_prefixtype='size_t'
13857                 fi
13858         else
13859                 db_prefixtype='size_t'
13860                 : XXX Maybe we should just give up here.
13861                 $cat try.out >&4
13862                 echo "Help:  I can't seem to compile the db test program." >&4
13863                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13864         fi
13865         $rm -f try.*
13866         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13867         ;;
13868 *)      db_prefixtype='size_t'
13869         ;;
13870 esac
13871
13872
13873 : How can we generate normalized random numbers ?
13874 echo " "
13875 echo "Looking for a random number function..." >&4
13876 case "$randfunc" in
13877 '')
13878         if set drand48 val -f; eval $csym; $val; then
13879                 dflt="drand48"
13880                 echo "Good, found drand48()." >&4
13881         elif set random val -f; eval $csym; $val; then
13882                 dflt="random"
13883                 echo "OK, found random()." >&4
13884         else
13885                 dflt="rand"
13886                 echo "Yick, looks like I have to use rand()." >&4
13887         fi
13888         echo " "
13889         ;;
13890 *)
13891         dflt="$randfunc"
13892         ;;
13893 esac
13894 cont=true
13895
13896 case "$ccflags" in
13897 *-Dmy_rand=*|*-Dmy_srand=*)
13898         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13899         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13900         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13901         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13902         ;;
13903 esac
13904
13905 while $test "$cont"; do
13906         rp="Use which function to generate random numbers?"
13907         . ./myread
13908         if $test "$ans" = "$dflt"; then
13909                 : null
13910         else
13911                 randbits=''
13912         fi
13913         randfunc="$ans"
13914         if set $ans val -f; eval $csym; $val; then
13915                 cont=''
13916         else
13917                 dflt=y
13918                 rp="I cannot find function $ans. Use that name anyway?"
13919                 . ./myread
13920                 dflt=rand
13921                 case "$ans" in
13922                         [yY]*) cont='';;
13923                 esac
13924         fi
13925         case "$cont" in
13926         '')
13927                 case "$randfunc" in
13928                 drand48)
13929                         drand01="drand48()"
13930                         seedfunc="srand48"
13931                         randbits=48
13932                         randseedtype=long
13933                         ;;
13934                 rand|random)
13935                         case "$randbits" in
13936                         '')
13937 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13938                                 $cat >try.c <<EOCP
13939 #$i_unistd I_UNISTD
13940 #$i_stdlib I_STDLIB
13941 #include <stdio.h>
13942 #ifdef I_UNISTD
13943 #  include <unistd.h>
13944 #endif
13945 #ifdef I_STDLIB
13946 #  include <stdlib.h>
13947 #endif
13948 int main()
13949 {
13950         register int i;
13951         register unsigned long tmp;
13952         register unsigned long max = 0L;
13953
13954         for (i = 1000; i; i--) {
13955                 tmp = (unsigned long) $randfunc();
13956                 if (tmp > max) max = tmp;
13957         }
13958         for (i = 0; max; i++)
13959                 max /= 2;
13960         printf("%d\n",i);
13961 }
13962 EOCP
13963                                 set try
13964                                 if eval $compile_ok; then
13965                                         dflt=`try`
13966                                 else
13967                                         dflt='?'
13968                                         echo "(I can't seem to compile the test program...)"
13969                                 fi
13970                                 ;;
13971                         *)
13972                                 dflt="$randbits"
13973                                 ;;
13974                         esac
13975                         rp="How many bits does your $randfunc() function produce?"
13976                         . ./myread
13977                         randbits="$ans"
13978                         $rm -f try.c try
13979                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13980                         seedfunc="s$randfunc"
13981                         randseedtype=unsigned
13982                         ;;
13983                 *)
13984                         dflt="31"
13985                         rp="How many bits does your $randfunc() function produce?"
13986                         . ./myread
13987                         randbits="$ans"
13988                         seedfunc="s$randfunc"
13989                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13990                         if set $seedfunc val -f; eval $csym; $val; then
13991                                 echo "(Using $seedfunc() to seed random generator)"
13992                         else
13993                                 echo "(Warning: no $seedfunc() to seed random generator)"
13994                                 seedfunc=rand
13995                         fi
13996                         randseedtype=unsigned
13997                         ;;
13998                 esac
13999                 ;;
14000         esac
14001 done
14002
14003 echo " "
14004 echo "Determining whether or not we are on an EBCDIC system..." >&4
14005 $cat >try.c <<'EOM'
14006 int main()
14007 {
14008   if ('M'==0xd4) return 0;
14009   return 1;
14010 }
14011 EOM
14012
14013 val=$undef
14014 set try
14015 if eval $compile_ok; then
14016         if $run ./try; then
14017                 echo "You seem to speak EBCDIC." >&4
14018                 val="$define"
14019         else
14020                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
14021         fi
14022 else
14023         echo "I'm unable to compile the test program." >&4
14024         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
14025 fi
14026 $rm -f try try.*
14027 set ebcdic
14028 eval $setvar
14029
14030 echo " "
14031 $cat >&4 <<EOM
14032 Checking how to flush all pending stdio output...
14033 EOM
14034 # I only know how to find the first 32 possibly open files on SunOS.
14035 # See also hints/sunos_4_1.sh and util.c  --AD
14036 case "$osname" in
14037 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
14038 esac
14039 $cat >>try.c <<EOCP
14040 #include <stdio.h>
14041 #$i_unistd I_UNISTD
14042 #ifdef I_UNISTD
14043 # include <unistd.h>
14044 #endif
14045 #$d_sysconf HAS_SYSCONF
14046 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
14047 #ifdef HAS_STDIO_STREAM_ARRAY
14048 # define STDIO_STREAM_ARRAY $stdio_stream_array
14049 #endif
14050 int main() {
14051   FILE* p;
14052   unlink("try.out");
14053   p = fopen("try.out", "w");
14054 #ifdef TRY_FPUTC
14055   fputc('x', p);
14056 #else
14057 # ifdef TRY_FPRINTF
14058   fprintf(p, "x");
14059 # endif
14060 #endif
14061 #ifdef TRY_FFLUSH_NULL
14062   fflush(NULL);
14063 #endif
14064 #ifdef TRY_FFLUSH_ALL
14065   {
14066     long open_max = -1;
14067 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
14068     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
14069 # else
14070 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
14071     open_max = sysconf(_SC_OPEN_MAX);
14072 #  else
14073 #   ifdef FOPEN_MAX
14074     open_max = FOPEN_MAX;
14075 #   else
14076 #    ifdef OPEN_MAX
14077     open_max = OPEN_MAX;
14078 #    else
14079 #     ifdef _NFILE
14080     open_max = _NFILE;
14081 #     endif
14082 #    endif
14083 #   endif
14084 #  endif
14085 # endif 
14086 # ifdef HAS_STDIO_STREAM_ARRAY
14087     if (open_max > 0) {
14088       long i;
14089       for (i = 0; i < open_max; i++)
14090             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
14091                 STDIO_STREAM_ARRAY[i]._file < open_max &&
14092                 STDIO_STREAM_ARRAY[i]._flag)
14093                 fflush(&STDIO_STREAM_ARRAY[i]);
14094     }   
14095   }
14096 # endif
14097 #endif
14098   _exit(42);
14099 }
14100 EOCP
14101 : first we have to find out how _not_ to flush
14102 $to try.c
14103 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
14104     output=''
14105     set try -DTRY_FPUTC
14106     if eval $compile; then
14107             $run ./try 2>/dev/null
14108             code="$?"
14109             $from try.out
14110             if $test ! -s try.out -a "X$code" = X42; then
14111                 output=-DTRY_FPUTC
14112             fi
14113     fi
14114     case "$output" in
14115     '')
14116             set try -DTRY_FPRINTF
14117             if eval $compile; then
14118                     $run ./try 2>/dev/null
14119                     code="$?"
14120                     $from try.out
14121                     if $test ! -s try.out -a "X$code" = X42; then
14122                         output=-DTRY_FPRINTF
14123                     fi
14124             fi
14125         ;;
14126     esac
14127 fi
14128 : check for fflush NULL behaviour
14129 case "$fflushNULL" in
14130 '')     set try -DTRY_FFLUSH_NULL $output
14131         if eval $compile; then
14132                 $run ./try 2>/dev/null
14133                 code="$?"
14134                 $from try.out
14135                 if $test -s try.out -a "X$code" = X42; then
14136                         fflushNULL="`$cat try.out`"
14137                 else
14138                         if $test "X$code" != X42; then
14139                                 $cat >&4 <<EOM
14140 (If this test failed, don't worry, we'll try another method shortly.)
14141 EOM
14142                         fi
14143                 fi
14144         fi
14145         $rm -f core try.core core.try.*
14146         case "$fflushNULL" in
14147         x)      $cat >&4 <<EOM
14148 Your fflush(NULL) works okay for output streams.
14149 Let's see if it clobbers input pipes...
14150 EOM
14151 # As of mid-March 2000 all versions of Solaris appear to have a stdio
14152 # bug that improperly flushes the input end of pipes.  So we avoid the
14153 # autoflush on fork/system/exec support for now. :-(
14154 $cat >tryp.c <<EOCP
14155 #include <stdio.h>
14156 int
14157 main(int argc, char **argv)
14158 {
14159     char buf[1024];
14160     int i;
14161     char *bp = buf;
14162     while (1) {
14163         while ((i = getc(stdin)) != -1
14164                && (*bp++ = i) != '\n'
14165                && bp < &buf[1024])
14166         /* DO NOTHING */ ;
14167         *bp = '\0';
14168         fprintf(stdout, "%s", buf);
14169         fflush(NULL);
14170         if (i == -1)
14171             return 0;
14172         bp = buf;
14173     }
14174 }
14175 EOCP
14176                 fflushNULL="$define"
14177                 set tryp
14178                 if eval $compile; then
14179                     $rm -f tryp.out
14180                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14181                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
14182                        $cat >&4 <<EOM
14183 fflush(NULL) seems to behave okay with input streams.
14184 EOM
14185                         fflushNULL="$define"
14186                     else
14187                         $cat >&4 <<EOM
14188 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
14189 EOM
14190                         fflushNULL="$undef"
14191                     fi
14192                 fi
14193                 $rm -f core tryp.c tryp.core core.tryp.*
14194                 ;;
14195         '')     $cat >&4 <<EOM
14196 Your fflush(NULL) isn't working (contrary to ANSI C).
14197 EOM
14198                 fflushNULL="$undef"
14199                 ;;
14200         *)      $cat >&4 <<EOM
14201 Cannot figure out whether your fflush(NULL) works or not.
14202 I'm assuming it doesn't (contrary to ANSI C).
14203 EOM
14204                 fflushNULL="$undef"
14205                 ;;
14206         esac
14207         ;;
14208 $define|true|[yY]*)
14209         fflushNULL="$define"
14210         ;;
14211 *)
14212         fflushNULL="$undef"
14213         ;;
14214 esac
14215 : check explicit looping only if NULL did not work, and if the pipe
14216 : bug does not show up on an explicit flush too
14217 case "$fflushNULL" in
14218 "$undef")
14219         $cat >tryp.c <<EOCP
14220 #include <stdio.h>
14221 int
14222 main(int argc, char **argv)
14223 {
14224     char buf[1024];
14225     int i;
14226     char *bp = buf;
14227     while (1) {
14228         while ((i = getc(stdin)) != -1
14229                && (*bp++ = i) != '\n'
14230                && bp < &buf[1024])
14231         /* DO NOTHING */ ;
14232         *bp = '\0';
14233         fprintf(stdout, "%s", buf);
14234         fflush(stdin);
14235         if (i == -1)
14236             return 0;
14237         bp = buf;
14238     }
14239 }
14240 EOCP
14241         set tryp
14242         if eval $compile; then
14243             $rm -f tryp.out
14244             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14245             if cmp tryp.c tryp.out >/dev/null 2>&1; then
14246                $cat >&4 <<EOM
14247 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14248 EOM
14249                 : now check for fflushall behaviour
14250                 case "$fflushall" in
14251                 '')     set try -DTRY_FFLUSH_ALL $output
14252                         if eval $compile; then
14253                                 $cat >&4 <<EOM
14254 (Now testing the other method--but note that this also may fail.)
14255 EOM
14256                                 $run ./try 2>/dev/null
14257                                 code=$?
14258                                 $from try.out
14259                                 if $test -s try.out -a "X$code" = X42; then
14260                                         fflushall="`$cat try.out`"
14261                                 fi
14262                         fi
14263                         $rm -f core try.core core.try.*
14264                         case "$fflushall" in
14265                         x)      $cat >&4 <<EOM
14266 Whew. Flushing explicitly all the stdio streams works.
14267 EOM
14268                                 fflushall="$define"
14269                                 ;;
14270                         '')     $cat >&4 <<EOM
14271 Sigh. Flushing explicitly all the stdio streams doesn't work.
14272 EOM
14273                                 fflushall="$undef"
14274                                 ;;
14275                         *)      $cat >&4 <<EOM
14276 Cannot figure out whether flushing stdio streams explicitly works or not.
14277 I'm assuming it doesn't.
14278 EOM
14279                                 fflushall="$undef"
14280                                 ;;
14281                         esac
14282                         ;;
14283                 "$define"|true|[yY]*)
14284                         fflushall="$define"
14285                         ;;
14286                 *)
14287                         fflushall="$undef"
14288                         ;;
14289                 esac
14290             else
14291                 $cat >&4 <<EOM
14292 All is futile.  Even fflush(stdin) clobbers input pipes!
14293 EOM
14294                 fflushall="$undef"
14295             fi
14296         else
14297             fflushall="$undef"
14298         fi
14299         $rm -f core tryp.c tryp.core core.tryp.*
14300         ;;
14301 *)      fflushall="$undef"
14302         ;;
14303 esac
14304
14305 case "$fflushNULL$fflushall" in
14306 undefundef)
14307         $cat <<EOM
14308 OK, I give up.  I cannot figure out how to flush pending stdio output.
14309 We won't be flushing handles at all before fork/exec/popen.
14310 EOM
14311         ;;
14312 esac
14313 $rm -f try.* try$exe_ext
14314
14315 : Store the full pathname to the ar program for use in the C program
14316 : Respect a hint or command line value for full_ar.
14317 case "$full_ar" in
14318 '') full_ar=$ar ;;
14319 esac
14320
14321 : Store the full pathname to the sed program for use in the C program
14322 full_sed=$sed
14323
14324 : see what type gids are declared as in the kernel
14325 echo " "
14326 echo "Looking for the type for group ids returned by getgid()."
14327 set gid_t gidtype xxx stdio.h sys/types.h
14328 eval $typedef
14329 case "$gidtype" in
14330 xxx)
14331         xxx=`./findhdr sys/user.h`
14332         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14333         case $1 in
14334         unsigned) dflt="$1 $2" ;;
14335         *) dflt="$1" ;;
14336         esac
14337         ;;
14338 *) dflt="$gidtype";;
14339 esac
14340 case "$gidtype" in
14341 gid_t) echo "gid_t found." ;;
14342 *)      rp="What is the type for group ids returned by getgid()?"
14343         . ./myread
14344         gidtype="$ans"
14345         ;;
14346 esac
14347
14348 echo " "
14349 case "$gidtype" in
14350 *_t) zzz="$gidtype"     ;;
14351 *)   zzz="gid"          ;;
14352 esac
14353 echo "Checking the size of $zzz..." >&4 
14354 cat > try.c <<EOCP
14355 #include <sys/types.h>
14356 #include <stdio.h>
14357 int main() {
14358     printf("%d\n", (int)sizeof($gidtype));
14359     exit(0);
14360 }
14361 EOCP
14362 set try
14363 if eval $compile_ok; then
14364         yyy=`$run ./try`
14365         case "$yyy" in
14366         '')     gidsize=4
14367                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14368                 ;;
14369         *)      gidsize=$yyy
14370                 echo "Your $zzz is $gidsize bytes long."
14371                 ;;
14372         esac
14373 else
14374         gidsize=4
14375         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14376 fi
14377
14378
14379 echo " "
14380 case "$gidtype" in
14381 *_t) zzz="$gidtype"     ;;
14382 *)   zzz="gid"          ;;
14383 esac
14384 echo "Checking the sign of $zzz..." >&4 
14385 cat > try.c <<EOCP
14386 #include <sys/types.h>
14387 #include <stdio.h>
14388 int main() {
14389         $gidtype foo = -1;
14390         if (foo < 0)
14391                 printf("-1\n");
14392         else
14393                 printf("1\n");
14394 }
14395 EOCP
14396 set try
14397 if eval $compile; then
14398         yyy=`$run ./try`
14399         case "$yyy" in
14400         '')     gidsign=1
14401                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14402                 ;;
14403         *)      gidsign=$yyy
14404                 case "$gidsign" in
14405                  1) echo "Your $zzz is unsigned." ;;
14406                 -1) echo "Your $zzz is signed."   ;;
14407                 esac
14408                 ;;
14409         esac
14410 else
14411         gidsign=1
14412         echo "(I can't compile the test program--guessing unsigned.)" >&4
14413 fi
14414
14415
14416 echo " "
14417
14418 if $test X"$quadtype" != X; then
14419
14420 echo "Checking how to print 64-bit integers..." >&4
14421
14422 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14423         $cat >try.c <<'EOCP'
14424 #include <sys/types.h>
14425 #include <stdio.h>
14426 int main() {
14427   int q = 12345678901;
14428   printf("%ld\n", q);
14429 }
14430 EOCP
14431         set try
14432         if eval $compile; then
14433                 yyy=`$run ./try`
14434                 case "$yyy" in
14435                 12345678901)
14436                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14437                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14438                         echo "We will use %d."
14439                         ;;
14440                 esac
14441         fi
14442 fi
14443
14444 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14445         $cat >try.c <<'EOCP'
14446 #include <sys/types.h>
14447 #include <stdio.h>
14448 int main() {
14449   long q = 12345678901;
14450   printf("%ld\n", q);
14451 }
14452 EOCP
14453         set try
14454         if eval $compile; then
14455                 yyy=`$run ./try`
14456                 case "$yyy" in
14457                 12345678901)
14458                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14459                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14460                         echo "We will use %ld."
14461                         ;;
14462                 esac
14463         fi
14464 fi
14465
14466 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14467         $cat >try.c <<'EOCP'
14468 #include <sys/types.h>
14469 #include <inttypes.h>
14470 #include <stdio.h>
14471 int main() {
14472   int64_t q = 12345678901;
14473   printf("%" PRId64 "\n", q);
14474 }
14475 EOCP
14476         set try
14477         if eval $compile; then
14478                 yyy=`$run ./try`
14479                 case "$yyy" in
14480                 12345678901)
14481                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14482                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14483                         echo "We will use the C9X style."
14484                         ;;
14485                 esac
14486         fi
14487 fi
14488
14489 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14490         $cat >try.c <<EOCP
14491 #include <sys/types.h>
14492 #include <stdio.h>
14493 int main() {
14494   $quadtype q = 12345678901;
14495   printf("%Ld\n", q);
14496 }
14497 EOCP
14498         set try
14499         if eval $compile; then
14500                 yyy=`$run ./try`
14501                 case "$yyy" in
14502                 12345678901)
14503                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14504                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14505                         echo "We will use %Ld."
14506                         ;;
14507                 esac
14508         fi
14509 fi
14510
14511 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14512         $cat >try.c <<'EOCP'
14513 #include <sys/types.h>
14514 #include <stdio.h>
14515 int main() {
14516   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14517   printf("%lld\n", q);
14518 }
14519 EOCP
14520         set try
14521         if eval $compile; then
14522                 yyy=`$run ./try`
14523                 case "$yyy" in
14524                 12345678901)
14525                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14526                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14527                         echo "We will use the %lld style."
14528                         ;;
14529                 esac
14530         fi
14531 fi
14532
14533 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14534         $cat >try.c <<EOCP
14535 #include <sys/types.h>
14536 #include <stdio.h>
14537 int main() {
14538   $quadtype q = 12345678901;
14539   printf("%qd\n", q);
14540 }
14541 EOCP
14542         set try
14543         if eval $compile; then
14544                 yyy=`$run ./try`
14545                 case "$yyy" in
14546                 12345678901)
14547                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14548                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14549                         echo "We will use %qd."
14550                         ;;
14551                 esac
14552         fi
14553 fi
14554
14555 if $test X"$sPRId64" = X; then
14556         echo "Cannot figure out how to print 64-bit integers." >&4
14557 fi
14558
14559 $rm -f try try.*
14560
14561 fi
14562
14563 case "$sPRId64" in
14564 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14565         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14566         ;;
14567 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14568         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14569         ;;
14570 esac
14571
14572
14573 echo " "
14574 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14575
14576 if $test X"$ivsize" = X8; then
14577         ivdformat="$sPRId64"
14578         uvuformat="$sPRIu64"
14579         uvoformat="$sPRIo64"
14580         uvxformat="$sPRIx64"
14581         uvXUformat="$sPRIXU64"
14582 else
14583         if $test X"$ivsize" = X"$longsize"; then
14584                 ivdformat='"ld"'
14585                 uvuformat='"lu"'
14586                 uvoformat='"lo"'
14587                 uvxformat='"lx"'
14588                 uvXUformat='"lX"'
14589         else
14590                 if $test X"$ivsize" = X"$intsize"; then
14591                         ivdformat='"d"'
14592                         uvuformat='"u"'
14593                         uvoformat='"o"'
14594                         uvxformat='"x"'
14595                         uvXUformat='"X"'
14596                 else
14597                         : far out
14598                         if $test X"$ivsize" = X"$shortsize"; then
14599                                 ivdformat='"hd"'
14600                                 uvuformat='"hu"'
14601                                 uvoformat='"ho"'
14602                                 uvxformat='"hx"'
14603                                 uvXUformat='"hX"'
14604                         fi
14605                 fi
14606         fi
14607 fi
14608
14609 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14610         nveformat="$sPRIeldbl"
14611         nvfformat="$sPRIfldbl"
14612         nvgformat="$sPRIgldbl"
14613         nvEUformat="$sPRIEUldbl"
14614         nvFUformat="$sPRIFUldbl"
14615         nvGUformat="$sPRIGUldbl"
14616 else
14617         nveformat='"e"'
14618         nvfformat='"f"'
14619         nvgformat='"g"'
14620         nvEUformat='"E"'
14621         nvFUformat='"F"'
14622         nvGUformat='"G"'
14623 fi
14624
14625 case "$ivdformat" in
14626 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14627     exit 1
14628     ;;
14629 esac
14630
14631
14632 echo " "
14633 $echo "Checking the format string to be used for gids..." >&4
14634
14635 case "$gidsign" in
14636 -1)     if $test X"$gidsize" = X"$ivsize"; then
14637                 gidformat="$ivdformat"
14638         else
14639                 if $test X"$gidsize" = X"$longsize"; then
14640                         gidformat='"ld"'
14641                 else
14642                         if $test X"$gidsize" = X"$intsize"; then
14643                                 gidformat='"d"'
14644                         else
14645                                 if $test X"$gidsize" = X"$shortsize"; then
14646                                         gidformat='"hd"'
14647                                 fi
14648                         fi
14649                 fi
14650         fi
14651         ;;
14652 *)      if $test X"$gidsize" = X"$uvsize"; then
14653                 gidformat="$uvuformat"
14654         else
14655                 if $test X"$gidsize" = X"$longsize"; then
14656                         gidformat='"lu"'
14657                 else
14658                         if $test X"$gidsize" = X"$intsize"; then
14659                                 gidformat='"u"'
14660                         else
14661                                 if $test X"$gidsize" = X"$shortsize"; then
14662                                         gidformat='"hu"'
14663                                 fi
14664                         fi
14665                 fi
14666         fi
14667         ;;
14668 esac
14669
14670 : see if getgroups exists
14671 set getgroups d_getgrps
14672 eval $inlibc
14673
14674 : see if setgroups exists
14675 set setgroups d_setgrps
14676 eval $inlibc
14677
14678
14679 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14680 echo " "
14681 case "$d_getgrps$d_setgrps" in
14682 *define*)
14683         case "$groupstype" in
14684         '') dflt="$gidtype" ;;
14685         *)  dflt="$groupstype" ;;
14686         esac
14687         $cat <<EOM
14688 What type of pointer is the second argument to getgroups() and setgroups()?
14689 Usually this is the same as group ids, $gidtype, but not always.
14690
14691 EOM
14692         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14693         . ./myread
14694         groupstype="$ans"
14695         ;;
14696 *)  groupstype="$gidtype";;
14697 esac
14698
14699 echo " "
14700 echo "Checking if your $make program sets \$(MAKE)..." >&4
14701 case "$make_set_make" in
14702 '')
14703         $sed 's/^X //' > testmake.mak << 'EOF'
14704 Xall:
14705 X       @echo 'maketemp="$(MAKE)"'
14706 EOF
14707         case "`$make -f testmake.mak 2>/dev/null`" in
14708         *maketemp=*) make_set_make='#' ;;
14709         *)      make_set_make="MAKE=$make" ;;
14710         esac
14711         $rm -f testmake.mak
14712         ;;
14713 esac
14714 case "$make_set_make" in
14715 '#') echo "Yup, it does.";;
14716 *) echo "Nope, it doesn't.";;
14717 esac
14718
14719 : see what type is used for mode_t
14720 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14721 set mode_t modetype int stdio.h sys/types.h
14722 eval $typedef_ask
14723
14724 : see if stdarg is available
14725 echo " "
14726 if $test `./findhdr stdarg.h`; then
14727         echo "<stdarg.h> found." >&4
14728         valstd="$define"
14729 else
14730         echo "<stdarg.h> NOT found." >&4
14731         valstd="$undef"
14732 fi
14733
14734 : see if varags is available
14735 echo " "
14736 if $test `./findhdr varargs.h`; then
14737         echo "<varargs.h> found." >&4
14738 else
14739         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14740 fi
14741
14742 : set up the varargs testing programs
14743 $cat > varargs.c <<EOP
14744 #ifdef I_STDARG
14745 #include <stdarg.h>
14746 #endif
14747 #ifdef I_VARARGS
14748 #include <varargs.h>
14749 #endif
14750
14751 #ifdef I_STDARG
14752 int f(char *p, ...)
14753 #else
14754 int f(va_alist)
14755 va_dcl
14756 #endif
14757 {
14758         va_list ap;
14759 #ifndef I_STDARG
14760         char *p;
14761 #endif
14762 #ifdef I_STDARG
14763         va_start(ap,p);
14764 #else
14765         va_start(ap);
14766         p = va_arg(ap, char *);
14767 #endif
14768         va_end(ap);
14769 }
14770 EOP
14771 $cat > varargs <<EOP
14772 $startsh
14773 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14774         echo "true"
14775 else
14776         echo "false"
14777 fi
14778 $rm -f varargs$_o
14779 EOP
14780 chmod +x varargs
14781
14782 : now check which varargs header should be included
14783 echo " "
14784 i_varhdr=''
14785 case "$valstd" in
14786 "$define")
14787         if `./varargs I_STDARG`; then
14788                 val='stdarg.h'
14789         elif `./varargs I_VARARGS`; then
14790                 val='varargs.h'
14791         fi
14792         ;;
14793 *)
14794         if `./varargs I_VARARGS`; then
14795                 val='varargs.h'
14796         fi
14797         ;;
14798 esac
14799 case "$val" in
14800 '')
14801 echo "I could not find the definition for va_dcl... You have problems..." >&4
14802         val="$undef"; set i_stdarg; eval $setvar
14803         val="$undef"; set i_varargs; eval $setvar
14804         ;;
14805 *) 
14806         set i_varhdr
14807         eval $setvar
14808         case "$i_varhdr" in
14809         stdarg.h)
14810                 val="$define"; set i_stdarg; eval $setvar
14811                 val="$undef"; set i_varargs; eval $setvar
14812                 ;;
14813         varargs.h)
14814                 val="$undef"; set i_stdarg; eval $setvar
14815                 val="$define"; set i_varargs; eval $setvar
14816                 ;;
14817         esac
14818         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14819 esac
14820 $rm -f varargs*
14821
14822 : see if we need va_copy
14823 echo " "
14824 case "$i_stdarg" in
14825 "$define")
14826         $cat >try.c <<EOCP
14827 #include <stdarg.h>
14828 #include <stdio.h>
14829 #$i_stdlib I_STDLIB
14830 #ifdef I_STDLIB
14831 #include <stdlib.h>
14832 #endif
14833 #include <signal.h>
14834
14835 int
14836 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14837 {
14838   return vfprintf(f, fmt, *valp);
14839 }
14840  
14841 int    
14842 myvfprintf(FILE *f, const  char *fmt, va_list val)
14843 {
14844   return ivfprintf(f, fmt, &val);
14845 }
14846       
14847 int
14848 myprintf(char *fmt, ...) 
14849 {
14850   va_list val;
14851   va_start(val, fmt);
14852   return myvfprintf(stdout, fmt, val); 
14853 }         
14854
14855 int
14856 main(int ac, char **av)
14857 {
14858   signal(SIGSEGV, exit);
14859
14860   myprintf("%s%cs all right, then\n", "that", '\'');                            
14861   exit(0);      
14862 }
14863 EOCP
14864         set try
14865         if eval $compile && $run ./try 2>&1 >/dev/null; then
14866                 case "`$run ./try`" in
14867                 "that's all right, then")
14868                         okay=yes
14869                         ;;
14870                 esac
14871         fi
14872         case "$okay" in
14873         yes)    echo "It seems that you don't need va_copy()." >&4
14874                 need_va_copy="$undef"
14875                 ;;
14876         *)      echo "It seems that va_copy() or similar will be needed." >&4
14877                 need_va_copy="$define"
14878                 ;;
14879         esac
14880         $rm -f try.* core core.* *.core *.core.*
14881         ;;
14882 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14883         ;;
14884 esac
14885
14886 : define a fucntion to check prototypes
14887 $cat > protochk <<EOSH
14888 $startsh
14889 cc="$cc"
14890 optimize="$optimize"
14891 ccflags="$ccflags"
14892 prototype="$prototype"
14893 define="$define"
14894 rm=$rm
14895 EOSH
14896
14897 $cat >> protochk <<'EOSH'
14898
14899 $rm -f try.c
14900 foo="$1"
14901 shift
14902 while test $# -ge 2; do
14903         case "$1" in
14904                 $define) echo "#include <$2>" >> try.c ;;
14905                 literal) echo "$2" >> try.c ;;
14906         esac
14907     shift 2
14908 done
14909 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14910 cat >> try.c <<'EOCP'
14911 #ifdef CAN_PROTOTYPE
14912 #define _(args) args
14913 #else
14914 #define _(args) ()
14915 #endif
14916 EOCP
14917 echo "$foo" >> try.c
14918 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14919 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14920 status=$?
14921 $rm -f try.[co]
14922 exit $status
14923 EOSH
14924 chmod +x protochk
14925 $eunicefix protochk
14926
14927 : see what type is used for size_t
14928 rp="What is the type used for the length parameter for string functions?"
14929 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14930 eval $typedef_ask
14931
14932 : check for type of arguments to gethostbyaddr. 
14933 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14934         case "$d_gethbyaddr" in
14935         $define)
14936                 $cat <<EOM
14937
14938 Checking to see what type of arguments are accepted by gethostbyaddr().
14939 EOM
14940                 hdrs="$define sys/types.h
14941                         $d_socket sys/socket.h 
14942                         $i_niin netinet/in.h 
14943                         $i_netdb netdb.h
14944                         $i_unistd unistd.h"
14945                 : The first arg can 'char *' or 'void *'
14946                 : The second arg is some of integral type
14947                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14948                         for yyy in size_t long int; do
14949                                 case "$netdb_host_type" in
14950                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14951                                         if ./protochk "$try" $hdrs; then
14952                                                 echo "Your system accepts $xxx for the first arg."
14953                                                 echo "...and $yyy for the second arg."
14954                                                 netdb_host_type="$xxx"
14955                                                 netdb_hlen_type="$yyy"
14956                                         fi
14957                                         ;;
14958                                 esac
14959                         done
14960                 done
14961                 : In case none of those worked, prompt the user.
14962                 case "$netdb_host_type" in
14963                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14964                         dflt='char *'
14965                         . ./myread
14966                         netdb_host_type=$ans
14967                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14968                         dflt="$sizetype"
14969                         . ./myread
14970                         netdb_hlen_type=$ans
14971                         ;;
14972                 esac
14973                 ;;
14974         *)      : no gethostbyaddr, so pick harmless defaults
14975                 netdb_host_type='char *'
14976                 netdb_hlen_type="$sizetype"
14977                 ;;
14978         esac
14979         # Remove the "const" if needed. -- but then we'll have a 
14980         # prototype clash!
14981         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14982 fi
14983
14984 : check for type of argument to gethostbyname. 
14985 if test "X$netdb_name_type" = X ; then
14986         case "$d_gethbyname" in
14987         $define)
14988                 $cat <<EOM
14989
14990 Checking to see what type of argument is accepted by gethostbyname().
14991 EOM
14992                 hdrs="$define sys/types.h
14993                         $d_socket sys/socket.h 
14994                         $i_niin netinet/in.h 
14995                         $i_netdb netdb.h
14996                         $i_unistd unistd.h"
14997                 for xxx in "const char *" "char *"; do
14998                         case "$netdb_name_type" in
14999                         '')     try="extern struct hostent *gethostbyname($xxx);"
15000                                 if ./protochk "$try" $hdrs; then
15001                                         echo "Your system accepts $xxx."
15002                                         netdb_name_type="$xxx"
15003                                 fi
15004                                 ;;
15005                         esac
15006                 done
15007                 : In case none of those worked, prompt the user.
15008                 case "$netdb_name_type" in
15009                 '')     rp='What is the type for the 1st argument to gethostbyname?'
15010                         dflt='char *'
15011                         . ./myread
15012                         netdb_name_type=$ans
15013                         ;;
15014                 esac
15015                 ;;
15016         *)      : no gethostbyname, so pick harmless default
15017                 netdb_name_type='char *'
15018                 ;;
15019         esac
15020 fi
15021
15022 : check for type of 1st argument to getnetbyaddr. 
15023 if test "X$netdb_net_type" = X ; then
15024         case "$d_getnbyaddr" in
15025         $define)
15026                 $cat <<EOM
15027
15028 Checking to see what type of 1st argument is accepted by getnetbyaddr().
15029 EOM
15030                 hdrs="$define sys/types.h
15031                         $d_socket sys/socket.h 
15032                         $i_niin netinet/in.h 
15033                         $i_netdb netdb.h
15034                         $i_unistd unistd.h"
15035                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
15036                         case "$netdb_net_type" in
15037                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
15038                                 if ./protochk "$try" $hdrs; then
15039                                         echo "Your system accepts $xxx."
15040                                         netdb_net_type="$xxx"
15041                                 fi
15042                                 ;;
15043                         esac
15044                 done
15045                 : In case none of those worked, prompt the user.
15046                 case "$netdb_net_type" in
15047                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
15048                         dflt='long'
15049                         . ./myread
15050                         netdb_net_type=$ans
15051                         ;;
15052                 esac
15053                 ;;
15054         *)      : no getnetbyaddr, so pick harmless default
15055                 netdb_net_type='long'
15056                 ;;
15057         esac
15058 fi
15059 : locate the preferred pager for this system
15060 case "$pager" in
15061 '')
15062         dflt=''
15063         case "$pg" in
15064         /*) dflt=$pg;;
15065         [a-zA-Z]:/*) dflt=$pg;;
15066         esac
15067         case "$more" in
15068         /*) dflt=$more;;
15069         [a-zA-Z]:/*) dflt=$more;;
15070         esac
15071         case "$less" in
15072         /*) dflt=$less;;
15073         [a-zA-Z]:/*) dflt=$less;;
15074         esac
15075         case "$dflt" in
15076         '') dflt=/usr/ucb/more;;
15077         esac
15078         ;;
15079 *) dflt="$pager";;
15080 esac
15081 echo " "
15082 fn=f/
15083 rp='What pager is used on your system?'
15084 . ./getfile
15085 pager="$ans"
15086
15087 : see what type pids are declared as in the kernel
15088 rp="What is the type of process ids on this system?"
15089 set pid_t pidtype int stdio.h sys/types.h
15090 eval $typedef_ask
15091
15092 : Find earliest binary compatible site_perl subdirectory perl can use.
15093 case "$bincompat5005" in
15094 "$define") xs_apiversion='5.005' ;;
15095 *) xs_apiversion=$version ;;   # The current site_perl version.
15096 esac
15097 : Find earliest pure perl site_perl subdirectory perl can use.
15098 : The versioned directories started at 5.005.
15099 pm_apiversion='5.005'
15100
15101 : see if ar generates random libraries by itself
15102 echo " "
15103 echo "Checking how to generate random libraries on your machine..." >&4
15104 echo 'int bar1() { return bar2(); }' > bar1.c
15105 echo 'int bar2() { return 2; }' > bar2.c
15106 $cat > foo.c <<'EOP'
15107 int main() { printf("%d\n", bar1()); exit(0); }
15108 EOP
15109 $cc $ccflags -c bar1.c >/dev/null 2>&1
15110 $cc $ccflags -c bar2.c >/dev/null 2>&1
15111 $cc $ccflags -c foo.c >/dev/null 2>&1
15112 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
15113 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15114         $run ./foobar >/dev/null 2>&1; then
15115         echo "$ar appears to generate random libraries itself."
15116         orderlib=false
15117         ranlib=":"
15118 elif $ar ts bar$_a >/dev/null 2>&1 &&
15119         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15120         $run ./foobar >/dev/null 2>&1; then
15121                 echo "a table of contents needs to be added with '$ar ts'."
15122                 orderlib=false
15123                 ranlib="$ar ts"
15124 else
15125         case "$ranlib" in
15126         :) ranlib='';;
15127         '')
15128                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
15129                 $test -f $ranlib || ranlib=''
15130                 ;;
15131         esac
15132         if $test -n "$ranlib"; then
15133                 echo "your system has '$ranlib'; we'll use that."
15134                 orderlib=false
15135         else
15136                 echo "your system doesn't seem to support random libraries"
15137                 echo "so we'll use lorder and tsort to order the libraries."
15138                 orderlib=true
15139                 ranlib=":"
15140         fi
15141 fi
15142 $rm -f foo* bar* 
15143
15144 : check for type of arguments to select. 
15145 case "$selecttype" in
15146 '') case "$d_select" in
15147         $define)
15148                 echo " "
15149                 $cat <<EOM
15150 Checking to see what type of arguments are accepted by select().
15151 EOM
15152                 hdrs="$define sys/types.h
15153                         $i_systime sys/time.h 
15154                         $i_sysselct sys/select.h
15155                         $d_socket sys/socket.h"
15156                 : The first arg can be int, unsigned, or size_t
15157                 : The last arg may or may not be 'const'
15158                 val=''
15159                 : void pointer has been seen but using that
15160                 : breaks the selectminbits test
15161                 for xxx in 'fd_set *' 'int *'; do
15162                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
15163                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
15164                                         case "$val" in
15165                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
15166                                                 if ./protochk "$try" $hdrs; then
15167                                                         echo "Your system accepts $xxx."
15168                                                         val="$xxx"
15169                                                 fi
15170                                                 ;;
15171                                         esac
15172                                 done
15173                         done
15174                 done
15175                 case "$val" in
15176                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
15177                         case "$d_fd_set" in
15178                                 $define) dflt="fd_set *" ;;
15179                                 *)              dflt="int *" ;;
15180                         esac
15181                         . ./myread
15182                         val=$ans
15183                         ;;
15184                 esac
15185                 selecttype="$val"
15186                 ;;
15187         *)      : no select, so pick a harmless default
15188                 selecttype='int *'
15189                 ;;
15190         esac
15191         ;;
15192 esac
15193
15194 : check for the select 'width'
15195 case "$selectminbits" in
15196 '') case "$d_select" in
15197         $define)
15198                 $cat <<EOM
15199
15200 Checking to see on how many bits at a time your select() operates...
15201 EOM
15202                 $cat >try.c <<EOCP
15203 #include <sys/types.h>
15204 #$i_time I_TIME
15205 #$i_systime I_SYS_TIME
15206 #$i_systimek I_SYS_TIME_KERNEL
15207 #ifdef I_TIME
15208 #   include <time.h>
15209 #endif
15210 #ifdef I_SYS_TIME
15211 #   ifdef I_SYS_TIME_KERNEL
15212 #       define KERNEL
15213 #   endif
15214 #   include <sys/time.h>
15215 #   ifdef I_SYS_TIME_KERNEL
15216 #       undef KERNEL
15217 #   endif
15218 #endif
15219 #$i_sysselct I_SYS_SELECT
15220 #ifdef I_SYS_SELECT
15221 #include <sys/select.h>
15222 #endif
15223 #$d_socket HAS_SOCKET
15224 #ifdef HAS_SOCKET
15225 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15226 #endif
15227 #include <stdio.h>
15228 $selecttype b;
15229 #define S sizeof(*(b))
15230 #define MINBITS 64
15231 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15232 #define NBITS  (NBYTES * 8)
15233 int main() {
15234     char s[NBYTES];
15235     struct timeval t;
15236     int i;
15237     FILE* fp;
15238     int fd;
15239
15240     fclose(stdin);
15241     fp = fopen("try.c", "r");
15242     if (fp == 0)
15243       exit(1);
15244     fd = fileno(fp);
15245     if (fd < 0)
15246       exit(2);
15247     b = ($selecttype)s;
15248     for (i = 0; i < NBITS; i++)
15249         FD_SET(i, b);
15250     t.tv_sec  = 0;
15251     t.tv_usec = 0;
15252     select(fd + 1, b, 0, 0, &t);
15253     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15254     printf("%d\n", i + 1);
15255     return 0;
15256 }
15257 EOCP
15258                 set try
15259                 if eval $compile_ok; then
15260                         selectminbits=`$run ./try`
15261                         case "$selectminbits" in
15262                         '')     cat >&4 <<EOM
15263 Cannot figure out on how many bits at a time your select() operates.
15264 I'll play safe and guess it is 32 bits.
15265 EOM
15266                                 selectminbits=32
15267                                 bits="32 bits"
15268                                 ;;
15269                         1)      bits="1 bit" ;;
15270                         *)      bits="$selectminbits bits" ;;
15271                         esac
15272                         echo "Your select() operates on $bits at a time." >&4
15273                 else
15274                         rp='What is the minimum number of bits your select() operates on?'
15275                         case "$byteorder" in
15276                         1234|12345678)  dflt=32 ;;
15277                         *)              dflt=1  ;;
15278                         esac
15279                         . ./myread
15280                         val=$ans
15281                         selectminbits="$val"
15282                 fi
15283                 $rm -f try.* try
15284                 ;;
15285         *)      : no select, so pick a harmless default
15286                 selectminbits='32'
15287                 ;;
15288         esac
15289         ;;
15290 esac
15291
15292 : Trace out the files included by signal.h, then look for SIGxxx names.
15293 : Remove SIGARRAYSIZE used by HPUX.
15294 : Remove SIGSTKSIZE used by Linux.
15295 : Remove SIGSTKSZ used by Posix.
15296 : Remove SIGTYP void lines used by OS2.
15297 : Some cpps, like os390, dont give the file name anywhere
15298 if [ "X$fieldn" = X ]; then
15299         : Just make some guesses.  We check them later.
15300         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15301 else
15302         xxx=`echo '#include <signal.h>' |
15303         $cppstdin $cppminus $cppflags 2>/dev/null |
15304         $grep '^[       ]*#.*include' | 
15305         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15306 fi
15307 : Check this list of files to be sure we have parsed the cpp output ok.
15308 : This will also avoid potentially non-existent files, such 
15309 : as ../foo/bar.h
15310 xxxfiles=''
15311 for xx in $xxx /dev/null ; do
15312         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15313 done
15314 : If we have found no files, at least try signal.h
15315 case "$xxxfiles" in
15316 '')     xxxfiles=`./findhdr signal.h` ;;
15317 esac
15318 xxx=`awk '
15319 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15320         print substr($2, 4, 20)
15321 }
15322 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15323         print substr($3, 4, 20)
15324 }' $xxxfiles`
15325 : Append some common names just in case the awk scan failed.
15326 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15327 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15328 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15329 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15330 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15331
15332 : generate a few handy files for later
15333 $cat > signal.c <<'EOCP'
15334 #include <sys/types.h>
15335 #include <signal.h>
15336 #include <stdio.h>
15337 int main() {
15338
15339 /* Strange style to avoid deeply-nested #if/#else/#endif */
15340 #ifndef NSIG
15341 #  ifdef _NSIG
15342 #    define NSIG (_NSIG)
15343 #  endif
15344 #endif
15345
15346 #ifndef NSIG
15347 #  ifdef SIGMAX
15348 #    define NSIG (SIGMAX+1)
15349 #  endif
15350 #endif
15351
15352 #ifndef NSIG
15353 #  ifdef SIG_MAX
15354 #    define NSIG (SIG_MAX+1)
15355 #  endif
15356 #endif
15357
15358 #ifndef NSIG
15359 #  ifdef MAXSIG
15360 #    define NSIG (MAXSIG+1)
15361 #  endif
15362 #endif
15363
15364 #ifndef NSIG
15365 #  ifdef MAX_SIG
15366 #    define NSIG (MAX_SIG+1)
15367 #  endif
15368 #endif
15369
15370 #ifndef NSIG
15371 #  ifdef SIGARRAYSIZE
15372 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15373 #  endif
15374 #endif
15375
15376 #ifndef NSIG
15377 #  ifdef _sys_nsig
15378 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15379 #  endif
15380 #endif
15381
15382 /* Default to some arbitrary number that's big enough to get most
15383    of the common signals.
15384 */
15385 #ifndef NSIG
15386 #    define NSIG 50
15387 #endif
15388
15389 printf("NSIG %d\n", NSIG);
15390
15391 #ifndef JUST_NSIG
15392
15393 EOCP
15394
15395 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15396 {
15397         printf "#ifdef SIG"; printf $1; printf "\n"
15398         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15399         printf $1; printf ");\n"
15400         printf "#endif\n"
15401 }
15402 END {
15403         printf "#endif /* JUST_NSIG */\n";
15404         printf "exit(0);\n}\n";
15405 }
15406 ' >>signal.c
15407 $cat >signal.awk <<'EOP'
15408 BEGIN { ndups = 0 }
15409 $1 ~ /^NSIG$/ { nsig = $2 }
15410 ($1 !~ /^NSIG$/) && (NF == 2) {
15411     if ($2 > maxsig) { maxsig = $2 }
15412     if (sig_name[$2]) {
15413         dup_name[ndups] = $1
15414         dup_num[ndups] = $2
15415         ndups++ 
15416     }
15417     else {
15418         sig_name[$2] = $1
15419         sig_num[$2] = $2
15420     }
15421 }
15422 END { 
15423     if (nsig == 0) {
15424         nsig = maxsig + 1
15425     }
15426     printf("NSIG %d\n", nsig);
15427     for (n = 1; n < nsig; n++) {
15428         if (sig_name[n]) {
15429             printf("%s %d\n", sig_name[n], sig_num[n])
15430         }
15431         else {
15432             printf("NUM%d %d\n", n, n) 
15433         }
15434     }
15435     for (n = 0; n < ndups; n++) {
15436         printf("%s %d\n", dup_name[n], dup_num[n])
15437     }
15438 }
15439 EOP
15440 $cat >signal_cmd <<EOS
15441 $startsh
15442 if $test -s signal.lst; then
15443     echo "Using your existing signal.lst file"
15444         exit 0
15445 fi
15446 xxx="$xxx"
15447 EOS
15448 $cat >>signal_cmd <<'EOS'
15449
15450 set signal
15451 if eval $compile_ok; then
15452         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15453 else
15454         echo "(I can't seem be able to compile the whole test program)" >&4
15455         echo "(I'll try it in little pieces.)" >&4
15456         set signal -DJUST_NSIG
15457         if eval $compile_ok; then
15458                 $run ./signal$_exe > signal.nsg
15459                 $cat signal.nsg
15460         else
15461                 echo "I can't seem to figure out how many signals you have." >&4
15462                 echo "Guessing 50." >&4
15463                 echo 'NSIG 50' > signal.nsg
15464         fi
15465         : Now look at all the signal names, one at a time.
15466         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15467                 $cat > signal.c <<EOCP
15468 #include <sys/types.h>
15469 #include <signal.h>
15470 #include <stdio.h>
15471 int main() {
15472 printf("$xx %d\n", SIG${xx});
15473 return 0;
15474 }
15475 EOCP
15476                 set signal
15477                 if eval $compile; then
15478                         echo "SIG${xx} found."
15479                         $run ./signal$_exe  >> signal.ls1
15480                 else
15481                         echo "SIG${xx} NOT found."
15482                 fi
15483         done
15484         if $test -s signal.ls1; then
15485                 $cat signal.nsg signal.ls1 |
15486                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15487         fi
15488
15489 fi
15490 if $test -s signal.lst; then
15491         :
15492 else
15493         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15494         echo 'kill -l' >signal
15495         set X `csh -f <signal`
15496         $rm -f signal
15497         shift
15498         case $# in
15499         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15500         esac
15501         echo $@ | $tr ' ' $trnl | \
15502             $awk '{ printf "%s %d\n", $1, ++s; }
15503                   END { printf "NSIG %d\n", ++s }' >signal.lst
15504 fi
15505 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15506 EOS
15507 chmod a+x signal_cmd
15508 $eunicefix signal_cmd
15509
15510 : generate list of signal names
15511 echo " "
15512 case "$sig_name_init" in
15513 '') doinit=yes ;;
15514 *)  case "$sig_num_init" in
15515     ''|*,*) doinit=yes ;;
15516     esac ;;
15517 esac
15518 case "$doinit" in
15519 yes)
15520         echo "Generating a list of signal names and numbers..." >&4
15521         . ./signal_cmd
15522         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15523         sig_name=`$awk 'BEGIN { printf "ZERO " }
15524                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15525         sig_num=`$awk  'BEGIN { printf "0 " }
15526                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15527         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15528                              !/^NSIG/   { printf "\"%s\", ", $1 }
15529                              END        { printf "0\n" }' signal.lst`
15530         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15531                              !/^NSIG/   { printf "%d, ", $2}
15532                              END        { printf "0\n"}' signal.lst`
15533         ;;
15534 esac
15535 echo "The following $sig_count signals are available:"
15536 echo " "
15537 echo $sig_name | $awk \
15538 'BEGIN { linelen = 0 }
15539 {
15540         for (i = 1; i <= NF; i++) {
15541                 name = "SIG" $i " "
15542                 linelen = linelen + length(name)
15543                 if (linelen > 70) {
15544                         printf "\n"
15545                         linelen = length(name)
15546                 }
15547                 printf "%s", name
15548         }
15549         printf "\n"
15550 }'
15551 sig_size=`echo $sig_name | awk '{print NF}'`
15552 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15553
15554 echo " "
15555 case "$sizetype" in
15556 *_t) zzz="$sizetype"    ;;
15557 *)   zzz="filesize"     ;;
15558 esac
15559 echo "Checking the size of $zzz..." >&4 
15560 cat > try.c <<EOCP
15561 #include <sys/types.h>
15562 #include <stdio.h>
15563 int main() {
15564     printf("%d\n", (int)sizeof($sizetype));
15565     exit(0);
15566 }
15567 EOCP
15568 set try
15569 if eval $compile_ok; then
15570         yyy=`$run ./try`
15571         case "$yyy" in
15572         '')     sizesize=4
15573                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15574                 ;;
15575         *)      sizesize=$yyy
15576                 echo "Your $zzz size is $sizesize bytes."
15577                 ;;
15578         esac
15579 else
15580         sizesize=4
15581         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15582 fi
15583
15584
15585 : check for socklen_t
15586 echo " "
15587 echo "Checking to see if you have socklen_t..." >&4
15588 $cat >try.c <<EOCP
15589 #include <sys/types.h>
15590 #$d_socket HAS_SOCKET
15591 #ifdef HAS_SOCKET
15592 #include <sys/socket.h>
15593 #endif
15594 int main() { socklen_t x = 16; }
15595 EOCP
15596 set try
15597 if eval $compile; then
15598         val="$define"
15599         echo "You have socklen_t."
15600 else
15601         val="$undef"
15602         echo "You do not have socklen_t."
15603         case "$sizetype" in
15604         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15605         esac
15606 fi
15607 $rm -f try try.*
15608 set d_socklen_t
15609 eval $setvar
15610
15611 : see if this is a socks.h system
15612 set socks.h i_socks
15613 eval $inhdr
15614
15615 : check for type of the size argument to socket calls
15616 case "$d_socket" in
15617 "$define")
15618         $cat <<EOM
15619
15620 Checking to see what type is the last argument of accept().
15621 EOM
15622         yyy=''
15623         case "$d_socklen_t" in
15624         "$define") yyy="$yyy socklen_t"
15625         esac
15626         yyy="$yyy $sizetype int long unsigned"
15627         for xxx in $yyy; do
15628                 case "$socksizetype" in
15629                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15630                         case "$usesocks" in
15631                         "$define")
15632                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15633                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15634                                         socksizetype="$xxx"
15635                                 fi
15636                                 ;;
15637                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15638                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15639                                         socksizetype="$xxx"
15640                                 fi
15641                                 ;;
15642                         esac
15643                         ;;
15644                 esac
15645         done
15646 : In case none of those worked, prompt the user.
15647         case "$socksizetype" in
15648         '')     rp='What is the type for socket address structure sizes?'
15649                 dflt='int'
15650                 . ./myread
15651                 socksizetype=$ans
15652                 ;;
15653         esac
15654         ;;
15655 *)      : no sockets, so pick relatively harmless default
15656         socksizetype='int'
15657         ;;
15658 esac
15659
15660 : see what type is used for signed size_t
15661 set ssize_t ssizetype int stdio.h sys/types.h
15662 eval $typedef
15663 dflt="$ssizetype"
15664 $cat > try.c <<EOM
15665 #include <stdio.h>
15666 #include <sys/types.h>
15667 #define Size_t $sizetype
15668 #define SSize_t $dflt
15669 int main()
15670 {
15671         if (sizeof(Size_t) == sizeof(SSize_t))
15672                 printf("$dflt\n");
15673         else if (sizeof(Size_t) == sizeof(int))
15674                 printf("int\n");
15675         else 
15676                 printf("long\n");
15677         exit(0);
15678 }
15679 EOM
15680 echo " "
15681 set try
15682 if eval $compile_ok && $run ./try > /dev/null; then
15683         ssizetype=`$run ./try`
15684         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15685 else
15686         $cat >&4 <<EOM
15687 Help! I can't compile and run the ssize_t test program: please enlighten me!
15688 (This is probably a misconfiguration in your system or libraries, and
15689 you really ought to fix it.  Still, I'll try anyway.)
15690
15691 I need a type that is the same size as $sizetype, but is guaranteed to
15692 be signed.  Common values are ssize_t, int and long.
15693
15694 EOM
15695         rp="What signed type is the same size as $sizetype?"
15696         . ./myread
15697         ssizetype="$ans"
15698 fi
15699 $rm -f try try.*
15700
15701 : see what type of char stdio uses.
15702 echo " "
15703 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15704 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15705         echo "Your stdio uses unsigned chars." >&4
15706         stdchar="unsigned char"
15707 else
15708         echo "Your stdio uses signed chars." >&4
15709         stdchar="char"
15710 fi
15711 $rm -f stdioh
15712
15713
15714
15715 : see if time exists
15716 echo " "
15717 if test "X$d_time" = X -o X"$timetype" = X; then
15718     if set time val -f d_time; eval $csym; $val; then
15719                 echo 'time() found.' >&4
15720                 val="$define"
15721                 rp="What is the type returned by time() on this system?"
15722                 set time_t timetype long stdio.h sys/types.h
15723                 eval $typedef_ask
15724     else
15725                 echo 'time() not found, hope that will do.' >&4
15726                 val="$undef"
15727                 timetype='int';
15728     fi
15729     set d_time
15730     eval $setvar
15731 fi
15732
15733 : see what type uids are declared as in the kernel
15734 echo " "
15735 echo "Looking for the type for user ids returned by getuid()."
15736 set uid_t uidtype xxx stdio.h sys/types.h
15737 eval $typedef
15738 case "$uidtype" in
15739 xxx)
15740         xxx=`./findhdr sys/user.h`
15741         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15742         case $1 in
15743         unsigned) dflt="$1 $2" ;;
15744         *) dflt="$1" ;;
15745         esac
15746         ;;
15747 *) dflt="$uidtype";;
15748 esac
15749 case "$uidtype" in
15750 uid_t)  echo "uid_t found." ;;
15751 *)      rp="What is the type for user ids returned by getuid()?"
15752         . ./myread
15753         uidtype="$ans"
15754         ;;
15755 esac
15756
15757 echo " "
15758 case "$uidtype" in
15759 *_t) zzz="$uidtype"     ;;
15760 *)   zzz="uid"          ;;
15761 esac
15762 echo "Checking the size of $zzz..." >&4 
15763 cat > try.c <<EOCP
15764 #include <sys/types.h>
15765 #include <stdio.h>
15766 int main() {
15767     printf("%d\n", (int)sizeof($uidtype));
15768     exit(0);
15769 }
15770 EOCP
15771 set try
15772 if eval $compile_ok; then
15773         yyy=`$run ./try`
15774         case "$yyy" in
15775         '')     uidsize=4
15776                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15777                 ;;
15778         *)      uidsize=$yyy
15779                 echo "Your $zzz is $uidsize bytes long."
15780                 ;;
15781         esac
15782 else
15783         uidsize=4
15784         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15785 fi
15786
15787 echo " "
15788 case "$uidtype" in
15789 *_t) zzz="$uidtype"     ;;
15790 *)   zzz="uid"          ;;
15791 esac
15792 echo "Checking the sign of $zzz..." >&4
15793 cat > try.c <<EOCP
15794 #include <sys/types.h>
15795 #include <stdio.h>
15796 int main() {
15797         $uidtype foo = -1;
15798         if (foo < 0)
15799                 printf("-1\n");
15800         else
15801                 printf("1\n");
15802 }
15803 EOCP
15804 set try
15805 if eval $compile; then
15806         yyy=`$run ./try`
15807         case "$yyy" in
15808         '')     uidsign=1
15809                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15810                 ;;
15811         *)      uidsign=$yyy
15812                 case "$uidsign" in
15813                  1) echo "Your $zzz is unsigned." ;;
15814                 -1) echo "Your $zzz is signed."   ;;
15815                 esac
15816                 ;;
15817         esac
15818 else
15819         uidsign=1
15820         echo "(I can't compile the test program--guessing unsigned.)" >&4
15821 fi
15822
15823
15824
15825 echo " "
15826 $echo "Checking the format string to be used for uids..." >&4
15827
15828 case "$uidsign" in
15829 -1)     if $test X"$uidsize" = X"$ivsize"; then
15830                 uidformat="$ivdformat"
15831         else
15832                 if $test X"$uidsize" = X"$longsize"; then
15833                         uidformat='"ld"'
15834                 else
15835                         if $test X"$uidsize" = X"$intsize"; then
15836                                 uidformat='"d"'
15837                         else
15838                                 if $test X"$uidsize" = X"$shortsize"; then
15839                                         uidformat='"hd"'
15840                                 fi
15841                         fi
15842                 fi
15843         fi
15844         ;;
15845 *)      if $test X"$uidsize" = X"$uvsize"; then
15846                 uidformat="$uvuformat"
15847         else
15848                 if $test X"$uidsize" = X"$longsize"; then
15849                         uidformat='"lu"'
15850                 else
15851                         if $test X"$uidsize" = X"$intsize"; then
15852                                 uidformat='"u"'
15853                         else
15854                                 if $test X"$uidsize" = X"$shortsize"; then
15855                                         uidformat='"hu"'
15856                                 fi
15857                         fi
15858                 fi
15859         fi
15860         ;;
15861 esac
15862
15863 : determine compiler compiler
15864 case "$yacc" in
15865 '')
15866         dflt=yacc;;
15867 *)
15868         dflt="$yacc";;
15869 esac
15870 echo " "
15871 comp='yacc'
15872 if $test -f "$byacc"; then
15873         dflt="$byacc"
15874         comp="byacc or $comp"
15875 fi
15876 if $test -f "$bison"; then
15877         comp="$comp or bison -y"
15878 fi
15879 rp="Which compiler compiler ($comp) shall I use?"
15880 . ./myread
15881 yacc="$ans"
15882 case "$yacc" in
15883 *bis*)
15884         case "$yacc" in
15885         *-y*) ;;
15886         *)
15887                 yacc="$yacc -y"
15888                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15889                 ;;
15890         esac
15891         ;;
15892 esac
15893
15894 : see if fcntl.h is there
15895 val=''
15896 set fcntl.h val
15897 eval $inhdr
15898
15899 : see if we can include fcntl.h
15900 case "$val" in
15901 "$define")
15902         echo " "
15903         if $h_fcntl; then
15904                 val="$define"
15905                 echo "We'll be including <fcntl.h>." >&4
15906         else
15907                 val="$undef"
15908                 if $h_sysfile; then
15909         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15910                 else
15911                         echo "We won't be including <fcntl.h>." >&4
15912                 fi
15913         fi
15914         ;;
15915 *)
15916         h_fcntl=false
15917         val="$undef"
15918         ;;
15919 esac
15920 set i_fcntl
15921 eval $setvar
15922
15923 : see if this is a fp.h system
15924 set fp.h i_fp
15925 eval $inhdr
15926
15927 : see if this is a fp_class.h system
15928 set fp_class.h i_fp_class
15929 eval $inhdr
15930
15931 : see if this is a ieeefp.h system
15932 case "$i_ieeefp" in
15933 '' ) set ieeefp.h i_ieeefp
15934      eval $inhdr
15935      ;;
15936 esac
15937
15938 : see if this is a libutil.h system
15939 set libutil.h i_libutil
15940 eval $inhdr
15941
15942 : see if locale.h is available
15943 set locale.h i_locale
15944 eval $inhdr
15945
15946 : see if mach cthreads are available
15947 if test "X$usethreads" = "X$define"; then
15948         set mach/cthreads.h i_machcthr
15949         eval $inhdr
15950 else
15951         i_machcthr="$undef"
15952 fi
15953
15954
15955
15956 : see if this is a math.h system
15957 set math.h i_math
15958 eval $inhdr
15959
15960 : see if this is a mntent.h system
15961 set mntent.h i_mntent
15962 eval $inhdr
15963
15964 : see if ndbm.h is available
15965 set ndbm.h t_ndbm
15966 eval $inhdr
15967 case "$t_ndbm" in
15968 $define)
15969         : see if dbm_open exists
15970         set dbm_open d_dbm_open
15971         eval $inlibc
15972         case "$d_dbm_open" in
15973         $undef)
15974                 t_ndbm="$undef"
15975                 echo "We won't be including <ndbm.h>"
15976                 ;;
15977         esac
15978         ;;
15979 esac
15980 val="$t_ndbm"
15981 set i_ndbm
15982 eval $setvar
15983
15984 : see if net/errno.h is available
15985 val=''
15986 set net/errno.h val
15987 eval $inhdr
15988
15989 : Unfortunately, it causes problems on some systems.  Arrgh.
15990 case "$val" in
15991 $define)
15992         cat > try.c <<'EOM'
15993 #include <stdio.h>
15994 #include <errno.h>
15995 #include <net/errno.h>
15996 int func()
15997 {
15998         return ENOTSOCK;
15999 }
16000 EOM
16001         if $cc $ccflags -c try.c >/dev/null 2>&1; then
16002                 echo "We'll be including <net/errno.h>." >&4
16003         else
16004                 echo "We won't be including <net/errno.h>." >&4
16005                 val="$undef"
16006         fi
16007         $rm -f try.* try
16008         ;;
16009 esac
16010 set i_neterrno
16011 eval $setvar
16012
16013 : see if netinet/tcp.h is available
16014 set netinet/tcp.h i_netinettcp
16015 eval $inhdr
16016
16017 : see if this is a poll.h system
16018 set poll.h i_poll
16019 eval $inhdr
16020
16021 : see if this is a prot.h system
16022 set prot.h i_prot
16023 eval $inhdr
16024
16025 echo " "
16026 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
16027 $cat <<'EOSH' > Cppsym.know
16028 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
16029 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
16030 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
16031 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
16032 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
16033 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
16034 bull c cadmus clipper CMU COFF COMPILER_VERSION
16035 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
16036 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
16037 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
16038 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
16039 GLIBC GLIBC_MINOR
16040 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
16041 H3050R H3050RX hbullx20 hcx host_mips
16042 hp200 hp300 hp700 HP700 hp800 hp9000
16043 hp9000s200 hp9000s300 hp9000s400 hp9000s500
16044 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
16045 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
16046 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
16047 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
16048 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
16049 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
16050 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
16051 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
16052 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
16053 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
16054 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
16055 MATH_HAS_NO_SIDE_EFFECTS
16056 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
16057 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
16058 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
16059 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
16060 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
16061 NetBSD news1500 news1700 news1800 news1900 news3700
16062 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
16063 ns32016 ns32332 ns32k nsc32000
16064 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
16065 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
16066 pc532 pdp11 PGC PIC plexus PORTAR posix
16067 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
16068 POSIX_C_SOURCE POSIX_SOURCE POWER
16069 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
16070 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
16071 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
16072 sony sony_news sonyrisc sparc sparclite spectrum
16073 stardent stdc STDC_EXT stratos sun sun3 sun386
16074 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
16075 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
16076 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
16077 sysV68 sysV88 Tek4132 Tek4300 titan
16078 TM3200 TM5400 TM5600
16079 tower tower32 tower32_200 tower32_600 tower32_700
16080 tower32_800 tower32_850 tss
16081 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
16082 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
16083 unix UNIX95 UNIX99 unixpc unos
16084 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
16085 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
16086 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
16087 USGr4 USGr4_2
16088 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
16089 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
16090 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
16091 z8000
16092 EOSH
16093 # Maybe put other stuff here too.
16094 cat <<EOSH >>Cppsym.know
16095 $osname
16096 EOSH
16097 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
16098 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
16099 $cat Cppsym.know > Cppsym.c
16100 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
16101 $rm -f Cppsym.a Cppsym.b Cppsym.c
16102 cat <<EOSH > Cppsym
16103 $startsh
16104 if $test \$# -gt 0; then
16105     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
16106     if $test -s Cppsym.got; then
16107         $rm -f Cppsym.got
16108         exit 0
16109     fi
16110     $rm -f Cppsym.got
16111     exit 1
16112 else
16113     $tr " " "$trnl" | ./Cppsym.try
16114     exit 0
16115 fi
16116 EOSH
16117 chmod +x Cppsym
16118 $eunicefix Cppsym
16119 cat <<EOSH > Cppsym.try
16120 $startsh
16121 cat <<'EOCP' > try.c
16122 #include <stdio.h>
16123 int main() {
16124 EOCP
16125 $awk \\
16126 EOSH
16127 cat <<'EOSH' >> Cppsym.try
16128 'length($1) > 0 {
16129     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
16130     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
16131     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
16132     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
16133 }'       >> try.c
16134 echo 'return 0;}' >> try.c
16135 EOSH
16136 cat <<EOSH >> Cppsym.try
16137 ccflags="$ccflags"
16138 case "$osname-$gccversion" in
16139 irix-) ccflags="\$ccflags -woff 1178" ;;
16140 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
16141 esac
16142 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
16143 EOSH
16144 chmod +x Cppsym.try
16145 $eunicefix Cppsym.try
16146 ./Cppsym < Cppsym.know > Cppsym.true
16147 : now check the C compiler for additional symbols
16148 postprocess_cc_v=''
16149 case "$osname" in
16150 aix) postprocess_cc_v="|$tr , ' '" ;;
16151 esac
16152 $cat >ccsym <<EOS
16153 $startsh
16154 $cat >tmp.c <<EOF
16155 extern int foo;
16156 EOF
16157 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
16158 do
16159         case "\$i" in
16160         -D*) echo "\$i" | $sed 's/^-D//';;
16161         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
16162         esac
16163 done
16164 $rm -f try.c
16165 EOS
16166 postprocess_cc_v=''
16167 chmod +x ccsym
16168 $eunicefix ccsym
16169 ./ccsym > ccsym1.raw
16170 if $test -s ccsym1.raw; then
16171        $sort ccsym1.raw | $uniq >ccsym.raw
16172 else
16173        mv ccsym1.raw ccsym.raw
16174 fi
16175
16176 $awk '/\=/ { print $0; next }
16177         { print $0"=1" }' ccsym.raw >ccsym.list
16178 $awk '/\=/ { print $0; next }
16179         { print $0"=1" }' Cppsym.true >ccsym.true
16180 $comm -13 ccsym.true ccsym.list >ccsym.own
16181 $comm -12 ccsym.true ccsym.list >ccsym.com
16182 $comm -23 ccsym.true ccsym.list >ccsym.cpp
16183 also=''
16184 if $test -z ccsym.raw; then
16185         echo "Your C compiler doesn't seem to define any symbols!" >&4
16186         echo " "
16187         echo "However, your C preprocessor defines the following symbols:"
16188         $cat Cppsym.true
16189         ccsymbols=''
16190         cppsymbols=`$cat Cppsym.true`
16191         cppsymbols=`echo $cppsymbols`
16192         cppccsymbols="$cppsymbols"
16193 else
16194         if $test -s ccsym.com; then
16195                 echo "Your C compiler and pre-processor define these symbols:"
16196                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
16197                 also='also '
16198                 symbols='ones'
16199                 cppccsymbols=`$cat ccsym.com`
16200                 cppccsymbols=`echo $cppccsymbols`
16201                 $test "$silent" || sleep 1
16202         fi
16203         if $test -s ccsym.cpp; then
16204                 $test "$also" && echo " "
16205                 echo "Your C pre-processor ${also}defines the following symbols:"
16206                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
16207                 also='further '
16208                 cppsymbols=`$cat ccsym.cpp`
16209                 cppsymbols=`echo $cppsymbols`
16210                 $test "$silent" || sleep 1
16211         fi
16212         if $test -s ccsym.own; then
16213                 $test "$also" && echo " "
16214                 echo "Your C compiler ${also}defines the following cpp symbols:"
16215                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
16216                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
16217                 ccsymbols=`$cat ccsym.own`
16218                 ccsymbols=`echo $ccsymbols`
16219                 $test "$silent" || sleep 1
16220         fi
16221 fi
16222
16223 : see if this is a termio system
16224 val="$undef"
16225 val2="$undef"
16226 val3="$undef"
16227 if $test `./findhdr termios.h`; then
16228         set tcsetattr i_termios
16229         eval $inlibc
16230         val3="$i_termios"
16231 fi
16232 echo " "
16233 case "$val3" in
16234 "$define") echo "You have POSIX termios.h... good!" >&4;;
16235 *) if ./Cppsym pyr; then
16236                 case "`/bin/universe`" in
16237                 ucb) if $test `./findhdr sgtty.h`; then
16238                                 val2="$define"
16239                                 echo "<sgtty.h> found." >&4
16240                         else
16241                                 echo "System is pyramid with BSD universe."
16242                                 echo "<sgtty.h> not found--you could have problems." >&4
16243                         fi;;
16244                 *) if $test `./findhdr termio.h`; then
16245                                 val="$define"
16246                                 echo "<termio.h> found." >&4
16247                         else
16248                                 echo "System is pyramid with USG universe."
16249                                 echo "<termio.h> not found--you could have problems." >&4
16250                         fi;;
16251                 esac
16252         elif ./usg; then
16253                 if $test `./findhdr termio.h`; then
16254                         echo "<termio.h> found." >&4
16255                         val="$define"
16256                 elif $test `./findhdr sgtty.h`; then
16257                         echo "<sgtty.h> found." >&4
16258                         val2="$define"
16259                 else
16260 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16261                 fi
16262         else
16263                 if $test `./findhdr sgtty.h`; then
16264                         echo "<sgtty.h> found." >&4
16265                         val2="$define"
16266                 elif $test `./findhdr termio.h`; then
16267                         echo "<termio.h> found." >&4
16268                         val="$define"
16269                 else
16270 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16271                 fi
16272         fi;;
16273 esac
16274 set i_termio; eval $setvar
16275 val=$val2; set i_sgtty; eval $setvar
16276 val=$val3; set i_termios; eval $setvar
16277
16278 : see if this is a shadow.h system
16279 set shadow.h i_shadow
16280 eval $inhdr
16281
16282 : see if stddef is available
16283 set stddef.h i_stddef
16284 eval $inhdr
16285
16286 : see if this is a sunmath.h system
16287 set sunmath.h i_sunmath
16288 eval $inhdr
16289
16290 : see if sys/access.h is available
16291 set sys/access.h i_sysaccess
16292 eval $inhdr
16293
16294 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16295 set sys/filio.h i_sysfilio
16296 eval $inhdr
16297 echo " "
16298 if $test `./findhdr sys/ioctl.h`; then
16299         val="$define"
16300         echo '<sys/ioctl.h> found.' >&4
16301 else
16302         val="$undef"
16303         if $test $i_sysfilio = "$define"; then
16304             echo '<sys/ioctl.h> NOT found.' >&4
16305         else
16306                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16307                 $test $i_termio = "$define" && xxx="termio.h"
16308                 $test $i_termios = "$define" && xxx="termios.h"
16309 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16310         fi
16311 fi
16312 set i_sysioctl
16313 eval $setvar
16314
16315 : see if socket ioctl defs are in sys/sockio.h
16316 echo " "
16317 xxx=`./findhdr sys/sockio.h`
16318 if $test "$xxx"; then
16319         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16320                 val="$define"
16321                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16322         else
16323                 val="$undef"
16324                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16325         fi
16326 else
16327         val="$undef"
16328         $cat <<EOM
16329 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16330 EOM
16331 fi
16332 set i_syssockio
16333 eval $setvar
16334
16335
16336 : see if this is a syslog.h system
16337 set syslog.h i_syslog
16338 eval $inhdr
16339
16340
16341 : see if this is a sys/mode.h system
16342 set sys/mode.h i_sysmode
16343 eval $inhdr
16344
16345 : see if sys/resource.h has to be included
16346 set sys/resource.h i_sysresrc
16347 eval $inhdr
16348
16349 : see if sys/security.h is available
16350 set sys/security.h i_syssecrt
16351 eval $inhdr
16352
16353 : see if this is a sys/statvfs.h system
16354 set sys/statvfs.h i_sysstatvfs
16355 eval $inhdr
16356
16357 : see if this is a sys/un.h system
16358 set sys/un.h i_sysun
16359 eval $inhdr
16360
16361
16362 : see if this is a sys/utsname.h system
16363 set sys/utsname.h i_sysutsname
16364 eval $inhdr
16365
16366 : see if this is a syswait system
16367 set sys/wait.h i_syswait
16368 eval $inhdr
16369
16370 : see if this is a ustat.h system
16371 set ustat.h i_ustat
16372 eval $inhdr
16373
16374 : see if this is an utime system
16375 set utime.h i_utime
16376 eval $inhdr
16377
16378 : see if this is a values.h system
16379 set values.h i_values
16380 eval $inhdr
16381
16382 : see if this is a vfork system
16383 case "$d_vfork" in
16384 "$define")
16385         set vfork.h i_vfork
16386         eval $inhdr
16387         ;;
16388 *)
16389         i_vfork="$undef"
16390         ;;
16391 esac
16392
16393 : see if gdbm.h is available
16394 set gdbm.h t_gdbm
16395 eval $inhdr
16396 case "$t_gdbm" in
16397 $define)
16398         : see if gdbm_open exists
16399         set gdbm_open d_gdbm_open
16400         eval $inlibc
16401         case "$d_gdbm_open" in
16402         $undef)
16403                 t_gdbm="$undef"
16404                 echo "We won't be including <gdbm.h>"
16405                 ;;
16406         esac
16407         ;;
16408 esac
16409 val="$t_gdbm"
16410 set i_gdbm
16411 eval $setvar
16412
16413 echo " "
16414 echo "Looking for extensions..." >&4
16415 : If we are using the old config.sh, known_extensions may contain
16416 : old or inaccurate or duplicate values.
16417 known_extensions=''
16418 nonxs_extensions=''
16419 : We do not use find because it might not be available.
16420 : We do not just use MANIFEST because the user may have dropped
16421 : some additional extensions into the source tree and expect them
16422 : to be built.
16423
16424 : Function to recursively find available extensions, ignoring DynaLoader
16425 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16426 find_extensions='
16427     for xxx in *; do
16428        case "$xxx" in
16429            DynaLoader|dynaload) ;;
16430            *)
16431            if $test -f $xxx/$xxx.xs; then
16432                known_extensions="$known_extensions $1$xxx";
16433            elif $test -f $xxx/Makefile.PL; then
16434                nonxs_extensions="$nonxs_extensions $1$xxx";
16435            else
16436                if $test -d $xxx -a $# -lt 10; then
16437                    set $1$xxx/ $*;
16438                    cd $xxx;
16439                    eval $find_extensions;
16440                    cd ..;
16441                    shift;
16442                fi;
16443            fi
16444            ;;
16445        esac;
16446     done'
16447 tdir=`pwd`
16448 cd $rsrc/ext
16449 set X
16450 shift
16451 eval $find_extensions
16452 # Special case:  Add in threads/shared since it is not picked up by the
16453 # recursive find above (and adding in general recursive finding breaks
16454 # SDBM_File/sdbm).  A.D.  10/25/2001.
16455 known_extensions="$known_extensions threads/shared"
16456 set X $nonxs_extensions
16457 shift
16458 nonxs_extensions="$*"
16459 set X $known_extensions
16460 shift
16461 known_extensions="$*"
16462 cd $tdir
16463
16464 : Now see which are supported on this system.
16465 avail_ext=''
16466 for xxx in $known_extensions ; do
16467         case "$xxx" in
16468         DB_File|db_file)
16469                 case "$i_db" in
16470                 $define) avail_ext="$avail_ext $xxx" ;;
16471                 esac
16472                 ;;
16473         GDBM_File|gdbm_fil)
16474                 case "$i_gdbm" in 
16475                 $define) avail_ext="$avail_ext $xxx" ;;
16476                 esac
16477                 ;;
16478         I18N/Langinfo|i18n_lan)
16479                 case "$i_langinfo$d_nl_langinfo" in 
16480                 $define$define) avail_ext="$avail_ext $xxx" ;;
16481                 esac
16482                 ;;
16483         NDBM_File|ndbm_fil)
16484                 case "$i_ndbm" in
16485                 $define)
16486                     case "$osname-$use64bitint" in
16487                     cygwin-*|hpux-define)
16488                         case "$libs" in
16489                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16490                         esac
16491                         ;;
16492                     *) avail_ext="$avail_ext $xxx" ;;
16493                     esac
16494                     ;;
16495                 esac
16496                 ;;
16497         ODBM_File|odbm_fil) 
16498                 case "${i_dbm}${i_rpcsvcdbm}" in
16499                 *"${define}"*)
16500                     case "$osname-$use64bitint" in
16501                     cygwin-*|hpux-define)
16502                         case "$libs" in
16503                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16504                         esac
16505                         ;;
16506                     *) avail_ext="$avail_ext $xxx" ;;
16507                     esac
16508                     ;;
16509                 esac
16510                 ;;
16511         POSIX|posix)
16512                 case "$useposix" in
16513                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16514                 esac
16515                 ;;
16516         Opcode|opcode)
16517                 case "$useopcode" in
16518                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16519                 esac
16520                 ;;
16521         Socket|socket)
16522                 case "$d_socket" in 
16523                 true|$define|y)
16524                     case "$osname" in
16525                     beos) ;; # not unless BONE
16526                     *) avail_ext="$avail_ext $xxx" ;;
16527                     esac
16528                     ;;
16529                 esac
16530                 ;;
16531         Sys/Syslog|sys/syslog)
16532                 : XXX syslog requires socket
16533                 case "$d_socket" in 
16534                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16535                 esac
16536                 ;;
16537         Thread|thread)
16538                 case "$usethreads" in
16539                 true|$define|y)
16540                         case "$useithreads" in
16541                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16542                         esac
16543                 esac
16544                 ;;
16545         threads|threads/shared)
16546                 case "$usethreads" in
16547                 true|$define|y)
16548                         case "$useithreads" in
16549                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
16550                         esac
16551                 esac
16552                 ;;
16553         IPC/SysV|ipc/sysv)
16554                 : XXX Do we need a useipcsysv variable here
16555                 case "${d_msg}${d_sem}${d_shm}" in 
16556                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16557                 esac
16558                 ;;
16559         *)      avail_ext="$avail_ext $xxx"
16560                 ;;
16561         esac
16562 done
16563
16564 set X $avail_ext
16565 shift
16566 avail_ext="$*"
16567
16568 : Now see which nonxs extensions are supported on this system.
16569 : For now assume all are.
16570 nonxs_ext=''
16571 for xxx in $nonxs_extensions ; do
16572         case "$xxx" in
16573         *)      nonxs_ext="$nonxs_ext $xxx"
16574                 ;;
16575         esac
16576 done
16577
16578 set X $nonxs_ext
16579 shift
16580 nonxs_ext="$*"
16581
16582 case $usedl in
16583 $define)
16584         $cat <<EOM
16585 A number of extensions are supplied with $package.  You may choose to
16586 compile these extensions for dynamic loading (the default), compile
16587 them into the $package executable (static loading), or not include
16588 them at all.  Answer "none" to include no extensions.
16589 Note that DynaLoader is always built and need not be mentioned here.
16590
16591 EOM
16592         case "$dynamic_ext" in
16593         '') dflt="$avail_ext" ;;
16594         *)      dflt="$dynamic_ext"
16595                 # Perhaps we are reusing an old out-of-date config.sh.
16596                 case "$hint" in
16597                 previous)
16598                         if test X"$dynamic_ext" != X"$avail_ext"; then
16599                                 $cat <<EOM
16600 NOTICE:  Your previous config.sh list may be incorrect. 
16601 The extensions now available to you are 
16602         ${avail_ext}
16603 but the default list from your previous config.sh is
16604         ${dynamic_ext} 
16605
16606 EOM
16607                         fi
16608                         ;;
16609                 esac
16610                 ;;
16611         esac
16612         case "$dflt" in
16613         '')     dflt=none;;
16614         esac
16615         rp="What extensions do you wish to load dynamically?"
16616         . ./myread
16617         case "$ans" in
16618         none) dynamic_ext=' ' ;;
16619         *) dynamic_ext="$ans" ;;
16620         esac
16621
16622         case "$static_ext" in
16623         '')
16624                 : Exclude those already listed in dynamic linking
16625                 dflt=''
16626                 for xxx in $avail_ext; do
16627                         case " $dynamic_ext " in
16628                         *" $xxx "*) ;;
16629                         *) dflt="$dflt $xxx" ;;
16630                         esac
16631                 done
16632                 set X $dflt
16633                 shift
16634                 dflt="$*"
16635                 ;;
16636         *)  dflt="$static_ext" 
16637                 ;;
16638         esac
16639
16640         case "$dflt" in
16641         '')     dflt=none;;
16642         esac
16643         rp="What extensions do you wish to load statically?"
16644         . ./myread
16645         case "$ans" in
16646         none) static_ext=' ' ;;
16647         *) static_ext="$ans" ;;
16648         esac
16649         ;;
16650 *)
16651         $cat <<EOM
16652 A number of extensions are supplied with $package.  Answer "none" 
16653 to include no extensions. 
16654 Note that DynaLoader is always built and need not be mentioned here.
16655
16656 EOM
16657         case "$static_ext" in
16658         '') dflt="$avail_ext" ;;
16659         *)      dflt="$static_ext"
16660                 # Perhaps we are reusing an old out-of-date config.sh.
16661                 case "$hint" in
16662                 previous)
16663                         if test X"$static_ext" != X"$avail_ext"; then
16664                                 $cat <<EOM
16665 NOTICE:  Your previous config.sh list may be incorrect. 
16666 The extensions now available to you are 
16667         ${avail_ext}
16668 but the default list from your previous config.sh is
16669         ${static_ext} 
16670
16671 EOM
16672                         fi
16673                         ;;
16674                 esac
16675                 ;;
16676         esac
16677         : Exclude those that are not xs extensions
16678         case "$dflt" in
16679         '')     dflt=none;;
16680         esac
16681         rp="What extensions do you wish to include?"
16682         . ./myread
16683         case "$ans" in
16684         none) static_ext=' ' ;;
16685         *) static_ext="$ans" ;;
16686         esac
16687         ;;
16688 esac
16689
16690 set X $dynamic_ext $static_ext $nonxs_ext
16691 shift
16692 extensions="$*"
16693
16694 : Remove libraries needed only for extensions
16695 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16696 : The exception is SunOS 4.x, which needs them.
16697 case "${osname}X${osvers}" in
16698 sunos*X4*)
16699     perllibs="$libs"
16700     ;;
16701 *) case "$usedl" in
16702     $define|true|[yY]*)
16703             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16704             shift
16705             perllibs="$*"
16706             ;;
16707     *)  perllibs="$libs"
16708             ;;
16709     esac
16710     ;;
16711 esac
16712
16713 : Remove build directory name from cppstdin so it can be used from
16714 : either the present location or the final installed location.
16715 echo " "
16716 : Get out of the UU directory to get correct path name.
16717 cd ..
16718 case "$cppstdin" in
16719 `pwd`/cppstdin)
16720         echo "Stripping down cppstdin path name"
16721         cppstdin=cppstdin
16722         ;;
16723 esac
16724 cd UU
16725
16726 : end of configuration questions
16727 echo " "
16728 echo "End of configuration questions."
16729 echo " "
16730
16731 : back to where it started
16732 if test -d ../UU; then
16733         cd ..
16734 fi
16735
16736 : configuration may be patched via a 'config.arch' file
16737 if $test -f config.arch; then
16738         echo "I see a config.arch file, loading it."
16739         . ./config.arch
16740 fi
16741
16742 : configuration may be patched via a 'config.over' file
16743 if $test -f config.over; then
16744         echo " "
16745         dflt=y
16746         rp='I see a config.over file.  Do you wish to load it?'
16747         . UU/myread
16748         case "$ans" in
16749         n*) echo "OK, I'll ignore it.";;
16750         *)      . ./config.over
16751                 echo "Configuration override changes have been loaded."
16752                 ;;
16753         esac
16754 fi
16755
16756 : in case they want portability, strip down executable paths
16757 case "$d_portable" in
16758 "$define")
16759         echo " "
16760         echo "Stripping down executable paths..." >&4
16761         for file in $loclist $trylist; do
16762                 eval temp=\$$file
16763                 eval $file=`basename $temp`
16764         done
16765         ;;
16766 esac
16767
16768 : create config.sh file
16769 echo " "
16770 echo "Creating config.sh..." >&4
16771 $spitshell <<EOT >config.sh
16772 $startsh
16773 #
16774 # This file was produced by running the Configure script. It holds all the
16775 # definitions figured out by Configure. Should you modify one of these values,
16776 # do not forget to propagate your changes by running "Configure -der". You may
16777 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16778 #
16779
16780 # Package name      : $package
16781 # Source directory  : $src
16782 # Configuration time: $cf_time
16783 # Configured by     : $cf_by
16784 # Target system     : $myuname
16785
16786 Author='$Author'
16787 Date='$Date'
16788 Header='$Header'
16789 Id='$Id'
16790 Locker='$Locker'
16791 Log='$Log'
16792 Mcc='$Mcc'
16793 RCSfile='$RCSfile'
16794 Revision='$Revision'
16795 Source='$Source'
16796 State='$State'
16797 _a='$_a'
16798 _exe='$_exe'
16799 _o='$_o'
16800 afs='$afs'
16801 afsroot='$afsroot'
16802 alignbytes='$alignbytes'
16803 ansi2knr='$ansi2knr'
16804 aphostname='$aphostname'
16805 api_revision='$api_revision'
16806 api_subversion='$api_subversion'
16807 api_version='$api_version'
16808 api_versionstring='$api_versionstring'
16809 ar='$ar'
16810 archlib='$archlib'
16811 archlibexp='$archlibexp'
16812 archname64='$archname64'
16813 archname='$archname'
16814 archobjs='$archobjs'
16815 awk='$awk'
16816 baserev='$baserev'
16817 bash='$bash'
16818 bin='$bin'
16819 bincompat5005='$bincompat5005'
16820 binexp='$binexp'
16821 bison='$bison'
16822 byacc='$byacc'
16823 byteorder='$byteorder'
16824 c='$c'
16825 castflags='$castflags'
16826 cat='$cat'
16827 cc='$cc'
16828 cccdlflags='$cccdlflags'
16829 ccdlflags='$ccdlflags'
16830 ccflags='$ccflags'
16831 ccflags_uselargefiles='$ccflags_uselargefiles'
16832 ccname='$ccname'
16833 ccsymbols='$ccsymbols'
16834 ccversion='$ccversion'
16835 cf_by='$cf_by'
16836 cf_email='$cf_email'
16837 cf_time='$cf_time'
16838 charsize='$charsize'
16839 chgrp='$chgrp'
16840 chmod='$chmod'
16841 chown='$chown'
16842 clocktype='$clocktype'
16843 comm='$comm'
16844 compress='$compress'
16845 contains='$contains'
16846 cp='$cp'
16847 cpio='$cpio'
16848 cpp='$cpp'
16849 cpp_stuff='$cpp_stuff'
16850 cppccsymbols='$cppccsymbols'
16851 cppflags='$cppflags'
16852 cpplast='$cpplast'
16853 cppminus='$cppminus'
16854 cpprun='$cpprun'
16855 cppstdin='$cppstdin'
16856 cppsymbols='$cppsymbols'
16857 cryptlib='$cryptlib'
16858 csh='$csh'
16859 d_Gconvert='$d_Gconvert'
16860 d_PRIEUldbl='$d_PRIEUldbl'
16861 d_PRIFUldbl='$d_PRIFUldbl'
16862 d_PRIGUldbl='$d_PRIGUldbl'
16863 d_PRIXU64='$d_PRIXU64'
16864 d_PRId64='$d_PRId64'
16865 d_PRIeldbl='$d_PRIeldbl'
16866 d_PRIfldbl='$d_PRIfldbl'
16867 d_PRIgldbl='$d_PRIgldbl'
16868 d_PRIi64='$d_PRIi64'
16869 d_PRIo64='$d_PRIo64'
16870 d_PRIu64='$d_PRIu64'
16871 d_PRIx64='$d_PRIx64'
16872 d_SCNfldbl='$d_SCNfldbl'
16873 d__fwalk='$d__fwalk'
16874 d_access='$d_access'
16875 d_accessx='$d_accessx'
16876 d_alarm='$d_alarm'
16877 d_archlib='$d_archlib'
16878 d_atolf='$d_atolf'
16879 d_atoll='$d_atoll'
16880 d_attribut='$d_attribut'
16881 d_bcmp='$d_bcmp'
16882 d_bcopy='$d_bcopy'
16883 d_bincompat5005='$d_bincompat5005'
16884 d_bsd='$d_bsd'
16885 d_bsdgetpgrp='$d_bsdgetpgrp'
16886 d_bsdsetpgrp='$d_bsdsetpgrp'
16887 d_bzero='$d_bzero'
16888 d_casti32='$d_casti32'
16889 d_castneg='$d_castneg'
16890 d_charvspr='$d_charvspr'
16891 d_chown='$d_chown'
16892 d_chroot='$d_chroot'
16893 d_chsize='$d_chsize'
16894 d_class='$d_class'
16895 d_closedir='$d_closedir'
16896 d_cmsghdr_s='$d_cmsghdr_s'
16897 d_const='$d_const'
16898 d_crypt='$d_crypt'
16899 d_csh='$d_csh'
16900 d_cuserid='$d_cuserid'
16901 d_dbl_dig='$d_dbl_dig'
16902 d_dbminitproto='$d_dbminitproto'
16903 d_difftime='$d_difftime'
16904 d_dirfd='$d_dirfd'
16905 d_dirnamlen='$d_dirnamlen'
16906 d_dlerror='$d_dlerror'
16907 d_dlopen='$d_dlopen'
16908 d_dlsymun='$d_dlsymun'
16909 d_dosuid='$d_dosuid'
16910 d_drand48proto='$d_drand48proto'
16911 d_dup2='$d_dup2'
16912 d_eaccess='$d_eaccess'
16913 d_endgrent='$d_endgrent'
16914 d_endhent='$d_endhent'
16915 d_endnent='$d_endnent'
16916 d_endpent='$d_endpent'
16917 d_endpwent='$d_endpwent'
16918 d_endsent='$d_endsent'
16919 d_eofnblk='$d_eofnblk'
16920 d_eunice='$d_eunice'
16921 d_fchdir='$d_fchdir'
16922 d_fchmod='$d_fchmod'
16923 d_fchown='$d_fchown'
16924 d_fcntl='$d_fcntl'
16925 d_fcntl_can_lock='$d_fcntl_can_lock'
16926 d_fd_macros='$d_fd_macros'
16927 d_fd_set='$d_fd_set'
16928 d_fds_bits='$d_fds_bits'
16929 d_fgetpos='$d_fgetpos'
16930 d_finite='$d_finite'
16931 d_finitel='$d_finitel'
16932 d_flexfnam='$d_flexfnam'
16933 d_flock='$d_flock'
16934 d_flockproto='$d_flockproto'
16935 d_fork='$d_fork'
16936 d_fp_class='$d_fp_class'
16937 d_fpathconf='$d_fpathconf'
16938 d_fpclass='$d_fpclass'
16939 d_fpclassify='$d_fpclassify'
16940 d_fpclassl='$d_fpclassl'
16941 d_fpos64_t='$d_fpos64_t'
16942 d_frexpl='$d_frexpl'
16943 d_fs_data_s='$d_fs_data_s'
16944 d_fseeko='$d_fseeko'
16945 d_fsetpos='$d_fsetpos'
16946 d_fstatfs='$d_fstatfs'
16947 d_fstatvfs='$d_fstatvfs'
16948 d_fsync='$d_fsync'
16949 d_ftello='$d_ftello'
16950 d_ftime='$d_ftime'
16951 d_getcwd='$d_getcwd'
16952 d_getespwnam='$d_getespwnam'
16953 d_getfsstat='$d_getfsstat'
16954 d_getgrent='$d_getgrent'
16955 d_getgrps='$d_getgrps'
16956 d_gethbyaddr='$d_gethbyaddr'
16957 d_gethbyname='$d_gethbyname'
16958 d_gethent='$d_gethent'
16959 d_gethname='$d_gethname'
16960 d_gethostprotos='$d_gethostprotos'
16961 d_getitimer='$d_getitimer'
16962 d_getlogin='$d_getlogin'
16963 d_getmnt='$d_getmnt'
16964 d_getmntent='$d_getmntent'
16965 d_getnbyaddr='$d_getnbyaddr'
16966 d_getnbyname='$d_getnbyname'
16967 d_getnent='$d_getnent'
16968 d_getnetprotos='$d_getnetprotos'
16969 d_getpagsz='$d_getpagsz'
16970 d_getpbyname='$d_getpbyname'
16971 d_getpbynumber='$d_getpbynumber'
16972 d_getpent='$d_getpent'
16973 d_getpgid='$d_getpgid'
16974 d_getpgrp2='$d_getpgrp2'
16975 d_getpgrp='$d_getpgrp'
16976 d_getppid='$d_getppid'
16977 d_getprior='$d_getprior'
16978 d_getprotoprotos='$d_getprotoprotos'
16979 d_getprpwnam='$d_getprpwnam'
16980 d_getpwent='$d_getpwent'
16981 d_getsbyname='$d_getsbyname'
16982 d_getsbyport='$d_getsbyport'
16983 d_getsent='$d_getsent'
16984 d_getservprotos='$d_getservprotos'
16985 d_getspnam='$d_getspnam'
16986 d_gettimeod='$d_gettimeod'
16987 d_gnulibc='$d_gnulibc'
16988 d_grpasswd='$d_grpasswd'
16989 d_hasmntopt='$d_hasmntopt'
16990 d_htonl='$d_htonl'
16991 d_index='$d_index'
16992 d_inetaton='$d_inetaton'
16993 d_int64_t='$d_int64_t'
16994 d_isascii='$d_isascii'
16995 d_isfinite='$d_isfinite'
16996 d_isinf='$d_isinf'
16997 d_isnan='$d_isnan'
16998 d_isnanl='$d_isnanl'
16999 d_killpg='$d_killpg'
17000 d_lchown='$d_lchown'
17001 d_ldbl_dig='$d_ldbl_dig'
17002 d_link='$d_link'
17003 d_locconv='$d_locconv'
17004 d_lockf='$d_lockf'
17005 d_longdbl='$d_longdbl'
17006 d_longlong='$d_longlong'
17007 d_lseekproto='$d_lseekproto'
17008 d_lstat='$d_lstat'
17009 d_madvise='$d_madvise'
17010 d_mblen='$d_mblen'
17011 d_mbstowcs='$d_mbstowcs'
17012 d_mbtowc='$d_mbtowc'
17013 d_memchr='$d_memchr'
17014 d_memcmp='$d_memcmp'
17015 d_memcpy='$d_memcpy'
17016 d_memmove='$d_memmove'
17017 d_memset='$d_memset'
17018 d_mkdir='$d_mkdir'
17019 d_mkdtemp='$d_mkdtemp'
17020 d_mkfifo='$d_mkfifo'
17021 d_mkstemp='$d_mkstemp'
17022 d_mkstemps='$d_mkstemps'
17023 d_mktime='$d_mktime'
17024 d_mmap='$d_mmap'
17025 d_modfl='$d_modfl'
17026 d_modfl_pow32_bug='$d_modfl_pow32_bug'
17027 d_mprotect='$d_mprotect'
17028 d_msg='$d_msg'
17029 d_msg_ctrunc='$d_msg_ctrunc'
17030 d_msg_dontroute='$d_msg_dontroute'
17031 d_msg_oob='$d_msg_oob'
17032 d_msg_peek='$d_msg_peek'
17033 d_msg_proxy='$d_msg_proxy'
17034 d_msgctl='$d_msgctl'
17035 d_msgget='$d_msgget'
17036 d_msghdr_s='$d_msghdr_s'
17037 d_msgrcv='$d_msgrcv'
17038 d_msgsnd='$d_msgsnd'
17039 d_msync='$d_msync'
17040 d_munmap='$d_munmap'
17041 d_mymalloc='$d_mymalloc'
17042 d_nice='$d_nice'
17043 d_nl_langinfo='$d_nl_langinfo'
17044 d_nv_preserves_uv='$d_nv_preserves_uv'
17045 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
17046 d_off64_t='$d_off64_t'
17047 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
17048 d_oldpthreads='$d_oldpthreads'
17049 d_oldsock='$d_oldsock'
17050 d_open3='$d_open3'
17051 d_pathconf='$d_pathconf'
17052 d_pause='$d_pause'
17053 d_perl_otherlibdirs='$d_perl_otherlibdirs'
17054 d_phostname='$d_phostname'
17055 d_pipe='$d_pipe'
17056 d_poll='$d_poll'
17057 d_portable='$d_portable'
17058 d_procselfexe='$d_procselfexe'
17059 d_pthread_atfork='$d_pthread_atfork'
17060 d_pthread_yield='$d_pthread_yield'
17061 d_pwage='$d_pwage'
17062 d_pwchange='$d_pwchange'
17063 d_pwclass='$d_pwclass'
17064 d_pwcomment='$d_pwcomment'
17065 d_pwexpire='$d_pwexpire'
17066 d_pwgecos='$d_pwgecos'
17067 d_pwpasswd='$d_pwpasswd'
17068 d_pwquota='$d_pwquota'
17069 d_qgcvt='$d_qgcvt'
17070 d_quad='$d_quad'
17071 d_readdir='$d_readdir'
17072 d_readlink='$d_readlink'
17073 d_readv='$d_readv'
17074 d_recvmsg='$d_recvmsg'
17075 d_rename='$d_rename'
17076 d_rewinddir='$d_rewinddir'
17077 d_rmdir='$d_rmdir'
17078 d_safebcpy='$d_safebcpy'
17079 d_safemcpy='$d_safemcpy'
17080 d_sanemcmp='$d_sanemcmp'
17081 d_sbrkproto='$d_sbrkproto'
17082 d_sched_yield='$d_sched_yield'
17083 d_scm_rights='$d_scm_rights'
17084 d_seekdir='$d_seekdir'
17085 d_select='$d_select'
17086 d_sem='$d_sem'
17087 d_semctl='$d_semctl'
17088 d_semctl_semid_ds='$d_semctl_semid_ds'
17089 d_semctl_semun='$d_semctl_semun'
17090 d_semget='$d_semget'
17091 d_semop='$d_semop'
17092 d_sendmsg='$d_sendmsg'
17093 d_setegid='$d_setegid'
17094 d_seteuid='$d_seteuid'
17095 d_setgrent='$d_setgrent'
17096 d_setgrps='$d_setgrps'
17097 d_sethent='$d_sethent'
17098 d_setitimer='$d_setitimer'
17099 d_setlinebuf='$d_setlinebuf'
17100 d_setlocale='$d_setlocale'
17101 d_setnent='$d_setnent'
17102 d_setpent='$d_setpent'
17103 d_setpgid='$d_setpgid'
17104 d_setpgrp2='$d_setpgrp2'
17105 d_setpgrp='$d_setpgrp'
17106 d_setprior='$d_setprior'
17107 d_setproctitle='$d_setproctitle'
17108 d_setpwent='$d_setpwent'
17109 d_setregid='$d_setregid'
17110 d_setresgid='$d_setresgid'
17111 d_setresuid='$d_setresuid'
17112 d_setreuid='$d_setreuid'
17113 d_setrgid='$d_setrgid'
17114 d_setruid='$d_setruid'
17115 d_setsent='$d_setsent'
17116 d_setsid='$d_setsid'
17117 d_setvbuf='$d_setvbuf'
17118 d_sfio='$d_sfio'
17119 d_shm='$d_shm'
17120 d_shmat='$d_shmat'
17121 d_shmatprototype='$d_shmatprototype'
17122 d_shmctl='$d_shmctl'
17123 d_shmdt='$d_shmdt'
17124 d_shmget='$d_shmget'
17125 d_sigaction='$d_sigaction'
17126 d_sigprocmask='$d_sigprocmask'
17127 d_sigsetjmp='$d_sigsetjmp'
17128 d_sockatmark='$d_sockatmark'
17129 d_sockatmarkproto='$d_sockatmarkproto'
17130 d_socket='$d_socket'
17131 d_socklen_t='$d_socklen_t'
17132 d_sockpair='$d_sockpair'
17133 d_socks5_init='$d_socks5_init'
17134 d_sqrtl='$d_sqrtl'
17135 d_sresgproto='$d_sresgproto'
17136 d_sresuproto='$d_sresuproto'
17137 d_statblks='$d_statblks'
17138 d_statfs_f_flags='$d_statfs_f_flags'
17139 d_statfs_s='$d_statfs_s'
17140 d_statvfs='$d_statvfs'
17141 d_stdio_cnt_lval='$d_stdio_cnt_lval'
17142 d_stdio_ptr_lval='$d_stdio_ptr_lval'
17143 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
17144 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
17145 d_stdio_stream_array='$d_stdio_stream_array'
17146 d_stdiobase='$d_stdiobase'
17147 d_stdstdio='$d_stdstdio'
17148 d_strchr='$d_strchr'
17149 d_strcoll='$d_strcoll'
17150 d_strctcpy='$d_strctcpy'
17151 d_strerrm='$d_strerrm'
17152 d_strerror='$d_strerror'
17153 d_strftime='$d_strftime'
17154 d_strtod='$d_strtod'
17155 d_strtol='$d_strtol'
17156 d_strtold='$d_strtold'
17157 d_strtoll='$d_strtoll'
17158 d_strtoq='$d_strtoq'
17159 d_strtoul='$d_strtoul'
17160 d_strtoull='$d_strtoull'
17161 d_strtouq='$d_strtouq'
17162 d_strxfrm='$d_strxfrm'
17163 d_suidsafe='$d_suidsafe'
17164 d_symlink='$d_symlink'
17165 d_syscall='$d_syscall'
17166 d_syscallproto='$d_syscallproto'
17167 d_sysconf='$d_sysconf'
17168 d_sysernlst='$d_sysernlst'
17169 d_syserrlst='$d_syserrlst'
17170 d_system='$d_system'
17171 d_tcgetpgrp='$d_tcgetpgrp'
17172 d_tcsetpgrp='$d_tcsetpgrp'
17173 d_telldir='$d_telldir'
17174 d_telldirproto='$d_telldirproto'
17175 d_time='$d_time'
17176 d_times='$d_times'
17177 d_truncate='$d_truncate'
17178 d_tzname='$d_tzname'
17179 d_u32align='$d_u32align'
17180 d_ualarm='$d_ualarm'
17181 d_umask='$d_umask'
17182 d_uname='$d_uname'
17183 d_union_semun='$d_union_semun'
17184 d_unordered='$d_unordered'
17185 d_usleep='$d_usleep'
17186 d_usleepproto='$d_usleepproto'
17187 d_ustat='$d_ustat'
17188 d_vendorarch='$d_vendorarch'
17189 d_vendorbin='$d_vendorbin'
17190 d_vendorlib='$d_vendorlib'
17191 d_vfork='$d_vfork'
17192 d_void_closedir='$d_void_closedir'
17193 d_voidsig='$d_voidsig'
17194 d_voidtty='$d_voidtty'
17195 d_volatile='$d_volatile'
17196 d_vprintf='$d_vprintf'
17197 d_wait4='$d_wait4'
17198 d_waitpid='$d_waitpid'
17199 d_wcstombs='$d_wcstombs'
17200 d_wctomb='$d_wctomb'
17201 d_writev='$d_writev'
17202 d_xenix='$d_xenix'
17203 date='$date'
17204 db_hashtype='$db_hashtype'
17205 db_prefixtype='$db_prefixtype'
17206 db_version_major='$db_version_major'
17207 db_version_minor='$db_version_minor'
17208 db_version_patch='$db_version_patch'
17209 defvoidused='$defvoidused'
17210 direntrytype='$direntrytype'
17211 dlext='$dlext'
17212 dlsrc='$dlsrc'
17213 doublesize='$doublesize'
17214 drand01='$drand01'
17215 dynamic_ext='$dynamic_ext'
17216 eagain='$eagain'
17217 ebcdic='$ebcdic'
17218 echo='$echo'
17219 egrep='$egrep'
17220 emacs='$emacs'
17221 eunicefix='$eunicefix'
17222 exe_ext='$exe_ext'
17223 expr='$expr'
17224 extensions='$extensions'
17225 extras='$extras'
17226 fflushNULL='$fflushNULL'
17227 fflushall='$fflushall'
17228 find='$find'
17229 firstmakefile='$firstmakefile'
17230 flex='$flex'
17231 fpossize='$fpossize'
17232 fpostype='$fpostype'
17233 freetype='$freetype'
17234 from='$from'
17235 full_ar='$full_ar'
17236 full_csh='$full_csh'
17237 full_sed='$full_sed'
17238 gccosandvers='$gccosandvers'
17239 gccversion='$gccversion'
17240 gidformat='$gidformat'
17241 gidsign='$gidsign'
17242 gidsize='$gidsize'
17243 gidtype='$gidtype'
17244 glibpth='$glibpth'
17245 grep='$grep'
17246 groupcat='$groupcat'
17247 groupstype='$groupstype'
17248 gzip='$gzip'
17249 h_fcntl='$h_fcntl'
17250 h_sysfile='$h_sysfile'
17251 hint='$hint'
17252 hostcat='$hostcat'
17253 i16size='$i16size'
17254 i16type='$i16type'
17255 i32size='$i32size'
17256 i32type='$i32type'
17257 i64size='$i64size'
17258 i64type='$i64type'
17259 i8size='$i8size'
17260 i8type='$i8type'
17261 i_arpainet='$i_arpainet'
17262 i_bsdioctl='$i_bsdioctl'
17263 i_db='$i_db'
17264 i_dbm='$i_dbm'
17265 i_dirent='$i_dirent'
17266 i_dld='$i_dld'
17267 i_dlfcn='$i_dlfcn'
17268 i_fcntl='$i_fcntl'
17269 i_float='$i_float'
17270 i_fp='$i_fp'
17271 i_fp_class='$i_fp_class'
17272 i_gdbm='$i_gdbm'
17273 i_grp='$i_grp'
17274 i_ieeefp='$i_ieeefp'
17275 i_inttypes='$i_inttypes'
17276 i_langinfo='$i_langinfo'
17277 i_libutil='$i_libutil'
17278 i_limits='$i_limits'
17279 i_locale='$i_locale'
17280 i_machcthr='$i_machcthr'
17281 i_malloc='$i_malloc'
17282 i_math='$i_math'
17283 i_memory='$i_memory'
17284 i_mntent='$i_mntent'
17285 i_ndbm='$i_ndbm'
17286 i_netdb='$i_netdb'
17287 i_neterrno='$i_neterrno'
17288 i_netinettcp='$i_netinettcp'
17289 i_niin='$i_niin'
17290 i_poll='$i_poll'
17291 i_prot='$i_prot'
17292 i_pthread='$i_pthread'
17293 i_pwd='$i_pwd'
17294 i_rpcsvcdbm='$i_rpcsvcdbm'
17295 i_sfio='$i_sfio'
17296 i_sgtty='$i_sgtty'
17297 i_shadow='$i_shadow'
17298 i_socks='$i_socks'
17299 i_stdarg='$i_stdarg'
17300 i_stddef='$i_stddef'
17301 i_stdlib='$i_stdlib'
17302 i_string='$i_string'
17303 i_sunmath='$i_sunmath'
17304 i_sysaccess='$i_sysaccess'
17305 i_sysdir='$i_sysdir'
17306 i_sysfile='$i_sysfile'
17307 i_sysfilio='$i_sysfilio'
17308 i_sysin='$i_sysin'
17309 i_sysioctl='$i_sysioctl'
17310 i_syslog='$i_syslog'
17311 i_sysmman='$i_sysmman'
17312 i_sysmode='$i_sysmode'
17313 i_sysmount='$i_sysmount'
17314 i_sysndir='$i_sysndir'
17315 i_sysparam='$i_sysparam'
17316 i_sysresrc='$i_sysresrc'
17317 i_syssecrt='$i_syssecrt'
17318 i_sysselct='$i_sysselct'
17319 i_syssockio='$i_syssockio'
17320 i_sysstat='$i_sysstat'
17321 i_sysstatfs='$i_sysstatfs'
17322 i_sysstatvfs='$i_sysstatvfs'
17323 i_systime='$i_systime'
17324 i_systimek='$i_systimek'
17325 i_systimes='$i_systimes'
17326 i_systypes='$i_systypes'
17327 i_sysuio='$i_sysuio'
17328 i_sysun='$i_sysun'
17329 i_sysutsname='$i_sysutsname'
17330 i_sysvfs='$i_sysvfs'
17331 i_syswait='$i_syswait'
17332 i_termio='$i_termio'
17333 i_termios='$i_termios'
17334 i_time='$i_time'
17335 i_unistd='$i_unistd'
17336 i_ustat='$i_ustat'
17337 i_utime='$i_utime'
17338 i_values='$i_values'
17339 i_varargs='$i_varargs'
17340 i_varhdr='$i_varhdr'
17341 i_vfork='$i_vfork'
17342 ignore_versioned_solibs='$ignore_versioned_solibs'
17343 inc_version_list='$inc_version_list'
17344 inc_version_list_init='$inc_version_list_init'
17345 incpath='$incpath'
17346 inews='$inews'
17347 installarchlib='$installarchlib'
17348 installbin='$installbin'
17349 installman1dir='$installman1dir'
17350 installman3dir='$installman3dir'
17351 installprefix='$installprefix'
17352 installprefixexp='$installprefixexp'
17353 installprivlib='$installprivlib'
17354 installscript='$installscript'
17355 installsitearch='$installsitearch'
17356 installsitebin='$installsitebin'
17357 installsitelib='$installsitelib'
17358 installstyle='$installstyle'
17359 installusrbinperl='$installusrbinperl'
17360 installvendorarch='$installvendorarch'
17361 installvendorbin='$installvendorbin'
17362 installvendorlib='$installvendorlib'
17363 intsize='$intsize'
17364 issymlink='$issymlink'
17365 ivdformat='$ivdformat'
17366 ivsize='$ivsize'
17367 ivtype='$ivtype'
17368 known_extensions='$known_extensions'
17369 ksh='$ksh'
17370 ld='$ld'
17371 lddlflags='$lddlflags'
17372 ldflags='$ldflags'
17373 ldflags_uselargefiles='$ldflags_uselargefiles'
17374 ldlibpthname='$ldlibpthname'
17375 less='$less'
17376 lib_ext='$lib_ext'
17377 libc='$libc'
17378 libperl='$libperl'
17379 libpth='$libpth'
17380 libs='$libs'
17381 libsdirs='$libsdirs'
17382 libsfiles='$libsfiles'
17383 libsfound='$libsfound'
17384 libspath='$libspath'
17385 libswanted='$libswanted'
17386 libswanted_uselargefiles='$libswanted_uselargefiles'
17387 line='$line'
17388 lint='$lint'
17389 lkflags='$lkflags'
17390 ln='$ln'
17391 lns='$lns'
17392 locincpth='$locincpth'
17393 loclibpth='$loclibpth'
17394 longdblsize='$longdblsize'
17395 longlongsize='$longlongsize'
17396 longsize='$longsize'
17397 lp='$lp'
17398 lpr='$lpr'
17399 ls='$ls'
17400 lseeksize='$lseeksize'
17401 lseektype='$lseektype'
17402 mail='$mail'
17403 mailx='$mailx'
17404 make='$make'
17405 make_set_make='$make_set_make'
17406 mallocobj='$mallocobj'
17407 mallocsrc='$mallocsrc'
17408 malloctype='$malloctype'
17409 man1dir='$man1dir'
17410 man1direxp='$man1direxp'
17411 man1ext='$man1ext'
17412 man3dir='$man3dir'
17413 man3direxp='$man3direxp'
17414 man3ext='$man3ext'
17415 mips_type='$mips_type'
17416 mkdir='$mkdir'
17417 mmaptype='$mmaptype'
17418 modetype='$modetype'
17419 more='$more'
17420 multiarch='$multiarch'
17421 mv='$mv'
17422 myarchname='$myarchname'
17423 mydomain='$mydomain'
17424 myhostname='$myhostname'
17425 myuname='$myuname'
17426 n='$n'
17427 need_va_copy='$need_va_copy'
17428 netdb_hlen_type='$netdb_hlen_type'
17429 netdb_host_type='$netdb_host_type'
17430 netdb_name_type='$netdb_name_type'
17431 netdb_net_type='$netdb_net_type'
17432 nm='$nm'
17433 nm_opt='$nm_opt'
17434 nm_so_opt='$nm_so_opt'
17435 nonxs_ext='$nonxs_ext'
17436 nroff='$nroff'
17437 nvEUformat='$nvEUformat'
17438 nvFUformat='$nvFUformat'
17439 nvGUformat='$nvGUformat'
17440 nveformat='$nveformat'
17441 nvfformat='$nvfformat'
17442 nvgformat='$nvgformat'
17443 nvsize='$nvsize'
17444 nvtype='$nvtype'
17445 o_nonblock='$o_nonblock'
17446 obj_ext='$obj_ext'
17447 old_pthread_create_joinable='$old_pthread_create_joinable'
17448 optimize='$optimize'
17449 orderlib='$orderlib'
17450 osname='$osname'
17451 osvers='$osvers'
17452 otherlibdirs='$otherlibdirs'
17453 package='$package'
17454 pager='$pager'
17455 passcat='$passcat'
17456 patchlevel='$patchlevel'
17457 path_sep='$path_sep'
17458 perl5='$perl5'
17459 perl='$perl'
17460 perl_patchlevel='$perl_patchlevel'
17461 perladmin='$perladmin'
17462 perllibs='$perllibs'
17463 perlpath='$perlpath'
17464 pg='$pg'
17465 phostname='$phostname'
17466 pidtype='$pidtype'
17467 plibpth='$plibpth'
17468 pm_apiversion='$pm_apiversion'
17469 pmake='$pmake'
17470 pr='$pr'
17471 prefix='$prefix'
17472 prefixexp='$prefixexp'
17473 privlib='$privlib'
17474 privlibexp='$privlibexp'
17475 procselfexe='$procselfexe'
17476 prototype='$prototype'
17477 ptrsize='$ptrsize'
17478 quadkind='$quadkind'
17479 quadtype='$quadtype'
17480 randbits='$randbits'
17481 randfunc='$randfunc'
17482 randseedtype='$randseedtype'
17483 ranlib='$ranlib'
17484 rd_nodata='$rd_nodata'
17485 revision='$revision'
17486 rm='$rm'
17487 rmail='$rmail'
17488 run='$run'
17489 runnm='$runnm'
17490 sPRIEUldbl='$sPRIEUldbl'
17491 sPRIFUldbl='$sPRIFUldbl'
17492 sPRIGUldbl='$sPRIGUldbl'
17493 sPRIXU64='$sPRIXU64'
17494 sPRId64='$sPRId64'
17495 sPRIeldbl='$sPRIeldbl'
17496 sPRIfldbl='$sPRIfldbl'
17497 sPRIgldbl='$sPRIgldbl'
17498 sPRIi64='$sPRIi64'
17499 sPRIo64='$sPRIo64'
17500 sPRIu64='$sPRIu64'
17501 sPRIx64='$sPRIx64'
17502 sSCNfldbl='$sSCNfldbl'
17503 sched_yield='$sched_yield'
17504 scriptdir='$scriptdir'
17505 scriptdirexp='$scriptdirexp'
17506 sed='$sed'
17507 seedfunc='$seedfunc'
17508 selectminbits='$selectminbits'
17509 selecttype='$selecttype'
17510 sendmail='$sendmail'
17511 sh='$sh'
17512 shar='$shar'
17513 sharpbang='$sharpbang'
17514 shmattype='$shmattype'
17515 shortsize='$shortsize'
17516 shrpenv='$shrpenv'
17517 shsharp='$shsharp'
17518 sig_count='$sig_count'
17519 sig_name='$sig_name'
17520 sig_name_init='$sig_name_init'
17521 sig_num='$sig_num'
17522 sig_num_init='$sig_num_init'
17523 sig_size='$sig_size'
17524 signal_t='$signal_t'
17525 sitearch='$sitearch'
17526 sitearchexp='$sitearchexp'
17527 sitebin='$sitebin'
17528 sitebinexp='$sitebinexp'
17529 sitelib='$sitelib'
17530 sitelib_stem='$sitelib_stem'
17531 sitelibexp='$sitelibexp'
17532 siteprefix='$siteprefix'
17533 siteprefixexp='$siteprefixexp'
17534 sizesize='$sizesize'
17535 sizetype='$sizetype'
17536 sleep='$sleep'
17537 smail='$smail'
17538 so='$so'
17539 sockethdr='$sockethdr'
17540 socketlib='$socketlib'
17541 socksizetype='$socksizetype'
17542 sort='$sort'
17543 spackage='$spackage'
17544 spitshell='$spitshell'
17545 src='$src'
17546 ssizetype='$ssizetype'
17547 startperl='$startperl'
17548 startsh='$startsh'
17549 static_ext='$static_ext'
17550 stdchar='$stdchar'
17551 stdio_base='$stdio_base'
17552 stdio_bufsiz='$stdio_bufsiz'
17553 stdio_cnt='$stdio_cnt'
17554 stdio_filbuf='$stdio_filbuf'
17555 stdio_ptr='$stdio_ptr'
17556 stdio_stream_array='$stdio_stream_array'
17557 strings='$strings'
17558 submit='$submit'
17559 subversion='$subversion'
17560 sysman='$sysman'
17561 tail='$tail'
17562 tar='$tar'
17563 targetarch='$targetarch'
17564 tbl='$tbl'
17565 tee='$tee'
17566 test='$test'
17567 timeincl='$timeincl'
17568 timetype='$timetype'
17569 to='$to'
17570 touch='$touch'
17571 tr='$tr'
17572 trnl='$trnl'
17573 troff='$troff'
17574 u16size='$u16size'
17575 u16type='$u16type'
17576 u32size='$u32size'
17577 u32type='$u32type'
17578 u64size='$u64size'
17579 u64type='$u64type'
17580 u8size='$u8size'
17581 u8type='$u8type'
17582 uidformat='$uidformat'
17583 uidsign='$uidsign'
17584 uidsize='$uidsize'
17585 uidtype='$uidtype'
17586 uname='$uname'
17587 uniq='$uniq'
17588 uquadtype='$uquadtype'
17589 use5005threads='$use5005threads'
17590 use64bitall='$use64bitall'
17591 use64bitint='$use64bitint'
17592 usecrosscompile='$usecrosscompile'
17593 usedl='$usedl'
17594 useithreads='$useithreads'
17595 uselargefiles='$uselargefiles'
17596 uselongdouble='$uselongdouble'
17597 usemorebits='$usemorebits'
17598 usemultiplicity='$usemultiplicity'
17599 usemymalloc='$usemymalloc'
17600 usenm='$usenm'
17601 useopcode='$useopcode'
17602 useperlio='$useperlio'
17603 useposix='$useposix'
17604 usereentrant='$usereentrant'
17605 usesfio='$usesfio'
17606 useshrplib='$useshrplib'
17607 usesocks='$usesocks'
17608 usethreads='$usethreads'
17609 usevendorprefix='$usevendorprefix'
17610 usevfork='$usevfork'
17611 usrinc='$usrinc'
17612 uuname='$uuname'
17613 uvXUformat='$uvXUformat'
17614 uvoformat='$uvoformat'
17615 uvsize='$uvsize'
17616 uvtype='$uvtype'
17617 uvuformat='$uvuformat'
17618 uvxformat='$uvxformat'
17619 vendorarch='$vendorarch'
17620 vendorarchexp='$vendorarchexp'
17621 vendorbin='$vendorbin'
17622 vendorbinexp='$vendorbinexp'
17623 vendorlib='$vendorlib'
17624 vendorlib_stem='$vendorlib_stem'
17625 vendorlibexp='$vendorlibexp'
17626 vendorprefix='$vendorprefix'
17627 vendorprefixexp='$vendorprefixexp'
17628 version='$version'
17629 version_patchlevel_string='$version_patchlevel_string'
17630 versiononly='$versiononly'
17631 vi='$vi'
17632 voidflags='$voidflags'
17633 xlibpth='$xlibpth'
17634 xs_apiversion='$xs_apiversion'
17635 yacc='$yacc'
17636 yaccflags='$yaccflags'
17637 zcat='$zcat'
17638 zip='$zip'
17639 EOT
17640
17641 : Add in command line options if available
17642 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17643
17644 : add special variables
17645 $test -f $src/patchlevel.h && \
17646 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17647 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17648 echo "PERL_CONFIG_SH=true" >>config.sh
17649
17650 : propagate old symbols
17651 if $test -f UU/config.sh; then
17652         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17653         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17654         $sort | $uniq -u >UU/oldsyms
17655         set X `cat UU/oldsyms`
17656         shift
17657         case $# in
17658         0) ;;
17659         *)
17660                 cat <<EOM
17661 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17662 EOM
17663                 echo "# Variables propagated from previous config.sh file." >>config.sh
17664                 for sym in `cat UU/oldsyms`; do
17665                         echo "    Propagating $hint variable "'$'"$sym..."
17666                         eval 'tmp="$'"${sym}"'"'
17667                         echo "$tmp" | \
17668                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17669                 done
17670                 ;;
17671         esac
17672 fi
17673
17674 : Finish up by extracting the .SH files
17675 case "$alldone" in
17676 exit)
17677         $rm -rf UU
17678         echo "Extraction done."
17679         exit 0
17680         ;;
17681 cont)
17682         ;;
17683 '')
17684         dflt=''
17685         nostick=true
17686         $cat <<EOM
17687
17688 If you'd like to make any changes to the config.sh file before I begin
17689 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17690
17691 EOM
17692         rp="Press return or use a shell escape to edit config.sh:"
17693         . UU/myread
17694         nostick=''
17695         case "$ans" in
17696         '') ;;
17697         *) : in case they cannot read
17698                 sh 1>&4 -c "$ans";;
17699         esac
17700         ;;
17701 esac
17702
17703 : if this fails, just run all the .SH files by hand
17704 . ./config.sh
17705
17706 echo " "
17707 exec 1>&4
17708 pwd=`pwd`
17709 . ./UU/extract
17710 cd $pwd
17711
17712 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17713         dflt=y
17714         case "$silent" in
17715         true) ;;
17716         *)
17717                 $cat <<EOM
17718
17719 Now you need to generate make dependencies by running "$make depend".
17720 You might prefer to run it in background: "$make depend > makedepend.out &"
17721 It can take a while, so you might not want to run it right now.
17722
17723 EOM
17724                 ;;
17725         esac
17726         rp="Run $make depend now?"
17727         . UU/myread
17728         case "$ans" in
17729         y*)
17730                 $make depend && echo "Now you must run '$make'."
17731                 ;;
17732         *)
17733                 echo "You must run '$make depend' then '$make'."
17734                 ;;
17735         esac
17736 elif test -f [Mm]akefile; then
17737         echo " "
17738         echo "Now you must run a $make."
17739 else
17740         echo "Configure done."
17741 fi
17742
17743 if $test -f Policy.sh; then
17744     $cat <<EOM
17745
17746 If you compile $package on a different machine or from a different object
17747 directory, copy the Policy.sh file from this object directory to the
17748 new one before you run Configure -- this will help you with most of
17749 the policy defaults.
17750
17751 EOM
17752 fi
17753 if $test -f config.msg; then
17754     echo "Hmm.  I also noted the following information while running:"
17755     echo " "
17756     $cat config.msg >&4
17757     $rm -f config.msg
17758 fi
17759 $rm -f kit*isdone ark*isdone
17760 $rm -rf UU
17761
17762 : End of Configure
17763