Tests are good
[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 Thu Nov 22 08:04:01 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_dlerror=''
349 d_dlopen=''
350 d_dlsymun=''
351 d_dosuid=''
352 d_suidsafe=''
353 d_drand48proto=''
354 d_dup2=''
355 d_eaccess=''
356 d_endgrent=''
357 d_endhent=''
358 d_endnent=''
359 d_endpent=''
360 d_endpwent=''
361 d_endsent=''
362 d_fchdir=''
363 d_fchmod=''
364 d_fchown=''
365 d_fcntl=''
366 d_fcntl_can_lock=''
367 d_fd_macros=''
368 d_fd_set=''
369 d_fds_bits=''
370 d_fgetpos=''
371 d_finite=''
372 d_finitel=''
373 d_flexfnam=''
374 d_flock=''
375 d_flockproto=''
376 d_fork=''
377 d_fp_class=''
378 d_fpclass=''
379 d_fpclassify=''
380 d_fpclassl=''
381 d_fpos64_t=''
382 d_frexpl=''
383 d_fs_data_s=''
384 d_fseeko=''
385 d_fsetpos=''
386 d_fstatfs=''
387 d_fsync=''
388 d_ftello=''
389 d_ftime=''
390 d_gettimeod=''
391 d_Gconvert=''
392 d_getcwd=''
393 d_getespwnam=''
394 d_getfsstat=''
395 d_getgrent=''
396 d_getgrps=''
397 d_gethbyaddr=''
398 d_gethbyname=''
399 d_gethent=''
400 aphostname=''
401 d_gethname=''
402 d_phostname=''
403 d_uname=''
404 d_gethostprotos=''
405 d_getitimer=''
406 d_getlogin=''
407 d_getmnt=''
408 d_getmntent=''
409 d_getnbyaddr=''
410 d_getnbyname=''
411 d_getnent=''
412 d_getnetprotos=''
413 d_getpagsz=''
414 d_getpent=''
415 d_getpgid=''
416 d_getpgrp2=''
417 d_bsdgetpgrp=''
418 d_getpgrp=''
419 d_getppid=''
420 d_getprior=''
421 d_getpbyname=''
422 d_getpbynumber=''
423 d_getprotoprotos=''
424 d_getprpwnam=''
425 d_getpwent=''
426 d_getsent=''
427 d_getservprotos=''
428 d_getspnam=''
429 d_getsbyname=''
430 d_getsbyport=''
431 d_gnulibc=''
432 d_hasmntopt=''
433 d_htonl=''
434 d_inetaton=''
435 d_int64_t=''
436 d_isascii=''
437 d_isfinite=''
438 d_isinf=''
439 d_isnan=''
440 d_isnanl=''
441 d_killpg=''
442 d_lchown=''
443 d_ldbl_dig=''
444 d_link=''
445 d_locconv=''
446 d_lockf=''
447 d_longdbl=''
448 longdblsize=''
449 d_longlong=''
450 longlongsize=''
451 d_lseekproto=''
452 d_lstat=''
453 d_madvise=''
454 d_mblen=''
455 d_mbstowcs=''
456 d_mbtowc=''
457 d_memchr=''
458 d_memcmp=''
459 d_memcpy=''
460 d_memmove=''
461 d_memset=''
462 d_mkdir=''
463 d_mkdtemp=''
464 d_mkfifo=''
465 d_mkstemp=''
466 d_mkstemps=''
467 d_mktime=''
468 d_mmap=''
469 mmaptype=''
470 d_modfl=''
471 d_modfl_pow32_bug=''
472 d_mprotect=''
473 d_msg=''
474 d_msgctl=''
475 d_msgget=''
476 d_msghdr_s=''
477 d_msgrcv=''
478 d_msgsnd=''
479 d_msync=''
480 d_munmap=''
481 d_nice=''
482 d_nl_langinfo=''
483 d_off64_t=''
484 d_open3=''
485 d_fpathconf=''
486 d_pathconf=''
487 d_pause=''
488 d_pipe=''
489 d_poll=''
490 d_portable=''
491 d_procselfexe=''
492 d_old_pthread_create_joinable=''
493 old_pthread_create_joinable=''
494 d_pthread_atfork=''
495 d_pthread_yield=''
496 d_sched_yield=''
497 sched_yield=''
498 d_qgcvt=''
499 d_readdir=''
500 d_rewinddir=''
501 d_seekdir=''
502 d_telldir=''
503 d_readlink=''
504 d_readv=''
505 d_recvmsg=''
506 d_rename=''
507 d_rmdir=''
508 d_safebcpy=''
509 d_safemcpy=''
510 d_sanemcmp=''
511 d_sbrkproto=''
512 d_select=''
513 d_sem=''
514 d_semctl=''
515 d_semget=''
516 d_semop=''
517 d_sendmsg=''
518 d_setegid=''
519 d_seteuid=''
520 d_setgrent=''
521 d_setgrps=''
522 d_sethent=''
523 d_setitimer=''
524 d_setlinebuf=''
525 d_setlocale=''
526 d_setnent=''
527 d_setpent=''
528 d_setpgid=''
529 d_setpgrp2=''
530 d_bsdsetpgrp=''
531 d_setpgrp=''
532 d_setprior=''
533 d_setproctitle=''
534 d_setpwent=''
535 d_setregid=''
536 d_setresgid=''
537 d_setresuid=''
538 d_setreuid=''
539 d_setrgid=''
540 d_setruid=''
541 d_setsent=''
542 d_setsid=''
543 d_setvbuf=''
544 d_sfio=''
545 usesfio=''
546 d_shm=''
547 d_shmat=''
548 d_shmatprototype=''
549 shmattype=''
550 d_shmctl=''
551 d_shmdt=''
552 d_shmget=''
553 d_sigaction=''
554 d_sigprocmask=''
555 d_sigsetjmp=''
556 d_sockatmark=''
557 d_sockatmarkproto=''
558 d_msg_ctrunc=''
559 d_msg_dontroute=''
560 d_msg_oob=''
561 d_msg_peek=''
562 d_msg_proxy=''
563 d_oldsock=''
564 d_scm_rights=''
565 d_socket=''
566 d_sockpair=''
567 sockethdr=''
568 socketlib=''
569 d_socklen_t=''
570 d_socks5_init=''
571 d_sqrtl=''
572 d_sresgproto=''
573 d_sresuproto=''
574 d_statblks=''
575 d_statfs_f_flags=''
576 d_statfs_s=''
577 d_fstatvfs=''
578 d_statvfs=''
579 d_stdio_cnt_lval=''
580 d_stdio_ptr_lval=''
581 d_stdio_ptr_lval_nochange_cnt=''
582 d_stdio_ptr_lval_sets_cnt=''
583 d_stdiobase=''
584 d_stdstdio=''
585 stdio_base=''
586 stdio_bufsiz=''
587 stdio_cnt=''
588 stdio_filbuf=''
589 stdio_ptr=''
590 d_index=''
591 d_strchr=''
592 d_strcoll=''
593 d_strctcpy=''
594 d_strerrm=''
595 d_strerror=''
596 d_sysernlst=''
597 d_syserrlst=''
598 d_strftime=''
599 d_strtod=''
600 d_strtol=''
601 d_strtold=''
602 d_strtoll=''
603 d_strtoq=''
604 d_strtoul=''
605 d_strtoull=''
606 d_strtouq=''
607 d_strxfrm=''
608 d_symlink=''
609 d_syscall=''
610 d_syscallproto=''
611 d_sysconf=''
612 d_system=''
613 d_tcgetpgrp=''
614 d_tcsetpgrp=''
615 d_telldirproto=''
616 d_time=''
617 timetype=''
618 clocktype=''
619 d_times=''
620 d_truncate=''
621 d_tzname=''
622 d_u32align=''
623 d_ualarm=''
624 d_umask=''
625 d_semctl_semid_ds=''
626 d_semctl_semun=''
627 d_union_semun=''
628 d_unordered=''
629 d_usleep=''
630 d_usleepproto=''
631 d_ustat=''
632 d_vfork=''
633 usevfork=''
634 d_voidsig=''
635 signal_t=''
636 d_volatile=''
637 d_charvspr=''
638 d_vprintf=''
639 d_wait4=''
640 d_waitpid=''
641 d_wcstombs=''
642 d_wctomb=''
643 d_writev=''
644 dlext=''
645 cccdlflags=''
646 ccdlflags=''
647 dlsrc=''
648 ld=''
649 lddlflags=''
650 usedl=''
651 doublesize=''
652 ebcdic=''
653 fflushNULL=''
654 fflushall=''
655 fpossize=''
656 fpostype=''
657 gccosandvers=''
658 gccversion=''
659 gidformat=''
660 gidsign=''
661 gidsize=''
662 gidtype=''
663 groupstype=''
664 h_fcntl=''
665 h_sysfile=''
666 i_arpainet=''
667 db_hashtype=''
668 db_prefixtype=''
669 db_version_major=''
670 db_version_minor=''
671 db_version_patch=''
672 i_db=''
673 i_dbm=''
674 i_rpcsvcdbm=''
675 d_dirnamlen=''
676 direntrytype=''
677 i_dirent=''
678 i_dld=''
679 i_dlfcn=''
680 i_fcntl=''
681 i_float=''
682 i_fp=''
683 i_fp_class=''
684 i_gdbm=''
685 d_grpasswd=''
686 i_grp=''
687 i_ieeefp=''
688 i_inttypes=''
689 i_langinfo=''
690 i_libutil=''
691 i_limits=''
692 i_locale=''
693 i_machcthr=''
694 i_malloc=''
695 i_math=''
696 i_memory=''
697 i_mntent=''
698 i_ndbm=''
699 i_netdb=''
700 i_neterrno=''
701 i_netinettcp=''
702 i_niin=''
703 i_sysin=''
704 i_poll=''
705 i_prot=''
706 i_pthread=''
707 d_pwage=''
708 d_pwchange=''
709 d_pwclass=''
710 d_pwcomment=''
711 d_pwexpire=''
712 d_pwgecos=''
713 d_pwpasswd=''
714 d_pwquota=''
715 i_pwd=''
716 i_sfio=''
717 i_shadow=''
718 i_socks=''
719 i_stddef=''
720 i_stdlib=''
721 i_string=''
722 strings=''
723 i_sunmath=''
724 i_sysaccess=''
725 i_sysdir=''
726 i_sysfile=''
727 d_voidtty=''
728 i_bsdioctl=''
729 i_sysfilio=''
730 i_sysioctl=''
731 i_syssockio=''
732 i_syslog=''
733 i_sysmman=''
734 i_sysmode=''
735 i_sysmount=''
736 i_sysndir=''
737 i_sysparam=''
738 i_sysresrc=''
739 i_syssecrt=''
740 i_sysselct=''
741 i_sysstat=''
742 i_sysstatfs=''
743 i_sysstatvfs=''
744 i_systimes=''
745 i_systypes=''
746 i_sysuio=''
747 i_sysun=''
748 i_sysutsname=''
749 i_sysvfs=''
750 i_syswait=''
751 i_sgtty=''
752 i_termio=''
753 i_termios=''
754 i_systime=''
755 i_systimek=''
756 i_time=''
757 timeincl=''
758 i_unistd=''
759 i_ustat=''
760 i_utime=''
761 i_values=''
762 i_stdarg=''
763 i_varargs=''
764 i_varhdr=''
765 i_vfork=''
766 inc_version_list=''
767 inc_version_list_init=''
768 installprefix=''
769 installprefixexp=''
770 installstyle=''
771 installusrbinperl=''
772 intsize=''
773 longsize=''
774 shortsize=''
775 issymlink=''
776 libc=''
777 ldlibpthname=''
778 libperl=''
779 shrpenv=''
780 useshrplib=''
781 glibpth=''
782 libpth=''
783 loclibpth=''
784 plibpth=''
785 xlibpth=''
786 ignore_versioned_solibs=''
787 libs=''
788 libsdirs=''
789 libsfiles=''
790 libsfound=''
791 libspath=''
792 lns=''
793 d_PRIEUldbl=''
794 d_PRIFUldbl=''
795 d_PRIGUldbl=''
796 d_PRIeldbl=''
797 d_PRIfldbl=''
798 d_PRIgldbl=''
799 d_SCNfldbl=''
800 sPRIEUldbl=''
801 sPRIFUldbl=''
802 sPRIGUldbl=''
803 sPRIeldbl=''
804 sPRIfldbl=''
805 sPRIgldbl=''
806 sSCNfldbl=''
807 lseeksize=''
808 lseektype=''
809 make_set_make=''
810 d_mymalloc=''
811 freetype=''
812 mallocobj=''
813 mallocsrc=''
814 malloctype=''
815 usemymalloc=''
816 installman1dir=''
817 man1dir=''
818 man1direxp=''
819 man1ext=''
820 installman3dir=''
821 man3dir=''
822 man3direxp=''
823 man3ext=''
824 modetype=''
825 multiarch=''
826 mydomain=''
827 myhostname=''
828 phostname=''
829 c=''
830 n=''
831 d_eofnblk=''
832 eagain=''
833 o_nonblock=''
834 rd_nodata=''
835 need_va_copy=''
836 netdb_hlen_type=''
837 netdb_host_type=''
838 netdb_name_type=''
839 netdb_net_type=''
840 groupcat=''
841 hostcat=''
842 passcat=''
843 orderlib=''
844 ranlib=''
845 d_perl_otherlibdirs=''
846 otherlibdirs=''
847 package=''
848 spackage=''
849 pager=''
850 api_revision=''
851 api_subversion=''
852 api_version=''
853 api_versionstring=''
854 patchlevel=''
855 perl_patchlevel=''
856 revision=''
857 subversion=''
858 version=''
859 version_patchlevel_string=''
860 perl5=''
861 perladmin=''
862 perlpath=''
863 d_nv_preserves_uv=''
864 d_nv_preserves_uv_bits=''
865 i16size=''
866 i16type=''
867 i32size=''
868 i32type=''
869 i64size=''
870 i64type=''
871 i8size=''
872 i8type=''
873 ivsize=''
874 ivtype=''
875 nvsize=''
876 nvtype=''
877 u16size=''
878 u16type=''
879 u32size=''
880 u32type=''
881 u64size=''
882 u64type=''
883 u8size=''
884 u8type=''
885 uvsize=''
886 uvtype=''
887 ivdformat=''
888 nvEUformat=''
889 nvFUformat=''
890 nvGUformat=''
891 nveformat=''
892 nvfformat=''
893 nvgformat=''
894 uvXUformat=''
895 uvoformat=''
896 uvuformat=''
897 uvxformat=''
898 pidtype=''
899 prefix=''
900 prefixexp=''
901 installprivlib=''
902 privlib=''
903 privlibexp=''
904 prototype=''
905 ptrsize=''
906 d_PRIXU64=''
907 d_PRId64=''
908 d_PRIi64=''
909 d_PRIo64=''
910 d_PRIu64=''
911 d_PRIx64=''
912 sPRIXU64=''
913 sPRId64=''
914 sPRIi64=''
915 sPRIo64=''
916 sPRIu64=''
917 sPRIx64=''
918 d_quad=''
919 quadkind=''
920 quadtype=''
921 uquadtype=''
922 drand01=''
923 randbits=''
924 randfunc=''
925 randseedtype=''
926 seedfunc=''
927 installscript=''
928 scriptdir=''
929 scriptdirexp=''
930 selectminbits=''
931 selecttype=''
932 sh=''
933 sig_count=''
934 sig_name=''
935 sig_name_init=''
936 sig_num=''
937 sig_num_init=''
938 sig_size=''
939 installsitearch=''
940 sitearch=''
941 sitearchexp=''
942 installsitebin=''
943 sitebin=''
944 sitebinexp=''
945 installsitelib=''
946 sitelib=''
947 sitelib_stem=''
948 sitelibexp=''
949 siteprefix=''
950 siteprefixexp=''
951 sizesize=''
952 sizetype=''
953 so=''
954 socksizetype=''
955 sharpbang=''
956 shsharp=''
957 spitshell=''
958 src=''
959 ssizetype=''
960 startperl=''
961 startsh=''
962 stdchar=''
963 d_stdio_stream_array=''
964 stdio_stream_array=''
965 sysman=''
966 trnl=''
967 uidformat=''
968 uidsign=''
969 uidsize=''
970 uidtype=''
971 archname64=''
972 use64bitall=''
973 use64bitint=''
974 ccflags_uselargefiles=''
975 ldflags_uselargefiles=''
976 libswanted_uselargefiles=''
977 uselargefiles=''
978 uselongdouble=''
979 usemorebits=''
980 usemultiplicity=''
981 nm_opt=''
982 nm_so_opt=''
983 runnm=''
984 usenm=''
985 useperlio=''
986 usesocks=''
987 d_oldpthreads=''
988 use5005threads=''
989 useithreads=''
990 usereentrant=''
991 usethreads=''
992 incpath=''
993 mips_type=''
994 usrinc=''
995 d_vendorarch=''
996 installvendorarch=''
997 vendorarch=''
998 vendorarchexp=''
999 d_vendorbin=''
1000 installvendorbin=''
1001 vendorbin=''
1002 vendorbinexp=''
1003 d_vendorlib=''
1004 installvendorlib=''
1005 vendorlib=''
1006 vendorlib_stem=''
1007 vendorlibexp=''
1008 usevendorprefix=''
1009 vendorprefix=''
1010 vendorprefixexp=''
1011 versiononly=''
1012 defvoidused=''
1013 voidflags=''
1014 pm_apiversion=''
1015 xs_apiversion=''
1016 yacc=''
1017 yaccflags=''
1018 CONFIG=''
1019
1020 define='define'
1021 undef='undef'
1022 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1023 rmlist=''
1024
1025 : We must find out about Eunice early
1026 eunicefix=':'
1027 if test -f /etc/unixtovms; then
1028         eunicefix=/etc/unixtovms
1029 fi
1030 if test -f /etc/unixtovms.exe; then
1031         eunicefix=/etc/unixtovms.exe
1032 fi
1033
1034 i_whoami=''
1035 ccname=''
1036 ccversion=''
1037 perllibs=''
1038 : set useposix=false in your hint file to disable the POSIX extension.
1039 useposix=true
1040 : set useopcode=false in your hint file to disable the Opcode extension.
1041 useopcode=true
1042 : Trailing extension.  Override this in a hint file, if needed.
1043 _exe=''
1044 : Extra object files, if any, needed on this platform.
1045 archobjs=''
1046 archname=''
1047 : Possible local include directories to search.
1048 : Set locincpth to "" in a hint file to defeat local include searches.
1049 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1050 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1051 :
1052 : no include file wanted by default
1053 inclwanted=''
1054
1055 groupstype=''
1056 libnames=''
1057 : change the next line if compiling for Xenix/286 on Xenix/386
1058 xlibpth='/usr/lib/386 /lib/386'
1059 : Possible local library directories to search.
1060 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1061 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1062
1063 : general looking path for locating libraries
1064 glibpth="/lib /usr/lib $xlibpth"
1065 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1066 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1067 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1068
1069 : Private path used by Configure to find libraries.  Its value
1070 : is prepended to libpth. This variable takes care of special
1071 : machines, like the mips.  Usually, it should be empty.
1072 plibpth=''
1073
1074 : default library list
1075 libswanted=''
1076 : some systems want to use only the non-versioned libso:s
1077 ignore_versioned_solibs=''
1078 archname64=''
1079 ccflags_uselargefiles=''
1080 ldflags_uselargefiles=''
1081 libswanted_uselargefiles=''
1082 : set usemultiplicity on the Configure command line to enable multiplicity.
1083 : set usesocks on the Configure command line to enable socks.
1084 : set usethreads on the Configure command line to enable threads.
1085 usereentrant='undef'
1086 : full support for void wanted by default
1087 defvoidused=15
1088
1089 : List of libraries we want.
1090 : If anyone needs -lnet, put it in a hint file.
1091 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1092 libswanted="$libswanted dld ld sun m c cposix posix"
1093 libswanted="$libswanted ndir dir crypt sec"
1094 libswanted="$libswanted ucb bsd BSD PW x util"
1095 : We probably want to search /usr/shlib before most other libraries.
1096 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1097 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1098 glibpth="/usr/shlib $glibpth"
1099 : Do not use vfork unless overridden by a hint file.
1100 usevfork=false
1101
1102 : Find the basic shell for Bourne shell scripts
1103 case "$sh" in
1104 '')
1105         case "$SYSTYPE" in
1106         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1107         *) xxx='/bin/sh';;
1108         esac
1109         if test -f "$xxx"; then
1110                 sh="$xxx"
1111         else
1112                 : Build up a list and do a single loop so we can 'break' out.
1113                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1114                 for xxx in sh bash ksh pdksh ash; do
1115                         for p in $pth; do
1116                                 try="$try ${p}/${xxx}"
1117                         done
1118                 done
1119                 for xxx in $try; do
1120                         if test -f "$xxx"; then
1121                                 sh="$xxx";
1122                                 break
1123                         elif test -f "$xxx.exe"; then
1124                                 sh="$xxx";
1125                                 break
1126                         fi
1127                 done
1128         fi
1129         ;;
1130 esac
1131
1132 case "$sh" in
1133 '')     cat >&2 <<EOM
1134 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1135
1136 Usually it's in /bin/sh.  How did you even get this far?
1137 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1138 we'll try to straighten this all out.
1139 EOM
1140         exit 1
1141         ;;
1142 esac
1143
1144 : see if sh knows # comments
1145 if `$sh -c '#' >/dev/null 2>&1`; then
1146         shsharp=true
1147         spitshell=cat
1148         xcat=/bin/cat
1149         test -f $xcat || xcat=/usr/bin/cat
1150         echo "#!$xcat" >sharp
1151         $eunicefix sharp
1152         chmod +x sharp
1153         ./sharp > today
1154         if test -s today; then
1155                 sharpbang='#!'
1156         else
1157                 echo "#! $xcat" > sharp
1158                 $eunicefix sharp
1159                 chmod +x sharp
1160                 ./sharp > today
1161                 if test -s today; then
1162                         sharpbang='#! '
1163                 else
1164                         sharpbang=': use '
1165                 fi
1166         fi
1167 else
1168         echo " "
1169         echo "Your $sh doesn't grok # comments--I will strip them later on."
1170         shsharp=false
1171         cd ..
1172         echo "exec grep -v '^[  ]*#'" >spitshell
1173         chmod +x spitshell
1174         $eunicefix spitshell
1175         spitshell=`pwd`/spitshell
1176         cd UU
1177         echo "I presume that if # doesn't work, #! won't work either!"
1178         sharpbang=': use '
1179 fi
1180 rm -f sharp today
1181
1182 : figure out how to guarantee sh startup
1183 case "$startsh" in
1184 '') startsh=${sharpbang}${sh} ;;
1185 *)
1186 esac
1187 cat >sharp <<EOSS
1188 $startsh
1189 set abc
1190 test "$?abc" != 1
1191 EOSS
1192
1193 chmod +x sharp
1194 $eunicefix sharp
1195 if ./sharp; then
1196         : echo "Yup, it does."
1197 else
1198         echo "Hmm... '$startsh' does not guarantee sh startup..."
1199         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1200 fi
1201 rm -f sharp
1202
1203
1204 : Save command line options in file UU/cmdline.opt for later use in
1205 : generating config.sh.
1206 cat > cmdline.opt <<EOSH
1207 # Configure command line arguments.
1208 config_arg0='$0'
1209 config_args='$*'
1210 config_argc=$#
1211 EOSH
1212 argn=1
1213 args_exp=''
1214 args_sep=''
1215 for arg in "$@"; do
1216         cat >>cmdline.opt <<EOSH
1217 config_arg$argn='$arg'
1218 EOSH
1219         # Extreme backslashitis: replace each ' by '"'"'
1220         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1221 $arg
1222 EOC
1223         arg_exp=`cat cmdl.opt`
1224         args_exp="$args_exp$args_sep'$arg_exp'"
1225         argn=`expr $argn + 1`
1226         args_sep=' '
1227 done
1228 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1229 # used by ./hints/os2.sh
1230 rm -f cmdl.opt
1231
1232 : produce awk script to parse command line options
1233 cat >options.awk <<'EOF'
1234 BEGIN {
1235         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1236
1237         len = length(optstr);
1238         for (i = 1; i <= len; i++) {
1239                 c = substr(optstr, i, 1);
1240                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1241                 if (a == ":") {
1242                         arg[c] = 1;
1243                         i++;
1244                 }
1245                 opt[c] = 1;
1246         }
1247 }
1248 {
1249         expect = 0;
1250         str = $0;
1251         if (substr(str, 1, 1) != "-") {
1252                 printf("'%s'\n", str);
1253                 next;
1254         }
1255         len = length($0);
1256         for (i = 2; i <= len; i++) {
1257                 c = substr(str, i, 1);
1258                 if (!opt[c]) {
1259                         printf("-%s\n", substr(str, i));
1260                         next;
1261                 }
1262                 printf("-%s\n", c);
1263                 if (arg[c]) {
1264                         if (i < len)
1265                                 printf("'%s'\n", substr(str, i + 1));
1266                         else
1267                                 expect = 1;
1268                         next;
1269                 }
1270         }
1271 }
1272 END {
1273         if (expect)
1274                 print "?";
1275 }
1276 EOF
1277
1278 : process the command line options
1279 set X `for arg in "$@"; do echo "X$arg"; done |
1280         sed -e s/X// | awk -f options.awk`
1281 eval "set $*"
1282 shift
1283 rm -f options.awk
1284
1285 : set up default values
1286 fastread=''
1287 reuseval=false
1288 config_sh=''
1289 alldone=''
1290 error=''
1291 silent=''
1292 extractsh=''
1293 override=''
1294 knowitall=''
1295 rm -f optdef.sh posthint.sh
1296 cat >optdef.sh <<EOS
1297 $startsh
1298 EOS
1299
1300
1301 : option parsing
1302 while test $# -gt 0; do
1303         case "$1" in
1304         -d) shift; fastread=yes;;
1305         -e) shift; alldone=cont;;
1306         -f)
1307                 shift
1308                 cd ..
1309                 if test -r "$1"; then
1310                         config_sh="$1"
1311                 else
1312                         echo "$me: cannot read config file $1." >&2
1313                         error=true
1314                 fi
1315                 cd UU
1316                 shift;;
1317         -h) shift; error=true;;
1318         -r) shift; reuseval=true;;
1319         -s) shift; silent=true; realsilent=true;;
1320         -E) shift; alldone=exit;;
1321         -K) shift; knowitall=true;;
1322         -O) shift; override=true;;
1323         -S) shift; silent=true; extractsh=true;;
1324         -D)
1325                 shift
1326                 case "$1" in
1327                 *=)
1328                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1329                         echo "$me: ignoring -D $1" >&2
1330                         ;;
1331                 *=*) echo "$1" | \
1332                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1333                 *) echo "$1='define'" >> optdef.sh;;
1334                 esac
1335                 shift
1336                 ;;
1337         -U)
1338                 shift
1339                 case "$1" in
1340                 *=) echo "$1" >> optdef.sh;;
1341                 *=*)
1342                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1343                         echo "$me: ignoring -U $1" >&2
1344                         ;;
1345                 *) echo "$1='undef'" >> optdef.sh;;
1346                 esac
1347                 shift
1348                 ;;
1349         -A)
1350             shift
1351             xxx=''
1352             yyy="$1"
1353             zzz=''
1354             uuu=undef
1355             case "$yyy" in
1356             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1357                  case "$zzz" in
1358                  *:*) zzz='' ;;
1359                  *)   xxx=append
1360                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1361                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1362                  esac
1363                  ;;
1364             esac
1365             case "$xxx" in
1366             '')  case "$yyy" in
1367                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1368                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1369                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1370                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1371                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1372                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1373                  esac
1374                  ;;       
1375             esac
1376             case "$xxx" in
1377             append)
1378                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1379             clear)
1380                 echo "$yyy=''"                  >> posthint.sh ;;
1381             define)
1382                 case "$zzz" in
1383                 '') zzz=define ;;
1384                 esac
1385                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1386             eval)
1387                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1388             prepend)
1389                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1390             undef)
1391                 case "$zzz" in
1392                 '') zzz="$uuu" ;;
1393                 esac
1394                 echo "$yyy=$zzz"                >> posthint.sh ;;
1395             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1396             esac
1397             shift
1398             ;;
1399         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1400             exit 0;;
1401         --) break;;
1402         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1403         *) break;;
1404         esac
1405 done
1406
1407 case "$error" in
1408 true)
1409         cat >&2 <<EOM
1410 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1411                  [-U symbol] [-U symbol=] [-A command:symbol...]
1412   -d : use defaults for all answers.
1413   -e : go on without questioning past the production of config.sh.
1414   -f : specify an alternate default configuration file.
1415   -h : print this help message and exit (with an error status).
1416   -r : reuse C symbols value if possible (skips costly nm extraction).
1417   -s : silent mode, only echoes questions and essential information.
1418   -D : define symbol to have some value:
1419          -D symbol         symbol gets the value 'define'
1420          -D symbol=value   symbol gets the value 'value'
1421   -E : stop at the end of questions, after having produced config.sh.
1422   -K : do not use unless you know what you are doing.
1423   -O : let -D and -U override definitions from loaded configuration file.
1424   -S : perform variable substitutions on all .SH files (can mix with -f)
1425   -U : undefine symbol:
1426          -U symbol    symbol gets the value 'undef'
1427          -U symbol=   symbol gets completely empty
1428   -A : manipulate symbol after the platform specific hints have been applied:
1429          -A symbol=value                append " "value to symbol
1430          -A append:symbol=value         append value to symbol
1431          -A define:symbol=value         define symbol to have value
1432          -A clear:symbol                define symbol to be ''
1433          -A define:symbol               define symbol to be 'define'
1434          -A eval:symbol=value           define symbol to be eval of value
1435          -A prepend:symbol=value        prepend value to symbol
1436          -A undef:symbol                define symbol to be 'undef'
1437          -A undef:symbol=               define symbol to be ''
1438   -V : print version number and exit (with a zero status).
1439 EOM
1440         exit 1
1441         ;;
1442 esac
1443
1444 : Sanity checks
1445 case "$fastread$alldone" in
1446 yescont|yesexit) ;;
1447 *)
1448         case "$extractsh" in
1449         true) ;;
1450         *)
1451                 if test ! -t 0; then
1452                         echo "Say 'sh Configure', not 'sh <Configure'"
1453                         exit 1
1454                 fi
1455                 ;;
1456         esac
1457         ;;
1458 esac
1459
1460 exec 4>&1
1461 case "$silent" in
1462 true) exec 1>/dev/null;;
1463 esac
1464
1465 : run the defines and the undefines, if any, but leave the file out there...
1466 touch optdef.sh
1467 . ./optdef.sh
1468 : create the posthint manipulation script and leave the file out there...
1469 touch posthint.sh
1470
1471 : set package name
1472 package=perl5
1473 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1474 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1475 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1476 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1477 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1478 esac
1479
1480 : Some greps do not return status, grrr.
1481 echo "grimblepritz" >grimble
1482 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1483         contains=contains
1484 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1485         contains=grep
1486 else
1487         contains=contains
1488 fi
1489 rm -f grimble
1490 : the following should work in any shell
1491 case "$contains" in
1492 contains*)
1493         echo " "
1494         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1495         cat >contains <<'EOSS'
1496 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1497 EOSS
1498 chmod +x contains
1499 esac
1500
1501 : Find the path to the source tree
1502 case "$src" in
1503 '') case "$0" in
1504     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1505          case "$src" in
1506          /*)    ;;
1507          .)     ;;
1508          *)     src=`cd ../$src && pwd` ;;
1509          esac
1510          ;;
1511     *)   src='.';;
1512     esac;;
1513 esac
1514 case "$src" in
1515 '')     src=/
1516         rsrc=/
1517         ;;
1518 /*) rsrc="$src";;
1519 *) rsrc="../$src";;
1520 esac
1521 if test -f $rsrc/Configure && \
1522         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1523 then
1524    : found it, so we are ok.
1525 else
1526         rsrc=''
1527         for src in . .. ../.. ../../.. ../../../..; do
1528                 if test -f ../$src/Configure && \
1529                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1530                 then
1531                         rsrc=../$src
1532                         break
1533                 fi
1534         done
1535 fi
1536 case "$rsrc" in
1537 '')
1538         cat <<EOM >&4
1539
1540 Sorry, I can't seem to locate the source dir for $package.  Please start
1541 Configure with an explicit path -- i.e. /some/path/Configure.
1542
1543 EOM
1544         exit 1
1545         ;;
1546 ../.)   rsrc='..';;
1547 *)
1548         echo " "
1549         echo "Sources for $package found in \"$src\"." >&4
1550         ;;
1551 esac
1552
1553 : script used to extract .SH files with variable substitutions
1554 cat >extract <<'EOS'
1555 PERL_CONFIG_SH=true
1556 echo "Doing variable substitutions on .SH files..."
1557 if test -f MANIFEST; then
1558         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1559 else
1560         echo "(Looking for .SH files under the source directory.)"
1561         set x `(cd $src; find . -name "*.SH" -print)`
1562 fi
1563 shift
1564 case $# in
1565 0) set x `(cd $src; echo *.SH)`; shift;;
1566 esac
1567 if test ! -f $src/$1; then
1568         shift
1569 fi
1570 mkdir_p='
1571 name=$1;
1572 create="";
1573 while test $name; do
1574         if test ! -d "$name"; then
1575                 create="$name $create";
1576                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1577                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1578         else
1579                 name="";
1580         fi;
1581 done;
1582 for file in $create; do
1583         mkdir $file;
1584 done
1585 '
1586 for file in $*; do
1587         case "$src" in
1588         ".")
1589                 case "$file" in
1590                 */*)
1591                         dir=`expr X$file : 'X\(.*\)/'`
1592                         file=`expr X$file : 'X.*/\(.*\)'`
1593                         (cd $dir && . ./$file)
1594                         ;;
1595                 *)
1596                         . ./$file
1597                         ;;
1598                 esac
1599                 ;;
1600         *)
1601                 case "$file" in
1602                 */*)
1603                         dir=`expr X$file : 'X\(.*\)/'`
1604                         file=`expr X$file : 'X.*/\(.*\)'`
1605                         (set x $dir; shift; eval $mkdir_p)
1606                         sh <$src/$dir/$file
1607                         ;;
1608                 *)
1609                         sh <$src/$file
1610                         ;;
1611                 esac
1612                 ;;
1613         esac
1614 done
1615 if test -f $src/config_h.SH; then
1616         if test ! -f config.h; then
1617         : oops, they left it out of MANIFEST, probably, so do it anyway.
1618         . $src/config_h.SH
1619         fi
1620 fi
1621 EOS
1622
1623 : extract files and exit if asked to do so
1624 case "$extractsh" in
1625 true)
1626         case "$realsilent" in
1627         true) ;;
1628         *) exec 1>&4;;
1629         esac
1630         case "$config_sh" in
1631         '') config_sh='config.sh';;
1632         esac
1633         echo " "
1634         echo "Fetching answers from $config_sh..."
1635         cd ..
1636         . $config_sh
1637         test "$override" && . ./optdef.sh
1638         echo " "
1639         . UU/extract
1640         rm -rf UU
1641         echo "Extraction done."
1642         exit 0
1643         ;;
1644 esac
1645
1646 : Eunice requires " " instead of "", can you believe it
1647 echo " "
1648 : Here we go...
1649 echo "Beginning of configuration questions for $package."
1650
1651 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1652
1653 : first determine how to suppress newline on echo command
1654 echo " "
1655 echo "Checking echo to see how to suppress newlines..."
1656 (echo "hi there\c" ; echo " ") >.echotmp
1657 if $contains c .echotmp >/dev/null 2>&1 ; then
1658         echo "...using -n."
1659         n='-n'
1660         c=''
1661 else
1662         cat <<'EOM'
1663 ...using \c
1664 EOM
1665         n=''
1666         c='\c'
1667 fi
1668 echo $n "The star should be here-->$c"
1669 echo '*'
1670 rm -f .echotmp
1671
1672 : Now test for existence of everything in MANIFEST
1673 echo " "
1674 if test -f $rsrc/MANIFEST; then
1675         echo "First let's make sure your kit is complete.  Checking..." >&4
1676         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1677         rm -f missing
1678         tmppwd=`pwd`
1679         for filelist in x??; do
1680                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1681         done
1682         if test -s missing; then
1683                 cat missing >&4
1684                 cat >&4 <<'EOM'
1685
1686 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1687
1688 You have the option of continuing the configuration process, despite the
1689 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1690 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1691 and contact the author (perlbug@perl.org).
1692
1693 EOM
1694                 echo $n "Continue? [n] $c" >&4
1695                 read ans
1696                 case "$ans" in
1697                 y*)
1698                         echo "Continuing..." >&4
1699                         rm -f missing
1700                         ;;
1701                 *)
1702                         echo "ABORTING..." >&4
1703                         kill $$
1704                         ;;
1705                 esac
1706         else
1707                 echo "Looks good..."
1708         fi
1709 else
1710         echo "There is no MANIFEST file.  I hope your kit is complete !"
1711 fi
1712 rm -f missing x??
1713
1714 echo " "
1715 : Find the appropriate value for a newline for tr
1716 if test -n "$DJGPP"; then
1717        trnl='\012'
1718 fi
1719 if test X"$trnl" = X; then
1720         case "`echo foo|tr '\n' x 2>/dev/null`" in
1721         foox) trnl='\n' ;;
1722         esac
1723 fi
1724 if test X"$trnl" = X; then
1725         case "`echo foo|tr '\012' x 2>/dev/null`" in
1726         foox) trnl='\012' ;;
1727         esac
1728 fi
1729 if test X"$trnl" = X; then
1730         cat <<EOM >&2
1731
1732 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1733
1734 EOM
1735         exit 1
1736 fi
1737
1738 : compute the number of columns on the terminal for proper question formatting
1739 case "$COLUMNS" in
1740 '') COLUMNS='80';;
1741 esac
1742
1743 : set up the echo used in my read
1744 myecho="case \"\$xxxm\" in
1745 '') echo $n \"\$rp $c\" >&4;;
1746 *) case \"\$rp\" in
1747         '') echo $n \"[\$xxxm] $c\";;
1748         *)
1749                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1750                         echo \"\$rp\" >&4
1751                         echo $n \"[\$xxxm] $c\" >&4
1752                 else
1753                         echo $n \"\$rp [\$xxxm] $c\" >&4
1754                 fi
1755                 ;;
1756         esac;;
1757 esac"
1758
1759 : now set up to do reads with possible shell escape and default assignment
1760 cat <<EOSC >myread
1761 $startsh
1762 xxxm=\$dflt
1763 $myecho
1764 ans='!'
1765 case "\$fastread" in
1766 yes) case "\$dflt" in
1767         '') ;;
1768         *) ans='';
1769                 case "\$silent-\$rp" in
1770                 true-) ;;
1771                 *) echo " " >&4;;
1772                 esac;;
1773         esac;;
1774 *) case "\$silent" in
1775         true) case "\$rp" in
1776                 '') ans='';;
1777                 esac;;
1778         esac;;
1779 esac
1780 while expr "X\$ans" : "X!" >/dev/null; do
1781         read answ
1782         set x \$xxxm
1783         shift
1784         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1785         case  "\$answ" in
1786         "!")
1787                 sh 1>&4
1788                 echo " "
1789                 $myecho
1790                 ;;
1791         !*)
1792                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1793                 shift
1794                 sh 1>&4 -c "\$*"
1795                 echo " "
1796                 $myecho
1797                 ;;
1798         "\$ans")
1799                 case "\$ans" in
1800                 \\&*)
1801                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1802                         shift
1803                         case "\$1" in
1804                         -d)
1805                                 fastread=yes
1806                                 echo "(OK, I'll run with -d after this question.)" >&4
1807                                 ;;
1808                         -*)
1809                                 echo "*** Sorry, \$1 not supported yet." >&4
1810                                 ;;
1811                         esac
1812                         $myecho
1813                         ans=!
1814                         ;;
1815                 esac;;
1816         *)
1817                 case "\$aok" in
1818                 y)
1819                         echo "*** Substitution done -- please confirm."
1820                         xxxm="\$ans"
1821                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1822                         xxxm="\$ans"
1823                         ans=!
1824                         ;;
1825                 *)
1826                         echo "*** Error -- try again."
1827                         ans=!
1828                         ;;
1829                 esac
1830                 $myecho
1831                 ;;
1832         esac
1833         case "\$ans\$xxxm\$nostick" in
1834         '')
1835                 ans=!
1836                 $myecho
1837                 ;;
1838         esac
1839 done
1840 case "\$ans" in
1841 '') ans="\$xxxm";;
1842 esac
1843 EOSC
1844
1845 : create .config dir to save info across Configure sessions
1846 test -d ../.config || mkdir ../.config
1847 cat >../.config/README <<EOF
1848 This directory created by Configure to save information that should
1849 persist across sessions for $package.
1850
1851 You may safely delete it if you wish.
1852 EOF
1853
1854 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1855 case "$usedevel" in
1856 $define|true|[yY]*) ;;
1857 *) case "$xversion" in
1858    *[13579])
1859         cat >&4 <<EOH
1860 *** WHOA THERE!!! ***
1861
1862     This is an UNSTABLE DEVELOPMENT release.
1863     The version of this $package distribution is $xversion, that is, odd,
1864     (as opposed to even) and that signifies a development release.
1865     If you want a maintenance release, you want an even-numbered version.
1866
1867     Do ***NOT*** install this into production use.
1868     Data corruption and crashes are possible.
1869
1870     It is most seriously suggested that you do not continue any further
1871     unless you want to help in developing and debugging Perl.
1872
1873     If you *still* want to build perl, you can answer 'y' now,
1874     or pass -Dusedevel to Configure.
1875
1876 EOH
1877         rp='Do you really want to continue?'
1878         dflt='n'
1879         . ./myread
1880         case "$ans" in
1881         [yY]) echo >&4 "Okay, continuing."
1882               usedevel="$define" ;;
1883         *) echo >&4 "Okay, bye."
1884            exit 1
1885            ;;
1886         esac
1887         ;;
1888     esac
1889     ;;
1890 esac
1891 case "$usedevel" in
1892 $define|true|[yY]*)
1893         case "$versiononly" in
1894         '') versiononly="$define" ;;
1895         esac
1896         case "$installusrbinperl" in
1897         '') installusrbinperl="$undef" ;;
1898         esac
1899         ;;
1900 esac
1901
1902 : general instructions
1903 needman=true
1904 firsttime=true
1905 user=`(logname) 2>/dev/null`
1906 case "$user" in
1907 '') user=`whoami 2>&1`;;
1908 esac
1909 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1910         firsttime=false
1911         echo " "
1912         rp='Would you like to see the instructions?'
1913         dflt=n
1914         . ./myread
1915         case "$ans" in
1916         [yY]*) ;;
1917         *) needman=false;;
1918         esac
1919 fi
1920 if $needman; then
1921         cat <<EOH
1922
1923 This installation shell script will examine your system and ask you questions
1924 to determine how the perl5 package should be installed. If you get
1925 stuck on a question, you may use a ! shell escape to start a subshell or
1926 execute a command.  Many of the questions will have default answers in square
1927 brackets; typing carriage return will give you the default.
1928
1929 On some of the questions which ask for file or directory names you are allowed
1930 to use the ~name construct to specify the login directory belonging to "name",
1931 even if you don't have a shell which knows about that.  Questions where this is
1932 allowed will be marked "(~name ok)".
1933
1934 EOH
1935         rp=''
1936         dflt='Type carriage return to continue'
1937         . ./myread
1938         cat <<'EOH'
1939
1940 The prompter used in this script allows you to use shell variables and
1941 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1942 in the default answer, as if the default line was a set of arguments given to a
1943 script shell.  This means you may also use $* to repeat the whole default line,
1944 so you do not have to re-type everything to add something to the default.
1945
1946 Everytime there is a substitution, you will have to confirm.  If there is an
1947 error (e.g. an unmatched backtick), the default answer will remain unchanged
1948 and you will be prompted again.
1949
1950 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1951 the questions and use the computed defaults (or the previous answers if there
1952 was already a config.sh file). Type 'Configure -h' for a list of options.
1953 You may also start interactively and then answer '& -d' at any prompt to turn
1954 on the non-interactive behaviour for the remainder of the execution.
1955
1956 EOH
1957         . ./myread
1958         cat <<EOH
1959
1960 Much effort has been expended to ensure that this shell script will run on any
1961 Unix system.  If despite that it blows up on yours, your best bet is to edit
1962 Configure and run it again.  If you can't run Configure for some reason,
1963 you'll have to generate a config.sh file by hand.  Whatever problems you
1964 have, let me (perlbug@perl.org) know how I blew it.
1965
1966 This installation script affects things in two ways:
1967
1968 1) it may do direct variable substitutions on some of the files included
1969    in this kit.
1970 2) it builds a config.h file for inclusion in C programs.  You may edit
1971    any of these files as the need arises after running this script.
1972
1973 If you make a mistake on a question, there is no easy way to back up to it
1974 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1975 files.  Configure will offer to let you do this before it runs the SH files.
1976
1977 EOH
1978         dflt='Type carriage return to continue'
1979         . ./myread
1980         case "$firsttime" in
1981         true) echo $user >>../.config/instruct;;
1982         esac
1983 fi
1984
1985 : find out where common programs are
1986 echo " "
1987 echo "Locating common programs..." >&4
1988 cat <<EOSC >loc
1989 $startsh
1990 case \$# in
1991 0) exit 1;;
1992 esac
1993 thing=\$1
1994 shift
1995 dflt=\$1
1996 shift
1997 for dir in \$*; do
1998         case "\$thing" in
1999         .)
2000         if test -d \$dir/\$thing; then
2001                 echo \$dir
2002                 exit 0
2003         fi
2004         ;;
2005         *)
2006         for thisthing in \$dir/\$thing; do
2007                 : just loop through to pick last item
2008         done
2009         if test -f \$thisthing; then
2010                 echo \$thisthing
2011                 exit 0
2012         elif test -f \$dir/\$thing.exe; then
2013                 if test -n "$DJGPP"; then
2014                         echo \$dir/\$thing.exe
2015                 else
2016                         : on Eunice apparently
2017                         echo \$dir/\$thing
2018                 fi
2019                 exit 0
2020         fi
2021         ;;
2022         esac
2023 done
2024 echo \$dflt
2025 exit 1
2026 EOSC
2027 chmod +x loc
2028 $eunicefix loc
2029 loclist="
2030 awk
2031 cat
2032 chmod
2033 comm
2034 cp
2035 echo
2036 expr
2037 grep
2038 ls
2039 make
2040 mkdir
2041 rm
2042 sed
2043 sort
2044 touch
2045 tr
2046 uniq
2047 "
2048 trylist="
2049 Mcc
2050 ar
2051 bison
2052 byacc
2053 cpp
2054 csh
2055 date
2056 egrep
2057 gzip
2058 less
2059 ln
2060 more
2061 nm
2062 nroff
2063 pg
2064 test
2065 uname
2066 zip
2067 "
2068 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2069 pth="$pth /lib /usr/lib"
2070 for file in $loclist; do
2071         eval xxx=\$$file
2072         case "$xxx" in
2073         /*|?:[\\/]*)
2074                 if test -f "$xxx"; then
2075                         : ok
2076                 else
2077                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2078                         xxx=`./loc $file $file $pth`
2079                 fi
2080                 ;;
2081         '') xxx=`./loc $file $file $pth`;;
2082         *) xxx=`./loc $xxx $xxx $pth`;;
2083         esac
2084         eval $file=$xxx
2085         eval _$file=$xxx
2086         case "$xxx" in
2087         /*)
2088                 echo $file is in $xxx.
2089                 ;;
2090         ?:[\\/]*)
2091                 echo $file is in $xxx.
2092                 ;;
2093         *)
2094                 echo "I don't know where '$file' is, and my life depends on it." >&4
2095                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2096                 exit 1
2097                 ;;
2098         esac
2099 done
2100 echo " "
2101 echo "Don't worry if any of the following aren't found..."
2102 say=offhand
2103 for file in $trylist; do
2104         eval xxx=\$$file
2105         case "$xxx" in
2106         /*|?:[\\/]*)
2107                 if test -f "$xxx"; then
2108                         : ok
2109                 else
2110                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2111                         xxx=`./loc $file $file $pth`
2112                 fi
2113                 ;;
2114         '') xxx=`./loc $file $file $pth`;;
2115         *) xxx=`./loc $xxx $xxx $pth`;;
2116         esac
2117         eval $file=$xxx
2118         eval _$file=$xxx
2119         case "$xxx" in
2120         /*)
2121                 echo $file is in $xxx.
2122                 ;;
2123         ?:[\\/]*)
2124                 echo $file is in $xxx.
2125                 ;;
2126         *)
2127                 echo "I don't see $file out there, $say."
2128                 say=either
2129                 ;;
2130         esac
2131 done
2132 case "$egrep" in
2133 egrep)
2134         echo "Substituting grep for egrep."
2135         egrep=$grep
2136         ;;
2137 esac
2138 case "$ln" in
2139 ln)
2140         echo "Substituting cp for ln."
2141         ln=$cp
2142         ;;
2143 esac
2144 case "$test" in
2145 test)
2146         echo "Hopefully test is built into your sh."
2147         ;;
2148 *)
2149         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2150                 echo "Using the test built into your sh."
2151                 test=test
2152                 _test=test
2153         fi
2154         ;;
2155 esac
2156 case "$echo" in
2157 echo)
2158         echo "Hopefully echo is built into your sh."
2159         ;;
2160 '') ;;
2161 *)
2162         echo " "
2163 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2164         $echo $n "hi there$c" >foo1
2165         echo $n "hi there$c" >foo2
2166         if cmp foo1 foo2 >/dev/null 2>&1; then
2167                 echo "They are compatible.  In fact, they may be identical."
2168         else
2169                 case "$n" in
2170                 '-n') n='' c='\c';;
2171                 *) n='-n' c='';;
2172                 esac
2173                 cat <<FOO
2174 They are not compatible!  You are probably running ksh on a non-USG system.
2175 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2176 have echo built in and we may have to run some Bourne shell scripts.  That
2177 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2178
2179 FOO
2180                 $echo $n "The star should be here-->$c"
2181                 $echo "*"
2182         fi
2183         $rm -f foo1 foo2
2184         ;;
2185 esac
2186
2187 cat <<EOS >checkcc
2188 $startsh
2189 EOS
2190 cat <<'EOSC' >>checkcc
2191 case "$cc" in
2192 '') ;;
2193 *)  $rm -f try try.*
2194     $cat >try.c <<EOM
2195 int main(int argc, char *argv[]) {
2196   return 0;
2197 }
2198 EOM
2199     if $cc -o try $ccflags $ldflags try.c; then
2200        :
2201     else
2202         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2203         despair=yes
2204         trygcc=yes
2205         case "$cc" in
2206         *gcc*) trygcc=no ;;
2207         esac
2208         case "`$cc -v -c try.c 2>&1`" in
2209         *gcc*) trygcc=no ;;
2210         esac
2211         if $test X"$trygcc" = Xyes; then
2212             if gcc -o try -c try.c; then
2213                 echo " "
2214                 echo "You seem to have a working gcc, though." >&4
2215                 rp="Would you like to use it?"
2216                 dflt=y
2217                 if $test -f myread; then
2218                     . ./myread
2219                 else
2220                     if $test -f UU/myread; then
2221                         . ./UU/myread
2222                     else
2223                         echo "Cannot find myread, sorry.  Aborting." >&2
2224                         exit 1
2225                     fi
2226                 fi  
2227                 case "$ans" in
2228                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2229                 esac
2230             fi
2231         fi
2232         if $test X"$despair" = Xyes; then
2233             $cat >&4 <<EOM
2234 You need to find a working C compiler.
2235 Either (purchase and) install the C compiler supplied by your OS vendor,
2236 or for a free C compiler try http://gcc.gnu.org/
2237 I cannot continue any further, aborting.
2238 EOM
2239             exit 1
2240         fi
2241     fi
2242     $rm -f try try.*
2243     ;;
2244 esac
2245 EOSC
2246
2247 : determine whether symbolic links are supported
2248 echo " "
2249 $touch blurfl
2250 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2251         echo "Symbolic links are supported." >&4
2252         lns="$ln -s"
2253 else
2254         echo "Symbolic links are NOT supported." >&4
2255         lns="$ln"
2256 fi
2257 $rm -f blurfl sym
2258
2259 : determine whether symbolic links are supported
2260 echo " "
2261 case "$lns" in
2262 *"ln -s")
2263         echo "Checking how to test for symbolic links..." >&4
2264         $lns blurfl sym
2265         if $test "X$issymlink" = X; then
2266                 case "$newsh" in
2267                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2268                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2269                 esac
2270                 if test $? = 0; then
2271                         issymlink="test -h"
2272                 else
2273                         echo "Your builtin 'test -h' may be broken." >&4
2274                         case "$test" in
2275                         /*)     ;;
2276                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2277                                 for p in $pth
2278                                 do
2279                                         if test -f "$p/$test"; then
2280                                                 test="$p/$test"
2281                                                 break
2282                                         fi
2283                                 done
2284                                 ;;
2285                         esac
2286                         case "$test" in
2287                         /*)
2288                                 echo "Trying external '$test -h'." >&4
2289                                 issymlink="$test -h"
2290                                 if $test ! -h sym >/dev/null 2>&1; then
2291                                         echo "External '$test -h' is broken, too." >& 4
2292                                         issymlink=''
2293                                 fi
2294                                 ;;
2295                         *)      issymlink='' ;;
2296                         esac
2297                 fi              
2298         fi
2299         if $test "X$issymlink" = X; then
2300                 if $test -L sym 2>/dev/null; then
2301                         issymlink="$test -L"
2302                         echo "The builtin '$test -L' worked." >&4
2303                 fi
2304         fi
2305         if $test "X$issymlink" != X; then
2306                 echo "You can test for symbolic links with '$issymlink'." >&4
2307         else
2308                 echo "I do not know how you can test for symbolic links." >&4
2309         fi
2310         $rm -f blurfl sym
2311         ;;
2312 *)      echo "No symbolic links, so not testing for their testing..." >&4
2313         ;;
2314 esac
2315 echo " "
2316
2317
2318 case "$mksymlinks" in
2319 $define|true|[yY]*)
2320         case "$src" in
2321         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2322                 exit 1
2323                 ;;
2324         *)      case "$lns:$issymlink" in
2325                 *"ln -s:"*"test -"?)
2326                         echo "Creating the symbolic links..." >&4
2327                         echo "(First creating the subdirectories...)" >&4
2328                         cd ..
2329                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2330                                 read directory
2331                                 test -z "$directory" && break
2332                                 mkdir -p $directory
2333                         done
2334                         # Sanity check 1.
2335                         if test ! -d t/base; then
2336                                 echo "Failed to create the subdirectories.  Aborting." >&4
2337                                 exit 1
2338                         fi
2339                         echo "(Then creating the symlinks...)" >&4
2340                         awk '{print $1}' $src/MANIFEST | while true; do
2341                                 read filename
2342                                 test -z "$filename" && break
2343                                 if test -f $filename; then
2344                                         if $issymlink $filename; then
2345                                                 rm -f $filename
2346                                         fi
2347                                 fi
2348                                 if test -f $filename; then
2349                                         echo "$filename already exists, not symlinking."
2350                                 else
2351                                         ln -s $src/$filename $filename
2352                                 fi
2353                         done
2354                         # Sanity check 2.
2355                         if test ! -f t/base/lex.t; then
2356                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2357                                 exit 1
2358                         fi
2359                         cd UU
2360                         ;;
2361                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2362                         ;;
2363                 esac
2364                 ;;
2365         esac
2366         ;;
2367 esac
2368
2369
2370 case "$usecrosscompile" in
2371 $define|true|[yY]*)
2372         $echo "Cross-compiling..."
2373         croak=''
2374         case "$cc" in
2375         *-*-gcc) # A cross-compiling gcc, probably.
2376             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2377             ar=$targetarch-ar
2378             # leave out ld, choosing it is more complex
2379             nm=$targetarch-nm
2380             ranlib=$targetarch-ranlib
2381             $echo 'extern int foo;' > try.c
2382             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2383             shift
2384             if $test $# -gt 0; then
2385                 incpth="$incpth $*"
2386                 incpth="`$echo $incpth|$sed 's/^ //'`"
2387                 echo "Guessing incpth '$incpth'." >&4
2388                 for i in $*; do
2389                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2390                     if $test -d $j; then
2391                         libpth="$libpth $j"
2392                     fi
2393                 done   
2394                 libpth="`$echo $libpth|$sed 's/^ //'`"
2395                 echo "Guessing libpth '$libpth'." >&4
2396             fi
2397             $rm -f try.c
2398             ;;
2399         esac
2400         case "$targetarch" in
2401         '') echo "Targetarch not defined." >&4; croak=y ;;
2402         *)  echo "Using targetarch $targetarch." >&4 ;;
2403         esac
2404         case "$incpth" in
2405         '') echo "Incpth not defined." >&4; croak=y ;;
2406         *)  echo "Using incpth '$incpth'." >&4 ;;
2407         esac
2408         case "$libpth" in
2409         '') echo "Libpth not defined." >&4; croak=y ;;
2410         *)  echo "Using libpth '$libpth'." >&4 ;;
2411         esac
2412         case "$usrinc" in
2413         '') for i in $incpth; do
2414                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2415                     usrinc=$i
2416                     echo "Guessing usrinc $usrinc." >&4
2417                     break
2418                 fi
2419             done
2420             case "$usrinc" in
2421             '') echo "Usrinc not defined." >&4; croak=y ;;
2422             esac
2423             ;;
2424         *)  echo "Using usrinc $usrinc." >&4 ;;
2425         esac
2426         case "$targethost" in
2427         '') echo "Targethost not defined." >&4; croak=y ;;
2428         *)  echo "Using targethost $targethost." >&4
2429         esac
2430         locincpth=' '
2431         loclibpth=' '
2432         case "$croak" in
2433         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2434         esac
2435         case "$src" in
2436         /*) run=$src/Cross/run
2437             targetmkdir=$src/Cross/mkdir
2438             to=$src/Cross/to
2439             from=$src/Cross/from
2440             ;;
2441         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2442             run=$pwd/Cross/run
2443             targetmkdir=$pwd/Cross/mkdir
2444             to=$pwd/Cross/to
2445             from=$pwd/Cross/from
2446             ;;
2447         esac
2448         case "$targetrun" in
2449         '') targetrun=ssh ;;
2450         esac
2451         case "$targetto" in
2452         '') targetto=scp ;;
2453         esac
2454         case "$targetfrom" in
2455         '') targetfrom=scp ;;
2456         esac
2457         run=$run-$targetrun
2458         to=$to-$targetto
2459         from=$from-$targetfrom
2460         case "$targetdir" in
2461         '')  targetdir=/tmp
2462              echo "Guessing targetdir $targetdir." >&4
2463              ;;
2464         esac
2465         case "$targetuser" in
2466         '')  targetuser=root
2467              echo "Guessing targetuser $targetuser." >&4
2468              ;;
2469         esac
2470         case "$targetfrom" in
2471         scp)    q=-q ;;
2472         *)      q='' ;;
2473         esac
2474         case "$targetrun" in
2475         ssh|rsh)
2476             cat >$run <<EOF
2477 #!/bin/sh
2478 case "\$1" in
2479 -cwd)
2480   shift
2481   cwd=\$1
2482   shift
2483   ;;
2484 esac
2485 case "\$cwd" in
2486 '') cwd=$targetdir ;;
2487 esac
2488 exe=\$1
2489 shift
2490 if $test ! -f \$exe.xok; then
2491   $to \$exe
2492   $touch \$exe.xok
2493 fi
2494 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2495 EOF
2496             ;;
2497         *)  echo "Unknown targetrun '$targetrun'" >&4
2498             exit 1
2499             ;;
2500         esac
2501         case "$targetmkdir" in
2502         */Cross/mkdir)
2503             cat >$targetmkdir <<EOF
2504 #!/bin/sh
2505 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2506 EOF
2507             $chmod a+rx $targetmkdir
2508             ;;
2509         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2510             exit 1
2511             ;;
2512         esac
2513         case "$targetto" in
2514         scp|rcp)
2515             cat >$to <<EOF
2516 #!/bin/sh
2517 for f in \$@
2518 do
2519   case "\$f" in
2520   /*)
2521     $targetmkdir \`dirname \$f\`
2522     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2523     ;;
2524   *)
2525     $targetmkdir $targetdir/\`dirname \$f\`
2526     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2527     ;;
2528   esac
2529 done
2530 exit 0
2531 EOF
2532             ;;
2533         cp) cat >$to <<EOF
2534 #!/bin/sh
2535 for f in \$@
2536 do
2537   case "\$f" in
2538   /*)
2539     $mkdir -p $targetdir/\`dirname \$f\`
2540     $cp \$f $targetdir/\$f || exit 1
2541     ;;
2542   *)
2543     $targetmkdir $targetdir/\`dirname \$f\`
2544     $cp \$f $targetdir/\$f || exit 1
2545     ;;
2546   esac
2547 done
2548 exit 0
2549 EOF
2550             ;;
2551         *)  echo "Unknown targetto '$targetto'" >&4
2552             exit 1
2553             ;;
2554         esac
2555         case "$targetfrom" in
2556         scp|rcp)
2557           cat >$from <<EOF
2558 #!/bin/sh
2559 for f in \$@
2560 do
2561   $rm -f \$f
2562   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2563 done
2564 exit 0
2565 EOF
2566             ;;
2567         cp) cat >$from <<EOF
2568 #!/bin/sh
2569 for f in \$@
2570 do
2571   $rm -f \$f
2572   cp $targetdir/\$f . || exit 1
2573 done
2574 exit 0
2575 EOF
2576             ;;
2577         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2578             exit 1
2579             ;;
2580         esac
2581         if $test ! -f $run; then
2582             echo "Target 'run' script '$run' not found." >&4
2583         else
2584             $chmod a+rx $run
2585         fi
2586         if $test ! -f $to; then
2587             echo "Target 'to' script '$to' not found." >&4
2588         else
2589             $chmod a+rx $to
2590         fi
2591         if $test ! -f $from; then
2592             echo "Target 'from' script '$from' not found." >&4
2593         else
2594             $chmod a+rx $from
2595         fi
2596         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2597             exit 1
2598         fi
2599         cat >&4 <<EOF
2600 Using '$run' for remote execution,
2601 and '$from' and '$to'
2602 for remote file transfer.
2603 EOF
2604         ;;
2605 *)      run=''
2606         to=:
2607         from=:
2608         usecrosscompile='undef'
2609         targetarch=''
2610         ;;
2611 esac
2612
2613 : see whether [:lower:] and [:upper:] are supported character classes
2614 echo " "
2615 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2616 ABYZ)
2617         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2618         up='[:upper:]'
2619         low='[:lower:]'
2620         ;;
2621 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2622         # (0xc9 and 0xd1), therefore that is a nice testing point.
2623         if test "X$up" = X -o "X$low" = X; then
2624             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2625             ij) up='[A-Z]'
2626                 low='[a-z]'
2627                 ;;
2628             esac
2629         fi
2630         if test "X$up" = X -o "X$low" = X; then
2631             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2632             ij) up='A-Z'
2633                 low='a-z'
2634                 ;;
2635             esac
2636         fi
2637         if test "X$up" = X -o "X$low" = X; then
2638             case "`echo IJ | od -x 2>/dev/null`" in
2639             *C9D1*|*c9d1*)
2640                 echo "Hey, this might be EBCDIC." >&4
2641                 if test "X$up" = X -o "X$low" = X; then
2642                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2643                     ij) up='[A-IJ-RS-Z]'
2644                         low='[a-ij-rs-z]'
2645                         ;;
2646                     esac
2647                 fi
2648                 if test "X$up" = X -o "X$low" = X; then
2649                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2650                     ij) up='A-IJ-RS-Z'
2651                         low='a-ij-rs-z'
2652                         ;;
2653                     esac
2654                 fi
2655                 ;;
2656             esac
2657         fi
2658 esac
2659 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2660 ij)
2661     echo "Using $up and $low to convert case." >&4
2662     ;;
2663 *)
2664     echo "I don't know how to translate letters from upper to lower case." >&4
2665     echo "Your tr is not acting any way I know of." >&4
2666     exit 1
2667     ;;
2668 esac
2669 : set up the translation script tr, must be called with ./tr of course
2670 cat >tr <<EOSC
2671 $startsh
2672 case "\$1\$2" in
2673 '[A-Z][a-z]') exec $tr '$up' '$low';;
2674 '[a-z][A-Z]') exec $tr '$low' '$up';;
2675 esac
2676 exec $tr "\$@"
2677 EOSC
2678 chmod +x tr
2679 $eunicefix tr
2680
2681 : Try to determine whether config.sh was made on this system
2682 case "$config_sh" in
2683 '')
2684 myuname=`$uname -a 2>/dev/null`
2685 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2686 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2687 # because the A-Z/a-z are not consecutive.
2688 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2689         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2690 newmyuname="$myuname"
2691 dflt=n
2692 case "$knowitall" in
2693 '')
2694         if test -f ../config.sh; then
2695                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2696                         eval "`grep myuname= ../config.sh`"
2697                 fi
2698                 if test "X$myuname" = "X$newmyuname"; then
2699                         dflt=y
2700                 fi
2701         fi
2702         ;;
2703 *) dflt=y;;
2704 esac
2705
2706 : Get old answers from old config file if Configure was run on the
2707 : same system, otherwise use the hints.
2708 hint=default
2709 cd ..
2710 if test -f config.sh; then
2711         echo " "
2712         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2713         . UU/myread
2714         case "$ans" in
2715         n*|N*) echo "OK, I'll ignore it."
2716                 mv config.sh config.sh.old
2717                 myuname="$newmyuname"
2718                 ;;
2719         *)  echo "Fetching default answers from your old config.sh file..." >&4
2720                 tmp_n="$n"
2721                 tmp_c="$c"
2722                 tmp_sh="$sh"
2723                 . ./config.sh
2724                 cp config.sh UU
2725                 n="$tmp_n"
2726                 c="$tmp_c"
2727                 : Older versions did not always set $sh.  Catch re-use of such
2728                 : an old config.sh.
2729                 case "$sh" in
2730                 '') sh="$tmp_sh" ;;
2731                 esac
2732                 hint=previous
2733                 ;;
2734         esac
2735 fi
2736 . ./UU/checkcc
2737 if test ! -f config.sh; then
2738         $cat <<EOM
2739
2740 First time through, eh?  I have some defaults handy for some systems
2741 that need some extra help getting the Configure answers right:
2742
2743 EOM
2744         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2745         dflt=''
2746         : Half the following guesses are probably wrong... If you have better
2747         : tests or hints, please send them to perlbug@perl.org
2748         : The metaconfig authors would also appreciate a copy...
2749         $test -f /irix && osname=irix
2750         $test -f /xenix && osname=sco_xenix
2751         $test -f /dynix && osname=dynix
2752         $test -f /dnix && osname=dnix
2753         $test -f /lynx.os && osname=lynxos
2754         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2755         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2756         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2757         $test -f /bin/mips && /bin/mips && osname=mips
2758         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2759                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2760         $test -d /usr/apollo/bin && osname=apollo
2761         $test -f /etc/saf/_sactab && osname=svr4
2762         $test -d /usr/include/minix && osname=minix
2763         if $test -d /MachTen -o -d /MachTen_Folder; then
2764                 osname=machten
2765                 if $test -x /sbin/version; then
2766                         osvers=`/sbin/version | $awk '{print $2}' |
2767                         $sed -e 's/[A-Za-z]$//'`
2768                 elif $test -x /usr/etc/version; then
2769                         osvers=`/usr/etc/version | $awk '{print $2}' |
2770                         $sed -e 's/[A-Za-z]$//'`
2771                 else
2772                         osvers="$2.$3"
2773                 fi
2774         fi
2775
2776         $test -f /sys/posix.dll &&
2777                 $test -f /usr/bin/what &&
2778                 set X `/usr/bin/what /sys/posix.dll` &&
2779                 $test "$3" = UWIN &&
2780                 osname=uwin &&
2781                 osvers="$5"
2782
2783         if $test -f $uname; then
2784                 set X $myuname
2785                 shift
2786
2787                 case "$5" in
2788                 fps*) osname=fps ;;
2789                 mips*)
2790                         case "$4" in
2791                         umips) osname=umips ;;
2792                         *) osname=mips ;;
2793                         esac;;
2794                 [23]100) osname=mips ;;
2795                 next*) osname=next ;;
2796                 i386*)
2797                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2798                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2799                                 osname='sco'
2800                                 osvers=$tmp
2801                         elif $test -f /etc/kconfig; then
2802                                 osname=isc
2803                                 if test "$lns" = "$ln -s"; then
2804                                         osvers=4
2805                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2806                                         osvers=3
2807                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2808                                         osvers=2
2809                                 fi
2810                         fi
2811                         tmp=''
2812                         ;;
2813                 pc*)
2814                         if test -n "$DJGPP"; then
2815                                 osname=dos
2816                                 osvers=djgpp
2817                         fi
2818                         ;;
2819                 esac
2820
2821                 case "$1" in
2822                 aix) osname=aix
2823                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2824                         case "$tmp" in
2825                         'not found') osvers="$4"."$3" ;;
2826                         '<3240'|'<>3240') osvers=3.2.0 ;;
2827                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2828                         '=3250'|'>3250') osvers=3.2.5 ;;
2829                         *) osvers=$tmp;;
2830                         esac
2831                         ;;
2832                 bsd386) osname=bsd386
2833                         osvers=`$uname -r`
2834                         ;;
2835                 cygwin*) osname=cygwin
2836                         osvers="$3"
2837                         ;;
2838                 *dc.osx) osname=dcosx
2839                         osvers="$3"
2840                         ;;
2841                 dnix) osname=dnix
2842                         osvers="$3"
2843                         ;;
2844                 domainos) osname=apollo
2845                         osvers="$3"
2846                         ;;
2847                 dgux) osname=dgux 
2848                         osvers="$3"
2849                         ;;
2850                 dynixptx*) osname=dynixptx
2851                         osvers=`echo "$4"|sed 's/^v//'`
2852                         ;;
2853                 freebsd) osname=freebsd 
2854                         osvers="$3" ;;
2855                 genix) osname=genix ;;
2856                 hp*) osname=hpux 
2857                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2858                         ;;
2859                 irix*) osname=irix
2860                         case "$3" in
2861                         4*) osvers=4 ;;
2862                         5*) osvers=5 ;;
2863                         *)      osvers="$3" ;;
2864                         esac
2865                         ;;
2866                 linux) osname=linux
2867                         case "$3" in
2868                         *)      osvers="$3" ;;
2869                         esac
2870                         ;;
2871                 MiNT) osname=mint
2872                         ;;
2873                 netbsd*) osname=netbsd
2874                         osvers="$3"
2875                         ;;
2876                 news-os) osvers="$3"
2877                         case "$3" in
2878                         4*) osname=newsos4 ;;
2879                         *) osname=newsos ;;
2880                         esac
2881                         ;;
2882                 next*) osname=next ;;
2883                 nonstop-ux) osname=nonstopux ;;
2884                 POSIX-BC | posix-bc ) osname=posix-bc
2885                         osvers="$3"
2886                         ;;
2887                 powerux | power_ux | powermax_os | powermaxos | \
2888                 powerunix | power_unix) osname=powerux
2889                         osvers="$3"
2890                         ;;
2891                 qnx) osname=qnx
2892                         osvers="$4"
2893                         ;;
2894                 solaris) osname=solaris
2895                         case "$3" in
2896                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2897                         *)      osvers="$3" ;;
2898                         esac
2899                         ;;
2900                 sunos) osname=sunos
2901                         case "$3" in
2902                         5*) osname=solaris
2903                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2904                         *)      osvers="$3" ;;
2905                         esac
2906                         ;;
2907                 titanos) osname=titanos
2908                         case "$3" in
2909                         1*) osvers=1 ;;
2910                         2*) osvers=2 ;;
2911                         3*) osvers=3 ;;
2912                         4*) osvers=4 ;;
2913                         *)      osvers="$3" ;;
2914                         esac
2915                         ;;
2916                 ultrix) osname=ultrix
2917                         osvers="$3"
2918                         ;;
2919                 osf1|mls+)      case "$5" in
2920                                 alpha)
2921                                         osname=dec_osf
2922                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2923                                         case "$osvers" in
2924                                         [1-9].[0-9]*) ;;
2925                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2926                                         esac
2927                                         ;;
2928                         hp*)    osname=hp_osf1  ;;
2929                         mips)   osname=mips_osf1 ;;
2930                         esac
2931                         ;;
2932                 unixware) osname=svr5
2933                         osvers="$4"
2934                         ;;
2935                 uts) osname=uts
2936                         osvers="$3"
2937                         ;;
2938                 $2) case "$osname" in
2939                         *isc*) ;;
2940                         *freebsd*) ;;
2941                         svr*)
2942                                 : svr4.x or possibly later
2943                                 case "svr$3" in 
2944                                 ${osname}*)
2945                                         osname=svr$3
2946                                         osvers=$4
2947                                         ;;
2948                                 esac
2949                                 case "$osname" in
2950                                 svr4.0)
2951                                         : Check for ESIX
2952                                         if test -f /stand/boot ; then
2953                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2954                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2955                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2956                                                         if test -n "$isesix"; then
2957                                                                 osname=esix4
2958                                                         fi
2959                                                 fi
2960                                         fi
2961                                         ;;
2962                                 esac
2963                                 ;;
2964                         *)      if test -f /etc/systemid; then
2965                                         osname=sco
2966                                         set `echo $3 | $sed 's/\./ /g'` $4
2967                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2968                                                 osvers=$1.$2.$3
2969                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2970                                                 osvers=$1.$2
2971                                         elif $test -f $src/hints/sco_$1.sh; then
2972                                                 osvers=$1
2973                                         fi
2974                                 else
2975                                         case "$osname" in
2976                                         '') : Still unknown.  Probably a generic Sys V.
2977                                                 osname="sysv"
2978                                                 osvers="$3"
2979                                                 ;;
2980                                         esac
2981                                 fi
2982                                 ;;
2983                         esac
2984                         ;;
2985                 *)      case "$osname" in
2986                         '') : Still unknown.  Probably a generic BSD.
2987                                 osname="$1"
2988                                 osvers="$3"
2989                                 ;;
2990                         esac
2991                         ;;
2992                 esac
2993         else
2994                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2995                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2996                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2997                                 osname=news_os
2998                         fi
2999                         $rm -f UU/kernel.what
3000                 elif test -d c:/.; then
3001                         set X $myuname
3002                         osname=os2
3003                         osvers="$5"
3004                 fi
3005         fi
3006         
3007         case "$targetarch" in
3008         '') ;;
3009         *)  hostarch=$osname
3010             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3011             osvers=''
3012             ;;
3013         esac
3014
3015         : Now look for a hint file osname_osvers, unless one has been
3016         : specified already.
3017         case "$hintfile" in
3018         ''|' ')
3019                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3020                 : Also try without trailing minor version numbers.
3021                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3022                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3023                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3024                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3025                 case "$file" in
3026                 '') dflt=none ;;
3027                 *)  case "$osvers" in
3028                         '') dflt=$file
3029                                 ;;
3030                         *)  if $test -f $src/hints/$file.sh ; then
3031                                         dflt=$file
3032                                 elif $test -f $src/hints/$xfile.sh ; then
3033                                         dflt=$xfile
3034                                 elif $test -f $src/hints/$xxfile.sh ; then
3035                                         dflt=$xxfile
3036                                 elif $test -f $src/hints/$xxxfile.sh ; then
3037                                         dflt=$xxxfile
3038                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3039                                         dflt=$xxxxfile
3040                                 elif $test -f "$src/hints/${osname}.sh" ; then
3041                                         dflt="${osname}"
3042                                 else
3043                                         dflt=none
3044                                 fi
3045                                 ;;
3046                         esac
3047                         ;;
3048                 esac
3049                 if $test -f Policy.sh ; then
3050                         case "$dflt" in
3051                         *Policy*) ;;
3052                         none) dflt="Policy" ;;
3053                         *) dflt="Policy $dflt" ;;
3054                         esac
3055                 fi
3056                 ;;
3057         *)
3058                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3059                 ;;
3060         esac
3061
3062         if $test -f Policy.sh ; then
3063                 $cat <<EOM
3064
3065 There's also a Policy hint file available, which should make the
3066 site-specific (policy) questions easier to answer.
3067 EOM
3068
3069         fi
3070
3071         $cat <<EOM
3072
3073 You may give one or more space-separated answers, or "none" if appropriate.
3074 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3075 is a good thing.  DO NOT give a wrong version or a wrong OS.
3076
3077 EOM
3078
3079         rp="Which of these apply, if any?"
3080         . UU/myread
3081         tans=$ans
3082         for file in $tans; do
3083                 if $test X$file = XPolicy -a -f Policy.sh; then
3084                         . Policy.sh
3085                         $cat Policy.sh >> UU/config.sh
3086                 elif $test -f $src/hints/$file.sh; then
3087                         . $src/hints/$file.sh
3088                         $cat $src/hints/$file.sh >> UU/config.sh
3089                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3090                         : nothing
3091                 else
3092                         : Give one chance to correct a possible typo.
3093                         echo "$file.sh does not exist"
3094                         dflt=$file
3095                         rp="hint to use instead?"
3096                         . UU/myread
3097                         for file in $ans; do
3098                                 if $test -f "$src/hints/$file.sh"; then
3099                                         . $src/hints/$file.sh
3100                                         $cat $src/hints/$file.sh >> UU/config.sh
3101                                 elif $test X$ans = X -o X$ans = Xnone ; then
3102                                         : nothing
3103                                 else
3104                                         echo "$file.sh does not exist -- ignored."
3105                                 fi
3106                         done
3107                 fi
3108         done
3109
3110         hint=recommended
3111         : Remember our hint file for later.
3112         if $test -f "$src/hints/$file.sh" ; then
3113                 hintfile="$file"
3114         else
3115                 hintfile=''
3116         fi
3117 fi
3118 cd UU
3119 ;;
3120 *)
3121         echo " "
3122         echo "Fetching default answers from $config_sh..." >&4
3123         tmp_n="$n"
3124         tmp_c="$c"
3125         cd ..
3126         cp $config_sh config.sh 2>/dev/null
3127         chmod +w config.sh
3128         . ./config.sh
3129         cd UU
3130         cp ../config.sh .
3131         n="$tmp_n"
3132         c="$tmp_c"
3133         hint=previous
3134         ;;
3135 esac
3136 test "$override" && . ./optdef.sh
3137
3138 : Restore computed paths
3139 for file in $loclist $trylist; do
3140         eval $file="\$_$file"
3141 done
3142
3143 cat << EOM
3144
3145 Configure uses the operating system name and version to set some defaults.
3146 The default value is probably right if the name rings a bell. Otherwise,
3147 since spelling matters for me, either accept the default or answer "none"
3148 to leave it blank.
3149
3150 EOM
3151 case "$osname" in
3152         ''|' ')
3153                 case "$hintfile" in
3154                 ''|' '|none) dflt=none ;;
3155                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3156                 esac
3157                 ;;
3158         *) dflt="$osname" ;;
3159 esac
3160 rp="Operating system name?"
3161 . ./myread
3162 case "$ans" in
3163 none)  osname='' ;;
3164 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3165 esac
3166 echo " "
3167 case "$osvers" in
3168         ''|' ')
3169                 case "$hintfile" in
3170                 ''|' '|none) dflt=none ;;
3171                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3172                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3173                         case "$dflt" in
3174                         ''|' ') dflt=none ;;
3175                         esac
3176                         ;;
3177                 esac
3178                 ;;
3179         *) dflt="$osvers" ;;
3180 esac
3181 rp="Operating system version?"
3182 . ./myread
3183 case "$ans" in
3184 none)  osvers='' ;;
3185 *) osvers="$ans" ;;
3186 esac
3187
3188
3189 . ./posthint.sh
3190
3191 : who configured the system
3192 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3193 cf_by=`(logname) 2>/dev/null`
3194 case "$cf_by" in
3195 "")
3196         cf_by=`(whoami) 2>/dev/null`
3197         case "$cf_by" in
3198         "") cf_by=unknown ;;
3199         esac ;;
3200 esac
3201
3202 : set up the script used to warn in case of inconsistency
3203 cat <<EOS >whoa
3204 $startsh
3205 EOS
3206 cat <<'EOSC' >>whoa
3207 dflt=y
3208 echo " "
3209 echo "*** WHOA THERE!!! ***" >&4
3210 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3211 rp="    Keep the $hint value?"
3212 . ./myread
3213 case "$ans" in
3214 y) td=$was; tu=$was;;
3215 esac
3216 EOSC
3217
3218 : function used to set $1 to $val
3219 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3220 case "$val$was" in
3221 $define$undef) . ./whoa; eval "$var=\$td";;
3222 $undef$define) . ./whoa; eval "$var=\$tu";;
3223 *) eval "$var=$val";;
3224 esac'
3225
3226 case "$usethreads" in
3227 $define|true|[yY]*)     dflt='y';;
3228 *) dflt='n';;
3229 esac
3230 cat <<EOM
3231
3232 Perl can be built to take advantage of threads on some systems.
3233 To do so, Configure can be run with -Dusethreads.
3234
3235 Note that threading is a highly experimental feature, and
3236 some known race conditions still remain.  If you choose to try
3237 it, be very sure to not actually deploy it for production
3238 purposes.  README.threads has more details, and is required
3239 reading if you enable threads.
3240
3241 If this doesn't make any sense to you, just accept the default '$dflt'.
3242 EOM
3243 rp='Build a threading Perl?'
3244 . ./myread
3245 case "$ans" in
3246 y|Y)    val="$define" ;;
3247 *)      val="$undef" ;;
3248 esac
3249 set usethreads
3250 eval $setvar
3251
3252 case "$usethreads" in
3253 $define)
3254         $cat <<EOM
3255
3256 As of 5.5.640, Perl has two different internal threading implementations,
3257 the 5.005 version (5005threads) and an interpreter-based version
3258 (ithreads) that has one interpreter per thread.  Both are very 
3259 experimental.  This arrangement exists to help developers work out
3260 which one is better.
3261
3262 If you're a casual user, you probably don't want interpreter-threads
3263 at this time.  There doesn't yet exist a way to create threads from
3264 within Perl in this model, i.e., "use Thread;" will NOT work.
3265 EOM
3266         : Default to ithreads unless overridden on command line or with
3267         : old config.sh
3268         dflt='y'
3269         case "$use5005threads" in
3270                 $define|true|[yY]*) dflt='n';;
3271         esac
3272         case "$useithreads" in
3273                 $undef|false|[nN]*) dflt='n';;
3274         esac
3275         rp='Use interpreter-based ithreads?'
3276         . ./myread
3277         case "$ans" in
3278         y|Y)    val="$define" ;;
3279         *)      val="$undef" ;;
3280         esac
3281         set useithreads
3282         eval $setvar
3283         : Now set use5005threads to the opposite value.
3284         case "$useithreads" in
3285         $define) val="$undef" ;;
3286         *) val="$define" ;;
3287         esac
3288         set use5005threads
3289         eval $setvar
3290         ;;
3291 *)
3292         useithreads="$undef"
3293         use5005threads="$undef"
3294         ;;
3295 esac
3296
3297 case "$useithreads$use5005threads" in
3298 "$define$define")
3299         $cat >&4 <<EOM
3300
3301 You cannot have both the ithreads and the 5.005 threads enabled
3302 at the same time.  Disabling the 5.005 threads since they are
3303 much less stable than the ithreads.
3304
3305 EOM
3306         use5005threads="$undef"
3307         ;;
3308 esac
3309
3310 case "$d_oldpthreads" in
3311 '')     : Configure tests would be welcome here.  For now, assume undef.
3312         val="$undef" ;;
3313 *)      val="$d_oldpthreads" ;;
3314 esac
3315 set d_oldpthreads
3316 eval $setvar
3317
3318
3319 case "$usethreads" in
3320 "$define"|true|[yY]*)
3321 : Look for a hint-file generated 'call-back-unit'.  If the
3322 : user has specified that a threading perl is to be built,
3323 : we may need to set or change some other defaults.
3324         if $test -f usethreads.cbu; then
3325                 echo "Your platform has some specific hints for threaded builds, using them..."
3326                 . ./usethreads.cbu
3327         else
3328                 $cat <<EOM
3329 (Your platform doesn't have any specific hints for threaded builds.
3330  Assuming POSIX threads, then.)
3331 EOM
3332         fi
3333         ;;
3334 esac
3335
3336 cat <<EOM
3337
3338 Perl can be built so that multiple Perl interpreters can coexist
3339 within the same Perl executable.
3340 EOM
3341
3342 case "$useithreads" in
3343 $define)
3344         cat <<EOM
3345 This multiple interpreter support is required for interpreter-based threads.
3346 EOM
3347         val="$define"
3348         ;;
3349 *)      case "$usemultiplicity" in
3350         $define|true|[yY]*)     dflt='y';;
3351         *) dflt='n';;
3352         esac
3353         echo " "
3354         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3355         rp='Build Perl for multiplicity?'
3356         . ./myread
3357         case "$ans" in
3358         y|Y)    val="$define" ;;
3359         *)      val="$undef" ;;
3360         esac
3361         ;;
3362 esac
3363 set usemultiplicity
3364 eval $setvar
3365
3366
3367 case "$usemorebits" in
3368 "$define"|true|[yY]*)
3369         use64bitint="$define"
3370         uselongdouble="$define"
3371         usemorebits="$define"
3372         ;;
3373 *)      usemorebits="$undef"
3374         ;;
3375 esac
3376
3377 : make some quick guesses about what we are up against
3378 echo " "
3379 $echo $n "Hmm...  $c"
3380 echo exit 1 >bsd
3381 echo exit 1 >usg
3382 echo exit 1 >v7
3383 echo exit 1 >osf1
3384 echo exit 1 >eunice
3385 echo exit 1 >xenix
3386 echo exit 1 >venix
3387 echo exit 1 >os2
3388 d_bsd="$undef"
3389 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3390 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3391 then
3392         echo "Looks kind of like an OSF/1 system, but we'll see..."
3393         echo exit 0 >osf1
3394 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3395         xxx=`./loc addbib blurfl $pth`
3396         if $test -f $xxx; then
3397         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3398                 echo exit 0 >bsd
3399                 echo exit 0 >usg
3400         else
3401                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3402                         echo "Looks kind of like an extended USG system, but we'll see..."
3403                 else
3404                         echo "Looks kind of like a USG system, but we'll see..."
3405                 fi
3406                 echo exit 0 >usg
3407         fi
3408 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3409         echo "Looks kind of like a BSD system, but we'll see..."
3410         d_bsd="$define"
3411         echo exit 0 >bsd
3412 else
3413         echo "Looks kind of like a Version 7 system, but we'll see..."
3414         echo exit 0 >v7
3415 fi
3416 case "$eunicefix" in
3417 *unixtovms*)
3418         $cat <<'EOI'
3419 There is, however, a strange, musty smell in the air that reminds me of
3420 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3421 EOI
3422         echo exit 0 >eunice
3423         d_eunice="$define"
3424 : it so happens the Eunice I know will not run shell scripts in Unix format
3425         ;;
3426 *)
3427         echo " "
3428         echo "Congratulations.  You aren't running Eunice."
3429         d_eunice="$undef"
3430         ;;
3431 esac
3432 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3433 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3434 : semicolon as a patch separator
3435 case "$p_" in
3436 :) ;;
3437 *)
3438         $cat <<'EOI'
3439 I have the feeling something is not exactly right, however...don't tell me...
3440 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3441 (Or you may be running DOS with DJGPP.)
3442 EOI
3443         echo exit 0 >os2
3444         ;;
3445 esac
3446 if test -f /xenix; then
3447         echo "Actually, this looks more like a XENIX system..."
3448         echo exit 0 >xenix
3449         d_xenix="$define"
3450 else
3451         echo " "
3452         echo "It's not Xenix..."
3453         d_xenix="$undef"
3454 fi
3455 chmod +x xenix
3456 $eunicefix xenix
3457 if test -f /venix; then
3458         echo "Actually, this looks more like a VENIX system..."
3459         echo exit 0 >venix
3460 else
3461         echo " "
3462         if ./xenix; then
3463                 : null
3464         else
3465                 echo "Nor is it Venix..."
3466         fi
3467 fi
3468 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3469 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3470 $rm -f foo
3471
3472 case "$cc" in
3473 '') dflt=cc;;
3474 *) dflt="$cc";;
3475 esac
3476 rp="Use which C compiler?"
3477 . ./myread
3478 cc="$ans"
3479 : Look for a hint-file generated 'call-back-unit'.  Now that the
3480 : user has specified the compiler, we may need to set or change some
3481 : other defaults.
3482 if $test -f cc.cbu; then
3483     . ./cc.cbu
3484 fi
3485 . ./checkcc
3486
3487 echo " "
3488 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3489 $cat >try.c <<EOM
3490 #include <stdio.h>
3491 int main() {
3492 #ifdef __GNUC__
3493 #ifdef __VERSION__
3494         printf("%s\n", __VERSION__);
3495 #else
3496         printf("%s\n", "1");
3497 #endif
3498 #endif
3499         exit(0);
3500 }
3501 EOM
3502 if $cc -o try $ccflags $ldflags try.c; then
3503         gccversion=`$run ./try`
3504         case "$gccversion" in
3505         '') echo "You are not using GNU cc." ;;
3506         *)  echo "You are using GNU cc $gccversion."
3507             ccname=gcc  
3508             ;;
3509         esac
3510 else
3511         echo " "
3512         echo "*** WHOA THERE!!! ***" >&4
3513         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3514         case "$knowitall" in
3515         '')
3516         echo "    You'd better start hunting for one and let me know about it." >&4
3517                 exit 1
3518                 ;;
3519         esac
3520 fi
3521 $rm -f try try.*
3522 case "$gccversion" in
3523 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3524 esac
3525 case "$gccversion" in
3526 '') gccosandvers='' ;;
3527 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3528    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3529    gccshortvers=''
3530    case "$gccosandvers" in
3531    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3532    $osname$osvers) ;; # looking good
3533    $osname*) cat <<EOM >&4
3534
3535 *** WHOA THERE!!! ***
3536
3537     Your gcc has not been compiled for the exact release of
3538     your operating system ($gccosandvers versus $osname$osvers).
3539
3540     In general it is a good idea to keep gcc synchronized with
3541     the operating system because otherwise serious problems
3542     may ensue when trying to compile software, like Perl.
3543
3544     I'm trying to be optimistic here, though, and will continue.
3545     If later during the configuration and build icky compilation
3546     problems appear (headerfile conflicts being the most common
3547     manifestation), I suggest reinstalling the gcc to match
3548     your operating system release.
3549
3550 EOM
3551       ;;
3552    *) gccosandvers='' ;; # failed to parse, better be silent
3553    esac
3554    ;;
3555 esac
3556 case "$ccname" in
3557 '') ccname="$cc" ;;
3558 esac
3559
3560
3561 : decide how portable to be.  Allow command line overrides.
3562 case "$d_portable" in
3563 "$undef") ;;
3564 *)      d_portable="$define" ;;
3565 esac
3566
3567 : set up shell script to do ~ expansion
3568 cat >filexp <<EOSS
3569 $startsh
3570 : expand filename
3571 case "\$1" in
3572  ~/*|~)
3573         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3574         ;;
3575  ~*)
3576         if $test -f /bin/csh; then
3577                 /bin/csh -f -c "glob \$1"
3578                 failed=\$?
3579                 echo ""
3580                 exit \$failed
3581         else
3582                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3583                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3584                 if $test ! -d "\$dir"; then
3585                         me=\`basename \$0\`
3586                         echo "\$me: can't locate home directory for: \$name" >&2
3587                         exit 1
3588                 fi
3589                 case "\$1" in
3590                 */*)
3591                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3592                         ;;
3593                 *)
3594                         echo \$dir
3595                         ;;
3596                 esac
3597         fi
3598         ;;
3599 *)
3600         echo \$1
3601         ;;
3602 esac
3603 EOSS
3604 chmod +x filexp
3605 $eunicefix filexp
3606
3607 : now set up to get a file name
3608 cat <<EOS >getfile
3609 $startsh
3610 EOS
3611 cat <<'EOSC' >>getfile
3612 tilde=''
3613 fullpath=''
3614 already=''
3615 skip=''
3616 none_ok=''
3617 exp_file=''
3618 nopath_ok=''
3619 orig_rp="$rp"
3620 orig_dflt="$dflt"
3621 case "$gfpth" in
3622 '') gfpth='.' ;;
3623 esac
3624
3625 case "$fn" in
3626 *\(*)
3627         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3628         fn=`echo $fn | sed 's/(.*)//'`
3629         ;;
3630 esac
3631
3632 case "$fn" in
3633 *:*)
3634         loc_file=`expr $fn : '.*:\(.*\)'`
3635         fn=`expr $fn : '\(.*\):.*'`
3636         ;;
3637 esac
3638
3639 case "$fn" in
3640 *~*) tilde=true;;
3641 esac
3642 case "$fn" in
3643 */*) fullpath=true;;
3644 esac
3645 case "$fn" in
3646 *+*) skip=true;;
3647 esac
3648 case "$fn" in
3649 *n*) none_ok=true;;
3650 esac
3651 case "$fn" in
3652 *e*) exp_file=true;;
3653 esac
3654 case "$fn" in
3655 *p*) nopath_ok=true;;
3656 esac
3657
3658 case "$fn" in
3659 *f*) type='File';;
3660 *d*) type='Directory';;
3661 *l*) type='Locate';;
3662 esac
3663
3664 what="$type"
3665 case "$what" in
3666 Locate) what='File';;
3667 esac
3668
3669 case "$exp_file" in
3670 '')
3671         case "$d_portable" in
3672         "$define") ;;
3673         *) exp_file=true;;
3674         esac
3675         ;;
3676 esac
3677
3678 cd ..
3679 while test "$type"; do
3680         redo=''
3681         rp="$orig_rp"
3682         dflt="$orig_dflt"
3683         case "$tilde" in
3684         true) rp="$rp (~name ok)";;
3685         esac
3686         . UU/myread
3687         if test -f UU/getfile.ok && \
3688                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3689         then
3690                 value="$ans"
3691                 ansexp="$ans"
3692                 break
3693         fi
3694         case "$ans" in
3695         none)
3696                 value=''
3697                 ansexp=''
3698                 case "$none_ok" in
3699                 true) type='';;
3700                 esac
3701                 ;;
3702         *)
3703                 case "$tilde" in
3704                 '') value="$ans"
3705                         ansexp="$ans";;
3706                 *)
3707                         value=`UU/filexp $ans`
3708                         case $? in
3709                         0)
3710                                 if test "$ans" != "$value"; then
3711                                         echo "(That expands to $value on this system.)"
3712                                 fi
3713                                 ;;
3714                         *) value="$ans";;
3715                         esac
3716                         ansexp="$value"
3717                         case "$exp_file" in
3718                         '') value="$ans";;
3719                         esac
3720                         ;;
3721                 esac
3722                 case "$fullpath" in
3723                 true)
3724                         case "$ansexp" in
3725                         /*) value="$ansexp" ;;
3726                         [a-zA-Z]:/*) value="$ansexp" ;;
3727                         *)
3728                                 redo=true
3729                                 case "$already" in
3730                                 true)
3731                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3732                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3733                                         ;;
3734                                 *)
3735                                 echo "Please give a full path name, starting with slash." >&4
3736                                         case "$tilde" in
3737                                         true)
3738                                 echo "Note that using ~name is ok provided it expands well." >&4
3739                                                 already=true
3740                                                 ;;
3741                                         esac
3742                                 esac
3743                                 ;;
3744                         esac
3745                         ;;
3746                 esac
3747                 case "$redo" in
3748                 '')
3749                         case "$type" in
3750                         File)
3751                                 for fp in $gfpth; do
3752                                         if test "X$fp" = X.; then
3753                                             pf="$ansexp"
3754                                         else    
3755                                             pf="$fp/$ansexp"
3756                                         fi
3757                                         if test -f "$pf"; then
3758                                                 type=''
3759                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3760                                         then
3761                                                 echo "($value is not a plain file, but that's ok.)"
3762                                                 type=''
3763                                         fi
3764                                         if test X"$type" = X; then
3765                                             value="$pf"
3766                                             break
3767                                         fi
3768                                 done
3769                                 ;;
3770                         Directory)
3771                                 for fp in $gfpth; do
3772                                         if test "X$fp" = X.; then
3773                                             dir="$ans"
3774                                             direxp="$ansexp"
3775                                         else    
3776                                             dir="$fp/$ansexp"
3777                                             direxp="$fp/$ansexp"
3778                                         fi
3779                                         if test -d "$direxp"; then
3780                                                 type=''
3781                                                 value="$dir"
3782                                                 break
3783                                         fi
3784                                 done
3785                                 ;;
3786                         Locate)
3787                                 if test -d "$ansexp"; then
3788                                         echo "(Looking for $loc_file in directory $value.)"
3789                                         value="$value/$loc_file"
3790                                         ansexp="$ansexp/$loc_file"
3791                                 fi
3792                                 if test -f "$ansexp"; then
3793                                         type=''
3794                                 fi
3795                                 case "$nopath_ok" in
3796                                 true)   case "$value" in
3797                                         */*) ;;
3798                                         *)      echo "Assuming $value will be in people's path."
3799                                                 type=''
3800                                                 ;;
3801                                         esac
3802                                         ;;
3803                                 esac
3804                                 ;;
3805                         esac
3806
3807                         case "$skip" in
3808                         true) type='';
3809                         esac
3810
3811                         case "$type" in
3812                         '') ;;
3813                         *)
3814                                 if test "$fastread" = yes; then
3815                                         dflt=y
3816                                 else
3817                                         dflt=n
3818                                 fi
3819                                 rp="$what $value doesn't exist.  Use that name anyway?"
3820                                 . UU/myread
3821                                 dflt=''
3822                                 case "$ans" in
3823                                 y*) type='';;
3824                                 *) echo " ";;
3825                                 esac
3826                                 ;;
3827                         esac
3828                         ;;
3829                 esac
3830                 ;;
3831         esac
3832 done
3833 cd UU
3834 ans="$value"
3835 rp="$orig_rp"
3836 dflt="$orig_dflt"
3837 rm -f getfile.ok
3838 test "X$gfpthkeep" != Xy && gfpth=""
3839 EOSC
3840
3841 : What should the include directory be ?
3842 echo " "
3843 $echo $n "Hmm...  $c"
3844 dflt='/usr/include'
3845 incpath=''
3846 mips_type=''
3847 if $test -f /bin/mips && /bin/mips; then
3848         echo "Looks like a MIPS system..."
3849         $cat >usr.c <<'EOCP'
3850 #ifdef SYSTYPE_BSD43
3851 /bsd43
3852 #endif
3853 EOCP
3854         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3855                 dflt='/bsd43/usr/include'
3856                 incpath='/bsd43'
3857                 mips_type='BSD 4.3'
3858         else
3859                 mips_type='System V'
3860         fi
3861         $rm -f usr.c usr.out
3862         echo "and you're compiling with the $mips_type compiler and libraries."
3863         xxx_prompt=y
3864         echo "exit 0" >mips
3865 else
3866         echo "Doesn't look like a MIPS system."
3867         xxx_prompt=n
3868         echo "exit 1" >mips
3869 fi
3870 chmod +x mips
3871 $eunicefix mips
3872 case "$usrinc" in
3873 '') ;;
3874 *) dflt="$usrinc";;
3875 esac
3876 case "$xxx_prompt" in
3877 y)      fn=d/
3878         echo " "
3879         rp='Where are the include files you want to use?'
3880         . ./getfile
3881         usrinc="$ans"
3882         ;;
3883 *)      usrinc="$dflt"
3884         ;;
3885 esac
3886
3887 : see how we invoke the C preprocessor
3888 echo " "
3889 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3890 cat <<'EOT' >testcpp.c
3891 #define ABC abc
3892 #define XYZ xyz
3893 ABC.XYZ
3894 EOT
3895 cd ..
3896 if test ! -f cppstdin; then
3897         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3898                 # AIX cc -E doesn't show the absolute headerfile
3899                 # locations but we'll cheat by using the -M flag.
3900                 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
3901         else
3902                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3903         fi
3904 else
3905         echo "Keeping your $hint cppstdin wrapper."
3906 fi
3907 chmod 755 cppstdin
3908 wrapper=`pwd`/cppstdin
3909 ok='false'
3910 cd UU
3911
3912 if $test "X$cppstdin" != "X" && \
3913         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3914         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3915 then
3916         echo "You used to use $cppstdin $cppminus so we'll use that again."
3917         case "$cpprun" in
3918         '') echo "But let's see if we can live without a wrapper..." ;;
3919         *)
3920                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3921                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3922                 then
3923                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3924                         ok='true'
3925                 else
3926                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3927                 fi
3928                 ;;
3929         esac
3930 else
3931         case "$cppstdin" in
3932         '') ;;
3933         *)
3934                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3935                 ;;
3936         esac
3937 fi
3938
3939 if $ok; then
3940         : nothing
3941 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3942         $cc -E <testcpp.c >testcpp.out 2>&1; \
3943         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3944         echo "Yup, it does."
3945         x_cpp="$cc -E"
3946         x_minus='';
3947 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3948         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3949         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3950         echo "Yup, it does."
3951         x_cpp="$cc -E"
3952         x_minus='-';
3953 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3954         $cc -P <testcpp.c >testcpp.out 2>&1; \
3955         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3956         echo "Yipee, that works!"
3957         x_cpp="$cc -P"
3958         x_minus='';
3959 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3960         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3961         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3962         echo "At long last!"
3963         x_cpp="$cc -P"
3964         x_minus='-';
3965 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3966         $cpp <testcpp.c >testcpp.out 2>&1; \
3967         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3968         echo "It works!"
3969         x_cpp="$cpp"
3970         x_minus='';
3971 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3972         $cpp - <testcpp.c >testcpp.out 2>&1; \
3973         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3974         echo "Hooray, it works!  I was beginning to wonder."
3975         x_cpp="$cpp"
3976         x_minus='-';
3977 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3978         $wrapper <testcpp.c >testcpp.out 2>&1; \
3979         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3980         x_cpp="$wrapper"
3981         x_minus=''
3982         echo "Eureka!"
3983 else
3984         dflt=''
3985         rp="No dice.  I can't find a C preprocessor.  Name one:"
3986         . ./myread
3987         x_cpp="$ans"
3988         x_minus=''
3989         $x_cpp <testcpp.c >testcpp.out 2>&1
3990         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3991                 echo "OK, that will do." >&4
3992         else
3993 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3994                 exit 1
3995         fi
3996 fi
3997
3998 case "$ok" in
3999 false)
4000         cppstdin="$x_cpp"
4001         cppminus="$x_minus"
4002         cpprun="$x_cpp"
4003         cpplast="$x_minus"
4004         set X $x_cpp
4005         shift
4006         case "$1" in
4007         "$cpp")
4008                 echo "Perhaps can we force $cc -E using a wrapper..."
4009                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4010                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4011                 then
4012                         echo "Yup, we can."
4013                         cppstdin="$wrapper"
4014                         cppminus='';
4015                 else
4016                         echo "Nope, we'll have to live without it..."
4017                 fi
4018                 ;;
4019         esac
4020         case "$cpprun" in
4021         "$wrapper")
4022                 cpprun=''
4023                 cpplast=''
4024                 ;;
4025         esac
4026         ;;
4027 esac
4028
4029 case "$cppstdin" in
4030 "$wrapper"|'cppstdin') ;;
4031 *) $rm -f $wrapper;;
4032 esac
4033 $rm -f testcpp.c testcpp.out
4034
4035 : Set private lib path
4036 case "$plibpth" in
4037 '') if ./mips; then
4038                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4039         fi;;
4040 esac
4041 case "$libpth" in
4042 ' ') dlist='';;
4043 '') dlist="$loclibpth $plibpth $glibpth";;
4044 *) dlist="$libpth";;
4045 esac
4046
4047 : Now check and see which directories actually exist, avoiding duplicates
4048 libpth=''
4049 for xxx in $dlist
4050 do
4051     if $test -d $xxx; then
4052                 case " $libpth " in
4053                 *" $xxx "*) ;;
4054                 *) libpth="$libpth $xxx";;
4055                 esac
4056     fi
4057 done
4058 $cat <<'EOM'
4059
4060 Some systems have incompatible or broken versions of libraries.  Among
4061 the directories listed in the question below, please remove any you
4062 know not to be holding relevant libraries, and add any that are needed.
4063 Say "none" for none.
4064
4065 EOM
4066 case "$libpth" in
4067 '') dflt='none';;
4068 *)
4069         set X $libpth
4070         shift
4071         dflt=${1+"$@"}
4072         ;;
4073 esac
4074 rp="Directories to use for library searches?"
4075 . ./myread
4076 case "$ans" in
4077 none) libpth=' ';;
4078 *) libpth="$ans";;
4079 esac
4080
4081 : compute shared library extension
4082 case "$so" in
4083 '')
4084         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4085                 dflt='sl'
4086         else
4087                 dflt='so'
4088         fi
4089         ;;
4090 *) dflt="$so";;
4091 esac
4092 $cat <<EOM
4093
4094 On some systems, shared libraries may be available.  Answer 'none' if
4095 you want to suppress searching of shared libraries for the remainder
4096 of this configuration.
4097
4098 EOM
4099 rp='What is the file extension used for shared libraries?'
4100 . ./myread
4101 so="$ans"
4102
4103 : Define several unixisms.
4104 : Hints files or command line option can be used to override them.
4105 : The convoluted testing is in case hints files set either the old
4106 : or the new name.
4107 case "$_exe" in
4108 '')     case "$exe_ext" in
4109     '') ;;
4110         *)      _exe="$exe_ext" ;;
4111         esac
4112         ;;
4113 esac
4114 case "$_a" in
4115 '')     case "$lib_ext" in
4116     '') _a='.a';;
4117         *)      _a="$lib_ext" ;;
4118         esac
4119         ;;
4120 esac
4121 case "$_o" in
4122 '') case "$obj_ext" in
4123         '')     _o='.o';;
4124         *)      _o="$obj_ext";;
4125         esac
4126         ;;
4127 esac
4128 case "$p_" in
4129 '') case "$path_sep" in
4130         '')     p_=':';;
4131         *)      p_="$path_sep";;
4132         esac
4133         ;;
4134 esac
4135 exe_ext=$_exe
4136 lib_ext=$_a
4137 obj_ext=$_o
4138 path_sep=$p_
4139
4140 : Which makefile gets called first.  This is used by make depend.
4141 case "$firstmakefile" in
4142 '') firstmakefile='makefile';;
4143 esac
4144
4145 case "$usesocks" in
4146 $define|true|[yY]*)     dflt='y';;
4147 *) dflt='n';;
4148 esac
4149 cat <<EOM
4150
4151 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4152 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4153 to use the PerlIO abstraction layer, this will be implicitly selected.
4154
4155 If this doesn't make any sense to you, just accept the default '$dflt'.
4156 EOM
4157 rp='Build Perl for SOCKS?'
4158 . ./myread
4159 case "$ans" in
4160 y|Y)    val="$define" ;;     
4161 *)      val="$undef" ;;
4162 esac
4163 set usesocks
4164 eval $setvar
4165
4166 case "$usesocks" in
4167 $define|true|[yY]*) useperlio="$define";;
4168 esac
4169
4170 : Looking for optional libraries
4171 echo " "
4172 echo "Checking for optional libraries..." >&4
4173 case "$libs" in
4174 ' '|'') dflt='';;
4175 *) dflt="$libs";;
4176 esac
4177 case "$libswanted" in
4178 '') libswanted='c_s';;
4179 esac
4180 case "$usesocks" in
4181 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4182 esac
4183 libsfound=''
4184 libsfiles=''
4185 libsdirs=''
4186 libspath=''
4187 for thisdir in $libpth $xlibpth; do
4188   test -d $thisdir && libspath="$libspath $thisdir"
4189 done
4190 for thislib in $libswanted; do
4191         for thisdir in $libspath; do
4192             xxx=''
4193             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4194                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4195                 $test -f "$xxx" && eval $libscheck
4196                 $test -f "$xxx" && libstyle=shared
4197             fi
4198             if test ! -f "$xxx"; then
4199                 xxx=$thisdir/lib$thislib.$so
4200                 $test -f "$xxx" && eval $libscheck
4201                 $test -f "$xxx" && libstyle=shared
4202             fi  
4203             if test ! -f "$xxx"; then
4204                 xxx=$thisdir/lib$thislib$_a
4205                 $test -f "$xxx" && eval $libscheck
4206                 $test -f "$xxx" && libstyle=static
4207             fi
4208             if test ! -f "$xxx"; then
4209                 xxx=$thisdir/$thislib$_a
4210                 $test -f "$xxx" && eval $libscheck
4211                 $test -f "$xxx" && libstyle=static
4212             fi
4213             if test ! -f "$xxx"; then
4214                 xxx=$thisdir/lib${thislib}_s$_a
4215                 $test -f "$xxx" && eval $libscheck
4216                 $test -f "$xxx" && libstyle=static
4217                 $test -f "$xxx" && thislib=${thislib}_s
4218             fi
4219             if test ! -f "$xxx"; then
4220                 xxx=$thisdir/Slib$thislib$_a
4221                 $test -f "$xxx" && eval $libscheck
4222                 $test -f "$xxx" && libstyle=static
4223             fi
4224             if $test -f "$xxx"; then
4225                 case "$libstyle" in
4226                 shared) echo "Found -l$thislib (shared)." ;;
4227                 static) echo "Found -l$thislib." ;;
4228                 *)      echo "Found -l$thislib ($libstyle)." ;;
4229                 esac
4230                 case " $dflt " in
4231                 *"-l$thislib "*);;
4232                 *) dflt="$dflt -l$thislib"
4233                    libsfound="$libsfound $xxx"
4234                    yyy=`basename $xxx`
4235                    libsfiles="$libsfiles $yyy"
4236                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4237                    case " $libsdirs " in
4238                    *" $yyy "*) ;;
4239                    *) libsdirs="$libsdirs $yyy" ;;
4240                    esac
4241                    ;;
4242                 esac
4243                 break
4244             fi  
4245         done
4246         if $test ! -f "$xxx"; then
4247             echo "No -l$thislib."
4248         fi
4249 done
4250 set X $dflt
4251 shift
4252 dflt="$*"
4253 case "$libs" in
4254 '') dflt="$dflt";;
4255 *) dflt="$libs";;
4256 esac
4257 case "$dflt" in
4258 ' '|'') dflt='none';;
4259 esac
4260
4261 $cat <<EOM
4262
4263 In order to compile $package on your machine, a number of libraries
4264 are usually needed.  Include any other special libraries here as well.
4265 Say "none" for none.  The default list is almost always right.
4266 EOM
4267
4268 echo " "
4269 rp="What libraries to use?"
4270 . ./myread
4271 case "$ans" in
4272 none) libs=' ';;
4273 *) libs="$ans";;
4274 esac
4275
4276 : determine optimization, if desired, or use for debug flag also
4277 case "$optimize" in
4278 ' '|$undef) dflt='none';;
4279 '') dflt='-O';;
4280 *) dflt="$optimize";;
4281 esac
4282 $cat <<EOH
4283
4284 By default, $package compiles with the -O flag to use the optimizer.
4285 Alternately, you might want to use the symbolic debugger, which uses
4286 the -g flag (on traditional Unix systems).  Either flag can be
4287 specified here.  To use neither flag, specify the word "none".
4288
4289 EOH
4290 rp="What optimizer/debugger flag should be used?"
4291 . ./myread
4292 optimize="$ans"
4293 case "$optimize" in
4294 'none') optimize=" ";;
4295 esac
4296
4297 dflt=''
4298 : We will not override a previous value, but we might want to
4299 : augment a hint file
4300 case "$hint" in
4301 default|recommended)
4302         case "$gccversion" in
4303         1*) dflt='-fpcc-struct-return' ;;
4304         esac
4305         case "$optimize" in
4306         *-g*) dflt="$dflt -DDEBUGGING";;
4307         esac
4308         case "$gccversion" in
4309         2*) if test -d /etc/conf/kconfig.d &&
4310                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4311                 then
4312                         dflt="$dflt -posix"
4313                 fi
4314                 ;;
4315         esac
4316         case "$gccversion" in
4317         1*) ;;
4318         2.[0-8]*) ;;
4319         ?*)     echo " "
4320                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4321                 echo 'int main(void) { return 0; }' > gcctest.c
4322                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4323                         echo "Yes, it does." 2>&1
4324                         case "$ccflags" in
4325                         *strict-aliasing*) 
4326                                 echo "Leaving current flags $ccflags alone." 2>&1
4327                                 ;;
4328                         *) dflt="$dflt -fno-strict-aliasing" ;;
4329                         esac
4330                 else
4331                         echo "Nope, it doesn't, but that's ok." 2>&1
4332                 fi
4333                 ;;
4334         esac
4335         ;;
4336 esac
4337
4338 case "$mips_type" in
4339 *BSD*|'') inclwanted="$locincpth $usrinc";;
4340 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4341 esac
4342 for thisincl in $inclwanted; do
4343         if $test -d $thisincl; then
4344                 if $test x$thisincl != x$usrinc; then
4345                         case "$dflt" in
4346                         *" -I$thisincl "*);;
4347                         *) dflt="$dflt -I$thisincl ";;
4348                         esac
4349                 fi
4350         fi
4351 done
4352
4353 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4354         xxx=true;
4355 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4356         xxx=true;
4357 else
4358         xxx=false;
4359 fi;
4360 if $xxx; then
4361         case "$dflt" in
4362         *$2*);;
4363         *) dflt="$dflt -D$2";;
4364         esac;
4365 fi'
4366
4367 set signal.h LANGUAGE_C; eval $inctest
4368
4369 case "$usesocks" in
4370 $define)
4371         ccflags="$ccflags -DSOCKS"
4372         ;;
4373 esac
4374
4375 case "$hint" in
4376 default|recommended) dflt="$ccflags $dflt" ;;
4377 *) dflt="$ccflags";;
4378 esac
4379
4380 case "$dflt" in
4381 ''|' ') dflt=none;;
4382 esac
4383
4384 $cat <<EOH
4385
4386 Your C compiler may want other flags.  For this question you should include
4387 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4388 but you should NOT include libraries or ld flags like -lwhatever.  If you
4389 want $package to honor its debug switch, you should include -DDEBUGGING here.
4390 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4391
4392 To use no flags, specify the word "none".
4393
4394 EOH
4395 set X $dflt
4396 shift
4397 dflt=${1+"$@"}
4398 rp="Any additional cc flags?"
4399 . ./myread
4400 case "$ans" in
4401 none) ccflags='';;
4402 *) ccflags="$ans";;
4403 esac
4404
4405 : the following weeds options from ccflags that are of no interest to cpp
4406 case "$cppflags" in
4407 '') cppflags="$ccflags" ;;
4408 *)  cppflags="$cppflags $ccflags" ;;
4409 esac
4410 case "$gccversion" in
4411 1*) cppflags="$cppflags -D__GNUC__"
4412 esac
4413 case "$mips_type" in
4414 '');;
4415 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4416 esac
4417 case "$cppflags" in
4418 '');;
4419 *)
4420         echo " "
4421         echo "Let me guess what the preprocessor flags are..." >&4
4422         set X $cppflags
4423         shift
4424         cppflags=''
4425         $cat >cpp.c <<'EOM'
4426 #define BLURFL foo
4427
4428 BLURFL xx LFRULB
4429 EOM
4430         previous=''
4431         for flag in $*
4432         do
4433                 case "$flag" in
4434                 -*) ftry="$flag";;
4435                 *) ftry="$previous $flag";;
4436                 esac
4437                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4438                         >cpp1.out 2>/dev/null && \
4439                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4440                         >cpp2.out 2>/dev/null && \
4441                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4442                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4443                 then
4444                         cppflags="$cppflags $ftry"
4445                         previous=''
4446                 else
4447                         previous="$flag"
4448                 fi
4449         done
4450         set X $cppflags
4451         shift
4452         cppflags=${1+"$@"}
4453         case "$cppflags" in
4454         *-*)  echo "They appear to be: $cppflags";;
4455         esac
4456         $rm -f cpp.c cpp?.out
4457         ;;
4458 esac
4459
4460 : flags used in final linking phase
4461 case "$ldflags" in
4462 '') if ./venix; then
4463                 dflt='-i -z'
4464         else
4465                 dflt=''
4466         fi
4467         case "$ccflags" in
4468         *-posix*) dflt="$dflt -posix" ;;
4469         esac
4470         ;;
4471 *) dflt="$ldflags";;
4472 esac
4473
4474 : Try to guess additional flags to pick up local libraries.
4475 for thislibdir in $libpth; do
4476         case " $loclibpth " in
4477         *" $thislibdir "*)
4478                 case "$dflt " in 
4479                 *"-L$thislibdir "*) ;;
4480                 *)  dflt="$dflt -L$thislibdir" ;;
4481                 esac
4482                 ;;
4483         esac
4484 done
4485
4486 case "$dflt" in
4487 '') dflt='none' ;;
4488 esac
4489
4490 $cat <<EOH
4491
4492 Your C linker may need flags.  For this question you should
4493 include -L/whatever and any other flags used by the C linker, but you
4494 should NOT include libraries like -lwhatever.
4495
4496 Make sure you include the appropriate -L/path flags if your C linker
4497 does not normally search all of the directories you specified above,
4498 namely
4499         $libpth
4500 To use no flags, specify the word "none".
4501
4502 EOH
4503
4504 rp="Any additional ld flags (NOT including libraries)?"
4505 . ./myread
4506 case "$ans" in
4507 none) ldflags='';;
4508 *) ldflags="$ans";;
4509 esac
4510 rmlist="$rmlist pdp11"
4511
4512 : coherency check
4513 echo " "
4514 echo "Checking your choice of C compiler and flags for coherency..." >&4
4515 $cat > try.c <<'EOF'
4516 #include <stdio.h>
4517 int main() { printf("Ok\n"); exit(0); }
4518 EOF
4519 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4520 shift
4521 $cat >try.msg <<'EOM'
4522 I've tried to compile and run the following simple program:
4523
4524 EOM
4525 $cat try.c >> try.msg
4526
4527 $cat >> try.msg <<EOM
4528
4529 I used the command:
4530
4531         $*
4532         $run ./try
4533
4534 and I got the following output:
4535
4536 EOM
4537 dflt=y
4538 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4539         if $sh -c "$run ./try" >>try.msg 2>&1; then
4540                 xxx=`$run ./try`
4541                 case "$xxx" in
4542                 "Ok") dflt=n ;;
4543                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4544                         case " $libs " in
4545                         *" -lsfio "*)
4546                                 cat >> try.msg <<'EOQS'
4547 If $libs contains -lsfio, and sfio is mis-configured, then it
4548 sometimes (apparently) runs and exits with a 0 status, but with no
4549 output!  It may have to do with sfio's use of _exit vs. exit.
4550
4551 EOQS
4552                                 rp="You have a big problem.  Shall I abort Configure"
4553                                 dflt=y
4554                                 ;;
4555                         esac
4556                         ;;
4557                 esac
4558         else
4559                 echo "The program compiled OK, but exited with status $?." >>try.msg
4560                 rp="You have a problem.  Shall I abort Configure"
4561                 dflt=y
4562         fi
4563 else
4564         echo "I can't compile the test program." >>try.msg
4565         rp="You have a BIG problem.  Shall I abort Configure"
4566         dflt=y
4567 fi
4568 case "$dflt" in
4569 y)
4570         $cat try.msg >&4
4571         case "$knowitall" in
4572         '')
4573                 echo "(The supplied flags or libraries might be incorrect.)"
4574                 ;;
4575         *) dflt=n;;
4576         esac
4577         echo " "
4578         . ./myread
4579         case "$ans" in
4580         n*|N*) ;;
4581         *)      echo "Ok.  Stopping Configure." >&4
4582                 exit 1
4583                 ;;
4584         esac
4585         ;;
4586 n) echo "OK, that should do.";;
4587 esac
4588 $rm -f try try.* core
4589
4590 : define a shorthand compile call
4591 compile='
4592 mc_file=$1;
4593 shift;
4594 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4595 : define a shorthand compile call for compilations that should be ok.
4596 compile_ok='
4597 mc_file=$1;
4598 shift;
4599 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4600
4601 : check for lengths of integral types
4602 echo " "
4603 case "$intsize" in
4604 '')
4605         echo "Checking to see how big your integers are..." >&4
4606         $cat >try.c <<'EOCP'
4607 #include <stdio.h>
4608 int main()
4609 {
4610         printf("intsize=%d;\n", (int)sizeof(int));
4611         printf("longsize=%d;\n", (int)sizeof(long));
4612         printf("shortsize=%d;\n", (int)sizeof(short));
4613         exit(0);
4614 }
4615 EOCP
4616         set try
4617         if eval $compile_ok && $run ./try > /dev/null; then
4618                 eval `$run ./try`
4619                 echo "Your integers are $intsize bytes long."
4620                 echo "Your long integers are $longsize bytes long."
4621                 echo "Your short integers are $shortsize bytes long."
4622         else
4623                 $cat >&4 <<EOM
4624 !
4625 Help! I can't compile and run the intsize test program: please enlighten me!
4626 (This is probably a misconfiguration in your system or libraries, and
4627 you really ought to fix it.  Still, I'll try anyway.)
4628 !
4629 EOM
4630                 dflt=4
4631                 rp="What is the size of an integer (in bytes)?"
4632                 . ./myread
4633                 intsize="$ans"
4634                 dflt=$intsize
4635                 rp="What is the size of a long integer (in bytes)?"
4636                 . ./myread
4637                 longsize="$ans"
4638                 dflt=2
4639                 rp="What is the size of a short integer (in bytes)?"
4640                 . ./myread
4641                 shortsize="$ans"
4642         fi
4643         ;;
4644 esac
4645 $rm -f try try.*
4646
4647 : check for void type
4648 echo " "
4649 echo "Checking to see how well your C compiler groks the void type..." >&4
4650 case "$voidflags" in
4651 '')
4652         $cat >try.c <<'EOCP'
4653 #if TRY & 1
4654 void sub() {
4655 #else
4656 sub() {
4657 #endif
4658         extern void moo();      /* function returning void */
4659         void (*goo)();          /* ptr to func returning void */
4660 #if TRY & 8
4661         void *hue;              /* generic ptr */
4662 #endif
4663 #if TRY & 2
4664         void (*foo[10])();
4665 #endif
4666
4667 #if TRY & 4
4668         if(goo == moo) {
4669                 exit(0);
4670         }
4671 #endif
4672         exit(0);
4673 }
4674 int main() { sub(); }
4675 EOCP
4676         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4677                 voidflags=$defvoidused
4678         echo "Good.  It appears to support void to the level $package wants.">&4
4679                 if $contains warning .out >/dev/null 2>&1; then
4680                         echo "However, you might get some warnings that look like this:"
4681                         $cat .out
4682                 fi
4683         else
4684 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4685                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4686                         echo "It supports 1..."
4687                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4688                                 echo "It also supports 2..."
4689                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4690                                         voidflags=7
4691                                         echo "And it supports 4 but not 8 definitely."
4692                                 else
4693                                         echo "It doesn't support 4..."
4694                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4695                                                 voidflags=11
4696                                                 echo "But it supports 8."
4697                                         else
4698                                                 voidflags=3
4699                                                 echo "Neither does it support 8."
4700                                         fi
4701                                 fi
4702                         else
4703                                 echo "It does not support 2..."
4704                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4705                                         voidflags=13
4706                                         echo "But it supports 4 and 8."
4707                                 else
4708                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4709                                                 voidflags=5
4710                                                 echo "And it supports 4 but has not heard about 8."
4711                                         else
4712                                                 echo "However it supports 8 but not 4."
4713                                         fi
4714                                 fi
4715                         fi
4716                 else
4717                         echo "There is no support at all for void."
4718                         voidflags=0
4719                 fi
4720         fi
4721 esac
4722 case "$voidflags" in
4723 "$defvoidused") ;;
4724 *)      $cat >&4 <<'EOM'
4725   Support flag bits are:
4726     1: basic void declarations.
4727     2: arrays of pointers to functions returning void.
4728     4: operations between pointers to and addresses of void functions.
4729     8: generic void pointers.
4730 EOM
4731         dflt="$voidflags";
4732         rp="Your void support flags add up to what?"
4733         . ./myread
4734         voidflags="$ans"
4735         ;;
4736 esac
4737 $rm -f try.* .out
4738
4739 : check for length of pointer
4740 echo " "
4741 case "$ptrsize" in
4742 '')
4743         echo "Checking to see how big your pointers are..." >&4
4744         if test "$voidflags" -gt 7; then
4745                 echo '#define VOID_PTR char *' > try.c
4746         else
4747                 echo '#define VOID_PTR void *' > try.c
4748         fi
4749         $cat >>try.c <<'EOCP'
4750 #include <stdio.h>
4751 int main()
4752 {
4753     printf("%d\n", (int)sizeof(VOID_PTR));
4754     exit(0);
4755 }
4756 EOCP
4757         set try
4758         if eval $compile_ok; then
4759                 ptrsize=`$run ./try`
4760                 echo "Your pointers are $ptrsize bytes long."
4761         else
4762                 dflt='4'
4763                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4764                 rp="What is the size of a pointer (in bytes)?"
4765                 . ./myread
4766                 ptrsize="$ans"
4767         fi
4768         ;;
4769 esac
4770 $rm -f try.c try
4771
4772 : check for long long
4773 echo " "
4774 echo "Checking to see if you have long long..." >&4
4775 echo 'int main() { long long x = 7; return 0; }' > try.c
4776 set try
4777 if eval $compile; then
4778         val="$define"
4779         echo "You have long long."
4780 else
4781         val="$undef"
4782         echo "You do not have long long."
4783 fi
4784 $rm try.*
4785 set d_longlong
4786 eval $setvar
4787
4788 : check for length of long long
4789 case "${d_longlong}${longlongsize}" in
4790 $define)
4791         echo " "
4792         echo "Checking to see how big your long longs are..." >&4
4793         $cat >try.c <<'EOCP'
4794 #include <stdio.h>
4795 int main()
4796 {
4797     printf("%d\n", (int)sizeof(long long));
4798     return(0);
4799 }
4800 EOCP
4801         set try
4802         if eval $compile_ok; then
4803                 longlongsize=`$run ./try`
4804                 echo "Your long longs are $longlongsize bytes long."
4805         else
4806                 dflt='8'
4807                 echo " "
4808                 echo "(I can't seem to compile the test program.  Guessing...)"
4809                 rp="What is the size of a long long (in bytes)?"
4810                 . ./myread
4811                 longlongsize="$ans"
4812         fi
4813         if $test "X$longsize" = "X$longlongsize"; then
4814                 echo "(That isn't any different from an ordinary long.)"
4815         fi      
4816         ;;
4817 esac
4818 $rm -f try.* try
4819
4820 : determine filename position in cpp output
4821 echo " "
4822 echo "Computing filename position in cpp output for #include directives..." >&4
4823 echo '#include <stdio.h>' > foo.c
4824 $cat >fieldn <<EOF
4825 $startsh
4826 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4827 $grep '^[       ]*#.*stdio\.h' | \
4828 while read cline; do
4829         pos=1
4830         set \$cline
4831         while $test \$# -gt 0; do
4832                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4833                         echo "\$pos"
4834                         exit 0
4835                 fi
4836                 shift
4837                 pos=\`expr \$pos + 1\`
4838         done
4839 done
4840 EOF
4841 chmod +x fieldn
4842 fieldn=`./fieldn`
4843 $rm -f foo.c fieldn
4844 case $fieldn in
4845 '') pos='???';;
4846 1) pos=first;;
4847 2) pos=second;;
4848 3) pos=third;;
4849 *) pos="${fieldn}th";;
4850 esac
4851 echo "Your cpp writes the filename in the $pos field of the line."
4852
4853 : locate header file
4854 $cat >findhdr <<EOF
4855 $startsh
4856 wanted=\$1
4857 name=''
4858 for usrincdir in $usrinc
4859 do
4860         if test -f \$usrincdir/\$wanted; then
4861                 echo "\$usrincdir/\$wanted"
4862                 exit 0
4863         fi
4864 done
4865 awkprg='{ print \$$fieldn }'
4866 echo "#include <\$wanted>" > foo\$\$.c
4867 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4868 $grep "^[       ]*#.*\$wanted" | \
4869 while read cline; do
4870         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4871         case "\$name" in
4872         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4873         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4874         *) exit 2;;
4875         esac;
4876 done;
4877 #
4878 # status = 0: grep returned 0 lines, case statement not executed
4879 # status = 1: headerfile found
4880 # status = 2: while loop executed, no headerfile found
4881 #
4882 status=\$?
4883 $rm -f foo\$\$.c;
4884 if test \$status -eq 1; then
4885         exit 0;
4886 fi
4887 exit 1
4888 EOF
4889 chmod +x findhdr
4890
4891 : define an alternate in-header-list? function
4892 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4893 cont=true; xxf="echo \"<\$1> found.\" >&4";
4894 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4895 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4896 esac;
4897 case $# in 4) instead=instead;; *) instead="at last";; esac;
4898 while $test "$cont"; do
4899         xxx=`./findhdr $1`
4900         var=$2; eval "was=\$$2";
4901         if $test "$xxx" && $test -r "$xxx";
4902         then eval $xxf;
4903         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4904                 cont="";
4905         else eval $xxnf;
4906         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4907         set $yyy; shift; shift; yyy=$@;
4908         case $# in 0) cont="";;
4909         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4910                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4911         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4912                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4913         esac;
4914 done;
4915 while $test "$yyy";
4916 do set $yyy; var=$2; eval "was=\$$2";
4917         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4918         set $yyy; shift; shift; yyy=$@;
4919 done'
4920
4921 : see if inttypes.h is available
4922 : we want a real compile instead of Inhdr because some systems
4923 : have an inttypes.h which includes non-existent headers
4924 echo " "
4925 $cat >try.c <<EOCP
4926 #include <inttypes.h>
4927 int main() {
4928         static int32_t foo32 = 0x12345678;
4929 }
4930 EOCP
4931 set try
4932 if eval $compile; then
4933         echo "<inttypes.h> found." >&4
4934         val="$define"
4935 else
4936         echo "<inttypes.h> NOT found." >&4
4937         val="$undef"
4938 fi
4939 $rm -f try.c try
4940 set i_inttypes
4941 eval $setvar
4942
4943 : check for int64_t
4944 echo " "
4945 echo "Checking to see if you have int64_t..." >&4
4946 $cat >try.c <<EOCP
4947 #include <sys/types.h>
4948 #$i_inttypes I_INTTYPES
4949 #ifdef I_INTTYPES
4950 #include <inttypes.h>
4951 #endif
4952 int main() { int64_t x = 7; }
4953 EOCP
4954 set try
4955 if eval $compile; then
4956         val="$define"
4957         echo "You have int64_t."
4958 else
4959         val="$undef"
4960         echo "You do not have int64_t."
4961 fi
4962 $rm -f try try.*
4963 set d_int64_t
4964 eval $setvar
4965
4966
4967 echo " "
4968 echo "Checking which 64-bit integer type we could use..." >&4
4969
4970 case "$intsize" in
4971 8) val=int
4972    set quadtype
4973    eval $setvar
4974    val='"unsigned int"'
4975    set uquadtype
4976    eval $setvar
4977    quadkind=1
4978    ;;
4979 *) case "$longsize" in
4980    8) val=long
4981       set quadtype
4982       eval $setvar
4983       val='"unsigned long"'
4984       set uquadtype
4985       eval $setvar
4986       quadkind=2
4987       ;;
4988    *) case "$d_longlong:$longlongsize" in
4989       define:8)
4990         val='"long long"'
4991         set quadtype
4992         eval $setvar
4993         val='"unsigned long long"'
4994         set uquadtype
4995         eval $setvar
4996         quadkind=3
4997         ;;
4998       *) case "$d_int64_t" in
4999          define)
5000            val=int64_t
5001            set quadtype
5002            eval $setvar
5003            val=uint64_t
5004            set uquadtype
5005            eval $setvar
5006            quadkind=4
5007            ;;
5008          esac
5009          ;;
5010       esac
5011       ;;
5012    esac
5013    ;;
5014 esac
5015
5016 case "$quadtype" in
5017 '')     echo "Alas, no 64-bit integer types in sight." >&4
5018         d_quad="$undef"
5019         ;;
5020 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5021         d_quad="$define"
5022         ;;
5023 esac
5024
5025
5026 case "$uselonglong" in
5027 "$define"|true|[yY]*)
5028         cat <<EOM >&4
5029
5030 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5031 EOM
5032         use64bitint="$define"
5033         ;;
5034 esac                          
5035 case "$use64bits" in
5036 "$define"|true|[yY]*)
5037         cat <<EOM >&4
5038
5039 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5040 EOM
5041         use64bitint="$define"
5042         ;;
5043 esac                          
5044 case "$use64bitints" in
5045 "$define"|true|[yY]*)
5046         cat <<EOM >&4
5047
5048 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5049 EOM
5050         use64bitint="$define"
5051         ;;
5052 esac                          
5053 case "$use64bitsint" in
5054 "$define"|true|[yY]*)
5055         cat <<EOM >&4
5056
5057 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5058 EOM
5059         use64bitint="$define"
5060         ;;
5061 esac                          
5062 case "$uselonglongs" in
5063 "$define"|true|[yY]*)
5064         cat <<EOM >&4
5065
5066 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5067 EOM
5068         use64bitint="$define"
5069         ;;
5070 esac                          
5071 case "$use64bitsall" in
5072 "$define"|true|[yY]*)
5073         cat <<EOM >&4
5074
5075 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5076 EOM
5077         use64bitall="$define"
5078         ;;
5079 esac                          
5080
5081 case "$ccflags" in
5082 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5083 esac
5084 case "$use64bitall" in
5085 "$define"|true|[yY]*) use64bitint="$define" ;;
5086 esac
5087
5088 case "$longsize" in
5089 8) cat <<EOM
5090
5091 You have natively 64-bit long integers.
5092 EOM
5093    val="$define"
5094    ;;
5095 *) case "$use64bitint" in
5096    "$define"|true|[yY]*) dflt='y';;
5097    *) dflt='n';;
5098    esac
5099    case "$d_quad" in
5100    "$define") ;;
5101    *) dflt='n' ;;
5102    esac
5103    cat <<EOM
5104
5105 Perl can be built to take advantage of 64-bit integer types
5106 on some systems.  To do so, Configure can be run with -Duse64bitint.
5107 Choosing this option will most probably introduce binary incompatibilities.
5108
5109 If this doesn't make any sense to you, just accept the default '$dflt'.
5110 (The default has been chosen based on your configuration.)
5111 EOM
5112    rp='Try to use 64-bit integers, if available?'
5113    . ./myread
5114    case "$ans" in
5115    [yY]*) val="$define" ;;
5116    *)     val="$undef"  ;;
5117    esac
5118    ;;
5119 esac
5120 set use64bitint
5121 eval $setvar
5122
5123 case "$use64bitall" in
5124 "$define"|true|[yY]*) dflt='y' ;;
5125 *) case "$longsize" in
5126    8) dflt='y' ;;
5127    *) dflt='n' ;;
5128    esac
5129    ;;
5130 esac    
5131 cat <<EOM
5132
5133 You may also choose to try maximal 64-bitness.  It means using as much
5134 64-bitness as possible on the platform.  This in turn means even more
5135 binary incompatibilities.  On the other hand, your platform may not
5136 have any more 64-bitness available than what you already have chosen.
5137
5138 If this doesn't make any sense to you, just accept the default '$dflt'.
5139 (The default has been chosen based on your configuration.)
5140 EOM
5141 rp='Try to use maximal 64-bit support, if available?'
5142 . ./myread
5143 case "$ans" in
5144 [yY]*) val="$define" ;;
5145 *)     val="$undef"  ;;
5146 esac
5147 set use64bitall
5148 eval $setvar
5149 case "$use64bitall" in
5150 "$define")
5151         case "$use64bitint" in
5152         "$undef")
5153                 cat <<EOM
5154
5155 Since you have chosen a maximally 64-bit build, I'm also turning on
5156 the use of 64-bit integers.
5157 EOM
5158                 use64bitint="$define" ;;
5159         esac
5160         ;;
5161 esac
5162
5163 case "$use64bitall" in
5164 "$define"|true|[yY]*)
5165         case "$ptrsize" in
5166         4)      cat <<EOM >&4
5167
5168 *** You have chosen a maximally 64-bit build, but your pointers
5169 *** are only 4 bytes wide, disabling maximal 64-bitness.
5170
5171 EOM
5172                 use64bitall="$undef"
5173                 case "$use64bitint" in
5174                 "$define"|true|[yY]*) ;;
5175                 *)      cat <<EOM >&4
5176
5177 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5178
5179 EOM
5180                         use64bitint="$define"
5181                         ;;
5182                 esac
5183                 ;;
5184         esac
5185         ;;
5186 esac
5187
5188 case "$use64bitint" in
5189 "$define"|true|[yY]*)
5190 : Look for a hint-file generated 'call-back-unit'.  If the
5191 : user has specified that a 64-bit perl is to be built,
5192 : we may need to set or change some other defaults.
5193         if $test -f use64bitint.cbu; then
5194                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5195                 . ./use64bitint.cbu
5196         fi
5197         case "$longsize" in
5198         4) case "$archname64" in
5199            '') archname64=64int ;;
5200            esac
5201            ;;
5202         esac
5203         ;;
5204 esac
5205
5206 case "$use64bitall" in
5207 "$define"|true|[yY]*)
5208 : Look for a hint-file generated 'call-back-unit'.  If the
5209 : user has specified that a maximally 64-bit perl is to be built,
5210 : we may need to set or change some other defaults.
5211         if $test -f use64bitall.cbu; then
5212                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5213                 . ./use64bitall.cbu
5214         fi
5215         case "$longsize" in
5216         4) case "$archname64" in
5217            ''|64int) archname64=64all ;;
5218            esac
5219            ;;
5220         esac
5221         ;;
5222 esac
5223
5224 echo " "
5225 echo "Checking for GNU C Library..." >&4
5226 cat >try.c <<EOM
5227 #include <stdio.h>
5228 int main()
5229 {
5230 #ifdef __GLIBC__
5231     exit(0);
5232 #else
5233     exit(1);
5234 #endif
5235 }
5236 EOM
5237 set try
5238 if eval $compile_ok && $run ./try; then
5239         val="$define"
5240         echo "You are using the GNU C Library"
5241 else
5242         val="$undef"
5243         echo "You are not using the GNU C Library"
5244 fi
5245 $rm -f try try.*
5246 set d_gnulibc
5247 eval $setvar
5248
5249 : see if nm is to be used to determine whether a symbol is defined or not
5250 case "$usenm" in
5251 '')
5252         dflt=''
5253         case "$d_gnulibc" in
5254         "$define")
5255                 echo " "
5256                 echo "nm probably won't work on the GNU C Library." >&4
5257                 dflt=n
5258                 ;;
5259         esac
5260         case "$dflt" in
5261         '') 
5262                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5263                         echo " "
5264                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5265                         echo "'nm' won't be sufficient on this sytem." >&4
5266                         dflt=n
5267                 fi
5268                 ;;
5269         esac
5270         case "$dflt" in
5271         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5272                 if $test $dflt -gt 20; then
5273                         dflt=y
5274                 else
5275                         dflt=n
5276                 fi
5277                 ;;
5278         esac
5279         ;;
5280 *)
5281         case "$usenm" in
5282         true|$define) dflt=y;;
5283         *) dflt=n;;
5284         esac
5285         ;;
5286 esac
5287 $cat <<EOM
5288
5289 I can use $nm to extract the symbols from your C libraries. This
5290 is a time consuming task which may generate huge output on the disk (up
5291 to 3 megabytes) but that should make the symbols extraction faster. The
5292 alternative is to skip the 'nm' extraction part and to compile a small
5293 test program instead to determine whether each symbol is present. If
5294 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5295 this may be the best solution.
5296
5297 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5298
5299 EOM
5300 rp="Shall I use $nm to extract C symbols from the libraries?"
5301 . ./myread
5302 case "$ans" in
5303 [Nn]*) usenm=false;;
5304 *) usenm=true;;
5305 esac
5306
5307 runnm=$usenm
5308 case "$reuseval" in
5309 true) runnm=false;;
5310 esac
5311
5312 : nm options which may be necessary
5313 case "$nm_opt" in
5314 '') if $test -f /mach_boot; then
5315                 nm_opt=''       # Mach
5316         elif $test -d /usr/ccs/lib; then
5317                 nm_opt='-p'     # Solaris (and SunOS?)
5318         elif $test -f /dgux; then
5319                 nm_opt='-p'     # DG-UX
5320         elif $test -f /lib64/rld; then
5321                 nm_opt='-p'     # 64-bit Irix
5322         else
5323                 nm_opt=''
5324         fi;;
5325 esac
5326
5327 : nm options which may be necessary for shared libraries but illegal
5328 : for archive libraries.  Thank you, Linux.
5329 case "$nm_so_opt" in
5330 '')     case "$myuname" in
5331         *linux*)
5332                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5333                         nm_so_opt='--dynamic'
5334                 fi
5335                 ;;
5336         esac
5337         ;;
5338 esac
5339
5340 case "$runnm" in
5341 true)
5342 : get list of predefined functions in a handy place
5343 echo " "
5344 case "$libc" in
5345 '') libc=unknown
5346         case "$libs" in
5347         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5348         esac
5349         ;;
5350 esac
5351 case "$libs" in
5352 '') ;;
5353 *)  for thislib in $libs; do
5354         case "$thislib" in
5355         -lc|-lc_s)
5356                 : Handle C library specially below.
5357                 ;;
5358         -l*)
5359                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5360                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5361                         :
5362                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5363                         :
5364                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5365                         :
5366                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5367                         :
5368                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5369                         :
5370                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5371                         :
5372                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5373                         :
5374                 else
5375                         try=''
5376                 fi
5377                 libnames="$libnames $try"
5378                 ;;
5379         *) libnames="$libnames $thislib" ;;
5380         esac
5381         done
5382         ;;
5383 esac
5384 xxx=normal
5385 case "$libc" in
5386 unknown)
5387         set /lib/libc.$so
5388         for xxx in $libpth; do
5389                 $test -r $1 || set $xxx/libc.$so
5390                 : The messy sed command sorts on library version numbers.
5391                 $test -r $1 || \
5392                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5393                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5394                                 h
5395                                 s/[0-9][0-9]*/0000&/g
5396                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5397                                 G
5398                                 s/\n/ /' | \
5399                          $sort | $sed -e 's/^.* //'`
5400                 eval set \$$#
5401         done
5402         $test -r $1 || set /usr/ccs/lib/libc.$so
5403         $test -r $1 || set /lib/libsys_s$_a
5404         ;;
5405 *)
5406         set blurfl
5407         ;;
5408 esac
5409 if $test -r "$1"; then
5410         echo "Your (shared) C library seems to be in $1."
5411         libc="$1"
5412 elif $test -r /lib/libc && $test -r /lib/clib; then
5413         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5414         xxx=apollo
5415         libc='/lib/clib /lib/libc'
5416         if $test -r /lib/syslib; then
5417                 echo "(Your math library is in /lib/syslib.)"
5418                 libc="$libc /lib/syslib"
5419         fi
5420 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5421         echo "Your C library seems to be in $libc, as you said before."
5422 elif $test -r $incpath/usr/lib/libc$_a; then
5423         libc=$incpath/usr/lib/libc$_a;
5424         echo "Your C library seems to be in $libc.  That's fine."
5425 elif $test -r /lib/libc$_a; then
5426         libc=/lib/libc$_a;
5427         echo "Your C library seems to be in $libc.  You're normal."
5428 else
5429         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5430                 :
5431         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5432                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5433         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5434                 :
5435         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5436                 :
5437         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5438                 :
5439         else
5440                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5441         fi
5442         if $test -r "$tans"; then
5443                 echo "Your C library seems to be in $tans, of all places."
5444                 libc=$tans
5445         else
5446                 libc='blurfl'
5447         fi
5448 fi
5449 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5450         dflt="$libc"
5451         cat <<EOM
5452
5453 If the guess above is wrong (which it might be if you're using a strange
5454 compiler, or your machine supports multiple models), you can override it here.
5455
5456 EOM
5457 else
5458         dflt=''
5459         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5460         cat >&4 <<EOM
5461 I can't seem to find your C library.  I've looked in the following places:
5462
5463 EOM
5464         $sed 's/^/      /' libpath
5465         cat <<EOM
5466
5467 None of these seems to contain your C library. I need to get its name...
5468
5469 EOM
5470 fi
5471 fn=f
5472 rp='Where is your C library?'
5473 . ./getfile
5474 libc="$ans"
5475
5476 echo " "
5477 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5478 set X `cat libnames`
5479 shift
5480 xxx=files
5481 case $# in 1) xxx=file; esac
5482 echo "Extracting names from the following $xxx for later perusal:" >&4
5483 echo " "
5484 $sed 's/^/      /' libnames >&4
5485 echo " "
5486 $echo $n "This may take a while...$c" >&4
5487
5488 for file in $*; do
5489         case $file in
5490         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5491         *) $nm $nm_opt $file 2>/dev/null;;
5492         esac
5493 done >libc.tmp
5494
5495 $echo $n ".$c"
5496 $grep fprintf libc.tmp > libc.ptf
5497 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5498 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5499 xxx='[ADTSIW]'
5500 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5501         eval $xscan;\
5502         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5503                 eval $xrun
5504 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5505         eval $xscan;\
5506         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5507                 eval $xrun
5508 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5509         eval $xscan;\
5510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5511                 eval $xrun
5512 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5513         eval $xscan;\
5514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5515                 eval $xrun
5516 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5517         eval $xscan;\
5518         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5519                 eval $xrun
5520 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5521         eval $xscan;\
5522         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5523                 eval $xrun
5524 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5525                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5526         eval $xscan;\
5527         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5528                 eval $xrun
5529 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5530         eval $xscan;\
5531         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5532                 eval $xrun
5533 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5534         eval $xscan;\
5535         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5536                 eval $xrun
5537 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5538         eval $xscan;\
5539         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5540                 eval $xrun
5541 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5542         eval $xscan;\
5543         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5544                 eval $xrun
5545 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5546         eval $xscan;\
5547         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5548                 eval $xrun
5549 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5550         eval $xscan;\
5551         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5552                 eval $xrun
5553 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5554         eval $xscan;\
5555         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5556                 eval $xrun
5557 else
5558         $nm -p $* 2>/dev/null >libc.tmp
5559         $grep fprintf libc.tmp > libc.ptf
5560         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5561                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5562         then
5563                 nm_opt='-p'
5564                 eval $xrun
5565         else
5566                 echo " "
5567                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5568                 com=''
5569                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5570                         for thisname in $libnames $libc; do
5571                                 $ar t $thisname >>libc.tmp
5572                         done
5573                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5574                         echo "Ok." >&4
5575                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5576                         # Repeat libc to extract forwarders to DLL entries too
5577                         for thisname in $libnames $libc; do
5578                                 $ar tv $thisname >>libc.tmp
5579                                 # Revision 50 of EMX has bug in $ar.
5580                                 # it will not extract forwarders to DLL entries
5581                                 # Use emximp which will extract exactly them.
5582                                 emximp -o tmp.imp $thisname \
5583                                     2>/dev/null && \
5584                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5585                                     < tmp.imp >>libc.tmp
5586                                 $rm tmp.imp
5587                         done
5588                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5589                         echo "Ok." >&4
5590                 else
5591                         echo "$ar didn't seem to work right." >&4
5592                         echo "Maybe this is a Cray...trying bld instead..." >&4
5593                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5594                         then
5595                                 for thisname in $libnames; do
5596                                         bld t $libnames | \
5597                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5598                                         $ar t $thisname >>libc.tmp
5599                                 done
5600                                 echo "Ok." >&4
5601                         else
5602                                 echo "That didn't work either.  Giving up." >&4
5603                                 exit 1
5604                         fi
5605                 fi
5606         fi
5607 fi
5608 nm_extract="$com"
5609 if $test -f /lib/syscalls.exp; then
5610         echo " "
5611         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5612         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5613 fi
5614 ;;
5615 esac
5616 $rm -f libnames libpath
5617
5618 : is a C symbol defined?
5619 csym='tlook=$1;
5620 case "$3" in
5621 -v) tf=libc.tmp; tc=""; tdc="";;
5622 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5623 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5624 esac;
5625 tx=yes;
5626 case "$reuseval-$4" in
5627 true-) ;;
5628 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5629 esac;
5630 case "$tx" in
5631 yes)
5632         case "$runnm" in
5633         true)
5634                 if $contains $tlook $tf >/dev/null 2>&1;
5635                 then tval=true;
5636                 else tval=false;
5637                 fi;;
5638         *)
5639                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5640                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5641                 then tval=true;
5642                 else tval=false;
5643                 fi;
5644                 $rm -f t t.c;;
5645         esac;;
5646 *)
5647         case "$tval" in
5648         $define) tval=true;;
5649         *) tval=false;;
5650         esac;;
5651 esac;
5652 eval "$2=$tval"'
5653
5654 : define an is-in-libc? function
5655 inlibc='echo " "; td=$define; tu=$undef;
5656 sym=$1; var=$2; eval "was=\$$2";
5657 tx=yes;
5658 case "$reuseval$was" in
5659 true) ;;
5660 true*) tx=no;;
5661 esac;
5662 case "$tx" in
5663 yes)
5664         set $sym tres -f;
5665         eval $csym;
5666         case "$tres" in
5667         true)
5668                 echo "$sym() found." >&4;
5669                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5670         *)
5671                 echo "$sym() NOT found." >&4;
5672                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5673         esac;;
5674 *)
5675         case "$was" in
5676         $define) echo "$sym() found." >&4;;
5677         *) echo "$sym() NOT found." >&4;;
5678         esac;;
5679 esac'
5680
5681 : see if sqrtl exists
5682 set sqrtl d_sqrtl
5683 eval $inlibc
5684
5685 case "$ccflags" in
5686 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5687 esac
5688
5689 case "$uselongdouble" in
5690 $define|true|[yY]*)     dflt='y';;
5691 *) dflt='n';;
5692 esac
5693 cat <<EOM
5694
5695 Perl can be built to take advantage of long doubles which
5696 (if available) may give more accuracy and range for floating point numbers.
5697
5698 If this doesn't make any sense to you, just accept the default '$dflt'.
5699 EOM
5700 rp='Try to use long doubles if available?'
5701 . ./myread
5702 case "$ans" in
5703 y|Y)    val="$define"   ;;
5704 *)      val="$undef"    ;;
5705 esac
5706 set uselongdouble
5707 eval $setvar
5708
5709 case "$uselongdouble" in
5710 true|[yY]*) uselongdouble="$define" ;;
5711 esac
5712
5713 case "$uselongdouble" in
5714 $define)
5715 : Look for a hint-file generated 'call-back-unit'.  If the
5716 : user has specified that long doubles should be used,
5717 : we may need to set or change some other defaults.
5718         if $test -f uselongdouble.cbu; then
5719                 echo "Your platform has some specific hints for long doubles, using them..."
5720                 . ./uselongdouble.cbu
5721         else
5722                 $cat <<EOM
5723 (Your platform doesn't have any specific hints for long doubles.)
5724 EOM
5725         fi
5726         ;;
5727 esac
5728
5729 case "$uselongdouble:$d_sqrtl" in
5730 $define:$undef)
5731                 $cat <<EOM >&4
5732
5733 *** You requested the use of long doubles but you do not seem to have
5734 *** the mathematic functions for long doubles.  I'm disabling the use
5735 *** of long doubles.
5736
5737 EOM
5738         uselongdouble=$undef
5739         ;;
5740 esac
5741
5742 : check for length of double
5743 echo " "
5744 case "$doublesize" in
5745 '')
5746         echo "Checking to see how big your double precision numbers are..." >&4
5747         $cat >try.c <<'EOCP'
5748 #include <stdio.h>
5749 int main()
5750 {
5751     printf("%d\n", (int)sizeof(double));
5752     exit(0);
5753 }
5754 EOCP
5755         set try
5756         if eval $compile_ok; then
5757                 doublesize=`$run ./try`
5758                 echo "Your double is $doublesize bytes long."
5759         else
5760                 dflt='8'
5761                 echo "(I can't seem to compile the test program.  Guessing...)"
5762                 rp="What is the size of a double precision number (in bytes)?"
5763                 . ./myread
5764                 doublesize="$ans"
5765         fi
5766         ;;
5767 esac
5768 $rm -f try.c try
5769
5770 : check for long doubles
5771 echo " "
5772 echo "Checking to see if you have long double..." >&4
5773 echo 'int main() { long double x = 7.0; }' > try.c
5774 set try
5775 if eval $compile; then
5776         val="$define"
5777         echo "You have long double."
5778 else
5779         val="$undef"
5780         echo "You do not have long double."
5781 fi
5782 $rm try.*
5783 set d_longdbl
5784 eval $setvar
5785
5786 : check for length of long double
5787 case "${d_longdbl}${longdblsize}" in
5788 $define)
5789         echo " "
5790         echo "Checking to see how big your long doubles are..." >&4
5791         $cat >try.c <<'EOCP'
5792 #include <stdio.h>
5793 int main()
5794 {
5795         printf("%d\n", sizeof(long double));
5796 }
5797 EOCP
5798         set try
5799         set try
5800         if eval $compile; then
5801                 longdblsize=`$run ./try`
5802                 echo "Your long doubles are $longdblsize bytes long."
5803         else
5804                 dflt='8'
5805                 echo " "
5806                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5807                 rp="What is the size of a long double (in bytes)?"
5808                 . ./myread
5809                 longdblsize="$ans"
5810         fi
5811         if $test "X$doublesize" = "X$longdblsize"; then
5812                 echo "(That isn't any different from an ordinary double.)"
5813         fi      
5814         ;;
5815 esac
5816 $rm -f try.* try
5817
5818 case "$useperlio" in
5819 $define|true|[yY]*|'')  dflt='y';;
5820 *) dflt='n';;
5821 esac
5822 cat <<EOM
5823
5824 Previous version of $package used the standard IO mechanisms as
5825 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5826 alternate IO mechanisms via the PerlIO abstraction layer, but the
5827 stdio mechanism is still available if needed.  The abstraction layer
5828 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5829 Using PerlIO with sfio may cause problems with some extension modules.
5830
5831 If this doesn't make any sense to you, just accept the default '$dflt'.
5832 EOM
5833 rp='Use the PerlIO abstraction layer?'
5834 . ./myread
5835 case "$ans" in
5836 y|Y) 
5837         val="$define"
5838         ;;
5839 *)      
5840         echo "Ok, doing things the stdio way."
5841         val="$undef"
5842         ;;
5843 esac
5844 set useperlio
5845 eval $setvar 
5846
5847 case "$usesocks" in
5848 $define|true|[yY]*)
5849         case "$useperlio" in
5850         $define|true|[yY]*) ;;
5851         *)      cat >&4 <<EOM
5852
5853 You are using the SOCKS proxy protocol library which means that you
5854 should also use the PerlIO layer.  You may be headed for trouble.
5855
5856 EOM
5857                 ;;
5858         esac
5859         ;;
5860 esac
5861
5862         
5863 : determine the architecture name
5864 echo " "
5865 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5866         tarch=`arch`"-$osname"
5867 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5868         if uname -m > tmparch 2>&1 ; then
5869                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5870                         -e 's/$/'"-$osname/" tmparch`
5871         else
5872                 tarch="$osname"
5873         fi
5874         $rm -f tmparch
5875 else
5876         tarch="$osname"
5877 fi
5878 case "$myarchname" in
5879 ''|"$tarch") ;;
5880 *)
5881         echo "(Your architecture name used to be $myarchname.)"
5882         archname=''
5883         ;;
5884 esac
5885 case "$targetarch" in
5886 '') ;;
5887 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5888 esac
5889 myarchname="$tarch"
5890 case "$archname" in
5891 '') dflt="$tarch";;
5892 *) dflt="$archname";;
5893 esac
5894 rp='What is your architecture name'
5895 . ./myread
5896 archname="$ans"
5897 case "$usethreads" in
5898 $define)
5899         echo "Threads selected." >&4
5900         case "$archname" in
5901         *-thread*) echo "...and architecture name already has -thread." >&4
5902                 ;;
5903         *)      archname="$archname-thread"
5904                 echo "...setting architecture name to $archname." >&4
5905                 ;;
5906         esac
5907         ;;
5908 esac
5909 case "$usemultiplicity" in
5910 $define)
5911         echo "Multiplicity selected." >&4
5912         case "$archname" in
5913         *-multi*) echo "...and architecture name already has -multi." >&4
5914                 ;;
5915         *)      archname="$archname-multi"
5916                 echo "...setting architecture name to $archname." >&4
5917                 ;;
5918         esac
5919         ;;
5920 esac
5921 case "$use64bitint$use64bitall" in
5922 *"$define"*)
5923         case "$archname64" in
5924         '')
5925                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5926                 ;;
5927         *)
5928                 case "$use64bitint" in
5929                 "$define") echo "64 bit integers selected." >&4 ;;
5930                 esac
5931                 case "$use64bitall" in
5932                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5933                 esac
5934                 case "$archname" in
5935                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5936                         ;;
5937                 *)      archname="$archname-$archname64"
5938                         echo "...setting architecture name to $archname." >&4
5939                         ;;
5940                 esac
5941                 ;;
5942         esac
5943 esac
5944 case "$uselongdouble" in
5945 $define)
5946         echo "Long doubles selected." >&4
5947         case "$longdblsize" in
5948         $doublesize)
5949                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5950                 ;;
5951         *)
5952                 case "$archname" in
5953                 *-ld*) echo "...and architecture name already has -ld." >&4
5954                         ;;
5955                 *)      archname="$archname-ld"
5956                         echo "...setting architecture name to $archname." >&4
5957                         ;;
5958                 esac
5959                 ;;
5960         esac
5961         ;;
5962 esac
5963 case "$useperlio" in
5964 $define)
5965         echo "Perlio selected." >&4
5966         ;;
5967 *)
5968         echo "Perlio not selected, using stdio." >&4
5969         case "$archname" in
5970         *-stdio*) echo "...and architecture name already has -stdio." >&4
5971                 ;;
5972         *)      archname="$archname-stdio"
5973                 echo "...setting architecture name to $archname." >&4
5974                 ;;
5975         esac
5976         ;;
5977 esac
5978
5979 : determine root of directory hierarchy where package will be installed.
5980 case "$prefix" in
5981 '')
5982         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5983         ;;
5984 *)
5985         dflt="$prefix"
5986         ;;
5987 esac
5988 $cat <<EOM
5989
5990 By default, $package will be installed in $dflt/bin, manual pages
5991 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5992 installation directories. Typically this is something like /usr/local.
5993 If you wish to have binaries under /usr/bin but other parts of the
5994 installation under /usr/local, that's ok: you will be prompted
5995 separately for each of the installation directories, the prefix being
5996 only used to set the defaults.
5997
5998 EOM
5999 fn=d~
6000 rp='Installation prefix to use?'
6001 . ./getfile
6002 oldprefix=''
6003 case "$prefix" in
6004 '') ;;
6005 *)
6006         case "$ans" in
6007         "$prefix") ;;
6008         *) oldprefix="$prefix";;
6009         esac
6010         ;;
6011 esac
6012 prefix="$ans"
6013 prefixexp="$ansexp"
6014
6015 case "$afsroot" in
6016 '')     afsroot=/afs ;;
6017 *)      afsroot=$afsroot ;;
6018 esac
6019
6020 : is AFS running?
6021 echo " "
6022 case "$afs" in
6023 $define|true)   afs=true ;;
6024 $undef|false)   afs=false ;;
6025 *)      if test -d $afsroot; then
6026                 afs=true
6027         else
6028                 afs=false
6029         fi
6030         ;;
6031 esac
6032 if $afs; then
6033         echo "AFS may be running... I'll be extra cautious then..." >&4
6034 else
6035         echo "AFS does not seem to be running..." >&4
6036 fi
6037
6038 : determine installation prefix for where package is to be installed.
6039 if $afs; then 
6040 $cat <<EOM
6041
6042 Since you are running AFS, I need to distinguish the directory in which
6043 files will reside from the directory in which they are installed (and from
6044 which they are presumably copied to the former directory by occult means).
6045
6046 EOM
6047         case "$installprefix" in
6048         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6049         *) dflt="$installprefix";;
6050         esac
6051 else
6052 $cat <<EOM
6053
6054 In some special cases, particularly when building $package for distribution,
6055 it is convenient to distinguish between the directory in which files should 
6056 be installed from the directory ($prefix) in which they 
6057 will eventually reside.  For most users, these two directories are the same.
6058
6059 EOM
6060         case "$installprefix" in
6061         '') dflt=$prefix ;;
6062         *) dflt=$installprefix;;
6063         esac
6064 fi
6065 fn=d~
6066 rp='What installation prefix should I use for installing files?'
6067 . ./getfile
6068 installprefix="$ans"
6069 installprefixexp="$ansexp"
6070
6071 : set the prefixit variable, to compute a suitable default value
6072 prefixit='case "$3" in
6073 ""|none)
6074         case "$oldprefix" in
6075         "") eval "$1=\"\$$2\"";;
6076         *)
6077                 case "$3" in
6078                 "") eval "$1=";;
6079                 none)
6080                         eval "tp=\"\$$2\"";
6081                         case "$tp" in
6082                         ""|" ") eval "$1=\"\$$2\"";;
6083                         *) eval "$1=";;
6084                         esac;;
6085                 esac;;
6086         esac;;
6087 *)
6088         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6089         case "$tp" in
6090         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6091         /*-$oldprefix/*|\~*-$oldprefix/*)
6092                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6093         *) eval "$1=\"\$$2\"";;
6094         esac;;
6095 esac'
6096
6097 : get the patchlevel
6098 echo " "
6099 echo "Getting the current patchlevel..." >&4
6100 if $test -r $rsrc/patchlevel.h;then
6101         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6102         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6103         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6104         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6105         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6106         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6107        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6108 else
6109         revision=0
6110         patchlevel=0
6111         subversion=0
6112         api_revision=0
6113         api_version=0
6114         api_subversion=0
6115         perl_patchlevel=0
6116         $echo "(You do not have patchlevel.h.  Eek.)"
6117 fi
6118 if $test -r $rsrc/.patch ; then  
6119         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6120                 perl_patchlevel=`cat $rsrc/.patch`
6121         fi
6122 fi
6123 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6124 version_patchlevel_string="version $patchlevel subversion $subversion"
6125 case "$perl_patchlevel" in
6126 0|'') ;;
6127 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6128 esac
6129
6130 $echo "(You have $package $version_patchlevel_string.)"
6131
6132 case "$osname" in
6133 dos|vms)
6134         : XXX Should be a Configure test for double-dots in filenames.
6135         version=`echo $revision $patchlevel $subversion | \
6136                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6137         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6138                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6139         ;;
6140 *)
6141         version=`echo $revision $patchlevel $subversion | \
6142                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6143         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6144                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6145         ;;
6146 esac
6147 : Special case the 5.005_xx maintenance series, which used 5.005
6148 : without any subversion label as a subdirectory in $sitelib
6149 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6150         api_versionstring='5.005'
6151 fi
6152
6153 : determine installation style
6154 : For now, try to deduce it from prefix unless it is already set.
6155 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6156 case "$installstyle" in
6157 '')     case "$prefix" in
6158                 *perl*) dflt='lib';;
6159                 *) dflt='lib/perl5' ;;
6160         esac
6161         ;;
6162 *)      dflt="$installstyle" ;;
6163 esac
6164 : Probably not worth prompting for this since we prompt for all
6165 : the directories individually, and the prompt would be too long and
6166 : confusing anyway.
6167 installstyle=$dflt
6168
6169 : determine where private library files go
6170 : Usual default is /usr/local/lib/perl5/$version.
6171 : Also allow things like /opt/perl/lib/$version, since 
6172 : /opt/perl/lib/perl5... would be redundant.
6173 : The default "style" setting is made in installstyle.U
6174 case "$installstyle" in
6175 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6176 *)       set dflt privlib lib/$version ;;
6177 esac
6178 eval $prefixit
6179 $cat <<EOM
6180
6181 There are some auxiliary files for $package that need to be put into a
6182 private library directory that is accessible by everyone.
6183
6184 EOM
6185 fn=d~+
6186 rp='Pathname where the private library files will reside?'
6187 . ./getfile
6188 privlib="$ans"
6189 privlibexp="$ansexp"
6190 : Change installation prefix, if necessary.
6191 if $test X"$prefix" != X"$installprefix"; then
6192         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6193 else
6194         installprivlib="$privlibexp"
6195 fi
6196
6197 : set the prefixup variable, to restore leading tilda escape
6198 prefixup='case "$prefixexp" in
6199 "$prefix") ;;
6200 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6201 esac'
6202
6203 : determine where public architecture dependent libraries go
6204 set archlib archlib
6205 eval $prefixit
6206 : privlib default is /usr/local/lib/$package/$version
6207 : archlib default is /usr/local/lib/$package/$version/$archname
6208 : privlib may have an optional trailing /share.
6209 tdflt=`echo $privlib | $sed 's,/share$,,'`
6210 tdflt=$tdflt/$archname
6211 case "$archlib" in
6212 '')     dflt=$tdflt
6213         ;;
6214 *)      dflt="$archlib"
6215     ;;
6216 esac
6217 $cat <<EOM
6218
6219 $spackage contains architecture-dependent library files.  If you are
6220 sharing libraries in a heterogeneous environment, you might store
6221 these files in a separate location.  Otherwise, you can just include
6222 them with the rest of the public library files.
6223
6224 EOM
6225 fn=d+~
6226 rp='Where do you want to put the public architecture-dependent libraries?'
6227 . ./getfile
6228 archlib="$ans"
6229 archlibexp="$ansexp"
6230 if $test X"$archlib" = X"$privlib"; then
6231         d_archlib="$undef"
6232 else
6233         d_archlib="$define"
6234 fi
6235 : Change installation prefix, if necessary.
6236 if $test X"$prefix" != X"$installprefix"; then
6237         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6238 else
6239         installarchlib="$archlibexp"
6240 fi
6241
6242
6243 : Binary compatibility with 5.005 is not possible for builds
6244 : with advanced features
6245 case "$usethreads$usemultiplicity" in
6246 *define*)
6247         bincompat5005="$undef"
6248         d_bincompat5005="$undef"
6249         ;;
6250 *)      $cat <<EOM
6251
6252 This version of Perl can be compiled for binary compatibility with 5.005.
6253 If you decide to do so, you will be able to continue using most of the
6254 extensions that were compiled for Perl 5.005.
6255
6256 EOM
6257         case "$bincompat5005$d_bincompat5005" in
6258         *"$undef"*) dflt=n ;;
6259         *) dflt=y ;;
6260         esac
6261         rp='Binary compatibility with Perl 5.005?'
6262         . ./myread
6263         case "$ans" in
6264         y*) val="$define" ;;
6265         *)  val="$undef" ;;
6266         esac
6267         set d_bincompat5005
6268         eval $setvar
6269         case "$d_bincompat5005" in
6270         "$define")
6271                 bincompat5005="$define"
6272                 ;;
6273         *)      bincompat5005="$undef"
6274                 d_bincompat5005="$undef"
6275                 ;;
6276         esac
6277         ;;
6278 esac
6279
6280
6281 : see if setuid scripts can be secure
6282 $cat <<EOM
6283
6284 Some kernels have a bug that prevents setuid #! scripts from being
6285 secure.  Some sites have disabled setuid #! scripts because of this.
6286
6287 First let's decide if your kernel supports secure setuid #! scripts.
6288 (If setuid #! scripts would be secure but have been disabled anyway,
6289 don't say that they are secure if asked.)
6290
6291 EOM
6292
6293 val="$undef"
6294 if $test -d /dev/fd; then
6295         echo "#!$ls" >reflect
6296         chmod +x,u+s reflect
6297         ./reflect >flect 2>&1
6298         if $contains "/dev/fd" flect >/dev/null; then
6299                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6300                 val="$define"
6301         else
6302                 $cat <<EOM
6303 If you are not sure if they are secure, I can check but I'll need a
6304 username and password different from the one you are using right now.
6305 If you don't have such a username or don't want me to test, simply
6306 enter 'none'.
6307
6308 EOM
6309                 rp='Other username to test security of setuid scripts with?'
6310                 dflt='none'
6311                 . ./myread
6312                 case "$ans" in
6313                 n|none)
6314                         case "$d_suidsafe" in
6315                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6316                                 dflt=n;;
6317                         "$undef")
6318                                 echo "Well, the $hint value is *not* secure." >&4
6319                                 dflt=n;;
6320                         *)      echo "Well, the $hint value *is* secure." >&4
6321                                 dflt=y;;
6322                         esac
6323                         ;;
6324                 *)
6325                         $rm -f reflect flect
6326                         echo "#!$ls" >reflect
6327                         chmod +x,u+s reflect
6328                         echo >flect
6329                         chmod a+w flect
6330                         echo '"su" will (probably) prompt you for '"$ans's password."
6331                         su $ans -c './reflect >flect'
6332                         if $contains "/dev/fd" flect >/dev/null; then
6333                                 echo "Okay, it looks like setuid scripts are secure." >&4
6334                                 dflt=y
6335                         else
6336                                 echo "I don't think setuid scripts are secure." >&4
6337                                 dflt=n
6338                         fi
6339                         ;;
6340                 esac
6341                 rp='Does your kernel have *secure* setuid scripts?'
6342                 . ./myread
6343                 case "$ans" in
6344                 [yY]*)  val="$define";;
6345                 *)      val="$undef";;
6346                 esac
6347         fi
6348 else
6349         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6350         echo "(That's for file descriptors, not floppy disks.)"
6351         val="$undef"
6352 fi
6353 set d_suidsafe
6354 eval $setvar
6355
6356 $rm -f reflect flect
6357
6358 : now see if they want to do setuid emulation
6359 echo " "
6360 val="$undef"
6361 case "$d_suidsafe" in
6362 "$define")
6363         val="$undef"
6364         echo "No need to emulate SUID scripts since they are secure here." >& 4
6365         ;;
6366 *)
6367         $cat <<EOM
6368 Some systems have disabled setuid scripts, especially systems where
6369 setuid scripts cannot be secure.  On systems where setuid scripts have
6370 been disabled, the setuid/setgid bits on scripts are currently
6371 useless.  It is possible for $package to detect those bits and emulate
6372 setuid/setgid in a secure fashion.  This emulation will only work if
6373 setuid scripts have been disabled in your kernel.
6374
6375 EOM
6376         case "$d_dosuid" in
6377         "$define") dflt=y ;;
6378         *) dflt=n ;;
6379         esac
6380         rp="Do you want to do setuid/setgid emulation?"
6381         . ./myread
6382         case "$ans" in
6383         [yY]*)  val="$define";;
6384         *)      val="$undef";;
6385         esac
6386         ;;
6387 esac
6388 set d_dosuid
6389 eval $setvar
6390
6391 : see if this is a malloc.h system
6392 set malloc.h i_malloc
6393 eval $inhdr
6394
6395 : see if stdlib is available
6396 set stdlib.h i_stdlib
6397 eval $inhdr
6398
6399 : determine which malloc to compile in
6400 echo " "
6401 case "$usemymalloc" in
6402 [yY]*|true|$define)     dflt='y' ;;
6403 [nN]*|false|$undef)     dflt='n' ;;
6404 *)      case "$ptrsize" in
6405         4) dflt='y' ;;
6406         *) dflt='n' ;;
6407         esac
6408         ;;
6409 esac
6410 rp="Do you wish to attempt to use the malloc that comes with $package?"
6411 . ./myread
6412 usemymalloc="$ans"
6413 case "$ans" in
6414 y*|true)
6415         usemymalloc='y'
6416         mallocsrc='malloc.c'
6417         mallocobj="malloc$_o"
6418         d_mymalloc="$define"
6419         case "$libs" in
6420         *-lmalloc*)
6421                 : Remove malloc from list of libraries to use
6422                 echo "Removing unneeded -lmalloc from library list" >&4
6423                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6424                 shift
6425                 libs="$*"
6426                 echo "libs = $libs" >&4
6427                 ;;
6428         esac
6429         ;;
6430 *)
6431         usemymalloc='n'
6432         mallocsrc=''
6433         mallocobj=''
6434         d_mymalloc="$undef"
6435         ;;
6436 esac
6437
6438 : compute the return types of malloc and free
6439 echo " "
6440 $cat >malloc.c <<END
6441 #$i_malloc I_MALLOC
6442 #$i_stdlib I_STDLIB
6443 #include <stdio.h>
6444 #include <sys/types.h>
6445 #ifdef I_MALLOC
6446 #include <malloc.h>
6447 #endif
6448 #ifdef I_STDLIB
6449 #include <stdlib.h>
6450 #endif
6451 #ifdef TRY_MALLOC
6452 void *malloc();
6453 #endif
6454 #ifdef TRY_FREE
6455 void free();
6456 #endif
6457 END
6458 case "$malloctype" in
6459 '')
6460         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6461                 malloctype='void *'
6462         else
6463                 malloctype='char *'
6464         fi
6465         ;;
6466 esac
6467 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6468
6469 case "$freetype" in
6470 '')
6471         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6472                 freetype='void'
6473         else
6474                 freetype='int'
6475         fi
6476         ;;
6477 esac
6478 echo "Your system uses $freetype free(), it would seem." >&4
6479 $rm -f malloc.[co]
6480 $cat <<EOM
6481
6482 After $package is installed, you may wish to install various
6483 add-on modules and utilities.  Typically, these add-ons will
6484 be installed under $prefix with the rest
6485 of this package.  However, you may wish to install such add-ons
6486 elsewhere under a different prefix.
6487
6488 If you do not wish to put everything under a single prefix, that's
6489 ok.  You will be prompted for the individual locations; this siteprefix
6490 is only used to suggest the defaults.
6491
6492 The default should be fine for most people.
6493
6494 EOM
6495 fn=d~+
6496 rp='Installation prefix to use for add-on modules and utilities?'
6497 : XXX Here might be another good place for an installstyle setting.
6498 case "$siteprefix" in
6499 '') dflt=$prefix ;;
6500 *)  dflt=$siteprefix ;;
6501 esac
6502 . ./getfile
6503 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6504 oldsiteprefix=''
6505 case "$siteprefix" in
6506 '') ;;
6507 *)      case "$ans" in
6508         "$prefix") ;;
6509         *) oldsiteprefix="$prefix";;
6510         esac
6511         ;;
6512 esac
6513 siteprefix="$ans"
6514 siteprefixexp="$ansexp"
6515
6516 : determine where site specific libraries go.
6517 : Usual default is /usr/local/lib/perl5/site_perl/$version
6518 : The default "style" setting is made in installstyle.U
6519 : XXX No longer works with Prefixit stuff.
6520 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6521 case "$sitelib" in
6522 '') case "$installstyle" in
6523         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6524         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6525         esac
6526         ;;
6527 *)      dflt="$sitelib"
6528         ;;
6529 esac
6530 $cat <<EOM
6531
6532 The installation process will create a directory for
6533 site-specific extensions and modules.  Most users find it convenient
6534 to place all site-specific files in this directory rather than in the
6535 main distribution directory.
6536
6537 EOM
6538 fn=d~+
6539 rp='Pathname for the site-specific library files?'
6540 . ./getfile
6541 sitelib="$ans"
6542 sitelibexp="$ansexp"
6543 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6544 : Change installation prefix, if necessary.
6545 if $test X"$prefix" != X"$installprefix"; then
6546         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6547 else
6548         installsitelib="$sitelibexp"
6549 fi
6550
6551 : determine where site specific architecture-dependent libraries go.
6552 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6553 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6554 : sitelib may have an optional trailing /share.
6555 case "$sitearch" in
6556 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6557         dflt="$dflt/$archname"
6558         ;;
6559 *)      dflt="$sitearch"
6560         ;;
6561 esac
6562 set sitearch sitearch none
6563 eval $prefixit
6564 $cat <<EOM
6565
6566 The installation process will also create a directory for
6567 architecture-dependent site-specific extensions and modules.
6568
6569 EOM
6570 fn=d~+
6571 rp='Pathname for the site-specific architecture-dependent library files?'
6572 . ./getfile
6573 sitearch="$ans"
6574 sitearchexp="$ansexp"
6575 : Change installation prefix, if necessary.
6576 if $test X"$prefix" != X"$installprefix"; then
6577         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6578 else
6579         installsitearch="$sitearchexp"
6580 fi
6581
6582 $cat <<EOM
6583
6584 The installation process will also create a directory for
6585 vendor-supplied add-ons.  Vendors who supply perl with their system
6586 may find it convenient to place all vendor-supplied files in this
6587 directory rather than in the main distribution directory.  This will
6588 ease upgrades between binary-compatible maintenance versions of perl.
6589
6590 Of course you may also use these directories in whatever way you see
6591 fit.  For example, you might use them to access modules shared over a
6592 company-wide network.
6593
6594 The default answer should be fine for most people.
6595 This causes further questions about vendor add-ons to be skipped
6596 and no vendor-specific directories will be configured for perl.
6597
6598 EOM
6599 rp='Do you want to configure vendor-specific add-on directories?'
6600 case "$usevendorprefix" in
6601 define|true|[yY]*) dflt=y ;;
6602 *)      : User may have set vendorprefix directly on Configure command line.
6603         case "$vendorprefix" in
6604         ''|' ') dflt=n ;;
6605         *)      dflt=y ;;
6606         esac
6607         ;;
6608 esac
6609 . ./myread
6610 case "$ans" in
6611 [yY]*)  fn=d~+
6612         rp='Installation prefix to use for vendor-supplied add-ons?'
6613         case "$vendorprefix" in
6614         '') dflt='' ;;
6615         *)  dflt=$vendorprefix ;;
6616         esac
6617         . ./getfile
6618         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6619         oldvendorprefix=''
6620         case "$vendorprefix" in
6621         '') ;;
6622         *)      case "$ans" in
6623                 "$prefix") ;;
6624                 *) oldvendorprefix="$prefix";;
6625                 esac
6626                 ;;
6627         esac
6628         usevendorprefix="$define"
6629         vendorprefix="$ans"
6630         vendorprefixexp="$ansexp"
6631         ;;
6632 *)      usevendorprefix="$undef"
6633         vendorprefix=''
6634         vendorprefixexp=''
6635         ;;
6636 esac
6637
6638 case "$vendorprefix" in
6639 '')     d_vendorlib="$undef"
6640         vendorlib=''
6641         vendorlibexp=''
6642         ;;
6643 *)      d_vendorlib="$define"
6644         : determine where vendor-supplied modules go.
6645         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6646         case "$vendorlib" in
6647         '')
6648                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6649                 case "$installstyle" in
6650                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6651                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6652                 esac
6653                 ;;
6654         *)      dflt="$vendorlib"
6655                 ;;
6656         esac
6657         fn=d~+
6658         rp='Pathname for the vendor-supplied library files?'
6659         . ./getfile
6660         vendorlib="$ans"
6661         vendorlibexp="$ansexp"
6662         ;;
6663 esac
6664 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6665 : Change installation prefix, if necessary.
6666 if $test X"$prefix" != X"$installprefix"; then
6667         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6668 else
6669         installvendorlib="$vendorlibexp"
6670 fi
6671
6672 case "$vendorprefix" in
6673 '')     d_vendorarch="$undef"
6674         vendorarch=''
6675         vendorarchexp=''
6676         ;;
6677 *)      d_vendorarch="$define"
6678         : determine where vendor-supplied architecture-dependent libraries go.
6679         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6680         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6681         : vendorlib may have an optional trailing /share.
6682         case "$vendorarch" in
6683         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6684                 dflt="$dflt/$archname"
6685                 ;;
6686         *)      dflt="$vendorarch" ;;
6687         esac
6688         fn=d~+
6689         rp='Pathname for vendor-supplied architecture-dependent files?'
6690         . ./getfile
6691         vendorarch="$ans"
6692         vendorarchexp="$ansexp"
6693         ;;
6694 esac
6695 : Change installation prefix, if necessary.
6696 if $test X"$prefix" != X"$installprefix"; then
6697         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6698 else
6699         installvendorarch="$vendorarchexp"
6700 fi
6701
6702 : Final catch-all directories to search
6703 $cat <<EOM
6704
6705 Lastly, you can have perl look in other directories for extensions and
6706 modules in addition to those already specified.
6707 These directories will be searched after 
6708         $sitearch 
6709         $sitelib 
6710 EOM
6711 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6712 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6713 echo ' '
6714 case "$otherlibdirs" in
6715 ''|' ') dflt='none' ;;
6716 *)      dflt="$otherlibdirs" ;;
6717 esac
6718 $cat <<EOM
6719 Enter a colon-separated set of extra paths to include in perl's @INC
6720 search path, or enter 'none' for no extra paths.
6721
6722 EOM
6723
6724 rp='Colon-separated list of additional directories for perl to search?'
6725 . ./myread
6726 case "$ans" in
6727 ' '|''|none)    otherlibdirs=' ' ;;     
6728 *)      otherlibdirs="$ans" ;;
6729 esac
6730 case "$otherlibdirs" in
6731 ' ') val=$undef ;;
6732 *)      val=$define ;;
6733 esac
6734 set d_perl_otherlibdirs
6735 eval $setvar
6736
6737 : Cruising for prototypes
6738 echo " "
6739 echo "Checking out function prototypes..." >&4
6740 $cat >prototype.c <<'EOCP'
6741 int main(int argc, char *argv[]) {
6742         exit(0);}
6743 EOCP
6744 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6745         echo "Your C compiler appears to support function prototypes."
6746         val="$define"
6747 else
6748         echo "Your C compiler doesn't seem to understand function prototypes."
6749         val="$undef"
6750 fi
6751 set prototype
6752 eval $setvar
6753 $rm -f prototype*
6754
6755 case "$prototype" in
6756 "$define") ;;
6757 *)      ansi2knr='ansi2knr'
6758         echo " "
6759         cat <<EOM >&4
6760
6761 $me:  FATAL ERROR:
6762 This version of $package can only be compiled by a compiler that 
6763 understands function prototypes.  Unfortunately, your C compiler 
6764         $cc $ccflags
6765 doesn't seem to understand them.  Sorry about that.
6766
6767 If GNU cc is available for your system, perhaps you could try that instead.  
6768
6769 Eventually, we hope to support building Perl with pre-ANSI compilers.
6770 If you would like to help in that effort, please contact <perlbug@perl.org>.
6771
6772 Aborting Configure now.
6773 EOM
6774         exit 2
6775         ;;
6776 esac
6777
6778 : determine where public executables go
6779 echo " "
6780 set dflt bin bin
6781 eval $prefixit
6782 fn=d~
6783 rp='Pathname where the public executables will reside?'
6784 . ./getfile
6785 if $test "X$ansexp" != "X$binexp"; then
6786         installbin=''
6787 fi
6788 bin="$ans"
6789 binexp="$ansexp"
6790 : Change installation prefix, if necessary.
6791 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6792 if $test X"$prefix" != X"$installprefix"; then
6793         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6794 else
6795         installbin="$binexp"
6796 fi
6797
6798 echo " "
6799 case "$extras" in
6800 '') dflt='n';;
6801 *) dflt='y';;
6802 esac
6803 cat <<EOM
6804 Perl can be built with extra modules or bundles of modules which
6805 will be fetched from the CPAN and installed alongside Perl.
6806
6807 Notice that you will need access to the CPAN; either via the Internet,
6808 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6809 be asked later to configure the CPAN.pm module which will in turn do
6810 the installation of the rest of the extra modules or bundles.)
6811
6812 Notice also that if the modules require any external software such as
6813 libraries and headers (the libz library and the zlib.h header for the
6814 Compress::Zlib module, for example) you MUST have any such software
6815 already installed, this configuration process will NOT install such
6816 things for you.
6817
6818 If this doesn't make any sense to you, just accept the default '$dflt'.
6819 EOM
6820 rp='Install any extra modules (y or n)?'
6821 . ./myread
6822 case "$ans" in
6823 y|Y)
6824         cat <<EOM
6825
6826 Please list any extra modules or bundles to be installed from CPAN,
6827 with spaces between the names.  The names can be in any format the
6828 'install' command of CPAN.pm will understand.  (Answer 'none',
6829 without the quotes, to install no extra modules or bundles.)
6830 EOM
6831         rp='Extras?'
6832         dflt="$extras"
6833         . ./myread
6834         extras="$ans"
6835 esac
6836 case "$extras" in
6837 ''|'none')
6838         val=''
6839         $rm -f ../extras.lst
6840         ;;
6841 *)      echo "(Saving the list of extras for later...)"
6842         echo "$extras" > ../extras.lst
6843         val="'$extras'"
6844         ;;
6845 esac
6846 set extras
6847 eval $setvar
6848 echo " "
6849
6850 : Find perl5.005 or later.
6851 echo "Looking for a previously installed perl5.005 or later... "
6852 case "$perl5" in
6853 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6854                 : Check if this perl is recent and can load a simple module
6855                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6856                         perl5=$tdir/perl
6857                         break;
6858                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6859                         perl5=$tdir/perl5
6860                         break;
6861                 fi
6862         done
6863         ;;
6864 *)      perl5="$perl5"
6865         ;;
6866 esac
6867 case "$perl5" in
6868 '')     echo "None found.  That's ok.";;
6869 *)      echo "Using $perl5." ;;
6870 esac
6871
6872 : Determine list of previous versions to include in @INC
6873 $cat > getverlist <<EOPL
6874 #!$perl5 -w
6875 use File::Basename;
6876 \$api_versionstring = "$api_versionstring";
6877 \$version = "$version";
6878 \$stem = "$sitelib_stem";
6879 \$archname = "$archname";
6880 EOPL
6881         $cat >> getverlist <<'EOPL'
6882 # Can't have leading @ because metaconfig interprets it as a command!
6883 ;@inc_version_list=();
6884 # XXX Redo to do opendir/readdir? 
6885 if (-d $stem) {
6886     chdir($stem);
6887     ;@candidates = glob("5.*");
6888 }
6889 else {
6890     ;@candidates = ();
6891 }
6892
6893 # XXX ToDo:  These comparisons must be reworked when two-digit
6894 # subversions come along, so that 5.7.10 compares as greater than
6895 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6896 # widespread that we can use the built-in version vectors rather
6897 # than reinventing them here.  For 5.6.0, however, we must
6898 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6899 foreach $d (@candidates) {
6900     if ($d lt $version) {
6901         if ($d ge $api_versionstring) {
6902             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6903         }
6904         elsif ($d ge "5.005") {
6905             unshift(@inc_version_list, grep { -d } $d);
6906         }
6907     }
6908     else {
6909         # Skip newer version.  I.e. don't look in
6910         # 5.7.0 if we're installing 5.6.1.
6911     }
6912 }
6913
6914 if (@inc_version_list) {
6915     print join(' ', @inc_version_list);
6916 }
6917 else {
6918     # Blank space to preserve value for next Configure run.
6919     print " ";
6920 }
6921 EOPL
6922 chmod +x getverlist
6923 case "$inc_version_list" in
6924 '')     if test -x "$perl5$exe_ext"; then
6925                 dflt=`$perl5 getverlist`
6926         else
6927                 dflt='none'
6928         fi
6929         ;;
6930 $undef) dflt='none' ;;
6931 *)  eval dflt=\"$inc_version_list\" ;;
6932 esac
6933 case "$dflt" in
6934 ''|' ') dflt=none ;;
6935 esac
6936 case "$dflt" in
6937 5.005) case "$bincompat5005" in
6938        $define|true|[yY]*) ;;
6939        *) dflt=none ;;
6940        esac
6941        ;;
6942 esac
6943 $cat <<'EOM'
6944
6945 In order to ease the process of upgrading, this version of perl 
6946 can be configured to use modules built and installed with earlier 
6947 versions of perl that were installed under $prefix.  Specify here
6948 the list of earlier versions that this version of perl should check.
6949 If Configure detected no earlier versions of perl installed under
6950 $prefix, then the list will be empty.  Answer 'none' to tell perl
6951 to not search earlier versions.
6952
6953 The default should almost always be sensible, so if you're not sure,
6954 just accept the default.
6955 EOM
6956
6957 rp='List of earlier versions to include in @INC?'
6958 . ./myread
6959 case "$ans" in
6960 [Nn]one|''|' ') inc_version_list=' ' ;;
6961 *) inc_version_list="$ans" ;;
6962 esac
6963 case "$inc_version_list" in
6964 ''|' ') 
6965         inc_version_list_init='0';;
6966 *)      inc_version_list_init=`echo $inc_version_list |
6967                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6968         ;;
6969 esac
6970 $rm -f getverlist
6971
6972 : determine whether to install perl also as /usr/bin/perl
6973
6974 echo " "
6975 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6976         $cat <<EOM
6977 Many scripts expect perl to be installed as /usr/bin/perl.
6978 I can install the perl you are about to compile also as /usr/bin/perl
6979 (in addition to $installbin/perl).
6980 EOM
6981         case "$installusrbinperl" in
6982         "$undef"|[nN]*) dflt='n';;
6983         *)              dflt='y';;
6984         esac
6985         rp="Do you want to install perl as /usr/bin/perl?"
6986         . ./myread
6987         case "$ans" in
6988         [yY]*)  val="$define";;
6989         *)      val="$undef" ;;
6990         esac
6991 else
6992         val="$undef"
6993 fi
6994 set installusrbinperl
6995 eval $setvar
6996
6997 : see if dld is available
6998 set dld.h i_dld
6999 eval $inhdr
7000
7001 : see if dlopen exists
7002 xxx_runnm="$runnm"
7003 runnm=false
7004 set dlopen d_dlopen
7005 eval $inlibc
7006 runnm="$xxx_runnm"
7007
7008 : determine which dynamic loading, if any, to compile in
7009 echo " "
7010 dldir="ext/DynaLoader"
7011 case "$usedl" in
7012 $define|y|true)
7013         dflt='y'
7014         usedl="$define"
7015         ;;
7016 $undef|n|false)
7017         dflt='n'
7018         usedl="$undef"
7019         ;;
7020 *) 
7021         dflt='n'
7022         case "$d_dlopen" in
7023             $define) dflt='y' ;;
7024         esac
7025         case "$i_dld" in
7026             $define) dflt='y' ;;
7027         esac
7028         : Does a dl_xxx.xs file exist for this operating system
7029         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7030         ;;
7031 esac
7032 rp="Do you wish to use dynamic loading?"
7033 . ./myread
7034 usedl="$ans"
7035 case "$ans" in
7036 y*) usedl="$define"
7037         case "$dlsrc" in
7038         '')
7039                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7040                         dflt="$dldir/dl_${osname}.xs"
7041                 elif $test "$d_dlopen" = "$define" ; then
7042                         dflt="$dldir/dl_dlopen.xs"
7043                 elif $test "$i_dld" = "$define" ; then
7044                         dflt="$dldir/dl_dld.xs"
7045                 else
7046                         dflt=''
7047                 fi
7048                 ;;
7049         *)      dflt="$dldir/$dlsrc"
7050                 ;;
7051         esac
7052     echo "The following dynamic loading files are available:"
7053         : Can not go over to $dldir because getfile has path hard-coded in.
7054         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7055         rp="Source file to use for dynamic loading"
7056         fn="fne"
7057         gfpth="$src"
7058         . ./getfile
7059         usedl="$define"
7060         : emulate basename
7061         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7062
7063         $cat << EOM
7064
7065 Some systems may require passing special flags to $cc -c to
7066 compile modules that will be used to create a shared library.
7067 To use no flags, say "none".
7068
7069 EOM
7070     case "$cccdlflags" in
7071     '') case "$gccversion" in
7072                 '') case "$osname" in
7073                         hpux)   dflt='+z' ;;
7074                         next)   dflt='none' ;;
7075                         irix*)  dflt='-KPIC' ;;
7076                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7077                         sunos)  dflt='-pic' ;;
7078                         *)      dflt='none' ;;
7079                     esac
7080                         ;;
7081                 *)  case "$osname" in
7082                         darwin) dflt='none' ;;
7083                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7084                         *)      dflt='-fpic' ;;
7085                     esac ;;
7086             esac ;;
7087         ' ') dflt='none' ;;
7088     *)  dflt="$cccdlflags" ;;
7089     esac
7090     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7091     . ./myread
7092     case "$ans" in
7093     none) cccdlflags=' ' ;;
7094     *) cccdlflags="$ans" ;;
7095     esac
7096
7097     cat << EOM
7098
7099 Some systems use ld to create libraries that can be dynamically loaded,
7100 while other systems (such as those using ELF) use $cc.
7101
7102 EOM
7103         case "$ld" in
7104         '')     $cat >try.c <<'EOM'
7105 /* Test for whether ELF binaries are produced */
7106 #include <fcntl.h>
7107 #include <stdlib.h>
7108 int main() {
7109         char b[4];
7110         int i = open("a.out",O_RDONLY);
7111         if(i == -1) 
7112                 exit(1); /* fail */
7113         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7114                 exit(0); /* succeed (yes, it's ELF) */
7115         else
7116                 exit(1); /* fail */
7117 }
7118 EOM
7119                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7120                         cat <<EOM
7121 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7122 EOM
7123                         dflt="$cc"
7124                 else
7125                         echo "I'll use ld to build dynamic libraries."
7126                         dflt='ld'
7127                 fi
7128                 rm -f try.c a.out
7129                 ;;
7130         *)      dflt="$ld"
7131                 ;;
7132         esac
7133
7134     rp="What command should be used to create dynamic libraries?"
7135     . ./myread
7136         ld="$ans"
7137
7138     cat << EOM
7139
7140 Some systems may require passing special flags to $ld to create a
7141 library that can be dynamically loaded.  If your ld flags include
7142 -L/other/path options to locate libraries outside your loader's normal
7143 search path, you may need to specify those -L options here as well.  To
7144 use no flags, say "none".
7145
7146 EOM
7147     case "$lddlflags" in
7148     '') case "$osname" in
7149                         beos) dflt='-nostart' ;;
7150                         hpux) dflt='-b';
7151                               case "$gccversion" in
7152                               '') dflt="$dflt +vnocompatwarnings" ;;
7153                               esac
7154                               ;;        
7155                         linux|irix*)    dflt='-shared' ;;
7156                         next)  dflt='none' ;;
7157                         solaris) dflt='-G' ;;
7158                         sunos) dflt='-assert nodefinitions' ;;
7159                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7160                 *)     dflt='none' ;;
7161                         esac
7162                         ;;
7163     *) dflt="$lddlflags" ;;
7164     esac
7165
7166         : Try to guess additional flags to pick up local libraries.
7167         : Be careful not to append to a plain 'none'
7168         case "$dflt" in
7169         none) dflt='' ;;
7170         esac
7171         for thisflag in $ldflags; do
7172                 case "$thisflag" in
7173                 -L*|-R*)
7174                         case " $dflt " in
7175                         *" $thisflag "*) ;;
7176                         *) dflt="$dflt $thisflag" ;;
7177                         esac
7178                         ;;
7179                 esac
7180         done
7181
7182         case "$dflt" in
7183         ''|' ') dflt='none' ;;
7184         esac
7185
7186     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7187     . ./myread
7188     case "$ans" in
7189     none) lddlflags=' ' ;;
7190     *) lddlflags="$ans" ;;
7191     esac
7192
7193         cat <<EOM
7194
7195 Some systems may require passing special flags to $cc to indicate that
7196 the resulting executable will use dynamic linking.  To use no flags,
7197 say "none".
7198
7199 EOM
7200     case "$ccdlflags" in
7201     '') case "$osname" in
7202                 hpux)   dflt='-Wl,-E' ;;
7203                 linux)  dflt='-rdynamic' ;;
7204                 next)   dflt='none' ;;
7205                 sunos)  dflt='none' ;;
7206                 *)      dflt='none' ;;
7207             esac ;;
7208     ' ')  dflt='none' ;;
7209     *)  dflt="$ccdlflags" ;;
7210     esac
7211     rp="Any special flags to pass to $cc to use dynamic linking?"
7212     . ./myread
7213     case "$ans" in
7214     none) ccdlflags=' ' ;;
7215     *) ccdlflags="$ans" ;;
7216     esac
7217     ;;
7218 *)  usedl="$undef"
7219         ld='ld'
7220     dlsrc='dl_none.xs'
7221     lddlflags=''
7222     ccdlflags=''
7223     ;;
7224 esac
7225
7226 also=''
7227 case "$usedl" in
7228 $undef)
7229         # No dynamic loading being used, so don't bother even to prompt.
7230         useshrplib='false'
7231         ;;
7232 *)      case "$useshrplib" in
7233         '')     case "$osname" in
7234                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7235                         dflt=y
7236                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7237                         ;;
7238                 next*)
7239                         case "$osvers" in
7240                         4*)     dflt=y
7241                                 also='Building a shared libperl is needed for MAB support.'
7242                                 ;;
7243                         *)      dflt=n
7244                                 ;;
7245                         esac
7246                         ;;
7247                 *)      dflt=n
7248                         ;;
7249                 esac
7250                 ;;
7251         $define|true|[Yy]*)
7252                 dflt=y
7253                 ;;
7254         *)      dflt=n
7255                 ;;
7256         esac
7257         $cat << EOM
7258
7259 The perl executable is normally obtained by linking perlmain.c with
7260 libperl${_a}, any static extensions (usually just DynaLoader), and
7261 any other libraries needed on this system (such as -lm, etc.).  Since
7262 your system supports dynamic loading, it is probably possible to build
7263 a shared libperl.$so.  If you will have more than one executable linked
7264 to libperl.$so, this will significantly reduce the size of each
7265 executable, but it may have a noticeable affect on performance.  The
7266 default is probably sensible for your system.
7267 $also
7268
7269 EOM
7270         rp="Build a shared libperl.$so (y/n)"
7271         . ./myread
7272         case "$ans" in
7273         true|$define|[Yy]*)
7274                 useshrplib='true'  ;;
7275         *)      useshrplib='false' ;;
7276         esac
7277         ;;
7278 esac
7279
7280 case "$useshrplib" in
7281 true)
7282         case "$libperl" in
7283         '')
7284                 # Figure out a good name for libperl.so.  Since it gets stored in
7285                 # a version-specific architecture-dependent library, the version
7286                 # number isn't really that important, except for making cc/ld happy.
7287                 #
7288                 # A name such as libperl.so.3.1
7289                 majmin="libperl.$so.$patchlevel.$subversion"
7290                 # A name such as libperl.so.301
7291                 majonly=`echo $patchlevel $subversion |
7292                         $awk '{printf "%d%02d", $1, $2}'`
7293                 majonly=libperl.$so.$majonly
7294                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7295                 # rely on figuring it out from the naming of libc.
7296                 case "${osname}${osvers}" in
7297                 next4*)
7298                         dflt=libperl.5.$so
7299                         # XXX How handle the --version stuff for MAB?
7300                         ;;
7301                 linux*)  # ld won't link with a bare -lperl otherwise.
7302                         dflt=libperl.$so
7303                         ;;
7304                 cygwin*) # include version
7305                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7306                         ;;
7307                 *)      # Try to guess based on whether libc has major.minor.
7308                         case "$libc" in
7309                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7310                         *libc.$so.[0-9]*) dflt=$majonly ;;
7311                         *)      dflt=libperl.$so ;;
7312                         esac
7313                         ;;
7314                 esac
7315                 ;;
7316         *)      dflt=$libperl
7317                 ;;
7318         esac
7319         cat << EOM
7320
7321 I need to select a good name for the shared libperl.  If your system uses
7322 library names with major and minor numbers, then you might want something
7323 like $majmin.  Alternatively, if your system uses a single version
7324 number for shared libraries, then you might want to use $majonly.
7325 Or, your system might be quite happy with a simple libperl.$so.
7326
7327 Since the shared libperl will get installed into a version-specific
7328 architecture-dependent directory, the version number of the shared perl
7329 library probably isn't important, so the default should be o.k.
7330
7331 EOM
7332         rp='What name do you want to give to the shared libperl?'
7333         . ./myread
7334         libperl=$ans
7335         echo "Ok, I'll use $libperl"
7336         ;;
7337 *)
7338         libperl="libperl${_a}"
7339         ;;
7340 esac
7341
7342 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7343 case "$shrpdir" in
7344 '') ;;
7345 *)      $cat >&4 <<EOM
7346 WARNING:  Use of the shrpdir variable for the installation location of
7347 the shared $libperl is not supported.  It was never documented and
7348 will not work in this version.  Let me (perlbug@perl.org)
7349 know of any problems this may cause.
7350
7351 EOM
7352         case "$shrpdir" in
7353         "$archlibexp/CORE")
7354                 $cat >&4 <<EOM
7355 But your current setting of $shrpdir is
7356 the default anyway, so it's harmless.
7357 EOM
7358                 ;;
7359         *)
7360                 $cat >&4 <<EOM
7361 Further, your current attempted setting of $shrpdir
7362 conflicts with the value of $archlibexp/CORE
7363 that installperl will use.
7364 EOM
7365                 ;;
7366         esac
7367         ;;
7368 esac
7369
7370 # How will the perl executable find the installed shared $libperl?
7371 # Add $xxx to ccdlflags.
7372 # If we can't figure out a command-line option, use $shrpenv to
7373 # set env LD_RUN_PATH.  The main perl makefile uses this.
7374 shrpdir=$archlibexp/CORE
7375 xxx=''
7376 tmp_shrpenv=''
7377 if "$useshrplib"; then
7378     case "$osname" in 
7379         aix)
7380                 # We'll set it in Makefile.SH...
7381                 ;;
7382         solaris|netbsd)
7383                 xxx="-R $shrpdir"
7384                 ;;
7385         freebsd)
7386                 xxx="-Wl,-R$shrpdir"
7387                 ;;
7388         linux|irix*|dec_osf)
7389                 xxx="-Wl,-rpath,$shrpdir"
7390                 ;;
7391         next)
7392                 # next doesn't like the default...
7393                 ;;
7394         beos)
7395                 # beos doesn't like the default, either.
7396                 ;;
7397         hpux*)
7398                 # hpux doesn't like the default, either.
7399                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7400                 ;;
7401         *)
7402                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7403                 ;;
7404         esac
7405         case "$xxx" in
7406         '') ;;
7407         *)      
7408                 # Only add $xxx if it isn't already in ccdlflags.
7409                 case " $ccdlflags " in
7410                 *" $xxx "*)     ;;
7411                 *)      ccdlflags="$ccdlflags $xxx"
7412                         cat <<EOM >&4
7413
7414 Adding $xxx to the flags
7415 passed to $ld so that the perl executable will find the 
7416 installed shared $libperl.
7417
7418 EOM
7419                         ;;
7420                 esac
7421                 ;;
7422         esac
7423 fi
7424 # Fix ccdlflags in AIX for building external extensions.
7425 # (For building Perl itself bare -bE:perl.exp is needed,
7426 #  Makefile.SH takes care of this.)
7427 case "$osname" in
7428 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7429 esac
7430 # Respect a hint or command-line value.
7431 case "$shrpenv" in
7432 '') shrpenv="$tmp_shrpenv" ;;
7433 esac
7434 case "$ldlibpthname" in
7435 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7436 none)   ldlibpthname='' ;;
7437 esac
7438
7439 : determine where manual pages are on this system
7440 echo " "
7441 case "$sysman" in
7442 '') 
7443         syspath='/usr/share/man/man1 /usr/man/man1'
7444         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7445         syspath="$syspath /usr/man/u_man/man1"
7446         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7447         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7448         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7449         sysman=`./loc . /usr/man/man1 $syspath`
7450         ;;
7451 esac
7452 if $test -d "$sysman"; then
7453         echo "System manual is in $sysman." >&4
7454 else
7455         echo "Could not find manual pages in source form." >&4
7456 fi
7457
7458 : determine where manual pages go
7459 set man1dir man1dir none
7460 eval $prefixit
7461 $cat <<EOM
7462
7463 $spackage has manual pages available in source form.
7464 EOM
7465 case "$nroff" in
7466 nroff)
7467         echo "However, you don't have nroff, so they're probably useless to you."
7468         case "$man1dir" in
7469         '') man1dir="none";;
7470         esac;;
7471 esac
7472 echo "If you don't want the manual sources installed, answer 'none'."
7473 case "$man1dir" in
7474 ' ') dflt=none
7475         ;;
7476 '')
7477         lookpath="$prefixexp/share/man/man1"
7478         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7479         lookpath="$lookpath $prefixexp/man/p_man/man1"
7480         lookpath="$lookpath $prefixexp/man/u_man/man1"
7481         lookpath="$lookpath $prefixexp/man/man.1"
7482         case "$sysman" in
7483         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7484         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7485         esac
7486         set dflt
7487         eval $prefixup
7488         ;;
7489 *)  dflt="$man1dir"
7490         ;;
7491 esac
7492 echo " "
7493 fn=dn+~
7494 rp="Where do the main $spackage manual pages (source) go?"
7495 . ./getfile
7496 if $test "X$man1direxp" != "X$ansexp"; then
7497         installman1dir=''
7498 fi
7499 man1dir="$ans"
7500 man1direxp="$ansexp"
7501 case "$man1dir" in
7502 '')     man1dir=' '
7503         installman1dir='';;
7504 esac
7505
7506 : Change installation prefix, if necessary.
7507 if $test X"$prefix" != X"$installprefix"; then
7508         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7509 else
7510         installman1dir="$man1direxp"
7511 fi
7512
7513 : What suffix to use on installed man pages
7514
7515 case "$man1dir" in
7516 ' ')
7517         man1ext='0'
7518         ;;
7519 *)
7520         rp="What suffix should be used for the main $spackage man pages?"
7521         case "$man1ext" in
7522         '')     case "$man1dir" in
7523                 *1)  dflt=1 ;;
7524                 *1p) dflt=1p ;;
7525                 *1pm) dflt=1pm ;;
7526                 *l) dflt=l;;
7527                 *n) dflt=n;;
7528                 *o) dflt=o;;
7529                 *p) dflt=p;;
7530                 *C) dflt=C;;
7531                 *L) dflt=L;;
7532                 *L1) dflt=L1;;
7533                 *) dflt=1;;
7534                 esac
7535                 ;;
7536         *)      dflt="$man1ext";;
7537         esac
7538         . ./myread
7539         man1ext="$ans"
7540         ;;
7541 esac
7542
7543 : see if we can have long filenames
7544 echo " "
7545 first=123456789abcdef
7546 $rm -f $first
7547 if (echo hi >$first) 2>/dev/null; then
7548         if $test -f 123456789abcde; then
7549                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7550                 val="$undef"
7551         else
7552                 echo 'You can have filenames longer than 14 characters.'>&4
7553                 val="$define"
7554         fi
7555 else
7556         $cat <<'EOM'
7557 You can't have filenames longer than 14 chars.
7558 You can't even think about them!
7559 EOM
7560         val="$undef"
7561 fi 
7562 set d_flexfnam
7563 eval $setvar
7564 $rm -rf 123456789abcde*
7565
7566 : determine where library module manual pages go
7567 set man3dir man3dir none
7568 eval $prefixit
7569 $cat <<EOM
7570
7571 $spackage has manual pages for many of the library modules.
7572 EOM
7573
7574 case "$nroff" in
7575 nroff)
7576         $cat <<'EOM'
7577 However, you don't have nroff, so they're probably useless to you.
7578 EOM
7579         case "$man3dir" in
7580         '') man3dir="none";;
7581         esac;;
7582 esac
7583
7584 case "$d_flexfnam" in
7585 undef)
7586         $cat <<'EOM'
7587 However, your system can't handle the long file names like File::Basename.3. 
7588 EOM
7589         case "$man3dir" in
7590         '') man3dir="none";;
7591         esac;;
7592 esac
7593
7594 echo "If you don't want the manual sources installed, answer 'none'."
7595 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7596 case "$man3dir" in
7597 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7598         if $test -d "$privlib/man/man3"; then
7599                 cat <<EOM >&4
7600
7601 WARNING:  Previous versions of perl installed man3 pages into
7602 $privlib/man/man3.  This version will suggest a 
7603 new default of $dflt.  
7604 EOM
7605                 tdflt=$dflt
7606                 dflt='n'
7607                 rp='Do you wish to preserve the old behavior?(y/n)'
7608                 . ./myread
7609                 case "$ans" in
7610                 y*) dflt="$privlib/man/man3" ;;
7611                 *)  dflt=$tdflt ;;
7612                 esac
7613     fi
7614         ;;
7615 *)      dflt="$man3dir" ;;
7616 esac
7617 case "$dflt" in
7618 ' ') dflt=none ;;
7619 esac
7620 echo " "
7621 fn=dn+~
7622 rp="Where do the $package library man pages (source) go?"
7623 . ./getfile
7624 man3dir="$ans"
7625 man3direxp="$ansexp"
7626 case "$man3dir" in
7627 '')     man3dir=' '
7628         installman3dir='';;
7629 esac
7630
7631 : Change installation prefix, if necessary.
7632 if $test X"$prefix" != X"$installprefix"; then
7633         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7634 else
7635         installman3dir="$man3direxp"
7636 fi
7637
7638 : What suffix to use on installed man pages
7639 case "$man3dir" in
7640 ' ')
7641         man3ext='0'
7642         ;;
7643 *)
7644         rp="What suffix should be used for the $package library man pages?"
7645         case "$man3ext" in
7646         '')     case "$man3dir" in
7647                 *3)  dflt=3 ;;
7648                 *3p) dflt=3p ;;
7649                 *3pm) dflt=3pm ;;
7650                 *l) dflt=l;;
7651                 *n) dflt=n;;
7652                 *o) dflt=o;;
7653                 *p) dflt=p;;
7654                 *C) dflt=C;;
7655                 *L) dflt=L;;
7656                 *L3) dflt=L3;;
7657                 *) dflt=3;;
7658                 esac
7659                 ;;
7660         *)      dflt="$man3ext";;
7661         esac
7662         . ./myread
7663         man3ext="$ans"
7664         ;;
7665 esac
7666
7667 : see if we have to deal with yellow pages, now NIS.
7668 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7669         if $test -f /usr/etc/nibindd; then
7670                 echo " "
7671                 echo "I'm fairly confident you're on a NeXT."
7672                 echo " "
7673                 rp='Do you get the hosts file via NetInfo?'
7674                 dflt=y
7675                 case "$hostcat" in
7676                 nidump*) ;;
7677                 '') ;;
7678                 *) dflt=n;;
7679                 esac
7680                 . ./myread
7681                 case "$ans" in
7682                 y*) hostcat='nidump hosts .';;
7683                 *)      case "$hostcat" in
7684                         nidump*) hostcat='';;
7685                         esac
7686                         ;;
7687                 esac
7688         fi
7689         case "$hostcat" in
7690         nidump*) ;;
7691         *)
7692                 case "$hostcat" in
7693                 *ypcat*) dflt=y;;
7694                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7695                                 dflt=y
7696                         else
7697                                 dflt=n
7698                         fi;;
7699                 *) dflt=n;;
7700                 esac
7701                 echo " "
7702                 rp='Are you getting the hosts file via yellow pages?'
7703                 . ./myread
7704                 case "$ans" in
7705                 y*) hostcat='ypcat hosts';;
7706                 *) hostcat='cat /etc/hosts';;
7707                 esac
7708                 ;;
7709         esac
7710 fi
7711 case "$hostcat" in
7712 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7713 esac
7714 case "$groupcat" in
7715 '') test -f /etc/group && groupcat='cat /etc/group';;
7716 esac
7717 case "$passcat" in
7718 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7719 esac
7720
7721 : now get the host name
7722 echo " "
7723 echo "Figuring out host name..." >&4
7724 case "$myhostname" in
7725 '') cont=true
7726         echo 'Maybe "hostname" will work...'
7727         if tans=`sh -c hostname 2>&1` ; then
7728                 myhostname=$tans
7729                 phostname=hostname
7730                 cont=''
7731         fi
7732         ;;
7733 *) cont='';;
7734 esac
7735 if $test "$cont"; then
7736         if ./xenix; then
7737                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7738                 if tans=`cat /etc/systemid 2>&1` ; then
7739                         myhostname=$tans
7740                         phostname='cat /etc/systemid'
7741                         echo "Whadyaknow.  Xenix always was a bit strange..."
7742                         cont=''
7743                 fi
7744         elif $test -r /etc/systemid; then
7745                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7746         fi
7747 fi
7748 if $test "$cont"; then
7749         echo 'No, maybe "uuname -l" will work...'
7750         if tans=`sh -c 'uuname -l' 2>&1` ; then
7751                 myhostname=$tans
7752                 phostname='uuname -l'
7753         else
7754                 echo 'Strange.  Maybe "uname -n" will work...'
7755                 if tans=`sh -c 'uname -n' 2>&1` ; then
7756                         myhostname=$tans
7757                         phostname='uname -n'
7758                 else
7759                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7760                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7761                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7762                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7763                         else
7764                                 case "$myhostname" in
7765                                 '') echo "Does this machine have an identity crisis or something?"
7766                                         phostname='';;
7767                                 *)
7768                                         echo "Well, you said $myhostname before..."
7769                                         phostname='echo $myhostname';;
7770                                 esac
7771                         fi
7772                 fi
7773         fi
7774 fi
7775 : you do not want to know about this
7776 set $myhostname
7777 myhostname=$1
7778
7779 : verify guess
7780 if $test "$myhostname" ; then
7781         dflt=y
7782         rp='Your host name appears to be "'$myhostname'".'" Right?"
7783         . ./myread
7784         case "$ans" in
7785         y*) ;;
7786         *) myhostname='';;
7787         esac
7788 fi
7789
7790 : bad guess or no guess
7791 while $test "X$myhostname" = X ; do
7792         dflt=''
7793         rp="Please type the (one word) name of your host:"
7794         . ./myread
7795         myhostname="$ans"
7796 done
7797
7798 : translate upper to lower if necessary
7799 case "$myhostname" in
7800 *[A-Z]*)
7801         echo "(Normalizing case in your host name)"
7802         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7803         ;;
7804 esac
7805
7806 case "$myhostname" in
7807 *.*)
7808         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7809         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7810         echo "(Trimming domain name from host name--host name is now $myhostname)"
7811         ;;
7812 *) case "$mydomain" in
7813         '')
7814                 {
7815                         test "X$hostcat" = "Xypcat hosts" &&
7816                         ypmatch "$myhostname" hosts 2>/dev/null |\
7817                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7818                         $test -s hosts
7819                 } || {
7820                         test "X$hostcat" != "X" &&
7821                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7822                                         /[       ]$myhostname[  . ]/p" > hosts
7823                 }
7824                 tmp_re="[       . ]"
7825                 if $test -f hosts; then
7826                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7827                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7828                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7829                                 hosts | $sort | $uniq | \
7830                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7831                         case `$echo X$dflt` in
7832                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7833                                 dflt=.
7834                                 ;;
7835                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7836                                 ;;
7837                         esac
7838                 else
7839                         echo "(I cannot locate a hosts database anywhere)"
7840                         dflt=.
7841                 fi
7842                 case "$dflt" in
7843                 .)
7844                         tans=`./loc resolv.conf X /etc /usr/etc`
7845                         if $test -f "$tans"; then
7846                                 echo "(Attempting domain name extraction from $tans)"
7847                                 dflt=.`$sed -n -e 's/   / /g' \
7848                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7849                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7850                                 case "$dflt" in
7851                                 .) dflt=.`$sed -n -e 's/        / /g' \
7852                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7853                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7854                                         ;;
7855                                 esac
7856                         fi
7857                         ;;
7858                 esac
7859                 case "$dflt" in
7860                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7861                         dflt=.`sh -c domainname 2>/dev/null`
7862                         case "$dflt" in
7863                         '') dflt='.';;
7864                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7865                         esac
7866                         ;;
7867                 esac
7868                 case "$dflt$osname" in
7869                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7870                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7871                         ;;
7872                 esac
7873                 case "$dflt" in
7874                 .) echo "(Lost all hope -- silly guess then)"
7875                         dflt='.uucp'
7876                         ;;
7877                 esac
7878                 $rm -f hosts
7879                 ;;
7880         *) dflt="$mydomain";;
7881         esac;;
7882 esac
7883 echo " "
7884 rp="What is your domain name?"
7885 . ./myread
7886 tans="$ans"
7887 case "$ans" in
7888 '') ;;
7889 .*) ;;
7890 *) tans=".$tans";;
7891 esac
7892 mydomain="$tans"
7893
7894 : translate upper to lower if necessary
7895 case "$mydomain" in
7896 *[A-Z]*)
7897         echo "(Normalizing case in your domain name)"
7898         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7899         ;;
7900 esac
7901
7902 : a little sanity check here
7903 case "$phostname" in
7904 '') ;;
7905 *)
7906         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7907         $myhostname$mydomain|$myhostname) ;;
7908         *)
7909                 case "$phostname" in
7910                 sed*)
7911                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7912                         ;;
7913                 *)
7914                         echo "(That doesn't agree with your $phostname command, by the way.)"
7915                         ;;
7916                 esac
7917         ;;
7918         esac
7919         ;;
7920 esac
7921
7922 $cat <<EOM
7923
7924 I need to get your e-mail address in Internet format if possible, i.e.
7925 something like user@host.domain. Please answer accurately since I have
7926 no easy means to double check it. The default value provided below
7927 is most probably close to reality but may not be valid from outside
7928 your organization...
7929
7930 EOM
7931 cont=x
7932 while test "$cont"; do
7933         case "$cf_email" in
7934         '') dflt="$cf_by@$myhostname$mydomain";;
7935         *) dflt="$cf_email";;
7936         esac
7937         rp='What is your e-mail address?'
7938         . ./myread
7939         cf_email="$ans"
7940         case "$cf_email" in
7941         *@*.*) cont='' ;;
7942         *)
7943                 rp='Address does not look like an Internet one.  Use it anyway?'
7944                 case "$fastread" in
7945                 yes) dflt=y ;;
7946                 *) dflt=n ;;
7947                 esac
7948                 . ./myread
7949                 case "$ans" in
7950                 y*) cont='' ;;
7951                 *) echo " " ;;
7952                 esac
7953                 ;;
7954         esac
7955 done
7956
7957 $cat <<EOM
7958
7959 If you or somebody else will be maintaining perl at your site, please
7960 fill in the correct e-mail address here so that they may be contacted
7961 if necessary. Currently, the "perlbug" program included with perl
7962 will send mail to this address in addition to perlbug@perl.org. You may
7963 enter "none" for no administrator.
7964
7965 EOM
7966 case "$perladmin" in
7967 '') dflt="$cf_email";;
7968 *) dflt="$perladmin";;
7969 esac
7970 rp='Perl administrator e-mail address'
7971 . ./myread
7972 perladmin="$ans"
7973
7974 : determine whether to only install version-specific parts.
7975 echo " "
7976 $cat <<EOM
7977 Do you want to install only the version-specific parts of the perl
7978 distribution?  Usually you do *not* want to do this.
7979 EOM
7980 case "$versiononly" in
7981 "$define"|[Yy]*|true) dflt='y' ;;
7982 *) dflt='n';
7983 esac
7984 rp="Do you want to install only the version-specific parts of perl?"
7985 . ./myread
7986 case "$ans" in
7987 [yY]*)  val="$define";;
7988 *)      val="$undef" ;;
7989 esac
7990 set versiononly
7991 eval $setvar
7992
7993 : figure out how to guarantee perl startup
7994 case "$startperl" in
7995 '')
7996         case "$sharpbang" in
7997         *!)
7998                 $cat <<EOH
7999
8000 I can use the #! construct to start perl on your system. This will
8001 make startup of perl scripts faster, but may cause problems if you
8002 want to share those scripts and perl is not in a standard place
8003 ($binexp/perl) on all your platforms. The alternative is to force
8004 a shell by starting the script with a single ':' character.
8005
8006 EOH
8007                 case "$versiononly" in
8008                 "$define")      dflt="$binexp/perl$version";;  
8009                 *)              dflt="$binexp/perl";;
8010                 esac
8011                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8012                 . ./myread
8013                 case "$ans" in
8014                 none)   startperl=": # use perl";;
8015                 *)      startperl="#!$ans"
8016                         if $test 30 -lt `echo "$ans" | wc -c`; then
8017                                 $cat >&4 <<EOM
8018
8019 WARNING:  Some systems limit the #! command to 32 characters.
8020 If you experience difficulty running Perl scripts with #!, try
8021 installing Perl in a directory with a shorter pathname.
8022
8023 EOM
8024                         fi ;;
8025                 esac
8026                 ;;
8027         *) startperl=": # use perl"
8028                 ;;
8029         esac
8030         ;;
8031 esac
8032 echo "I'll use $startperl to start perl scripts."
8033
8034 : figure best path for perl in scripts
8035 case "$perlpath" in
8036 '')
8037         perlpath="$binexp/perl"
8038         case "$startperl" in
8039         *!*) ;;
8040         *)
8041                 $cat <<EOH
8042
8043 I will use the "eval 'exec'" idiom to start Perl on your system.
8044 I can use the full path of your Perl binary for this purpose, but
8045 doing so may cause problems if you want to share those scripts and
8046 Perl is not always in a standard place ($binexp/perl).
8047
8048 EOH
8049                 dflt="$binexp/perl"
8050                 rp="What path shall I use in \"eval 'exec'\"?"
8051                 . ./myread
8052                 perlpath="$ans"
8053                 ;;
8054         esac
8055         ;;
8056 esac
8057 case "$startperl" in
8058 *!*)    ;;
8059 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8060 esac
8061
8062 : determine where public executable scripts go
8063 set scriptdir scriptdir
8064 eval $prefixit
8065 case "$scriptdir" in
8066 '')
8067         dflt="$bin"
8068         : guess some guesses
8069         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8070         $test -d /usr/share/bin     && dflt=/usr/share/bin
8071         $test -d /usr/local/script  && dflt=/usr/local/script
8072         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8073         $test -d $prefixexp/script  && dflt=$prefixexp/script
8074         set dflt
8075         eval $prefixup
8076         ;;
8077 *)  dflt="$scriptdir"
8078         ;;
8079 esac
8080 $cat <<EOM
8081  
8082 Some installations have a separate directory just for executable scripts so
8083 that they can mount it across multiple architectures but keep the scripts in
8084 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8085 Or you might just lump your scripts in with all your other executables.
8086  
8087 EOM
8088 fn=d~
8089 rp='Where do you keep publicly executable scripts?'
8090 . ./getfile
8091 if $test "X$ansexp" != "X$scriptdirexp"; then
8092         installscript=''
8093 fi
8094 scriptdir="$ans"
8095 scriptdirexp="$ansexp"
8096 : Change installation prefix, if necessary.
8097 if $test X"$prefix" != X"$installprefix"; then
8098         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8099 else
8100         installscript="$scriptdirexp"
8101 fi
8102
8103 : determine where add-on public executables go
8104 case "$sitebin" in
8105 '')     dflt=$siteprefix/bin ;;
8106 *)      dflt=$sitebin ;;
8107 esac
8108 fn=d~
8109 rp='Pathname where the add-on public executables should be installed?'
8110 . ./getfile
8111 sitebin="$ans"
8112 sitebinexp="$ansexp"
8113 : Change installation prefix, if necessary.
8114 if $test X"$prefix" != X"$installprefix"; then
8115         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8116 else
8117         installsitebin="$sitebinexp"
8118 fi
8119
8120 : define an is-a-typedef? function
8121 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8122 case "$inclist" in
8123 "") inclist="sys/types.h";;
8124 esac;
8125 eval "varval=\$$var";
8126 case "$varval" in
8127 "")
8128         $rm -f temp.c;
8129         for inc in $inclist; do
8130                 echo "#include <$inc>" >>temp.c;
8131         done;
8132         echo "#ifdef $type" >> temp.c;
8133         echo "printf(\"We have $type\");" >> temp.c;
8134         echo "#endif" >> temp.c;
8135         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8136         if $contains $type temp.E >/dev/null 2>&1; then
8137                 eval "$var=\$type";
8138         else
8139                 eval "$var=\$def";
8140         fi;
8141         $rm -f temp.?;;
8142 *) eval "$var=\$varval";;
8143 esac'
8144
8145 : define an is-a-typedef? function that prompts if the type is not available.
8146 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8147 case "$inclist" in
8148 "") inclist="sys/types.h";;
8149 esac;
8150 eval "varval=\$$var";
8151 case "$varval" in
8152 "")
8153         $rm -f temp.c;
8154         for inc in $inclist; do
8155                 echo "#include <$inc>" >>temp.c;
8156         done;
8157         echo "#ifdef $type" >> temp.c;
8158         echo "printf(\"We have $type\");" >> temp.c;
8159         echo "#endif" >> temp.c;
8160         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8161         echo " " ;
8162         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8163         if $contains $type temp.E >/dev/null 2>&1; then
8164                 echo "$type found." >&4;
8165                 eval "$var=\$type";
8166         else
8167                 echo "$type NOT found." >&4;
8168                 dflt="$def";
8169                 . ./myread ;
8170                 eval "$var=\$ans";
8171         fi;
8172         $rm -f temp.?;;
8173 *) eval "$var=\$varval";;
8174 esac'
8175
8176 : see what type lseek is declared as in the kernel
8177 rp="What is the type used for lseek's offset on this system?"
8178 set off_t lseektype long stdio.h sys/types.h
8179 eval $typedef_ask
8180
8181 echo " "
8182 echo "Checking to see how big your file offsets are..." >&4
8183 $cat >try.c <<EOCP
8184 #include <sys/types.h>
8185 #include <stdio.h>
8186 int main()
8187 {
8188     printf("%d\n", (int)sizeof($lseektype));
8189     return(0); 
8190 }
8191 EOCP
8192 set try
8193 if eval $compile_ok; then
8194         lseeksize=`$run ./try`
8195         echo "Your file offsets are $lseeksize bytes long."
8196 else
8197         dflt=$longsize
8198         echo " "
8199         echo "(I can't seem to compile the test program.  Guessing...)"
8200         rp="What is the size of your file offsets (in bytes)?"
8201         . ./myread
8202         lseeksize="$ans"
8203 fi
8204 $rm -f try.c try
8205
8206 : see what type file positions are declared as in the library
8207 rp="What is the type for file position used by fsetpos()?"
8208 set fpos_t fpostype long stdio.h sys/types.h
8209 eval $typedef_ask
8210
8211 echo " "
8212 case "$fpostype" in
8213 *_t) zzz="$fpostype"    ;;
8214 *)   zzz="fpos_t"       ;;
8215 esac
8216 echo "Checking the size of $zzz..." >&4 
8217 cat > try.c <<EOCP
8218 #include <sys/types.h>
8219 #include <stdio.h>
8220 int main() {
8221     printf("%d\n", (int)sizeof($fpostype));
8222     exit(0);
8223 }
8224 EOCP
8225 set try
8226 if eval $compile_ok; then
8227         yyy=`$run ./try`
8228         case "$yyy" in
8229         '')     fpossize=4
8230                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8231                 ;;
8232         *)      fpossize=$yyy
8233                 echo "Your $zzz is $fpossize bytes long."
8234                 ;;
8235         esac
8236 else
8237         dflt="$longsize"
8238         echo " " >&4
8239         echo "(I can't compile the test program.  Guessing...)" >&4
8240         rp="What is the size of your file positions (in bytes)?"
8241         . ./myread
8242         fpossize="$ans"
8243 fi
8244
8245
8246
8247 # Backward compatibility (uselfs is deprecated).
8248 case "$uselfs" in
8249 "$define"|true|[yY]*)
8250         cat <<EOM >&4
8251
8252 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8253 EOM
8254         uselargefiles="$define"
8255         ;;
8256 esac                          
8257
8258 case "$lseeksize:$fpossize" in
8259 8:8) cat <<EOM
8260
8261 You can have files larger than 2 gigabytes.
8262 EOM
8263    val="$define" ;;
8264 *)    case "$uselargefiles" in
8265    "$undef"|false|[nN]*) dflt='n' ;;
8266    *)   dflt='y' ;;
8267    esac
8268    cat <<EOM
8269
8270 Perl can be built to understand large files (files larger than 2 gigabytes)
8271 on some systems.  To do so, Configure can be run with -Duselargefiles.
8272
8273 If this doesn't make any sense to you, just accept the default '$dflt'.
8274 EOM
8275    rp='Try to understand large files, if available?'
8276    . ./myread
8277    case "$ans" in
8278    y|Y)         val="$define" ;;
8279    *)           val="$undef"  ;;
8280    esac
8281    ;;
8282 esac
8283 set uselargefiles
8284 eval $setvar
8285 case "$uselargefiles" in
8286 "$define")
8287 : Look for a hint-file generated 'call-back-unit'.  If the
8288 : user has specified that a large files perl is to be built,
8289 : we may need to set or change some other defaults.
8290         if $test -f uselargefiles.cbu; then
8291                 echo "Your platform has some specific hints for large file builds, using them..."
8292                 . ./uselargefiles.cbu
8293                 echo " "
8294                 echo "Rechecking to see how big your file offsets are..." >&4
8295                 $cat >try.c <<EOCP
8296 #include <sys/types.h>
8297 #include <stdio.h>
8298 int main()
8299 {
8300     printf("%d\n", (int)sizeof($lseektype));
8301     return(0); 
8302 }
8303 EOCP
8304                 set try
8305                 if eval $compile_ok; then
8306                         lseeksize=`$run ./try`
8307                         $echo "Your file offsets are now $lseeksize bytes long."
8308                 else
8309                         dflt="$lseeksize"
8310                         echo " "
8311                         echo "(I can't seem to compile the test program.  Guessing...)"
8312                         rp="What is the size of your file offsets (in bytes)?"
8313                         . ./myread
8314                         lseeksize="$ans"
8315                 fi
8316                 case "$fpostype" in
8317                 *_t) zzz="$fpostype"    ;;
8318                 *)   zzz="fpos_t"       ;;
8319                 esac
8320                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8321                 $cat > try.c <<EOCP
8322 #include <sys/types.h>
8323 #include <stdio.h>
8324 int main() {
8325     printf("%d\n", (int)sizeof($fpostype));
8326     exit(0);
8327 }
8328 EOCP
8329                 set try
8330                 if eval $compile_ok; then
8331                         yyy=`$run ./try`
8332                         dflt="$lseeksize"
8333                         case "$yyy" in
8334                         '')     echo " "
8335                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8336                                 ;;
8337                         *)      fpossize=$yyy
8338                                 echo " $fpossize bytes." >&4
8339                                 ;;
8340                         esac
8341                 else
8342                         dflt="$fpossize"
8343                         echo " "
8344                         echo "(I can't compile the test program.  Guessing...)" >&4
8345                         rp="What is the size of your file positions (in bytes)?"
8346                         . ./myread
8347                         fpossize="$ans"
8348                 fi
8349                 $rm -f try.c try
8350         fi
8351         ;;
8352 esac
8353
8354 case "$vendorprefix" in
8355 '')     d_vendorbin="$undef"
8356         vendorbin=''
8357         vendorbinexp=''
8358         ;;
8359 *)      d_vendorbin="$define"
8360         : determine where vendor-supplied executables go.
8361         case "$vendorbin" in
8362         '') dflt=$vendorprefix/bin ;;
8363         *)      dflt="$vendorbin" ;;
8364         esac
8365         fn=d~+
8366         rp='Pathname for the vendor-supplied executables directory?'
8367         . ./getfile
8368         vendorbin="$ans"
8369         vendorbinexp="$ansexp"
8370         ;;
8371 esac
8372 : Change installation prefix, if necessary.
8373 if $test X"$prefix" != X"$installprefix"; then
8374         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8375 else
8376         installvendorbin="$vendorbinexp"
8377 fi
8378
8379 : see if qgcvt exists
8380 set qgcvt d_qgcvt
8381 eval $inlibc
8382
8383 echo " "
8384
8385 if $test X"$d_longdbl" = X"$define"; then
8386
8387 echo "Checking how to print long doubles..." >&4
8388
8389 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8390         $cat >try.c <<'EOCP'
8391 #include <sys/types.h>
8392 #include <stdio.h>
8393 int main() {
8394   double d = 123.456;
8395   printf("%.3f\n", d);
8396 }
8397 EOCP
8398         set try
8399         if eval $compile; then
8400                 yyy=`$run ./try`
8401                 case "$yyy" in
8402                 123.456)
8403                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8404                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8405                         echo "We will use %f."
8406                         ;;
8407                 esac
8408         fi
8409 fi
8410
8411 if $test X"$sPRIfldbl" = X; then
8412         $cat >try.c <<'EOCP'
8413 #include <sys/types.h>
8414 #include <stdio.h>
8415 int main() {
8416   long double d = 123.456;
8417   printf("%.3Lf\n", d);
8418 }
8419 EOCP
8420         set try
8421         if eval $compile; then
8422                 yyy=`$run ./try`
8423                 case "$yyy" in
8424                 123.456)
8425                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8426                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8427                         echo "We will use %Lf."
8428                         ;;
8429                 esac
8430         fi
8431 fi
8432
8433 if $test X"$sPRIfldbl" = X; then
8434         $cat >try.c <<'EOCP'
8435 #include <sys/types.h>
8436 #include <stdio.h>
8437 int main() {
8438   long double d = 123.456;
8439   printf("%.3llf\n", d);
8440 }
8441 EOCP
8442         set try
8443         if eval $compile; then
8444                 yyy=`$run ./try`
8445                 case "$yyy" in
8446                 123.456)
8447                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8448                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8449                         echo "We will use %llf."
8450                         ;;
8451                 esac
8452         fi
8453 fi
8454
8455 if $test X"$sPRIfldbl" = X; then
8456         $cat >try.c <<'EOCP'
8457 #include <sys/types.h>
8458 #include <stdio.h>
8459 int main() {
8460   long double d = 123.456;
8461   printf("%.3lf\n", d);
8462 }
8463 EOCP
8464         set try
8465         if eval $compile; then
8466                 yyy=`$run ./try`
8467                 case "$yyy" in
8468                 123.456)
8469                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8470                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8471                         echo "We will use %lf."
8472                         ;;
8473                 esac
8474         fi
8475 fi
8476
8477 if $test X"$sPRIfldbl" = X; then
8478         echo "Cannot figure out how to print long doubles." >&4
8479 else
8480         sSCNfldbl=$sPRIfldbl    # expect consistency
8481 fi
8482
8483 $rm -f try try.*
8484
8485 fi # d_longdbl
8486
8487 case "$sPRIfldbl" in
8488 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8489         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8490         d_SCNfldbl="$undef";
8491         ;;
8492 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8493         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8494         d_SCNfldbl="$define";
8495         ;;
8496 esac
8497
8498 : Check how to convert floats to strings.
8499 echo " "
8500 echo "Checking for an efficient way to convert floats to strings."
8501 echo " " > try.c
8502 case "$uselongdouble" in
8503 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8504 esac
8505 case "$d_longdbl" in
8506 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8507 esac
8508 case "$d_PRIgldbl" in
8509 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8510 esac
8511 $cat >>try.c <<EOP
8512 #ifdef TRY_gconvert
8513 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8514 char *myname = "gconvert";
8515 #endif
8516 #ifdef TRY_gcvt
8517 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8518 char *myname = "gcvt";
8519 #endif
8520 #ifdef TRY_qgcvt
8521 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8522 char *myname = "qgcvt";
8523 #define DOUBLETYPE long double
8524 #endif
8525 #ifdef TRY_sprintf
8526 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8527 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8528 #else
8529 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8530 #endif
8531 char *myname = "sprintf";
8532 #endif
8533
8534 #ifndef DOUBLETYPE
8535 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8536 #define DOUBLETYPE long double
8537 #else
8538 #define DOUBLETYPE double
8539 #endif
8540 #endif
8541
8542 #include <stdio.h>
8543
8544 #define I_STDLIB $i_stdlib
8545 #ifdef I_STDLIB
8546 #include <stdlib.h>
8547 #endif
8548
8549 int
8550 checkit(expect, got)
8551 char *expect;
8552 char *got;
8553 {
8554     if (strcmp(expect, got)) {
8555                 printf("%s oddity:  Expected %s, got %s\n",
8556                         myname, expect, got);
8557                 exit(1);
8558         }
8559 }
8560
8561 int main()
8562
8563         char buf[64]; 
8564         buf[63] = '\0';
8565
8566         /* This must be 1st test on (which?) platform */
8567         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8568         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8569         checkit("0.1", buf);
8570
8571         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8572         checkit("1", buf);
8573
8574         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8575         checkit("1.1", buf);
8576
8577         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8578         checkit("1.01", buf);
8579
8580         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8581         checkit("1.001", buf);
8582
8583         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8584         checkit("1.0001", buf);
8585
8586         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8587         checkit("1.00001", buf);
8588
8589         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8590         checkit("1.000001", buf);
8591
8592         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8593         checkit("0", buf);
8594
8595         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8596         checkit("-1", buf);
8597
8598         /* Some Linux gcvt's give 1.e+5 here. */
8599         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8600         checkit("100000", buf);
8601         
8602         /* Some Linux gcvt's give -1.e+5 here. */
8603         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8604         checkit("-100000", buf);
8605
8606         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8607         checkit("123.456", buf);
8608
8609         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8610         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8611         if (strlen(buf) > 5)
8612             checkit("1e+030", buf); /* for Microsoft */
8613         else
8614             checkit("1e+30", buf);
8615
8616         exit(0);
8617 }
8618 EOP
8619 case "$d_Gconvert" in
8620 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8621 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8622 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8623 *) xxx_list='gconvert gcvt sprintf' ;;
8624 esac
8625
8626 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8627 "$define$define$define")
8628     # for long doubles prefer first qgcvt, then sprintf
8629     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8630     xxx_list="sprintf $xxx_list"
8631     case "$d_qgcvt" in
8632     "$define") xxx_list="qgcvt $xxx_list" ;;
8633     esac
8634     ;;
8635 esac
8636
8637 for xxx_convert in $xxx_list; do
8638         echo "Trying $xxx_convert..."
8639         $rm -f try try$_o
8640         set try -DTRY_$xxx_convert
8641         if eval $compile; then
8642                 echo "$xxx_convert() found." >&4
8643                 if $run ./try; then
8644                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8645                         break;
8646                 else
8647                         echo "...But $xxx_convert didn't work as I expected."
8648                 fi
8649         else
8650                 echo "$xxx_convert NOT found." >&4
8651         fi
8652 done
8653         
8654 case "$xxx_convert" in
8655 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8656 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8657 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8658 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8659    "$define$define$define")
8660       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8661    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8662    esac
8663    ;;  
8664 esac
8665
8666 : see if _fwalk exists
8667 set fwalk d__fwalk
8668 eval $inlibc
8669
8670 : Initialize h_fcntl
8671 h_fcntl=false
8672
8673 : Initialize h_sysfile
8674 h_sysfile=false
8675
8676 : access call always available on UNIX
8677 set access d_access
8678 eval $inlibc
8679
8680 : locate the flags for 'access()'
8681 case "$d_access" in
8682 "$define")
8683         echo " "
8684         $cat >access.c <<'EOCP'
8685 #include <sys/types.h>
8686 #ifdef I_FCNTL
8687 #include <fcntl.h>
8688 #endif
8689 #ifdef I_SYS_FILE
8690 #include <sys/file.h>
8691 #endif
8692 #ifdef I_UNISTD
8693 #include <unistd.h>
8694 #endif
8695 int main() {
8696         exit(R_OK);
8697 }
8698 EOCP
8699         : check sys/file.h first, no particular reason here
8700         if $test `./findhdr sys/file.h` && \
8701                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8702                 h_sysfile=true;
8703                 echo "<sys/file.h> defines the *_OK access constants." >&4
8704         elif $test `./findhdr fcntl.h` && \
8705                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8706                 h_fcntl=true;
8707                 echo "<fcntl.h> defines the *_OK access constants." >&4
8708         elif $test `./findhdr unistd.h` && \
8709                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8710                 echo "<unistd.h> defines the *_OK access constants." >&4
8711         else
8712                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8713         fi
8714         ;;
8715 esac
8716 $rm -f access*
8717
8718 : see if accessx exists
8719 set accessx d_accessx
8720 eval $inlibc
8721
8722 : see if alarm exists
8723 set alarm d_alarm
8724 eval $inlibc
8725
8726 : see if atolf exists
8727 set atolf d_atolf
8728 eval $inlibc
8729
8730 : see if atoll exists
8731 set atoll d_atoll
8732 eval $inlibc
8733
8734 : Look for GNU-cc style attribute checking
8735 echo " "
8736 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8737 $cat >attrib.c <<'EOCP'
8738 #include <stdio.h>
8739 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8740 EOCP
8741 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8742         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8743                 echo "Your C compiler doesn't fully support __attribute__."
8744                 val="$undef"
8745         else
8746                 echo "Your C compiler supports __attribute__."
8747                 val="$define"
8748         fi
8749 else
8750         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8751         val="$undef"
8752 fi
8753 set d_attribut
8754 eval $setvar
8755 $rm -f attrib*
8756
8757 : see if bcmp exists
8758 set bcmp d_bcmp
8759 eval $inlibc
8760
8761 : see if bcopy exists
8762 set bcopy d_bcopy
8763 eval $inlibc
8764
8765 : see if this is a unistd.h system
8766 set unistd.h i_unistd
8767 eval $inhdr
8768
8769 : see if getpgrp exists
8770 set getpgrp d_getpgrp
8771 eval $inlibc
8772
8773 case "$d_getpgrp" in
8774 "$define")
8775         echo " "
8776         echo "Checking to see which flavor of getpgrp is in use..."
8777         $cat >try.c <<EOP
8778 #$i_unistd I_UNISTD
8779 #include <sys/types.h>
8780 #ifdef I_UNISTD
8781 #  include <unistd.h>
8782 #endif
8783 int main()
8784 {
8785         if (getuid() == 0) {
8786                 printf("(I see you are running Configure as super-user...)\n");
8787                 setuid(1);
8788         }
8789 #ifdef TRY_BSD_PGRP
8790         if (getpgrp(1) == 0)
8791                 exit(0);
8792 #else
8793         if (getpgrp() > 0)
8794                 exit(0);
8795 #endif
8796         exit(1);
8797 }
8798 EOP
8799         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8800                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8801                 val="$define"
8802         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8803                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8804                 val="$undef"
8805         else
8806                 echo "I can't seem to compile and run the test program."
8807                 if ./usg; then
8808                         xxx="a USG one, i.e. you use getpgrp()."
8809                 else
8810                         # SVR4 systems can appear rather BSD-ish.
8811                         case "$i_unistd" in
8812                         $undef)
8813                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8814                                 val="$define"
8815                                 ;;
8816                         $define)
8817                                 xxx="probably a USG one, i.e. you use getpgrp()."
8818                                 val="$undef"
8819                                 ;;
8820                         esac
8821                 fi
8822                 echo "Assuming your getpgrp is $xxx" >&4
8823         fi
8824         ;;
8825 *) val="$undef";;
8826 esac
8827 set d_bsdgetpgrp
8828 eval $setvar
8829 $rm -f try try.*
8830
8831 : see if setpgrp exists
8832 set setpgrp d_setpgrp
8833 eval $inlibc
8834
8835 case "$d_setpgrp" in
8836 "$define")
8837         echo " "
8838         echo "Checking to see which flavor of setpgrp is in use..."
8839         $cat >try.c <<EOP
8840 #$i_unistd I_UNISTD
8841 #include <sys/types.h>
8842 #ifdef I_UNISTD
8843 #  include <unistd.h>
8844 #endif
8845 int main()
8846 {
8847         if (getuid() == 0) {
8848                 printf("(I see you are running Configure as super-user...)\n");
8849                 setuid(1);
8850         }
8851 #ifdef TRY_BSD_PGRP
8852         if (-1 == setpgrp(1, 1))
8853                 exit(0);
8854 #else
8855         if (setpgrp() != -1)
8856                 exit(0);
8857 #endif
8858         exit(1);
8859 }
8860 EOP
8861         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8862                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8863                 val="$define"
8864         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8865                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8866                 val="$undef"
8867         else
8868                 echo "(I can't seem to compile and run the test program.)"
8869                 if ./usg; then
8870                         xxx="a USG one, i.e. you use setpgrp()."
8871                 else
8872                         # SVR4 systems can appear rather BSD-ish.
8873                         case "$i_unistd" in
8874                         $undef)
8875                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8876                                 val="$define"
8877                                 ;;
8878                         $define)
8879                                 xxx="probably a USG one, i.e. you use setpgrp()."
8880                                 val="$undef"
8881                                 ;;
8882                         esac
8883                 fi
8884                 echo "Assuming your setpgrp is $xxx" >&4
8885         fi
8886         ;;
8887 *) val="$undef";;
8888 esac
8889 set d_bsdsetpgrp
8890 eval $setvar
8891 $rm -f try try.*
8892 : see if bzero exists
8893 set bzero d_bzero
8894 eval $inlibc
8895
8896 : see if signal is declared as pointer to function returning int or void
8897 echo " "
8898 xxx=`./findhdr signal.h`
8899 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8900 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8901         echo "You have int (*signal())() instead of void." >&4
8902         val="$undef"
8903 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8904         echo "You have void (*signal())()." >&4
8905         val="$define"
8906 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8907         echo "You have int (*signal())() instead of void." >&4
8908         val="$undef"
8909 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8910         echo "You have void (*signal())()." >&4
8911         val="$define"
8912 else
8913         case "$d_voidsig" in
8914         '')
8915         echo "I can't determine whether signal handler returns void or int..." >&4
8916                 dflt=void
8917                 rp="What type does your signal handler return?"
8918                 . ./myread
8919                 case "$ans" in
8920                 v*) val="$define";;
8921                 *) val="$undef";;
8922                 esac;;
8923         "$define")
8924                 echo "As you already told me, signal handler returns void." >&4
8925                 val="$define"
8926                 ;;
8927         *)      echo "As you already told me, signal handler returns int." >&4
8928                 val="$undef"
8929                 ;;
8930         esac
8931 fi
8932 set d_voidsig
8933 eval $setvar
8934 case "$d_voidsig" in
8935 "$define") signal_t="void";;
8936 *) signal_t="int";;
8937 esac
8938 $rm -f $$.tmp
8939
8940 : check for ability to cast large floats to 32-bit ints.
8941 echo " "
8942 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8943 if $test "$intsize" -ge 4; then
8944         xxx=int
8945 else
8946         xxx=long
8947 fi
8948 $cat >try.c <<EOCP
8949 #include <stdio.h>
8950 #include <sys/types.h>
8951 #include <signal.h>
8952 $signal_t blech(s) int s; { exit(3); }
8953 int main()
8954 {
8955         $xxx i32;
8956         double f, g;
8957         int result = 0;
8958         char str[16];
8959         signal(SIGFPE, blech);
8960
8961         /* Don't let compiler optimize the test away.  Store the number 
8962            in a writable string for gcc to pass to sscanf under HP/UX.
8963         */
8964         sprintf(str, "2147483647");
8965         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8966         g = 10 * f;
8967         i32  = ($xxx) g;
8968
8969         /* x86 processors will probably give 0x8000 0000, which is a
8970        sign change.  We don't want that.  We want to mimic SPARC
8971            behavior here, which is to preserve the sign and give
8972            back 0x7fff ffff.
8973         */
8974         if (i32 != ($xxx) f)
8975                 result |= 1;
8976         exit(result);
8977 }
8978 EOCP
8979 set try
8980 if eval $compile_ok; then
8981         $run ./try
8982         yyy=$?
8983 else
8984         echo "(I can't seem to compile the test program--assuming it can't)"
8985         yyy=1
8986 fi
8987 case "$yyy" in
8988 0)      val="$define"
8989         echo "Yup, it can."
8990         ;;
8991 *)      val="$undef"
8992         echo "Nope, it can't."
8993         ;;
8994 esac
8995 set d_casti32
8996 eval $setvar
8997 $rm -f try try.*
8998
8999 : check for ability to cast negative floats to unsigned
9000 echo " "
9001 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9002 $cat >try.c <<EOCP
9003 #include <stdio.h>
9004 #include <sys/types.h>
9005 #include <signal.h>
9006 $signal_t blech(s) int s; { exit(7); }
9007 $signal_t blech_in_list(s) int s; { exit(4); }
9008 unsigned long dummy_long(p) unsigned long p; { return p; }
9009 unsigned int dummy_int(p) unsigned int p; { return p; }
9010 unsigned short dummy_short(p) unsigned short p; { return p; }
9011 int main()
9012 {
9013         double f;
9014         unsigned long along;
9015         unsigned int aint;
9016         unsigned short ashort;
9017         int result = 0;
9018         char str[16];
9019         
9020         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9021            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9022            optimized the whole file away
9023         */
9024         /* Store the number in a writable string for gcc to pass to 
9025            sscanf under HP/UX.
9026         */
9027         sprintf(str, "-123");
9028         sscanf(str, "%lf", &f);  /* f = -123.; */
9029
9030         signal(SIGFPE, blech);
9031         along = (unsigned long)f;
9032         aint = (unsigned int)f;
9033         ashort = (unsigned short)f;
9034         if (along != (unsigned long)-123)
9035                 result |= 1;
9036         if (aint != (unsigned int)-123)
9037                 result |= 1;
9038         if (ashort != (unsigned short)-123)
9039                 result |= 1;
9040         sprintf(str, "1073741824.");
9041         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9042         f = f + f;
9043         along = 0;
9044         along = (unsigned long)f;
9045         if (along != 0x80000000)
9046                 result |= 2;
9047         f -= 1.;
9048         along = 0;
9049         along = (unsigned long)f;
9050         if (along != 0x7fffffff)
9051                 result |= 1;
9052         f += 2.;
9053         along = 0;
9054         along = (unsigned long)f;
9055         if (along != 0x80000001)
9056                 result |= 2;
9057         if (result)
9058                 exit(result);
9059         signal(SIGFPE, blech_in_list);
9060         sprintf(str, "123.");
9061         sscanf(str, "%lf", &f);  /* f = 123.; */
9062         along = dummy_long((unsigned long)f);
9063         aint = dummy_int((unsigned int)f);
9064         ashort = dummy_short((unsigned short)f);
9065         if (along != (unsigned long)123)
9066                 result |= 4;
9067         if (aint != (unsigned int)123)
9068                 result |= 4;
9069         if (ashort != (unsigned short)123)
9070                 result |= 4;
9071         exit(result);
9072
9073 }
9074 EOCP
9075 set try
9076 if eval $compile_ok; then
9077         $run ./try
9078         castflags=$?
9079 else
9080         echo "(I can't seem to compile the test program--assuming it can't)"
9081         castflags=7
9082 fi
9083 case "$castflags" in
9084 0)      val="$define"
9085         echo "Yup, it can."
9086         ;;
9087 *)      val="$undef"
9088         echo "Nope, it can't."
9089         ;;
9090 esac
9091 set d_castneg
9092 eval $setvar
9093 $rm -f try.*
9094
9095 : see if vprintf exists
9096 echo " "
9097 if set vprintf val -f d_vprintf; eval $csym; $val; then
9098         echo 'vprintf() found.' >&4
9099         val="$define"
9100         $cat >try.c <<'EOF'
9101 #include <varargs.h>
9102
9103 int main() { xxx("foo"); }
9104
9105 xxx(va_alist)
9106 va_dcl
9107 {
9108         va_list args;
9109         char buf[10];
9110
9111         va_start(args);
9112         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9113 }
9114 EOF
9115         set try
9116         if eval $compile && $run ./try; then
9117                 echo "Your vsprintf() returns (int)." >&4
9118                 val2="$undef"
9119         else
9120                 echo "Your vsprintf() returns (char*)." >&4
9121                 val2="$define"
9122         fi
9123 else
9124         echo 'vprintf() NOT found.' >&4
9125                 val="$undef"
9126                 val2="$undef"
9127 fi
9128 $rm -f try try.*
9129 set d_vprintf
9130 eval $setvar
9131 val=$val2
9132 set d_charvspr
9133 eval $setvar
9134
9135 : see if chown exists
9136 set chown d_chown
9137 eval $inlibc
9138
9139 : see if chroot exists
9140 set chroot d_chroot
9141 eval $inlibc
9142
9143 : see if chsize exists
9144 set chsize d_chsize
9145 eval $inlibc
9146
9147 : see if class exists
9148 set class d_class
9149 eval $inlibc
9150
9151 hasstruct='varname=$1; struct=$2; shift; shift;
9152 while $test $# -ge 2; do
9153         case "$1" in
9154         $define) echo "#include <$2>";;
9155         esac ;
9156     shift 2;
9157 done > try.c;
9158 echo "int main () { struct $struct foo; }" >> try.c;
9159 set try;
9160 if eval $compile; then
9161         val="$define";
9162 else
9163         val="$undef";
9164 fi;
9165 set $varname;
9166 eval $setvar;
9167 $rm -f try.c try.o'
9168
9169 : see if sys/types.h has to be included
9170 set sys/types.h i_systypes
9171 eval $inhdr
9172
9173 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9174 while $test $# -ge 2; do
9175         case "$1" in
9176         $define) echo "#include <$2>";;
9177         esac ;
9178     shift 2;
9179 done > try.c;
9180 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9181 set try;
9182 if eval $compile; then
9183         val="$define";
9184 else
9185         val="$undef";
9186 fi;
9187 set $varname;
9188 eval $setvar;
9189 $rm -f try.c try.o'
9190
9191 socketlib=''
9192 sockethdr=''
9193 : see whether socket exists
9194 echo " "
9195 $echo $n "Hmm... $c" >&4
9196 if set socket val -f d_socket; eval $csym; $val; then
9197         echo "Looks like you have Berkeley networking support." >&4
9198         d_socket="$define"
9199         if set setsockopt val -f; eval $csym; $val; then
9200                 d_oldsock="$undef"
9201         else
9202                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9203                 d_oldsock="$define"
9204         fi
9205 else
9206         if $contains socklib libc.list >/dev/null 2>&1; then
9207                 echo "Looks like you have Berkeley networking support." >&4
9208                 d_socket="$define"
9209                 : we will have to assume that it supports the 4.2 BSD interface
9210                 d_oldsock="$undef"
9211         else
9212                 echo "You don't have Berkeley networking in libc$_a..." >&4
9213                 if test "X$d_socket" = "X$define"; then
9214                    echo "...but you seem to believe that you have sockets." >&4
9215                 else
9216                         for net in net socket
9217                         do
9218                                 if test -f /usr/lib/lib$net$_a; then
9219                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9220                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9221                                         if $contains socket libc.list >/dev/null 2>&1; then
9222                                                 d_socket="$define"
9223                                                 socketlib="-l$net"
9224                                                 case "$net" in
9225                                                 net)
9226                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9227                                                         sockethdr="-I/usr/netinclude"
9228                                                         ;;
9229                                                 esac
9230                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9231                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9232                                                         d_oldsock="$undef"
9233                                                 else
9234                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9235                                                         d_oldsock="$define"
9236                                                 fi
9237                                                 break
9238                                         fi
9239                                 fi
9240                         done
9241                         if test "X$d_socket" != "X$define"; then
9242                            echo "or anywhere else I see." >&4
9243                            d_socket="$undef"
9244                            d_oldsock="$undef"
9245                         fi
9246                 fi
9247         fi
9248 fi
9249
9250 : see if socketpair exists
9251 set socketpair d_sockpair
9252 eval $inlibc
9253
9254
9255 echo " "
9256 echo "Checking the availability of certain socket constants..." >& 4
9257 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9258         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9259         $cat >try.c <<EOF
9260 #include <sys/types.h>
9261 #include <sys/socket.h>
9262 int main() {
9263     int i = $ENUM;
9264 }
9265 EOF
9266         val="$undef"
9267         set try; if eval $compile; then
9268                 val="$define"
9269         fi
9270         set d_${enum}; eval $setvar
9271         $rm -f try.c try
9272 done
9273
9274 : see if this is a sys/uio.h system
9275 set sys/uio.h i_sysuio
9276 eval $inhdr
9277
9278
9279 echo " "
9280 echo "Checking to see if your system supports struct cmsghdr..." >&4
9281 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9282 eval $hasstruct
9283 case "$d_cmsghdr_s" in
9284 "$define")      echo "Yes, it does."   ;;
9285 *)              echo "No, it doesn't." ;;
9286 esac
9287
9288
9289 : check for const keyword
9290 echo " "
9291 echo 'Checking to see if your C compiler knows about "const"...' >&4
9292 $cat >const.c <<'EOCP'
9293 typedef struct spug { int drokk; } spug;
9294 int main()
9295 {
9296         const char *foo;
9297         const spug y;
9298 }
9299 EOCP
9300 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9301         val="$define"
9302         echo "Yup, it does."
9303 else
9304         val="$undef"
9305         echo "Nope, it doesn't."
9306 fi
9307 set d_const
9308 eval $setvar
9309
9310 : see if crypt exists
9311 echo " "
9312 if set crypt val -f d_crypt; eval $csym; $val; then
9313         echo 'crypt() found.' >&4
9314         val="$define"
9315         cryptlib=''
9316 else
9317         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9318         if $test -z "$cryptlib"; then
9319                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9320         else
9321                 cryptlib=-lcrypt
9322         fi
9323         if $test -z "$cryptlib"; then
9324                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9325         else
9326                 cryptlib=-lcrypt
9327         fi
9328         if $test -z "$cryptlib"; then
9329                 cryptlib=`./loc libcrypt$_a "" $libpth`
9330         else
9331                 cryptlib=-lcrypt
9332         fi
9333         if $test -z "$cryptlib"; then
9334                 echo 'crypt() NOT found.' >&4
9335                 val="$undef"
9336         else
9337                 val="$define"
9338         fi
9339 fi
9340 set d_crypt
9341 eval $setvar
9342
9343 : get csh whereabouts
9344 case "$csh" in
9345 'csh') val="$undef" ;;
9346 *) val="$define" ;;
9347 esac
9348 set d_csh
9349 eval $setvar
9350 : Respect a hint or command line value for full_csh.
9351 case "$full_csh" in
9352 '') full_csh=$csh ;;
9353 esac
9354
9355 : see if cuserid exists
9356 set cuserid d_cuserid
9357 eval $inlibc
9358
9359 : see if this is a limits.h system
9360 set limits.h i_limits
9361 eval $inhdr
9362
9363 : see if this is a float.h system
9364 set float.h i_float
9365 eval $inhdr
9366
9367 : See if number of significant digits in a double precision number is known
9368 echo " "
9369 $cat >dbl_dig.c <<EOM
9370 #$i_limits I_LIMITS
9371 #$i_float I_FLOAT
9372 #ifdef I_LIMITS
9373 #include <limits.h>
9374 #endif
9375 #ifdef I_FLOAT
9376 #include <float.h>
9377 #endif
9378 #ifdef DBL_DIG
9379 printf("Contains DBL_DIG");
9380 #endif
9381 EOM
9382 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9383 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9384         echo "DBL_DIG found." >&4
9385         val="$define"
9386 else
9387         echo "DBL_DIG NOT found." >&4
9388         val="$undef"
9389 fi
9390 $rm -f dbl_dig.?
9391 set d_dbl_dig
9392 eval $setvar
9393
9394 hasproto='varname=$1; func=$2; shift; shift;
9395 while $test $# -ge 2; do
9396         case "$1" in
9397         $define) echo "#include <$2>";;
9398         esac ;
9399     shift 2;
9400 done > try.c;
9401 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9402 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9403         echo "$func() prototype found.";
9404         val="$define";
9405 else
9406         echo "$func() prototype NOT found.";
9407         val="$undef";
9408 fi;
9409 set $varname;
9410 eval $setvar;
9411 $rm -f try.c tryout.c'
9412
9413 : see if dbm.h is available
9414 : see if dbmclose exists
9415 set dbmclose d_dbmclose
9416 eval $inlibc
9417
9418 case "$d_dbmclose" in
9419 $define)
9420         set dbm.h i_dbm
9421         eval $inhdr
9422         case "$i_dbm" in
9423         $define)
9424                 val="$undef"
9425                 set i_rpcsvcdbm
9426                 eval $setvar
9427                 ;;
9428         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9429                 eval $inhdr
9430                 ;;
9431         esac
9432         ;;
9433 *)      echo "We won't be including <dbm.h>"
9434         val="$undef"
9435         set i_dbm
9436         eval $setvar
9437         val="$undef"
9438         set i_rpcsvcdbm
9439         eval $setvar
9440         ;;
9441 esac
9442
9443 : see if prototype for dbminit is available
9444 echo " "
9445 set d_dbminitproto dbminit $i_dbm dbm.h
9446 eval $hasproto
9447
9448 : see if difftime exists
9449 set difftime d_difftime
9450 eval $inlibc
9451
9452 : see if this is a dirent system
9453 echo " "
9454 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9455         val="$define"
9456         echo "<dirent.h> found." >&4
9457 else
9458         val="$undef"
9459         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9460                 echo "<sys/dir.h> found." >&4
9461                 echo " "
9462         else
9463                 xinc=`./findhdr sys/ndir.h`
9464         fi
9465         echo "<dirent.h> NOT found." >&4
9466 fi
9467 set i_dirent
9468 eval $setvar
9469
9470 : Look for type of directory structure.
9471 echo " "
9472 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9473
9474 case "$direntrytype" in
9475 ''|' ')
9476         case "$i_dirent" in
9477         $define) guess1='struct dirent' ;;
9478         *) guess1='struct direct'  ;;
9479         esac
9480         ;;
9481 *)      guess1="$direntrytype"
9482         ;;
9483 esac
9484
9485 case "$guess1" in
9486 'struct dirent') guess2='struct direct' ;;
9487 *) guess2='struct dirent' ;;
9488 esac
9489                 
9490 if $contains "$guess1" try.c >/dev/null 2>&1; then
9491         direntrytype="$guess1"
9492         echo "Your directory entries are $direntrytype." >&4
9493 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9494         direntrytype="$guess2"
9495         echo "Your directory entries seem to be $direntrytype." >&4
9496 else
9497         echo "I don't recognize your system's directory entries." >&4
9498         rp="What type is used for directory entries on this system?"
9499         dflt="$guess1"
9500         . ./myread
9501         direntrytype="$ans"
9502 fi
9503 $rm -f try.c
9504
9505
9506 : see if the directory entry stores field length
9507 echo " "
9508 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9509 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9510         echo "Good, your directory entry keeps length information in d_namlen." >&4
9511         val="$define"
9512 else
9513         echo "Your directory entry does not know about the d_namlen field." >&4
9514         val="$undef"
9515 fi
9516 set d_dirnamlen
9517 eval $setvar
9518 $rm -f try.c
9519
9520 : see if dlerror exists
9521 xxx_runnm="$runnm"
9522 runnm=false
9523 set dlerror d_dlerror
9524 eval $inlibc
9525 runnm="$xxx_runnm"
9526
9527 : see if dlfcn is available
9528 set dlfcn.h i_dlfcn
9529 eval $inhdr
9530
9531 case "$usedl" in
9532 $define|y|true)
9533         $cat << EOM
9534
9535 On a few systems, the dynamically loaded modules that perl generates and uses
9536 will need a different extension than shared libs. The default will probably
9537 be appropriate.
9538
9539 EOM
9540         case "$dlext" in
9541         '')     dflt="$so" ;;
9542         *)      dflt="$dlext" ;;
9543         esac
9544         rp='What is the extension of dynamically loaded modules'
9545         . ./myread
9546         dlext="$ans"
9547         ;;
9548 *)
9549         dlext="none"
9550         ;;
9551 esac
9552
9553 : Check if dlsym need a leading underscore
9554 echo " "
9555 val="$undef"
9556
9557 case "$dlsrc" in
9558 dl_dlopen.xs)
9559         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9560         $cat >dyna.c <<'EOM'
9561 fred () { }
9562 EOM
9563
9564 $cat >fred.c<<EOM
9565
9566 #include <stdio.h>
9567 #$i_dlfcn I_DLFCN
9568 #ifdef I_DLFCN
9569 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9570 #else
9571 #include <sys/types.h>
9572 #include <nlist.h>
9573 #include <link.h>
9574 #endif
9575
9576 extern int fred() ;
9577
9578 int main()
9579 {
9580     void * handle ;
9581     void * symbol ;
9582 #ifndef RTLD_LAZY
9583     int mode = 1 ;
9584 #else
9585     int mode = RTLD_LAZY ;
9586 #endif
9587     handle = dlopen("./dyna.$dlext", mode) ;
9588     if (handle == NULL) {
9589         printf ("1\n") ;
9590         fflush (stdout) ;
9591         exit(0);
9592     }
9593     symbol = dlsym(handle, "fred") ;
9594     if (symbol == NULL) {
9595         /* try putting a leading underscore */
9596         symbol = dlsym(handle, "_fred") ;
9597         if (symbol == NULL) {
9598             printf ("2\n") ;
9599             fflush (stdout) ;
9600             exit(0);
9601         }
9602         printf ("3\n") ;
9603     }
9604     else
9605         printf ("4\n") ;
9606     fflush (stdout) ;
9607     exit(0);
9608 }
9609 EOM
9610         : Call the object file tmp-dyna.o in case dlext=o.
9611         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9612                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9613                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9614                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9615                 xxx=`$run ./fred`
9616                 case $xxx in
9617                 1)      echo "Test program failed using dlopen." >&4
9618                         echo "Perhaps you should not use dynamic loading." >&4;;
9619                 2)      echo "Test program failed using dlsym." >&4
9620                         echo "Perhaps you should not use dynamic loading." >&4;;
9621                 3)      echo "dlsym needs a leading underscore" >&4
9622                         val="$define" ;;
9623                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9624                 esac
9625         else
9626                 echo "I can't compile and run the test program." >&4
9627                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9628         fi
9629         ;;
9630 esac
9631                 
9632 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9633
9634 set d_dlsymun
9635 eval $setvar
9636
9637 : see if prototype for drand48 is available
9638 echo " "
9639 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9640 eval $hasproto
9641
9642 : see if dup2 exists
9643 set dup2 d_dup2
9644 eval $inlibc
9645
9646 : see if eaccess exists
9647 set eaccess d_eaccess
9648 eval $inlibc
9649
9650 : see if endgrent exists
9651 set endgrent d_endgrent
9652 eval $inlibc
9653
9654 : see if endhostent exists
9655 set endhostent d_endhent
9656 eval $inlibc
9657
9658 : see if endnetent exists
9659 set endnetent d_endnent
9660 eval $inlibc
9661
9662 : see if endprotoent exists
9663 set endprotoent d_endpent
9664 eval $inlibc
9665
9666 : see if endpwent exists
9667 set endpwent d_endpwent
9668 eval $inlibc
9669
9670 : see if endservent exists
9671 set endservent d_endsent
9672 eval $inlibc
9673
9674 : Locate the flags for 'open()'
9675 echo " "
9676 $cat >try.c <<'EOCP'
9677 #include <sys/types.h>
9678 #ifdef I_FCNTL
9679 #include <fcntl.h>
9680 #endif
9681 #ifdef I_SYS_FILE
9682 #include <sys/file.h>
9683 #endif
9684 int main() {
9685         if(O_RDONLY);
9686 #ifdef O_TRUNC
9687         exit(0);
9688 #else
9689         exit(1);
9690 #endif
9691 }
9692 EOCP
9693 : check sys/file.h first to get FREAD on Sun
9694 if $test `./findhdr sys/file.h` && \
9695                 set try -DI_SYS_FILE && eval $compile; then
9696         h_sysfile=true;
9697         echo "<sys/file.h> defines the O_* constants..." >&4
9698         if $run ./try; then
9699                 echo "and you have the 3 argument form of open()." >&4
9700                 val="$define"
9701         else
9702                 echo "but not the 3 argument form of open().  Oh, well." >&4
9703                 val="$undef"
9704         fi
9705 elif $test `./findhdr fcntl.h` && \
9706                 set try -DI_FCNTL && eval $compile; then
9707         h_fcntl=true;
9708         echo "<fcntl.h> defines the O_* constants..." >&4
9709         if $run ./try; then
9710                 echo "and you have the 3 argument form of open()." >&4
9711                 val="$define"
9712         else
9713                 echo "but not the 3 argument form of open().  Oh, well." >&4
9714                 val="$undef"
9715         fi
9716 else
9717         val="$undef"
9718         echo "I can't find the O_* constant definitions!  You got problems." >&4
9719 fi
9720 set d_open3
9721 eval $setvar
9722 $rm -f try try.*
9723
9724 : see which of string.h or strings.h is needed
9725 echo " "
9726 strings=`./findhdr string.h`
9727 if $test "$strings" && $test -r "$strings"; then
9728         echo "Using <string.h> instead of <strings.h>." >&4
9729         val="$define"
9730 else
9731         val="$undef"
9732         strings=`./findhdr strings.h`
9733         if $test "$strings" && $test -r "$strings"; then
9734                 echo "Using <strings.h> instead of <string.h>." >&4
9735         else
9736                 echo "No string header found -- You'll surely have problems." >&4
9737         fi
9738 fi
9739 set i_string
9740 eval $setvar
9741 case "$i_string" in
9742 "$undef") strings=`./findhdr strings.h`;;
9743 *)        strings=`./findhdr string.h`;;
9744 esac
9745
9746 : check for non-blocking I/O stuff
9747 case "$h_sysfile" in
9748 true) echo "#include <sys/file.h>" > head.c;;
9749 *)
9750        case "$h_fcntl" in
9751        true) echo "#include <fcntl.h>" > head.c;;
9752        *) echo "#include <sys/fcntl.h>" > head.c;;
9753        esac
9754        ;;
9755 esac
9756 echo " "
9757 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9758 case "$o_nonblock" in
9759 '')
9760         $cat head.c > try.c
9761         $cat >>try.c <<'EOCP'
9762 #include <stdio.h>
9763 #include <stdlib.h>
9764 int main() {
9765 #ifdef O_NONBLOCK
9766         printf("O_NONBLOCK\n");
9767         exit(0);
9768 #endif
9769 #ifdef O_NDELAY
9770         printf("O_NDELAY\n");
9771         exit(0);
9772 #endif
9773 #ifdef FNDELAY
9774         printf("FNDELAY\n");
9775         exit(0);
9776 #endif
9777         exit(0);
9778 }
9779 EOCP
9780         set try
9781         if eval $compile_ok; then
9782                 o_nonblock=`$run ./try`
9783                 case "$o_nonblock" in
9784                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9785                 *) echo "Seems like we can use $o_nonblock.";;
9786                 esac
9787         else
9788                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9789         fi
9790         ;;
9791 *) echo "Using $hint value $o_nonblock.";;
9792 esac
9793 $rm -f try try.* .out core
9794
9795 echo " "
9796 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9797 case "$eagain" in
9798 '')
9799         $cat head.c > try.c
9800         $cat >>try.c <<EOCP
9801 #include <errno.h>
9802 #include <sys/types.h>
9803 #include <signal.h>
9804 #include <stdio.h> 
9805 #include <stdlib.h> 
9806 #define MY_O_NONBLOCK $o_nonblock
9807 #ifndef errno  /* XXX need better Configure test */
9808 extern int errno;
9809 #endif
9810 #$i_unistd I_UNISTD
9811 #ifdef I_UNISTD
9812 #include <unistd.h>
9813 #endif
9814 #$i_string I_STRING
9815 #ifdef I_STRING
9816 #include <string.h>
9817 #else
9818 #include <strings.h>
9819 #endif
9820 $signal_t blech(x) int x; { exit(3); }
9821 EOCP
9822         $cat >> try.c <<'EOCP'
9823 int main()
9824 {
9825         int pd[2];
9826         int pu[2];
9827         char buf[1];
9828         char string[100];
9829
9830         pipe(pd);       /* Down: child -> parent */
9831         pipe(pu);       /* Up: parent -> child */
9832         if (0 != fork()) {
9833                 int ret;
9834                 close(pd[1]);   /* Parent reads from pd[0] */
9835                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9836 #ifdef F_SETFL
9837                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9838                         exit(1);
9839 #else
9840                 exit(4);
9841 #endif
9842                 signal(SIGALRM, blech);
9843                 alarm(5);
9844                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9845                         exit(2);
9846                 sprintf(string, "%d\n", ret);
9847                 write(2, string, strlen(string));
9848                 alarm(0);
9849 #ifdef EAGAIN
9850                 if (errno == EAGAIN) {
9851                         printf("EAGAIN\n");
9852                         goto ok;
9853                 }
9854 #endif
9855 #ifdef EWOULDBLOCK
9856                 if (errno == EWOULDBLOCK)
9857                         printf("EWOULDBLOCK\n");
9858 #endif
9859         ok:
9860                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9861                 sleep(2);                               /* Give it time to close our pipe */
9862                 alarm(5);
9863                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9864                 alarm(0);
9865                 sprintf(string, "%d\n", ret);
9866                 write(3, string, strlen(string));
9867                 exit(0);
9868         }
9869
9870         close(pd[0]);                   /* We write to pd[1] */
9871         close(pu[1]);                   /* We read from pu[0] */
9872         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9873         close(pd[1]);                   /* Pipe pd is now fully closed! */
9874         exit(0);                                /* Bye bye, thank you for playing! */
9875 }
9876 EOCP
9877         set try
9878         if eval $compile_ok; then
9879                 echo "$startsh" >mtry
9880                 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9881                 chmod +x mtry
9882                 ./mtry >/dev/null 2>&1
9883                 case $? in
9884                 0) eagain=`$cat try.out`;;
9885                 1) echo "Could not perform non-blocking setting!";;
9886                 2) echo "I did a successful read() for something that was not there!";;
9887                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9888                 4) echo "Could not find F_SETFL!";;
9889                 *) echo "Something terribly wrong happened during testing.";;
9890                 esac
9891                 rd_nodata=`$cat try.ret`
9892                 echo "A read() system call with no data present returns $rd_nodata."
9893                 case "$rd_nodata" in
9894                 0|-1) ;;
9895                 *)
9896                         echo "(That's peculiar, fixing that to be -1.)"
9897                         rd_nodata=-1
9898                         ;;
9899                 esac
9900                 case "$eagain" in
9901                 '')
9902                         echo "Forcing errno EAGAIN on read() with no data available."
9903                         eagain=EAGAIN
9904                         ;;
9905                 *)
9906                         echo "Your read() sets errno to $eagain when no data is available."
9907                         ;;
9908                 esac
9909                 status=`$cat try.err`
9910                 case "$status" in
9911                 0) echo "And it correctly returns 0 to signal EOF.";;
9912                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9913                 *) echo "However, your read() returns '$status' on EOF??";;
9914                 esac
9915                 val="$define"
9916                 if test "$status" = "$rd_nodata"; then
9917                         echo "WARNING: you can't distinguish between EOF and no data!"
9918                         val="$undef"
9919                 fi
9920         else
9921                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9922                 eagain=EAGAIN
9923         fi
9924         set d_eofnblk
9925         eval $setvar
9926         ;;
9927 *)
9928         echo "Using $hint value $eagain."
9929         echo "Your read() returns $rd_nodata when no data is present."
9930         case "$d_eofnblk" in
9931         "$define") echo "And you can see EOF because read() returns 0.";;
9932         "$undef") echo "But you can't see EOF status from read() returned value.";;
9933         *)
9934                 echo "(Assuming you can't see EOF status from read anyway.)"
9935                 d_eofnblk=$undef
9936                 ;;
9937         esac
9938         ;;
9939 esac
9940 $rm -f try try.* .out core head.c mtry
9941
9942 : see if fchdir exists
9943 set fchdir d_fchdir
9944 eval $inlibc
9945
9946 : see if fchmod exists
9947 set fchmod d_fchmod
9948 eval $inlibc
9949
9950 : see if fchown exists
9951 set fchown d_fchown
9952 eval $inlibc
9953
9954 : see if this is an fcntl system
9955 set fcntl d_fcntl
9956 eval $inlibc
9957
9958 echo " "
9959 : See if fcntl-based locking works.
9960 $cat >try.c <<EOCP
9961 #include <stdlib.h>
9962 #include <unistd.h>
9963 #include <fcntl.h>
9964 #include <signal.h>
9965 $signal_t blech(x) int x; { exit(3); }
9966 int main() {
9967 #if defined(F_SETLK) && defined(F_SETLKW)
9968      struct flock flock;
9969      int retval, fd;
9970      fd = open("try.c", O_RDONLY);
9971      flock.l_type = F_RDLCK;
9972      flock.l_whence = SEEK_SET;
9973      flock.l_start = flock.l_len = 0;
9974      signal(SIGALRM, blech);
9975      alarm(10);
9976      retval = fcntl(fd, F_SETLK, &flock);
9977      close(fd);
9978      (retval < 0 ? exit(2) : exit(0));
9979 #else
9980      exit(2);
9981 #endif
9982 }
9983 EOCP
9984 echo "Checking if fcntl-based file locking works... "
9985 case "$d_fcntl" in
9986 "$define")
9987         set try
9988         if eval $compile_ok; then
9989                 if $run ./try; then
9990                         echo "Yes, it seems to work."
9991                         val="$define"
9992                 else
9993                         echo "Nope, it didn't work."
9994                         val="$undef"
9995                         case "$?" in
9996                         3) $cat >&4 <<EOM
9997 ***
9998 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
9999 *** This is (almost) impossible.
10000 *** If your NFS lock daemons are not feeling well, something like
10001 *** this may happen, please investigate.  Cannot continue, aborting.
10002 ***
10003 EOM
10004                                 exit 1
10005                                 ;;
10006                         esac
10007                 fi
10008         else
10009                 echo "I'm unable to compile the test program, so I'll assume not."
10010                 val="$undef"
10011         fi
10012         ;;
10013 *) val="$undef";
10014         echo "Nope, since you don't even have fcntl()."
10015         ;;
10016 esac
10017 set d_fcntl_can_lock
10018 eval $setvar
10019 $rm -f try*
10020
10021
10022 : see if sys/select.h has to be included
10023 set sys/select.h i_sysselct
10024 eval $inhdr
10025
10026 : see if we should include time.h, sys/time.h, or both
10027 echo " "
10028 if test "X$timeincl" = X; then
10029         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10030         $echo $n "I'm now running the test program...$c"
10031         $cat >try.c <<'EOCP'
10032 #include <sys/types.h>
10033 #ifdef I_TIME
10034 #include <time.h>
10035 #endif
10036 #ifdef I_SYSTIME
10037 #ifdef SYSTIMEKERNEL
10038 #define KERNEL
10039 #endif
10040 #include <sys/time.h>
10041 #endif
10042 #ifdef I_SYSSELECT
10043 #include <sys/select.h>
10044 #endif
10045 int main()
10046 {
10047         struct tm foo;
10048 #ifdef S_TIMEVAL
10049         struct timeval bar;
10050 #endif
10051 #ifdef S_TIMEZONE
10052         struct timezone tzp;
10053 #endif
10054         if (foo.tm_sec == foo.tm_sec)
10055                 exit(0);
10056 #ifdef S_TIMEVAL
10057         if (bar.tv_sec == bar.tv_sec)
10058                 exit(0);
10059 #endif
10060         exit(1);
10061 }
10062 EOCP
10063         flags=''
10064         for s_timezone in '-DS_TIMEZONE' ''; do
10065         sysselect=''
10066         for s_timeval in '-DS_TIMEVAL' ''; do
10067         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10068         for i_time in '' '-DI_TIME'; do
10069         for i_systime in '-DI_SYSTIME' ''; do
10070                 case "$flags" in
10071                 '') $echo $n ".$c"
10072                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10073                         if eval $compile; then
10074                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10075                                 shift
10076                                 flags="$*"
10077                                 echo " "
10078                                 $echo $n "Succeeded with $flags$c"
10079                         fi
10080                         ;;
10081                 esac
10082         done
10083         done
10084         done
10085         done
10086         done
10087         timeincl=''
10088         echo " "
10089         case "$flags" in
10090         *SYSTIMEKERNEL*) i_systimek="$define"
10091                 timeincl=`./findhdr sys/time.h`
10092                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10093         *) i_systimek="$undef";;
10094         esac
10095         case "$flags" in
10096         *I_TIME*) i_time="$define"
10097                 timeincl=`./findhdr time.h`" $timeincl"
10098                 echo "We'll include <time.h>." >&4;;
10099         *) i_time="$undef";;
10100         esac
10101         case "$flags" in
10102         *I_SYSTIME*) i_systime="$define"
10103                 timeincl=`./findhdr sys/time.h`" $timeincl"
10104                 echo "We'll include <sys/time.h>." >&4;;
10105         *) i_systime="$undef";;
10106         esac
10107         $rm -f try.c try
10108 fi
10109
10110 : check for fd_set items
10111 $cat <<EOM
10112
10113 Checking to see how well your C compiler handles fd_set and friends ...
10114 EOM
10115 $cat >try.c <<EOCP
10116 #$i_systime I_SYS_TIME
10117 #$i_sysselct I_SYS_SELECT
10118 #$d_socket HAS_SOCKET
10119 #include <sys/types.h>
10120 #ifdef HAS_SOCKET
10121 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10122 #endif
10123 #ifdef I_SYS_TIME
10124 #include <sys/time.h>
10125 #endif
10126 #ifdef I_SYS_SELECT
10127 #include <sys/select.h>
10128 #endif
10129 int main() {
10130         fd_set fds;
10131
10132 #ifdef TRYBITS
10133         if(fds.fds_bits);
10134 #endif
10135
10136 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10137         exit(0);
10138 #else
10139         exit(1);
10140 #endif
10141 }
10142 EOCP
10143 set try -DTRYBITS
10144 if eval $compile; then
10145         d_fds_bits="$define"
10146         d_fd_set="$define"
10147         echo "Well, your system knows about the normal fd_set typedef..." >&4
10148         if $run ./try; then
10149                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10150                 d_fd_macros="$define"
10151         else
10152                 $cat >&4 <<'EOM'
10153 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10154 EOM
10155                 d_fd_macros="$undef"
10156         fi
10157 else
10158         $cat <<'EOM'
10159 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10160 EOM
10161         set try
10162         if eval $compile; then
10163                 d_fds_bits="$undef"
10164                 d_fd_set="$define"
10165                 echo "Well, your system has some sort of fd_set available..." >&4
10166                 if $run ./try; then
10167                         echo "and you have the normal fd_set macros." >&4
10168                         d_fd_macros="$define"
10169                 else
10170                         $cat <<'EOM'
10171 but not the normal fd_set macros!  Gross!  More work for me...
10172 EOM
10173                         d_fd_macros="$undef"
10174                 fi
10175         else
10176         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10177                 d_fd_set="$undef"
10178                 d_fds_bits="$undef"
10179                 d_fd_macros="$undef"
10180         fi
10181 fi
10182 $rm -f try try.*
10183
10184 : see if fgetpos exists
10185 set fgetpos d_fgetpos
10186 eval $inlibc
10187
10188 : see if finite exists
10189 set finite d_finite
10190 eval $inlibc
10191
10192 : see if finitel exists
10193 set finitel d_finitel
10194 eval $inlibc
10195
10196 : see if flock exists
10197 set flock d_flock
10198 eval $inlibc
10199
10200 : see if this is a sys/file.h system
10201 val=''
10202 set sys/file.h val
10203 eval $inhdr
10204
10205 : do we need to include sys/file.h ?
10206 case "$val" in
10207 "$define")
10208         echo " "
10209         if $h_sysfile; then
10210                 val="$define"
10211                 echo "We'll be including <sys/file.h>." >&4
10212         else
10213                 val="$undef"
10214                 echo "We won't be including <sys/file.h>." >&4
10215         fi
10216         ;;
10217 *)
10218         h_sysfile=false
10219         ;;
10220 esac
10221 set i_sysfile
10222 eval $setvar
10223
10224 : see if prototype for flock is available
10225 echo " "
10226 set d_flockproto flock $i_sysfile sys/file.h
10227 eval $hasproto
10228
10229 : see if fork exists
10230 set fork d_fork
10231 eval $inlibc
10232
10233 : see if fp_class exists
10234 set fp_class d_fp_class
10235 eval $inlibc
10236
10237 : see if pathconf exists
10238 set pathconf d_pathconf
10239 eval $inlibc
10240
10241 : see if fpathconf exists
10242 set fpathconf d_fpathconf
10243 eval $inlibc
10244
10245 : see if fpclass exists
10246 set fpclass d_fpclass
10247 eval $inlibc
10248
10249 : see if fpclassify exists
10250 set fpclassify d_fpclassify
10251 eval $inlibc
10252
10253 : see if fpclassl exists
10254 set fpclassl d_fpclassl
10255 eval $inlibc
10256
10257
10258 : check for fpos64_t
10259 echo " "
10260 echo "Checking to see if you have fpos64_t..." >&4
10261 $cat >try.c <<EOCP
10262 #include <stdio.h>
10263 int main() { fpos64_t x = 7; }
10264 EOCP
10265 set try
10266 if eval $compile; then
10267         val="$define"
10268         echo "You have fpos64_t."
10269 else
10270         val="$undef"
10271         echo "You do not have fpos64_t."
10272         case "$fpossize" in
10273         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10274         esac
10275 fi
10276 $rm -f try.* try
10277 set d_fpos64_t
10278 eval $setvar
10279
10280 : see if frexpl exists
10281 set frexpl d_frexpl
10282 eval $inlibc
10283
10284 : see if this is a sys/param system
10285 set sys/param.h i_sysparam
10286 eval $inhdr
10287
10288 : see if this is a sys/mount.h system
10289 set sys/mount.h i_sysmount
10290 eval $inhdr
10291
10292
10293 echo " "
10294 echo "Checking to see if your system supports struct fs_data..." >&4
10295 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10296 eval $hasstruct
10297 case "$d_fs_data_s" in
10298 "$define")      echo "Yes, it does."   ;;
10299 *)              echo "No, it doesn't." ;;
10300 esac
10301
10302 : see if fseeko exists
10303 set fseeko d_fseeko
10304 eval $inlibc
10305 case "$longsize" in
10306 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10307 esac
10308
10309 : see if fsetpos exists
10310 set fsetpos d_fsetpos
10311 eval $inlibc
10312
10313
10314 : see if fstatfs exists
10315 set fstatfs d_fstatfs
10316 eval $inlibc
10317
10318
10319 : see if statvfs exists
10320 set statvfs d_statvfs
10321 eval $inlibc
10322
10323 : see if fstatvfs exists
10324 set fstatvfs d_fstatvfs
10325 eval $inlibc
10326
10327
10328 : see if fsync exists
10329 set fsync d_fsync
10330 eval $inlibc
10331
10332 : see if ftello exists
10333 set ftello d_ftello
10334 eval $inlibc
10335 case "$longsize" in
10336 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10337 esac
10338
10339 : see if getcwd exists
10340 set getcwd d_getcwd
10341 eval $inlibc
10342
10343 : see if getespwnam exists
10344 set getespwnam d_getespwnam
10345 eval $inlibc
10346
10347
10348 : see if getfsstat exists
10349 set getfsstat d_getfsstat
10350 eval $inlibc
10351
10352 : see if getgrent exists
10353 set getgrent d_getgrent
10354 eval $inlibc
10355
10356 : see if gethostbyaddr exists
10357 set gethostbyaddr d_gethbyaddr
10358 eval $inlibc
10359
10360 : see if gethostbyname exists
10361 set gethostbyname d_gethbyname
10362 eval $inlibc
10363
10364 : see if gethostent exists
10365 set gethostent d_gethent
10366 eval $inlibc
10367
10368 : see how we will look up host name
10369 echo " "
10370 call=''
10371 if set gethostname val -f d_gethname; eval $csym; $val; then
10372         echo 'gethostname() found.' >&4
10373         d_gethname="$define"
10374         call=gethostname
10375 fi
10376 if set uname val -f d_uname; eval $csym; $val; then
10377         if ./xenix; then
10378                 $cat <<'EOM'
10379 uname() was found, but you're running xenix, and older versions of xenix
10380 have a broken uname(). If you don't really know whether your xenix is old
10381 enough to have a broken system call, use the default answer.
10382
10383 EOM
10384                 dflt=y
10385                 case "$d_uname" in
10386                 "$define") dflt=n;;
10387                 esac
10388                 rp='Is your uname() broken?'
10389                 . ./myread
10390                 case "$ans" in
10391                 n*) d_uname="$define"; call=uname;;
10392                 esac
10393         else
10394                 echo 'uname() found.' >&4
10395                 d_uname="$define"
10396                 case "$call" in
10397                 '') call=uname ;;
10398                 esac
10399         fi
10400 fi
10401 case "$d_gethname" in
10402 '') d_gethname="$undef";;
10403 esac
10404 case "$d_uname" in
10405 '') d_uname="$undef";;
10406 esac
10407 case "$d_uname$d_gethname" in
10408 *define*)
10409         dflt=n
10410         cat <<EOM
10411  
10412 Every now and then someone has a $call() that lies about the hostname
10413 but can't be fixed for political or economic reasons.  If you wish, I can
10414 pretend $call() isn't there and maybe compute hostname at run-time
10415 thanks to the '$phostname' command.
10416
10417 EOM
10418         rp="Shall I ignore $call() from now on?"
10419         . ./myread
10420         case "$ans" in
10421         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10422         esac;;
10423 esac
10424 case "$phostname" in
10425 '') aphostname='';;
10426 *) case "$aphostname" in
10427         /*) ;;
10428         *) set X $phostname
10429                 shift
10430                 file=$1
10431                 shift
10432                 file=`./loc $file $file $pth`
10433                 aphostname=`echo $file $*`
10434                 ;;
10435         esac
10436         ;;
10437 esac
10438 case "$d_uname$d_gethname" in
10439 *define*) ;;
10440 *)
10441         case "$phostname" in
10442         '')
10443                 echo "There will be no way for $package to get your hostname." >&4;;
10444         *)
10445         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10446                 ;;
10447         esac;;
10448 esac
10449 case "$d_phostname" in
10450 '') d_phostname="$undef";;
10451 esac
10452
10453 : see if this is a netdb.h system
10454 set netdb.h i_netdb
10455 eval $inhdr
10456
10457 : see if prototypes for various gethostxxx netdb.h functions are available
10458 echo " "
10459 set d_gethostprotos gethostent $i_netdb netdb.h
10460 eval $hasproto
10461
10462 : see if getitimer exists
10463 set getitimer d_getitimer
10464 eval $inlibc
10465
10466 : see if getlogin exists
10467 set getlogin d_getlogin
10468 eval $inlibc
10469
10470 : see if getmnt exists
10471 set getmnt d_getmnt
10472 eval $inlibc
10473
10474 : see if getmntent exists
10475 set getmntent d_getmntent
10476 eval $inlibc
10477
10478 : see if getnetbyaddr exists
10479 set getnetbyaddr d_getnbyaddr
10480 eval $inlibc
10481
10482 : see if getnetbyname exists
10483 set getnetbyname d_getnbyname
10484 eval $inlibc
10485
10486 : see if getnetent exists
10487 set getnetent d_getnent
10488 eval $inlibc
10489
10490 : see if prototypes for various getnetxxx netdb.h functions are available
10491 echo " "
10492 set d_getnetprotos getnetent $i_netdb netdb.h
10493 eval $hasproto
10494
10495 : see if getpagesize exists
10496 set getpagesize d_getpagsz
10497 eval $inlibc
10498
10499
10500 : see if getprotobyname exists
10501 set getprotobyname d_getpbyname
10502 eval $inlibc
10503
10504 : see if getprotobynumber exists
10505 set getprotobynumber d_getpbynumber
10506 eval $inlibc
10507
10508 : see if getprotoent exists
10509 set getprotoent d_getpent
10510 eval $inlibc
10511
10512 : see if getpgid exists
10513 set getpgid d_getpgid
10514 eval $inlibc
10515
10516 : see if getpgrp2 exists
10517 set getpgrp2 d_getpgrp2
10518 eval $inlibc
10519
10520 : see if getppid exists
10521 set getppid d_getppid
10522 eval $inlibc
10523
10524 : see if getpriority exists
10525 set getpriority d_getprior
10526 eval $inlibc
10527
10528 : see if prototypes for various getprotoxxx netdb.h functions are available
10529 echo " "
10530 set d_getprotoprotos getprotoent $i_netdb netdb.h
10531 eval $hasproto
10532
10533 : see if getprpwnam exists
10534 set getprpwnam d_getprpwnam
10535 eval $inlibc
10536
10537 : see if getpwent exists
10538 set getpwent d_getpwent
10539 eval $inlibc
10540
10541
10542 : see if getservbyname exists
10543 set getservbyname d_getsbyname
10544 eval $inlibc
10545
10546 : see if getservbyport exists
10547 set getservbyport d_getsbyport
10548 eval $inlibc
10549
10550 : see if getservent exists
10551 set getservent d_getsent
10552 eval $inlibc
10553
10554 : see if prototypes for various getservxxx netdb.h functions are available
10555 echo " "
10556 set d_getservprotos getservent $i_netdb netdb.h
10557 eval $hasproto
10558
10559 : see if getspnam exists
10560 set getspnam d_getspnam
10561 eval $inlibc
10562
10563 : see if gettimeofday or ftime exists
10564 set gettimeofday d_gettimeod
10565 eval $inlibc
10566 case "$d_gettimeod" in
10567 "$undef")
10568         set ftime d_ftime 
10569         eval $inlibc
10570         ;;
10571 *)
10572         val="$undef"; set d_ftime; eval $setvar
10573         ;;
10574 esac
10575 case "$d_gettimeod$d_ftime" in
10576 "$undef$undef")
10577         echo " "
10578         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10579         ;;
10580 esac
10581
10582 : see if this is an grp system
10583 set grp.h i_grp
10584 eval $inhdr
10585
10586 case "$i_grp" in
10587 $define)
10588         xxx=`./findhdr grp.h`
10589         $cppstdin $cppflags $cppminus < $xxx >$$.h
10590
10591         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10592                 val="$define"
10593         else
10594                 val="$undef"
10595         fi
10596         set d_grpasswd
10597         eval $setvar
10598
10599         $rm -f $$.h
10600         ;;
10601 *)
10602         val="$undef";
10603         set d_grpasswd; eval $setvar
10604         ;;
10605 esac
10606
10607 : see if hasmntopt exists
10608 set hasmntopt d_hasmntopt
10609 eval $inlibc
10610
10611 : see if this is a netinet/in.h or sys/in.h system
10612 set netinet/in.h i_niin sys/in.h i_sysin
10613 eval $inhdr
10614
10615 : see if arpa/inet.h has to be included
10616 set arpa/inet.h i_arpainet
10617 eval $inhdr
10618
10619 : see if htonl --and friends-- exists
10620 val=''
10621 set htonl val
10622 eval $inlibc
10623
10624 : Maybe they are macros.
10625 case "$val" in
10626 $undef)
10627         $cat >htonl.c <<EOM
10628 #include <stdio.h>
10629 #include <sys/types.h>
10630 #$i_niin I_NETINET_IN
10631 #$i_sysin I_SYS_IN
10632 #$i_arpainet I_ARPA_INET
10633 #ifdef I_NETINET_IN
10634 #include <netinet/in.h>
10635 #endif
10636 #ifdef I_SYS_IN
10637 #include <sys/in.h>
10638 #endif
10639 #ifdef I_ARPA_INET
10640 #include <arpa/inet.h>
10641 #endif
10642 #ifdef htonl
10643 printf("Defined as a macro.");
10644 #endif
10645 EOM
10646         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10647         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10648                 val="$define"
10649                 echo "But it seems to be defined as a macro." >&4
10650         fi
10651         $rm -f htonl.?
10652         ;;
10653 esac
10654 set d_htonl
10655 eval $setvar
10656
10657 : index or strchr
10658 echo " "
10659 if set index val -f; eval $csym; $val; then
10660         if set strchr val -f d_strchr; eval $csym; $val; then
10661                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10662                         val="$define"
10663                         vali="$undef"
10664                         echo "strchr() found." >&4
10665                 else
10666                         val="$undef"
10667                         vali="$define"
10668                         echo "index() found." >&4
10669                 fi
10670         else
10671                 val="$undef"
10672                 vali="$define"
10673                 echo "index() found." >&4
10674         fi
10675 else
10676         if set strchr val -f d_strchr; eval $csym; $val; then
10677                 val="$define"
10678                 vali="$undef"
10679                 echo "strchr() found." >&4
10680         else
10681                 echo "No index() or strchr() found!" >&4
10682                 val="$undef"
10683                 vali="$undef"
10684         fi
10685 fi
10686 set d_strchr; eval $setvar
10687 val="$vali"
10688 set d_index; eval $setvar
10689
10690 : check whether inet_aton exists
10691 set inet_aton d_inetaton
10692 eval $inlibc
10693
10694 : Look for isascii
10695 echo " "
10696 $cat >isascii.c <<'EOCP'
10697 #include <stdio.h>
10698 #include <ctype.h>
10699 int main() {
10700         int c = 'A';
10701         if (isascii(c))
10702                 exit(0);
10703         else
10704                 exit(1);
10705 }
10706 EOCP
10707 set isascii
10708 if eval $compile; then
10709         echo "isascii() found." >&4
10710         val="$define"
10711 else
10712         echo "isascii() NOT found." >&4
10713         val="$undef"
10714 fi
10715 set d_isascii
10716 eval $setvar
10717 $rm -f isascii*
10718
10719 : see if isfinite exists
10720 set isfinite d_isfinite
10721 eval $inlibc
10722
10723 : see if isinf exists
10724 set isinf d_isinf
10725 eval $inlibc
10726
10727 : see if isnan exists
10728 set isnan d_isnan
10729 eval $inlibc
10730
10731 : see if isnanl exists
10732 set isnanl d_isnanl
10733 eval $inlibc
10734
10735 : see if killpg exists
10736 set killpg d_killpg
10737 eval $inlibc
10738
10739 : see if lchown exists
10740 echo " "
10741 $cat > try.c <<'EOCP'
10742 /* System header to define __stub macros and hopefully few prototypes,
10743     which can conflict with char lchown(); below.  */
10744 #include <assert.h>
10745 /* Override any gcc2 internal prototype to avoid an error.  */
10746 /* We use char because int might match the return type of a gcc2
10747    builtin and then its argument prototype would still apply.  */
10748 char lchown();
10749 int main() {
10750     /*  The GNU C library defines this for functions which it implements
10751         to always fail with ENOSYS.  Some functions are actually named
10752         something starting with __ and the normal name is an alias.  */
10753 #if defined (__stub_lchown) || defined (__stub___lchown)
10754 choke me
10755 #else
10756 lchown();
10757 #endif
10758 ; return 0; }
10759 EOCP
10760 set try
10761 if eval $compile; then
10762     $echo "lchown() found." >&4
10763     val="$define"
10764 else
10765     $echo "lchown() NOT found." >&4
10766     val="$undef"
10767 fi
10768 set d_lchown
10769 eval $setvar
10770
10771 : See if number of significant digits in a double precision number is known
10772 echo " "
10773 $cat >ldbl_dig.c <<EOM
10774 #$i_limits I_LIMITS
10775 #$i_float I_FLOAT
10776 #ifdef I_LIMITS
10777 #include <limits.h>
10778 #endif
10779 #ifdef I_FLOAT
10780 #include <float.h>
10781 #endif
10782 #ifdef LDBL_DIG
10783 printf("Contains LDBL_DIG");
10784 #endif
10785 EOM
10786 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10787 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10788         echo "LDBL_DIG found." >&4
10789         val="$define"
10790 else
10791         echo "LDBL_DIG NOT found." >&4
10792         val="$undef"
10793 fi
10794 $rm -f ldbl_dig.?
10795 set d_ldbl_dig
10796 eval $setvar
10797
10798 : see if link exists
10799 set link d_link
10800 eval $inlibc
10801
10802 : see if localeconv exists
10803 set localeconv d_locconv
10804 eval $inlibc
10805
10806 : see if lockf exists
10807 set lockf d_lockf
10808 eval $inlibc
10809
10810 : see if prototype for lseek is available
10811 echo " "
10812 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10813 eval $hasproto
10814
10815 : see if lstat exists
10816 set lstat d_lstat
10817 eval $inlibc
10818
10819 : see if madvise exists
10820 set madvise d_madvise
10821 eval $inlibc
10822
10823 : see if mblen exists
10824 set mblen d_mblen
10825 eval $inlibc
10826
10827 : see if mbstowcs exists
10828 set mbstowcs d_mbstowcs
10829 eval $inlibc
10830
10831 : see if mbtowc exists
10832 set mbtowc d_mbtowc
10833 eval $inlibc
10834
10835 : see if memchr exists
10836 set memchr d_memchr
10837 eval $inlibc
10838
10839 : see if memcmp exists
10840 set memcmp d_memcmp
10841 eval $inlibc
10842
10843 : see if memcpy exists
10844 set memcpy d_memcpy
10845 eval $inlibc
10846
10847 : see if memmove exists
10848 set memmove d_memmove
10849 eval $inlibc
10850
10851 : see if memset exists
10852 set memset d_memset
10853 eval $inlibc
10854
10855 : see if mkdir exists
10856 set mkdir d_mkdir
10857 eval $inlibc
10858
10859 : see if mkdtemp exists
10860 set mkdtemp d_mkdtemp
10861 eval $inlibc
10862
10863 : see if mkfifo exists
10864 set mkfifo d_mkfifo
10865 eval $inlibc
10866
10867 : see if mkstemp exists
10868 set mkstemp d_mkstemp
10869 eval $inlibc
10870
10871 : see if mkstemps exists
10872 set mkstemps d_mkstemps
10873 eval $inlibc
10874
10875 : see if mktime exists
10876 set mktime d_mktime
10877 eval $inlibc
10878
10879 : see if this is a sys/mman.h system
10880 set sys/mman.h i_sysmman
10881 eval $inhdr
10882
10883 : see if mmap exists
10884 set mmap d_mmap
10885 eval $inlibc
10886 : see what shmat returns
10887 : default to something harmless
10888 mmaptype='void *'
10889 case "$i_sysmman$d_mmap" in
10890 "$define$define")
10891         $cat >mmap.c <<'END'
10892 #include <sys/mman.h>
10893 void *mmap();
10894 END
10895         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10896                 mmaptype='void *'
10897         else
10898                 mmaptype='caddr_t'
10899         fi
10900         echo "and it returns ($mmaptype)." >&4
10901         ;;
10902 esac
10903
10904
10905
10906 : see if modfl exists
10907 set modfl d_modfl
10908 eval $inlibc
10909
10910 d_modfl_pow32_bug="$undef"
10911
10912 case "$d_longdbl$d_modfl" in
10913 $define$define)
10914         $cat <<EOM
10915 Checking to see whether your modfl() is okay for large values...
10916 EOM
10917 $cat >try.c <<EOCP
10918 #include <math.h> 
10919 #include <stdio.h>
10920 int main() {
10921     long double nv = 4294967303.15;
10922     long double v, w;
10923     v = modfl(nv, &w);         
10924 #ifdef __GLIBC__
10925     printf("glibc");
10926 #endif
10927     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10928     return 0;
10929 }
10930 EOCP
10931         case "$osname:$gccversion" in
10932         aix:)   saveccflags="$ccflags"
10933                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10934         esac
10935         set try
10936         if eval $compile; then
10937                 foo=`$run ./try`
10938                 case "$foo" in
10939                 *" 4294967303.150000 1.150000 4294967302.000000")
10940                         echo >&4 "Your modfl() is broken for large values."
10941                         d_modfl_pow32_bug="$define"
10942                         case "$foo" in
10943                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10944                         ;;
10945                         esac
10946                         ;;
10947                 *" 4294967303.150000 0.150000 4294967303.000000")
10948                         echo >&4 "Your modfl() seems okay for large values."
10949                         ;;
10950                 *)      echo >&4 "I don't understand your modfl() at all."
10951                         d_modfl="$undef"
10952                         ;;
10953                 esac
10954                 $rm -f try.* try core core.try.*
10955         else
10956                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10957                 d_modfl="$undef"
10958         fi
10959         case "$osname:$gccversion" in
10960         aix:)   ccflags="$saveccflags" ;; # restore
10961         esac
10962         ;;
10963 esac
10964
10965 : see if mprotect exists
10966 set mprotect d_mprotect
10967 eval $inlibc
10968
10969 : see if msgctl exists
10970 set msgctl d_msgctl
10971 eval $inlibc
10972
10973 : see if msgget exists
10974 set msgget d_msgget
10975 eval $inlibc
10976
10977 : see if msgsnd exists
10978 set msgsnd d_msgsnd
10979 eval $inlibc
10980
10981 : see if msgrcv exists
10982 set msgrcv d_msgrcv
10983 eval $inlibc
10984
10985 : see how much of the 'msg*(2)' library is present.
10986 h_msg=true
10987 echo " "
10988 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10989 *"$undef"*) h_msg=false;;
10990 esac
10991 case "$osname" in
10992 freebsd)
10993     case "`ipcs 2>&1`" in
10994     "SVID messages"*"not configured"*)
10995         echo "Your $osname does not have the msg*(2) configured." >&4
10996         h_msg=false
10997         val="$undef"
10998         set msgctl d_msgctl
10999         eval $setvar
11000         set msgget d_msgget
11001         eval $setvar
11002         set msgsnd d_msgsnd
11003         eval $setvar
11004         set msgrcv d_msgrcv
11005         eval $setvar
11006         ;;
11007     esac
11008     ;;
11009 esac
11010 : we could also check for sys/ipc.h ...
11011 if $h_msg && $test `./findhdr sys/msg.h`; then
11012         echo "You have the full msg*(2) library." >&4
11013         val="$define"
11014 else
11015         echo "You don't have the full msg*(2) library." >&4
11016         val="$undef"
11017 fi
11018 set d_msg
11019 eval $setvar
11020
11021
11022 echo " "
11023 echo "Checking to see if your system supports struct msghdr..." >&4
11024 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11025 eval $hasstruct
11026 case "$d_msghdr_s" in
11027 "$define")      echo "Yes, it does."   ;;
11028 *)              echo "No, it doesn't." ;;
11029 esac
11030
11031
11032 : see if msync exists
11033 set msync d_msync
11034 eval $inlibc
11035
11036 : see if munmap exists
11037 set munmap d_munmap
11038 eval $inlibc
11039
11040 : see if nice exists
11041 set nice d_nice
11042 eval $inlibc
11043
11044 : see if this is a langinfo.h system
11045 set langinfo.h i_langinfo
11046 eval $inhdr
11047
11048 : see if nl_langinfo exists
11049 set nl_langinfo d_nl_langinfo
11050 eval $inlibc
11051
11052 : check for length of character
11053 echo " "
11054 case "$charsize" in
11055 '')
11056         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11057         $cat >try.c <<'EOCP'
11058 #include <stdio.h>
11059 int main()
11060 {
11061     printf("%d\n", (int)sizeof(char));
11062     exit(0);
11063 }
11064 EOCP
11065         set try
11066         if eval $compile_ok; then
11067                 dflt=`$run ./try`
11068         else
11069                 dflt='1'
11070                 echo "(I can't seem to compile the test program.  Guessing...)"
11071         fi
11072         ;;
11073 *)
11074         dflt="$charsize"
11075         ;;
11076 esac
11077 rp="What is the size of a character (in bytes)?"
11078 . ./myread
11079 charsize="$ans"
11080 $rm -f try.c try
11081
11082 : check for volatile keyword
11083 echo " "
11084 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11085 $cat >try.c <<'EOCP'
11086 int main()
11087 {
11088         typedef struct _goo_struct goo_struct;
11089         goo_struct * volatile goo = ((goo_struct *)0);
11090         struct _goo_struct {
11091                 long long_int;
11092                 int reg_int;
11093                 char char_var;
11094         };
11095         typedef unsigned short foo_t;
11096         char *volatile foo;
11097         volatile int bar;
11098         volatile foo_t blech;
11099         foo = foo;
11100 }
11101 EOCP
11102 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11103         val="$define"
11104         echo "Yup, it does."
11105 else
11106         val="$undef"
11107         echo "Nope, it doesn't."
11108 fi
11109 set d_volatile
11110 eval $setvar
11111 $rm -f try.*
11112
11113
11114 echo " "
11115 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11116
11117 case "$use64bitint:$d_quad:$quadtype" in
11118 define:define:?*)
11119         ivtype="$quadtype"
11120         uvtype="$uquadtype"
11121         ivsize=8
11122         uvsize=8
11123         ;;
11124 *)      ivtype="long"
11125         uvtype="unsigned long"
11126         ivsize=$longsize
11127         uvsize=$longsize
11128         ;;
11129 esac
11130
11131 case "$uselongdouble:$d_longdbl" in
11132 define:define)
11133         nvtype="long double"
11134         nvsize=$longdblsize
11135         ;;
11136 *)      nvtype=double
11137         nvsize=$doublesize
11138         ;;
11139 esac
11140
11141 $echo "(IV will be "$ivtype", $ivsize bytes)"
11142 $echo "(UV will be "$uvtype", $uvsize bytes)"
11143 $echo "(NV will be "$nvtype", $nvsize bytes)"
11144
11145 $cat >try.c <<EOCP
11146 #$i_inttypes I_INTTYPES
11147 #ifdef I_INTTYPES
11148 #include <inttypes.h>
11149 #endif
11150 #include <stdio.h>
11151 int main() {
11152 #ifdef INT8
11153    int8_t i =  INT8_MAX;
11154   uint8_t u = UINT8_MAX;
11155   printf("int8_t\n");
11156 #endif
11157 #ifdef INT16
11158    int16_t i =  INT16_MAX;
11159   uint16_t i = UINT16_MAX;
11160   printf("int16_t\n");
11161 #endif
11162 #ifdef INT32
11163    int32_t i =  INT32_MAX;
11164   uint32_t u = UINT32_MAX;
11165   printf("int32_t\n");
11166 #endif
11167 }
11168 EOCP
11169
11170 case "$i8type" in
11171 '')     case "$charsize" in
11172         1)      i8type=char
11173                 u8type="unsigned char"
11174                 i8size=$charsize
11175                 u8size=$charsize
11176                 ;;
11177         esac
11178         ;;
11179 esac
11180 case "$i8type" in
11181 '')     set try -DINT8
11182         if eval $compile; then
11183                 case "`$run ./try`" in
11184                 int8_t) i8type=int8_t
11185                         u8type=uint8_t
11186                         i8size=1
11187                         u8size=1
11188                         ;;
11189                 esac
11190         fi
11191         ;;
11192 esac
11193 case "$i8type" in
11194 '')     if $test $charsize -ge 1; then
11195                 i8type=char
11196                 u8type="unsigned char"
11197                 i8size=$charsize
11198                 u8size=$charsize
11199         fi
11200         ;;
11201 esac
11202
11203 case "$i16type" in
11204 '')     case "$shortsize" in
11205         2)      i16type=short
11206                 u16type="unsigned short"
11207                 i16size=$shortsize
11208                 u16size=$shortsize
11209                 ;;
11210         esac
11211         ;;
11212 esac
11213 case "$i16type" in
11214 '')     set try -DINT16
11215         if eval $compile; then
11216                 case "`$run ./try`" in
11217                 int16_t)
11218                         i16type=int16_t
11219                         u16type=uint16_t
11220                         i16size=2
11221                         u16size=2
11222                         ;;
11223                 esac
11224         fi
11225         ;;
11226 esac
11227 case "$i16type" in
11228 '')     if $test $shortsize -ge 2; then
11229                 i16type=short
11230                 u16type="unsigned short"
11231                 i16size=$shortsize
11232                 u16size=$shortsize
11233         fi
11234         ;;
11235 esac
11236
11237 case "$i32type" in
11238 '')     case "$longsize" in
11239         4)      i32type=long
11240                 u32type="unsigned long"
11241                 i32size=$longsize
11242                 u32size=$longsize
11243                 ;;
11244         *)      case "$intsize" in
11245                 4)      i32type=int
11246                         u32type="unsigned int"
11247                         i32size=$intsize
11248                         u32size=$intsize
11249                         ;;
11250                 esac
11251                 ;;
11252         esac
11253         ;;
11254 esac
11255 case "$i32type" in
11256 '')     set try -DINT32
11257         if eval $compile; then
11258                 case "`$run ./try`" in
11259                 int32_t)
11260                         i32type=int32_t
11261                         u32type=uint32_t
11262                         i32size=4
11263                         u32size=4
11264                         ;;
11265                 esac
11266         fi
11267         ;;
11268 esac
11269 case "$i32type" in
11270 '')     if $test $intsize -ge 4; then
11271                 i32type=int
11272                 u32type="unsigned int"
11273                 i32size=$intsize
11274                 u32size=$intsize
11275         fi
11276         ;;
11277 esac
11278
11279 case "$i64type" in
11280 '')     case "$d_quad:$quadtype" in
11281         define:?*)
11282                 i64type="$quadtype"
11283                 u64type="$uquadtype"
11284                 i64size=8
11285                 u64size=8
11286                 ;;
11287         esac
11288         ;;
11289 esac
11290
11291 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11292 : volatile so that the compiler has to store it out to memory.
11293 if test X"$d_volatile" = X"$define"; then
11294         volatile=volatile
11295 fi
11296 $cat <<EOP >try.c
11297 #include <stdio.h>
11298 #include <sys/types.h>
11299 #include <signal.h>
11300 #ifdef SIGFPE
11301 $volatile int bletched = 0;
11302 $signal_t blech(s) int s; { bletched = 1; }
11303 #endif
11304 int main() {
11305     $uvtype u = 0;
11306     $nvtype d;
11307     int     n = 8 * $uvsize;
11308     int     i;
11309 #ifdef SIGFPE
11310     signal(SIGFPE, blech);
11311 #endif
11312
11313     for (i = 0; i < n; i++) {
11314       u = u << 1 | ($uvtype)1;
11315       d = ($nvtype)u;
11316       if (($uvtype)d != u)
11317         break;
11318       if (d <= 0)
11319         break;
11320       d = ($nvtype)(u - 1);
11321       if (($uvtype)d != (u - 1))
11322         break;
11323 #ifdef SIGFPE
11324       if (bletched) {
11325         break;
11326 #endif
11327       } 
11328     }
11329     printf("%d\n", ((i == n) ? -n : i));
11330     exit(0);
11331 }
11332 EOP
11333 set try
11334
11335 d_nv_preserves_uv="$undef"
11336 if eval $compile; then
11337         d_nv_preserves_uv_bits="`$run ./try`"
11338 fi
11339 case "$d_nv_preserves_uv_bits" in
11340 \-[1-9]*)       
11341         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11342         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11343         d_nv_preserves_uv="$define"
11344         ;;
11345 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11346         d_nv_preserves_uv="$undef" ;;
11347 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11348         d_nv_preserves_uv_bits="$undef" ;;
11349 esac
11350
11351 $rm -f try.* try
11352
11353
11354 : check for off64_t
11355 echo " "
11356 echo "Checking to see if you have off64_t..." >&4
11357 $cat >try.c <<EOCP
11358 #include <sys/types.h>
11359 #include <unistd.h>
11360 int main() { off64_t x = 7; }
11361 EOCP
11362 set try
11363 if eval $compile; then
11364         val="$define"
11365         echo "You have off64_t."
11366 else
11367         val="$undef"
11368         echo "You do not have off64_t."
11369         case "$lseeksize" in
11370         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11371         esac
11372 fi
11373 $rm -f try.* try
11374 set d_off64_t
11375 eval $setvar
11376
11377 : see if POSIX threads are available
11378 set pthread.h i_pthread
11379 eval $inhdr
11380
11381
11382
11383
11384 : how to create joinable pthreads
11385 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11386         echo " "
11387         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11388         $cat >try.c <<'EOCP'
11389 #include <pthread.h>
11390 int main() {
11391     int detachstate = JOINABLE;
11392 }
11393 EOCP
11394         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11395         if eval $compile; then
11396                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11397                 val="$undef" # Yes, undef.
11398                 set d_old_pthread_create_joinable
11399                 eval $setvar
11400                 val=""
11401                 set old_pthread_create_joinable
11402                 eval $setvar
11403         else
11404                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11405                 if eval $compile; then
11406                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11407                         val="$define"
11408                         set d_old_pthread_create_joinable
11409                         eval $setvar
11410                         val=PTHREAD_CREATE_UNDETACHED
11411                         set old_pthread_create_joinable
11412                         eval $setvar
11413                 else            
11414                         set try -DJOINABLE=__UNDETACHED
11415                         if eval $compile; then
11416                                 echo "You seem to use __UNDETACHED." >&4
11417                                 val="$define"
11418                                 set d_old_pthread_create_joinable
11419                                 eval $setvar
11420                                 val=__UNDETACHED
11421                                 set old_pthread_create_joinable
11422                                 eval $setvar
11423                         else
11424                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11425                                 val="$define"
11426                                 set d_old_pthread_create_joinable
11427                                 eval $setvar
11428                                 val=0
11429                                 set old_pthread_create_joinable
11430                                 eval $setvar
11431                         fi
11432                 fi
11433         fi
11434         $rm -f try try.*
11435 else
11436     d_old_pthread_create_joinable="$undef"
11437     old_pthread_create_joinable=""
11438 fi
11439
11440 : see if pause exists
11441 set pause d_pause
11442 eval $inlibc
11443
11444 : see if pipe exists
11445 set pipe d_pipe
11446 eval $inlibc
11447
11448 : see if poll exists
11449 set poll d_poll
11450 eval $inlibc
11451
11452 : see if readlink exists
11453 set readlink d_readlink
11454 eval $inlibc
11455
11456 echo " "
11457 echo "Checking for /proc/self/exe..." >&4
11458 val="$undef"
11459 case "$d_readlink" in
11460 "$define")
11461         if $issymlink /proc/self/exe ; then
11462                 $ls -l /proc/self/exe > reflect
11463                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11464                         val="$define"
11465                         echo "You have Linux-like /proc/self/exe."
11466                 fi
11467                 $rm reflect
11468         fi
11469         ;;
11470 esac
11471 set d_procselfexe
11472 eval $setvar
11473
11474 : see if pthread_atfork exists
11475 set pthread_atfork d_pthread_atfork
11476 eval $inlibc
11477
11478
11479 : see whether the various POSIXish _yields exist
11480 $cat >try.c <<EOP
11481 #include <pthread.h>
11482 #include <stdio.h>
11483 int main() {
11484 #ifdef SCHED_YIELD
11485         sched_yield();
11486 #else
11487 #ifdef PTHREAD_YIELD
11488         pthread_yield();
11489 #else
11490 #ifdef PTHREAD_YIELD_NULL
11491         pthread_yield(NULL);
11492 #endif
11493 #endif
11494 #endif
11495 }
11496 EOP
11497 : see if sched_yield exists
11498 set try -DSCHED_YIELD
11499 if eval $compile; then
11500     val="$define"
11501     sched_yield='sched_yield()'
11502 else
11503     val="$undef"
11504 fi
11505 case "$usethreads" in
11506 $define)
11507         case "$val" in
11508         $define) echo 'sched_yield() found.' >&4        ;;
11509         *)       echo 'sched_yield() NOT found.' >&4    ;;
11510         esac
11511 esac
11512 set d_sched_yield
11513 eval $setvar
11514
11515 : see if pthread_yield exists
11516 set try -DPTHREAD_YIELD
11517 if eval $compile; then
11518     val="$define"
11519     case "$sched_yield" in
11520     '') sched_yield='pthread_yield()' ;;
11521     esac
11522 else
11523     set try -DPTHREAD_YIELD_NULL
11524     if eval $compile; then
11525         val="$define"
11526         case "$sched_yield" in
11527         '') sched_yield='pthread_yield(NULL)' ;;
11528         esac
11529     else
11530         val="$undef"
11531     fi
11532 fi
11533 case "$usethreads" in
11534 $define)
11535         case "$val" in
11536         $define) echo 'pthread_yield() found.' >&4      ;;
11537         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11538         esac
11539         ;;
11540 esac
11541 set d_pthread_yield
11542 eval $setvar
11543
11544 case "$sched_yield" in
11545 '') sched_yield=undef ;;
11546 esac
11547
11548 $rm -f try try.*
11549
11550 : see if this is a pwd.h system
11551 set pwd.h i_pwd
11552 eval $inhdr
11553
11554 case "$i_pwd" in
11555 $define)
11556         xxx=`./findhdr pwd.h`
11557         $cppstdin $cppflags $cppminus < $xxx >$$.h
11558
11559         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11560                 val="$define"
11561         else
11562                 val="$undef"
11563         fi
11564         set d_pwquota
11565         eval $setvar
11566
11567         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11568                 val="$define"
11569         else
11570                 val="$undef"
11571         fi
11572         set d_pwage
11573         eval $setvar
11574
11575         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11576                 val="$define"
11577         else
11578                 val="$undef"
11579         fi
11580         set d_pwchange
11581         eval $setvar
11582
11583         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11584                 val="$define"
11585         else
11586                 val="$undef"
11587         fi
11588         set d_pwclass
11589         eval $setvar
11590
11591         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11592                 val="$define"
11593         else
11594                 val="$undef"
11595         fi
11596         set d_pwexpire
11597         eval $setvar
11598
11599         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11600                 val="$define"
11601         else
11602                 val="$undef"
11603         fi
11604         set d_pwcomment
11605         eval $setvar
11606
11607         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11608                 val="$define"
11609         else
11610                 val="$undef"
11611         fi
11612         set d_pwgecos
11613         eval $setvar
11614
11615         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11616                 val="$define"
11617         else
11618                 val="$undef"
11619         fi
11620         set d_pwpasswd
11621         eval $setvar
11622
11623         $rm -f $$.h
11624         ;;
11625 *)
11626         val="$undef"; 
11627         set d_pwquota; eval $setvar
11628         set d_pwage; eval $setvar
11629         set d_pwchange; eval $setvar
11630         set d_pwclass; eval $setvar
11631         set d_pwexpire; eval $setvar
11632         set d_pwcomment; eval $setvar
11633         set d_pwgecos; eval $setvar
11634         set d_pwpasswd; eval $setvar
11635         ;;
11636 esac
11637
11638 : see if readdir and friends exist
11639 set readdir d_readdir
11640 eval $inlibc
11641 set seekdir d_seekdir
11642 eval $inlibc
11643 set telldir d_telldir
11644 eval $inlibc
11645 set rewinddir d_rewinddir
11646 eval $inlibc
11647
11648 : see if readv exists
11649 set readv d_readv
11650 eval $inlibc
11651
11652 : see if recvmsg exists
11653 set recvmsg d_recvmsg
11654 eval $inlibc
11655
11656 : see if rename exists
11657 set rename d_rename
11658 eval $inlibc
11659
11660 : see if rmdir exists
11661 set rmdir d_rmdir
11662 eval $inlibc
11663
11664 : see if memory.h is available.
11665 val=''
11666 set memory.h val
11667 eval $inhdr
11668
11669 : See if it conflicts with string.h
11670 case "$val" in
11671 $define)
11672         case "$strings" in
11673         '') ;;
11674         *)
11675                 $cppstdin $cppflags $cppminus < $strings > mem.h
11676                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11677                         echo " "
11678                         echo "We won't be including <memory.h>."
11679                         val="$undef"
11680                 fi
11681                 $rm -f mem.h
11682                 ;;
11683         esac
11684 esac
11685 set i_memory
11686 eval $setvar
11687
11688 : can bcopy handle overlapping blocks?
11689 echo " "
11690 val="$undef"
11691 case "$d_memmove" in
11692 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11693 *)      case "$d_bcopy" in
11694         "$define")
11695                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11696                 $cat >try.c <<EOCP
11697 #$i_memory I_MEMORY
11698 #$i_stdlib I_STDLIB
11699 #$i_string I_STRING
11700 #$i_unistd I_UNISTD
11701 EOCP
11702         $cat >>try.c <<'EOCP'
11703 #include <stdio.h>
11704 #ifdef I_MEMORY
11705 #  include <memory.h>
11706 #endif
11707 #ifdef I_STDLIB
11708 #  include <stdlib.h>
11709 #endif
11710 #ifdef I_STRING
11711 #  include <string.h>
11712 #else
11713 #  include <strings.h>
11714 #endif
11715 #ifdef I_UNISTD
11716 #  include <unistd.h>  /* Needed for NetBSD */
11717 #endif
11718 int main()
11719 {
11720 char buf[128], abc[128];
11721 char *b;
11722 int len;
11723 int off;
11724 int align;
11725
11726 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11727    try to store the string in read-only memory. */
11728 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11729
11730 for (align = 7; align >= 0; align--) {
11731         for (len = 36; len; len--) {
11732                 b = buf+align;
11733                 bcopy(abc, b, len);
11734                 for (off = 1; off <= len; off++) {
11735                         bcopy(b, b+off, len);
11736                         bcopy(b+off, b, len);
11737                         if (bcmp(b, abc, len))
11738                                 exit(1);
11739                 }
11740         }
11741 }
11742 exit(0);
11743 }
11744 EOCP
11745                 set try
11746                 if eval $compile_ok; then
11747                         if ./try 2>/dev/null; then
11748                                 echo "Yes, it can."
11749                                 val="$define"
11750                         else
11751                                 echo "It can't, sorry."
11752                         fi
11753                 else
11754                         echo "(I can't compile the test program, so we'll assume not...)"
11755                 fi
11756                 ;;
11757         esac
11758         $rm -f try.* try core
11759         ;;
11760 esac
11761 set d_safebcpy
11762 eval $setvar
11763
11764 : can memcpy handle overlapping blocks?
11765 echo " "
11766 val="$undef"
11767 case "$d_memmove" in
11768 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11769 *)      case "$d_memcpy" in
11770         "$define")
11771                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11772                 $cat >try.c <<EOCP
11773 #$i_memory I_MEMORY
11774 #$i_stdlib I_STDLIB
11775 #$i_string I_STRING
11776 #$i_unistd I_UNISTD
11777 EOCP
11778         $cat >>try.c <<'EOCP'
11779 #include <stdio.h>
11780 #ifdef I_MEMORY
11781 #  include <memory.h>
11782 #endif
11783 #ifdef I_STDLIB
11784 #  include <stdlib.h>
11785 #endif
11786 #ifdef I_STRING
11787 #  include <string.h>
11788 #else
11789 #  include <strings.h>
11790 #endif
11791 #ifdef I_UNISTD
11792 #  include <unistd.h>  /* Needed for NetBSD */
11793 #endif
11794 int main()
11795 {
11796 char buf[128], abc[128];
11797 char *b;
11798 int len;
11799 int off;
11800 int align;
11801
11802 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11803    try to store the string in read-only memory. */
11804 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11805
11806 for (align = 7; align >= 0; align--) {
11807         for (len = 36; len; len--) {
11808                 b = buf+align;
11809                 memcpy(b, abc, len);
11810                 for (off = 1; off <= len; off++) {
11811                         memcpy(b+off, b, len);
11812                         memcpy(b, b+off, len);
11813                         if (memcmp(b, abc, len))
11814                                 exit(1);
11815                 }
11816         }
11817 }
11818 exit(0);
11819 }
11820 EOCP
11821                 set try
11822                 if eval $compile_ok; then
11823                         if ./try 2>/dev/null; then
11824                                 echo "Yes, it can."
11825                                 val="$define"
11826                         else
11827                                 echo "It can't, sorry."
11828                         fi
11829                 else
11830                         echo "(I can't compile the test program, so we'll assume not...)"
11831                 fi
11832                 ;;
11833         esac
11834         $rm -f try.* try core
11835         ;;
11836 esac
11837 set d_safemcpy
11838 eval $setvar
11839
11840 : can memcmp be trusted to compare relative magnitude?
11841 val="$undef"
11842 case "$d_memcmp" in
11843 "$define")
11844         echo " "
11845         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11846         $cat >try.c <<EOCP
11847 #$i_memory I_MEMORY
11848 #$i_stdlib I_STDLIB
11849 #$i_string I_STRING
11850 #$i_unistd I_UNISTD
11851 EOCP
11852         $cat >>try.c <<'EOCP'
11853 #include <stdio.h>
11854 #ifdef I_MEMORY
11855 #  include <memory.h>
11856 #endif
11857 #ifdef I_STDLIB
11858 #  include <stdlib.h>
11859 #endif
11860 #ifdef I_STRING
11861 #  include <string.h>
11862 #else
11863 #  include <strings.h>
11864 #endif
11865 #ifdef I_UNISTD
11866 #  include <unistd.h>  /* Needed for NetBSD */
11867 #endif
11868 int main()
11869 {
11870 char a = -1;
11871 char b = 0;
11872 if ((a < b) && memcmp(&a, &b, 1) < 0)
11873         exit(1);
11874 exit(0);
11875 }
11876 EOCP
11877         set try
11878         if eval $compile_ok; then
11879                 if $run ./try 2>/dev/null; then
11880                         echo "Yes, it can."
11881                         val="$define"
11882                 else
11883                         echo "No, it can't (it uses signed chars)."
11884                 fi
11885         else
11886                 echo "(I can't compile the test program, so we'll assume not...)"
11887         fi
11888         ;;
11889 esac
11890 $rm -f try.* try core
11891 set d_sanemcmp
11892 eval $setvar
11893
11894 : see if prototype for sbrk is available
11895 echo " "
11896 set d_sbrkproto sbrk $i_unistd unistd.h
11897 eval $hasproto
11898
11899 : see if select exists
11900 set select d_select
11901 eval $inlibc
11902
11903 : see if semctl exists
11904 set semctl d_semctl
11905 eval $inlibc
11906
11907 : see if semget exists
11908 set semget d_semget
11909 eval $inlibc
11910
11911 : see if semop exists
11912 set semop d_semop
11913 eval $inlibc
11914
11915 : see how much of the 'sem*(2)' library is present.
11916 h_sem=true
11917 echo " "
11918 case "$d_semctl$d_semget$d_semop" in
11919 *"$undef"*) h_sem=false;;
11920 esac
11921 case "$osname" in
11922 freebsd)
11923     case "`ipcs 2>&1`" in
11924     "SVID messages"*"not configured"*)
11925         echo "Your $osname does not have the sem*(2) configured." >&4
11926         h_sem=false
11927         val="$undef"
11928         set semctl d_semctl
11929         eval $setvar
11930         set semget d_semget
11931         eval $setvar
11932         set semop d_semop
11933         eval $setvar
11934         ;;
11935     esac
11936     ;;
11937 esac
11938 : we could also check for sys/ipc.h ...
11939 if $h_sem && $test `./findhdr sys/sem.h`; then
11940         echo "You have the full sem*(2) library." >&4
11941         val="$define"
11942 else
11943         echo "You don't have the full sem*(2) library." >&4
11944         val="$undef"
11945 fi
11946 set d_sem
11947 eval $setvar
11948
11949 : see whether sys/sem.h defines union semun
11950 echo " "
11951 $cat > try.c <<'END'
11952 #include <sys/types.h>
11953 #include <sys/ipc.h>
11954 #include <sys/sem.h>
11955 int main () { union semun semun; semun.buf = 0; }
11956 END
11957 set try
11958 if eval $compile; then
11959     echo "You have union semun in <sys/sem.h>." >&4
11960     val="$define"
11961 else
11962     echo "You do not have union semun in <sys/sem.h>." >&4
11963     val="$undef"
11964 fi
11965 $rm -f try try.c try.h
11966 set d_union_semun
11967 eval $setvar
11968
11969 : see how to do semctl IPC_STAT
11970 case "$d_sem" in
11971 $define)
11972     : see whether semctl IPC_STAT can use union semun
11973     echo " "
11974     $cat > try.h <<END
11975 #ifndef S_IRUSR
11976 #   ifdef S_IREAD
11977 #       define S_IRUSR S_IREAD
11978 #       define S_IWUSR S_IWRITE
11979 #       define S_IXUSR S_IEXEC
11980 #   else
11981 #       define S_IRUSR 0400
11982 #       define S_IWUSR 0200
11983 #       define S_IXUSR 0100
11984 #   endif
11985 #   define S_IRGRP (S_IRUSR>>3)
11986 #   define S_IWGRP (S_IWUSR>>3)
11987 #   define S_IXGRP (S_IXUSR>>3)
11988 #   define S_IROTH (S_IRUSR>>6)
11989 #   define S_IWOTH (S_IWUSR>>6)
11990 #   define S_IXOTH (S_IXUSR>>6)
11991 #endif
11992 #ifndef S_IRWXU
11993 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11994 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11995 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11996 #endif
11997 END
11998
11999     $cat > try.c <<END
12000 #include <sys/types.h>
12001 #include <sys/ipc.h>
12002 #include <sys/sem.h>
12003 #include <sys/stat.h>
12004 #include <stdio.h>
12005 #include <errno.h>
12006 #include "try.h"
12007 #ifndef errno
12008 extern int errno;
12009 #endif
12010 #$d_union_semun HAS_UNION_SEMUN
12011 int main() {
12012     union semun
12013 #ifndef HAS_UNION_SEMUN
12014     {
12015         int val;
12016         struct semid_ds *buf;
12017         unsigned short *array;
12018     }
12019 #endif
12020     arg;
12021     int sem, st;
12022
12023 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
12024     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12025     if (sem > -1) {
12026         struct semid_ds argbuf;
12027         arg.buf = &argbuf;
12028 #       ifdef IPC_STAT
12029         st = semctl(sem, 0, IPC_STAT, arg);
12030         if (st == 0)
12031             printf("semun\n");
12032         else
12033 #       endif /* IPC_STAT */
12034             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12035 #       ifdef IPC_RMID
12036         if (semctl(sem, 0, IPC_RMID, arg) != 0)
12037 #       endif /* IPC_RMID */
12038             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12039     } else
12040 #endif /* IPC_PRIVATE && ... */
12041         printf("semget failed: errno = %d\n", errno);
12042   return 0;
12043 }
12044 END
12045     val="$undef"
12046     set try
12047     if eval $compile; then
12048         xxx=`$run ./try`
12049         case "$xxx" in
12050         semun) val="$define" ;;
12051         esac
12052     fi
12053     $rm -f try try.c
12054     set d_semctl_semun
12055     eval $setvar
12056     case "$d_semctl_semun" in
12057     $define)
12058         echo "You can use union semun for semctl IPC_STAT." >&4
12059         also='also'
12060         ;;
12061     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
12062         also=''
12063         ;;
12064     esac
12065
12066     : see whether semctl IPC_STAT can use struct semid_ds pointer
12067     $cat > try.c <<'END'
12068 #include <sys/types.h>
12069 #include <sys/ipc.h>
12070 #include <sys/sem.h>
12071 #include <sys/stat.h>
12072 #include "try.h"
12073 #include <stdio.h>
12074 #include <errno.h>
12075 #ifndef errno
12076 extern int errno;
12077 #endif
12078 int main() {
12079     struct semid_ds arg;
12080     int sem, st;
12081
12082 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
12083     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12084     if (sem > -1) {
12085 #       ifdef IPC_STAT
12086         st = semctl(sem, 0, IPC_STAT, &arg);
12087         if (st == 0)
12088             printf("semid_ds\n");
12089         else
12090 #       endif /* IPC_STAT */
12091             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12092 #       ifdef IPC_RMID
12093         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
12094 #       endif /* IPC_RMID */
12095             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12096     } else
12097 #endif /* IPC_PRIVATE && ... */
12098         printf("semget failed: errno = %d\n", errno);
12099
12100     return 0;
12101 }
12102 END
12103     val="$undef"
12104     set try
12105     if eval $compile; then
12106         xxx=`$run ./try`
12107         case "$xxx" in
12108         semid_ds) val="$define" ;;
12109         esac
12110     fi
12111     $rm -f try try.c
12112     set d_semctl_semid_ds
12113     eval $setvar
12114     case "$d_semctl_semid_ds" in
12115     $define)
12116         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
12117         ;;
12118     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
12119         ;;
12120     esac
12121     $rm -f try.h
12122     ;;
12123 *)  val="$undef"
12124
12125     # We do not have the full sem*(2) library, so assume we can not
12126     # use either.
12127
12128     set d_semctl_semun
12129     eval $setvar
12130
12131     set d_semctl_semid_ds
12132     eval $setvar
12133     ;;
12134 esac
12135
12136 : see if sendmsg exists
12137 set sendmsg d_sendmsg
12138 eval $inlibc
12139
12140 : see if setegid exists
12141 set setegid d_setegid
12142 eval $inlibc
12143
12144 : see if seteuid exists
12145 set seteuid d_seteuid
12146 eval $inlibc
12147
12148 : see if setgrent exists
12149 set setgrent d_setgrent
12150 eval $inlibc
12151
12152 : see if sethostent exists
12153 set sethostent d_sethent
12154 eval $inlibc
12155
12156 : see if setitimer exists
12157 set setitimer d_setitimer
12158 eval $inlibc
12159
12160 : see if setlinebuf exists
12161 set setlinebuf d_setlinebuf
12162 eval $inlibc
12163
12164 : see if setlocale exists
12165 set setlocale d_setlocale
12166 eval $inlibc
12167
12168 : see if setnetent exists
12169 set setnetent d_setnent
12170 eval $inlibc
12171
12172 : see if setprotoent exists
12173 set setprotoent d_setpent
12174 eval $inlibc
12175
12176 : see if setpgid exists
12177 set setpgid d_setpgid
12178 eval $inlibc
12179
12180 : see if setpgrp2 exists
12181 set setpgrp2 d_setpgrp2
12182 eval $inlibc
12183
12184 : see if setpriority exists
12185 set setpriority d_setprior
12186 eval $inlibc
12187
12188 : see if setproctitle exists
12189 set setproctitle d_setproctitle
12190 eval $inlibc
12191
12192 : see if setpwent exists
12193 set setpwent d_setpwent
12194 eval $inlibc
12195
12196 : see if setregid exists
12197 set setregid d_setregid
12198 eval $inlibc
12199 set setresgid d_setresgid
12200 eval $inlibc
12201
12202 : see if setreuid exists
12203 set setreuid d_setreuid
12204 eval $inlibc
12205 set setresuid d_setresuid
12206 eval $inlibc
12207
12208 : see if setrgid exists
12209 set setrgid d_setrgid
12210 eval $inlibc
12211
12212 : see if setruid exists
12213 set setruid d_setruid
12214 eval $inlibc
12215
12216 : see if setservent exists
12217 set setservent d_setsent
12218 eval $inlibc
12219
12220 : see if setsid exists
12221 set setsid d_setsid
12222 eval $inlibc
12223
12224 : see if setvbuf exists
12225 set setvbuf d_setvbuf
12226 eval $inlibc
12227
12228 : see if sfio.h is available
12229 set sfio.h i_sfio
12230 eval $inhdr
12231
12232
12233 : see if sfio library is available
12234 case "$i_sfio" in
12235 $define)
12236         val=''
12237         set sfreserve val
12238         eval $inlibc
12239         ;;
12240 *)
12241         val="$undef"
12242         ;;
12243 esac
12244 : Ok, but do we want to use it.
12245 case "$val" in
12246 $define)
12247         case "$usesfio" in
12248         true|$define|[yY]*) dflt='y';;
12249         *) dflt='n';;
12250         esac
12251         echo "$package can use the sfio library, but it is experimental."
12252         case "$useperlio" in
12253         "$undef")
12254             echo "For sfio also the PerlIO abstraction layer is needed."
12255             echo "Earlier you said you wouldn't want that."
12256             ;;
12257         esac
12258         rp="You seem to have sfio available, do you want to try using it?"
12259         . ./myread
12260         case "$ans" in
12261         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12262                 useperlio="$define"
12263                 val="$define"
12264                 ;;
12265         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12266                 val="$undef"
12267                 ;;
12268         esac
12269         ;;
12270 *)      case "$usesfio" in
12271         true|$define|[yY]*)
12272                 echo "Sorry, cannot find sfio on this machine." >&4
12273                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12274                 val="$undef"
12275                 ;;
12276         esac
12277         ;;
12278 esac
12279 set d_sfio
12280 eval $setvar
12281 case "$d_sfio" in
12282 $define) usesfio='true';;
12283 *) usesfio='false';;
12284 esac
12285 case "$d_sfio" in
12286 $define) ;;
12287 *)      : Remove sfio from list of libraries to use
12288         case "$libs" in
12289         *-lsfio*)
12290                 echo "Removing unneeded -lsfio from library list" >&4
12291                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12292                 shift
12293                 libs="$*"
12294                 echo "libs = $libs" >&4
12295                 ;;
12296         esac
12297 ;;
12298 esac
12299
12300
12301 : see if shmctl exists
12302 set shmctl d_shmctl
12303 eval $inlibc
12304
12305 : see if shmget exists
12306 set shmget d_shmget
12307 eval $inlibc
12308
12309 : see if shmat exists
12310 set shmat d_shmat
12311 eval $inlibc
12312 : see what shmat returns
12313 case "$d_shmat" in
12314 "$define")
12315         $cat >shmat.c <<'END'
12316 #include <sys/shm.h>
12317 void *shmat();
12318 END
12319         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12320                 shmattype='void *'
12321         else
12322                 shmattype='char *'
12323         fi
12324         echo "and it returns ($shmattype)." >&4
12325         : see if a prototype for shmat is available
12326         xxx=`./findhdr sys/shm.h`
12327         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12328         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12329                 val="$define"
12330         else
12331                 val="$undef"
12332         fi
12333         $rm -f shmat.[co]
12334         ;;
12335 *)
12336         val="$undef"
12337         ;;
12338 esac
12339 set d_shmatprototype
12340 eval $setvar
12341
12342 : see if shmdt exists
12343 set shmdt d_shmdt
12344 eval $inlibc
12345
12346 : see how much of the 'shm*(2)' library is present.
12347 h_shm=true
12348 echo " "
12349 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12350 *"$undef"*) h_shm=false;;
12351 esac
12352 case "$osname" in
12353 freebsd)
12354     case "`ipcs 2>&1`" in
12355     "SVID shared memory"*"not configured"*)
12356         echo "Your $osname does not have the shm*(2) configured." >&4
12357         h_shm=false
12358         val="$undef"
12359         set shmctl d_shmctl
12360         evat $setvar
12361         set shmget d_shmget
12362         evat $setvar
12363         set shmat d_shmat
12364         evat $setvar
12365         set shmdt d_shmdt
12366         evat $setvar
12367         ;;
12368     esac
12369     ;;
12370 esac
12371 : we could also check for sys/ipc.h ...
12372 if $h_shm && $test `./findhdr sys/shm.h`; then
12373         echo "You have the full shm*(2) library." >&4
12374         val="$define"
12375 else
12376         echo "You don't have the full shm*(2) library." >&4
12377         val="$undef"
12378 fi
12379 set d_shm
12380 eval $setvar
12381
12382 echo " "
12383 : see if we have sigaction
12384 if set sigaction val -f d_sigaction; eval $csym; $val; then
12385         echo 'sigaction() found.' >&4
12386         $cat > try.c <<'EOP'
12387 #include <stdio.h>
12388 #include <sys/types.h>
12389 #include <signal.h>
12390 int main()
12391 {
12392     struct sigaction act, oact;
12393     act.sa_flags = 0;
12394     oact.sa_handler = 0;
12395     /* so that act and oact are used */
12396     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12397 }
12398 EOP
12399         set try
12400         if eval $compile_ok; then
12401                 val="$define"
12402         else
12403                 echo "But you don't seem to have a useable struct sigaction." >&4
12404                 val="$undef"
12405         fi
12406 else
12407         echo 'sigaction NOT found.' >&4
12408         val="$undef"
12409 fi
12410 set d_sigaction; eval $setvar
12411 $rm -f try try$_o try.c
12412
12413 : see if sigprocmask exists
12414 set sigprocmask d_sigprocmask
12415 eval $inlibc
12416
12417 : see if sigsetjmp exists
12418 echo " "
12419 case "$d_sigsetjmp" in
12420 '')
12421         $cat >try.c <<'EOP'
12422 #include <setjmp.h>
12423 sigjmp_buf env;
12424 int set = 1;
12425 int main()
12426 {
12427         if (sigsetjmp(env,1))
12428                 exit(set);
12429         set = 0;
12430         siglongjmp(env, 1);
12431         exit(1);
12432 }
12433 EOP
12434         set try
12435         if eval $compile; then
12436                 if $run ./try >/dev/null 2>&1; then
12437                         echo "POSIX sigsetjmp found." >&4
12438                         val="$define"
12439                 else
12440                         $cat >&4 <<EOM
12441 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12442 I'll ignore them.
12443 EOM
12444                         val="$undef"
12445                 fi
12446         else
12447                 echo "sigsetjmp not found." >&4
12448                 val="$undef"
12449         fi
12450         ;;
12451 *) val="$d_sigsetjmp"
12452         case "$d_sigsetjmp" in
12453         $define) echo "POSIX sigsetjmp found." >&4;;
12454         $undef) echo "sigsetjmp not found." >&4;;
12455         esac
12456         ;;
12457 esac
12458 set d_sigsetjmp
12459 eval $setvar
12460 $rm -f try.c try
12461
12462 : see if sockatmark exists
12463 set sockatmark d_sockatmark
12464 eval $inlibc
12465
12466 : see if prototype for sockatmark is available
12467 echo " "
12468 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12469 eval $hasproto
12470
12471 : see if socks5_init exists
12472 set socks5_init d_socks5_init
12473 eval $inlibc
12474
12475 : see if prototype for setresgid is available
12476 echo " "
12477 set d_sresgproto setresgid $i_unistd unistd.h
12478 eval $hasproto
12479
12480 : see if prototype for setresuid is available
12481 echo " "
12482 set d_sresuproto setresuid $i_unistd unistd.h
12483 eval $hasproto
12484
12485 : see if sys/stat.h is available
12486 set sys/stat.h i_sysstat
12487 eval $inhdr
12488
12489
12490 : see if stat knows about block sizes
12491 echo " "
12492 echo "Checking to see if your struct stat has st_blocks field..." >&4
12493 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12494 eval $hasfield
12495
12496
12497 : see if this is a sys/vfs.h system
12498 set sys/vfs.h i_sysvfs
12499 eval $inhdr
12500
12501
12502 : see if this is a sys/statfs.h system
12503 set sys/statfs.h i_sysstatfs
12504 eval $inhdr
12505
12506
12507 echo " "
12508 echo "Checking to see if your system supports struct statfs..." >&4
12509 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
12510 eval $hasstruct
12511 case "$d_statfs_s" in
12512 "$define")      echo "Yes, it does."   ;;
12513 *)              echo "No, it doesn't." ;;
12514 esac
12515
12516
12517
12518 : see if struct statfs knows about f_flags
12519 case "$d_statfs_s" in
12520 define) 
12521         echo " "
12522         echo "Checking to see if your struct statfs has f_flags field..." >&4
12523         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
12524         eval $hasfield
12525         ;;
12526 *)      val="$undef"
12527         set d_statfs_f_flags
12528         eval $setvar
12529         ;;
12530 esac
12531 case "$d_statfs_f_flags" in
12532 "$define")      echo "Yes, it does."   ;;
12533 *)              echo "No, it doesn't." ;;
12534 esac
12535
12536 : see if _ptr and _cnt from stdio act std
12537 echo " "
12538
12539 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12540         echo "(Looks like you have stdio.h from BSD.)"
12541         case "$stdio_ptr" in
12542         '') stdio_ptr='((fp)->_p)'
12543                 ptr_lval=$define
12544                 ;;
12545         *)      ptr_lval=$d_stdio_ptr_lval;;
12546         esac
12547         case "$stdio_cnt" in
12548         '') stdio_cnt='((fp)->_r)'
12549                 cnt_lval=$define
12550                 ;;
12551         *)      cnt_lval=$d_stdio_cnt_lval;;
12552         esac
12553         case "$stdio_base" in
12554         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12555         esac
12556         case "$stdio_bufsiz" in
12557         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12558         esac
12559 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12560         echo "(Looks like you have stdio.h from Linux.)"
12561         case "$stdio_ptr" in
12562         '') stdio_ptr='((fp)->_IO_read_ptr)'
12563                 ptr_lval=$define
12564                 ;;
12565         *)      ptr_lval=$d_stdio_ptr_lval;;
12566         esac
12567         case "$stdio_cnt" in
12568         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12569                 cnt_lval=$undef
12570                 ;;
12571         *)      cnt_lval=$d_stdio_cnt_lval;;
12572         esac
12573         case "$stdio_base" in
12574         '') stdio_base='((fp)->_IO_read_base)';;
12575         esac
12576         case "$stdio_bufsiz" in
12577         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12578         esac
12579 else
12580         case "$stdio_ptr" in
12581         '') stdio_ptr='((fp)->_ptr)'
12582                 ptr_lval=$define
12583                 ;;
12584         *)      ptr_lval=$d_stdio_ptr_lval;;
12585         esac
12586         case "$stdio_cnt" in
12587         '') stdio_cnt='((fp)->_cnt)'
12588                 cnt_lval=$define
12589                 ;;
12590         *)      cnt_lval=$d_stdio_cnt_lval;;
12591         esac
12592         case "$stdio_base" in
12593         '') stdio_base='((fp)->_base)';;
12594         esac
12595         case "$stdio_bufsiz" in
12596         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12597         esac
12598 fi
12599
12600 : test whether _ptr and _cnt really work
12601 echo "Checking how std your stdio is..." >&4
12602 $cat >try.c <<EOP
12603 #include <stdio.h>
12604 #define FILE_ptr(fp)    $stdio_ptr
12605 #define FILE_cnt(fp)    $stdio_cnt
12606 int main() {
12607         FILE *fp = fopen("try.c", "r");
12608         char c = getc(fp);
12609         if (
12610                 18 <= FILE_cnt(fp) &&
12611                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12612         )
12613                 exit(0);
12614         exit(1);
12615 }
12616 EOP
12617 val="$undef"
12618 set try
12619 if eval $compile && $to try.c; then
12620         if $run ./try; then
12621                 echo "Your stdio acts pretty std."
12622                 val="$define"
12623         else
12624                 echo "Your stdio isn't very std."
12625         fi
12626 else
12627         echo "Your stdio doesn't appear very std."
12628 fi
12629 $rm -f try.c try
12630 set d_stdstdio
12631 eval $setvar
12632
12633 : Can _ptr be used as an lvalue?
12634 case "$d_stdstdio$ptr_lval" in
12635 $define$define) val=$define ;;
12636 *) val=$undef ;;
12637 esac
12638 set d_stdio_ptr_lval
12639 eval $setvar
12640
12641 : Can _cnt be used as an lvalue?
12642 case "$d_stdstdio$cnt_lval" in
12643 $define$define) val=$define ;;
12644 *) val=$undef ;;
12645 esac
12646 set d_stdio_cnt_lval
12647 eval $setvar
12648
12649
12650 : test whether setting _ptr sets _cnt as a side effect
12651 d_stdio_ptr_lval_sets_cnt="$undef"
12652 d_stdio_ptr_lval_nochange_cnt="$undef"
12653 case "$d_stdio_ptr_lval$d_stdstdio" in
12654 $define$define)
12655         echo "Checking to see what happens if we set the stdio ptr..." >&4
12656 $cat >try.c <<EOP
12657 #include <stdio.h>
12658 /* Can we scream? */
12659 /* Eat dust sed :-) */
12660 /* In the buffer space, no one can hear you scream. */
12661 #define FILE_ptr(fp)    $stdio_ptr
12662 #define FILE_cnt(fp)    $stdio_cnt
12663 #include <sys/types.h>
12664 int main() {
12665         FILE *fp = fopen("try.c", "r");
12666         int c;
12667         char *ptr;
12668         size_t cnt;
12669         if (!fp) {
12670             puts("Fail even to read");
12671             exit(1);
12672         }
12673         c = getc(fp); /* Read away the first # */
12674         if (c == EOF) {
12675             puts("Fail even to read");
12676             exit(1);
12677         }
12678         if (!(
12679                 18 <= FILE_cnt(fp) &&
12680                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12681         )) {
12682                 puts("Fail even to read");
12683                 exit (1);
12684         }
12685         ptr = (char*) FILE_ptr(fp);
12686         cnt = (size_t)FILE_cnt(fp);
12687
12688         FILE_ptr(fp) += 42;
12689
12690         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12691                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12692                 exit (1);
12693         }
12694         if (FILE_cnt(fp) <= 20) {
12695                 printf ("Fail (<20 chars to test)");
12696                 exit (1);
12697         }
12698         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12699                 puts("Fail compare");
12700                 exit (1);
12701         }
12702         if (cnt == FILE_cnt(fp)) {
12703                 puts("Pass_unchanged");
12704                 exit (0);
12705         }       
12706         if (FILE_cnt(fp) == (cnt - 42)) {
12707                 puts("Pass_changed");
12708                 exit (0);
12709         }
12710         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12711         return 1;
12712
12713 }
12714 EOP
12715         set try
12716         if eval $compile && $to try.c; then
12717                 case `$run ./try` in
12718                 Pass_changed)
12719                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12720                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12721                 Pass_unchanged)
12722                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12723                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12724                 Fail*)
12725                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12726                 *)
12727                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12728         esac
12729         else
12730                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12731         fi
12732         $rm -f try.c try
12733         ;;
12734 esac
12735
12736 : see if _base is also standard
12737 val="$undef"
12738 case "$d_stdstdio" in
12739 $define)
12740         $cat >try.c <<EOP
12741 #include <stdio.h>
12742 #define FILE_base(fp)   $stdio_base
12743 #define FILE_bufsiz(fp) $stdio_bufsiz
12744 int main() {
12745         FILE *fp = fopen("try.c", "r");
12746         char c = getc(fp);
12747         if (
12748                 19 <= FILE_bufsiz(fp) &&
12749                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12750         )
12751                 exit(0);
12752         exit(1);
12753 }
12754 EOP
12755         set try
12756         if eval $compile && $to try.c; then
12757                 if $run ./try; then
12758                         echo "And its _base field acts std."
12759                         val="$define"
12760                 else
12761                         echo "But its _base field isn't std."
12762                 fi
12763         else
12764                 echo "However, it seems to be lacking the _base field."
12765         fi
12766         $rm -f try.c try
12767         ;;
12768 esac
12769 set d_stdiobase
12770 eval $setvar
12771
12772 $cat >&4 <<EOM
12773 Checking how to access stdio streams by file descriptor number...
12774 EOM
12775 case "$stdio_stream_array" in
12776 '')     $cat >try.c <<EOCP
12777 #include <stdio.h>
12778 int main() {
12779   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12780     printf("yes\n");
12781 }
12782 EOCP
12783         for s in _iob __iob __sF
12784         do
12785                 set try -DSTDIO_STREAM_ARRAY=$s
12786                 if eval $compile; then
12787                         case "`$run ./try`" in
12788                         yes)    stdio_stream_array=$s; break ;;
12789                         esac
12790                 fi
12791         done
12792         $rm -f try.* try$exe_ext
12793 esac
12794 case "$stdio_stream_array" in
12795 '')     $cat >&4 <<EOM
12796 I can't figure out how to access stdio streams by file descriptor number.
12797 EOM
12798         d_stdio_stream_array="$undef"
12799         ;;
12800 *)      $cat >&4 <<EOM
12801 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12802 EOM
12803         d_stdio_stream_array="$define"
12804         ;;
12805 esac
12806
12807 : see if strcoll exists
12808 set strcoll d_strcoll
12809 eval $inlibc
12810
12811 : check for structure copying
12812 echo " "
12813 echo "Checking to see if your C compiler can copy structs..." >&4
12814 $cat >try.c <<'EOCP'
12815 int main()
12816 {
12817         struct blurfl {
12818                 int dyick;
12819         } foo, bar;
12820
12821         foo = bar;
12822 }
12823 EOCP
12824 if $cc -c try.c >/dev/null 2>&1 ; then
12825         val="$define"
12826         echo "Yup, it can."
12827 else
12828         val="$undef"
12829         echo "Nope, it can't."
12830 fi
12831 set d_strctcpy
12832 eval $setvar
12833 $rm -f try.*
12834
12835 : see if strerror and/or sys_errlist[] exist
12836 echo " "
12837 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12838     if set strerror val -f d_strerror; eval $csym; $val; then
12839                 echo 'strerror() found.' >&4
12840                 d_strerror="$define"
12841                 d_strerrm='strerror(e)'
12842                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12843                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12844                         d_syserrlst="$define"
12845                 else
12846                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12847                         d_syserrlst="$undef"
12848                 fi
12849     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12850                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12851                 echo 'strerror() found in string header.' >&4
12852                 d_strerror="$define"
12853                 d_strerrm='strerror(e)'
12854                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12855                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12856                                 d_syserrlst="$define"
12857                 else
12858                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12859                         d_syserrlst="$undef"
12860                 fi
12861     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12862                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12863                 d_strerror="$undef"
12864                 d_syserrlst="$define"
12865                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12866     else
12867                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12868                 d_strerror="$undef"
12869                 d_syserrlst="$undef"
12870                 d_strerrm='"unknown"'
12871     fi
12872 fi
12873
12874 : see if strftime exists
12875 set strftime d_strftime
12876 eval $inlibc
12877
12878 : see if strtod exists
12879 set strtod d_strtod
12880 eval $inlibc
12881
12882 : see if strtol exists
12883 set strtol d_strtol
12884 eval $inlibc
12885
12886 : see if strtold exists
12887 set strtold d_strtold
12888 eval $inlibc
12889
12890 : see if strtoll exists
12891 set strtoll d_strtoll
12892 eval $inlibc
12893
12894 case "$d_longlong-$d_strtoll" in
12895 "$define-$define")
12896         $cat <<EOM
12897 Checking whether your strtoll() works okay...
12898 EOM
12899         $cat >try.c <<'EOCP'
12900 #include <errno.h>
12901 #ifdef __hpux
12902 #define strtoll __strtoll
12903 #endif
12904 #ifdef __EMX__
12905 #define strtoll _strtoll
12906 #endif
12907 #include <stdio.h>
12908 extern long long int strtoll(char *s, char **, int); 
12909 static int bad = 0;
12910 int check(char *s, long long ell, int een) {
12911         long long gll;
12912         errno = 0;
12913         gll = strtoll(s, 0, 10);
12914         if (!((gll == ell) && (errno == een)))
12915                 bad++;
12916 }
12917 int main() {
12918         check(" 1",                                      1LL, 0);
12919         check(" 0",                                      0LL, 0);
12920         check("-1",                                     -1LL, 0);
12921         check("-9223372036854775808", -9223372036854775808LL, 0);
12922         check("-9223372036854775808", -9223372036854775808LL, 0);
12923         check(" 9223372036854775807",  9223372036854775807LL, 0);
12924         check("-9223372036854775808", -9223372036854775808LL, 0);
12925         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12926         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12927         if (!bad)
12928                 printf("ok\n");
12929 }
12930 EOCP
12931         set try
12932         if eval $compile; then
12933                 yyy=`$run ./try`
12934                 case "$yyy" in
12935                 ok) echo "Your strtoll() seems to be working okay." ;;
12936                 *) cat <<EOM >&4
12937 Your strtoll() doesn't seem to be working okay.
12938 EOM
12939                    d_strtoll="$undef"
12940                    ;;
12941                 esac
12942         else
12943                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12944                 d_strtoll="$undef"
12945         fi
12946         ;;
12947 esac
12948
12949 : see if strtoq exists
12950 set strtoq d_strtoq
12951 eval $inlibc
12952
12953 : see if strtoul exists
12954 set strtoul d_strtoul
12955 eval $inlibc
12956
12957 case "$d_strtoul" in
12958 "$define")
12959         $cat <<EOM
12960 Checking whether your strtoul() works okay...
12961 EOM
12962         $cat >try.c <<'EOCP'
12963 #include <errno.h>
12964 #include <stdio.h>
12965 extern unsigned long int strtoul(char *s, char **, int); 
12966 static int bad = 0;
12967 void check(char *s, unsigned long eul, int een) {
12968         unsigned long gul;
12969         errno = 0;
12970         gul = strtoul(s, 0, 10);
12971         if (!((gul == eul) && (errno == een)))
12972                 bad++;
12973 }
12974 int main() {
12975         check(" 1", 1L, 0);
12976         check(" 0", 0L, 0);
12977 EOCP
12978         case "$longsize" in
12979         8)
12980             $cat >>try.c <<'EOCP'
12981         check("18446744073709551615", 18446744073709551615UL, 0);
12982         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12983 #if 0 /* strtoul() for /^-/ strings is undefined. */
12984         check("-1", 18446744073709551615UL, 0);
12985         check("-18446744073709551614", 2, 0);
12986         check("-18446744073709551615", 1, 0);
12987         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12988         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12989 #endif
12990 EOCP
12991                 ;;
12992         4)
12993                     $cat >>try.c <<'EOCP'
12994         check("4294967295", 4294967295UL, 0);
12995         check("4294967296", 4294967295UL, ERANGE);
12996 #if 0 /* strtoul() for /^-/ strings is undefined. */
12997         check("-1", 4294967295UL, 0);
12998         check("-4294967294", 2, 0);
12999         check("-4294967295", 1, 0);
13000         check("-4294967296", 4294967295UL, ERANGE);
13001         check("-4294967297", 4294967295UL, ERANGE);
13002 #endif
13003 EOCP
13004                 ;;
13005         *)
13006 : Should we write these tests to be more portable by sprintf-ing
13007 : ~0 and then manipulating that char string as input for strtol?
13008                 ;;
13009         esac
13010         $cat >>try.c <<'EOCP'
13011         if (!bad)
13012                 printf("ok\n");
13013         return 0;
13014 }
13015 EOCP
13016         set try
13017         if eval $compile; then
13018                 case "`$run ./try`" in
13019                 ok) echo "Your strtoul() seems to be working okay." ;;
13020                 *) cat <<EOM >&4
13021 Your strtoul() doesn't seem to be working okay.
13022 EOM
13023                    d_strtoul="$undef"
13024                    ;;
13025                 esac
13026         fi
13027         ;;
13028 esac
13029
13030 : see if strtoull exists
13031 set strtoull d_strtoull
13032 eval $inlibc
13033
13034 case "$d_longlong-$d_strtoull" in
13035 "$define-$define")
13036         $cat <<EOM
13037 Checking whether your strtoull() works okay...
13038 EOM
13039         $cat >try.c <<'EOCP'
13040 #include <errno.h>
13041 #ifdef __hpux
13042 #define strtoull __strtoull
13043 #endif
13044 #include <stdio.h>
13045 extern unsigned long long int strtoull(char *s, char **, int); 
13046 static int bad = 0;
13047 int check(char *s, long long eull, int een) {
13048         long long gull;
13049         errno = 0;
13050         gull = strtoull(s, 0, 10);
13051         if (!((gull == eull) && (errno == een)))
13052                 bad++;
13053 }
13054 int main() {
13055         check(" 1",                                        1LL, 0);
13056         check(" 0",                                        0LL, 0);
13057         check("18446744073709551615",  18446744073709551615ULL, 0);
13058         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13059 #if 0 /* strtoull() for /^-/ strings is undefined. */
13060         check("-1",                    18446744073709551615ULL, 0);
13061         check("-18446744073709551614",                     2LL, 0);
13062         check("-18446744073709551615",                     1LL, 0);
13063         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13064         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13065 #endif
13066         if (!bad)
13067                 printf("ok\n");
13068 }
13069 EOCP
13070         set try
13071         if eval $compile; then
13072                 case "`$run ./try`" in
13073                 ok) echo "Your strtoull() seems to be working okay." ;;
13074                 *) cat <<EOM >&4
13075 Your strtoull() doesn't seem to be working okay.
13076 EOM
13077                    d_strtoull="$undef"
13078                    ;;
13079                 esac
13080         fi
13081         ;;
13082 esac
13083
13084 : see if strtouq exists
13085 set strtouq d_strtouq
13086 eval $inlibc
13087
13088 case "$d_strtouq" in
13089 "$define")
13090         $cat <<EOM
13091 Checking whether your strtouq() works okay...
13092 EOM
13093         $cat >try.c <<'EOCP'
13094 #include <errno.h>
13095 #include <stdio.h>
13096 extern unsigned long long int strtouq(char *s, char **, int); 
13097 static int bad = 0;
13098 void check(char *s, unsigned long long eull, int een) {
13099         unsigned long long gull;
13100         errno = 0;
13101         gull = strtouq(s, 0, 10);
13102         if (!((gull == eull) && (errno == een)))
13103                 bad++;
13104 }
13105 int main() {
13106         check(" 1",                                        1LL, 0);
13107         check(" 0",                                        0LL, 0);
13108         check("18446744073709551615",  18446744073709551615ULL, 0);
13109         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13110 #if 0 /* strtouq() for /^-/ strings is undefined. */
13111         check("-1",                    18446744073709551615ULL, 0);
13112         check("-18446744073709551614",                     2LL, 0);
13113         check("-18446744073709551615",                     1LL, 0);
13114         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13115         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13116 #endif
13117         if (!bad)
13118                 printf("ok\n");
13119         return 0;
13120 }
13121 EOCP
13122         set try
13123         if eval $compile; then
13124                 case "`$run ./try`" in
13125                 ok) echo "Your strtouq() seems to be working okay." ;;
13126                 *) cat <<EOM >&4
13127 Your strtouq() doesn't seem to be working okay.
13128 EOM
13129                    d_strtouq="$undef"
13130                    ;;
13131                 esac
13132         fi
13133         ;;
13134 esac
13135
13136 : see if strxfrm exists
13137 set strxfrm d_strxfrm
13138 eval $inlibc
13139
13140 : see if symlink exists
13141 set symlink d_symlink
13142 eval $inlibc
13143
13144 : see if syscall exists
13145 set syscall d_syscall
13146 eval $inlibc
13147
13148 : see if prototype for syscall is available
13149 echo " "
13150 set d_syscallproto syscall $i_unistd unistd.h
13151 eval $hasproto
13152
13153 : see if sysconf exists
13154 set sysconf d_sysconf
13155 eval $inlibc
13156
13157 : see if system exists
13158 set system d_system
13159 eval $inlibc
13160
13161 : see if tcgetpgrp exists
13162 set tcgetpgrp d_tcgetpgrp
13163 eval $inlibc
13164
13165 : see if tcsetpgrp exists
13166 set tcsetpgrp d_tcsetpgrp
13167 eval $inlibc
13168
13169 : see if prototype for telldir is available
13170 echo " "
13171 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13172 eval $hasproto
13173
13174 : see if this is a sys/times.h system
13175 set sys/times.h i_systimes
13176 eval $inhdr
13177
13178 : see if times exists
13179 echo " "
13180 if set times val -f d_times; eval $csym; $val; then
13181         echo 'times() found.' >&4
13182         d_times="$define"
13183         inc=''
13184         case "$i_systimes" in
13185         "$define") inc='sys/times.h';;
13186         esac
13187         rp="What is the type returned by times() on this system?"
13188         set clock_t clocktype long stdio.h sys/types.h $inc
13189         eval $typedef_ask
13190 else
13191         echo 'times() NOT found, hope that will do.' >&4
13192         d_times="$undef"
13193         clocktype='int'
13194 fi
13195
13196 : see if truncate exists
13197 set truncate d_truncate
13198 eval $inlibc
13199
13200 : see if tzname[] exists
13201 echo " "
13202 if set tzname val -a d_tzname; eval $csym; $val; then
13203         val="$define"
13204         echo 'tzname[] found.' >&4
13205 else
13206         val="$undef"
13207         echo 'tzname[] NOT found.' >&4
13208 fi
13209 set d_tzname
13210 eval $setvar
13211
13212 case "$osname" in
13213 next|rhapsody|darwin) multiarch="$define" ;;
13214 esac
13215 case "$multiarch" in
13216 ''|[nN]*) multiarch="$undef" ;;
13217 esac
13218
13219 : check for ordering of bytes in a long
13220 echo " "
13221 case "$usecrosscompile$multiarch" in
13222 *$define*)
13223         $cat <<EOM
13224 You seem to be either cross-compiling or doing a multiarchitecture build,
13225 skipping the byteorder check.
13226
13227 EOM
13228         byteorder='ffff'
13229         ;;
13230 *)
13231         case "$byteorder" in
13232         '')
13233                 $cat <<'EOM'
13234 In the following, larger digits indicate more significance.  A big-endian
13235 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13236 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13237 machines may have weird orders like 3412.  A Cray will report 87654321,
13238 an Alpha will report 12345678. If the test program works the default is
13239 probably right.
13240 I'm now running the test program...
13241 EOM
13242                 $cat >try.c <<'EOCP'
13243 #include <stdio.h>
13244 int main()
13245 {
13246         int i;
13247         union {
13248                 unsigned long l;
13249                 char c[sizeof(long)];
13250         } u;
13251
13252         if (sizeof(long) > 4)
13253                 u.l = (0x08070605L << 32) | 0x04030201L;
13254         else
13255                 u.l = 0x04030201L;
13256         for (i = 0; i < sizeof(long); i++)
13257                 printf("%c", u.c[i]+'0');
13258         printf("\n");
13259         exit(0);
13260 }
13261 EOCP
13262                 xxx_prompt=y
13263                 set try
13264                 if eval $compile && ./try > /dev/null; then
13265                         dflt=`$run ./try`
13266                         case "$dflt" in
13267                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13268                                 echo "(The test program ran ok.)"
13269                                 echo "byteorder=$dflt"
13270                                 xxx_prompt=n
13271                         ;;
13272                         ????|????????) echo "(The test program ran ok.)" ;;
13273                         *) echo "(The test program didn't run right for some reason.)" ;;
13274                         esac
13275                 else
13276                         dflt='4321'
13277                         cat <<'EOM'
13278 (I can't seem to compile the test program.  Guessing big-endian...)
13279 EOM
13280                 fi
13281                 case "$xxx_prompt" in
13282                 y)
13283                         rp="What is the order of bytes in a long?"
13284                         . ./myread
13285                         byteorder="$ans"
13286                         ;;
13287                 *)      byteorder=$dflt
13288                         ;;
13289                 esac
13290                 ;;
13291         esac
13292         $rm -f try.c try
13293         ;;
13294 esac
13295
13296
13297 $cat <<EOM
13298
13299 Checking to see whether you can access character data unalignedly...
13300 EOM
13301 $cat >try.c <<EOCP
13302 #include <stdio.h>
13303 #define U32 $u32type
13304 #define BYTEORDER $byteorder
13305 int main() {
13306 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13307     U8 buf[] = "\0\0\0\1\0\0\0\0";
13308     U32 *up;
13309     int i;
13310
13311     if (sizeof(U32) != 4) {
13312         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13313         exit(1);
13314     }
13315
13316     fflush(stdout);
13317
13318     for (i = 0; i < 4; i++) {
13319         up = (U32*)(buf + i);
13320         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13321                (*up == 1 << (8*(3-i)))  /* little-endian */
13322               )
13323            )
13324         {
13325             printf("read failed (%x)\n", *up);
13326             exit(2);
13327         }
13328     }
13329
13330     /* write test */
13331     for (i = 0; i < 4; i++) {
13332         up = (U32*)(buf + i);
13333         *up = 0xBeef;
13334         if (*up != 0xBeef) {
13335             printf("write failed (%x)\n", *up);
13336             exit(3);
13337         }
13338     }
13339
13340     exit(0);
13341 #else
13342     printf("1\n");
13343     exit(1);
13344 #endif
13345     return 0;
13346 }
13347 EOCP
13348 set try
13349 if eval $compile_ok; then
13350         echo "(Testing for character data alignment may dump core.)" >&4
13351         $run ./try 2>&1 >/dev/null
13352         case "$?" in
13353         0)      cat >&4 <<EOM
13354 You can access character data pretty unalignedly.
13355 EOM
13356                 d_u32align="$undef"
13357                 ;;
13358         *)      cat >&4 <<EOM
13359 It seems that you must access character data in an aligned manner.
13360 EOM
13361                 d_u32align="$define"
13362                 ;;
13363         esac
13364         $rm -f core core.try.* try.core
13365 else
13366         rp='Can you access character data at unaligned addresses?'
13367         dflt='n'
13368         . ./myread
13369         case "$ans" in
13370         [yY]*)  d_u32align="$undef"  ;;
13371         *)      d_u32align="$define" ;;
13372         esac
13373 fi
13374
13375 : see if ualarm exists
13376 set ualarm d_ualarm
13377 eval $inlibc
13378
13379 : see if umask exists
13380 set umask d_umask
13381 eval $inlibc
13382
13383 : see if unordered exists
13384 set unordered d_unordered
13385 eval $inlibc
13386
13387 : see if usleep exists
13388 set usleep d_usleep
13389 eval $inlibc
13390
13391 : see if prototype for usleep is available
13392 echo " "
13393 set d_usleepproto usleep $i_unistd unistd.h
13394 eval $hasproto
13395
13396 : see if ustat exists
13397 set ustat d_ustat
13398 eval $inlibc
13399
13400 : backward compatibility for d_hvfork
13401 if test X$d_hvfork != X; then
13402         d_vfork="$d_hvfork"
13403         d_hvfork=''
13404 fi
13405 : see if there is a vfork
13406 val=''
13407 set vfork val
13408 eval $inlibc
13409
13410 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13411 : perl on Solaris 2.x, and probably elsewhere.
13412 case "$val" in
13413 $define)
13414         echo " "
13415         case "$usevfork" in
13416         false) dflt='n';;
13417         *) dflt='y';;
13418         esac
13419         cat <<'EOM'
13420  
13421 Perl can only use a vfork() that doesn't suffer from strict
13422 restrictions on calling functions or modifying global data in
13423 the child.  For example, glibc-2.1 contains such a vfork()
13424 that is unsuitable.  If your system provides a proper fork()
13425 call, chances are that you do NOT want perl to use vfork().
13426
13427 EOM
13428         rp="Do you still want to use vfork()?"
13429         . ./myread
13430         case "$ans" in
13431         y|Y) ;;
13432         *)
13433                 echo "Ok, we won't use vfork()."
13434                 val="$undef"
13435                 ;;
13436         esac
13437         ;;
13438 esac
13439 set d_vfork
13440 eval $setvar
13441 case "$d_vfork" in
13442 $define) usevfork='true';;
13443 *) usevfork='false';;
13444 esac
13445
13446 : see if this is an sysdir system
13447 set sys/dir.h i_sysdir
13448 eval $inhdr
13449
13450 : see if this is an sysndir system
13451 set sys/ndir.h i_sysndir
13452 eval $inhdr
13453
13454 : see if closedir exists
13455 set closedir d_closedir
13456 eval $inlibc
13457
13458 case "$d_closedir" in
13459 "$define")
13460         echo " "
13461         echo "Checking whether closedir() returns a status..." >&4
13462         cat > try.c <<EOM
13463 #$i_dirent I_DIRENT             /**/
13464 #$i_sysdir I_SYS_DIR            /**/
13465 #$i_sysndir I_SYS_NDIR          /**/
13466 #$i_systypes I_SYS_TYPES        /**/
13467
13468 #if defined(I_SYS_TYPES)
13469 #include <sys/types.h>
13470 #endif
13471 #if defined(I_DIRENT)
13472 #include <dirent.h>
13473 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13474 #include <sys/dir.h>
13475 #endif
13476 #else
13477 #ifdef I_SYS_NDIR
13478 #include <sys/ndir.h>
13479 #else
13480 #ifdef I_SYS_DIR
13481 #ifdef hp9000s500
13482 #include <ndir.h>       /* may be wrong in the future */
13483 #else
13484 #include <sys/dir.h>
13485 #endif
13486 #endif
13487 #endif
13488 #endif 
13489 int main() { return closedir(opendir(".")); }
13490 EOM
13491         set try
13492         if eval $compile_ok; then
13493                 if $run ./try > /dev/null 2>&1 ; then
13494                         echo "Yes, it does."
13495                         val="$undef"
13496                 else
13497                         echo "No, it doesn't."
13498                         val="$define"
13499                 fi
13500         else
13501                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13502                 val="$define"
13503         fi
13504         ;;
13505 *)
13506         val="$undef";
13507         ;;
13508 esac
13509 set d_void_closedir
13510 eval $setvar
13511 $rm -f try try.*
13512 : see if there is a wait4
13513 set wait4 d_wait4
13514 eval $inlibc
13515
13516 : see if waitpid exists
13517 set waitpid d_waitpid
13518 eval $inlibc
13519
13520 : see if wcstombs exists
13521 set wcstombs d_wcstombs
13522 eval $inlibc
13523
13524 : see if wctomb exists
13525 set wctomb d_wctomb
13526 eval $inlibc
13527
13528 : see if writev exists
13529 set writev d_writev
13530 eval $inlibc
13531
13532 : preserve RCS keywords in files with variable substitution, grrr
13533 Date='$Date'
13534 Id='$Id'
13535 Log='$Log'
13536 RCSfile='$RCSfile'
13537 Revision='$Revision'
13538
13539 : check for alignment requirements
13540 echo " "
13541 case "$usecrosscompile$multiarch" in
13542 *$define*)
13543         $cat <<EOM
13544 You seem to be either cross-compiling or doing a multiarchitecture build,
13545 skipping the memory alignment check.
13546
13547 EOM
13548         case "$alignbytes" in
13549         '') alignbytes=8 ;;
13550         esac
13551         ;;
13552 *)
13553         case "$alignbytes" in
13554         '') echo "Checking alignment constraints..." >&4
13555                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13556                         $cat >try.c <<'EOCP'
13557 typedef long double NV;
13558 EOCP
13559                 else
13560                         $cat >try.c <<'EOCP'
13561 typedef double NV;
13562 EOCP
13563                 fi
13564                 $cat >>try.c <<'EOCP'
13565 #include <stdio.h>
13566 struct foobar {
13567         char foo;
13568         NV bar;
13569 } try_algn;
13570 int main()
13571 {
13572     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13573     return(0);
13574 }
13575 EOCP
13576                 set try
13577                 if eval $compile_ok; then
13578                         dflt=`$run ./try`
13579                 else
13580                         dflt='8'
13581                         echo "(I can't seem to compile the test program...)"
13582                 fi
13583                 ;;
13584         *) dflt="$alignbytes"
13585                 ;;
13586         esac
13587         rp="Doubles must be aligned on a how-many-byte boundary?"
13588         . ./myread
13589         alignbytes="$ans"
13590         $rm -f try.c try
13591         ;;
13592 esac
13593
13594
13595 : set the base revision
13596 baserev=5.0
13597
13598 : how do we catenate cpp tokens here?
13599 echo " "
13600 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13601 $cat >cpp_stuff.c <<'EOCP'
13602 #define RCAT(a,b)a/**/b
13603 #define ACAT(a,b)a ## b
13604 RCAT(Rei,ser)
13605 ACAT(Cir,cus)
13606 EOCP
13607 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13608 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13609         echo "Oh!  Smells like ANSI's been here." >&4
13610         echo "We can catify or stringify, separately or together!"
13611         cpp_stuff=42
13612 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13613         echo "Ah, yes!  The good old days!" >&4
13614         echo "However, in the good old days we don't know how to stringify and"
13615         echo "catify at the same time."
13616         cpp_stuff=1
13617 else
13618         $cat >&4 <<EOM
13619 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13620 to have to edit the values of CAT[2-5] in config.h...
13621 EOM
13622         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13623 fi
13624 $rm -f cpp_stuff.*
13625
13626 : see if this is a db.h system
13627 set db.h i_db
13628 eval $inhdr
13629
13630 case "$i_db" in
13631 $define)
13632         : Check db version.
13633         echo " "
13634         echo "Checking Berkeley DB version ..." >&4
13635         $cat >try.c <<EOCP
13636 #$d_const HASCONST
13637 #ifndef HASCONST
13638 #define const
13639 #endif
13640 #include <sys/types.h>
13641 #include <stdio.h>
13642 #include <db.h>
13643 int main(int argc, char *argv[])
13644 {
13645 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13646     int Major, Minor, Patch ;
13647     unsigned long Version ;
13648     (void)db_version(&Major, &Minor, &Patch) ;
13649     if (argc == 2) {
13650         printf("%d %d %d %d %d %d\n",
13651                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13652                Major, Minor, Patch);
13653         exit(0);
13654     }
13655     printf("You have Berkeley DB Version 2 or greater.\n");
13656
13657     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13658                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13659     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13660                 Major, Minor, Patch) ;
13661
13662     /* check that db.h & libdb are compatible */
13663     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13664         printf("db.h and libdb are incompatible.\n") ;
13665         exit(3);        
13666     }
13667
13668     printf("db.h and libdb are compatible.\n") ;
13669
13670     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13671                 + DB_VERSION_PATCH ;
13672
13673     /* needs to be >= 2.3.4 */
13674     if (Version < 2003004) {
13675     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13676         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13677         exit(2);        
13678     }
13679
13680     exit(0);
13681 #else
13682 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13683     if (argc == 2) {
13684         printf("1 0 0\n");
13685         exit(0);
13686     }
13687     printf("You have Berkeley DB Version 1.\n");
13688     exit(0);    /* DB version < 2: the coast is clear. */
13689 #else
13690     exit(1);    /* <db.h> not Berkeley DB? */
13691 #endif
13692 #endif
13693 }
13694 EOCP
13695         set try
13696         if eval $compile_ok && $run ./try; then
13697                 echo 'Looks OK.' >&4
13698                 set `$run ./try 1`
13699                 db_version_major=$1
13700                 db_version_minor=$2
13701                 db_version_patch=$3
13702         else
13703                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13704                 i_db=$undef
13705                 case " $libs " in
13706                 *"-ldb "*)
13707                         : Remove db from list of libraries to use
13708                         echo "Removing unusable -ldb from library list" >&4
13709                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13710                         shift
13711                         libs="$*"
13712                         echo "libs = $libs" >&4
13713                         ;;
13714                 esac
13715         fi
13716         $rm -f try.*
13717         ;;
13718 esac
13719
13720 case "$i_db" in
13721 define)
13722         : Check the return type needed for hash 
13723         echo " "
13724         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13725         $cat >try.c <<EOCP
13726 #$d_const HASCONST
13727 #ifndef HASCONST
13728 #define const
13729 #endif
13730 #include <sys/types.h>
13731 #include <db.h>
13732
13733 #ifndef DB_VERSION_MAJOR
13734 u_int32_t hash_cb (ptr, size)
13735 const void *ptr;
13736 size_t size;
13737 {
13738 }
13739 HASHINFO info;
13740 int main()
13741 {
13742         info.hash = hash_cb;
13743 }
13744 #endif
13745 EOCP
13746         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13747                 if $contains warning try.out >>/dev/null 2>&1 ; then
13748                         db_hashtype='int'
13749                 else
13750                         db_hashtype='u_int32_t'
13751                 fi
13752         else
13753                 : XXX Maybe we should just give up here.
13754                 db_hashtype=u_int32_t
13755                 $cat try.out >&4
13756                 echo "Help:  I can't seem to compile the db test program." >&4
13757                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13758         fi
13759         $rm -f try.*
13760         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13761         ;;
13762 *)      db_hashtype=u_int32_t
13763         ;;
13764 esac
13765 case "$i_db" in
13766 define)
13767         : Check the return type needed for prefix 
13768         echo " "
13769         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13770         cat >try.c <<EOCP
13771 #$d_const HASCONST
13772 #ifndef HASCONST
13773 #define const
13774 #endif
13775 #include <sys/types.h>
13776 #include <db.h>
13777
13778 #ifndef DB_VERSION_MAJOR
13779 size_t prefix_cb (key1, key2)
13780 const DBT *key1;
13781 const DBT *key2;
13782 {
13783 }
13784 BTREEINFO info;
13785 int main()
13786 {
13787         info.prefix = prefix_cb;
13788 }
13789 #endif
13790 EOCP
13791         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13792                 if $contains warning try.out >>/dev/null 2>&1 ; then
13793                         db_prefixtype='int'
13794                 else
13795                         db_prefixtype='size_t'
13796                 fi
13797         else
13798                 db_prefixtype='size_t'
13799                 : XXX Maybe we should just give up here.
13800                 $cat try.out >&4
13801                 echo "Help:  I can't seem to compile the db test program." >&4
13802                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13803         fi
13804         $rm -f try.*
13805         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13806         ;;
13807 *)      db_prefixtype='size_t'
13808         ;;
13809 esac
13810
13811
13812 : How can we generate normalized random numbers ?
13813 echo " "
13814 echo "Looking for a random number function..." >&4
13815 case "$randfunc" in
13816 '')
13817         if set drand48 val -f; eval $csym; $val; then
13818                 dflt="drand48"
13819                 echo "Good, found drand48()." >&4
13820         elif set random val -f; eval $csym; $val; then
13821                 dflt="random"
13822                 echo "OK, found random()." >&4
13823         else
13824                 dflt="rand"
13825                 echo "Yick, looks like I have to use rand()." >&4
13826         fi
13827         echo " "
13828         ;;
13829 *)
13830         dflt="$randfunc"
13831         ;;
13832 esac
13833 cont=true
13834
13835 case "$ccflags" in
13836 *-Dmy_rand=*|*-Dmy_srand=*)
13837         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13838         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13839         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13840         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13841         ;;
13842 esac
13843
13844 while $test "$cont"; do
13845         rp="Use which function to generate random numbers?"
13846         . ./myread
13847         if $test "$ans" = "$dflt"; then
13848                 : null
13849         else
13850                 randbits=''
13851         fi
13852         randfunc="$ans"
13853         if set $ans val -f; eval $csym; $val; then
13854                 cont=''
13855         else
13856                 dflt=y
13857                 rp="I cannot find function $ans. Use that name anyway?"
13858                 . ./myread
13859                 dflt=rand
13860                 case "$ans" in
13861                         [yY]*) cont='';;
13862                 esac
13863         fi
13864         case "$cont" in
13865         '')
13866                 case "$randfunc" in
13867                 drand48)
13868                         drand01="drand48()"
13869                         seedfunc="srand48"
13870                         randbits=48
13871                         randseedtype=long
13872                         ;;
13873                 rand|random)
13874                         case "$randbits" in
13875                         '')
13876 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13877                                 $cat >try.c <<EOCP
13878 #$i_unistd I_UNISTD
13879 #$i_stdlib I_STDLIB
13880 #include <stdio.h>
13881 #ifdef I_UNISTD
13882 #  include <unistd.h>
13883 #endif
13884 #ifdef I_STDLIB
13885 #  include <stdlib.h>
13886 #endif
13887 int main()
13888 {
13889         register int i;
13890         register unsigned long tmp;
13891         register unsigned long max = 0L;
13892
13893         for (i = 1000; i; i--) {
13894                 tmp = (unsigned long) $randfunc();
13895                 if (tmp > max) max = tmp;
13896         }
13897         for (i = 0; max; i++)
13898                 max /= 2;
13899         printf("%d\n",i);
13900 }
13901 EOCP
13902                                 set try
13903                                 if eval $compile_ok; then
13904                                         dflt=`try`
13905                                 else
13906                                         dflt='?'
13907                                         echo "(I can't seem to compile the test program...)"
13908                                 fi
13909                                 ;;
13910                         *)
13911                                 dflt="$randbits"
13912                                 ;;
13913                         esac
13914                         rp="How many bits does your $randfunc() function produce?"
13915                         . ./myread
13916                         randbits="$ans"
13917                         $rm -f try.c try
13918                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13919                         seedfunc="s$randfunc"
13920                         randseedtype=unsigned
13921                         ;;
13922                 *)
13923                         dflt="31"
13924                         rp="How many bits does your $randfunc() function produce?"
13925                         . ./myread
13926                         randbits="$ans"
13927                         seedfunc="s$randfunc"
13928                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13929                         if set $seedfunc val -f; eval $csym; $val; then
13930                                 echo "(Using $seedfunc() to seed random generator)"
13931                         else
13932                                 echo "(Warning: no $seedfunc() to seed random generator)"
13933                                 seedfunc=rand
13934                         fi
13935                         randseedtype=unsigned
13936                         ;;
13937                 esac
13938                 ;;
13939         esac
13940 done
13941
13942 echo " "
13943 echo "Determining whether or not we are on an EBCDIC system..." >&4
13944 $cat >try.c <<'EOM'
13945 int main()
13946 {
13947   if ('M'==0xd4) return 0;
13948   return 1;
13949 }
13950 EOM
13951
13952 val=$undef
13953 set try
13954 if eval $compile_ok; then
13955         if $run ./try; then
13956                 echo "You seem to speak EBCDIC." >&4
13957                 val="$define"
13958         else
13959                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
13960         fi
13961 else
13962         echo "I'm unable to compile the test program." >&4
13963         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13964 fi
13965 $rm -f try try.*
13966 set ebcdic
13967 eval $setvar
13968
13969 echo " "
13970 $cat >&4 <<EOM
13971 Checking how to flush all pending stdio output...
13972 EOM
13973 # I only know how to find the first 32 possibly open files on SunOS.
13974 # See also hints/sunos_4_1.sh and util.c  --AD
13975 case "$osname" in
13976 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13977 esac
13978 $cat >>try.c <<EOCP
13979 #include <stdio.h>
13980 #$i_unistd I_UNISTD
13981 #ifdef I_UNISTD
13982 # include <unistd.h>
13983 #endif
13984 #$d_sysconf HAS_SYSCONF
13985 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13986 #ifdef HAS_STDIO_STREAM_ARRAY
13987 # define STDIO_STREAM_ARRAY $stdio_stream_array
13988 #endif
13989 int main() {
13990   FILE* p;
13991   unlink("try.out");
13992   p = fopen("try.out", "w");
13993 #ifdef TRY_FPUTC
13994   fputc('x', p);
13995 #else
13996 # ifdef TRY_FPRINTF
13997   fprintf(p, "x");
13998 # endif
13999 #endif
14000 #ifdef TRY_FFLUSH_NULL
14001   fflush(NULL);
14002 #endif
14003 #ifdef TRY_FFLUSH_ALL
14004   {
14005     long open_max = -1;
14006 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
14007     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
14008 # else
14009 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
14010     open_max = sysconf(_SC_OPEN_MAX);
14011 #  else
14012 #   ifdef FOPEN_MAX
14013     open_max = FOPEN_MAX;
14014 #   else
14015 #    ifdef OPEN_MAX
14016     open_max = OPEN_MAX;
14017 #    else
14018 #     ifdef _NFILE
14019     open_max = _NFILE;
14020 #     endif
14021 #    endif
14022 #   endif
14023 #  endif
14024 # endif 
14025 # ifdef HAS_STDIO_STREAM_ARRAY
14026     if (open_max > 0) {
14027       long i;
14028       for (i = 0; i < open_max; i++)
14029             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
14030                 STDIO_STREAM_ARRAY[i]._file < open_max &&
14031                 STDIO_STREAM_ARRAY[i]._flag)
14032                 fflush(&STDIO_STREAM_ARRAY[i]);
14033     }   
14034   }
14035 # endif
14036 #endif
14037   _exit(42);
14038 }
14039 EOCP
14040 : first we have to find out how _not_ to flush
14041 $to try.c
14042 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
14043     output=''
14044     set try -DTRY_FPUTC
14045     if eval $compile; then
14046             $run ./try 2>/dev/null
14047             code="$?"
14048             $from try.out
14049             if $test ! -s try.out -a "X$code" = X42; then
14050                 output=-DTRY_FPUTC
14051             fi
14052     fi
14053     case "$output" in
14054     '')
14055             set try -DTRY_FPRINTF
14056             if eval $compile; then
14057                     $run ./try 2>/dev/null
14058                     code="$?"
14059                     $from try.out
14060                     if $test ! -s try.out -a "X$code" = X42; then
14061                         output=-DTRY_FPRINTF
14062                     fi
14063             fi
14064         ;;
14065     esac
14066 fi
14067 : check for fflush NULL behaviour
14068 case "$fflushNULL" in
14069 '')     set try -DTRY_FFLUSH_NULL $output
14070         if eval $compile; then
14071                 $run ./try 2>/dev/null
14072                 code="$?"
14073                 $from try.out
14074                 if $test -s try.out -a "X$code" = X42; then
14075                         fflushNULL="`$cat try.out`"
14076                 else
14077                         if $test "X$code" != X42; then
14078                                 $cat >&4 <<EOM
14079 (If this test failed, don't worry, we'll try another method shortly.)
14080 EOM
14081                         fi
14082                 fi
14083         fi
14084         $rm -f core try.core core.try.*
14085         case "$fflushNULL" in
14086         x)      $cat >&4 <<EOM
14087 Your fflush(NULL) works okay for output streams.
14088 Let's see if it clobbers input pipes...
14089 EOM
14090 # As of mid-March 2000 all versions of Solaris appear to have a stdio
14091 # bug that improperly flushes the input end of pipes.  So we avoid the
14092 # autoflush on fork/system/exec support for now. :-(
14093 $cat >tryp.c <<EOCP
14094 #include <stdio.h>
14095 int
14096 main(int argc, char **argv)
14097 {
14098     char buf[1024];
14099     int i;
14100     char *bp = buf;
14101     while (1) {
14102         while ((i = getc(stdin)) != -1
14103                && (*bp++ = i) != '\n'
14104                && bp < &buf[1024])
14105         /* DO NOTHING */ ;
14106         *bp = '\0';
14107         fprintf(stdout, "%s", buf);
14108         fflush(NULL);
14109         if (i == -1)
14110             return 0;
14111         bp = buf;
14112     }
14113 }
14114 EOCP
14115                 fflushNULL="$define"
14116                 set tryp
14117                 if eval $compile; then
14118                     $rm -f tryp.out
14119                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14120                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
14121                        $cat >&4 <<EOM
14122 fflush(NULL) seems to behave okay with input streams.
14123 EOM
14124                         fflushNULL="$define"
14125                     else
14126                         $cat >&4 <<EOM
14127 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
14128 EOM
14129                         fflushNULL="$undef"
14130                     fi
14131                 fi
14132                 $rm -f core tryp.c tryp.core core.tryp.*
14133                 ;;
14134         '')     $cat >&4 <<EOM
14135 Your fflush(NULL) isn't working (contrary to ANSI C).
14136 EOM
14137                 fflushNULL="$undef"
14138                 ;;
14139         *)      $cat >&4 <<EOM
14140 Cannot figure out whether your fflush(NULL) works or not.
14141 I'm assuming it doesn't (contrary to ANSI C).
14142 EOM
14143                 fflushNULL="$undef"
14144                 ;;
14145         esac
14146         ;;
14147 $define|true|[yY]*)
14148         fflushNULL="$define"
14149         ;;
14150 *)
14151         fflushNULL="$undef"
14152         ;;
14153 esac
14154 : check explicit looping only if NULL did not work, and if the pipe
14155 : bug does not show up on an explicit flush too
14156 case "$fflushNULL" in
14157 "$undef")
14158         $cat >tryp.c <<EOCP
14159 #include <stdio.h>
14160 int
14161 main(int argc, char **argv)
14162 {
14163     char buf[1024];
14164     int i;
14165     char *bp = buf;
14166     while (1) {
14167         while ((i = getc(stdin)) != -1
14168                && (*bp++ = i) != '\n'
14169                && bp < &buf[1024])
14170         /* DO NOTHING */ ;
14171         *bp = '\0';
14172         fprintf(stdout, "%s", buf);
14173         fflush(stdin);
14174         if (i == -1)
14175             return 0;
14176         bp = buf;
14177     }
14178 }
14179 EOCP
14180         set tryp
14181         if eval $compile; then
14182             $rm -f tryp.out
14183             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14184             if cmp tryp.c tryp.out >/dev/null 2>&1; then
14185                $cat >&4 <<EOM
14186 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14187 EOM
14188                 : now check for fflushall behaviour
14189                 case "$fflushall" in
14190                 '')     set try -DTRY_FFLUSH_ALL $output
14191                         if eval $compile; then
14192                                 $cat >&4 <<EOM
14193 (Now testing the other method--but note that this also may fail.)
14194 EOM
14195                                 $run ./try 2>/dev/null
14196                                 code=$?
14197                                 $from try.out
14198                                 if $test -s try.out -a "X$code" = X42; then
14199                                         fflushall="`$cat try.out`"
14200                                 fi
14201                         fi
14202                         $rm -f core try.core core.try.*
14203                         case "$fflushall" in
14204                         x)      $cat >&4 <<EOM
14205 Whew. Flushing explicitly all the stdio streams works.
14206 EOM
14207                                 fflushall="$define"
14208                                 ;;
14209                         '')     $cat >&4 <<EOM
14210 Sigh. Flushing explicitly all the stdio streams doesn't work.
14211 EOM
14212                                 fflushall="$undef"
14213                                 ;;
14214                         *)      $cat >&4 <<EOM
14215 Cannot figure out whether flushing stdio streams explicitly works or not.
14216 I'm assuming it doesn't.
14217 EOM
14218                                 fflushall="$undef"
14219                                 ;;
14220                         esac
14221                         ;;
14222                 "$define"|true|[yY]*)
14223                         fflushall="$define"
14224                         ;;
14225                 *)
14226                         fflushall="$undef"
14227                         ;;
14228                 esac
14229             else
14230                 $cat >&4 <<EOM
14231 All is futile.  Even fflush(stdin) clobbers input pipes!
14232 EOM
14233                 fflushall="$undef"
14234             fi
14235         else
14236             fflushall="$undef"
14237         fi
14238         $rm -f core tryp.c tryp.core core.tryp.*
14239         ;;
14240 *)      fflushall="$undef"
14241         ;;
14242 esac
14243
14244 case "$fflushNULL$fflushall" in
14245 undefundef)
14246         $cat <<EOM
14247 OK, I give up.  I cannot figure out how to flush pending stdio output.
14248 We won't be flushing handles at all before fork/exec/popen.
14249 EOM
14250         ;;
14251 esac
14252 $rm -f try.* try$exe_ext
14253
14254 : Store the full pathname to the ar program for use in the C program
14255 : Respect a hint or command line value for full_ar.
14256 case "$full_ar" in
14257 '') full_ar=$ar ;;
14258 esac
14259
14260 : Store the full pathname to the sed program for use in the C program
14261 full_sed=$sed
14262
14263 : see what type gids are declared as in the kernel
14264 echo " "
14265 echo "Looking for the type for group ids returned by getgid()."
14266 set gid_t gidtype xxx stdio.h sys/types.h
14267 eval $typedef
14268 case "$gidtype" in
14269 xxx)
14270         xxx=`./findhdr sys/user.h`
14271         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14272         case $1 in
14273         unsigned) dflt="$1 $2" ;;
14274         *) dflt="$1" ;;
14275         esac
14276         ;;
14277 *) dflt="$gidtype";;
14278 esac
14279 case "$gidtype" in
14280 gid_t) echo "gid_t found." ;;
14281 *)      rp="What is the type for group ids returned by getgid()?"
14282         . ./myread
14283         gidtype="$ans"
14284         ;;
14285 esac
14286
14287 echo " "
14288 case "$gidtype" in
14289 *_t) zzz="$gidtype"     ;;
14290 *)   zzz="gid"          ;;
14291 esac
14292 echo "Checking the size of $zzz..." >&4 
14293 cat > try.c <<EOCP
14294 #include <sys/types.h>
14295 #include <stdio.h>
14296 int main() {
14297     printf("%d\n", (int)sizeof($gidtype));
14298     exit(0);
14299 }
14300 EOCP
14301 set try
14302 if eval $compile_ok; then
14303         yyy=`$run ./try`
14304         case "$yyy" in
14305         '')     gidsize=4
14306                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14307                 ;;
14308         *)      gidsize=$yyy
14309                 echo "Your $zzz is $gidsize bytes long."
14310                 ;;
14311         esac
14312 else
14313         gidsize=4
14314         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14315 fi
14316
14317
14318 echo " "
14319 case "$gidtype" in
14320 *_t) zzz="$gidtype"     ;;
14321 *)   zzz="gid"          ;;
14322 esac
14323 echo "Checking the sign of $zzz..." >&4 
14324 cat > try.c <<EOCP
14325 #include <sys/types.h>
14326 #include <stdio.h>
14327 int main() {
14328         $gidtype foo = -1;
14329         if (foo < 0)
14330                 printf("-1\n");
14331         else
14332                 printf("1\n");
14333 }
14334 EOCP
14335 set try
14336 if eval $compile; then
14337         yyy=`$run ./try`
14338         case "$yyy" in
14339         '')     gidsign=1
14340                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14341                 ;;
14342         *)      gidsign=$yyy
14343                 case "$gidsign" in
14344                  1) echo "Your $zzz is unsigned." ;;
14345                 -1) echo "Your $zzz is signed."   ;;
14346                 esac
14347                 ;;
14348         esac
14349 else
14350         gidsign=1
14351         echo "(I can't compile the test program--guessing unsigned.)" >&4
14352 fi
14353
14354
14355 echo " "
14356
14357 if $test X"$quadtype" != X; then
14358
14359 echo "Checking how to print 64-bit integers..." >&4
14360
14361 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14362         $cat >try.c <<'EOCP'
14363 #include <sys/types.h>
14364 #include <stdio.h>
14365 int main() {
14366   int q = 12345678901;
14367   printf("%ld\n", q);
14368 }
14369 EOCP
14370         set try
14371         if eval $compile; then
14372                 yyy=`$run ./try`
14373                 case "$yyy" in
14374                 12345678901)
14375                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14376                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14377                         echo "We will use %d."
14378                         ;;
14379                 esac
14380         fi
14381 fi
14382
14383 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14384         $cat >try.c <<'EOCP'
14385 #include <sys/types.h>
14386 #include <stdio.h>
14387 int main() {
14388   long q = 12345678901;
14389   printf("%ld\n", q);
14390 }
14391 EOCP
14392         set try
14393         if eval $compile; then
14394                 yyy=`$run ./try`
14395                 case "$yyy" in
14396                 12345678901)
14397                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14398                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14399                         echo "We will use %ld."
14400                         ;;
14401                 esac
14402         fi
14403 fi
14404
14405 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14406         $cat >try.c <<'EOCP'
14407 #include <sys/types.h>
14408 #include <inttypes.h>
14409 #include <stdio.h>
14410 int main() {
14411   int64_t q = 12345678901;
14412   printf("%" PRId64 "\n", q);
14413 }
14414 EOCP
14415         set try
14416         if eval $compile; then
14417                 yyy=`$run ./try`
14418                 case "$yyy" in
14419                 12345678901)
14420                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14421                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14422                         echo "We will use the C9X style."
14423                         ;;
14424                 esac
14425         fi
14426 fi
14427
14428 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14429         $cat >try.c <<EOCP
14430 #include <sys/types.h>
14431 #include <stdio.h>
14432 int main() {
14433   $quadtype q = 12345678901;
14434   printf("%Ld\n", q);
14435 }
14436 EOCP
14437         set try
14438         if eval $compile; then
14439                 yyy=`$run ./try`
14440                 case "$yyy" in
14441                 12345678901)
14442                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14443                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14444                         echo "We will use %Ld."
14445                         ;;
14446                 esac
14447         fi
14448 fi
14449
14450 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14451         $cat >try.c <<'EOCP'
14452 #include <sys/types.h>
14453 #include <stdio.h>
14454 int main() {
14455   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14456   printf("%lld\n", q);
14457 }
14458 EOCP
14459         set try
14460         if eval $compile; then
14461                 yyy=`$run ./try`
14462                 case "$yyy" in
14463                 12345678901)
14464                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14465                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14466                         echo "We will use the %lld style."
14467                         ;;
14468                 esac
14469         fi
14470 fi
14471
14472 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14473         $cat >try.c <<EOCP
14474 #include <sys/types.h>
14475 #include <stdio.h>
14476 int main() {
14477   $quadtype q = 12345678901;
14478   printf("%qd\n", q);
14479 }
14480 EOCP
14481         set try
14482         if eval $compile; then
14483                 yyy=`$run ./try`
14484                 case "$yyy" in
14485                 12345678901)
14486                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14487                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14488                         echo "We will use %qd."
14489                         ;;
14490                 esac
14491         fi
14492 fi
14493
14494 if $test X"$sPRId64" = X; then
14495         echo "Cannot figure out how to print 64-bit integers." >&4
14496 fi
14497
14498 $rm -f try try.*
14499
14500 fi
14501
14502 case "$sPRId64" in
14503 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14504         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14505         ;;
14506 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14507         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14508         ;;
14509 esac
14510
14511
14512 echo " "
14513 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14514
14515 if $test X"$ivsize" = X8; then
14516         ivdformat="$sPRId64"
14517         uvuformat="$sPRIu64"
14518         uvoformat="$sPRIo64"
14519         uvxformat="$sPRIx64"
14520         uvXUformat="$sPRIXU64"
14521 else
14522         if $test X"$ivsize" = X"$longsize"; then
14523                 ivdformat='"ld"'
14524                 uvuformat='"lu"'
14525                 uvoformat='"lo"'
14526                 uvxformat='"lx"'
14527                 uvXUformat='"lX"'
14528         else
14529                 if $test X"$ivsize" = X"$intsize"; then
14530                         ivdformat='"d"'
14531                         uvuformat='"u"'
14532                         uvoformat='"o"'
14533                         uvxformat='"x"'
14534                         uvXUformat='"X"'
14535                 else
14536                         : far out
14537                         if $test X"$ivsize" = X"$shortsize"; then
14538                                 ivdformat='"hd"'
14539                                 uvuformat='"hu"'
14540                                 uvoformat='"ho"'
14541                                 uvxformat='"hx"'
14542                                 uvXUformat='"hX"'
14543                         fi
14544                 fi
14545         fi
14546 fi
14547
14548 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14549         nveformat="$sPRIeldbl"
14550         nvfformat="$sPRIfldbl"
14551         nvgformat="$sPRIgldbl"
14552         nvEUformat="$sPRIEUldbl"
14553         nvFUformat="$sPRIFUldbl"
14554         nvGUformat="$sPRIGUldbl"
14555 else
14556         nveformat='"e"'
14557         nvfformat='"f"'
14558         nvgformat='"g"'
14559         nvEUformat='"E"'
14560         nvFUformat='"F"'
14561         nvGUformat='"G"'
14562 fi
14563
14564 case "$ivdformat" in
14565 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14566     exit 1
14567     ;;
14568 esac
14569
14570
14571 echo " "
14572 $echo "Checking the format string to be used for gids..." >&4
14573
14574 case "$gidsign" in
14575 -1)     if $test X"$gidsize" = X"$ivsize"; then
14576                 gidformat="$ivdformat"
14577         else
14578                 if $test X"$gidsize" = X"$longsize"; then
14579                         gidformat='"ld"'
14580                 else
14581                         if $test X"$gidsize" = X"$intsize"; then
14582                                 gidformat='"d"'
14583                         else
14584                                 if $test X"$gidsize" = X"$shortsize"; then
14585                                         gidformat='"hd"'
14586                                 fi
14587                         fi
14588                 fi
14589         fi
14590         ;;
14591 *)      if $test X"$gidsize" = X"$uvsize"; then
14592                 gidformat="$uvuformat"
14593         else
14594                 if $test X"$gidsize" = X"$longsize"; then
14595                         gidformat='"lu"'
14596                 else
14597                         if $test X"$gidsize" = X"$intsize"; then
14598                                 gidformat='"u"'
14599                         else
14600                                 if $test X"$gidsize" = X"$shortsize"; then
14601                                         gidformat='"hu"'
14602                                 fi
14603                         fi
14604                 fi
14605         fi
14606         ;;
14607 esac
14608
14609 : see if getgroups exists
14610 set getgroups d_getgrps
14611 eval $inlibc
14612
14613 : see if setgroups exists
14614 set setgroups d_setgrps
14615 eval $inlibc
14616
14617
14618 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14619 echo " "
14620 case "$d_getgrps$d_setgrps" in
14621 *define*)
14622         case "$groupstype" in
14623         '') dflt="$gidtype" ;;
14624         *)  dflt="$groupstype" ;;
14625         esac
14626         $cat <<EOM
14627 What type of pointer is the second argument to getgroups() and setgroups()?
14628 Usually this is the same as group ids, $gidtype, but not always.
14629
14630 EOM
14631         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14632         . ./myread
14633         groupstype="$ans"
14634         ;;
14635 *)  groupstype="$gidtype";;
14636 esac
14637
14638 echo " "
14639 echo "Checking if your $make program sets \$(MAKE)..." >&4
14640 case "$make_set_make" in
14641 '')
14642         $sed 's/^X //' > testmake.mak << 'EOF'
14643 Xall:
14644 X       @echo 'maketemp="$(MAKE)"'
14645 EOF
14646         case "`$make -f testmake.mak 2>/dev/null`" in
14647         *maketemp=*) make_set_make='#' ;;
14648         *)      make_set_make="MAKE=$make" ;;
14649         esac
14650         $rm -f testmake.mak
14651         ;;
14652 esac
14653 case "$make_set_make" in
14654 '#') echo "Yup, it does.";;
14655 *) echo "Nope, it doesn't.";;
14656 esac
14657
14658 : see what type is used for mode_t
14659 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14660 set mode_t modetype int stdio.h sys/types.h
14661 eval $typedef_ask
14662
14663 : see if stdarg is available
14664 echo " "
14665 if $test `./findhdr stdarg.h`; then
14666         echo "<stdarg.h> found." >&4
14667         valstd="$define"
14668 else
14669         echo "<stdarg.h> NOT found." >&4
14670         valstd="$undef"
14671 fi
14672
14673 : see if varags is available
14674 echo " "
14675 if $test `./findhdr varargs.h`; then
14676         echo "<varargs.h> found." >&4
14677 else
14678         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14679 fi
14680
14681 : set up the varargs testing programs
14682 $cat > varargs.c <<EOP
14683 #ifdef I_STDARG
14684 #include <stdarg.h>
14685 #endif
14686 #ifdef I_VARARGS
14687 #include <varargs.h>
14688 #endif
14689
14690 #ifdef I_STDARG
14691 int f(char *p, ...)
14692 #else
14693 int f(va_alist)
14694 va_dcl
14695 #endif
14696 {
14697         va_list ap;
14698 #ifndef I_STDARG
14699         char *p;
14700 #endif
14701 #ifdef I_STDARG
14702         va_start(ap,p);
14703 #else
14704         va_start(ap);
14705         p = va_arg(ap, char *);
14706 #endif
14707         va_end(ap);
14708 }
14709 EOP
14710 $cat > varargs <<EOP
14711 $startsh
14712 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14713         echo "true"
14714 else
14715         echo "false"
14716 fi
14717 $rm -f varargs$_o
14718 EOP
14719 chmod +x varargs
14720
14721 : now check which varargs header should be included
14722 echo " "
14723 i_varhdr=''
14724 case "$valstd" in
14725 "$define")
14726         if `./varargs I_STDARG`; then
14727                 val='stdarg.h'
14728         elif `./varargs I_VARARGS`; then
14729                 val='varargs.h'
14730         fi
14731         ;;
14732 *)
14733         if `./varargs I_VARARGS`; then
14734                 val='varargs.h'
14735         fi
14736         ;;
14737 esac
14738 case "$val" in
14739 '')
14740 echo "I could not find the definition for va_dcl... You have problems..." >&4
14741         val="$undef"; set i_stdarg; eval $setvar
14742         val="$undef"; set i_varargs; eval $setvar
14743         ;;
14744 *) 
14745         set i_varhdr
14746         eval $setvar
14747         case "$i_varhdr" in
14748         stdarg.h)
14749                 val="$define"; set i_stdarg; eval $setvar
14750                 val="$undef"; set i_varargs; eval $setvar
14751                 ;;
14752         varargs.h)
14753                 val="$undef"; set i_stdarg; eval $setvar
14754                 val="$define"; set i_varargs; eval $setvar
14755                 ;;
14756         esac
14757         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14758 esac
14759 $rm -f varargs*
14760
14761 : see if we need va_copy
14762 echo " "
14763 case "$i_stdarg" in
14764 "$define")
14765         $cat >try.c <<EOCP
14766 #include <stdarg.h>
14767 #include <stdio.h>
14768 #$i_stdlib I_STDLIB
14769 #ifdef I_STDLIB
14770 #include <stdlib.h>
14771 #endif
14772 #include <signal.h>
14773
14774 int
14775 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14776 {
14777   return vfprintf(f, fmt, *valp);
14778 }
14779  
14780 int    
14781 myvfprintf(FILE *f, const  char *fmt, va_list val)
14782 {
14783   return ivfprintf(f, fmt, &val);
14784 }
14785       
14786 int
14787 myprintf(char *fmt, ...) 
14788 {
14789   va_list val;
14790   va_start(val, fmt);
14791   return myvfprintf(stdout, fmt, val); 
14792 }         
14793
14794 int
14795 main(int ac, char **av)
14796 {
14797   signal(SIGSEGV, exit);
14798
14799   myprintf("%s%cs all right, then\n", "that", '\'');                            
14800   exit(0);      
14801 }
14802 EOCP
14803         set try
14804         if eval $compile && $run ./try 2>&1 >/dev/null; then
14805                 case "`$run ./try`" in
14806                 "that's all right, then")
14807                         okay=yes
14808                         ;;
14809                 esac
14810         fi
14811         case "$okay" in
14812         yes)    echo "It seems that you don't need va_copy()." >&4
14813                 need_va_copy="$undef"
14814                 ;;
14815         *)      echo "It seems that va_copy() or similar will be needed." >&4
14816                 need_va_copy="$define"
14817                 ;;
14818         esac
14819         $rm -f try.* core core.* *.core *.core.*
14820         ;;
14821 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14822         ;;
14823 esac
14824
14825 : define a fucntion to check prototypes
14826 $cat > protochk <<EOSH
14827 $startsh
14828 cc="$cc"
14829 optimize="$optimize"
14830 ccflags="$ccflags"
14831 prototype="$prototype"
14832 define="$define"
14833 rm=$rm
14834 EOSH
14835
14836 $cat >> protochk <<'EOSH'
14837
14838 $rm -f try.c
14839 foo="$1"
14840 shift
14841 while test $# -ge 2; do
14842         case "$1" in
14843                 $define) echo "#include <$2>" >> try.c ;;
14844                 literal) echo "$2" >> try.c ;;
14845         esac
14846     shift 2
14847 done
14848 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14849 cat >> try.c <<'EOCP'
14850 #ifdef CAN_PROTOTYPE
14851 #define _(args) args
14852 #else
14853 #define _(args) ()
14854 #endif
14855 EOCP
14856 echo "$foo" >> try.c
14857 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14858 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14859 status=$?
14860 $rm -f try.[co]
14861 exit $status
14862 EOSH
14863 chmod +x protochk
14864 $eunicefix protochk
14865
14866 : see what type is used for size_t
14867 rp="What is the type used for the length parameter for string functions?"
14868 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14869 eval $typedef_ask
14870
14871 : check for type of arguments to gethostbyaddr. 
14872 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14873         case "$d_gethbyaddr" in
14874         $define)
14875                 $cat <<EOM
14876
14877 Checking to see what type of arguments are accepted by gethostbyaddr().
14878 EOM
14879                 hdrs="$define sys/types.h
14880                         $d_socket sys/socket.h 
14881                         $i_niin netinet/in.h 
14882                         $i_netdb netdb.h
14883                         $i_unistd unistd.h"
14884                 : The first arg can 'char *' or 'void *'
14885                 : The second arg is some of integral type
14886                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14887                         for yyy in size_t long int; do
14888                                 case "$netdb_host_type" in
14889                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14890                                         if ./protochk "$try" $hdrs; then
14891                                                 echo "Your system accepts $xxx for the first arg."
14892                                                 echo "...and $yyy for the second arg."
14893                                                 netdb_host_type="$xxx"
14894                                                 netdb_hlen_type="$yyy"
14895                                         fi
14896                                         ;;
14897                                 esac
14898                         done
14899                 done
14900                 : In case none of those worked, prompt the user.
14901                 case "$netdb_host_type" in
14902                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14903                         dflt='char *'
14904                         . ./myread
14905                         netdb_host_type=$ans
14906                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14907                         dflt="$sizetype"
14908                         . ./myread
14909                         netdb_hlen_type=$ans
14910                         ;;
14911                 esac
14912                 ;;
14913         *)      : no gethostbyaddr, so pick harmless defaults
14914                 netdb_host_type='char *'
14915                 netdb_hlen_type="$sizetype"
14916                 ;;
14917         esac
14918         # Remove the "const" if needed. -- but then we'll have a 
14919         # prototype clash!
14920         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14921 fi
14922
14923 : check for type of argument to gethostbyname. 
14924 if test "X$netdb_name_type" = X ; then
14925         case "$d_gethbyname" in
14926         $define)
14927                 $cat <<EOM
14928
14929 Checking to see what type of argument is accepted by gethostbyname().
14930 EOM
14931                 hdrs="$define sys/types.h
14932                         $d_socket sys/socket.h 
14933                         $i_niin netinet/in.h 
14934                         $i_netdb netdb.h
14935                         $i_unistd unistd.h"
14936                 for xxx in "const char *" "char *"; do
14937                         case "$netdb_name_type" in
14938                         '')     try="extern struct hostent *gethostbyname($xxx);"
14939                                 if ./protochk "$try" $hdrs; then
14940                                         echo "Your system accepts $xxx."
14941                                         netdb_name_type="$xxx"
14942                                 fi
14943                                 ;;
14944                         esac
14945                 done
14946                 : In case none of those worked, prompt the user.
14947                 case "$netdb_name_type" in
14948                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14949                         dflt='char *'
14950                         . ./myread
14951                         netdb_name_type=$ans
14952                         ;;
14953                 esac
14954                 ;;
14955         *)      : no gethostbyname, so pick harmless default
14956                 netdb_name_type='char *'
14957                 ;;
14958         esac
14959 fi
14960
14961 : check for type of 1st argument to getnetbyaddr. 
14962 if test "X$netdb_net_type" = X ; then
14963         case "$d_getnbyaddr" in
14964         $define)
14965                 $cat <<EOM
14966
14967 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14968 EOM
14969                 hdrs="$define sys/types.h
14970                         $d_socket sys/socket.h 
14971                         $i_niin netinet/in.h 
14972                         $i_netdb netdb.h
14973                         $i_unistd unistd.h"
14974                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14975                         case "$netdb_net_type" in
14976                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14977                                 if ./protochk "$try" $hdrs; then
14978                                         echo "Your system accepts $xxx."
14979                                         netdb_net_type="$xxx"
14980                                 fi
14981                                 ;;
14982                         esac
14983                 done
14984                 : In case none of those worked, prompt the user.
14985                 case "$netdb_net_type" in
14986                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14987                         dflt='long'
14988                         . ./myread
14989                         netdb_net_type=$ans
14990                         ;;
14991                 esac
14992                 ;;
14993         *)      : no getnetbyaddr, so pick harmless default
14994                 netdb_net_type='long'
14995                 ;;
14996         esac
14997 fi
14998 : locate the preferred pager for this system
14999 case "$pager" in
15000 '')
15001         dflt=''
15002         case "$pg" in
15003         /*) dflt=$pg;;
15004         [a-zA-Z]:/*) dflt=$pg;;
15005         esac
15006         case "$more" in
15007         /*) dflt=$more;;
15008         [a-zA-Z]:/*) dflt=$more;;
15009         esac
15010         case "$less" in
15011         /*) dflt=$less;;
15012         [a-zA-Z]:/*) dflt=$less;;
15013         esac
15014         case "$dflt" in
15015         '') dflt=/usr/ucb/more;;
15016         esac
15017         ;;
15018 *) dflt="$pager";;
15019 esac
15020 echo " "
15021 fn=f/
15022 rp='What pager is used on your system?'
15023 . ./getfile
15024 pager="$ans"
15025
15026 : see what type pids are declared as in the kernel
15027 rp="What is the type of process ids on this system?"
15028 set pid_t pidtype int stdio.h sys/types.h
15029 eval $typedef_ask
15030
15031 : Find earliest binary compatible site_perl subdirectory perl can use.
15032 case "$bincompat5005" in
15033 "$define") xs_apiversion='5.005' ;;
15034 *) xs_apiversion=$version ;;   # The current site_perl version.
15035 esac
15036 : Find earliest pure perl site_perl subdirectory perl can use.
15037 : The versioned directories started at 5.005.
15038 pm_apiversion='5.005'
15039
15040 : see if ar generates random libraries by itself
15041 echo " "
15042 echo "Checking how to generate random libraries on your machine..." >&4
15043 echo 'int bar1() { return bar2(); }' > bar1.c
15044 echo 'int bar2() { return 2; }' > bar2.c
15045 $cat > foo.c <<'EOP'
15046 int main() { printf("%d\n", bar1()); exit(0); }
15047 EOP
15048 $cc $ccflags -c bar1.c >/dev/null 2>&1
15049 $cc $ccflags -c bar2.c >/dev/null 2>&1
15050 $cc $ccflags -c foo.c >/dev/null 2>&1
15051 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
15052 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15053         $run ./foobar >/dev/null 2>&1; then
15054         echo "$ar appears to generate random libraries itself."
15055         orderlib=false
15056         ranlib=":"
15057 elif $ar ts bar$_a >/dev/null 2>&1 &&
15058         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15059         $run ./foobar >/dev/null 2>&1; then
15060                 echo "a table of contents needs to be added with '$ar ts'."
15061                 orderlib=false
15062                 ranlib="$ar ts"
15063 else
15064         case "$ranlib" in
15065         :) ranlib='';;
15066         '')
15067                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
15068                 $test -f $ranlib || ranlib=''
15069                 ;;
15070         esac
15071         if $test -n "$ranlib"; then
15072                 echo "your system has '$ranlib'; we'll use that."
15073                 orderlib=false
15074         else
15075                 echo "your system doesn't seem to support random libraries"
15076                 echo "so we'll use lorder and tsort to order the libraries."
15077                 orderlib=true
15078                 ranlib=":"
15079         fi
15080 fi
15081 $rm -f foo* bar* 
15082
15083 : check for type of arguments to select. 
15084 case "$selecttype" in
15085 '') case "$d_select" in
15086         $define)
15087                 echo " "
15088                 $cat <<EOM
15089 Checking to see what type of arguments are accepted by select().
15090 EOM
15091                 hdrs="$define sys/types.h
15092                         $i_systime sys/time.h 
15093                         $i_sysselct sys/select.h
15094                         $d_socket sys/socket.h"
15095                 : The first arg can be int, unsigned, or size_t
15096                 : The last arg may or may not be 'const'
15097                 val=''
15098                 : void pointer has been seen but using that
15099                 : breaks the selectminbits test
15100                 for xxx in 'fd_set *' 'int *'; do
15101                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
15102                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
15103                                         case "$val" in
15104                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
15105                                                 if ./protochk "$try" $hdrs; then
15106                                                         echo "Your system accepts $xxx."
15107                                                         val="$xxx"
15108                                                 fi
15109                                                 ;;
15110                                         esac
15111                                 done
15112                         done
15113                 done
15114                 case "$val" in
15115                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
15116                         case "$d_fd_set" in
15117                                 $define) dflt="fd_set *" ;;
15118                                 *)              dflt="int *" ;;
15119                         esac
15120                         . ./myread
15121                         val=$ans
15122                         ;;
15123                 esac
15124                 selecttype="$val"
15125                 ;;
15126         *)      : no select, so pick a harmless default
15127                 selecttype='int *'
15128                 ;;
15129         esac
15130         ;;
15131 esac
15132
15133 : check for the select 'width'
15134 case "$selectminbits" in
15135 '') case "$d_select" in
15136         $define)
15137                 $cat <<EOM
15138
15139 Checking to see on how many bits at a time your select() operates...
15140 EOM
15141                 $cat >try.c <<EOCP
15142 #include <sys/types.h>
15143 #$i_time I_TIME
15144 #$i_systime I_SYS_TIME
15145 #$i_systimek I_SYS_TIME_KERNEL
15146 #ifdef I_TIME
15147 #   include <time.h>
15148 #endif
15149 #ifdef I_SYS_TIME
15150 #   ifdef I_SYS_TIME_KERNEL
15151 #       define KERNEL
15152 #   endif
15153 #   include <sys/time.h>
15154 #   ifdef I_SYS_TIME_KERNEL
15155 #       undef KERNEL
15156 #   endif
15157 #endif
15158 #$i_sysselct I_SYS_SELECT
15159 #ifdef I_SYS_SELECT
15160 #include <sys/select.h>
15161 #endif
15162 #$d_socket HAS_SOCKET
15163 #ifdef HAS_SOCKET
15164 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15165 #endif
15166 #include <stdio.h>
15167 $selecttype b;
15168 #define S sizeof(*(b))
15169 #define MINBITS 64
15170 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15171 #define NBITS  (NBYTES * 8)
15172 int main() {
15173     char s[NBYTES];
15174     struct timeval t;
15175     int i;
15176     FILE* fp;
15177     int fd;
15178
15179     fclose(stdin);
15180     fp = fopen("try.c", "r");
15181     if (fp == 0)
15182       exit(1);
15183     fd = fileno(fp);
15184     if (fd < 0)
15185       exit(2);
15186     b = ($selecttype)s;
15187     for (i = 0; i < NBITS; i++)
15188         FD_SET(i, b);
15189     t.tv_sec  = 0;
15190     t.tv_usec = 0;
15191     select(fd + 1, b, 0, 0, &t);
15192     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15193     printf("%d\n", i + 1);
15194     return 0;
15195 }
15196 EOCP
15197                 set try
15198                 if eval $compile_ok; then
15199                         selectminbits=`$run ./try`
15200                         case "$selectminbits" in
15201                         '')     cat >&4 <<EOM
15202 Cannot figure out on how many bits at a time your select() operates.
15203 I'll play safe and guess it is 32 bits.
15204 EOM
15205                                 selectminbits=32
15206                                 bits="32 bits"
15207                                 ;;
15208                         1)      bits="1 bit" ;;
15209                         *)      bits="$selectminbits bits" ;;
15210                         esac
15211                         echo "Your select() operates on $bits at a time." >&4
15212                 else
15213                         rp='What is the minimum number of bits your select() operates on?'
15214                         case "$byteorder" in
15215                         1234|12345678)  dflt=32 ;;
15216                         *)              dflt=1  ;;
15217                         esac
15218                         . ./myread
15219                         val=$ans
15220                         selectminbits="$val"
15221                 fi
15222                 $rm -f try.* try
15223                 ;;
15224         *)      : no select, so pick a harmless default
15225                 selectminbits='32'
15226                 ;;
15227         esac
15228         ;;
15229 esac
15230
15231 : Trace out the files included by signal.h, then look for SIGxxx names.
15232 : Remove SIGARRAYSIZE used by HPUX.
15233 : Remove SIGSTKSIZE used by Linux.
15234 : Remove SIGSTKSZ used by Posix.
15235 : Remove SIGTYP void lines used by OS2.
15236 : Some cpps, like os390, dont give the file name anywhere
15237 if [ "X$fieldn" = X ]; then
15238         : Just make some guesses.  We check them later.
15239         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15240 else
15241         xxx=`echo '#include <signal.h>' |
15242         $cppstdin $cppminus $cppflags 2>/dev/null |
15243         $grep '^[       ]*#.*include' | 
15244         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15245 fi
15246 : Check this list of files to be sure we have parsed the cpp output ok.
15247 : This will also avoid potentially non-existent files, such 
15248 : as ../foo/bar.h
15249 xxxfiles=''
15250 for xx in $xxx /dev/null ; do
15251         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15252 done
15253 : If we have found no files, at least try signal.h
15254 case "$xxxfiles" in
15255 '')     xxxfiles=`./findhdr signal.h` ;;
15256 esac
15257 xxx=`awk '
15258 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15259         print substr($2, 4, 20)
15260 }
15261 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15262         print substr($3, 4, 20)
15263 }' $xxxfiles`
15264 : Append some common names just in case the awk scan failed.
15265 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15266 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15267 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15268 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15269 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15270
15271 : generate a few handy files for later
15272 $cat > signal.c <<'EOCP'
15273 #include <sys/types.h>
15274 #include <signal.h>
15275 #include <stdio.h>
15276 int main() {
15277
15278 /* Strange style to avoid deeply-nested #if/#else/#endif */
15279 #ifndef NSIG
15280 #  ifdef _NSIG
15281 #    define NSIG (_NSIG)
15282 #  endif
15283 #endif
15284
15285 #ifndef NSIG
15286 #  ifdef SIGMAX
15287 #    define NSIG (SIGMAX+1)
15288 #  endif
15289 #endif
15290
15291 #ifndef NSIG
15292 #  ifdef SIG_MAX
15293 #    define NSIG (SIG_MAX+1)
15294 #  endif
15295 #endif
15296
15297 #ifndef NSIG
15298 #  ifdef MAXSIG
15299 #    define NSIG (MAXSIG+1)
15300 #  endif
15301 #endif
15302
15303 #ifndef NSIG
15304 #  ifdef MAX_SIG
15305 #    define NSIG (MAX_SIG+1)
15306 #  endif
15307 #endif
15308
15309 #ifndef NSIG
15310 #  ifdef SIGARRAYSIZE
15311 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15312 #  endif
15313 #endif
15314
15315 #ifndef NSIG
15316 #  ifdef _sys_nsig
15317 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15318 #  endif
15319 #endif
15320
15321 /* Default to some arbitrary number that's big enough to get most
15322    of the common signals.
15323 */
15324 #ifndef NSIG
15325 #    define NSIG 50
15326 #endif
15327
15328 printf("NSIG %d\n", NSIG);
15329
15330 #ifndef JUST_NSIG
15331
15332 EOCP
15333
15334 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15335 {
15336         printf "#ifdef SIG"; printf $1; printf "\n"
15337         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15338         printf $1; printf ");\n"
15339         printf "#endif\n"
15340 }
15341 END {
15342         printf "#endif /* JUST_NSIG */\n";
15343         printf "exit(0);\n}\n";
15344 }
15345 ' >>signal.c
15346 $cat >signal.awk <<'EOP'
15347 BEGIN { ndups = 0 }
15348 $1 ~ /^NSIG$/ { nsig = $2 }
15349 ($1 !~ /^NSIG$/) && (NF == 2) {
15350     if ($2 > maxsig) { maxsig = $2 }
15351     if (sig_name[$2]) {
15352         dup_name[ndups] = $1
15353         dup_num[ndups] = $2
15354         ndups++ 
15355     }
15356     else {
15357         sig_name[$2] = $1
15358         sig_num[$2] = $2
15359     }
15360 }
15361 END { 
15362     if (nsig == 0) {
15363         nsig = maxsig + 1
15364     }
15365     printf("NSIG %d\n", nsig);
15366     for (n = 1; n < nsig; n++) {
15367         if (sig_name[n]) {
15368             printf("%s %d\n", sig_name[n], sig_num[n])
15369         }
15370         else {
15371             printf("NUM%d %d\n", n, n) 
15372         }
15373     }
15374     for (n = 0; n < ndups; n++) {
15375         printf("%s %d\n", dup_name[n], dup_num[n])
15376     }
15377 }
15378 EOP
15379 $cat >signal_cmd <<EOS
15380 $startsh
15381 if $test -s signal.lst; then
15382     echo "Using your existing signal.lst file"
15383         exit 0
15384 fi
15385 xxx="$xxx"
15386 EOS
15387 $cat >>signal_cmd <<'EOS'
15388
15389 set signal
15390 if eval $compile_ok; then
15391         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15392 else
15393         echo "(I can't seem be able to compile the whole test program)" >&4
15394         echo "(I'll try it in little pieces.)" >&4
15395         set signal -DJUST_NSIG
15396         if eval $compile_ok; then
15397                 $run ./signal$_exe > signal.nsg
15398                 $cat signal.nsg
15399         else
15400                 echo "I can't seem to figure out how many signals you have." >&4
15401                 echo "Guessing 50." >&4
15402                 echo 'NSIG 50' > signal.nsg
15403         fi
15404         : Now look at all the signal names, one at a time.
15405         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15406                 $cat > signal.c <<EOCP
15407 #include <sys/types.h>
15408 #include <signal.h>
15409 #include <stdio.h>
15410 int main() {
15411 printf("$xx %d\n", SIG${xx});
15412 return 0;
15413 }
15414 EOCP
15415                 set signal
15416                 if eval $compile; then
15417                         echo "SIG${xx} found."
15418                         $run ./signal$_exe  >> signal.ls1
15419                 else
15420                         echo "SIG${xx} NOT found."
15421                 fi
15422         done
15423         if $test -s signal.ls1; then
15424                 $cat signal.nsg signal.ls1 |
15425                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15426         fi
15427
15428 fi
15429 if $test -s signal.lst; then
15430         :
15431 else
15432         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15433         echo 'kill -l' >signal
15434         set X `csh -f <signal`
15435         $rm -f signal
15436         shift
15437         case $# in
15438         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15439         esac
15440         echo $@ | $tr ' ' $trnl | \
15441             $awk '{ printf "%s %d\n", $1, ++s; }
15442                   END { printf "NSIG %d\n", ++s }' >signal.lst
15443 fi
15444 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15445 EOS
15446 chmod a+x signal_cmd
15447 $eunicefix signal_cmd
15448
15449 : generate list of signal names
15450 echo " "
15451 case "$sig_name_init" in
15452 '') doinit=yes ;;
15453 *)  case "$sig_num_init" in
15454     ''|*,*) doinit=yes ;;
15455     esac ;;
15456 esac
15457 case "$doinit" in
15458 yes)
15459         echo "Generating a list of signal names and numbers..." >&4
15460         . ./signal_cmd
15461         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15462         sig_name=`$awk 'BEGIN { printf "ZERO " }
15463                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15464         sig_num=`$awk  'BEGIN { printf "0 " }
15465                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15466         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15467                              !/^NSIG/   { printf "\"%s\", ", $1 }
15468                              END        { printf "0\n" }' signal.lst`
15469         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15470                              !/^NSIG/   { printf "%d, ", $2}
15471                              END        { printf "0\n"}' signal.lst`
15472         ;;
15473 esac
15474 echo "The following $sig_count signals are available:"
15475 echo " "
15476 echo $sig_name | $awk \
15477 'BEGIN { linelen = 0 }
15478 {
15479         for (i = 1; i <= NF; i++) {
15480                 name = "SIG" $i " "
15481                 linelen = linelen + length(name)
15482                 if (linelen > 70) {
15483                         printf "\n"
15484                         linelen = length(name)
15485                 }
15486                 printf "%s", name
15487         }
15488         printf "\n"
15489 }'
15490 sig_size=`echo $sig_name | awk '{print NF}'`
15491 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15492
15493 echo " "
15494 case "$sizetype" in
15495 *_t) zzz="$sizetype"    ;;
15496 *)   zzz="filesize"     ;;
15497 esac
15498 echo "Checking the size of $zzz..." >&4 
15499 cat > try.c <<EOCP
15500 #include <sys/types.h>
15501 #include <stdio.h>
15502 int main() {
15503     printf("%d\n", (int)sizeof($sizetype));
15504     exit(0);
15505 }
15506 EOCP
15507 set try
15508 if eval $compile_ok; then
15509         yyy=`$run ./try`
15510         case "$yyy" in
15511         '')     sizesize=4
15512                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15513                 ;;
15514         *)      sizesize=$yyy
15515                 echo "Your $zzz size is $sizesize bytes."
15516                 ;;
15517         esac
15518 else
15519         sizesize=4
15520         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15521 fi
15522
15523
15524 : check for socklen_t
15525 echo " "
15526 echo "Checking to see if you have socklen_t..." >&4
15527 $cat >try.c <<EOCP
15528 #include <sys/types.h>
15529 #$d_socket HAS_SOCKET
15530 #ifdef HAS_SOCKET
15531 #include <sys/socket.h>
15532 #endif
15533 int main() { socklen_t x = 16; }
15534 EOCP
15535 set try
15536 if eval $compile; then
15537         val="$define"
15538         echo "You have socklen_t."
15539 else
15540         val="$undef"
15541         echo "You do not have socklen_t."
15542         case "$sizetype" in
15543         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15544         esac
15545 fi
15546 $rm -f try try.*
15547 set d_socklen_t
15548 eval $setvar
15549
15550 : see if this is a socks.h system
15551 set socks.h i_socks
15552 eval $inhdr
15553
15554 : check for type of the size argument to socket calls
15555 case "$d_socket" in
15556 "$define")
15557         $cat <<EOM
15558
15559 Checking to see what type is the last argument of accept().
15560 EOM
15561         yyy=''
15562         case "$d_socklen_t" in
15563         "$define") yyy="$yyy socklen_t"
15564         esac
15565         yyy="$yyy $sizetype int long unsigned"
15566         for xxx in $yyy; do
15567                 case "$socksizetype" in
15568                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15569                         case "$usesocks" in
15570                         "$define")
15571                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15572                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15573                                         socksizetype="$xxx"
15574                                 fi
15575                                 ;;
15576                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15577                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15578                                         socksizetype="$xxx"
15579                                 fi
15580                                 ;;
15581                         esac
15582                         ;;
15583                 esac
15584         done
15585 : In case none of those worked, prompt the user.
15586         case "$socksizetype" in
15587         '')     rp='What is the type for socket address structure sizes?'
15588                 dflt='int'
15589                 . ./myread
15590                 socksizetype=$ans
15591                 ;;
15592         esac
15593         ;;
15594 *)      : no sockets, so pick relatively harmless default
15595         socksizetype='int'
15596         ;;
15597 esac
15598
15599 : see what type is used for signed size_t
15600 set ssize_t ssizetype int stdio.h sys/types.h
15601 eval $typedef
15602 dflt="$ssizetype"
15603 $cat > try.c <<EOM
15604 #include <stdio.h>
15605 #include <sys/types.h>
15606 #define Size_t $sizetype
15607 #define SSize_t $dflt
15608 int main()
15609 {
15610         if (sizeof(Size_t) == sizeof(SSize_t))
15611                 printf("$dflt\n");
15612         else if (sizeof(Size_t) == sizeof(int))
15613                 printf("int\n");
15614         else 
15615                 printf("long\n");
15616         exit(0);
15617 }
15618 EOM
15619 echo " "
15620 set try
15621 if eval $compile_ok && $run ./try > /dev/null; then
15622         ssizetype=`$run ./try`
15623         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15624 else
15625         $cat >&4 <<EOM
15626 Help! I can't compile and run the ssize_t test program: please enlighten me!
15627 (This is probably a misconfiguration in your system or libraries, and
15628 you really ought to fix it.  Still, I'll try anyway.)
15629
15630 I need a type that is the same size as $sizetype, but is guaranteed to
15631 be signed.  Common values are ssize_t, int and long.
15632
15633 EOM
15634         rp="What signed type is the same size as $sizetype?"
15635         . ./myread
15636         ssizetype="$ans"
15637 fi
15638 $rm -f try try.*
15639
15640 : see what type of char stdio uses.
15641 echo " "
15642 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15643 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15644         echo "Your stdio uses unsigned chars." >&4
15645         stdchar="unsigned char"
15646 else
15647         echo "Your stdio uses signed chars." >&4
15648         stdchar="char"
15649 fi
15650 $rm -f stdioh
15651
15652
15653
15654 : see if time exists
15655 echo " "
15656 if test "X$d_time" = X -o X"$timetype" = X; then
15657     if set time val -f d_time; eval $csym; $val; then
15658                 echo 'time() found.' >&4
15659                 val="$define"
15660                 rp="What is the type returned by time() on this system?"
15661                 set time_t timetype long stdio.h sys/types.h
15662                 eval $typedef_ask
15663     else
15664                 echo 'time() not found, hope that will do.' >&4
15665                 val="$undef"
15666                 timetype='int';
15667     fi
15668     set d_time
15669     eval $setvar
15670 fi
15671
15672 : see what type uids are declared as in the kernel
15673 echo " "
15674 echo "Looking for the type for user ids returned by getuid()."
15675 set uid_t uidtype xxx stdio.h sys/types.h
15676 eval $typedef
15677 case "$uidtype" in
15678 xxx)
15679         xxx=`./findhdr sys/user.h`
15680         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15681         case $1 in
15682         unsigned) dflt="$1 $2" ;;
15683         *) dflt="$1" ;;
15684         esac
15685         ;;
15686 *) dflt="$uidtype";;
15687 esac
15688 case "$uidtype" in
15689 uid_t)  echo "uid_t found." ;;
15690 *)      rp="What is the type for user ids returned by getuid()?"
15691         . ./myread
15692         uidtype="$ans"
15693         ;;
15694 esac
15695
15696 echo " "
15697 case "$uidtype" in
15698 *_t) zzz="$uidtype"     ;;
15699 *)   zzz="uid"          ;;
15700 esac
15701 echo "Checking the size of $zzz..." >&4 
15702 cat > try.c <<EOCP
15703 #include <sys/types.h>
15704 #include <stdio.h>
15705 int main() {
15706     printf("%d\n", (int)sizeof($uidtype));
15707     exit(0);
15708 }
15709 EOCP
15710 set try
15711 if eval $compile_ok; then
15712         yyy=`$run ./try`
15713         case "$yyy" in
15714         '')     uidsize=4
15715                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15716                 ;;
15717         *)      uidsize=$yyy
15718                 echo "Your $zzz is $uidsize bytes long."
15719                 ;;
15720         esac
15721 else
15722         uidsize=4
15723         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15724 fi
15725
15726 echo " "
15727 case "$uidtype" in
15728 *_t) zzz="$uidtype"     ;;
15729 *)   zzz="uid"          ;;
15730 esac
15731 echo "Checking the sign of $zzz..." >&4
15732 cat > try.c <<EOCP
15733 #include <sys/types.h>
15734 #include <stdio.h>
15735 int main() {
15736         $uidtype foo = -1;
15737         if (foo < 0)
15738                 printf("-1\n");
15739         else
15740                 printf("1\n");
15741 }
15742 EOCP
15743 set try
15744 if eval $compile; then
15745         yyy=`$run ./try`
15746         case "$yyy" in
15747         '')     uidsign=1
15748                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15749                 ;;
15750         *)      uidsign=$yyy
15751                 case "$uidsign" in
15752                  1) echo "Your $zzz is unsigned." ;;
15753                 -1) echo "Your $zzz is signed."   ;;
15754                 esac
15755                 ;;
15756         esac
15757 else
15758         uidsign=1
15759         echo "(I can't compile the test program--guessing unsigned.)" >&4
15760 fi
15761
15762
15763
15764 echo " "
15765 $echo "Checking the format string to be used for uids..." >&4
15766
15767 case "$uidsign" in
15768 -1)     if $test X"$uidsize" = X"$ivsize"; then
15769                 uidformat="$ivdformat"
15770         else
15771                 if $test X"$uidsize" = X"$longsize"; then
15772                         uidformat='"ld"'
15773                 else
15774                         if $test X"$uidsize" = X"$intsize"; then
15775                                 uidformat='"d"'
15776                         else
15777                                 if $test X"$uidsize" = X"$shortsize"; then
15778                                         uidformat='"hd"'
15779                                 fi
15780                         fi
15781                 fi
15782         fi
15783         ;;
15784 *)      if $test X"$uidsize" = X"$uvsize"; then
15785                 uidformat="$uvuformat"
15786         else
15787                 if $test X"$uidsize" = X"$longsize"; then
15788                         uidformat='"lu"'
15789                 else
15790                         if $test X"$uidsize" = X"$intsize"; then
15791                                 uidformat='"u"'
15792                         else
15793                                 if $test X"$uidsize" = X"$shortsize"; then
15794                                         uidformat='"hu"'
15795                                 fi
15796                         fi
15797                 fi
15798         fi
15799         ;;
15800 esac
15801
15802 : determine compiler compiler
15803 case "$yacc" in
15804 '')
15805         dflt=yacc;;
15806 *)
15807         dflt="$yacc";;
15808 esac
15809 echo " "
15810 comp='yacc'
15811 if $test -f "$byacc"; then
15812         dflt="$byacc"
15813         comp="byacc or $comp"
15814 fi
15815 if $test -f "$bison"; then
15816         comp="$comp or bison -y"
15817 fi
15818 rp="Which compiler compiler ($comp) shall I use?"
15819 . ./myread
15820 yacc="$ans"
15821 case "$yacc" in
15822 *bis*)
15823         case "$yacc" in
15824         *-y*) ;;
15825         *)
15826                 yacc="$yacc -y"
15827                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15828                 ;;
15829         esac
15830         ;;
15831 esac
15832
15833 : see if fcntl.h is there
15834 val=''
15835 set fcntl.h val
15836 eval $inhdr
15837
15838 : see if we can include fcntl.h
15839 case "$val" in
15840 "$define")
15841         echo " "
15842         if $h_fcntl; then
15843                 val="$define"
15844                 echo "We'll be including <fcntl.h>." >&4
15845         else
15846                 val="$undef"
15847                 if $h_sysfile; then
15848         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15849                 else
15850                         echo "We won't be including <fcntl.h>." >&4
15851                 fi
15852         fi
15853         ;;
15854 *)
15855         h_fcntl=false
15856         val="$undef"
15857         ;;
15858 esac
15859 set i_fcntl
15860 eval $setvar
15861
15862 : see if this is a fp.h system
15863 set fp.h i_fp
15864 eval $inhdr
15865
15866 : see if this is a fp_class.h system
15867 set fp_class.h i_fp_class
15868 eval $inhdr
15869
15870 : see if this is a ieeefp.h system
15871 set ieeefp.h i_ieeefp
15872 eval $inhdr
15873
15874 : see if this is a libutil.h system
15875 set libutil.h i_libutil
15876 eval $inhdr
15877
15878 : see if locale.h is available
15879 set locale.h i_locale
15880 eval $inhdr
15881
15882 : see if mach cthreads are available
15883 if test "X$usethreads" = "X$define"; then
15884         set mach/cthreads.h i_machcthr
15885         eval $inhdr
15886 else
15887         i_machcthr="$undef"
15888 fi
15889
15890
15891
15892 : see if this is a math.h system
15893 set math.h i_math
15894 eval $inhdr
15895
15896 : see if this is a mntent.h system
15897 set mntent.h i_mntent
15898 eval $inhdr
15899
15900 : see if ndbm.h is available
15901 set ndbm.h t_ndbm
15902 eval $inhdr
15903 case "$t_ndbm" in
15904 $define)
15905         : see if dbm_open exists
15906         set dbm_open d_dbm_open
15907         eval $inlibc
15908         case "$d_dbm_open" in
15909         $undef)
15910                 t_ndbm="$undef"
15911                 echo "We won't be including <ndbm.h>"
15912                 ;;
15913         esac
15914         ;;
15915 esac
15916 val="$t_ndbm"
15917 set i_ndbm
15918 eval $setvar
15919
15920 : see if net/errno.h is available
15921 val=''
15922 set net/errno.h val
15923 eval $inhdr
15924
15925 : Unfortunately, it causes problems on some systems.  Arrgh.
15926 case "$val" in
15927 $define)
15928         cat > try.c <<'EOM'
15929 #include <stdio.h>
15930 #include <errno.h>
15931 #include <net/errno.h>
15932 int func()
15933 {
15934         return ENOTSOCK;
15935 }
15936 EOM
15937         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15938                 echo "We'll be including <net/errno.h>." >&4
15939         else
15940                 echo "We won't be including <net/errno.h>." >&4
15941                 val="$undef"
15942         fi
15943         $rm -f try.* try
15944         ;;
15945 esac
15946 set i_neterrno
15947 eval $setvar
15948
15949 : see if netinet/tcp.h is available
15950 set netinet/tcp.h i_netinettcp
15951 eval $inhdr
15952
15953 : see if this is a poll.h system
15954 set poll.h i_poll
15955 eval $inhdr
15956
15957 : see if this is a prot.h system
15958 set prot.h i_prot
15959 eval $inhdr
15960
15961 echo " "
15962 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15963 $cat <<'EOSH' > Cppsym.know
15964 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15965 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15966 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15967 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15968 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15969 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15970 bull c cadmus clipper CMU COFF COMPILER_VERSION
15971 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15972 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15973 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
15974 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15975 GLIBC GLIBC_MINOR
15976 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
15977 H3050R H3050RX hbullx20 hcx host_mips
15978 hp200 hp300 hp700 HP700 hp800 hp9000
15979 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15980 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15981 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15982 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15983 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15984 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15985 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15986 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15987 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15988 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15989 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15990 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15991 MATH_HAS_NO_SIDE_EFFECTS
15992 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15993 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15994 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15995 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15996 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15997 NetBSD news1500 news1700 news1800 news1900 news3700
15998 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15999 ns32016 ns32332 ns32k nsc32000
16000 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
16001 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
16002 pc532 pdp11 PGC PIC plexus PORTAR posix
16003 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
16004 POSIX_C_SOURCE POSIX_SOURCE POWER
16005 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
16006 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
16007 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
16008 sony sony_news sonyrisc sparc sparclite spectrum
16009 stardent stdc STDC_EXT stratos sun sun3 sun386
16010 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
16011 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
16012 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
16013 sysV68 sysV88 Tek4132 Tek4300 titan
16014 TM3200 TM5400 TM5600
16015 tower tower32 tower32_200 tower32_600 tower32_700
16016 tower32_800 tower32_850 tss
16017 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
16018 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
16019 unix UNIX95 UNIX99 unixpc unos
16020 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
16021 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
16022 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
16023 USGr4 USGr4_2
16024 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
16025 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
16026 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
16027 z8000
16028 EOSH
16029 # Maybe put other stuff here too.
16030 cat <<EOSH >>Cppsym.know
16031 $osname
16032 EOSH
16033 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
16034 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
16035 $cat Cppsym.know > Cppsym.c
16036 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
16037 $rm -f Cppsym.a Cppsym.b Cppsym.c
16038 cat <<EOSH > Cppsym
16039 $startsh
16040 if $test \$# -gt 0; then
16041     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
16042     if $test -s Cppsym.got; then
16043         $rm -f Cppsym.got
16044         exit 0
16045     fi
16046     $rm -f Cppsym.got
16047     exit 1
16048 else
16049     $tr " " "$trnl" | ./Cppsym.try
16050     exit 0
16051 fi
16052 EOSH
16053 chmod +x Cppsym
16054 $eunicefix Cppsym
16055 cat <<EOSH > Cppsym.try
16056 $startsh
16057 cat <<'EOCP' > try.c
16058 #include <stdio.h>
16059 int main() {
16060 EOCP
16061 $awk \\
16062 EOSH
16063 cat <<'EOSH' >> Cppsym.try
16064 'length($1) > 0 {
16065     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
16066     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
16067     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
16068     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
16069 }'       >> try.c
16070 echo 'return 0;}' >> try.c
16071 EOSH
16072 cat <<EOSH >> Cppsym.try
16073 ccflags="$ccflags"
16074 case "$osname-$gccversion" in
16075 irix-) ccflags="\$ccflags -woff 1178" ;;
16076 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
16077 esac
16078 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
16079 EOSH
16080 chmod +x Cppsym.try
16081 $eunicefix Cppsym.try
16082 ./Cppsym < Cppsym.know > Cppsym.true
16083 : now check the C compiler for additional symbols
16084 postprocess_cc_v=''
16085 case "$osname" in
16086 aix) postprocess_cc_v="|$tr , ' '" ;;
16087 esac
16088 $cat >ccsym <<EOS
16089 $startsh
16090 $cat >tmp.c <<EOF
16091 extern int foo;
16092 EOF
16093 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
16094 do
16095         case "\$i" in
16096         -D*) echo "\$i" | $sed 's/^-D//';;
16097         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
16098         esac
16099 done
16100 $rm -f try.c
16101 EOS
16102 postprocess_cc_v=''
16103 chmod +x ccsym
16104 $eunicefix ccsym
16105 ./ccsym > ccsym1.raw
16106 if $test -s ccsym1.raw; then
16107        $sort ccsym1.raw | $uniq >ccsym.raw
16108 else
16109        mv ccsym1.raw ccsym.raw
16110 fi
16111
16112 $awk '/\=/ { print $0; next }
16113         { print $0"=1" }' ccsym.raw >ccsym.list
16114 $awk '/\=/ { print $0; next }
16115         { print $0"=1" }' Cppsym.true >ccsym.true
16116 $comm -13 ccsym.true ccsym.list >ccsym.own
16117 $comm -12 ccsym.true ccsym.list >ccsym.com
16118 $comm -23 ccsym.true ccsym.list >ccsym.cpp
16119 also=''
16120 if $test -z ccsym.raw; then
16121         echo "Your C compiler doesn't seem to define any symbols!" >&4
16122         echo " "
16123         echo "However, your C preprocessor defines the following symbols:"
16124         $cat Cppsym.true
16125         ccsymbols=''
16126         cppsymbols=`$cat Cppsym.true`
16127         cppsymbols=`echo $cppsymbols`
16128         cppccsymbols="$cppsymbols"
16129 else
16130         if $test -s ccsym.com; then
16131                 echo "Your C compiler and pre-processor define these symbols:"
16132                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
16133                 also='also '
16134                 symbols='ones'
16135                 cppccsymbols=`$cat ccsym.com`
16136                 cppccsymbols=`echo $cppccsymbols`
16137                 $test "$silent" || sleep 1
16138         fi
16139         if $test -s ccsym.cpp; then
16140                 $test "$also" && echo " "
16141                 echo "Your C pre-processor ${also}defines the following symbols:"
16142                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
16143                 also='further '
16144                 cppsymbols=`$cat ccsym.cpp`
16145                 cppsymbols=`echo $cppsymbols`
16146                 $test "$silent" || sleep 1
16147         fi
16148         if $test -s ccsym.own; then
16149                 $test "$also" && echo " "
16150                 echo "Your C compiler ${also}defines the following cpp symbols:"
16151                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
16152                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
16153                 ccsymbols=`$cat ccsym.own`
16154                 ccsymbols=`echo $ccsymbols`
16155                 $test "$silent" || sleep 1
16156         fi
16157 fi
16158
16159 : see if this is a termio system
16160 val="$undef"
16161 val2="$undef"
16162 val3="$undef"
16163 if $test `./findhdr termios.h`; then
16164         set tcsetattr i_termios
16165         eval $inlibc
16166         val3="$i_termios"
16167 fi
16168 echo " "
16169 case "$val3" in
16170 "$define") echo "You have POSIX termios.h... good!" >&4;;
16171 *) if ./Cppsym pyr; then
16172                 case "`/bin/universe`" in
16173                 ucb) if $test `./findhdr sgtty.h`; then
16174                                 val2="$define"
16175                                 echo "<sgtty.h> found." >&4
16176                         else
16177                                 echo "System is pyramid with BSD universe."
16178                                 echo "<sgtty.h> not found--you could have problems." >&4
16179                         fi;;
16180                 *) if $test `./findhdr termio.h`; then
16181                                 val="$define"
16182                                 echo "<termio.h> found." >&4
16183                         else
16184                                 echo "System is pyramid with USG universe."
16185                                 echo "<termio.h> not found--you could have problems." >&4
16186                         fi;;
16187                 esac
16188         elif ./usg; then
16189                 if $test `./findhdr termio.h`; then
16190                         echo "<termio.h> found." >&4
16191                         val="$define"
16192                 elif $test `./findhdr sgtty.h`; then
16193                         echo "<sgtty.h> found." >&4
16194                         val2="$define"
16195                 else
16196 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16197                 fi
16198         else
16199                 if $test `./findhdr sgtty.h`; then
16200                         echo "<sgtty.h> found." >&4
16201                         val2="$define"
16202                 elif $test `./findhdr termio.h`; then
16203                         echo "<termio.h> found." >&4
16204                         val="$define"
16205                 else
16206 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16207                 fi
16208         fi;;
16209 esac
16210 set i_termio; eval $setvar
16211 val=$val2; set i_sgtty; eval $setvar
16212 val=$val3; set i_termios; eval $setvar
16213
16214 : see if this is a shadow.h system
16215 set shadow.h i_shadow
16216 eval $inhdr
16217
16218 : see if stddef is available
16219 set stddef.h i_stddef
16220 eval $inhdr
16221
16222 : see if this is a sunmath.h system
16223 set sunmath.h i_sunmath
16224 eval $inhdr
16225
16226 : see if sys/access.h is available
16227 set sys/access.h i_sysaccess
16228 eval $inhdr
16229
16230 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16231 set sys/filio.h i_sysfilio
16232 eval $inhdr
16233 echo " "
16234 if $test `./findhdr sys/ioctl.h`; then
16235         val="$define"
16236         echo '<sys/ioctl.h> found.' >&4
16237 else
16238         val="$undef"
16239         if $test $i_sysfilio = "$define"; then
16240             echo '<sys/ioctl.h> NOT found.' >&4
16241         else
16242                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16243                 $test $i_termio = "$define" && xxx="termio.h"
16244                 $test $i_termios = "$define" && xxx="termios.h"
16245 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16246         fi
16247 fi
16248 set i_sysioctl
16249 eval $setvar
16250
16251 : see if socket ioctl defs are in sys/sockio.h
16252 echo " "
16253 xxx=`./findhdr sys/sockio.h`
16254 if $test "$xxx"; then
16255         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16256                 val="$define"
16257                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16258         else
16259                 val="$undef"
16260                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16261         fi
16262 else
16263         val="$undef"
16264         $cat <<EOM
16265 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16266 EOM
16267 fi
16268 set i_syssockio
16269 eval $setvar
16270
16271
16272 : see if this is a syslog.h system
16273 set syslog.h i_syslog
16274 eval $inhdr
16275
16276
16277 : see if this is a sys/mode.h system
16278 set sys/mode.h i_sysmode
16279 eval $inhdr
16280
16281 : see if sys/resource.h has to be included
16282 set sys/resource.h i_sysresrc
16283 eval $inhdr
16284
16285 : see if sys/security.h is available
16286 set sys/security.h i_syssecrt
16287 eval $inhdr
16288
16289 : see if this is a sys/statvfs.h system
16290 set sys/statvfs.h i_sysstatvfs
16291 eval $inhdr
16292
16293 : see if this is a sys/un.h system
16294 set sys/un.h i_sysun
16295 eval $inhdr
16296
16297
16298 : see if this is a sys/utsname.h system
16299 set sys/utsname.h i_sysutsname
16300 eval $inhdr
16301
16302 : see if this is a syswait system
16303 set sys/wait.h i_syswait
16304 eval $inhdr
16305
16306 : see if this is a ustat.h system
16307 set ustat.h i_ustat
16308 eval $inhdr
16309
16310 : see if this is an utime system
16311 set utime.h i_utime
16312 eval $inhdr
16313
16314 : see if this is a values.h system
16315 set values.h i_values
16316 eval $inhdr
16317
16318 : see if this is a vfork system
16319 case "$d_vfork" in
16320 "$define")
16321         set vfork.h i_vfork
16322         eval $inhdr
16323         ;;
16324 *)
16325         i_vfork="$undef"
16326         ;;
16327 esac
16328
16329 : see if gdbm.h is available
16330 set gdbm.h t_gdbm
16331 eval $inhdr
16332 case "$t_gdbm" in
16333 $define)
16334         : see if gdbm_open exists
16335         set gdbm_open d_gdbm_open
16336         eval $inlibc
16337         case "$d_gdbm_open" in
16338         $undef)
16339                 t_gdbm="$undef"
16340                 echo "We won't be including <gdbm.h>"
16341                 ;;
16342         esac
16343         ;;
16344 esac
16345 val="$t_gdbm"
16346 set i_gdbm
16347 eval $setvar
16348
16349 echo " "
16350 echo "Looking for extensions..." >&4
16351 : If we are using the old config.sh, known_extensions may contain
16352 : old or inaccurate or duplicate values.
16353 known_extensions=''
16354 nonxs_extensions=''
16355 : We do not use find because it might not be available.
16356 : We do not just use MANIFEST because the user may have dropped
16357 : some additional extensions into the source tree and expect them
16358 : to be built.
16359
16360 : Function to recursively find available extensions, ignoring DynaLoader
16361 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16362 find_extensions='
16363     for xxx in *; do
16364        case "$xxx" in
16365            DynaLoader|dynaload) ;;
16366            *)
16367            if $test -f $xxx/$xxx.xs; then
16368                known_extensions="$known_extensions $1$xxx";
16369            elif $test -f $xxx/Makefile.PL; then
16370                nonxs_extensions="$nonxs_extensions $1$xxx";
16371            else
16372                if $test -d $xxx -a $# -lt 10; then
16373                    set $1$xxx/ $*;
16374                    cd $xxx;
16375                    eval $find_extensions;
16376                    cd ..;
16377                    shift;
16378                fi;
16379            fi
16380            ;;
16381        esac;
16382     done'
16383 tdir=`pwd`
16384 cd $rsrc/ext
16385 set X
16386 shift
16387 eval $find_extensions
16388 # Special case:  Add in threads/shared since it is not picked up by the
16389 # recursive find above (and adding in general recursive finding breaks
16390 # SDBM_File/sdbm).  A.D.  10/25/2001.
16391 known_extensions="$known_extensions threads/shared"
16392 set X $nonxs_extensions
16393 shift
16394 nonxs_extensions="$*"
16395 set X $known_extensions
16396 shift
16397 known_extensions="$*"
16398 cd $tdir
16399
16400 : Now see which are supported on this system.
16401 avail_ext=''
16402 for xxx in $known_extensions ; do
16403         case "$xxx" in
16404         DB_File|db_file)
16405                 case "$i_db" in
16406                 $define) avail_ext="$avail_ext $xxx" ;;
16407                 esac
16408                 ;;
16409         GDBM_File|gdbm_fil)
16410                 case "$i_gdbm" in 
16411                 $define) avail_ext="$avail_ext $xxx" ;;
16412                 esac
16413                 ;;
16414         I18N/Langinfo|i18n_lan)
16415                 case "$i_langinfo$d_nl_langinfo" in 
16416                 $define$define) avail_ext="$avail_ext $xxx" ;;
16417                 esac
16418                 ;;
16419         NDBM_File|ndbm_fil)
16420                 case "$i_ndbm" in
16421                 $define)
16422                     case "$osname-$use64bitint" in
16423                     cygwin-*|hpux-define)
16424                         case "$libs" in
16425                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16426                         esac
16427                         ;;
16428                     *) avail_ext="$avail_ext $xxx" ;;
16429                     esac
16430                     ;;
16431                 esac
16432                 ;;
16433         ODBM_File|odbm_fil) 
16434                 case "${i_dbm}${i_rpcsvcdbm}" in
16435                 *"${define}"*)
16436                     case "$osname-$use64bitint" in
16437                     cygwin-*|hpux-define)
16438                         case "$libs" in
16439                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16440                         esac
16441                         ;;
16442                     *) avail_ext="$avail_ext $xxx" ;;
16443                     esac
16444                     ;;
16445                 esac
16446                 ;;
16447         POSIX|posix)
16448                 case "$useposix" in
16449                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16450                 esac
16451                 ;;
16452         Opcode|opcode)
16453                 case "$useopcode" in
16454                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16455                 esac
16456                 ;;
16457         Socket|socket)
16458                 case "$d_socket" in 
16459                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16460                 esac
16461                 ;;
16462         Sys/Syslog|sys/syslog)
16463                 : XXX syslog requires socket
16464                 case "$d_socket" in 
16465                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16466                 esac
16467                 ;;
16468         Thread|thread)
16469                 case "$usethreads" in
16470                 true|$define|y)
16471                         case "$useithreads" in
16472                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16473                         esac
16474                 esac
16475                 ;;
16476         threads|threads/shared)
16477                 case "$usethreads" in
16478                 true|$define|y)
16479                         case "$useithreads" in
16480                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
16481                         esac
16482                 esac
16483                 ;;
16484         IPC/SysV|ipc/sysv)
16485                 : XXX Do we need a useipcsysv variable here
16486                 case "${d_msg}${d_sem}${d_shm}" in 
16487                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16488                 esac
16489                 ;;
16490         *)      avail_ext="$avail_ext $xxx"
16491                 ;;
16492         esac
16493 done
16494
16495 set X $avail_ext
16496 shift
16497 avail_ext="$*"
16498
16499 : Now see which nonxs extensions are supported on this system.
16500 : For now assume all are.
16501 nonxs_ext=''
16502 for xxx in $nonxs_extensions ; do
16503         case "$xxx" in
16504         *)      nonxs_ext="$nonxs_ext $xxx"
16505                 ;;
16506         esac
16507 done
16508
16509 set X $nonxs_ext
16510 shift
16511 nonxs_ext="$*"
16512
16513 case $usedl in
16514 $define)
16515         $cat <<EOM
16516 A number of extensions are supplied with $package.  You may choose to
16517 compile these extensions for dynamic loading (the default), compile
16518 them into the $package executable (static loading), or not include
16519 them at all.  Answer "none" to include no extensions.
16520 Note that DynaLoader is always built and need not be mentioned here.
16521
16522 EOM
16523         case "$dynamic_ext" in
16524         '') dflt="$avail_ext" ;;
16525         *)      dflt="$dynamic_ext"
16526                 # Perhaps we are reusing an old out-of-date config.sh.
16527                 case "$hint" in
16528                 previous)
16529                         if test X"$dynamic_ext" != X"$avail_ext"; then
16530                                 $cat <<EOM
16531 NOTICE:  Your previous config.sh list may be incorrect. 
16532 The extensions now available to you are 
16533         ${avail_ext}
16534 but the default list from your previous config.sh is
16535         ${dynamic_ext} 
16536
16537 EOM
16538                         fi
16539                         ;;
16540                 esac
16541                 ;;
16542         esac
16543         case "$dflt" in
16544         '')     dflt=none;;
16545         esac
16546         rp="What extensions do you wish to load dynamically?"
16547         . ./myread
16548         case "$ans" in
16549         none) dynamic_ext=' ' ;;
16550         *) dynamic_ext="$ans" ;;
16551         esac
16552
16553         case "$static_ext" in
16554         '')
16555                 : Exclude those already listed in dynamic linking
16556                 dflt=''
16557                 for xxx in $avail_ext; do
16558                         case " $dynamic_ext " in
16559                         *" $xxx "*) ;;
16560                         *) dflt="$dflt $xxx" ;;
16561                         esac
16562                 done
16563                 set X $dflt
16564                 shift
16565                 dflt="$*"
16566                 ;;
16567         *)  dflt="$static_ext" 
16568                 ;;
16569         esac
16570
16571         case "$dflt" in
16572         '')     dflt=none;;
16573         esac
16574         rp="What extensions do you wish to load statically?"
16575         . ./myread
16576         case "$ans" in
16577         none) static_ext=' ' ;;
16578         *) static_ext="$ans" ;;
16579         esac
16580         ;;
16581 *)
16582         $cat <<EOM
16583 A number of extensions are supplied with $package.  Answer "none" 
16584 to include no extensions. 
16585 Note that DynaLoader is always built and need not be mentioned here.
16586
16587 EOM
16588         case "$static_ext" in
16589         '') dflt="$avail_ext" ;;
16590         *)      dflt="$static_ext"
16591                 # Perhaps we are reusing an old out-of-date config.sh.
16592                 case "$hint" in
16593                 previous)
16594                         if test X"$static_ext" != X"$avail_ext"; then
16595                                 $cat <<EOM
16596 NOTICE:  Your previous config.sh list may be incorrect. 
16597 The extensions now available to you are 
16598         ${avail_ext}
16599 but the default list from your previous config.sh is
16600         ${static_ext} 
16601
16602 EOM
16603                         fi
16604                         ;;
16605                 esac
16606                 ;;
16607         esac
16608         : Exclude those that are not xs extensions
16609         case "$dflt" in
16610         '')     dflt=none;;
16611         esac
16612         rp="What extensions do you wish to include?"
16613         . ./myread
16614         case "$ans" in
16615         none) static_ext=' ' ;;
16616         *) static_ext="$ans" ;;
16617         esac
16618         ;;
16619 esac
16620
16621 set X $dynamic_ext $static_ext $nonxs_ext
16622 shift
16623 extensions="$*"
16624
16625 : Remove libraries needed only for extensions
16626 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16627 : The exception is SunOS 4.x, which needs them.
16628 case "${osname}X${osvers}" in
16629 sunos*X4*)
16630     perllibs="$libs"
16631     ;;
16632 *) case "$usedl" in
16633     $define|true|[yY]*)
16634             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16635             shift
16636             perllibs="$*"
16637             ;;
16638     *)  perllibs="$libs"
16639             ;;
16640     esac
16641     ;;
16642 esac
16643
16644 : Remove build directory name from cppstdin so it can be used from
16645 : either the present location or the final installed location.
16646 echo " "
16647 : Get out of the UU directory to get correct path name.
16648 cd ..
16649 case "$cppstdin" in
16650 `pwd`/cppstdin)
16651         echo "Stripping down cppstdin path name"
16652         cppstdin=cppstdin
16653         ;;
16654 esac
16655 cd UU
16656
16657 : end of configuration questions
16658 echo " "
16659 echo "End of configuration questions."
16660 echo " "
16661
16662 : back to where it started
16663 if test -d ../UU; then
16664         cd ..
16665 fi
16666
16667 : configuration may be patched via a 'config.arch' file
16668 if $test -f config.arch; then
16669         echo "I see a config.arch file, loading it."
16670         . ./config.arch
16671 fi
16672
16673 : configuration may be patched via a 'config.over' file
16674 if $test -f config.over; then
16675         echo " "
16676         dflt=y
16677         rp='I see a config.over file.  Do you wish to load it?'
16678         . UU/myread
16679         case "$ans" in
16680         n*) echo "OK, I'll ignore it.";;
16681         *)      . ./config.over
16682                 echo "Configuration override changes have been loaded."
16683                 ;;
16684         esac
16685 fi
16686
16687 : in case they want portability, strip down executable paths
16688 case "$d_portable" in
16689 "$define")
16690         echo " "
16691         echo "Stripping down executable paths..." >&4
16692         for file in $loclist $trylist; do
16693                 eval temp=\$$file
16694                 eval $file=`basename $temp`
16695         done
16696         ;;
16697 esac
16698
16699 : create config.sh file
16700 echo " "
16701 echo "Creating config.sh..." >&4
16702 $spitshell <<EOT >config.sh
16703 $startsh
16704 #
16705 # This file was produced by running the Configure script. It holds all the
16706 # definitions figured out by Configure. Should you modify one of these values,
16707 # do not forget to propagate your changes by running "Configure -der". You may
16708 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16709 #
16710
16711 # Package name      : $package
16712 # Source directory  : $src
16713 # Configuration time: $cf_time
16714 # Configured by     : $cf_by
16715 # Target system     : $myuname
16716
16717 Author='$Author'
16718 Date='$Date'
16719 Header='$Header'
16720 Id='$Id'
16721 Locker='$Locker'
16722 Log='$Log'
16723 Mcc='$Mcc'
16724 RCSfile='$RCSfile'
16725 Revision='$Revision'
16726 Source='$Source'
16727 State='$State'
16728 _a='$_a'
16729 _exe='$_exe'
16730 _o='$_o'
16731 afs='$afs'
16732 afsroot='$afsroot'
16733 alignbytes='$alignbytes'
16734 ansi2knr='$ansi2knr'
16735 aphostname='$aphostname'
16736 api_revision='$api_revision'
16737 api_subversion='$api_subversion'
16738 api_version='$api_version'
16739 api_versionstring='$api_versionstring'
16740 ar='$ar'
16741 archlib='$archlib'
16742 archlibexp='$archlibexp'
16743 archname64='$archname64'
16744 archname='$archname'
16745 archobjs='$archobjs'
16746 awk='$awk'
16747 baserev='$baserev'
16748 bash='$bash'
16749 bin='$bin'
16750 bincompat5005='$bincompat5005'
16751 binexp='$binexp'
16752 bison='$bison'
16753 byacc='$byacc'
16754 byteorder='$byteorder'
16755 c='$c'
16756 castflags='$castflags'
16757 cat='$cat'
16758 cc='$cc'
16759 cccdlflags='$cccdlflags'
16760 ccdlflags='$ccdlflags'
16761 ccflags='$ccflags'
16762 ccflags_uselargefiles='$ccflags_uselargefiles'
16763 ccname='$ccname'
16764 ccsymbols='$ccsymbols'
16765 ccversion='$ccversion'
16766 cf_by='$cf_by'
16767 cf_email='$cf_email'
16768 cf_time='$cf_time'
16769 charsize='$charsize'
16770 chgrp='$chgrp'
16771 chmod='$chmod'
16772 chown='$chown'
16773 clocktype='$clocktype'
16774 comm='$comm'
16775 compress='$compress'
16776 contains='$contains'
16777 cp='$cp'
16778 cpio='$cpio'
16779 cpp='$cpp'
16780 cpp_stuff='$cpp_stuff'
16781 cppccsymbols='$cppccsymbols'
16782 cppflags='$cppflags'
16783 cpplast='$cpplast'
16784 cppminus='$cppminus'
16785 cpprun='$cpprun'
16786 cppstdin='$cppstdin'
16787 cppsymbols='$cppsymbols'
16788 cryptlib='$cryptlib'
16789 csh='$csh'
16790 d_Gconvert='$d_Gconvert'
16791 d_PRIEUldbl='$d_PRIEUldbl'
16792 d_PRIFUldbl='$d_PRIFUldbl'
16793 d_PRIGUldbl='$d_PRIGUldbl'
16794 d_PRIXU64='$d_PRIXU64'
16795 d_PRId64='$d_PRId64'
16796 d_PRIeldbl='$d_PRIeldbl'
16797 d_PRIfldbl='$d_PRIfldbl'
16798 d_PRIgldbl='$d_PRIgldbl'
16799 d_PRIi64='$d_PRIi64'
16800 d_PRIo64='$d_PRIo64'
16801 d_PRIu64='$d_PRIu64'
16802 d_PRIx64='$d_PRIx64'
16803 d_SCNfldbl='$d_SCNfldbl'
16804 d__fwalk='$d__fwalk'
16805 d_access='$d_access'
16806 d_accessx='$d_accessx'
16807 d_alarm='$d_alarm'
16808 d_archlib='$d_archlib'
16809 d_atolf='$d_atolf'
16810 d_atoll='$d_atoll'
16811 d_attribut='$d_attribut'
16812 d_bcmp='$d_bcmp'
16813 d_bcopy='$d_bcopy'
16814 d_bincompat5005='$d_bincompat5005'
16815 d_bsd='$d_bsd'
16816 d_bsdgetpgrp='$d_bsdgetpgrp'
16817 d_bsdsetpgrp='$d_bsdsetpgrp'
16818 d_bzero='$d_bzero'
16819 d_casti32='$d_casti32'
16820 d_castneg='$d_castneg'
16821 d_charvspr='$d_charvspr'
16822 d_chown='$d_chown'
16823 d_chroot='$d_chroot'
16824 d_chsize='$d_chsize'
16825 d_class='$d_class'
16826 d_closedir='$d_closedir'
16827 d_cmsghdr_s='$d_cmsghdr_s'
16828 d_const='$d_const'
16829 d_crypt='$d_crypt'
16830 d_csh='$d_csh'
16831 d_cuserid='$d_cuserid'
16832 d_dbl_dig='$d_dbl_dig'
16833 d_dbminitproto='$d_dbminitproto'
16834 d_difftime='$d_difftime'
16835 d_dirnamlen='$d_dirnamlen'
16836 d_dlerror='$d_dlerror'
16837 d_dlopen='$d_dlopen'
16838 d_dlsymun='$d_dlsymun'
16839 d_dosuid='$d_dosuid'
16840 d_drand48proto='$d_drand48proto'
16841 d_dup2='$d_dup2'
16842 d_eaccess='$d_eaccess'
16843 d_endgrent='$d_endgrent'
16844 d_endhent='$d_endhent'
16845 d_endnent='$d_endnent'
16846 d_endpent='$d_endpent'
16847 d_endpwent='$d_endpwent'
16848 d_endsent='$d_endsent'
16849 d_eofnblk='$d_eofnblk'
16850 d_eunice='$d_eunice'
16851 d_fchdir='$d_fchdir'
16852 d_fchmod='$d_fchmod'
16853 d_fchown='$d_fchown'
16854 d_fcntl='$d_fcntl'
16855 d_fcntl_can_lock='$d_fcntl_can_lock'
16856 d_fd_macros='$d_fd_macros'
16857 d_fd_set='$d_fd_set'
16858 d_fds_bits='$d_fds_bits'
16859 d_fgetpos='$d_fgetpos'
16860 d_finite='$d_finite'
16861 d_finitel='$d_finitel'
16862 d_flexfnam='$d_flexfnam'
16863 d_flock='$d_flock'
16864 d_flockproto='$d_flockproto'
16865 d_fork='$d_fork'
16866 d_fp_class='$d_fp_class'
16867 d_fpathconf='$d_fpathconf'
16868 d_fpclass='$d_fpclass'
16869 d_fpclassify='$d_fpclassify'
16870 d_fpclassl='$d_fpclassl'
16871 d_fpos64_t='$d_fpos64_t'
16872 d_frexpl='$d_frexpl'
16873 d_fs_data_s='$d_fs_data_s'
16874 d_fseeko='$d_fseeko'
16875 d_fsetpos='$d_fsetpos'
16876 d_fstatfs='$d_fstatfs'
16877 d_fstatvfs='$d_fstatvfs'
16878 d_fsync='$d_fsync'
16879 d_ftello='$d_ftello'
16880 d_ftime='$d_ftime'
16881 d_getcwd='$d_getcwd'
16882 d_getespwnam='$d_getespwnam'
16883 d_getfsstat='$d_getfsstat'
16884 d_getgrent='$d_getgrent'
16885 d_getgrps='$d_getgrps'
16886 d_gethbyaddr='$d_gethbyaddr'
16887 d_gethbyname='$d_gethbyname'
16888 d_gethent='$d_gethent'
16889 d_gethname='$d_gethname'
16890 d_gethostprotos='$d_gethostprotos'
16891 d_getitimer='$d_getitimer'
16892 d_getlogin='$d_getlogin'
16893 d_getmnt='$d_getmnt'
16894 d_getmntent='$d_getmntent'
16895 d_getnbyaddr='$d_getnbyaddr'
16896 d_getnbyname='$d_getnbyname'
16897 d_getnent='$d_getnent'
16898 d_getnetprotos='$d_getnetprotos'
16899 d_getpagsz='$d_getpagsz'
16900 d_getpbyname='$d_getpbyname'
16901 d_getpbynumber='$d_getpbynumber'
16902 d_getpent='$d_getpent'
16903 d_getpgid='$d_getpgid'
16904 d_getpgrp2='$d_getpgrp2'
16905 d_getpgrp='$d_getpgrp'
16906 d_getppid='$d_getppid'
16907 d_getprior='$d_getprior'
16908 d_getprotoprotos='$d_getprotoprotos'
16909 d_getprpwnam='$d_getprpwnam'
16910 d_getpwent='$d_getpwent'
16911 d_getsbyname='$d_getsbyname'
16912 d_getsbyport='$d_getsbyport'
16913 d_getsent='$d_getsent'
16914 d_getservprotos='$d_getservprotos'
16915 d_getspnam='$d_getspnam'
16916 d_gettimeod='$d_gettimeod'
16917 d_gnulibc='$d_gnulibc'
16918 d_grpasswd='$d_grpasswd'
16919 d_hasmntopt='$d_hasmntopt'
16920 d_htonl='$d_htonl'
16921 d_index='$d_index'
16922 d_inetaton='$d_inetaton'
16923 d_int64_t='$d_int64_t'
16924 d_isascii='$d_isascii'
16925 d_isfinite='$d_isfinite'
16926 d_isinf='$d_isinf'
16927 d_isnan='$d_isnan'
16928 d_isnanl='$d_isnanl'
16929 d_killpg='$d_killpg'
16930 d_lchown='$d_lchown'
16931 d_ldbl_dig='$d_ldbl_dig'
16932 d_link='$d_link'
16933 d_locconv='$d_locconv'
16934 d_lockf='$d_lockf'
16935 d_longdbl='$d_longdbl'
16936 d_longlong='$d_longlong'
16937 d_lseekproto='$d_lseekproto'
16938 d_lstat='$d_lstat'
16939 d_madvise='$d_madvise'
16940 d_mblen='$d_mblen'
16941 d_mbstowcs='$d_mbstowcs'
16942 d_mbtowc='$d_mbtowc'
16943 d_memchr='$d_memchr'
16944 d_memcmp='$d_memcmp'
16945 d_memcpy='$d_memcpy'
16946 d_memmove='$d_memmove'
16947 d_memset='$d_memset'
16948 d_mkdir='$d_mkdir'
16949 d_mkdtemp='$d_mkdtemp'
16950 d_mkfifo='$d_mkfifo'
16951 d_mkstemp='$d_mkstemp'
16952 d_mkstemps='$d_mkstemps'
16953 d_mktime='$d_mktime'
16954 d_mmap='$d_mmap'
16955 d_modfl='$d_modfl'
16956 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16957 d_mprotect='$d_mprotect'
16958 d_msg='$d_msg'
16959 d_msg_ctrunc='$d_msg_ctrunc'
16960 d_msg_dontroute='$d_msg_dontroute'
16961 d_msg_oob='$d_msg_oob'
16962 d_msg_peek='$d_msg_peek'
16963 d_msg_proxy='$d_msg_proxy'
16964 d_msgctl='$d_msgctl'
16965 d_msgget='$d_msgget'
16966 d_msghdr_s='$d_msghdr_s'
16967 d_msgrcv='$d_msgrcv'
16968 d_msgsnd='$d_msgsnd'
16969 d_msync='$d_msync'
16970 d_munmap='$d_munmap'
16971 d_mymalloc='$d_mymalloc'
16972 d_nice='$d_nice'
16973 d_nl_langinfo='$d_nl_langinfo'
16974 d_nv_preserves_uv='$d_nv_preserves_uv'
16975 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16976 d_off64_t='$d_off64_t'
16977 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16978 d_oldpthreads='$d_oldpthreads'
16979 d_oldsock='$d_oldsock'
16980 d_open3='$d_open3'
16981 d_pathconf='$d_pathconf'
16982 d_pause='$d_pause'
16983 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16984 d_phostname='$d_phostname'
16985 d_pipe='$d_pipe'
16986 d_poll='$d_poll'
16987 d_portable='$d_portable'
16988 d_procselfexe='$d_procselfexe'
16989 d_pthread_atfork='$d_pthread_atfork'
16990 d_pthread_yield='$d_pthread_yield'
16991 d_pwage='$d_pwage'
16992 d_pwchange='$d_pwchange'
16993 d_pwclass='$d_pwclass'
16994 d_pwcomment='$d_pwcomment'
16995 d_pwexpire='$d_pwexpire'
16996 d_pwgecos='$d_pwgecos'
16997 d_pwpasswd='$d_pwpasswd'
16998 d_pwquota='$d_pwquota'
16999 d_qgcvt='$d_qgcvt'
17000 d_quad='$d_quad'
17001 d_readdir='$d_readdir'
17002 d_readlink='$d_readlink'
17003 d_readv='$d_readv'
17004 d_recvmsg='$d_recvmsg'
17005 d_rename='$d_rename'
17006 d_rewinddir='$d_rewinddir'
17007 d_rmdir='$d_rmdir'
17008 d_safebcpy='$d_safebcpy'
17009 d_safemcpy='$d_safemcpy'
17010 d_sanemcmp='$d_sanemcmp'
17011 d_sbrkproto='$d_sbrkproto'
17012 d_sched_yield='$d_sched_yield'
17013 d_scm_rights='$d_scm_rights'
17014 d_seekdir='$d_seekdir'
17015 d_select='$d_select'
17016 d_sem='$d_sem'
17017 d_semctl='$d_semctl'
17018 d_semctl_semid_ds='$d_semctl_semid_ds'
17019 d_semctl_semun='$d_semctl_semun'
17020 d_semget='$d_semget'
17021 d_semop='$d_semop'
17022 d_sendmsg='$d_sendmsg'
17023 d_setegid='$d_setegid'
17024 d_seteuid='$d_seteuid'
17025 d_setgrent='$d_setgrent'
17026 d_setgrps='$d_setgrps'
17027 d_sethent='$d_sethent'
17028 d_setitimer='$d_setitimer'
17029 d_setlinebuf='$d_setlinebuf'
17030 d_setlocale='$d_setlocale'
17031 d_setnent='$d_setnent'
17032 d_setpent='$d_setpent'
17033 d_setpgid='$d_setpgid'
17034 d_setpgrp2='$d_setpgrp2'
17035 d_setpgrp='$d_setpgrp'
17036 d_setprior='$d_setprior'
17037 d_setproctitle='$d_setproctitle'
17038 d_setpwent='$d_setpwent'
17039 d_setregid='$d_setregid'
17040 d_setresgid='$d_setresgid'
17041 d_setresuid='$d_setresuid'
17042 d_setreuid='$d_setreuid'
17043 d_setrgid='$d_setrgid'
17044 d_setruid='$d_setruid'
17045 d_setsent='$d_setsent'
17046 d_setsid='$d_setsid'
17047 d_setvbuf='$d_setvbuf'
17048 d_sfio='$d_sfio'
17049 d_shm='$d_shm'
17050 d_shmat='$d_shmat'
17051 d_shmatprototype='$d_shmatprototype'
17052 d_shmctl='$d_shmctl'
17053 d_shmdt='$d_shmdt'
17054 d_shmget='$d_shmget'
17055 d_sigaction='$d_sigaction'
17056 d_sigprocmask='$d_sigprocmask'
17057 d_sigsetjmp='$d_sigsetjmp'
17058 d_sockatmark='$d_sockatmark'
17059 d_sockatmarkproto='$d_sockatmarkproto'
17060 d_socket='$d_socket'
17061 d_socklen_t='$d_socklen_t'
17062 d_sockpair='$d_sockpair'
17063 d_socks5_init='$d_socks5_init'
17064 d_sqrtl='$d_sqrtl'
17065 d_sresgproto='$d_sresgproto'
17066 d_sresuproto='$d_sresuproto'
17067 d_statblks='$d_statblks'
17068 d_statfs_f_flags='$d_statfs_f_flags'
17069 d_statfs_s='$d_statfs_s'
17070 d_statvfs='$d_statvfs'
17071 d_stdio_cnt_lval='$d_stdio_cnt_lval'
17072 d_stdio_ptr_lval='$d_stdio_ptr_lval'
17073 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
17074 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
17075 d_stdio_stream_array='$d_stdio_stream_array'
17076 d_stdiobase='$d_stdiobase'
17077 d_stdstdio='$d_stdstdio'
17078 d_strchr='$d_strchr'
17079 d_strcoll='$d_strcoll'
17080 d_strctcpy='$d_strctcpy'
17081 d_strerrm='$d_strerrm'
17082 d_strerror='$d_strerror'
17083 d_strftime='$d_strftime'
17084 d_strtod='$d_strtod'
17085 d_strtol='$d_strtol'
17086 d_strtold='$d_strtold'
17087 d_strtoll='$d_strtoll'
17088 d_strtoq='$d_strtoq'
17089 d_strtoul='$d_strtoul'
17090 d_strtoull='$d_strtoull'
17091 d_strtouq='$d_strtouq'
17092 d_strxfrm='$d_strxfrm'
17093 d_suidsafe='$d_suidsafe'
17094 d_symlink='$d_symlink'
17095 d_syscall='$d_syscall'
17096 d_syscallproto='$d_syscallproto'
17097 d_sysconf='$d_sysconf'
17098 d_sysernlst='$d_sysernlst'
17099 d_syserrlst='$d_syserrlst'
17100 d_system='$d_system'
17101 d_tcgetpgrp='$d_tcgetpgrp'
17102 d_tcsetpgrp='$d_tcsetpgrp'
17103 d_telldir='$d_telldir'
17104 d_telldirproto='$d_telldirproto'
17105 d_time='$d_time'
17106 d_times='$d_times'
17107 d_truncate='$d_truncate'
17108 d_tzname='$d_tzname'
17109 d_u32align='$d_u32align'
17110 d_ualarm='$d_ualarm'
17111 d_umask='$d_umask'
17112 d_uname='$d_uname'
17113 d_union_semun='$d_union_semun'
17114 d_unordered='$d_unordered'
17115 d_usleep='$d_usleep'
17116 d_usleepproto='$d_usleepproto'
17117 d_ustat='$d_ustat'
17118 d_vendorarch='$d_vendorarch'
17119 d_vendorbin='$d_vendorbin'
17120 d_vendorlib='$d_vendorlib'
17121 d_vfork='$d_vfork'
17122 d_void_closedir='$d_void_closedir'
17123 d_voidsig='$d_voidsig'
17124 d_voidtty='$d_voidtty'
17125 d_volatile='$d_volatile'
17126 d_vprintf='$d_vprintf'
17127 d_wait4='$d_wait4'
17128 d_waitpid='$d_waitpid'
17129 d_wcstombs='$d_wcstombs'
17130 d_wctomb='$d_wctomb'
17131 d_writev='$d_writev'
17132 d_xenix='$d_xenix'
17133 date='$date'
17134 db_hashtype='$db_hashtype'
17135 db_prefixtype='$db_prefixtype'
17136 db_version_major='$db_version_major'
17137 db_version_minor='$db_version_minor'
17138 db_version_patch='$db_version_patch'
17139 defvoidused='$defvoidused'
17140 direntrytype='$direntrytype'
17141 dlext='$dlext'
17142 dlsrc='$dlsrc'
17143 doublesize='$doublesize'
17144 drand01='$drand01'
17145 dynamic_ext='$dynamic_ext'
17146 eagain='$eagain'
17147 ebcdic='$ebcdic'
17148 echo='$echo'
17149 egrep='$egrep'
17150 emacs='$emacs'
17151 eunicefix='$eunicefix'
17152 exe_ext='$exe_ext'
17153 expr='$expr'
17154 extensions='$extensions'
17155 extras='$extras'
17156 fflushNULL='$fflushNULL'
17157 fflushall='$fflushall'
17158 find='$find'
17159 firstmakefile='$firstmakefile'
17160 flex='$flex'
17161 fpossize='$fpossize'
17162 fpostype='$fpostype'
17163 freetype='$freetype'
17164 from='$from'
17165 full_ar='$full_ar'
17166 full_csh='$full_csh'
17167 full_sed='$full_sed'
17168 gccosandvers='$gccosandvers'
17169 gccversion='$gccversion'
17170 gidformat='$gidformat'
17171 gidsign='$gidsign'
17172 gidsize='$gidsize'
17173 gidtype='$gidtype'
17174 glibpth='$glibpth'
17175 grep='$grep'
17176 groupcat='$groupcat'
17177 groupstype='$groupstype'
17178 gzip='$gzip'
17179 h_fcntl='$h_fcntl'
17180 h_sysfile='$h_sysfile'
17181 hint='$hint'
17182 hostcat='$hostcat'
17183 i16size='$i16size'
17184 i16type='$i16type'
17185 i32size='$i32size'
17186 i32type='$i32type'
17187 i64size='$i64size'
17188 i64type='$i64type'
17189 i8size='$i8size'
17190 i8type='$i8type'
17191 i_arpainet='$i_arpainet'
17192 i_bsdioctl='$i_bsdioctl'
17193 i_db='$i_db'
17194 i_dbm='$i_dbm'
17195 i_dirent='$i_dirent'
17196 i_dld='$i_dld'
17197 i_dlfcn='$i_dlfcn'
17198 i_fcntl='$i_fcntl'
17199 i_float='$i_float'
17200 i_fp='$i_fp'
17201 i_fp_class='$i_fp_class'
17202 i_gdbm='$i_gdbm'
17203 i_grp='$i_grp'
17204 i_ieeefp='$i_ieeefp'
17205 i_inttypes='$i_inttypes'
17206 i_langinfo='$i_langinfo'
17207 i_libutil='$i_libutil'
17208 i_limits='$i_limits'
17209 i_locale='$i_locale'
17210 i_machcthr='$i_machcthr'
17211 i_malloc='$i_malloc'
17212 i_math='$i_math'
17213 i_memory='$i_memory'
17214 i_mntent='$i_mntent'
17215 i_ndbm='$i_ndbm'
17216 i_netdb='$i_netdb'
17217 i_neterrno='$i_neterrno'
17218 i_netinettcp='$i_netinettcp'
17219 i_niin='$i_niin'
17220 i_poll='$i_poll'
17221 i_prot='$i_prot'
17222 i_pthread='$i_pthread'
17223 i_pwd='$i_pwd'
17224 i_rpcsvcdbm='$i_rpcsvcdbm'
17225 i_sfio='$i_sfio'
17226 i_sgtty='$i_sgtty'
17227 i_shadow='$i_shadow'
17228 i_socks='$i_socks'
17229 i_stdarg='$i_stdarg'
17230 i_stddef='$i_stddef'
17231 i_stdlib='$i_stdlib'
17232 i_string='$i_string'
17233 i_sunmath='$i_sunmath'
17234 i_sysaccess='$i_sysaccess'
17235 i_sysdir='$i_sysdir'
17236 i_sysfile='$i_sysfile'
17237 i_sysfilio='$i_sysfilio'
17238 i_sysin='$i_sysin'
17239 i_sysioctl='$i_sysioctl'
17240 i_syslog='$i_syslog'
17241 i_sysmman='$i_sysmman'
17242 i_sysmode='$i_sysmode'
17243 i_sysmount='$i_sysmount'
17244 i_sysndir='$i_sysndir'
17245 i_sysparam='$i_sysparam'
17246 i_sysresrc='$i_sysresrc'
17247 i_syssecrt='$i_syssecrt'
17248 i_sysselct='$i_sysselct'
17249 i_syssockio='$i_syssockio'
17250 i_sysstat='$i_sysstat'
17251 i_sysstatfs='$i_sysstatfs'
17252 i_sysstatvfs='$i_sysstatvfs'
17253 i_systime='$i_systime'
17254 i_systimek='$i_systimek'
17255 i_systimes='$i_systimes'
17256 i_systypes='$i_systypes'
17257 i_sysuio='$i_sysuio'
17258 i_sysun='$i_sysun'
17259 i_sysutsname='$i_sysutsname'
17260 i_sysvfs='$i_sysvfs'
17261 i_syswait='$i_syswait'
17262 i_termio='$i_termio'
17263 i_termios='$i_termios'
17264 i_time='$i_time'
17265 i_unistd='$i_unistd'
17266 i_ustat='$i_ustat'
17267 i_utime='$i_utime'
17268 i_values='$i_values'
17269 i_varargs='$i_varargs'
17270 i_varhdr='$i_varhdr'
17271 i_vfork='$i_vfork'
17272 ignore_versioned_solibs='$ignore_versioned_solibs'
17273 inc_version_list='$inc_version_list'
17274 inc_version_list_init='$inc_version_list_init'
17275 incpath='$incpath'
17276 inews='$inews'
17277 installarchlib='$installarchlib'
17278 installbin='$installbin'
17279 installman1dir='$installman1dir'
17280 installman3dir='$installman3dir'
17281 installprefix='$installprefix'
17282 installprefixexp='$installprefixexp'
17283 installprivlib='$installprivlib'
17284 installscript='$installscript'
17285 installsitearch='$installsitearch'
17286 installsitebin='$installsitebin'
17287 installsitelib='$installsitelib'
17288 installstyle='$installstyle'
17289 installusrbinperl='$installusrbinperl'
17290 installvendorarch='$installvendorarch'
17291 installvendorbin='$installvendorbin'
17292 installvendorlib='$installvendorlib'
17293 intsize='$intsize'
17294 issymlink='$issymlink'
17295 ivdformat='$ivdformat'
17296 ivsize='$ivsize'
17297 ivtype='$ivtype'
17298 known_extensions='$known_extensions'
17299 ksh='$ksh'
17300 ld='$ld'
17301 lddlflags='$lddlflags'
17302 ldflags='$ldflags'
17303 ldflags_uselargefiles='$ldflags_uselargefiles'
17304 ldlibpthname='$ldlibpthname'
17305 less='$less'
17306 lib_ext='$lib_ext'
17307 libc='$libc'
17308 libperl='$libperl'
17309 libpth='$libpth'
17310 libs='$libs'
17311 libsdirs='$libsdirs'
17312 libsfiles='$libsfiles'
17313 libsfound='$libsfound'
17314 libspath='$libspath'
17315 libswanted='$libswanted'
17316 libswanted_uselargefiles='$libswanted_uselargefiles'
17317 line='$line'
17318 lint='$lint'
17319 lkflags='$lkflags'
17320 ln='$ln'
17321 lns='$lns'
17322 locincpth='$locincpth'
17323 loclibpth='$loclibpth'
17324 longdblsize='$longdblsize'
17325 longlongsize='$longlongsize'
17326 longsize='$longsize'
17327 lp='$lp'
17328 lpr='$lpr'
17329 ls='$ls'
17330 lseeksize='$lseeksize'
17331 lseektype='$lseektype'
17332 mail='$mail'
17333 mailx='$mailx'
17334 make='$make'
17335 make_set_make='$make_set_make'
17336 mallocobj='$mallocobj'
17337 mallocsrc='$mallocsrc'
17338 malloctype='$malloctype'
17339 man1dir='$man1dir'
17340 man1direxp='$man1direxp'
17341 man1ext='$man1ext'
17342 man3dir='$man3dir'
17343 man3direxp='$man3direxp'
17344 man3ext='$man3ext'
17345 mips_type='$mips_type'
17346 mkdir='$mkdir'
17347 mmaptype='$mmaptype'
17348 modetype='$modetype'
17349 more='$more'
17350 multiarch='$multiarch'
17351 mv='$mv'
17352 myarchname='$myarchname'
17353 mydomain='$mydomain'
17354 myhostname='$myhostname'
17355 myuname='$myuname'
17356 n='$n'
17357 need_va_copy='$need_va_copy'
17358 netdb_hlen_type='$netdb_hlen_type'
17359 netdb_host_type='$netdb_host_type'
17360 netdb_name_type='$netdb_name_type'
17361 netdb_net_type='$netdb_net_type'
17362 nm='$nm'
17363 nm_opt='$nm_opt'
17364 nm_so_opt='$nm_so_opt'
17365 nonxs_ext='$nonxs_ext'
17366 nroff='$nroff'
17367 nvEUformat='$nvEUformat'
17368 nvFUformat='$nvFUformat'
17369 nvGUformat='$nvGUformat'
17370 nveformat='$nveformat'
17371 nvfformat='$nvfformat'
17372 nvgformat='$nvgformat'
17373 nvsize='$nvsize'
17374 nvtype='$nvtype'
17375 o_nonblock='$o_nonblock'
17376 obj_ext='$obj_ext'
17377 old_pthread_create_joinable='$old_pthread_create_joinable'
17378 optimize='$optimize'
17379 orderlib='$orderlib'
17380 osname='$osname'
17381 osvers='$osvers'
17382 otherlibdirs='$otherlibdirs'
17383 package='$package'
17384 pager='$pager'
17385 passcat='$passcat'
17386 patchlevel='$patchlevel'
17387 path_sep='$path_sep'
17388 perl5='$perl5'
17389 perl='$perl'
17390 perl_patchlevel='$perl_patchlevel'
17391 perladmin='$perladmin'
17392 perllibs='$perllibs'
17393 perlpath='$perlpath'
17394 pg='$pg'
17395 phostname='$phostname'
17396 pidtype='$pidtype'
17397 plibpth='$plibpth'
17398 pm_apiversion='$pm_apiversion'
17399 pmake='$pmake'
17400 pr='$pr'
17401 prefix='$prefix'
17402 prefixexp='$prefixexp'
17403 privlib='$privlib'
17404 privlibexp='$privlibexp'
17405 prototype='$prototype'
17406 ptrsize='$ptrsize'
17407 quadkind='$quadkind'
17408 quadtype='$quadtype'
17409 randbits='$randbits'
17410 randfunc='$randfunc'
17411 randseedtype='$randseedtype'
17412 ranlib='$ranlib'
17413 rd_nodata='$rd_nodata'
17414 revision='$revision'
17415 rm='$rm'
17416 rmail='$rmail'
17417 run='$run'
17418 runnm='$runnm'
17419 sPRIEUldbl='$sPRIEUldbl'
17420 sPRIFUldbl='$sPRIFUldbl'
17421 sPRIGUldbl='$sPRIGUldbl'
17422 sPRIXU64='$sPRIXU64'
17423 sPRId64='$sPRId64'
17424 sPRIeldbl='$sPRIeldbl'
17425 sPRIfldbl='$sPRIfldbl'
17426 sPRIgldbl='$sPRIgldbl'
17427 sPRIi64='$sPRIi64'
17428 sPRIo64='$sPRIo64'
17429 sPRIu64='$sPRIu64'
17430 sPRIx64='$sPRIx64'
17431 sSCNfldbl='$sSCNfldbl'
17432 sched_yield='$sched_yield'
17433 scriptdir='$scriptdir'
17434 scriptdirexp='$scriptdirexp'
17435 sed='$sed'
17436 seedfunc='$seedfunc'
17437 selectminbits='$selectminbits'
17438 selecttype='$selecttype'
17439 sendmail='$sendmail'
17440 sh='$sh'
17441 shar='$shar'
17442 sharpbang='$sharpbang'
17443 shmattype='$shmattype'
17444 shortsize='$shortsize'
17445 shrpenv='$shrpenv'
17446 shsharp='$shsharp'
17447 sig_count='$sig_count'
17448 sig_name='$sig_name'
17449 sig_name_init='$sig_name_init'
17450 sig_num='$sig_num'
17451 sig_num_init='$sig_num_init'
17452 sig_size='$sig_size'
17453 signal_t='$signal_t'
17454 sitearch='$sitearch'
17455 sitearchexp='$sitearchexp'
17456 sitebin='$sitebin'
17457 sitebinexp='$sitebinexp'
17458 sitelib='$sitelib'
17459 sitelib_stem='$sitelib_stem'
17460 sitelibexp='$sitelibexp'
17461 siteprefix='$siteprefix'
17462 siteprefixexp='$siteprefixexp'
17463 sizesize='$sizesize'
17464 sizetype='$sizetype'
17465 sleep='$sleep'
17466 smail='$smail'
17467 so='$so'
17468 sockethdr='$sockethdr'
17469 socketlib='$socketlib'
17470 socksizetype='$socksizetype'
17471 sort='$sort'
17472 spackage='$spackage'
17473 spitshell='$spitshell'
17474 src='$src'
17475 ssizetype='$ssizetype'
17476 startperl='$startperl'
17477 startsh='$startsh'
17478 static_ext='$static_ext'
17479 stdchar='$stdchar'
17480 stdio_base='$stdio_base'
17481 stdio_bufsiz='$stdio_bufsiz'
17482 stdio_cnt='$stdio_cnt'
17483 stdio_filbuf='$stdio_filbuf'
17484 stdio_ptr='$stdio_ptr'
17485 stdio_stream_array='$stdio_stream_array'
17486 strings='$strings'
17487 submit='$submit'
17488 subversion='$subversion'
17489 sysman='$sysman'
17490 tail='$tail'
17491 tar='$tar'
17492 targetarch='$targetarch'
17493 tbl='$tbl'
17494 tee='$tee'
17495 test='$test'
17496 timeincl='$timeincl'
17497 timetype='$timetype'
17498 to='$to'
17499 touch='$touch'
17500 tr='$tr'
17501 trnl='$trnl'
17502 troff='$troff'
17503 u16size='$u16size'
17504 u16type='$u16type'
17505 u32size='$u32size'
17506 u32type='$u32type'
17507 u64size='$u64size'
17508 u64type='$u64type'
17509 u8size='$u8size'
17510 u8type='$u8type'
17511 uidformat='$uidformat'
17512 uidsign='$uidsign'
17513 uidsize='$uidsize'
17514 uidtype='$uidtype'
17515 uname='$uname'
17516 uniq='$uniq'
17517 uquadtype='$uquadtype'
17518 use5005threads='$use5005threads'
17519 use64bitall='$use64bitall'
17520 use64bitint='$use64bitint'
17521 usecrosscompile='$usecrosscompile'
17522 usedl='$usedl'
17523 useithreads='$useithreads'
17524 uselargefiles='$uselargefiles'
17525 uselongdouble='$uselongdouble'
17526 usemorebits='$usemorebits'
17527 usemultiplicity='$usemultiplicity'
17528 usemymalloc='$usemymalloc'
17529 usenm='$usenm'
17530 useopcode='$useopcode'
17531 useperlio='$useperlio'
17532 useposix='$useposix'
17533 usereentrant='$usereentrant'
17534 usesfio='$usesfio'
17535 useshrplib='$useshrplib'
17536 usesocks='$usesocks'
17537 usethreads='$usethreads'
17538 usevendorprefix='$usevendorprefix'
17539 usevfork='$usevfork'
17540 usrinc='$usrinc'
17541 uuname='$uuname'
17542 uvXUformat='$uvXUformat'
17543 uvoformat='$uvoformat'
17544 uvsize='$uvsize'
17545 uvtype='$uvtype'
17546 uvuformat='$uvuformat'
17547 uvxformat='$uvxformat'
17548 vendorarch='$vendorarch'
17549 vendorarchexp='$vendorarchexp'
17550 vendorbin='$vendorbin'
17551 vendorbinexp='$vendorbinexp'
17552 vendorlib='$vendorlib'
17553 vendorlib_stem='$vendorlib_stem'
17554 vendorlibexp='$vendorlibexp'
17555 vendorprefix='$vendorprefix'
17556 vendorprefixexp='$vendorprefixexp'
17557 version='$version'
17558 version_patchlevel_string='$version_patchlevel_string'
17559 versiononly='$versiononly'
17560 vi='$vi'
17561 voidflags='$voidflags'
17562 xlibpth='$xlibpth'
17563 xs_apiversion='$xs_apiversion'
17564 yacc='$yacc'
17565 yaccflags='$yaccflags'
17566 zcat='$zcat'
17567 zip='$zip'
17568 EOT
17569
17570 : Add in command line options if available
17571 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17572
17573 : add special variables
17574 $test -f $src/patchlevel.h && \
17575 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17576 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17577 echo "PERL_CONFIG_SH=true" >>config.sh
17578
17579 : propagate old symbols
17580 if $test -f UU/config.sh; then
17581         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17582         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17583         $sort | $uniq -u >UU/oldsyms
17584         set X `cat UU/oldsyms`
17585         shift
17586         case $# in
17587         0) ;;
17588         *)
17589                 cat <<EOM
17590 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17591 EOM
17592                 echo "# Variables propagated from previous config.sh file." >>config.sh
17593                 for sym in `cat UU/oldsyms`; do
17594                         echo "    Propagating $hint variable "'$'"$sym..."
17595                         eval 'tmp="$'"${sym}"'"'
17596                         echo "$tmp" | \
17597                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17598                 done
17599                 ;;
17600         esac
17601 fi
17602
17603 : Finish up by extracting the .SH files
17604 case "$alldone" in
17605 exit)
17606         $rm -rf UU
17607         echo "Extraction done."
17608         exit 0
17609         ;;
17610 cont)
17611         ;;
17612 '')
17613         dflt=''
17614         nostick=true
17615         $cat <<EOM
17616
17617 If you'd like to make any changes to the config.sh file before I begin
17618 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17619
17620 EOM
17621         rp="Press return or use a shell escape to edit config.sh:"
17622         . UU/myread
17623         nostick=''
17624         case "$ans" in
17625         '') ;;
17626         *) : in case they cannot read
17627                 sh 1>&4 -c "$ans";;
17628         esac
17629         ;;
17630 esac
17631
17632 : if this fails, just run all the .SH files by hand
17633 . ./config.sh
17634
17635 echo " "
17636 exec 1>&4
17637 pwd=`pwd`
17638 . ./UU/extract
17639 cd $pwd
17640
17641 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17642         dflt=y
17643         case "$silent" in
17644         true) ;;
17645         *)
17646                 $cat <<EOM
17647
17648 Now you need to generate make dependencies by running "$make depend".
17649 You might prefer to run it in background: "$make depend > makedepend.out &"
17650 It can take a while, so you might not want to run it right now.
17651
17652 EOM
17653                 ;;
17654         esac
17655         rp="Run $make depend now?"
17656         . UU/myread
17657         case "$ans" in
17658         y*)
17659                 $make depend && echo "Now you must run '$make'."
17660                 ;;
17661         *)
17662                 echo "You must run '$make depend' then '$make'."
17663                 ;;
17664         esac
17665 elif test -f [Mm]akefile; then
17666         echo " "
17667         echo "Now you must run a $make."
17668 else
17669         echo "Configure done."
17670 fi
17671
17672 if $test -f Policy.sh; then
17673     $cat <<EOM
17674
17675 If you compile $package on a different machine or from a different object
17676 directory, copy the Policy.sh file from this object directory to the
17677 new one before you run Configure -- this will help you with most of
17678 the policy defaults.
17679
17680 EOM
17681 fi
17682 if $test -f config.msg; then
17683     echo "Hmm.  I also noted the following information while running:"
17684     echo " "
17685     $cat config.msg >&4
17686     $rm -f config.msg
17687 fi
17688 $rm -f kit*isdone ark*isdone
17689 $rm -rf UU
17690
17691 : End of Configure
17692