The problem described in 20010514.031 still wasn't
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue May 15 16:44:30 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_cmsghdr_s=''
328 d_const=''
329 cryptlib=''
330 d_crypt=''
331 d_csh=''
332 full_csh=''
333 d_cuserid=''
334 d_dbl_dig=''
335 d_difftime=''
336 d_dlerror=''
337 d_dlopen=''
338 d_dlsymun=''
339 d_dosuid=''
340 d_suidsafe=''
341 d_drand48proto=''
342 d_dup2=''
343 d_eaccess=''
344 d_endgrent=''
345 d_endhent=''
346 d_endnent=''
347 d_endpent=''
348 d_endpwent=''
349 d_endsent=''
350 d_fchmod=''
351 d_fchown=''
352 d_fcntl=''
353 d_fcntl_can_lock=''
354 d_fd_macros=''
355 d_fd_set=''
356 d_fds_bits=''
357 d_fgetpos=''
358 d_flexfnam=''
359 d_flock=''
360 d_fork=''
361 d_fpos64_t=''
362 d_frexpl=''
363 d_fs_data_s=''
364 d_fseeko=''
365 d_fsetpos=''
366 d_fstatfs=''
367 d_fsync=''
368 d_ftello=''
369 d_ftime=''
370 d_gettimeod=''
371 d_Gconvert=''
372 d_getcwd=''
373 d_getespwnam=''
374 d_getfsstat=''
375 d_getgrent=''
376 d_getgrps=''
377 d_gethbyaddr=''
378 d_gethbyname=''
379 d_gethent=''
380 aphostname=''
381 d_gethname=''
382 d_phostname=''
383 d_uname=''
384 d_gethostprotos=''
385 d_getitimer=''
386 d_getlogin=''
387 d_getmnt=''
388 d_getmntent=''
389 d_getnbyaddr=''
390 d_getnbyname=''
391 d_getnent=''
392 d_getnetprotos=''
393 d_getpagsz=''
394 d_getpent=''
395 d_getpgid=''
396 d_getpgrp2=''
397 d_bsdgetpgrp=''
398 d_getpgrp=''
399 d_getppid=''
400 d_getprior=''
401 d_getpbyname=''
402 d_getpbynumber=''
403 d_getprotoprotos=''
404 d_getprpwnam=''
405 d_getpwent=''
406 d_getsent=''
407 d_getservprotos=''
408 d_getspnam=''
409 d_getsbyname=''
410 d_getsbyport=''
411 d_gnulibc=''
412 d_hasmntopt=''
413 d_htonl=''
414 d_iconv=''
415 d_inetaton=''
416 d_int64_t=''
417 d_isascii=''
418 d_isnan=''
419 d_isnanl=''
420 d_killpg=''
421 d_lchown=''
422 d_ldbl_dig=''
423 d_link=''
424 d_locconv=''
425 d_lockf=''
426 d_longdbl=''
427 longdblsize=''
428 d_longlong=''
429 longlongsize=''
430 d_lseekproto=''
431 d_lstat=''
432 d_madvise=''
433 d_mblen=''
434 d_mbstowcs=''
435 d_mbtowc=''
436 d_memchr=''
437 d_memcmp=''
438 d_memcpy=''
439 d_memmove=''
440 d_memset=''
441 d_mkdir=''
442 d_mkdtemp=''
443 d_mkfifo=''
444 d_mkstemp=''
445 d_mkstemps=''
446 d_mktime=''
447 d_mmap=''
448 mmaptype=''
449 d_modfl=''
450 d_mprotect=''
451 d_msg=''
452 d_msgctl=''
453 d_msgget=''
454 d_msghdr_s=''
455 d_msgrcv=''
456 d_msgsnd=''
457 d_msync=''
458 d_munmap=''
459 d_nice=''
460 d_off64_t=''
461 d_open3=''
462 d_fpathconf=''
463 d_pathconf=''
464 d_pause=''
465 d_pipe=''
466 d_poll=''
467 d_portable=''
468 d_old_pthread_create_joinable=''
469 old_pthread_create_joinable=''
470 d_pthread_yield=''
471 d_sched_yield=''
472 sched_yield=''
473 d_qgcvt=''
474 d_readdir=''
475 d_rewinddir=''
476 d_seekdir=''
477 d_telldir=''
478 d_readlink=''
479 d_readv=''
480 d_recvmsg=''
481 d_rename=''
482 d_rmdir=''
483 d_safebcpy=''
484 d_safemcpy=''
485 d_sanemcmp=''
486 d_sbrkproto=''
487 d_select=''
488 d_sem=''
489 d_semctl=''
490 d_semget=''
491 d_semop=''
492 d_sendmsg=''
493 d_setegid=''
494 d_seteuid=''
495 d_setgrent=''
496 d_setgrps=''
497 d_sethent=''
498 d_setitimer=''
499 d_setlinebuf=''
500 d_setlocale=''
501 d_setnent=''
502 d_setpent=''
503 d_setpgid=''
504 d_setpgrp2=''
505 d_bsdsetpgrp=''
506 d_setpgrp=''
507 d_setprior=''
508 d_setproctitle=''
509 d_setpwent=''
510 d_setregid=''
511 d_setresgid=''
512 d_setresuid=''
513 d_setreuid=''
514 d_setrgid=''
515 d_setruid=''
516 d_setsent=''
517 d_setsid=''
518 d_setvbuf=''
519 d_sfio=''
520 usesfio=''
521 d_shm=''
522 d_shmat=''
523 d_shmatprototype=''
524 shmattype=''
525 d_shmctl=''
526 d_shmdt=''
527 d_shmget=''
528 d_sigaction=''
529 d_sigprocmask=''
530 d_sigsetjmp=''
531 d_sockatmark=''
532 d_msg_ctrunc=''
533 d_msg_dontroute=''
534 d_msg_oob=''
535 d_msg_peek=''
536 d_msg_proxy=''
537 d_oldsock=''
538 d_scm_rights=''
539 d_socket=''
540 d_sockpair=''
541 sockethdr=''
542 socketlib=''
543 d_socklen_t=''
544 d_socks5_init=''
545 d_sqrtl=''
546 d_statblks=''
547 d_statfs_f_flags=''
548 d_statfs_s=''
549 d_fstatvfs=''
550 d_statvfs=''
551 d_stdio_cnt_lval=''
552 d_stdio_ptr_lval=''
553 d_stdio_ptr_lval_nochange_cnt=''
554 d_stdio_ptr_lval_sets_cnt=''
555 d_stdiobase=''
556 d_stdstdio=''
557 stdio_base=''
558 stdio_bufsiz=''
559 stdio_cnt=''
560 stdio_filbuf=''
561 stdio_ptr=''
562 d_index=''
563 d_strchr=''
564 d_strcoll=''
565 d_strctcpy=''
566 d_strerrm=''
567 d_strerror=''
568 d_sysernlst=''
569 d_syserrlst=''
570 d_strftime=''
571 d_strtod=''
572 d_strtol=''
573 d_strtold=''
574 d_strtoll=''
575 d_strtoq=''
576 d_strtoul=''
577 d_strtoull=''
578 d_strtouq=''
579 d_strxfrm=''
580 d_symlink=''
581 d_syscall=''
582 d_sysconf=''
583 d_system=''
584 d_tcgetpgrp=''
585 d_tcsetpgrp=''
586 d_telldirproto=''
587 d_time=''
588 timetype=''
589 clocktype=''
590 d_times=''
591 d_truncate=''
592 d_tzname=''
593 d_u32align=''
594 d_ualarm=''
595 d_umask=''
596 d_semctl_semid_ds=''
597 d_semctl_semun=''
598 d_union_semun=''
599 d_usleep=''
600 d_ustat=''
601 d_vfork=''
602 usevfork=''
603 d_voidsig=''
604 signal_t=''
605 d_volatile=''
606 d_charvspr=''
607 d_vprintf=''
608 d_wait4=''
609 d_waitpid=''
610 d_wcstombs=''
611 d_wctomb=''
612 d_writev=''
613 dlext=''
614 cccdlflags=''
615 ccdlflags=''
616 dlsrc=''
617 ld=''
618 lddlflags=''
619 usedl=''
620 doublesize=''
621 ebcdic=''
622 fflushNULL=''
623 fflushall=''
624 fpossize=''
625 fpostype=''
626 gccosandvers=''
627 gccversion=''
628 gidformat=''
629 gidsign=''
630 gidsize=''
631 gidtype=''
632 groupstype=''
633 h_fcntl=''
634 h_sysfile=''
635 i_arpainet=''
636 db_hashtype=''
637 db_prefixtype=''
638 i_db=''
639 i_dbm=''
640 i_rpcsvcdbm=''
641 d_dirnamlen=''
642 direntrytype=''
643 i_dirent=''
644 i_dld=''
645 i_dlfcn=''
646 i_fcntl=''
647 i_float=''
648 i_gdbm=''
649 d_grpasswd=''
650 i_grp=''
651 i_iconv=''
652 i_ieeefp=''
653 i_inttypes=''
654 i_libutil=''
655 i_limits=''
656 i_locale=''
657 i_machcthr=''
658 i_malloc=''
659 i_math=''
660 i_memory=''
661 i_mntent=''
662 i_ndbm=''
663 i_netdb=''
664 i_neterrno=''
665 i_netinettcp=''
666 i_niin=''
667 i_sysin=''
668 i_poll=''
669 i_prot=''
670 i_pthread=''
671 d_pwage=''
672 d_pwchange=''
673 d_pwclass=''
674 d_pwcomment=''
675 d_pwexpire=''
676 d_pwgecos=''
677 d_pwpasswd=''
678 d_pwquota=''
679 i_pwd=''
680 i_sfio=''
681 i_shadow=''
682 i_socks=''
683 i_stddef=''
684 i_stdlib=''
685 i_string=''
686 strings=''
687 i_sunmath=''
688 i_sysaccess=''
689 i_sysdir=''
690 i_sysfile=''
691 d_voidtty=''
692 i_bsdioctl=''
693 i_sysfilio=''
694 i_sysioctl=''
695 i_syssockio=''
696 i_syslog=''
697 i_sysmman=''
698 i_sysmode=''
699 i_sysmount=''
700 i_sysndir=''
701 i_sysparam=''
702 i_sysresrc=''
703 i_syssecrt=''
704 i_sysselct=''
705 i_sysstat=''
706 i_sysstatfs=''
707 i_sysstatvfs=''
708 i_systimes=''
709 i_systypes=''
710 i_sysuio=''
711 i_sysun=''
712 i_sysutsname=''
713 i_sysvfs=''
714 i_syswait=''
715 i_sgtty=''
716 i_termio=''
717 i_termios=''
718 i_systime=''
719 i_systimek=''
720 i_time=''
721 timeincl=''
722 i_unistd=''
723 i_ustat=''
724 i_utime=''
725 i_values=''
726 i_stdarg=''
727 i_varargs=''
728 i_varhdr=''
729 i_vfork=''
730 inc_version_list=''
731 inc_version_list_init=''
732 installprefix=''
733 installprefixexp=''
734 installstyle=''
735 installusrbinperl=''
736 intsize=''
737 longsize=''
738 shortsize=''
739 issymlink=''
740 libc=''
741 ldlibpthname=''
742 libperl=''
743 shrpenv=''
744 useshrplib=''
745 glibpth=''
746 libpth=''
747 loclibpth=''
748 plibpth=''
749 xlibpth=''
750 ignore_versioned_solibs=''
751 libs=''
752 libsdirs=''
753 libsfiles=''
754 libsfound=''
755 libspath=''
756 lns=''
757 d_PRIEUldbl=''
758 d_PRIFUldbl=''
759 d_PRIGUldbl=''
760 d_PRIeldbl=''
761 d_PRIfldbl=''
762 d_PRIgldbl=''
763 d_SCNfldbl=''
764 sPRIEUldbl=''
765 sPRIFUldbl=''
766 sPRIGUldbl=''
767 sPRIeldbl=''
768 sPRIfldbl=''
769 sPRIgldbl=''
770 sSCNfldbl=''
771 lseeksize=''
772 lseektype=''
773 make_set_make=''
774 d_mymalloc=''
775 freetype=''
776 mallocobj=''
777 mallocsrc=''
778 malloctype=''
779 usemymalloc=''
780 installman1dir=''
781 man1dir=''
782 man1direxp=''
783 man1ext=''
784 installman3dir=''
785 man3dir=''
786 man3direxp=''
787 man3ext=''
788 modetype=''
789 multiarch=''
790 mydomain=''
791 myhostname=''
792 phostname=''
793 c=''
794 n=''
795 d_eofnblk=''
796 eagain=''
797 o_nonblock=''
798 rd_nodata=''
799 need_va_copy=''
800 netdb_hlen_type=''
801 netdb_host_type=''
802 netdb_name_type=''
803 netdb_net_type=''
804 groupcat=''
805 hostcat=''
806 passcat=''
807 orderlib=''
808 ranlib=''
809 d_perl_otherlibdirs=''
810 otherlibdirs=''
811 package=''
812 spackage=''
813 pager=''
814 api_revision=''
815 api_subversion=''
816 api_version=''
817 api_versionstring=''
818 patchlevel=''
819 revision=''
820 subversion=''
821 version=''
822 perl5=''
823 perladmin=''
824 perlpath=''
825 d_nv_preserves_uv=''
826 d_nv_preserves_uv_bits=''
827 i16size=''
828 i16type=''
829 i32size=''
830 i32type=''
831 i64size=''
832 i64type=''
833 i8size=''
834 i8type=''
835 ivsize=''
836 ivtype=''
837 nvsize=''
838 nvtype=''
839 u16size=''
840 u16type=''
841 u32size=''
842 u32type=''
843 u64size=''
844 u64type=''
845 u8size=''
846 u8type=''
847 uvsize=''
848 uvtype=''
849 ivdformat=''
850 nvEUformat=''
851 nvFUformat=''
852 nvGUformat=''
853 nveformat=''
854 nvfformat=''
855 nvgformat=''
856 uvXUformat=''
857 uvoformat=''
858 uvuformat=''
859 uvxformat=''
860 pidtype=''
861 prefix=''
862 prefixexp=''
863 installprivlib=''
864 privlib=''
865 privlibexp=''
866 prototype=''
867 ptrsize=''
868 d_PRIXU64=''
869 d_PRId64=''
870 d_PRIi64=''
871 d_PRIo64=''
872 d_PRIu64=''
873 d_PRIx64=''
874 sPRIXU64=''
875 sPRId64=''
876 sPRIi64=''
877 sPRIo64=''
878 sPRIu64=''
879 sPRIx64=''
880 d_quad=''
881 quadkind=''
882 quadtype=''
883 uquadtype=''
884 drand01=''
885 randbits=''
886 randfunc=''
887 randseedtype=''
888 seedfunc=''
889 installscript=''
890 scriptdir=''
891 scriptdirexp=''
892 selectminbits=''
893 selecttype=''
894 sh=''
895 sig_count=''
896 sig_name=''
897 sig_name_init=''
898 sig_num=''
899 sig_num_init=''
900 sig_size=''
901 installsitearch=''
902 sitearch=''
903 sitearchexp=''
904 installsitebin=''
905 sitebin=''
906 sitebinexp=''
907 installsitelib=''
908 sitelib=''
909 sitelib_stem=''
910 sitelibexp=''
911 siteprefix=''
912 siteprefixexp=''
913 sizesize=''
914 sizetype=''
915 so=''
916 socksizetype=''
917 sharpbang=''
918 shsharp=''
919 spitshell=''
920 src=''
921 ssizetype=''
922 startperl=''
923 startsh=''
924 stdchar=''
925 d_stdio_stream_array=''
926 stdio_stream_array=''
927 sysman=''
928 trnl=''
929 uidformat=''
930 uidsign=''
931 uidsize=''
932 uidtype=''
933 archname64=''
934 use64bitall=''
935 use64bitint=''
936 ccflags_uselargefiles=''
937 ldflags_uselargefiles=''
938 libswanted_uselargefiles=''
939 uselargefiles=''
940 uselongdouble=''
941 usemorebits=''
942 usemultiplicity=''
943 nm_opt=''
944 nm_so_opt=''
945 runnm=''
946 usenm=''
947 useperlio=''
948 usesocks=''
949 d_oldpthreads=''
950 use5005threads=''
951 useithreads=''
952 usethreads=''
953 incpath=''
954 mips_type=''
955 usrinc=''
956 d_vendorarch=''
957 installvendorarch=''
958 vendorarch=''
959 vendorarchexp=''
960 d_vendorbin=''
961 installvendorbin=''
962 vendorbin=''
963 vendorbinexp=''
964 d_vendorlib=''
965 installvendorlib=''
966 vendorlib=''
967 vendorlib_stem=''
968 vendorlibexp=''
969 usevendorprefix=''
970 vendorprefix=''
971 vendorprefixexp=''
972 versiononly=''
973 defvoidused=''
974 voidflags=''
975 pm_apiversion=''
976 xs_apiversion=''
977 yacc=''
978 yaccflags=''
979 CONFIG=''
980
981 define='define'
982 undef='undef'
983 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
984 rmlist=''
985
986 : We must find out about Eunice early
987 eunicefix=':'
988 if test -f /etc/unixtovms; then
989         eunicefix=/etc/unixtovms
990 fi
991 if test -f /etc/unixtovms.exe; then
992         eunicefix=/etc/unixtovms.exe
993 fi
994
995 i_whoami=''
996 ccname=''
997 ccversion=''
998 perllibs=''
999 : set useposix=false in your hint file to disable the POSIX extension.
1000 useposix=true
1001 : set useopcode=false in your hint file to disable the Opcode extension.
1002 useopcode=true
1003 : Trailing extension.  Override this in a hint file, if needed.
1004 _exe=''
1005 : Extra object files, if any, needed on this platform.
1006 archobjs=''
1007 archname=''
1008 : Possible local include directories to search.
1009 : Set locincpth to "" in a hint file to defeat local include searches.
1010 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1011 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1012 :
1013 : no include file wanted by default
1014 inclwanted=''
1015
1016 groupstype=''
1017 : change the next line if compiling for Xenix/286 on Xenix/386
1018 xlibpth='/usr/lib/386 /lib/386'
1019 : Possible local library directories to search.
1020 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1021 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1022
1023 : general looking path for locating libraries
1024 glibpth="/lib /usr/lib $xlibpth"
1025 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1026 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1027 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1028
1029 : Private path used by Configure to find libraries.  Its value
1030 : is prepended to libpth. This variable takes care of special
1031 : machines, like the mips.  Usually, it should be empty.
1032 plibpth=''
1033
1034 : default library list
1035 libswanted=''
1036 : some systems want to use only the non-versioned libso:s
1037 ignore_versioned_solibs=''
1038 archname64=''
1039 ccflags_uselargefiles=''
1040 ldflags_uselargefiles=''
1041 libswanted_uselargefiles=''
1042 : set usemultiplicity on the Configure command line to enable multiplicity.
1043 : set usesocks on the Configure command line to enable socks.
1044 : set usethreads on the Configure command line to enable threads.
1045 : full support for void wanted by default
1046 defvoidused=15
1047
1048 : List of libraries we want.
1049 : If anyone needs -lnet, put it in a hint file.
1050 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1051 libswanted="$libswanted dld ld sun m c cposix posix"
1052 libswanted="$libswanted ndir dir crypt sec"
1053 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1054 : We probably want to search /usr/shlib before most other libraries.
1055 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1056 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1057 glibpth="/usr/shlib $glibpth"
1058 : Do not use vfork unless overridden by a hint file.
1059 usevfork=false
1060
1061 : Find the basic shell for Bourne shell scripts
1062 case "$sh" in
1063 '')
1064         case "$SYSTYPE" in
1065         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1066         *) xxx='/bin/sh';;
1067         esac
1068         if test -f "$xxx"; then
1069                 sh="$xxx"
1070         else
1071                 : Build up a list and do a single loop so we can 'break' out.
1072                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1073                 for xxx in sh bash ksh pdksh ash; do
1074                         for p in $pth; do
1075                                 try="$try ${p}/${xxx}"
1076                         done
1077                 done
1078                 for xxx in $try; do
1079                         if test -f "$xxx"; then
1080                                 sh="$xxx";
1081                                 break
1082                         elif test -f "$xxx.exe"; then
1083                                 sh="$xxx";
1084                                 break
1085                         fi
1086                 done
1087         fi
1088         ;;
1089 esac
1090
1091 case "$sh" in
1092 '')     cat <<EOM >&2
1093 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1094
1095 Usually it's in /bin/sh.  How did you even get this far?
1096 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1097 we'll try to straighten this all out.
1098 EOM
1099         exit 1
1100         ;;
1101 esac
1102
1103 : see if sh knows # comments
1104 if `$sh -c '#' >/dev/null 2>&1`; then
1105         shsharp=true
1106         spitshell=cat
1107         xcat=/bin/cat
1108         test -f $xcat || xcat=/usr/bin/cat
1109         echo "#!$xcat" >try
1110         $eunicefix try
1111         chmod +x try
1112         ./try > today
1113         if test -s today; then
1114                 sharpbang='#!'
1115         else
1116                 echo "#! $xcat" > try
1117                 $eunicefix try
1118                 chmod +x try
1119                 ./try > today
1120                 if test -s today; then
1121                         sharpbang='#! '
1122                 else
1123                         sharpbang=': use '
1124                 fi
1125         fi
1126 else
1127         echo " "
1128         echo "Your $sh doesn't grok # comments--I will strip them later on."
1129         shsharp=false
1130         cd ..
1131         echo "exec grep -v '^[  ]*#'" >spitshell
1132         chmod +x spitshell
1133         $eunicefix spitshell
1134         spitshell=`pwd`/spitshell
1135         cd UU
1136         echo "I presume that if # doesn't work, #! won't work either!"
1137         sharpbang=': use '
1138 fi
1139 rm -f try today
1140
1141 : figure out how to guarantee sh startup
1142 case "$startsh" in
1143 '') startsh=${sharpbang}${sh} ;;
1144 *)
1145 esac
1146 cat >try <<EOSS
1147 $startsh
1148 set abc
1149 test "$?abc" != 1
1150 EOSS
1151
1152 chmod +x try
1153 $eunicefix try
1154 if ./try; then
1155         : echo "Yup, it does."
1156 else
1157         echo "Hmm... '$startsh' does not guarantee sh startup..."
1158         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1159 fi
1160 rm -f try
1161
1162
1163 : Save command line options in file UU/cmdline.opt for later use in
1164 : generating config.sh.
1165 cat > cmdline.opt <<EOSH
1166 # Configure command line arguments.
1167 config_arg0='$0'
1168 config_args='$*'
1169 config_argc=$#
1170 EOSH
1171 argn=1
1172 for arg in "$@"; do
1173         cat >>cmdline.opt <<EOSH
1174 config_arg$argn='$arg'
1175 EOSH
1176         argn=`expr $argn + 1`
1177 done
1178
1179 : produce awk script to parse command line options
1180 cat >options.awk <<'EOF'
1181 BEGIN {
1182         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1183
1184         len = length(optstr);
1185         for (i = 1; i <= len; i++) {
1186                 c = substr(optstr, i, 1);
1187                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1188                 if (a == ":") {
1189                         arg[c] = 1;
1190                         i++;
1191                 }
1192                 opt[c] = 1;
1193         }
1194 }
1195 {
1196         expect = 0;
1197         str = $0;
1198         if (substr(str, 1, 1) != "-") {
1199                 printf("'%s'\n", str);
1200                 next;
1201         }
1202         len = length($0);
1203         for (i = 2; i <= len; i++) {
1204                 c = substr(str, i, 1);
1205                 if (!opt[c]) {
1206                         printf("-%s\n", substr(str, i));
1207                         next;
1208                 }
1209                 printf("-%s\n", c);
1210                 if (arg[c]) {
1211                         if (i < len)
1212                                 printf("'%s'\n", substr(str, i + 1));
1213                         else
1214                                 expect = 1;
1215                         next;
1216                 }
1217         }
1218 }
1219 END {
1220         if (expect)
1221                 print "?";
1222 }
1223 EOF
1224
1225 : process the command line options
1226 set X `for arg in "$@"; do echo "X$arg"; done |
1227         sed -e s/X// | awk -f options.awk`
1228 eval "set $*"
1229 shift
1230 rm -f options.awk
1231
1232 : set up default values
1233 fastread=''
1234 reuseval=false
1235 config_sh=''
1236 alldone=''
1237 error=''
1238 silent=''
1239 extractsh=''
1240 override=''
1241 knowitall=''
1242 rm -f optdef.sh posthint.sh
1243 cat >optdef.sh <<EOS
1244 $startsh
1245 EOS
1246
1247
1248 : option parsing
1249 while test $# -gt 0; do
1250         case "$1" in
1251         -d) shift; fastread=yes;;
1252         -e) shift; alldone=cont;;
1253         -f)
1254                 shift
1255                 cd ..
1256                 if test -r "$1"; then
1257                         config_sh="$1"
1258                 else
1259                         echo "$me: cannot read config file $1." >&2
1260                         error=true
1261                 fi
1262                 cd UU
1263                 shift;;
1264         -h) shift; error=true;;
1265         -r) shift; reuseval=true;;
1266         -s) shift; silent=true; realsilent=true;;
1267         -E) shift; alldone=exit;;
1268         -K) shift; knowitall=true;;
1269         -O) shift; override=true;;
1270         -S) shift; silent=true; extractsh=true;;
1271         -D)
1272                 shift
1273                 case "$1" in
1274                 *=)
1275                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1276                         echo "$me: ignoring -D $1" >&2
1277                         ;;
1278                 *=*) echo "$1" | \
1279                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1280                 *) echo "$1='define'" >> optdef.sh;;
1281                 esac
1282                 shift
1283                 ;;
1284         -U)
1285                 shift
1286                 case "$1" in
1287                 *=) echo "$1" >> optdef.sh;;
1288                 *=*)
1289                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1290                         echo "$me: ignoring -U $1" >&2
1291                         ;;
1292                 *) echo "$1='undef'" >> optdef.sh;;
1293                 esac
1294                 shift
1295                 ;;
1296         -A)
1297             shift
1298             xxx=''
1299             yyy="$1"
1300             zzz=''
1301             uuu=undef
1302             case "$yyy" in
1303             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1304                  case "$zzz" in
1305                  *:*) zzz='' ;;
1306                  *)   xxx=append
1307                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1308                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1309                  esac
1310                  ;;
1311             esac
1312             case "$xxx" in
1313             '')  case "$yyy" in
1314                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1315                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1316                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1317                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1318                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1319                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1320                  esac
1321                  ;;       
1322             esac
1323             case "$xxx" in
1324             append)
1325                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1326             clear)
1327                 echo "$yyy=''"                  >> posthint.sh ;;
1328             define)
1329                 case "$zzz" in
1330                 '') zzz=define ;;
1331                 esac
1332                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1333             eval)
1334                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1335             prepend)
1336                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1337             undef)
1338                 case "$zzz" in
1339                 '') zzz="$uuu" ;;
1340                 esac
1341                 echo "$yyy=$zzz"                >> posthint.sh ;;
1342             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1343             esac
1344             shift
1345             ;;
1346         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1347             exit 0;;
1348         --) break;;
1349         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1350         *) break;;
1351         esac
1352 done
1353
1354 case "$error" in
1355 true)
1356         cat >&2 <<EOM
1357 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1358                  [-U symbol] [-U symbol=] [-A command:symbol...]
1359   -d : use defaults for all answers.
1360   -e : go on without questioning past the production of config.sh.
1361   -f : specify an alternate default configuration file.
1362   -h : print this help message and exit (with an error status).
1363   -r : reuse C symbols value if possible (skips costly nm extraction).
1364   -s : silent mode, only echoes questions and essential information.
1365   -D : define symbol to have some value:
1366          -D symbol         symbol gets the value 'define'
1367          -D symbol=value   symbol gets the value 'value'
1368   -E : stop at the end of questions, after having produced config.sh.
1369   -K : do not use unless you know what you are doing.
1370   -O : let -D and -U override definitions from loaded configuration file.
1371   -S : perform variable substitutions on all .SH files (can mix with -f)
1372   -U : undefine symbol:
1373          -U symbol    symbol gets the value 'undef'
1374          -U symbol=   symbol gets completely empty
1375   -A : manipulate symbol after the platform specific hints have been applied:
1376          -A symbol=value                append " "value to symbol
1377          -A append:symbol=value         append value to symbol
1378          -A define:symbol=value         define symbol to have value
1379          -A clear:symbol                define symbol to be ''
1380          -A define:symbol               define symbol to be 'define'
1381          -A eval:symbol=value           define symbol to be eval of value
1382          -A prepend:symbol=value        prepend value to symbol
1383          -A undef:symbol                define symbol to be 'undef'
1384          -A undef:symbol=               define symbol to be ''
1385   -V : print version number and exit (with a zero status).
1386 EOM
1387         exit 1
1388         ;;
1389 esac
1390
1391 : Sanity checks
1392 case "$fastread$alldone" in
1393 yescont|yesexit) ;;
1394 *)
1395         case "$extractsh" in
1396         true) ;;
1397         *)
1398                 if test ! -t 0; then
1399                         echo "Say 'sh Configure', not 'sh <Configure'"
1400                         exit 1
1401                 fi
1402                 ;;
1403         esac
1404         ;;
1405 esac
1406
1407 exec 4>&1
1408 case "$silent" in
1409 true) exec 1>/dev/null;;
1410 esac
1411
1412 : run the defines and the undefines, if any, but leave the file out there...
1413 touch optdef.sh
1414 . ./optdef.sh
1415 : create the posthint manipulation script and leave the file out there...
1416 touch posthint.sh
1417
1418 : set package name
1419 package=perl5
1420 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1421 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1422 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1423 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1424 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1425 esac
1426
1427 : Some greps do not return status, grrr.
1428 echo "grimblepritz" >grimble
1429 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1430         contains=contains
1431 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1432         contains=grep
1433 else
1434         contains=contains
1435 fi
1436 rm -f grimble
1437 : the following should work in any shell
1438 case "$contains" in
1439 contains*)
1440         echo " "
1441         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1442         cat >contains <<'EOSS'
1443 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1444 EOSS
1445 chmod +x contains
1446 esac
1447
1448 : Find the path to the source tree
1449 case "$src" in
1450 '') case "$0" in
1451     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1452          case "$src" in
1453          /*)    ;;
1454          .)     ;;
1455          *)     src=`cd ../$src && pwd` ;;
1456          esac
1457          ;;
1458     *)   src='.';;
1459     esac;;
1460 esac
1461 case "$src" in
1462 '')     src=/
1463         rsrc=/
1464         ;;
1465 /*) rsrc="$src";;
1466 *) rsrc="../$src";;
1467 esac
1468 if test -f $rsrc/Configure && \
1469         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1470 then
1471    : found it, so we are ok.
1472 else
1473         rsrc=''
1474         for src in . .. ../.. ../../.. ../../../..; do
1475                 if test -f ../$src/Configure && \
1476                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1477                 then
1478                         rsrc=../$src
1479                         break
1480                 fi
1481         done
1482 fi
1483 case "$rsrc" in
1484 '')
1485         cat <<EOM >&4
1486
1487 Sorry, I can't seem to locate the source dir for $package.  Please start
1488 Configure with an explicit path -- i.e. /some/path/Configure.
1489
1490 EOM
1491         exit 1
1492         ;;
1493 ../.)   rsrc='..';;
1494 *)
1495         echo " "
1496         echo "Sources for $package found in \"$src\"." >&4
1497         ;;
1498 esac
1499
1500 : script used to extract .SH files with variable substitutions
1501 cat >extract <<'EOS'
1502 PERL_CONFIG_SH=true
1503 echo "Doing variable substitutions on .SH files..."
1504 if test -f $src/MANIFEST; then
1505         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1506 else
1507         echo "(Looking for .SH files under the source directory.)"
1508         set x `(cd $src; find . -name "*.SH" -print)`
1509 fi
1510 shift
1511 case $# in
1512 0) set x `(cd $src; echo *.SH)`; shift;;
1513 esac
1514 if test ! -f $src/$1; then
1515         shift
1516 fi
1517 mkdir_p='
1518 name=$1;
1519 create="";
1520 while test $name; do
1521         if test ! -d "$name"; then
1522                 create="$name $create";
1523                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1524                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1525         else
1526                 name="";
1527         fi;
1528 done;
1529 for file in $create; do
1530         mkdir $file;
1531 done
1532 '
1533 for file in $*; do
1534         case "$src" in
1535         ".")
1536                 case "$file" in
1537                 */*)
1538                         dir=`expr X$file : 'X\(.*\)/'`
1539                         file=`expr X$file : 'X.*/\(.*\)'`
1540                         (cd $dir && . ./$file)
1541                         ;;
1542                 *)
1543                         . ./$file
1544                         ;;
1545                 esac
1546                 ;;
1547         *)
1548                 case "$file" in
1549                 */*)
1550                         dir=`expr X$file : 'X\(.*\)/'`
1551                         file=`expr X$file : 'X.*/\(.*\)'`
1552                         (set x $dir; shift; eval $mkdir_p)
1553                         sh <$src/$dir/$file
1554                         ;;
1555                 *)
1556                         sh <$src/$file
1557                         ;;
1558                 esac
1559                 ;;
1560         esac
1561 done
1562 if test -f $src/config_h.SH; then
1563         if test ! -f config.h; then
1564         : oops, they left it out of MANIFEST, probably, so do it anyway.
1565         . $src/config_h.SH
1566         fi
1567 fi
1568 EOS
1569
1570 : extract files and exit if asked to do so
1571 case "$extractsh" in
1572 true)
1573         case "$realsilent" in
1574         true) ;;
1575         *) exec 1>&4;;
1576         esac
1577         case "$config_sh" in
1578         '') config_sh='config.sh';;
1579         esac
1580         echo " "
1581         echo "Fetching answers from $config_sh..."
1582         cd ..
1583         . $config_sh
1584         test "$override" && . ./optdef.sh
1585         echo " "
1586         . UU/extract
1587         rm -rf UU
1588         echo "Done."
1589         exit 0
1590         ;;
1591 esac
1592
1593 : Eunice requires " " instead of "", can you believe it
1594 echo " "
1595 : Here we go...
1596 echo "Beginning of configuration questions for $package."
1597
1598 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1599
1600 : first determine how to suppress newline on echo command
1601 echo " "
1602 echo "Checking echo to see how to suppress newlines..."
1603 (echo "hi there\c" ; echo " ") >.echotmp
1604 if $contains c .echotmp >/dev/null 2>&1 ; then
1605         echo "...using -n."
1606         n='-n'
1607         c=''
1608 else
1609         cat <<'EOM'
1610 ...using \c
1611 EOM
1612         n=''
1613         c='\c'
1614 fi
1615 echo $n "The star should be here-->$c"
1616 echo '*'
1617 rm -f .echotmp
1618
1619 : Now test for existence of everything in MANIFEST
1620 echo " "
1621 if test -f $rsrc/MANIFEST; then
1622         echo "First let's make sure your kit is complete.  Checking..." >&4
1623         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1624         rm -f missing
1625         tmppwd=`pwd`
1626         for filelist in x??; do
1627                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1628         done
1629         if test -s missing; then
1630                 cat missing >&4
1631                 cat >&4 <<'EOM'
1632
1633 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1634
1635 You have the option of continuing the configuration process, despite the
1636 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1637 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1638 and contact the author (perlbug@perl.org).
1639
1640 EOM
1641                 echo $n "Continue? [n] $c" >&4
1642                 read ans
1643                 case "$ans" in
1644                 y*)
1645                         echo "Continuing..." >&4
1646                         rm -f missing
1647                         ;;
1648                 *)
1649                         echo "ABORTING..." >&4
1650                         kill $$
1651                         ;;
1652                 esac
1653         else
1654                 echo "Looks good..."
1655         fi
1656 else
1657         echo "There is no MANIFEST file.  I hope your kit is complete !"
1658 fi
1659 rm -f missing x??
1660
1661 echo " "
1662 : Find the appropriate value for a newline for tr
1663 if test -n "$DJGPP"; then
1664        trnl='\012'
1665 fi
1666 if test X"$trnl" = X; then
1667         case "`echo foo|tr '\n' x 2>/dev/null`" in
1668         foox) trnl='\n' ;;
1669         esac
1670 fi
1671 if test X"$trnl" = X; then
1672         case "`echo foo|tr '\012' x 2>/dev/null`" in
1673         foox) trnl='\012' ;;
1674         esac
1675 fi
1676 if test X"$trnl" = X; then
1677         cat <<EOM >&2
1678
1679 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1680
1681 EOM
1682         exit 1
1683 fi
1684
1685 : compute the number of columns on the terminal for proper question formatting
1686 case "$COLUMNS" in
1687 '') COLUMNS='80';;
1688 esac
1689
1690 : set up the echo used in my read
1691 myecho="case \"\$xxxm\" in
1692 '') echo $n \"\$rp $c\" >&4;;
1693 *) case \"\$rp\" in
1694         '') echo $n \"[\$xxxm] $c\";;
1695         *)
1696                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1697                         echo \"\$rp\" >&4
1698                         echo $n \"[\$xxxm] $c\" >&4
1699                 else
1700                         echo $n \"\$rp [\$xxxm] $c\" >&4
1701                 fi
1702                 ;;
1703         esac;;
1704 esac"
1705
1706 : now set up to do reads with possible shell escape and default assignment
1707 cat <<EOSC >myread
1708 $startsh
1709 xxxm=\$dflt
1710 $myecho
1711 ans='!'
1712 case "\$fastread" in
1713 yes) case "\$dflt" in
1714         '') ;;
1715         *) ans='';
1716                 case "\$silent-\$rp" in
1717                 true-) ;;
1718                 *) echo " " >&4;;
1719                 esac;;
1720         esac;;
1721 *) case "\$silent" in
1722         true) case "\$rp" in
1723                 '') ans='';;
1724                 esac;;
1725         esac;;
1726 esac
1727 while expr "X\$ans" : "X!" >/dev/null; do
1728         read answ
1729         set x \$xxxm
1730         shift
1731         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1732         case  "\$answ" in
1733         "!")
1734                 sh 1>&4
1735                 echo " "
1736                 $myecho
1737                 ;;
1738         !*)
1739                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1740                 shift
1741                 sh 1>&4 -c "\$*"
1742                 echo " "
1743                 $myecho
1744                 ;;
1745         "\$ans")
1746                 case "\$ans" in
1747                 \\&*)
1748                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1749                         shift
1750                         case "\$1" in
1751                         -d)
1752                                 fastread=yes
1753                                 echo "(OK, I'll run with -d after this question.)" >&4
1754                                 ;;
1755                         -*)
1756                                 echo "*** Sorry, \$1 not supported yet." >&4
1757                                 ;;
1758                         esac
1759                         $myecho
1760                         ans=!
1761                         ;;
1762                 esac;;
1763         *)
1764                 case "\$aok" in
1765                 y)
1766                         echo "*** Substitution done -- please confirm."
1767                         xxxm="\$ans"
1768                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1769                         xxxm="\$ans"
1770                         ans=!
1771                         ;;
1772                 *)
1773                         echo "*** Error -- try again."
1774                         ans=!
1775                         ;;
1776                 esac
1777                 $myecho
1778                 ;;
1779         esac
1780         case "\$ans\$xxxm\$nostick" in
1781         '')
1782                 ans=!
1783                 $myecho
1784                 ;;
1785         esac
1786 done
1787 case "\$ans" in
1788 '') ans="\$xxxm";;
1789 esac
1790 EOSC
1791
1792 : create .config dir to save info across Configure sessions
1793 test -d ../.config || mkdir ../.config
1794 cat >../.config/README <<EOF
1795 This directory created by Configure to save information that should
1796 persist across sessions for $package.
1797
1798 You may safely delete it if you wish.
1799 EOF
1800
1801 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1802 case "$usedevel" in
1803 $define|true|[yY]*) ;;
1804 *) case "$xversion" in
1805    *[13579])
1806         cat >&4 <<EOH
1807 *** WHOA THERE!!! ***
1808
1809     This is an UNSTABLE DEVELOPMENT release.
1810     The version of this $package distribution is $xversion, that is, odd,
1811     (as opposed to even) and that signifies a development release.
1812     If you want a maintenance release, you want an even-numbered version.
1813
1814     Do ***NOT*** install this into production use.
1815     Data corruption and crashes are possible.
1816
1817     It is most seriously suggested that you do not continue any further
1818     unless you want to help in developing and debugging Perl.
1819
1820     If you *still* want to build perl, you can answer 'y' now,
1821     or pass -Dusedevel to Configure.
1822
1823 EOH
1824         rp='Do you really want to continue?'
1825         dflt='n'
1826         . ./myread
1827         case "$ans" in
1828         [yY]) echo >&4 "Okay, continuing."
1829               usedevel="$define" ;;
1830         *) echo >&4 "Okay, bye."
1831            exit 1
1832            ;;
1833         esac
1834         ;;
1835     esac
1836     ;;
1837 esac
1838 case "$usedevel" in
1839 $define|true|[yY]*)
1840         case "$versiononly" in
1841         '') versiononly="$define" ;;
1842         esac
1843         case "$installusrbinperl" in
1844         '') installusrbinperl="$undef" ;;
1845         esac
1846         ;;
1847 esac
1848
1849 : general instructions
1850 needman=true
1851 firsttime=true
1852 user=`(logname) 2>/dev/null`
1853 case "$user" in
1854 '') user=`whoami 2>&1`;;
1855 esac
1856 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1857         firsttime=false
1858         echo " "
1859         rp='Would you like to see the instructions?'
1860         dflt=n
1861         . ./myread
1862         case "$ans" in
1863         [yY]*) ;;
1864         *) needman=false;;
1865         esac
1866 fi
1867 if $needman; then
1868         cat <<EOH
1869
1870 This installation shell script will examine your system and ask you questions
1871 to determine how the perl5 package should be installed. If you get
1872 stuck on a question, you may use a ! shell escape to start a subshell or
1873 execute a command.  Many of the questions will have default answers in square
1874 brackets; typing carriage return will give you the default.
1875
1876 On some of the questions which ask for file or directory names you are allowed
1877 to use the ~name construct to specify the login directory belonging to "name",
1878 even if you don't have a shell which knows about that.  Questions where this is
1879 allowed will be marked "(~name ok)".
1880
1881 EOH
1882         rp=''
1883         dflt='Type carriage return to continue'
1884         . ./myread
1885         cat <<'EOH'
1886
1887 The prompter used in this script allows you to use shell variables and
1888 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1889 in the default answer, as if the default line was a set of arguments given to a
1890 script shell.  This means you may also use $* to repeat the whole default line,
1891 so you do not have to re-type everything to add something to the default.
1892
1893 Everytime there is a substitution, you will have to confirm.  If there is an
1894 error (e.g. an unmatched backtick), the default answer will remain unchanged
1895 and you will be prompted again.
1896
1897 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1898 the questions and use the computed defaults (or the previous answers if there
1899 was already a config.sh file). Type 'Configure -h' for a list of options.
1900 You may also start interactively and then answer '& -d' at any prompt to turn
1901 on the non-interactive behaviour for the remainder of the execution.
1902
1903 EOH
1904         . ./myread
1905         cat <<EOH
1906
1907 Much effort has been expended to ensure that this shell script will run on any
1908 Unix system.  If despite that it blows up on yours, your best bet is to edit
1909 Configure and run it again.  If you can't run Configure for some reason,
1910 you'll have to generate a config.sh file by hand.  Whatever problems you
1911 have, let me (perlbug@perl.org) know how I blew it.
1912
1913 This installation script affects things in two ways:
1914
1915 1) it may do direct variable substitutions on some of the files included
1916    in this kit.
1917 2) it builds a config.h file for inclusion in C programs.  You may edit
1918    any of these files as the need arises after running this script.
1919
1920 If you make a mistake on a question, there is no easy way to back up to it
1921 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1922 files.  Configure will offer to let you do this before it runs the SH files.
1923
1924 EOH
1925         dflt='Type carriage return to continue'
1926         . ./myread
1927         case "$firsttime" in
1928         true) echo $user >>../.config/instruct;;
1929         esac
1930 fi
1931
1932 : find out where common programs are
1933 echo " "
1934 echo "Locating common programs..." >&4
1935 cat <<EOSC >loc
1936 $startsh
1937 case \$# in
1938 0) exit 1;;
1939 esac
1940 thing=\$1
1941 shift
1942 dflt=\$1
1943 shift
1944 for dir in \$*; do
1945         case "\$thing" in
1946         .)
1947         if test -d \$dir/\$thing; then
1948                 echo \$dir
1949                 exit 0
1950         fi
1951         ;;
1952         *)
1953         for thisthing in \$dir/\$thing; do
1954                 : just loop through to pick last item
1955         done
1956         if test -f \$thisthing; then
1957                 echo \$thisthing
1958                 exit 0
1959         elif test -f \$dir/\$thing.exe; then
1960                 if test -n "$DJGPP"; then
1961                         echo \$dir/\$thing.exe
1962                 else
1963                         : on Eunice apparently
1964                         echo \$dir/\$thing
1965                 fi
1966                 exit 0
1967         fi
1968         ;;
1969         esac
1970 done
1971 echo \$dflt
1972 exit 1
1973 EOSC
1974 chmod +x loc
1975 $eunicefix loc
1976 loclist="
1977 awk
1978 cat
1979 comm
1980 cp
1981 echo
1982 expr
1983 grep
1984 ls
1985 make
1986 mkdir
1987 rm
1988 sed
1989 sort
1990 touch
1991 tr
1992 uniq
1993 "
1994 trylist="
1995 Mcc
1996 ar
1997 bison
1998 byacc
1999 cpp
2000 csh
2001 date
2002 egrep
2003 gzip
2004 less
2005 ln
2006 more
2007 nm
2008 nroff
2009 pg
2010 test
2011 uname
2012 zip
2013 "
2014 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2015 pth="$pth /lib /usr/lib"
2016 for file in $loclist; do
2017         eval xxx=\$$file
2018         case "$xxx" in
2019         /*|?:[\\/]*)
2020                 if test -f "$xxx"; then
2021                         : ok
2022                 else
2023                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2024                         xxx=`./loc $file $file $pth`
2025                 fi
2026                 ;;
2027         '') xxx=`./loc $file $file $pth`;;
2028         *) xxx=`./loc $xxx $xxx $pth`;;
2029         esac
2030         eval $file=$xxx
2031         eval _$file=$xxx
2032         case "$xxx" in
2033         /*)
2034                 echo $file is in $xxx.
2035                 ;;
2036         ?:[\\/]*)
2037                 echo $file is in $xxx.
2038                 ;;
2039         *)
2040                 echo "I don't know where '$file' is, and my life depends on it." >&4
2041                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2042                 exit 1
2043                 ;;
2044         esac
2045 done
2046 echo " "
2047 echo "Don't worry if any of the following aren't found..."
2048 say=offhand
2049 for file in $trylist; do
2050         eval xxx=\$$file
2051         case "$xxx" in
2052         /*|?:[\\/]*)
2053                 if test -f "$xxx"; then
2054                         : ok
2055                 else
2056                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2057                         xxx=`./loc $file $file $pth`
2058                 fi
2059                 ;;
2060         '') xxx=`./loc $file $file $pth`;;
2061         *) xxx=`./loc $xxx $xxx $pth`;;
2062         esac
2063         eval $file=$xxx
2064         eval _$file=$xxx
2065         case "$xxx" in
2066         /*)
2067                 echo $file is in $xxx.
2068                 ;;
2069         ?:[\\/]*)
2070                 echo $file is in $xxx.
2071                 ;;
2072         *)
2073                 echo "I don't see $file out there, $say."
2074                 say=either
2075                 ;;
2076         esac
2077 done
2078 case "$egrep" in
2079 egrep)
2080         echo "Substituting grep for egrep."
2081         egrep=$grep
2082         ;;
2083 esac
2084 case "$ln" in
2085 ln)
2086         echo "Substituting cp for ln."
2087         ln=$cp
2088         ;;
2089 esac
2090 case "$test" in
2091 test)
2092         echo "Hopefully test is built into your sh."
2093         ;;
2094 *)
2095         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2096                 echo "Using the test built into your sh."
2097                 test=test
2098                 _test=test
2099         fi
2100         ;;
2101 esac
2102 case "$echo" in
2103 echo)
2104         echo "Hopefully echo is built into your sh."
2105         ;;
2106 '') ;;
2107 *)
2108         echo " "
2109 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2110         $echo $n "hi there$c" >foo1
2111         echo $n "hi there$c" >foo2
2112         if cmp foo1 foo2 >/dev/null 2>&1; then
2113                 echo "They are compatible.  In fact, they may be identical."
2114         else
2115                 case "$n" in
2116                 '-n') n='' c='\c';;
2117                 *) n='-n' c='';;
2118                 esac
2119                 cat <<FOO
2120 They are not compatible!  You are probably running ksh on a non-USG system.
2121 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2122 have echo built in and we may have to run some Bourne shell scripts.  That
2123 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2124
2125 FOO
2126                 $echo $n "The star should be here-->$c"
2127                 $echo "*"
2128         fi
2129         $rm -f foo1 foo2
2130         ;;
2131 esac
2132
2133 cat <<EOS >checkcc
2134 $startsh
2135 EOS
2136 cat <<'EOSC' >>checkcc
2137 case "$cc" in
2138 '') ;;
2139 *)  $rm -f try try.*
2140     $cat >try.c <<EOM
2141 int main(int argc, char *argv[]) {
2142   return 0;
2143 }
2144 EOM
2145     if $cc -o try $ccflags $ldflags try.c; then
2146        :
2147     else
2148         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2149         despair=yes
2150         trygcc=yes
2151         case "$cc" in
2152         *gcc*) trygcc=no ;;
2153         esac
2154         case "`$cc -v -c try.c 2>&1`" in
2155         *gcc*) trygcc=no ;;
2156         esac
2157         if $test X"$trygcc" = Xyes; then
2158             if gcc -o try -c try.c; then
2159                 echo " "
2160                 echo "You seem to have a working gcc, though." >&4
2161                 rp="Would you like to use it?"
2162                 dflt=y
2163                 if $test -f myread; then
2164                     . ./myread
2165                 else
2166                     if $test -f UU/myread; then
2167                         . ./UU/myread
2168                     else
2169                         echo "Cannot find myread, sorry.  Aborting." >&2
2170                         exit 1
2171                     fi
2172                 fi  
2173                 case "$ans" in
2174                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2175                 esac
2176             fi
2177         fi
2178         if $test X"$despair" = Xyes; then
2179             $cat >&4 <<EOM
2180 You need to find a working C compiler.
2181 Either (purchase and) install the C compiler supplied by your OS vendor,
2182 or for a free C compiler try http://gcc.gnu.org/
2183 I cannot continue any further, aborting.
2184 EOM
2185             exit 1
2186         fi
2187     fi
2188     $rm -f try try.*
2189     ;;
2190 esac
2191 EOSC
2192
2193 : determine whether symbolic links are supported
2194 echo " "
2195 $touch blurfl
2196 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2197         echo "Symbolic links are supported." >&4
2198         lns="$ln -s"
2199 else
2200         echo "Symbolic links are NOT supported." >&4
2201         lns="$ln"
2202 fi
2203 $rm -f blurfl sym
2204
2205 : determine whether symbolic links are supported
2206 echo " "
2207 case "$lns" in
2208 *"ln -s")
2209         echo "Checking how to test for symbolic links..." >&4
2210         $lns blurfl sym
2211         if $test "X$issymlink" = X; then
2212                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2213                 if test $? = 0; then
2214                         issymlink="test -h"
2215                 fi              
2216         fi
2217         if $test "X$issymlink" = X; then
2218                 if  $test -h >/dev/null 2>&1; then
2219                         issymlink="$test -h"
2220                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2221                 fi              
2222         fi
2223         if $test "X$issymlink" = X; then
2224                 if $test -L sym 2>/dev/null; then
2225                         issymlink="$test -L"
2226                 fi
2227         fi
2228         if $test "X$issymlink" != X; then
2229                 echo "You can test for symbolic links with '$issymlink'." >&4
2230         else
2231                 echo "I do not know how you can test for symbolic links." >&4
2232         fi
2233         $rm -f blurfl sym
2234         ;;
2235 *)      echo "No symbolic links, so not testing for their testing..." >&4
2236         ;;
2237 esac
2238 echo " "
2239
2240
2241 case "$mksymlinks" in
2242 $define|true|[yY]*)
2243         case "$src" in
2244         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2245                 exit 1
2246                 ;;
2247         *)      case "$lns:$issymlink" in
2248                 *"ln -s:"*"test -"?)
2249                         echo "Creating the symbolic links..." >&4
2250                         echo "(First creating the subdirectories...)" >&4
2251                         cd ..
2252                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2253                                 read directory
2254                                 test -z "$directory" && break
2255                                 mkdir -p $directory
2256                         done
2257                         # Sanity check 1.
2258                         if test ! -d t/base; then
2259                                 echo "Failed to create the subdirectories.  Aborting." >&4
2260                                 exit 1
2261                         fi
2262                         echo "(Then creating the symlinks...)" >&4
2263                         awk '{print $1}' $src/MANIFEST | while true; do
2264                                 read filename
2265                                 test -z "$filename" && break
2266                                 if test -f $filename; then
2267                                         if $issymlink $filename; then
2268                                                 rm -f $filename
2269                                         fi
2270                                 fi
2271                                 if test -f $filename; then
2272                                         echo "$filename already exists, not symlinking."
2273                                 else
2274                                         ln -s $src/$filename $filename
2275                                 fi
2276                         done
2277                         # Sanity check 2.
2278                         if test ! -f t/base/commonsense.t; then
2279                                 echo "Failed to create the symlinks.  Aborting." >&4
2280                                 exit 1
2281                         fi
2282                         cd UU
2283                         ;;
2284                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2285                         ;;
2286                 esac
2287                 ;;
2288         esac
2289         ;;
2290 esac
2291
2292 : see whether [:lower:] and [:upper:] are supported character classes
2293 echo " "
2294 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2295 ABYZ)
2296         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2297         up='[:upper:]'
2298         low='[:lower:]'
2299         ;;
2300 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2301         # (0xc9 and 0xd1), therefore that is a nice testing point.
2302         if test "X$up" = X -o "X$low" = X; then
2303             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2304             ij) up='[A-Z]'
2305                 low='[a-z]'
2306                 ;;
2307             esac
2308         fi
2309         if test "X$up" = X -o "X$low" = X; then
2310             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2311             ij) up='A-Z'
2312                 low='a-z'
2313                 ;;
2314             esac
2315         fi
2316         if test "X$up" = X -o "X$low" = X; then
2317             case "`echo IJ | od -x 2>/dev/null`" in
2318             *C9D1*|*c9d1*)
2319                 echo "Hey, this might be EBCDIC." >&4
2320                 if test "X$up" = X -o "X$low" = X; then
2321                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2322                     ij) up='[A-IJ-RS-Z]'
2323                         low='[a-ij-rs-z]'
2324                         ;;
2325                     esac
2326                 fi
2327                 if test "X$up" = X -o "X$low" = X; then
2328                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2329                     ij) up='A-IJ-RS-Z'
2330                         low='a-ij-rs-z'
2331                         ;;
2332                     esac
2333                 fi
2334                 ;;
2335             esac
2336         fi
2337 esac
2338 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2339 ij)
2340     echo "Using $up and $low to convert case." >&4
2341     ;;
2342 *)
2343     echo "I don't know how to translate letters from upper to lower case." >&4
2344     echo "Your tr is not acting any way I know of." >&4
2345     exit 1
2346     ;;
2347 esac
2348 : set up the translation script tr, must be called with ./tr of course
2349 cat >tr <<EOSC
2350 $startsh
2351 case "\$1\$2" in
2352 '[A-Z][a-z]') exec $tr '$up' '$low';;
2353 '[a-z][A-Z]') exec $tr '$low' '$up';;
2354 esac
2355 exec $tr "\$@"
2356 EOSC
2357 chmod +x tr
2358 $eunicefix tr
2359
2360 : Try to determine whether config.sh was made on this system
2361 case "$config_sh" in
2362 '')
2363 myuname=`$uname -a 2>/dev/null`
2364 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2365 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2366 # because the A-Z/a-z are not consecutive.
2367 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2368         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2369 newmyuname="$myuname"
2370 dflt=n
2371 case "$knowitall" in
2372 '')
2373         if test -f ../config.sh; then
2374                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2375                         eval "`grep myuname= ../config.sh`"
2376                 fi
2377                 if test "X$myuname" = "X$newmyuname"; then
2378                         dflt=y
2379                 fi
2380         fi
2381         ;;
2382 *) dflt=y;;
2383 esac
2384
2385 : Get old answers from old config file if Configure was run on the
2386 : same system, otherwise use the hints.
2387 hint=default
2388 cd ..
2389 if test -f config.sh; then
2390         echo " "
2391         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2392         . UU/myread
2393         case "$ans" in
2394         n*|N*) echo "OK, I'll ignore it."
2395                 mv config.sh config.sh.old
2396                 myuname="$newmyuname"
2397                 ;;
2398         *)  echo "Fetching default answers from your old config.sh file..." >&4
2399                 tmp_n="$n"
2400                 tmp_c="$c"
2401                 tmp_sh="$sh"
2402                 . ./config.sh
2403                 cp config.sh UU
2404                 n="$tmp_n"
2405                 c="$tmp_c"
2406                 : Older versions did not always set $sh.  Catch re-use of such
2407                 : an old config.sh.
2408                 case "$sh" in
2409                 '') sh="$tmp_sh" ;;
2410                 esac
2411                 hint=previous
2412                 ;;
2413         esac
2414 fi
2415 . ./UU/checkcc
2416 if test ! -f config.sh; then
2417         $cat <<EOM
2418
2419 First time through, eh?  I have some defaults handy for some systems
2420 that need some extra help getting the Configure answers right:
2421
2422 EOM
2423         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2424         dflt=''
2425         : Half the following guesses are probably wrong... If you have better
2426         : tests or hints, please send them to perlbug@perl.org
2427         : The metaconfig authors would also appreciate a copy...
2428         $test -f /irix && osname=irix
2429         $test -f /xenix && osname=sco_xenix
2430         $test -f /dynix && osname=dynix
2431         $test -f /dnix && osname=dnix
2432         $test -f /lynx.os && osname=lynxos
2433         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2434         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2435         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2436         $test -f /bin/mips && /bin/mips && osname=mips
2437         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2438                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2439         $test -d /usr/apollo/bin && osname=apollo
2440         $test -f /etc/saf/_sactab && osname=svr4
2441         $test -d /usr/include/minix && osname=minix
2442         if $test -d /MachTen -o -d /MachTen_Folder; then
2443                 osname=machten
2444                 if $test -x /sbin/version; then
2445                         osvers=`/sbin/version | $awk '{print $2}' |
2446                         $sed -e 's/[A-Za-z]$//'`
2447                 elif $test -x /usr/etc/version; then
2448                         osvers=`/usr/etc/version | $awk '{print $2}' |
2449                         $sed -e 's/[A-Za-z]$//'`
2450                 else
2451                         osvers="$2.$3"
2452                 fi
2453         fi
2454
2455         $test -f /sys/posix.dll &&
2456                 $test -f /usr/bin/what &&
2457                 set X `/usr/bin/what /sys/posix.dll` &&
2458                 $test "$3" = UWIN &&
2459                 osname=uwin &&
2460                 osvers="$5"
2461
2462         if $test -f $uname; then
2463                 set X $myuname
2464                 shift
2465
2466                 case "$5" in
2467                 fps*) osname=fps ;;
2468                 mips*)
2469                         case "$4" in
2470                         umips) osname=umips ;;
2471                         *) osname=mips ;;
2472                         esac;;
2473                 [23]100) osname=mips ;;
2474                 next*) osname=next ;;
2475                 i386*)
2476                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2477                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2478                                 osname='sco'
2479                                 osvers=$tmp
2480                         elif $test -f /etc/kconfig; then
2481                                 osname=isc
2482                                 if test "$lns" = "$ln -s"; then
2483                                         osvers=4
2484                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2485                                         osvers=3
2486                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2487                                         osvers=2
2488                                 fi
2489                         fi
2490                         tmp=''
2491                         ;;
2492                 pc*)
2493                         if test -n "$DJGPP"; then
2494                                 osname=dos
2495                                 osvers=djgpp
2496                         fi
2497                         ;;
2498                 esac
2499
2500                 case "$1" in
2501                 aix) osname=aix
2502                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2503                         case "$tmp" in
2504                         'not found') osvers="$4"."$3" ;;
2505                         '<3240'|'<>3240') osvers=3.2.0 ;;
2506                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2507                         '=3250'|'>3250') osvers=3.2.5 ;;
2508                         *) osvers=$tmp;;
2509                         esac
2510                         ;;
2511                 bsd386) osname=bsd386
2512                         osvers=`$uname -r`
2513                         ;;
2514                 cygwin*) osname=cygwin
2515                         osvers="$3"
2516                         ;;
2517                 *dc.osx) osname=dcosx
2518                         osvers="$3"
2519                         ;;
2520                 dnix) osname=dnix
2521                         osvers="$3"
2522                         ;;
2523                 domainos) osname=apollo
2524                         osvers="$3"
2525                         ;;
2526                 dgux) osname=dgux 
2527                         osvers="$3"
2528                         ;;
2529                 dynixptx*) osname=dynixptx
2530                         osvers=`echo "$4"|sed 's/^v//'`
2531                         ;;
2532                 freebsd) osname=freebsd 
2533                         osvers="$3" ;;
2534                 genix) osname=genix ;;
2535                 hp*) osname=hpux 
2536                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2537                         ;;
2538                 irix*) osname=irix
2539                         case "$3" in
2540                         4*) osvers=4 ;;
2541                         5*) osvers=5 ;;
2542                         *)      osvers="$3" ;;
2543                         esac
2544                         ;;
2545                 linux) osname=linux
2546                         case "$3" in
2547                         *)      osvers="$3" ;;
2548                         esac
2549                         ;;
2550                 MiNT) osname=mint
2551                         ;;
2552                 netbsd*) osname=netbsd
2553                         osvers="$3"
2554                         ;;
2555                 news-os) osvers="$3"
2556                         case "$3" in
2557                         4*) osname=newsos4 ;;
2558                         *) osname=newsos ;;
2559                         esac
2560                         ;;
2561                 next*) osname=next ;;
2562                 nonstop-ux) osname=nonstopux ;;
2563                 POSIX-BC | posix-bc ) osname=posix-bc
2564                         osvers="$3"
2565                         ;;
2566                 powerux | power_ux | powermax_os | powermaxos | \
2567                 powerunix | power_unix) osname=powerux
2568                         osvers="$3"
2569                         ;;
2570                 qnx) osname=qnx
2571                         osvers="$4"
2572                         ;;
2573                 solaris) osname=solaris
2574                         case "$3" in
2575                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2576                         *)      osvers="$3" ;;
2577                         esac
2578                         ;;
2579                 sunos) osname=sunos
2580                         case "$3" in
2581                         5*) osname=solaris
2582                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2583                         *)      osvers="$3" ;;
2584                         esac
2585                         ;;
2586                 titanos) osname=titanos
2587                         case "$3" in
2588                         1*) osvers=1 ;;
2589                         2*) osvers=2 ;;
2590                         3*) osvers=3 ;;
2591                         4*) osvers=4 ;;
2592                         *)      osvers="$3" ;;
2593                         esac
2594                         ;;
2595                 ultrix) osname=ultrix
2596                         osvers="$3"
2597                         ;;
2598                 osf1|mls+)      case "$5" in
2599                                 alpha)
2600                                         osname=dec_osf
2601                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2602                                         case "$osvers" in
2603                                         [1-9].[0-9]*) ;;
2604                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2605                                         esac
2606                                         ;;
2607                         hp*)    osname=hp_osf1  ;;
2608                         mips)   osname=mips_osf1 ;;
2609                         esac
2610                         ;;
2611                 unixware) osname=svr5
2612                         osvers="$4"
2613                         ;;
2614                 uts) osname=uts
2615                         osvers="$3"
2616                         ;;
2617                 $2) case "$osname" in
2618                         *isc*) ;;
2619                         *freebsd*) ;;
2620                         svr*)
2621                                 : svr4.x or possibly later
2622                                 case "svr$3" in 
2623                                 ${osname}*)
2624                                         osname=svr$3
2625                                         osvers=$4
2626                                         ;;
2627                                 esac
2628                                 case "$osname" in
2629                                 svr4.0)
2630                                         : Check for ESIX
2631                                         if test -f /stand/boot ; then
2632                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2633                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2634                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2635                                                         if test -n "$isesix"; then
2636                                                                 osname=esix4
2637                                                         fi
2638                                                 fi
2639                                         fi
2640                                         ;;
2641                                 esac
2642                                 ;;
2643                         *)      if test -f /etc/systemid; then
2644                                         osname=sco
2645                                         set `echo $3 | $sed 's/\./ /g'` $4
2646                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2647                                                 osvers=$1.$2.$3
2648                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2649                                                 osvers=$1.$2
2650                                         elif $test -f $src/hints/sco_$1.sh; then
2651                                                 osvers=$1
2652                                         fi
2653                                 else
2654                                         case "$osname" in
2655                                         '') : Still unknown.  Probably a generic Sys V.
2656                                                 osname="sysv"
2657                                                 osvers="$3"
2658                                                 ;;
2659                                         esac
2660                                 fi
2661                                 ;;
2662                         esac
2663                         ;;
2664                 *)      case "$osname" in
2665                         '') : Still unknown.  Probably a generic BSD.
2666                                 osname="$1"
2667                                 osvers="$3"
2668                                 ;;
2669                         esac
2670                         ;;
2671                 esac
2672         else
2673                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2674                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2675                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2676                                 osname=news_os
2677                         fi
2678                         $rm -f UU/kernel.what
2679                 elif test -d c:/.; then
2680                         set X $myuname
2681                         osname=os2
2682                         osvers="$5"
2683                 fi
2684         fi
2685         
2686         : Now look for a hint file osname_osvers, unless one has been
2687         : specified already.
2688         case "$hintfile" in
2689         ''|' ')
2690                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2691                 : Also try without trailing minor version numbers.
2692                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2693                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2694                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2695                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2696                 case "$file" in
2697                 '') dflt=none ;;
2698                 *)  case "$osvers" in
2699                         '') dflt=$file
2700                                 ;;
2701                         *)  if $test -f $src/hints/$file.sh ; then
2702                                         dflt=$file
2703                                 elif $test -f $src/hints/$xfile.sh ; then
2704                                         dflt=$xfile
2705                                 elif $test -f $src/hints/$xxfile.sh ; then
2706                                         dflt=$xxfile
2707                                 elif $test -f $src/hints/$xxxfile.sh ; then
2708                                         dflt=$xxxfile
2709                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2710                                         dflt=$xxxxfile
2711                                 elif $test -f "$src/hints/${osname}.sh" ; then
2712                                         dflt="${osname}"
2713                                 else
2714                                         dflt=none
2715                                 fi
2716                                 ;;
2717                         esac
2718                         ;;
2719                 esac
2720                 if $test -f Policy.sh ; then
2721                         case "$dflt" in
2722                         *Policy*) ;;
2723                         none) dflt="Policy" ;;
2724                         *) dflt="Policy $dflt" ;;
2725                         esac
2726                 fi
2727                 ;;
2728         *)
2729                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2730                 ;;
2731         esac
2732
2733         if $test -f Policy.sh ; then
2734                 $cat <<EOM
2735
2736 There's also a Policy hint file available, which should make the
2737 site-specific (policy) questions easier to answer.
2738 EOM
2739
2740         fi
2741
2742         $cat <<EOM
2743
2744 You may give one or more space-separated answers, or "none" if appropriate.
2745 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2746 is a good thing.  DO NOT give a wrong version or a wrong OS.
2747
2748 EOM
2749
2750         rp="Which of these apply, if any?"
2751         . UU/myread
2752         tans=$ans
2753         for file in $tans; do
2754                 if $test X$file = XPolicy -a -f Policy.sh; then
2755                         . Policy.sh
2756                         $cat Policy.sh >> UU/config.sh
2757                 elif $test -f $src/hints/$file.sh; then
2758                         . $src/hints/$file.sh
2759                         $cat $src/hints/$file.sh >> UU/config.sh
2760                 elif $test X$tans = X -o X$tans = Xnone ; then
2761                         : nothing
2762                 else
2763                         : Give one chance to correct a possible typo.
2764                         echo "$file.sh does not exist"
2765                         dflt=$file
2766                         rp="hint to use instead?"
2767                         . UU/myread
2768                         for file in $ans; do
2769                                 if $test -f "$src/hints/$file.sh"; then
2770                                         . $src/hints/$file.sh
2771                                         $cat $src/hints/$file.sh >> UU/config.sh
2772                                 elif $test X$ans = X -o X$ans = Xnone ; then
2773                                         : nothing
2774                                 else
2775                                         echo "$file.sh does not exist -- ignored."
2776                                 fi
2777                         done
2778                 fi
2779         done
2780
2781         hint=recommended
2782         : Remember our hint file for later.
2783         if $test -f "$src/hints/$file.sh" ; then
2784                 hintfile="$file"
2785         else
2786                 hintfile=''
2787         fi
2788 fi
2789 cd UU
2790 ;;
2791 *)
2792         echo " "
2793         echo "Fetching default answers from $config_sh..." >&4
2794         tmp_n="$n"
2795         tmp_c="$c"
2796         cd ..
2797         cp $config_sh config.sh 2>/dev/null
2798         chmod +w config.sh
2799         . ./config.sh
2800         cd UU
2801         cp ../config.sh .
2802         n="$tmp_n"
2803         c="$tmp_c"
2804         hint=previous
2805         ;;
2806 esac
2807 test "$override" && . ./optdef.sh
2808
2809 : Restore computed paths
2810 for file in $loclist $trylist; do
2811         eval $file="\$_$file"
2812 done
2813
2814 cat << EOM
2815
2816 Configure uses the operating system name and version to set some defaults.
2817 The default value is probably right if the name rings a bell. Otherwise,
2818 since spelling matters for me, either accept the default or answer "none"
2819 to leave it blank.
2820
2821 EOM
2822 case "$osname" in
2823         ''|' ')
2824                 case "$hintfile" in
2825                 ''|' '|none) dflt=none ;;
2826                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2827                 esac
2828                 ;;
2829         *) dflt="$osname" ;;
2830 esac
2831 rp="Operating system name?"
2832 . ./myread
2833 case "$ans" in
2834 none)  osname='' ;;
2835 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2836 esac
2837 echo " "
2838 case "$osvers" in
2839         ''|' ')
2840                 case "$hintfile" in
2841                 ''|' '|none) dflt=none ;;
2842                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2843                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2844                         case "$dflt" in
2845                         ''|' ') dflt=none ;;
2846                         esac
2847                         ;;
2848                 esac
2849                 ;;
2850         *) dflt="$osvers" ;;
2851 esac
2852 rp="Operating system version?"
2853 . ./myread
2854 case "$ans" in
2855 none)  osvers='' ;;
2856 *) osvers="$ans" ;;
2857 esac
2858
2859
2860 . ./posthint.sh
2861
2862 : who configured the system
2863 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2864 cf_by=`(logname) 2>/dev/null`
2865 case "$cf_by" in
2866 "")
2867         cf_by=`(whoami) 2>/dev/null`
2868         case "$cf_by" in
2869         "") cf_by=unknown ;;
2870         esac ;;
2871 esac
2872
2873 : set up the script used to warn in case of inconsistency
2874 cat <<EOS >whoa
2875 $startsh
2876 EOS
2877 cat <<'EOSC' >>whoa
2878 dflt=y
2879 echo " "
2880 echo "*** WHOA THERE!!! ***" >&4
2881 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2882 rp="    Keep the $hint value?"
2883 . ./myread
2884 case "$ans" in
2885 y) td=$was; tu=$was;;
2886 esac
2887 EOSC
2888
2889 : function used to set $1 to $val
2890 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2891 case "$val$was" in
2892 $define$undef) . ./whoa; eval "$var=\$td";;
2893 $undef$define) . ./whoa; eval "$var=\$tu";;
2894 *) eval "$var=$val";;
2895 esac'
2896
2897 case "$usethreads" in
2898 $define|true|[yY]*)     dflt='y';;
2899 *) dflt='n';;
2900 esac
2901 cat <<EOM
2902
2903 Perl can be built to take advantage of threads on some systems.
2904 To do so, Configure can be run with -Dusethreads.
2905
2906 Note that threading is a highly experimental feature, and
2907 some known race conditions still remain.  If you choose to try
2908 it, be very sure to not actually deploy it for production
2909 purposes.  README.threads has more details, and is required
2910 reading if you enable threads.
2911
2912 If this doesn't make any sense to you, just accept the default '$dflt'.
2913 EOM
2914 rp='Build a threading Perl?'
2915 . ./myread
2916 case "$ans" in
2917 y|Y)    val="$define" ;;
2918 *)      val="$undef" ;;
2919 esac
2920 set usethreads
2921 eval $setvar
2922
2923 case "$usethreads" in
2924 $define)
2925         $cat <<EOM
2926
2927 As of 5.5.640, Perl has two different internal threading implementations,
2928 the 5.005 version (5005threads) and an interpreter-based version
2929 (ithreads) that has one interpreter per thread.  Both are very 
2930 experimental.  This arrangement exists to help developers work out
2931 which one is better.
2932
2933 If you're a casual user, you probably don't want interpreter-threads
2934 at this time.  There doesn't yet exist a way to create threads from
2935 within Perl in this model, i.e., "use Thread;" will NOT work.
2936 EOM
2937         : Default to ithreads unless overridden on command line or with
2938         : old config.sh
2939         dflt='y'
2940         case "$use5005threads" in
2941                 $define|true|[yY]*) dflt='n';;
2942         esac
2943         case "$useithreads" in
2944                 $undef|false|[nN]*) dflt='n';;
2945         esac
2946         rp='Use interpreter-based ithreads?'
2947         . ./myread
2948         case "$ans" in
2949         y|Y)    val="$define" ;;
2950         *)      val="$undef" ;;
2951         esac
2952         set useithreads
2953         eval $setvar
2954         : Now set use5005threads to the opposite value.
2955         case "$useithreads" in
2956         $define) val="$undef" ;;
2957         *) val="$define" ;;
2958         esac
2959         set use5005threads
2960         eval $setvar
2961         ;;
2962 *)
2963         useithreads="$undef"
2964         use5005threads="$undef"
2965         ;;
2966 esac
2967
2968 case "$useithreads$use5005threads" in
2969 "$define$define")
2970         $cat >&4 <<EOM
2971
2972 You cannot have both the ithreads and the 5.005 threads enabled
2973 at the same time.  Disabling the 5.005 threads since they are
2974 much less stable than the ithreads.
2975
2976 EOM
2977         use5005threads="$undef"
2978         ;;
2979 esac
2980
2981 case "$d_oldpthreads" in
2982 '')     : Configure tests would be welcome here.  For now, assume undef.
2983         val="$undef" ;;
2984 *)      val="$d_oldpthreads" ;;
2985 esac
2986 set d_oldpthreads
2987 eval $setvar
2988
2989
2990 case "$usethreads" in
2991 "$define"|true|[yY]*)
2992 : Look for a hint-file generated 'call-back-unit'.  If the
2993 : user has specified that a threading perl is to be built,
2994 : we may need to set or change some other defaults.
2995         if $test -f usethreads.cbu; then
2996                 echo "Your platform has some specific hints for threaded builds, using them..."
2997                 . ./usethreads.cbu
2998         else
2999                 $cat <<EOM
3000 (Your platform doesn't have any specific hints for threaded builds.
3001  Assuming POSIX threads, then.)
3002 EOM
3003         fi
3004         ;;
3005 esac
3006
3007 cat <<EOM
3008
3009 Perl can be built so that multiple Perl interpreters can coexist
3010 within the same Perl executable.
3011 EOM
3012
3013 case "$useithreads" in
3014 $define)
3015         cat <<EOM
3016 This multiple interpreter support is required for interpreter-based threads.
3017 EOM
3018         val="$define"
3019         ;;
3020 *)      case "$usemultiplicity" in
3021         $define|true|[yY]*)     dflt='y';;
3022         *) dflt='n';;
3023         esac
3024         echo " "
3025         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3026         rp='Build Perl for multiplicity?'
3027         . ./myread
3028         case "$ans" in
3029         y|Y)    val="$define" ;;
3030         *)      val="$undef" ;;
3031         esac
3032         ;;
3033 esac
3034 set usemultiplicity
3035 eval $setvar
3036
3037 : make some quick guesses about what we are up against
3038 echo " "
3039 $echo $n "Hmm...  $c"
3040 echo exit 1 >bsd
3041 echo exit 1 >usg
3042 echo exit 1 >v7
3043 echo exit 1 >osf1
3044 echo exit 1 >eunice
3045 echo exit 1 >xenix
3046 echo exit 1 >venix
3047 echo exit 1 >os2
3048 d_bsd="$undef"
3049 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3050 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3051 then
3052         echo "Looks kind of like an OSF/1 system, but we'll see..."
3053         echo exit 0 >osf1
3054 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3055         xxx=`./loc addbib blurfl $pth`
3056         if $test -f $xxx; then
3057         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3058                 echo exit 0 >bsd
3059                 echo exit 0 >usg
3060         else
3061                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3062                         echo "Looks kind of like an extended USG system, but we'll see..."
3063                 else
3064                         echo "Looks kind of like a USG system, but we'll see..."
3065                 fi
3066                 echo exit 0 >usg
3067         fi
3068 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3069         echo "Looks kind of like a BSD system, but we'll see..."
3070         d_bsd="$define"
3071         echo exit 0 >bsd
3072 else
3073         echo "Looks kind of like a Version 7 system, but we'll see..."
3074         echo exit 0 >v7
3075 fi
3076 case "$eunicefix" in
3077 *unixtovms*)
3078         $cat <<'EOI'
3079 There is, however, a strange, musty smell in the air that reminds me of
3080 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3081 EOI
3082         echo exit 0 >eunice
3083         d_eunice="$define"
3084 : it so happens the Eunice I know will not run shell scripts in Unix format
3085         ;;
3086 *)
3087         echo " "
3088         echo "Congratulations.  You aren't running Eunice."
3089         d_eunice="$undef"
3090         ;;
3091 esac
3092 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3093 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3094 : semicolon as a patch separator
3095 case "$p_" in
3096 :) ;;
3097 *)
3098         $cat <<'EOI'
3099 I have the feeling something is not exactly right, however...don't tell me...
3100 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3101 (Or you may be running DOS with DJGPP.)
3102 EOI
3103         echo exit 0 >os2
3104         ;;
3105 esac
3106 if test -f /xenix; then
3107         echo "Actually, this looks more like a XENIX system..."
3108         echo exit 0 >xenix
3109         d_xenix="$define"
3110 else
3111         echo " "
3112         echo "It's not Xenix..."
3113         d_xenix="$undef"
3114 fi
3115 chmod +x xenix
3116 $eunicefix xenix
3117 if test -f /venix; then
3118         echo "Actually, this looks more like a VENIX system..."
3119         echo exit 0 >venix
3120 else
3121         echo " "
3122         if ./xenix; then
3123                 : null
3124         else
3125                 echo "Nor is it Venix..."
3126         fi
3127 fi
3128 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3129 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3130 $rm -f foo
3131
3132 case "$cc" in
3133 '') dflt=cc;;
3134 *) dflt="$cc";;
3135 esac
3136 rp="Use which C compiler?"
3137 . ./myread
3138 cc="$ans"
3139 : Look for a hint-file generated 'call-back-unit'.  Now that the
3140 : user has specified the compiler, we may need to set or change some
3141 : other defaults.
3142 if $test -f cc.cbu; then
3143     . ./cc.cbu
3144 fi
3145 . ./checkcc
3146
3147 echo " "
3148 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3149 $cat >gccvers.c <<EOM
3150 #include <stdio.h>
3151 int main() {
3152 #ifdef __GNUC__
3153 #ifdef __VERSION__
3154         printf("%s\n", __VERSION__);
3155 #else
3156         printf("%s\n", "1");
3157 #endif
3158 #endif
3159         exit(0);
3160 }
3161 EOM
3162 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3163         gccversion=`./gccvers`
3164         case "$gccversion" in
3165         '') echo "You are not using GNU cc." ;;
3166         *)  echo "You are using GNU cc $gccversion."
3167             ccname=gcc  
3168             ;;
3169         esac
3170 else
3171         echo " "
3172         echo "*** WHOA THERE!!! ***" >&4
3173         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3174         case "$knowitall" in
3175         '')
3176         echo "    You'd better start hunting for one and let me know about it." >&4
3177                 exit 1
3178                 ;;
3179         esac
3180 fi
3181 $rm -f gccvers*
3182 case "$gccversion" in
3183 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3184 esac
3185 case "$gccversion" in
3186 '') gccosandvers='' ;;
3187 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3188    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3189    gccshortvers=''
3190    case "$gccosandvers" in
3191    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3192    $osname$osvers) ;; # looking good
3193    $osname*) cat <<EOM >&4
3194
3195 *** WHOA THERE!!! ***
3196
3197     Your gcc has not been compiled for the exact release of
3198     your operating system ($gccosandvers versus $osname$osvers).
3199
3200     In general it is a good idea to keep gcc synchronized with
3201     the operating system because otherwise serious problems
3202     may ensue when trying to compile software, like Perl.
3203
3204     I'm trying to be optimistic here, though, and will continue.
3205     If later during the configuration and build icky compilation
3206     problems appear (headerfile conflicts being the most common
3207     manifestation), I suggest reinstalling the gcc to match
3208     your operating system release.
3209
3210 EOM
3211       ;;
3212    *) gccosandvers='' ;; # failed to parse, better be silent
3213    esac
3214    ;;
3215 esac
3216 case "$ccname" in
3217 '') ccname="$cc" ;;
3218 esac
3219
3220 : see how we invoke the C preprocessor
3221 echo " "
3222 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3223 cat <<'EOT' >testcpp.c
3224 #define ABC abc
3225 #define XYZ xyz
3226 ABC.XYZ
3227 EOT
3228 cd ..
3229 if test ! -f cppstdin; then
3230         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3231                 # AIX cc -E doesn't show the absolute headerfile
3232                 # locations but we'll cheat by using the -M flag.
3233                 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
3234         else
3235                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3236         fi
3237 else
3238         echo "Keeping your $hint cppstdin wrapper."
3239 fi
3240 chmod 755 cppstdin
3241 wrapper=`pwd`/cppstdin
3242 ok='false'
3243 cd UU
3244
3245 if $test "X$cppstdin" != "X" && \
3246         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3247         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3248 then
3249         echo "You used to use $cppstdin $cppminus so we'll use that again."
3250         case "$cpprun" in
3251         '') echo "But let's see if we can live without a wrapper..." ;;
3252         *)
3253                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3254                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3255                 then
3256                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3257                         ok='true'
3258                 else
3259                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3260                 fi
3261                 ;;
3262         esac
3263 else
3264         case "$cppstdin" in
3265         '') ;;
3266         *)
3267                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3268                 ;;
3269         esac
3270 fi
3271
3272 if $ok; then
3273         : nothing
3274 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3275         $cc -E <testcpp.c >testcpp.out 2>&1; \
3276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3277         echo "Yup, it does."
3278         x_cpp="$cc -E"
3279         x_minus='';
3280 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3281         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3283         echo "Yup, it does."
3284         x_cpp="$cc -E"
3285         x_minus='-';
3286 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3287         $cc -P <testcpp.c >testcpp.out 2>&1; \
3288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3289         echo "Yipee, that works!"
3290         x_cpp="$cc -P"
3291         x_minus='';
3292 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3293         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3294         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3295         echo "At long last!"
3296         x_cpp="$cc -P"
3297         x_minus='-';
3298 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3299         $cpp <testcpp.c >testcpp.out 2>&1; \
3300         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3301         echo "It works!"
3302         x_cpp="$cpp"
3303         x_minus='';
3304 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3305         $cpp - <testcpp.c >testcpp.out 2>&1; \
3306         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3307         echo "Hooray, it works!  I was beginning to wonder."
3308         x_cpp="$cpp"
3309         x_minus='-';
3310 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3311         $wrapper <testcpp.c >testcpp.out 2>&1; \
3312         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3313         x_cpp="$wrapper"
3314         x_minus=''
3315         echo "Eureka!"
3316 else
3317         dflt=''
3318         rp="No dice.  I can't find a C preprocessor.  Name one:"
3319         . ./myread
3320         x_cpp="$ans"
3321         x_minus=''
3322         $x_cpp <testcpp.c >testcpp.out 2>&1
3323         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324                 echo "OK, that will do." >&4
3325         else
3326 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3327                 exit 1
3328         fi
3329 fi
3330
3331 case "$ok" in
3332 false)
3333         cppstdin="$x_cpp"
3334         cppminus="$x_minus"
3335         cpprun="$x_cpp"
3336         cpplast="$x_minus"
3337         set X $x_cpp
3338         shift
3339         case "$1" in
3340         "$cpp")
3341                 echo "Perhaps can we force $cc -E using a wrapper..."
3342                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3343                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3344                 then
3345                         echo "Yup, we can."
3346                         cppstdin="$wrapper"
3347                         cppminus='';
3348                 else
3349                         echo "Nope, we'll have to live without it..."
3350                 fi
3351                 ;;
3352         esac
3353         case "$cpprun" in
3354         "$wrapper")
3355                 cpprun=''
3356                 cpplast=''
3357                 ;;
3358         esac
3359         ;;
3360 esac
3361
3362 case "$cppstdin" in
3363 "$wrapper"|'cppstdin') ;;
3364 *) $rm -f $wrapper;;
3365 esac
3366 $rm -f testcpp.c testcpp.out
3367
3368 : decide how portable to be.  Allow command line overrides.
3369 case "$d_portable" in
3370 "$undef") ;;
3371 *)      d_portable="$define" ;;
3372 esac
3373
3374 : set up shell script to do ~ expansion
3375 cat >filexp <<EOSS
3376 $startsh
3377 : expand filename
3378 case "\$1" in
3379  ~/*|~)
3380         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3381         ;;
3382  ~*)
3383         if $test -f /bin/csh; then
3384                 /bin/csh -f -c "glob \$1"
3385                 failed=\$?
3386                 echo ""
3387                 exit \$failed
3388         else
3389                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3390                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3391                 if $test ! -d "\$dir"; then
3392                         me=\`basename \$0\`
3393                         echo "\$me: can't locate home directory for: \$name" >&2
3394                         exit 1
3395                 fi
3396                 case "\$1" in
3397                 */*)
3398                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3399                         ;;
3400                 *)
3401                         echo \$dir
3402                         ;;
3403                 esac
3404         fi
3405         ;;
3406 *)
3407         echo \$1
3408         ;;
3409 esac
3410 EOSS
3411 chmod +x filexp
3412 $eunicefix filexp
3413
3414 : now set up to get a file name
3415 cat <<EOS >getfile
3416 $startsh
3417 EOS
3418 cat <<'EOSC' >>getfile
3419 tilde=''
3420 fullpath=''
3421 already=''
3422 skip=''
3423 none_ok=''
3424 exp_file=''
3425 nopath_ok=''
3426 orig_rp="$rp"
3427 orig_dflt="$dflt"
3428 case "$gfpth" in
3429 '') gfpth='.' ;;
3430 esac
3431
3432 case "$fn" in
3433 *\(*)
3434         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3435         fn=`echo $fn | sed 's/(.*)//'`
3436         ;;
3437 esac
3438
3439 case "$fn" in
3440 *:*)
3441         loc_file=`expr $fn : '.*:\(.*\)'`
3442         fn=`expr $fn : '\(.*\):.*'`
3443         ;;
3444 esac
3445
3446 case "$fn" in
3447 *~*) tilde=true;;
3448 esac
3449 case "$fn" in
3450 */*) fullpath=true;;
3451 esac
3452 case "$fn" in
3453 *+*) skip=true;;
3454 esac
3455 case "$fn" in
3456 *n*) none_ok=true;;
3457 esac
3458 case "$fn" in
3459 *e*) exp_file=true;;
3460 esac
3461 case "$fn" in
3462 *p*) nopath_ok=true;;
3463 esac
3464
3465 case "$fn" in
3466 *f*) type='File';;
3467 *d*) type='Directory';;
3468 *l*) type='Locate';;
3469 esac
3470
3471 what="$type"
3472 case "$what" in
3473 Locate) what='File';;
3474 esac
3475
3476 case "$exp_file" in
3477 '')
3478         case "$d_portable" in
3479         "$define") ;;
3480         *) exp_file=true;;
3481         esac
3482         ;;
3483 esac
3484
3485 cd ..
3486 while test "$type"; do
3487         redo=''
3488         rp="$orig_rp"
3489         dflt="$orig_dflt"
3490         case "$tilde" in
3491         true) rp="$rp (~name ok)";;
3492         esac
3493         . UU/myread
3494         if test -f UU/getfile.ok && \
3495                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3496         then
3497                 value="$ans"
3498                 ansexp="$ans"
3499                 break
3500         fi
3501         case "$ans" in
3502         none)
3503                 value=''
3504                 ansexp=''
3505                 case "$none_ok" in
3506                 true) type='';;
3507                 esac
3508                 ;;
3509         *)
3510                 case "$tilde" in
3511                 '') value="$ans"
3512                         ansexp="$ans";;
3513                 *)
3514                         value=`UU/filexp $ans`
3515                         case $? in
3516                         0)
3517                                 if test "$ans" != "$value"; then
3518                                         echo "(That expands to $value on this system.)"
3519                                 fi
3520                                 ;;
3521                         *) value="$ans";;
3522                         esac
3523                         ansexp="$value"
3524                         case "$exp_file" in
3525                         '') value="$ans";;
3526                         esac
3527                         ;;
3528                 esac
3529                 case "$fullpath" in
3530                 true)
3531                         case "$ansexp" in
3532                         /*) value="$ansexp" ;;
3533                         [a-zA-Z]:/*) value="$ansexp" ;;
3534                         *)
3535                                 redo=true
3536                                 case "$already" in
3537                                 true)
3538                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3539                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3540                                         ;;
3541                                 *)
3542                                 echo "Please give a full path name, starting with slash." >&4
3543                                         case "$tilde" in
3544                                         true)
3545                                 echo "Note that using ~name is ok provided it expands well." >&4
3546                                                 already=true
3547                                                 ;;
3548                                         esac
3549                                 esac
3550                                 ;;
3551                         esac
3552                         ;;
3553                 esac
3554                 case "$redo" in
3555                 '')
3556                         case "$type" in
3557                         File)
3558                                 for fp in $gfpth; do
3559                                         if test "X$fp" = X.; then
3560                                             pf="$ansexp"
3561                                         else    
3562                                             pf="$fp/$ansexp"
3563                                         fi
3564                                         if test -f "$pf"; then
3565                                                 type=''
3566                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3567                                         then
3568                                                 echo "($value is not a plain file, but that's ok.)"
3569                                                 type=''
3570                                         fi
3571                                         if test X"$type" = X; then
3572                                             value="$pf"
3573                                             break
3574                                         fi
3575                                 done
3576                                 ;;
3577                         Directory)
3578                                 for fp in $gfpth; do
3579                                         if test "X$fp" = X.; then
3580                                             dir="$ans"
3581                                             direxp="$ansexp"
3582                                         else    
3583                                             dir="$fp/$ansexp"
3584                                             direxp="$fp/$ansexp"
3585                                         fi
3586                                         if test -d "$direxp"; then
3587                                                 type=''
3588                                                 value="$dir"
3589                                                 break
3590                                         fi
3591                                 done
3592                                 ;;
3593                         Locate)
3594                                 if test -d "$ansexp"; then
3595                                         echo "(Looking for $loc_file in directory $value.)"
3596                                         value="$value/$loc_file"
3597                                         ansexp="$ansexp/$loc_file"
3598                                 fi
3599                                 if test -f "$ansexp"; then
3600                                         type=''
3601                                 fi
3602                                 case "$nopath_ok" in
3603                                 true)   case "$value" in
3604                                         */*) ;;
3605                                         *)      echo "Assuming $value will be in people's path."
3606                                                 type=''
3607                                                 ;;
3608                                         esac
3609                                         ;;
3610                                 esac
3611                                 ;;
3612                         esac
3613
3614                         case "$skip" in
3615                         true) type='';
3616                         esac
3617
3618                         case "$type" in
3619                         '') ;;
3620                         *)
3621                                 if test "$fastread" = yes; then
3622                                         dflt=y
3623                                 else
3624                                         dflt=n
3625                                 fi
3626                                 rp="$what $value doesn't exist.  Use that name anyway?"
3627                                 . UU/myread
3628                                 dflt=''
3629                                 case "$ans" in
3630                                 y*) type='';;
3631                                 *) echo " ";;
3632                                 esac
3633                                 ;;
3634                         esac
3635                         ;;
3636                 esac
3637                 ;;
3638         esac
3639 done
3640 cd UU
3641 ans="$value"
3642 rp="$orig_rp"
3643 dflt="$orig_dflt"
3644 rm -f getfile.ok
3645 test "X$gfpthkeep" != Xy && gfpth=""
3646 EOSC
3647
3648 : What should the include directory be ?
3649 echo " "
3650 $echo $n "Hmm...  $c"
3651 dflt='/usr/include'
3652 incpath=''
3653 mips_type=''
3654 if $test -f /bin/mips && /bin/mips; then
3655         echo "Looks like a MIPS system..."
3656         $cat >usr.c <<'EOCP'
3657 #ifdef SYSTYPE_BSD43
3658 /bsd43
3659 #endif
3660 EOCP
3661         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3662                 dflt='/bsd43/usr/include'
3663                 incpath='/bsd43'
3664                 mips_type='BSD 4.3'
3665         else
3666                 mips_type='System V'
3667         fi
3668         $rm -f usr.c usr.out
3669         echo "and you're compiling with the $mips_type compiler and libraries."
3670         xxx_prompt=y
3671         echo "exit 0" >mips
3672 else
3673         echo "Doesn't look like a MIPS system."
3674         xxx_prompt=n
3675         echo "exit 1" >mips
3676 fi
3677 chmod +x mips
3678 $eunicefix mips
3679 case "$usrinc" in
3680 '') ;;
3681 *) dflt="$usrinc";;
3682 esac
3683 case "$xxx_prompt" in
3684 y)      fn=d/
3685         echo " "
3686         rp='Where are the include files you want to use?'
3687         . ./getfile
3688         usrinc="$ans"
3689         ;;
3690 *)      usrinc="$dflt"
3691         ;;
3692 esac
3693
3694 : Set private lib path
3695 case "$plibpth" in
3696 '') if ./mips; then
3697                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3698         fi;;
3699 esac
3700 case "$libpth" in
3701 ' ') dlist='';;
3702 '') dlist="$loclibpth $plibpth $glibpth";;
3703 *) dlist="$libpth";;
3704 esac
3705
3706 : Now check and see which directories actually exist, avoiding duplicates
3707 libpth=''
3708 for xxx in $dlist
3709 do
3710     if $test -d $xxx; then
3711                 case " $libpth " in
3712                 *" $xxx "*) ;;
3713                 *) libpth="$libpth $xxx";;
3714                 esac
3715     fi
3716 done
3717 $cat <<'EOM'
3718
3719 Some systems have incompatible or broken versions of libraries.  Among
3720 the directories listed in the question below, please remove any you
3721 know not to be holding relevant libraries, and add any that are needed.
3722 Say "none" for none.
3723
3724 EOM
3725 case "$libpth" in
3726 '') dflt='none';;
3727 *)
3728         set X $libpth
3729         shift
3730         dflt=${1+"$@"}
3731         ;;
3732 esac
3733 rp="Directories to use for library searches?"
3734 . ./myread
3735 case "$ans" in
3736 none) libpth=' ';;
3737 *) libpth="$ans";;
3738 esac
3739
3740 : compute shared library extension
3741 case "$so" in
3742 '')
3743         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3744                 dflt='sl'
3745         else
3746                 dflt='so'
3747         fi
3748         ;;
3749 *) dflt="$so";;
3750 esac
3751 $cat <<EOM
3752
3753 On some systems, shared libraries may be available.  Answer 'none' if
3754 you want to suppress searching of shared libraries for the remainder
3755 of this configuration.
3756
3757 EOM
3758 rp='What is the file extension used for shared libraries?'
3759 . ./myread
3760 so="$ans"
3761
3762 : Define several unixisms.
3763 : Hints files or command line option can be used to override them.
3764 : The convoluted testing is in case hints files set either the old
3765 : or the new name.
3766 case "$_exe" in
3767 '')     case "$exe_ext" in
3768     '') ;;
3769         *)      _exe="$exe_ext" ;;
3770         esac
3771         ;;
3772 esac
3773 case "$_a" in
3774 '')     case "$lib_ext" in
3775     '') _a='.a';;
3776         *)      _a="$lib_ext" ;;
3777         esac
3778         ;;
3779 esac
3780 case "$_o" in
3781 '') case "$obj_ext" in
3782         '')     _o='.o';;
3783         *)      _o="$obj_ext";;
3784         esac
3785         ;;
3786 esac
3787 case "$p_" in
3788 '') case "$path_sep" in
3789         '')     p_=':';;
3790         *)      p_="$path_sep";;
3791         esac
3792         ;;
3793 esac
3794 exe_ext=$_exe
3795 lib_ext=$_a
3796 obj_ext=$_o
3797 path_sep=$p_
3798
3799 : Which makefile gets called first.  This is used by make depend.
3800 case "$firstmakefile" in
3801 '') firstmakefile='makefile';;
3802 esac
3803
3804 case "$usesocks" in
3805 $define|true|[yY]*)     dflt='y';;
3806 *) dflt='n';;
3807 esac
3808 cat <<EOM
3809
3810 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3811 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3812 to use the PerlIO abstraction layer, this will be implicitly selected.
3813
3814 If this doesn't make any sense to you, just accept the default '$dflt'.
3815 EOM
3816 rp='Build Perl for SOCKS?'
3817 . ./myread
3818 case "$ans" in
3819 y|Y)    val="$define" ;;     
3820 *)      val="$undef" ;;
3821 esac
3822 set usesocks
3823 eval $setvar
3824
3825 case "$usesocks" in
3826 $define|true|[yY]*) useperlio="$define";;
3827 esac
3828
3829 : Looking for optional libraries
3830 echo " "
3831 echo "Checking for optional libraries..." >&4
3832 case "$libs" in
3833 ' '|'') dflt='';;
3834 *) dflt="$libs";;
3835 esac
3836 case "$libswanted" in
3837 '') libswanted='c_s';;
3838 esac
3839 case "$usesocks" in
3840 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3841 esac
3842 libsfound=''
3843 libsfiles=''
3844 libsdirs=''
3845 libspath=''
3846 for thisdir in $libpth $xlibpth; do
3847   test -d $thisdir && libspath="$libspath $thisdir"
3848 done
3849 for thislib in $libswanted; do
3850         for thisdir in $libspath; do
3851             xxx=''
3852             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3853                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3854                 $test -f "$xxx" && eval $libscheck
3855                 $test -f "$xxx" && libstyle=shared
3856             fi
3857             if test ! -f "$xxx"; then
3858                 xxx=$thisdir/lib$thislib.$so
3859                 $test -f "$xxx" && eval $libscheck
3860                 $test -f "$xxx" && libstyle=shared
3861             fi  
3862             if test ! -f "$xxx"; then
3863                 xxx=$thisdir/lib$thislib$_a
3864                 $test -f "$xxx" && eval $libscheck
3865                 $test -f "$xxx" && libstyle=static
3866             fi
3867             if test ! -f "$xxx"; then
3868                 xxx=$thisdir/$thislib$_a
3869                 $test -f "$xxx" && eval $libscheck
3870                 $test -f "$xxx" && libstyle=static
3871             fi
3872             if test ! -f "$xxx"; then
3873                 xxx=$thisdir/lib${thislib}_s$_a
3874                 $test -f "$xxx" && eval $libscheck
3875                 $test -f "$xxx" && libstyle=static
3876                 $test -f "$xxx" && thislib=${thislib}_s
3877             fi
3878             if test ! -f "$xxx"; then
3879                 xxx=$thisdir/Slib$thislib$_a
3880                 $test -f "$xxx" && eval $libscheck
3881                 $test -f "$xxx" && libstyle=static
3882             fi
3883             if $test -f "$xxx"; then
3884                 case "$libstyle" in
3885                 shared) echo "Found -l$thislib (shared)." ;;
3886                 static) echo "Found -l$thislib." ;;
3887                 *)      echo "Found -l$thislib ($libstyle)." ;;
3888                 esac
3889                 case " $dflt " in
3890                 *"-l$thislib "*);;
3891                 *) dflt="$dflt -l$thislib"
3892                    libsfound="$libsfound $xxx"
3893                    yyy=`basename $xxx`
3894                    libsfiles="$libsfiles $yyy"
3895                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3896                    case " $libsdirs " in
3897                    *" $yyy "*) ;;
3898                    *) libsdirs="$libsdirs $yyy" ;;
3899                    esac
3900                    ;;
3901                 esac
3902                 break
3903             fi  
3904         done
3905         if $test ! -f "$xxx"; then
3906             echo "No -l$thislib."
3907         fi
3908 done
3909 set X $dflt
3910 shift
3911 dflt="$*"
3912 case "$libs" in
3913 '') dflt="$dflt";;
3914 *) dflt="$libs";;
3915 esac
3916 case "$dflt" in
3917 ' '|'') dflt='none';;
3918 esac
3919
3920 $cat <<EOM
3921
3922 In order to compile $package on your machine, a number of libraries
3923 are usually needed.  Include any other special libraries here as well.
3924 Say "none" for none.  The default list is almost always right.
3925 EOM
3926
3927 echo " "
3928 rp="What libraries to use?"
3929 . ./myread
3930 case "$ans" in
3931 none) libs=' ';;
3932 *) libs="$ans";;
3933 esac
3934
3935 : determine optimization, if desired, or use for debug flag also
3936 case "$optimize" in
3937 ' '|$undef) dflt='none';;
3938 '') dflt='-O';;
3939 *) dflt="$optimize";;
3940 esac
3941 $cat <<EOH
3942
3943 By default, $package compiles with the -O flag to use the optimizer.
3944 Alternately, you might want to use the symbolic debugger, which uses
3945 the -g flag (on traditional Unix systems).  Either flag can be
3946 specified here.  To use neither flag, specify the word "none".
3947
3948 EOH
3949 rp="What optimizer/debugger flag should be used?"
3950 . ./myread
3951 optimize="$ans"
3952 case "$optimize" in
3953 'none') optimize=" ";;
3954 esac
3955
3956 dflt=''
3957 : We will not override a previous value, but we might want to
3958 : augment a hint file
3959 case "$hint" in
3960 default|recommended)
3961         case "$gccversion" in
3962         1*) dflt='-fpcc-struct-return' ;;
3963         esac
3964         case "$optimize" in
3965         *-g*) dflt="$dflt -DDEBUGGING";;
3966         esac
3967         case "$gccversion" in
3968         2*) if test -d /etc/conf/kconfig.d &&
3969                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3970                 then
3971                         dflt="$dflt -posix"
3972                 fi
3973                 ;;
3974         esac
3975         case "$gccversion" in
3976         1*) ;;
3977         2.[0-8]*) ;;
3978         ?*)     echo " "
3979                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3980                 echo 'int main(void) { return 0; }' > gcctest.c
3981                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3982                         echo "Yes, it does." 2>&1
3983                         case "$ccflags" in
3984                         *strict-aliasing*) 
3985                                 echo "Leaving current flags $ccflags alone." 2>&1
3986                                 ;;
3987                         *) dflt="$dflt -fno-strict-aliasing" ;;
3988                         esac
3989                 else
3990                         echo "Nope, it doesn't, but that's ok." 2>&1
3991                 fi
3992                 ;;
3993         esac
3994         ;;
3995 esac
3996
3997 case "$mips_type" in
3998 *BSD*|'') inclwanted="$locincpth $usrinc";;
3999 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4000 esac
4001 for thisincl in $inclwanted; do
4002         if $test -d $thisincl; then
4003                 if $test x$thisincl != x$usrinc; then
4004                         case "$dflt" in
4005                         *" -I$thisincl "*);;
4006                         *) dflt="$dflt -I$thisincl ";;
4007                         esac
4008                 fi
4009         fi
4010 done
4011
4012 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4013         xxx=true;
4014 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4015         xxx=true;
4016 else
4017         xxx=false;
4018 fi;
4019 if $xxx; then
4020         case "$dflt" in
4021         *$2*);;
4022         *) dflt="$dflt -D$2";;
4023         esac;
4024 fi'
4025
4026 set signal.h LANGUAGE_C; eval $inctest
4027
4028 case "$usesocks" in
4029 $define)
4030         ccflags="$ccflags -DSOCKS"
4031         ;;
4032 esac
4033
4034 case "$hint" in
4035 default|recommended) dflt="$ccflags $dflt" ;;
4036 *) dflt="$ccflags";;
4037 esac
4038
4039 case "$dflt" in
4040 ''|' ') dflt=none;;
4041 esac
4042
4043 $cat <<EOH
4044
4045 Your C compiler may want other flags.  For this question you should include
4046 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4047 but you should NOT include libraries or ld flags like -lwhatever.  If you
4048 want $package to honor its debug switch, you should include -DDEBUGGING here.
4049 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4050
4051 To use no flags, specify the word "none".
4052
4053 EOH
4054 set X $dflt
4055 shift
4056 dflt=${1+"$@"}
4057 rp="Any additional cc flags?"
4058 . ./myread
4059 case "$ans" in
4060 none) ccflags='';;
4061 *) ccflags="$ans";;
4062 esac
4063
4064 : the following weeds options from ccflags that are of no interest to cpp
4065 case "$cppflags" in
4066 '') cppflags="$ccflags" ;;
4067 *)  cppflags="$cppflags $ccflags" ;;
4068 esac
4069 case "$gccversion" in
4070 1*) cppflags="$cppflags -D__GNUC__"
4071 esac
4072 case "$mips_type" in
4073 '');;
4074 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4075 esac
4076 case "$cppflags" in
4077 '');;
4078 *)
4079         echo " "
4080         echo "Let me guess what the preprocessor flags are..." >&4
4081         set X $cppflags
4082         shift
4083         cppflags=''
4084         $cat >cpp.c <<'EOM'
4085 #define BLURFL foo
4086
4087 BLURFL xx LFRULB
4088 EOM
4089         previous=''
4090         for flag in $*
4091         do
4092                 case "$flag" in
4093                 -*) ftry="$flag";;
4094                 *) ftry="$previous $flag";;
4095                 esac
4096                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4097                         >cpp1.out 2>/dev/null && \
4098                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4099                         >cpp2.out 2>/dev/null && \
4100                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4101                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4102                 then
4103                         cppflags="$cppflags $ftry"
4104                         previous=''
4105                 else
4106                         previous="$flag"
4107                 fi
4108         done
4109         set X $cppflags
4110         shift
4111         cppflags=${1+"$@"}
4112         case "$cppflags" in
4113         *-*)  echo "They appear to be: $cppflags";;
4114         esac
4115         $rm -f cpp.c cpp?.out
4116         ;;
4117 esac
4118
4119 : flags used in final linking phase
4120 case "$ldflags" in
4121 '') if ./venix; then
4122                 dflt='-i -z'
4123         else
4124                 dflt=''
4125         fi
4126         case "$ccflags" in
4127         *-posix*) dflt="$dflt -posix" ;;
4128         esac
4129         ;;
4130 *) dflt="$ldflags";;
4131 esac
4132
4133 : Try to guess additional flags to pick up local libraries.
4134 for thislibdir in $libpth; do
4135         case " $loclibpth " in
4136         *" $thislibdir "*)
4137                 case "$dflt " in 
4138                 *"-L$thislibdir "*) ;;
4139                 *)  dflt="$dflt -L$thislibdir" ;;
4140                 esac
4141                 ;;
4142         esac
4143 done
4144
4145 case "$dflt" in
4146 '') dflt='none' ;;
4147 esac
4148
4149 $cat <<EOH
4150
4151 Your C linker may need flags.  For this question you should
4152 include -L/whatever and any other flags used by the C linker, but you
4153 should NOT include libraries like -lwhatever.
4154
4155 Make sure you include the appropriate -L/path flags if your C linker
4156 does not normally search all of the directories you specified above,
4157 namely
4158         $libpth
4159 To use no flags, specify the word "none".
4160
4161 EOH
4162
4163 rp="Any additional ld flags (NOT including libraries)?"
4164 . ./myread
4165 case "$ans" in
4166 none) ldflags='';;
4167 *) ldflags="$ans";;
4168 esac
4169 rmlist="$rmlist pdp11"
4170
4171 : coherency check
4172 echo " "
4173 echo "Checking your choice of C compiler and flags for coherency..." >&4
4174 $cat > try.c <<'EOF'
4175 #include <stdio.h>
4176 int main() { printf("Ok\n"); exit(0); }
4177 EOF
4178 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4179 shift
4180 $cat >try.msg <<'EOM'
4181 I've tried to compile and run the following simple program:
4182
4183 EOM
4184 $cat try.c >> try.msg
4185
4186 $cat >> try.msg <<EOM
4187
4188 I used the command:
4189
4190         $*
4191         ./try
4192
4193 and I got the following output:
4194
4195 EOM
4196 dflt=y
4197 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4198         if $sh -c './try' >>try.msg 2>&1; then
4199                 xxx=`./try`
4200                 case "$xxx" in
4201                 "Ok") dflt=n ;;
4202                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4203                         case " $libs " in
4204                         *" -lsfio "*)
4205                                 cat >> try.msg <<'EOQS'
4206 If $libs contains -lsfio, and sfio is mis-configured, then it
4207 sometimes (apparently) runs and exits with a 0 status, but with no
4208 output!  It may have to do with sfio's use of _exit vs. exit.
4209
4210 EOQS
4211                                 rp="You have a big problem.  Shall I abort Configure"
4212                                 dflt=y
4213                                 ;;
4214                         esac
4215                         ;;
4216                 esac
4217         else
4218                 echo "The program compiled OK, but exited with status $?." >>try.msg
4219                 rp="You have a problem.  Shall I abort Configure"
4220                 dflt=y
4221         fi
4222 else
4223         echo "I can't compile the test program." >>try.msg
4224         rp="You have a BIG problem.  Shall I abort Configure"
4225         dflt=y
4226 fi
4227 case "$dflt" in
4228 y)
4229         $cat try.msg >&4
4230         case "$knowitall" in
4231         '')
4232                 echo "(The supplied flags or libraries might be incorrect.)"
4233                 ;;
4234         *) dflt=n;;
4235         esac
4236         echo " "
4237         . ./myread
4238         case "$ans" in
4239         n*|N*) ;;
4240         *)      echo "Ok.  Stopping Configure." >&4
4241                 exit 1
4242                 ;;
4243         esac
4244         ;;
4245 n) echo "OK, that should do.";;
4246 esac
4247 $rm -f try try.* core
4248
4249 : define an is-a-typedef? function
4250 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4251 case "$inclist" in
4252 "") inclist="sys/types.h";;
4253 esac;
4254 eval "varval=\$$var";
4255 case "$varval" in
4256 "")
4257         $rm -f temp.c;
4258         for inc in $inclist; do
4259                 echo "#include <$inc>" >>temp.c;
4260         done;
4261         echo "#ifdef $type" >> temp.c;
4262         echo "printf(\"We have $type\");" >> temp.c;
4263         echo "#endif" >> temp.c;
4264         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4265         if $contains $type temp.E >/dev/null 2>&1; then
4266                 eval "$var=\$type";
4267         else
4268                 eval "$var=\$def";
4269         fi;
4270         $rm -f temp.?;;
4271 *) eval "$var=\$varval";;
4272 esac'
4273
4274 : define an is-a-typedef? function that prompts if the type is not available.
4275 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4276 case "$inclist" in
4277 "") inclist="sys/types.h";;
4278 esac;
4279 eval "varval=\$$var";
4280 case "$varval" in
4281 "")
4282         $rm -f temp.c;
4283         for inc in $inclist; do
4284                 echo "#include <$inc>" >>temp.c;
4285         done;
4286         echo "#ifdef $type" >> temp.c;
4287         echo "printf(\"We have $type\");" >> temp.c;
4288         echo "#endif" >> temp.c;
4289         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4290         echo " " ;
4291         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4292         if $contains $type temp.E >/dev/null 2>&1; then
4293                 echo "$type found." >&4;
4294                 eval "$var=\$type";
4295         else
4296                 echo "$type NOT found." >&4;
4297                 dflt="$def";
4298                 . ./myread ;
4299                 eval "$var=\$ans";
4300         fi;
4301         $rm -f temp.?;;
4302 *) eval "$var=\$varval";;
4303 esac'
4304
4305 : define a shorthand compile call
4306 compile='
4307 mc_file=$1;
4308 shift;
4309 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4310 : define a shorthand compile call for compilations that should be ok.
4311 compile_ok='
4312 mc_file=$1;
4313 shift;
4314 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4315
4316 : check for lengths of integral types
4317 echo " "
4318 case "$intsize" in
4319 '')
4320         echo "Checking to see how big your integers are..." >&4
4321         $cat >intsize.c <<'EOCP'
4322 #include <stdio.h>
4323 int main()
4324 {
4325         printf("intsize=%d;\n", (int)sizeof(int));
4326         printf("longsize=%d;\n", (int)sizeof(long));
4327         printf("shortsize=%d;\n", (int)sizeof(short));
4328         exit(0);
4329 }
4330 EOCP
4331         set intsize
4332         if eval $compile_ok && ./intsize > /dev/null; then
4333                 eval `./intsize`
4334                 echo "Your integers are $intsize bytes long."
4335                 echo "Your long integers are $longsize bytes long."
4336                 echo "Your short integers are $shortsize bytes long."
4337         else
4338                 $cat >&4 <<EOM
4339 !
4340 Help! I can't compile and run the intsize test program: please enlighten me!
4341 (This is probably a misconfiguration in your system or libraries, and
4342 you really ought to fix it.  Still, I'll try anyway.)
4343 !
4344 EOM
4345                 dflt=4
4346                 rp="What is the size of an integer (in bytes)?"
4347                 . ./myread
4348                 intsize="$ans"
4349                 dflt=$intsize
4350                 rp="What is the size of a long integer (in bytes)?"
4351                 . ./myread
4352                 longsize="$ans"
4353                 dflt=2
4354                 rp="What is the size of a short integer (in bytes)?"
4355                 . ./myread
4356                 shortsize="$ans"
4357         fi
4358         ;;
4359 esac
4360 $rm -f intsize intsize.*
4361
4362 : see what type lseek is declared as in the kernel
4363 rp="What is the type used for lseek's offset on this system?"
4364 set off_t lseektype long stdio.h sys/types.h
4365 eval $typedef_ask
4366
4367 echo " "
4368 echo "Checking to see how big your file offsets are..." >&4
4369 $cat >try.c <<EOCP
4370 #include <sys/types.h>
4371 #include <stdio.h>
4372 int main()
4373 {
4374     printf("%d\n", (int)sizeof($lseektype));
4375     return(0); 
4376 }
4377 EOCP
4378 set try
4379 if eval $compile_ok; then
4380         lseeksize=`./try`
4381         echo "Your file offsets are $lseeksize bytes long."
4382 else
4383         dflt=$longsize
4384         echo " "
4385         echo "(I can't seem to compile the test program.  Guessing...)"
4386         rp="What is the size of your file offsets (in bytes)?"
4387         . ./myread
4388         lseeksize="$ans"
4389 fi
4390 $rm -f try.c try
4391
4392 : see what type file positions are declared as in the library
4393 rp="What is the type for file position used by fsetpos()?"
4394 set fpos_t fpostype long stdio.h sys/types.h
4395 eval $typedef_ask
4396
4397 echo " "
4398 case "$fpostype" in
4399 *_t) zzz="$fpostype"    ;;
4400 *)   zzz="fpos_t"       ;;
4401 esac
4402 echo "Checking the size of $zzz..." >&4 
4403 cat > try.c <<EOCP
4404 #include <sys/types.h>
4405 #include <stdio.h>
4406 int main() {
4407     printf("%d\n", (int)sizeof($fpostype));
4408     exit(0);
4409 }
4410 EOCP
4411 set try
4412 if eval $compile_ok; then
4413         yyy=`./try`
4414         case "$yyy" in
4415         '')     fpossize=4
4416                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4417                 ;;
4418         *)      fpossize=$yyy
4419                 echo "Your $zzz is $fpossize bytes long."
4420                 ;;
4421         esac
4422 else
4423         dflt="$longsize"
4424         echo " " >&4
4425         echo "(I can't compile the test program.  Guessing...)" >&4
4426         rp="What is the size of your file positions (in bytes)?"
4427         . ./myread
4428         fpossize="$ans"
4429 fi
4430
4431
4432
4433 # Backward compatibility (uselfs is deprecated).
4434 case "$uselfs" in
4435 "$define"|true|[yY]*)
4436         cat <<EOM >&4
4437
4438 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4439 EOM
4440         uselargefiles="$define"
4441         ;;
4442 esac                          
4443
4444 case "$lseeksize:$fpossize" in
4445 8:8) cat <<EOM
4446
4447 You can have files larger than 2 gigabytes.
4448 EOM
4449    val="$define" ;;
4450 *)    case "$uselargefiles" in
4451    "$undef"|false|[nN]*) dflt='n' ;;
4452    *)   dflt='y' ;;
4453    esac
4454    cat <<EOM
4455
4456 Perl can be built to understand large files (files larger than 2 gigabytes)
4457 on some systems.  To do so, Configure can be run with -Duselargefiles.
4458
4459 If this doesn't make any sense to you, just accept the default '$dflt'.
4460 EOM
4461    rp='Try to understand large files, if available?'
4462    . ./myread
4463    case "$ans" in
4464    y|Y)         val="$define" ;;
4465    *)           val="$undef"  ;;
4466    esac
4467    ;;
4468 esac
4469 set uselargefiles
4470 eval $setvar
4471 case "$uselargefiles" in
4472 "$define")
4473 : Look for a hint-file generated 'call-back-unit'.  If the
4474 : user has specified that a large files perl is to be built,
4475 : we may need to set or change some other defaults.
4476         if $test -f uselargefiles.cbu; then
4477                 echo "Your platform has some specific hints for large file builds, using them..."
4478                 . ./uselargefiles.cbu
4479                 echo " "
4480                 echo "Rechecking to see how big your file offsets are..." >&4
4481                 $cat >try.c <<EOCP
4482 #include <sys/types.h>
4483 #include <stdio.h>
4484 int main()
4485 {
4486     printf("%d\n", (int)sizeof($lseektype));
4487     return(0); 
4488 }
4489 EOCP
4490                 set try
4491                 if eval $compile_ok; then
4492                         lseeksize=`./try`
4493                         $echo "Your file offsets are now $lseeksize bytes long."
4494                 else
4495                         dflt="$lseeksize"
4496                         echo " "
4497                         echo "(I can't seem to compile the test program.  Guessing...)"
4498                         rp="What is the size of your file offsets (in bytes)?"
4499                         . ./myread
4500                         lseeksize="$ans"
4501                 fi
4502                 case "$fpostype" in
4503                 *_t) zzz="$fpostype"    ;;
4504                 *)   zzz="fpos_t"       ;;
4505                 esac
4506                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4507                 $cat > try.c <<EOCP
4508 #include <sys/types.h>
4509 #include <stdio.h>
4510 int main() {
4511     printf("%d\n", (int)sizeof($fpostype));
4512     exit(0);
4513 }
4514 EOCP
4515                 set try
4516                 if eval $compile_ok; then
4517                         yyy=`./try`
4518                         dflt="$lseeksize"
4519                         case "$yyy" in
4520                         '')     echo " "
4521                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4522                                 ;;
4523                         *)      fpossize=$yyy
4524                                 echo " $fpossize bytes." >&4
4525                                 ;;
4526                         esac
4527                 else
4528                         dflt="$fpossize"
4529                         echo " "
4530                         echo "(I can't compile the test program.  Guessing...)" >&4
4531                         rp="What is the size of your file positions (in bytes)?"
4532                         . ./myread
4533                         fpossize="$ans"
4534                 fi
4535                 $rm -f try.c try
4536         fi
4537         ;;
4538 esac
4539
4540
4541 case "$usemorebits" in
4542 "$define"|true|[yY]*)
4543         use64bitint="$define"
4544         uselongdouble="$define"
4545         usemorebits="$define"
4546         ;;
4547 *)      usemorebits="$undef"
4548         ;;
4549 esac
4550
4551 : check for void type
4552 echo " "
4553 echo "Checking to see how well your C compiler groks the void type..." >&4
4554 case "$voidflags" in
4555 '')
4556         $cat >try.c <<'EOCP'
4557 #if TRY & 1
4558 void sub() {
4559 #else
4560 sub() {
4561 #endif
4562         extern void moo();      /* function returning void */
4563         void (*goo)();          /* ptr to func returning void */
4564 #if TRY & 8
4565         void *hue;              /* generic ptr */
4566 #endif
4567 #if TRY & 2
4568         void (*foo[10])();
4569 #endif
4570
4571 #if TRY & 4
4572         if(goo == moo) {
4573                 exit(0);
4574         }
4575 #endif
4576         exit(0);
4577 }
4578 int main() { sub(); }
4579 EOCP
4580         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4581                 voidflags=$defvoidused
4582         echo "Good.  It appears to support void to the level $package wants.">&4
4583                 if $contains warning .out >/dev/null 2>&1; then
4584                         echo "However, you might get some warnings that look like this:"
4585                         $cat .out
4586                 fi
4587         else
4588 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4589                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4590                         echo "It supports 1..."
4591                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4592                                 echo "It also supports 2..."
4593                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4594                                         voidflags=7
4595                                         echo "And it supports 4 but not 8 definitely."
4596                                 else
4597                                         echo "It doesn't support 4..."
4598                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4599                                                 voidflags=11
4600                                                 echo "But it supports 8."
4601                                         else
4602                                                 voidflags=3
4603                                                 echo "Neither does it support 8."
4604                                         fi
4605                                 fi
4606                         else
4607                                 echo "It does not support 2..."
4608                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4609                                         voidflags=13
4610                                         echo "But it supports 4 and 8."
4611                                 else
4612                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4613                                                 voidflags=5
4614                                                 echo "And it supports 4 but has not heard about 8."
4615                                         else
4616                                                 echo "However it supports 8 but not 4."
4617                                         fi
4618                                 fi
4619                         fi
4620                 else
4621                         echo "There is no support at all for void."
4622                         voidflags=0
4623                 fi
4624         fi
4625 esac
4626 case "$voidflags" in
4627 "$defvoidused") ;;
4628 *)      $cat >&4 <<'EOM'
4629   Support flag bits are:
4630     1: basic void declarations.
4631     2: arrays of pointers to functions returning void.
4632     4: operations between pointers to and addresses of void functions.
4633     8: generic void pointers.
4634 EOM
4635         dflt="$voidflags";
4636         rp="Your void support flags add up to what?"
4637         . ./myread
4638         voidflags="$ans"
4639         ;;
4640 esac
4641 $rm -f try.* .out
4642
4643 : check for length of pointer
4644 echo " "
4645 case "$ptrsize" in
4646 '')
4647         echo "Checking to see how big your pointers are..." >&4
4648         if test "$voidflags" -gt 7; then
4649                 echo '#define VOID_PTR char *' > try.c
4650         else
4651                 echo '#define VOID_PTR void *' > try.c
4652         fi
4653         $cat >>try.c <<'EOCP'
4654 #include <stdio.h>
4655 int main()
4656 {
4657     printf("%d\n", (int)sizeof(VOID_PTR));
4658     exit(0);
4659 }
4660 EOCP
4661         set try
4662         if eval $compile_ok; then
4663                 ptrsize=`./try`
4664                 echo "Your pointers are $ptrsize bytes long."
4665         else
4666                 dflt='4'
4667                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4668                 rp="What is the size of a pointer (in bytes)?"
4669                 . ./myread
4670                 ptrsize="$ans"
4671         fi
4672         ;;
4673 esac
4674 $rm -f try.c try
4675
4676 : check for long long
4677 echo " "
4678 echo "Checking to see if you have long long..." >&4
4679 echo 'int main() { long long x = 7; return 0; }' > try.c
4680 set try
4681 if eval $compile; then
4682         val="$define"
4683         echo "You have long long."
4684 else
4685         val="$undef"
4686         echo "You do not have long long."
4687 fi
4688 $rm try.*
4689 set d_longlong
4690 eval $setvar
4691
4692 : check for length of long long
4693 case "${d_longlong}${longlongsize}" in
4694 $define)
4695         echo " "
4696         echo "Checking to see how big your long longs are..." >&4
4697         $cat >try.c <<'EOCP'
4698 #include <stdio.h>
4699 int main()
4700 {
4701     printf("%d\n", (int)sizeof(long long));
4702     return(0);
4703 }
4704 EOCP
4705         set try
4706         if eval $compile_ok; then
4707                 longlongsize=`./try$exe_ext`
4708                 echo "Your long longs are $longlongsize bytes long."
4709         else
4710                 dflt='8'
4711                 echo " "
4712                 echo "(I can't seem to compile the test program.  Guessing...)"
4713                 rp="What is the size of a long long (in bytes)?"
4714                 . ./myread
4715                 longlongsize="$ans"
4716         fi
4717         if $test "X$longsize" = "X$longlongsize"; then
4718                 echo "(That isn't any different from an ordinary long.)"
4719         fi      
4720         ;;
4721 esac
4722 $rm -f try.* try
4723
4724 : determine filename position in cpp output
4725 echo " "
4726 echo "Computing filename position in cpp output for #include directives..." >&4
4727 echo '#include <stdio.h>' > foo.c
4728 $cat >fieldn <<EOF
4729 $startsh
4730 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4731 $grep '^[       ]*#.*stdio\.h' | \
4732 while read cline; do
4733         pos=1
4734         set \$cline
4735         while $test \$# -gt 0; do
4736                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4737                         echo "\$pos"
4738                         exit 0
4739                 fi
4740                 shift
4741                 pos=\`expr \$pos + 1\`
4742         done
4743 done
4744 EOF
4745 chmod +x fieldn
4746 fieldn=`./fieldn`
4747 $rm -f foo.c fieldn
4748 case $fieldn in
4749 '') pos='???';;
4750 1) pos=first;;
4751 2) pos=second;;
4752 3) pos=third;;
4753 *) pos="${fieldn}th";;
4754 esac
4755 echo "Your cpp writes the filename in the $pos field of the line."
4756
4757 : locate header file
4758 $cat >findhdr <<EOF
4759 $startsh
4760 wanted=\$1
4761 name=''
4762 for usrincdir in $usrinc
4763 do
4764         if test -f \$usrincdir/\$wanted; then
4765                 echo "\$usrincdir/\$wanted"
4766                 exit 0
4767         fi
4768 done
4769 awkprg='{ print \$$fieldn }'
4770 echo "#include <\$wanted>" > foo\$\$.c
4771 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4772 $grep "^[       ]*#.*\$wanted" | \
4773 while read cline; do
4774         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4775         case "\$name" in
4776         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4777         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4778         *) exit 2;;
4779         esac;
4780 done;
4781 #
4782 # status = 0: grep returned 0 lines, case statement not executed
4783 # status = 1: headerfile found
4784 # status = 2: while loop executed, no headerfile found
4785 #
4786 status=\$?
4787 $rm -f foo\$\$.c;
4788 if test \$status -eq 1; then
4789         exit 0;
4790 fi
4791 exit 1
4792 EOF
4793 chmod +x findhdr
4794
4795 : define an alternate in-header-list? function
4796 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4797 cont=true; xxf="echo \"<\$1> found.\" >&4";
4798 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4799 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4800 esac;
4801 case $# in 4) instead=instead;; *) instead="at last";; esac;
4802 while $test "$cont"; do
4803         xxx=`./findhdr $1`
4804         var=$2; eval "was=\$$2";
4805         if $test "$xxx" && $test -r "$xxx";
4806         then eval $xxf;
4807         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4808                 cont="";
4809         else eval $xxnf;
4810         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4811         set $yyy; shift; shift; yyy=$@;
4812         case $# in 0) cont="";;
4813         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4814                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4815         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4816                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4817         esac;
4818 done;
4819 while $test "$yyy";
4820 do set $yyy; var=$2; eval "was=\$$2";
4821         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4822         set $yyy; shift; shift; yyy=$@;
4823 done'
4824
4825 : see if inttypes.h is available
4826 : we want a real compile instead of Inhdr because some systems
4827 : have an inttypes.h which includes non-existent headers
4828 echo " "
4829 $cat >try.c <<EOCP
4830 #include <inttypes.h>
4831 int main() {
4832         static int32_t foo32 = 0x12345678;
4833 }
4834 EOCP
4835 set try
4836 if eval $compile; then
4837         echo "<inttypes.h> found." >&4
4838         val="$define"
4839 else
4840         echo "<inttypes.h> NOT found." >&4
4841         val="$undef"
4842 fi
4843 $rm -f try.c try
4844 set i_inttypes
4845 eval $setvar
4846
4847 : check for int64_t
4848 echo " "
4849 echo "Checking to see if you have int64_t..." >&4
4850 $cat >try.c <<EOCP
4851 #include <sys/types.h>
4852 #$i_inttypes I_INTTYPES
4853 #ifdef I_INTTYPES
4854 #include <inttypes.h>
4855 #endif
4856 int main() { int64_t x = 7; }
4857 EOCP
4858 set try
4859 if eval $compile; then
4860         val="$define"
4861         echo "You have int64_t."
4862 else
4863         val="$undef"
4864         echo "You do not have int64_t."
4865 fi
4866 $rm -f try try.*
4867 set d_int64_t
4868 eval $setvar
4869
4870
4871 echo " "
4872 echo "Checking which 64-bit integer type we could use..." >&4
4873
4874 case "$intsize" in
4875 8) val=int
4876    set quadtype
4877    eval $setvar
4878    val='"unsigned int"'
4879    set uquadtype
4880    eval $setvar
4881    quadkind=1
4882    ;;
4883 *) case "$longsize" in
4884    8) val=long
4885       set quadtype
4886       eval $setvar
4887       val='"unsigned long"'
4888       set uquadtype
4889       eval $setvar
4890       quadkind=2
4891       ;;
4892    *) case "$d_longlong:$longlongsize" in
4893       define:8)
4894         val='"long long"'
4895         set quadtype
4896         eval $setvar
4897         val='"unsigned long long"'
4898         set uquadtype
4899         eval $setvar
4900         quadkind=3
4901         ;;
4902       *) case "$d_int64_t" in
4903          define)
4904            val=int64_t
4905            set quadtype
4906            eval $setvar
4907            val=uint64_t
4908            set uquadtype
4909            eval $setvar
4910            quadkind=4
4911            ;;
4912          esac
4913          ;;
4914       esac
4915       ;;
4916    esac
4917    ;;
4918 esac
4919
4920 case "$quadtype" in
4921 '')     echo "Alas, no 64-bit integer types in sight." >&4
4922         d_quad="$undef"
4923         ;;
4924 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4925         d_quad="$define"
4926         ;;
4927 esac
4928
4929
4930 case "$uselonglong" in
4931 "$define"|true|[yY]*)
4932         cat <<EOM >&4
4933
4934 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4935 EOM
4936         use64bitint="$define"
4937         ;;
4938 esac                          
4939 case "$use64bits" in
4940 "$define"|true|[yY]*)
4941         cat <<EOM >&4
4942
4943 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4944 EOM
4945         use64bitint="$define"
4946         ;;
4947 esac                          
4948 case "$use64bitints" in
4949 "$define"|true|[yY]*)
4950         cat <<EOM >&4
4951
4952 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4953 EOM
4954         use64bitint="$define"
4955         ;;
4956 esac                          
4957 case "$use64bitsint" in
4958 "$define"|true|[yY]*)
4959         cat <<EOM >&4
4960
4961 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4962 EOM
4963         use64bitint="$define"
4964         ;;
4965 esac                          
4966 case "$uselonglongs" in
4967 "$define"|true|[yY]*)
4968         cat <<EOM >&4
4969
4970 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4971 EOM
4972         use64bitint="$define"
4973         ;;
4974 esac                          
4975 case "$use64bitsall" in
4976 "$define"|true|[yY]*)
4977         cat <<EOM >&4
4978
4979 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4980 EOM
4981         use64bitall="$define"
4982         ;;
4983 esac                          
4984
4985 case "$ccflags" in
4986 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4987 esac
4988 case "$use64bitall" in
4989 "$define"|true|[yY]*) use64bitint="$define" ;;
4990 esac
4991
4992 case "$longsize" in
4993 8) cat <<EOM
4994
4995 You have natively 64-bit long integers.
4996 EOM
4997    val="$define"
4998    ;;
4999 *) case "$use64bitint" in
5000    "$define"|true|[yY]*) dflt='y';;
5001    *) dflt='n';;
5002    esac
5003    case "$d_quad" in
5004    "$define") ;;
5005    *) dflt='n' ;;
5006    esac
5007    cat <<EOM
5008
5009 Perl can be built to take advantage of 64-bit integer types
5010 on some systems.  To do so, Configure can be run with -Duse64bitint.
5011 Choosing this option will most probably introduce binary incompatibilities.
5012
5013 If this doesn't make any sense to you, just accept the default '$dflt'.
5014 (The default has been chosen based on your configuration.)
5015 EOM
5016    rp='Try to use 64-bit integers, if available?'
5017    . ./myread
5018    case "$ans" in
5019    [yY]*) val="$define" ;;
5020    *)     val="$undef"  ;;
5021    esac
5022    ;;
5023 esac
5024 set use64bitint
5025 eval $setvar
5026
5027 case "$use64bitall" in
5028 "$define"|true|[yY]*) dflt='y' ;;
5029 *) case "$longsize" in
5030    8) dflt='y' ;;
5031    *) dflt='n' ;;
5032    esac
5033    ;;
5034 esac    
5035 cat <<EOM
5036
5037 You may also choose to try maximal 64-bitness.  It means using as much
5038 64-bitness as possible on the platform.  This in turn means even more
5039 binary incompatibilities.  On the other hand, your platform may not
5040 have any more 64-bitness available than what you already have chosen.
5041
5042 If this doesn't make any sense to you, just accept the default '$dflt'.
5043 (The default has been chosen based on your configuration.)
5044 EOM
5045 rp='Try to use maximal 64-bit support, if available?'
5046 . ./myread
5047 case "$ans" in
5048 [yY]*) val="$define" ;;
5049 *)     val="$undef"  ;;
5050 esac
5051 set use64bitall
5052 eval $setvar
5053 case "$use64bitall" in
5054 "$define")
5055         case "$use64bitint" in
5056         "$undef")
5057                 cat <<EOM
5058
5059 Since you have chosen a maximally 64-bit build, I'm also turning on
5060 the use of 64-bit integers.
5061 EOM
5062                 use64bitint="$define" ;;
5063         esac
5064         ;;
5065 esac
5066
5067 case "$use64bitall" in
5068 "$define"|true|[yY]*)
5069         case "$ptrsize" in
5070         4)      cat <<EOM >&4
5071
5072 *** You have chosen a maximally 64-bit build, but your pointers
5073 *** are only 4 bytes wide, disabling maximal 64-bitness.
5074
5075 EOM
5076                 use64bitall="$undef"
5077                 case "$use64bitint" in
5078                 "$define"|true|[yY]*) ;;
5079                 *)      cat <<EOM >&4
5080
5081 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5082
5083 EOM
5084                         use64bitint="$define"
5085                         ;;
5086                 esac
5087                 ;;
5088         esac
5089         ;;
5090 esac
5091
5092 case "$use64bitint" in
5093 "$define"|true|[yY]*)
5094 : Look for a hint-file generated 'call-back-unit'.  If the
5095 : user has specified that a 64-bit perl is to be built,
5096 : we may need to set or change some other defaults.
5097         if $test -f use64bitint.cbu; then
5098                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5099                 . ./use64bitint.cbu
5100         fi
5101         case "$longsize" in
5102         4) case "$archname64" in
5103            '') archname64=64int ;;
5104            esac
5105            ;;
5106         esac
5107         ;;
5108 esac
5109
5110 case "$use64bitall" in
5111 "$define"|true|[yY]*)
5112 : Look for a hint-file generated 'call-back-unit'.  If the
5113 : user has specified that a maximally 64-bit perl is to be built,
5114 : we may need to set or change some other defaults.
5115         if $test -f use64bitall.cbu; then
5116                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5117                 . ./use64bitall.cbu
5118         fi
5119         case "$longsize" in
5120         4) case "$archname64" in
5121            ''|64int) archname64=64all ;;
5122            esac
5123            ;;
5124         esac
5125         ;;
5126 esac
5127
5128 echo " "
5129 echo "Checking for GNU C Library..." >&4
5130 cat >gnulibc.c <<EOM
5131 #include <stdio.h>
5132 int main()
5133 {
5134 #ifdef __GLIBC__
5135     exit(0);
5136 #else
5137     exit(1);
5138 #endif
5139 }
5140 EOM
5141 set gnulibc
5142 if eval $compile_ok && ./gnulibc; then
5143         val="$define"
5144         echo "You are using the GNU C Library"
5145 else
5146         val="$undef"
5147         echo "You are not using the GNU C Library"
5148 fi
5149 $rm -f gnulibc*
5150 set d_gnulibc
5151 eval $setvar
5152
5153 : see if nm is to be used to determine whether a symbol is defined or not
5154 case "$usenm" in
5155 '')
5156         dflt=''
5157         case "$d_gnulibc" in
5158         "$define")
5159                 echo " "
5160                 echo "nm probably won't work on the GNU C Library." >&4
5161                 dflt=n
5162                 ;;
5163         esac
5164         case "$dflt" in
5165         '') 
5166                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5167                         echo " "
5168                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5169                         echo "'nm' won't be sufficient on this sytem." >&4
5170                         dflt=n
5171                 fi
5172                 ;;
5173         esac
5174         case "$dflt" in
5175         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5176                 if $test $dflt -gt 20; then
5177                         dflt=y
5178                 else
5179                         dflt=n
5180                 fi
5181                 ;;
5182         esac
5183         ;;
5184 *)
5185         case "$usenm" in
5186         true|$define) dflt=y;;
5187         *) dflt=n;;
5188         esac
5189         ;;
5190 esac
5191 $cat <<EOM
5192
5193 I can use $nm to extract the symbols from your C libraries. This
5194 is a time consuming task which may generate huge output on the disk (up
5195 to 3 megabytes) but that should make the symbols extraction faster. The
5196 alternative is to skip the 'nm' extraction part and to compile a small
5197 test program instead to determine whether each symbol is present. If
5198 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5199 this may be the best solution.
5200
5201 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5202
5203 EOM
5204 rp="Shall I use $nm to extract C symbols from the libraries?"
5205 . ./myread
5206 case "$ans" in
5207 [Nn]*) usenm=false;;
5208 *) usenm=true;;
5209 esac
5210
5211 runnm=$usenm
5212 case "$reuseval" in
5213 true) runnm=false;;
5214 esac
5215
5216 : nm options which may be necessary
5217 case "$nm_opt" in
5218 '') if $test -f /mach_boot; then
5219                 nm_opt=''       # Mach
5220         elif $test -d /usr/ccs/lib; then
5221                 nm_opt='-p'     # Solaris (and SunOS?)
5222         elif $test -f /dgux; then
5223                 nm_opt='-p'     # DG-UX
5224         elif $test -f /lib64/rld; then
5225                 nm_opt='-p'     # 64-bit Irix
5226         else
5227                 nm_opt=''
5228         fi;;
5229 esac
5230
5231 : nm options which may be necessary for shared libraries but illegal
5232 : for archive libraries.  Thank you, Linux.
5233 case "$nm_so_opt" in
5234 '')     case "$myuname" in
5235         *linux*)
5236                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5237                         nm_so_opt='--dynamic'
5238                 fi
5239                 ;;
5240         esac
5241         ;;
5242 esac
5243
5244 case "$runnm" in
5245 true)
5246 : get list of predefined functions in a handy place
5247 echo " "
5248 case "$libc" in
5249 '') libc=unknown
5250         case "$libs" in
5251         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5252         esac
5253         ;;
5254 esac
5255 libnames='';
5256 case "$libs" in
5257 '') ;;
5258 *)  for thislib in $libs; do
5259         case "$thislib" in
5260         -lc|-lc_s)
5261                 : Handle C library specially below.
5262                 ;;
5263         -l*)
5264                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5265                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5266                         :
5267                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5268                         :
5269                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5270                         :
5271                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5272                         :
5273                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5274                         :
5275                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5276                         :
5277                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5278                         :
5279                 else
5280                         try=''
5281                 fi
5282                 libnames="$libnames $try"
5283                 ;;
5284         *) libnames="$libnames $thislib" ;;
5285         esac
5286         done
5287         ;;
5288 esac
5289 xxx=normal
5290 case "$libc" in
5291 unknown)
5292         set /lib/libc.$so
5293         for xxx in $libpth; do
5294                 $test -r $1 || set $xxx/libc.$so
5295                 : The messy sed command sorts on library version numbers.
5296                 $test -r $1 || \
5297                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5298                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5299                                 h
5300                                 s/[0-9][0-9]*/0000&/g
5301                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5302                                 G
5303                                 s/\n/ /' | \
5304                          $sort | $sed -e 's/^.* //'`
5305                 eval set \$$#
5306         done
5307         $test -r $1 || set /usr/ccs/lib/libc.$so
5308         $test -r $1 || set /lib/libsys_s$_a
5309         ;;
5310 *)
5311         set blurfl
5312         ;;
5313 esac
5314 if $test -r "$1"; then
5315         echo "Your (shared) C library seems to be in $1."
5316         libc="$1"
5317 elif $test -r /lib/libc && $test -r /lib/clib; then
5318         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5319         xxx=apollo
5320         libc='/lib/clib /lib/libc'
5321         if $test -r /lib/syslib; then
5322                 echo "(Your math library is in /lib/syslib.)"
5323                 libc="$libc /lib/syslib"
5324         fi
5325 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5326         echo "Your C library seems to be in $libc, as you said before."
5327 elif $test -r $incpath/usr/lib/libc$_a; then
5328         libc=$incpath/usr/lib/libc$_a;
5329         echo "Your C library seems to be in $libc.  That's fine."
5330 elif $test -r /lib/libc$_a; then
5331         libc=/lib/libc$_a;
5332         echo "Your C library seems to be in $libc.  You're normal."
5333 else
5334         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5335                 :
5336         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5337                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5338         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5339                 :
5340         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5341                 :
5342         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5343                 :
5344         else
5345                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5346         fi
5347         if $test -r "$tans"; then
5348                 echo "Your C library seems to be in $tans, of all places."
5349                 libc=$tans
5350         else
5351                 libc='blurfl'
5352         fi
5353 fi
5354 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5355         dflt="$libc"
5356         cat <<EOM
5357
5358 If the guess above is wrong (which it might be if you're using a strange
5359 compiler, or your machine supports multiple models), you can override it here.
5360
5361 EOM
5362 else
5363         dflt=''
5364         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5365         cat >&4 <<EOM
5366 I can't seem to find your C library.  I've looked in the following places:
5367
5368 EOM
5369         $sed 's/^/      /' libpath
5370         cat <<EOM
5371
5372 None of these seems to contain your C library. I need to get its name...
5373
5374 EOM
5375 fi
5376 fn=f
5377 rp='Where is your C library?'
5378 . ./getfile
5379 libc="$ans"
5380
5381 echo " "
5382 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5383 set X `cat libnames`
5384 shift
5385 xxx=files
5386 case $# in 1) xxx=file; esac
5387 echo "Extracting names from the following $xxx for later perusal:" >&4
5388 echo " "
5389 $sed 's/^/      /' libnames >&4
5390 echo " "
5391 $echo $n "This may take a while...$c" >&4
5392
5393 for file in $*; do
5394         case $file in
5395         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5396         *) $nm $nm_opt $file 2>/dev/null;;
5397         esac
5398 done >libc.tmp
5399
5400 $echo $n ".$c"
5401 $grep fprintf libc.tmp > libc.ptf
5402 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5403 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5404 xxx='[ADTSIW]'
5405 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5406         eval $xscan;\
5407         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5408                 eval $xrun
5409 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5410         eval $xscan;\
5411         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5412                 eval $xrun
5413 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5414         eval $xscan;\
5415         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5416                 eval $xrun
5417 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5418         eval $xscan;\
5419         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5420                 eval $xrun
5421 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5422         eval $xscan;\
5423         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5424                 eval $xrun
5425 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5426         eval $xscan;\
5427         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5428                 eval $xrun
5429 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5430                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5431         eval $xscan;\
5432         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5433                 eval $xrun
5434 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5435         eval $xscan;\
5436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5437                 eval $xrun
5438 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5439         eval $xscan;\
5440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5441                 eval $xrun
5442 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5443         eval $xscan;\
5444         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5445                 eval $xrun
5446 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5447         eval $xscan;\
5448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5449                 eval $xrun
5450 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5451         eval $xscan;\
5452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5453                 eval $xrun
5454 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5455         eval $xscan;\
5456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5457                 eval $xrun
5458 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5459         eval $xscan;\
5460         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5461                 eval $xrun
5462 else
5463         $nm -p $* 2>/dev/null >libc.tmp
5464         $grep fprintf libc.tmp > libc.ptf
5465         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5466                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5467         then
5468                 nm_opt='-p'
5469                 eval $xrun
5470         else
5471                 echo " "
5472                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5473                 com=''
5474                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5475                         for thisname in $libnames $libc; do
5476                                 $ar t $thisname >>libc.tmp
5477                         done
5478                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5479                         echo "Ok." >&4
5480                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5481                         # Repeat libc to extract forwarders to DLL entries too
5482                         for thisname in $libnames $libc; do
5483                                 $ar tv $thisname >>libc.tmp
5484                                 # Revision 50 of EMX has bug in $ar.
5485                                 # it will not extract forwarders to DLL entries
5486                                 # Use emximp which will extract exactly them.
5487                                 emximp -o tmp.imp $thisname \
5488                                     2>/dev/null && \
5489                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5490                                     < tmp.imp >>libc.tmp
5491                                 $rm tmp.imp
5492                         done
5493                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5494                         echo "Ok." >&4
5495                 else
5496                         echo "$ar didn't seem to work right." >&4
5497                         echo "Maybe this is a Cray...trying bld instead..." >&4
5498                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5499                         then
5500                                 for thisname in $libnames; do
5501                                         bld t $libnames | \
5502                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5503                                         $ar t $thisname >>libc.tmp
5504                                 done
5505                                 echo "Ok." >&4
5506                         else
5507                                 echo "That didn't work either.  Giving up." >&4
5508                                 exit 1
5509                         fi
5510                 fi
5511         fi
5512 fi
5513 nm_extract="$com"
5514 if $test -f /lib/syscalls.exp; then
5515         echo " "
5516         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5517         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5518 fi
5519 ;;
5520 esac
5521 $rm -f libnames libpath
5522
5523 : is a C symbol defined?
5524 csym='tlook=$1;
5525 case "$3" in
5526 -v) tf=libc.tmp; tc=""; tdc="";;
5527 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5528 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5529 esac;
5530 tx=yes;
5531 case "$reuseval-$4" in
5532 true-) ;;
5533 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5534 esac;
5535 case "$tx" in
5536 yes)
5537         case "$runnm" in
5538         true)
5539                 if $contains $tlook $tf >/dev/null 2>&1;
5540                 then tval=true;
5541                 else tval=false;
5542                 fi;;
5543         *)
5544                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5545                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5546                 then tval=true;
5547                 else tval=false;
5548                 fi;
5549                 $rm -f t t.c;;
5550         esac;;
5551 *)
5552         case "$tval" in
5553         $define) tval=true;;
5554         *) tval=false;;
5555         esac;;
5556 esac;
5557 eval "$2=$tval"'
5558
5559 : define an is-in-libc? function
5560 inlibc='echo " "; td=$define; tu=$undef;
5561 sym=$1; var=$2; eval "was=\$$2";
5562 tx=yes;
5563 case "$reuseval$was" in
5564 true) ;;
5565 true*) tx=no;;
5566 esac;
5567 case "$tx" in
5568 yes)
5569         set $sym tres -f;
5570         eval $csym;
5571         case "$tres" in
5572         true)
5573                 echo "$sym() found." >&4;
5574                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5575         *)
5576                 echo "$sym() NOT found." >&4;
5577                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5578         esac;;
5579 *)
5580         case "$was" in
5581         $define) echo "$sym() found." >&4;;
5582         *) echo "$sym() NOT found." >&4;;
5583         esac;;
5584 esac'
5585
5586 : see if sqrtl exists
5587 set sqrtl d_sqrtl
5588 eval $inlibc
5589
5590 case "$ccflags" in
5591 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5592 esac
5593
5594 case "$uselongdouble" in
5595 $define|true|[yY]*)     dflt='y';;
5596 *) dflt='n';;
5597 esac
5598 cat <<EOM
5599
5600 Perl can be built to take advantage of long doubles which
5601 (if available) may give more accuracy and range for floating point numbers.
5602
5603 If this doesn't make any sense to you, just accept the default '$dflt'.
5604 EOM
5605 rp='Try to use long doubles if available?'
5606 . ./myread
5607 case "$ans" in
5608 y|Y)    val="$define"   ;;
5609 *)      val="$undef"    ;;
5610 esac
5611 set uselongdouble
5612 eval $setvar
5613
5614 case "$uselongdouble" in
5615 true|[yY]*) uselongdouble="$define" ;;
5616 esac
5617
5618 case "$uselongdouble" in
5619 $define)
5620 : Look for a hint-file generated 'call-back-unit'.  If the
5621 : user has specified that long doubles should be used,
5622 : we may need to set or change some other defaults.
5623         if $test -f uselongdouble.cbu; then
5624                 echo "Your platform has some specific hints for long doubles, using them..."
5625                 . ./uselongdouble.cbu
5626         else
5627                 $cat <<EOM
5628 (Your platform doesn't have any specific hints for long doubles.)
5629 EOM
5630         fi
5631         ;;
5632 esac
5633
5634 case "$uselongdouble:$d_sqrtl" in
5635 $define:$undef)
5636                 $cat <<EOM >&4
5637
5638 *** You requested the use of long doubles but you do not seem to have
5639 *** the mathematic functions for long doubles.  I'm disabling the use
5640 *** of long doubles.
5641
5642 EOM
5643         uselongdouble=$undef
5644         ;;
5645 esac
5646
5647 : check for length of double
5648 echo " "
5649 case "$doublesize" in
5650 '')
5651         echo "Checking to see how big your double precision numbers are..." >&4
5652         $cat >try.c <<'EOCP'
5653 #include <stdio.h>
5654 int main()
5655 {
5656     printf("%d\n", (int)sizeof(double));
5657     exit(0);
5658 }
5659 EOCP
5660         set try
5661         if eval $compile_ok; then
5662                 doublesize=`./try`
5663                 echo "Your double is $doublesize bytes long."
5664         else
5665                 dflt='8'
5666                 echo "(I can't seem to compile the test program.  Guessing...)"
5667                 rp="What is the size of a double precision number (in bytes)?"
5668                 . ./myread
5669                 doublesize="$ans"
5670         fi
5671         ;;
5672 esac
5673 $rm -f try.c try
5674
5675 : check for long doubles
5676 echo " "
5677 echo "Checking to see if you have long double..." >&4
5678 echo 'int main() { long double x = 7.0; }' > try.c
5679 set try
5680 if eval $compile; then
5681         val="$define"
5682         echo "You have long double."
5683 else
5684         val="$undef"
5685         echo "You do not have long double."
5686 fi
5687 $rm try.*
5688 set d_longdbl
5689 eval $setvar
5690
5691 : check for length of long double
5692 case "${d_longdbl}${longdblsize}" in
5693 $define)
5694         echo " "
5695         echo "Checking to see how big your long doubles are..." >&4
5696         $cat >try.c <<'EOCP'
5697 #include <stdio.h>
5698 int main()
5699 {
5700         printf("%d\n", sizeof(long double));
5701 }
5702 EOCP
5703         set try
5704         set try
5705         if eval $compile; then
5706                 longdblsize=`./try$exe_ext`
5707                 echo "Your long doubles are $longdblsize bytes long."
5708         else
5709                 dflt='8'
5710                 echo " "
5711                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5712                 rp="What is the size of a long double (in bytes)?"
5713                 . ./myread
5714                 longdblsize="$ans"
5715         fi
5716         if $test "X$doublesize" = "X$longdblsize"; then
5717                 echo "(That isn't any different from an ordinary double.)"
5718         fi      
5719         ;;
5720 esac
5721 $rm -f try.* try
5722
5723 case "$useperlio" in
5724 $define|true|[yY]*|'')  dflt='y';;
5725 *) dflt='n';;
5726 esac
5727 cat <<EOM
5728
5729 Previous version of $package used the standard IO mechanisms as
5730 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5731 alternate IO mechanisms via the PerlIO abstraction layer, but the
5732 stdio mechanism is still available if needed.  The abstraction layer
5733 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5734 Using PerlIO with sfio may cause problems with some extension modules.
5735
5736 If this doesn't make any sense to you, just accept the default '$dflt'.
5737 EOM
5738 rp='Use the PerlIO abstraction layer?'
5739 . ./myread
5740 case "$ans" in
5741 y|Y) 
5742         val="$define"
5743         ;;
5744 *)      
5745         echo "Ok, doing things the stdio way."
5746         val="$undef"
5747         ;;
5748 esac
5749 set useperlio
5750 eval $setvar 
5751
5752 case "$usesocks" in
5753 $define|true|[yY]*)
5754         case "$useperlio" in
5755         $define|true|[yY]*) ;;
5756         *)      cat >&4 <<EOM
5757
5758 You are using the SOCKS proxy protocol library which means that you
5759 should also use the PerlIO layer.  You may be headed for trouble.
5760
5761 EOM
5762                 ;;
5763         esac
5764         ;;
5765 esac
5766
5767         
5768 : determine the architecture name
5769 echo " "
5770 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5771         tarch=`arch`"-$osname"
5772 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5773         if uname -m > tmparch 2>&1 ; then
5774                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5775                         -e 's/$/'"-$osname/" tmparch`
5776         else
5777                 tarch="$osname"
5778         fi
5779         $rm -f tmparch
5780 else
5781         tarch="$osname"
5782 fi
5783 case "$myarchname" in
5784 ''|"$tarch") ;;
5785 *)
5786         echo "(Your architecture name used to be $myarchname.)"
5787         archname=''
5788         ;;
5789 esac
5790 myarchname="$tarch"
5791 case "$archname" in
5792 '') dflt="$tarch";;
5793 *) dflt="$archname";;
5794 esac
5795 rp='What is your architecture name'
5796 . ./myread
5797 archname="$ans"
5798 case "$usethreads" in
5799 $define)
5800         echo "Threads selected." >&4
5801         case "$archname" in
5802         *-thread*) echo "...and architecture name already has -thread." >&4
5803                 ;;
5804         *)      archname="$archname-thread"
5805                 echo "...setting architecture name to $archname." >&4
5806                 ;;
5807         esac
5808         ;;
5809 esac
5810 case "$usemultiplicity" in
5811 $define)
5812         echo "Multiplicity selected." >&4
5813         case "$archname" in
5814         *-multi*) echo "...and architecture name already has -multi." >&4
5815                 ;;
5816         *)      archname="$archname-multi"
5817                 echo "...setting architecture name to $archname." >&4
5818                 ;;
5819         esac
5820         ;;
5821 esac
5822 case "$use64bitint$use64bitall" in
5823 *"$define"*)
5824         case "$archname64" in
5825         '')
5826                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5827                 ;;
5828         *)
5829                 case "$use64bitint" in
5830                 "$define") echo "64 bit integers selected." >&4 ;;
5831                 esac
5832                 case "$use64bitall" in
5833                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5834                 esac
5835                 case "$archname" in
5836                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5837                         ;;
5838                 *)      archname="$archname-$archname64"
5839                         echo "...setting architecture name to $archname." >&4
5840                         ;;
5841                 esac
5842                 ;;
5843         esac
5844 esac
5845 case "$uselongdouble" in
5846 $define)
5847         echo "Long doubles selected." >&4
5848         case "$longdblsize" in
5849         $doublesize)
5850                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5851                 ;;
5852         *)
5853                 case "$archname" in
5854                 *-ld*) echo "...and architecture name already has -ld." >&4
5855                         ;;
5856                 *)      archname="$archname-ld"
5857                         echo "...setting architecture name to $archname." >&4
5858                         ;;
5859                 esac
5860                 ;;
5861         esac
5862         ;;
5863 esac
5864 case "$useperlio" in
5865 $define)
5866         echo "Perlio selected." >&4
5867         ;;
5868 *)
5869         echo "Perlio not selected, using stdio." >&4
5870         case "$archname" in
5871         *-stdio*) echo "...and architecture name already has -stdio." >&4
5872                 ;;
5873         *)      archname="$archname-stdio"
5874                 echo "...setting architecture name to $archname." >&4
5875                 ;;
5876         esac
5877         ;;
5878 esac
5879
5880 : determine root of directory hierarchy where package will be installed.
5881 case "$prefix" in
5882 '')
5883         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5884         ;;
5885 *)
5886         dflt="$prefix"
5887         ;;
5888 esac
5889 $cat <<EOM
5890
5891 By default, $package will be installed in $dflt/bin, manual pages
5892 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5893 installation directories. Typically this is something like /usr/local.
5894 If you wish to have binaries under /usr/bin but other parts of the
5895 installation under /usr/local, that's ok: you will be prompted
5896 separately for each of the installation directories, the prefix being
5897 only used to set the defaults.
5898
5899 EOM
5900 fn=d~
5901 rp='Installation prefix to use?'
5902 . ./getfile
5903 oldprefix=''
5904 case "$prefix" in
5905 '') ;;
5906 *)
5907         case "$ans" in
5908         "$prefix") ;;
5909         *) oldprefix="$prefix";;
5910         esac
5911         ;;
5912 esac
5913 prefix="$ans"
5914 prefixexp="$ansexp"
5915
5916 : is AFS running?
5917 echo " "
5918 case "$afs" in
5919 $define|true)   afs=true ;;
5920 $undef|false)   afs=false ;;
5921 *)      if test -d /afs; then
5922                 afs=true
5923         else
5924                 afs=false
5925         fi
5926         ;;
5927 esac
5928 if $afs; then
5929         echo "AFS may be running... I'll be extra cautious then..." >&4
5930 else
5931         echo "AFS does not seem to be running..." >&4
5932 fi
5933
5934 : determine installation prefix for where package is to be installed.
5935 if $afs; then 
5936 $cat <<EOM
5937
5938 Since you are running AFS, I need to distinguish the directory in which
5939 files will reside from the directory in which they are installed (and from
5940 which they are presumably copied to the former directory by occult means).
5941
5942 EOM
5943         case "$installprefix" in
5944         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5945         *) dflt="$installprefix";;
5946         esac
5947 else
5948 $cat <<EOM
5949
5950 In some special cases, particularly when building $package for distribution,
5951 it is convenient to distinguish between the directory in which files should 
5952 be installed from the directory ($prefix) in which they 
5953 will eventually reside.  For most users, these two directories are the same.
5954
5955 EOM
5956         case "$installprefix" in
5957         '') dflt=$prefix ;;
5958         *) dflt=$installprefix;;
5959         esac
5960 fi
5961 fn=d~
5962 rp='What installation prefix should I use for installing files?'
5963 . ./getfile
5964 installprefix="$ans"
5965 installprefixexp="$ansexp"
5966
5967 : set the prefixit variable, to compute a suitable default value
5968 prefixit='case "$3" in
5969 ""|none)
5970         case "$oldprefix" in
5971         "") eval "$1=\"\$$2\"";;
5972         *)
5973                 case "$3" in
5974                 "") eval "$1=";;
5975                 none)
5976                         eval "tp=\"\$$2\"";
5977                         case "$tp" in
5978                         ""|" ") eval "$1=\"\$$2\"";;
5979                         *) eval "$1=";;
5980                         esac;;
5981                 esac;;
5982         esac;;
5983 *)
5984         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5985         case "$tp" in
5986         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5987         /*-$oldprefix/*|\~*-$oldprefix/*)
5988                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5989         *) eval "$1=\"\$$2\"";;
5990         esac;;
5991 esac'
5992
5993
5994 : get the patchlevel
5995 echo " "
5996 echo "Getting the current patchlevel..." >&4
5997 if $test -r $rsrc/patchlevel.h;then
5998         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5999         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6000         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6001         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6002         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6003         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6004 else
6005         revision=0
6006         patchlevel=0
6007         subversion=0
6008         api_revision=0
6009         api_version=0
6010         api_subversion=0
6011 fi
6012 $echo "(You have $package version $patchlevel subversion $subversion.)"
6013 case "$osname" in
6014 dos|vms)
6015         : XXX Should be a Configure test for double-dots in filenames.
6016         version=`echo $revision $patchlevel $subversion | \
6017                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6018         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6019                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6020         ;;
6021 *)
6022         version=`echo $revision $patchlevel $subversion | \
6023                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6024         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6025                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6026         ;;
6027 esac
6028 : Special case the 5.005_xx maintenance series, which used 5.005
6029 : without any subversion label as a subdirectory in $sitelib
6030 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6031         api_versionstring='5.005'
6032 fi
6033
6034 : determine installation style
6035 : For now, try to deduce it from prefix unless it is already set.
6036 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6037 case "$installstyle" in
6038 '')     case "$prefix" in
6039                 *perl*) dflt='lib';;
6040                 *) dflt='lib/perl5' ;;
6041         esac
6042         ;;
6043 *)      dflt="$installstyle" ;;
6044 esac
6045 : Probably not worth prompting for this since we prompt for all
6046 : the directories individually, and the prompt would be too long and
6047 : confusing anyway.
6048 installstyle=$dflt
6049
6050 : determine where private library files go
6051 : Usual default is /usr/local/lib/perl5/$version.
6052 : Also allow things like /opt/perl/lib/$version, since 
6053 : /opt/perl/lib/perl5... would be redundant.
6054 : The default "style" setting is made in installstyle.U
6055 case "$installstyle" in
6056 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6057 *)       set dflt privlib lib/$version ;;
6058 esac
6059 eval $prefixit
6060 $cat <<EOM
6061
6062 There are some auxiliary files for $package that need to be put into a
6063 private library directory that is accessible by everyone.
6064
6065 EOM
6066 fn=d~+
6067 rp='Pathname where the private library files will reside?'
6068 . ./getfile
6069 privlib="$ans"
6070 privlibexp="$ansexp"
6071 : Change installation prefix, if necessary.
6072 if $test X"$prefix" != X"$installprefix"; then
6073         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6074 else
6075         installprivlib="$privlibexp"
6076 fi
6077
6078 : set the prefixup variable, to restore leading tilda escape
6079 prefixup='case "$prefixexp" in
6080 "$prefix") ;;
6081 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6082 esac'
6083
6084 : determine where public architecture dependent libraries go
6085 set archlib archlib
6086 eval $prefixit
6087 : privlib default is /usr/local/lib/$package/$version
6088 : archlib default is /usr/local/lib/$package/$version/$archname
6089 : privlib may have an optional trailing /share.
6090 tdflt=`echo $privlib | $sed 's,/share$,,'`
6091 tdflt=$tdflt/$archname
6092 case "$archlib" in
6093 '')     dflt=$tdflt
6094         ;;
6095 *)      dflt="$archlib"
6096     ;;
6097 esac
6098 $cat <<EOM
6099
6100 $spackage contains architecture-dependent library files.  If you are
6101 sharing libraries in a heterogeneous environment, you might store
6102 these files in a separate location.  Otherwise, you can just include
6103 them with the rest of the public library files.
6104
6105 EOM
6106 fn=d+~
6107 rp='Where do you want to put the public architecture-dependent libraries?'
6108 . ./getfile
6109 archlib="$ans"
6110 archlibexp="$ansexp"
6111 if $test X"$archlib" = X"$privlib"; then
6112         d_archlib="$undef"
6113 else
6114         d_archlib="$define"
6115 fi
6116 : Change installation prefix, if necessary.
6117 if $test X"$prefix" != X"$installprefix"; then
6118         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6119 else
6120         installarchlib="$archlibexp"
6121 fi
6122
6123
6124 : Binary compatibility with 5.005 is not possible for builds
6125 : with advanced features
6126 case "$usethreads$usemultiplicity" in
6127 *define*)
6128         bincompat5005="$undef"
6129         d_bincompat5005="$undef"
6130         ;;
6131 *)      $cat <<EOM
6132
6133 This version of Perl can be compiled for binary compatibility with 5.005.
6134 If you decide to do so, you will be able to continue using most of the
6135 extensions that were compiled for Perl 5.005.
6136
6137 EOM
6138         case "$bincompat5005$d_bincompat5005" in
6139         *"$undef"*) dflt=n ;;
6140         *) dflt=y ;;
6141         esac
6142         rp='Binary compatibility with Perl 5.005?'
6143         . ./myread
6144         case "$ans" in
6145         y*) val="$define" ;;
6146         *)  val="$undef" ;;
6147         esac
6148         set d_bincompat5005
6149         eval $setvar
6150         case "$d_bincompat5005" in
6151         "$define")
6152                 bincompat5005="$define"
6153                 ;;
6154         *)      bincompat5005="$undef"
6155                 d_bincompat5005="$undef"
6156                 ;;
6157         esac
6158         ;;
6159 esac
6160
6161
6162 : see if setuid scripts can be secure
6163 $cat <<EOM
6164
6165 Some kernels have a bug that prevents setuid #! scripts from being
6166 secure.  Some sites have disabled setuid #! scripts because of this.
6167
6168 First let's decide if your kernel supports secure setuid #! scripts.
6169 (If setuid #! scripts would be secure but have been disabled anyway,
6170 don't say that they are secure if asked.)
6171
6172 EOM
6173
6174 val="$undef"
6175 if $test -d /dev/fd; then
6176         echo "#!$ls" >reflect
6177         chmod +x,u+s reflect
6178         ./reflect >flect 2>&1
6179         if $contains "/dev/fd" flect >/dev/null; then
6180                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6181                 val="$define"
6182         else
6183                 $cat <<EOM
6184 If you are not sure if they are secure, I can check but I'll need a
6185 username and password different from the one you are using right now.
6186 If you don't have such a username or don't want me to test, simply
6187 enter 'none'.
6188
6189 EOM
6190                 rp='Other username to test security of setuid scripts with?'
6191                 dflt='none'
6192                 . ./myread
6193                 case "$ans" in
6194                 n|none)
6195                         case "$d_suidsafe" in
6196                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6197                                 dflt=n;;
6198                         "$undef")
6199                                 echo "Well, the $hint value is *not* secure." >&4
6200                                 dflt=n;;
6201                         *)      echo "Well, the $hint value *is* secure." >&4
6202                                 dflt=y;;
6203                         esac
6204                         ;;
6205                 *)
6206                         $rm -f reflect flect
6207                         echo "#!$ls" >reflect
6208                         chmod +x,u+s reflect
6209                         echo >flect
6210                         chmod a+w flect
6211                         echo '"su" will (probably) prompt you for '"$ans's password."
6212                         su $ans -c './reflect >flect'
6213                         if $contains "/dev/fd" flect >/dev/null; then
6214                                 echo "Okay, it looks like setuid scripts are secure." >&4
6215                                 dflt=y
6216                         else
6217                                 echo "I don't think setuid scripts are secure." >&4
6218                                 dflt=n
6219                         fi
6220                         ;;
6221                 esac
6222                 rp='Does your kernel have *secure* setuid scripts?'
6223                 . ./myread
6224                 case "$ans" in
6225                 [yY]*)  val="$define";;
6226                 *)      val="$undef";;
6227                 esac
6228         fi
6229 else
6230         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6231         echo "(That's for file descriptors, not floppy disks.)"
6232         val="$undef"
6233 fi
6234 set d_suidsafe
6235 eval $setvar
6236
6237 $rm -f reflect flect
6238
6239 : now see if they want to do setuid emulation
6240 echo " "
6241 val="$undef"
6242 case "$d_suidsafe" in
6243 "$define")
6244         val="$undef"
6245         echo "No need to emulate SUID scripts since they are secure here." >& 4
6246         ;;
6247 *)
6248         $cat <<EOM
6249 Some systems have disabled setuid scripts, especially systems where
6250 setuid scripts cannot be secure.  On systems where setuid scripts have
6251 been disabled, the setuid/setgid bits on scripts are currently
6252 useless.  It is possible for $package to detect those bits and emulate
6253 setuid/setgid in a secure fashion.  This emulation will only work if
6254 setuid scripts have been disabled in your kernel.
6255
6256 EOM
6257         case "$d_dosuid" in
6258         "$define") dflt=y ;;
6259         *) dflt=n ;;
6260         esac
6261         rp="Do you want to do setuid/setgid emulation?"
6262         . ./myread
6263         case "$ans" in
6264         [yY]*)  val="$define";;
6265         *)      val="$undef";;
6266         esac
6267         ;;
6268 esac
6269 set d_dosuid
6270 eval $setvar
6271
6272 : see if this is a malloc.h system
6273 set malloc.h i_malloc
6274 eval $inhdr
6275
6276 : see if stdlib is available
6277 set stdlib.h i_stdlib
6278 eval $inhdr
6279
6280 : determine which malloc to compile in
6281 echo " "
6282 case "$usemymalloc" in
6283 [yY]*|true|$define)     dflt='y' ;;
6284 [nN]*|false|$undef)     dflt='n' ;;
6285 *)      case "$ptrsize" in
6286         4) dflt='y' ;;
6287         *) dflt='n' ;;
6288         esac
6289         ;;
6290 esac
6291 rp="Do you wish to attempt to use the malloc that comes with $package?"
6292 . ./myread
6293 usemymalloc="$ans"
6294 case "$ans" in
6295 y*|true)
6296         usemymalloc='y'
6297         mallocsrc='malloc.c'
6298         mallocobj="malloc$_o"
6299         d_mymalloc="$define"
6300         case "$libs" in
6301         *-lmalloc*)
6302                 : Remove malloc from list of libraries to use
6303                 echo "Removing unneeded -lmalloc from library list" >&4
6304                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6305                 shift
6306                 libs="$*"
6307                 echo "libs = $libs" >&4
6308                 ;;
6309         esac
6310         ;;
6311 *)
6312         usemymalloc='n'
6313         mallocsrc=''
6314         mallocobj=''
6315         d_mymalloc="$undef"
6316         ;;
6317 esac
6318
6319 : compute the return types of malloc and free
6320 echo " "
6321 $cat >malloc.c <<END
6322 #$i_malloc I_MALLOC
6323 #$i_stdlib I_STDLIB
6324 #include <stdio.h>
6325 #include <sys/types.h>
6326 #ifdef I_MALLOC
6327 #include <malloc.h>
6328 #endif
6329 #ifdef I_STDLIB
6330 #include <stdlib.h>
6331 #endif
6332 #ifdef TRY_MALLOC
6333 void *malloc();
6334 #endif
6335 #ifdef TRY_FREE
6336 void free();
6337 #endif
6338 END
6339 case "$malloctype" in
6340 '')
6341         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6342                 malloctype='void *'
6343         else
6344                 malloctype='char *'
6345         fi
6346         ;;
6347 esac
6348 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6349
6350 case "$freetype" in
6351 '')
6352         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6353                 freetype='void'
6354         else
6355                 freetype='int'
6356         fi
6357         ;;
6358 esac
6359 echo "Your system uses $freetype free(), it would seem." >&4
6360 $rm -f malloc.[co]
6361 $cat <<EOM
6362
6363 After $package is installed, you may wish to install various
6364 add-on modules and utilities.  Typically, these add-ons will
6365 be installed under $prefix with the rest
6366 of this package.  However, you may wish to install such add-ons
6367 elsewhere under a different prefix.
6368
6369 If you do not wish to put everything under a single prefix, that's
6370 ok.  You will be prompted for the individual locations; this siteprefix
6371 is only used to suggest the defaults.
6372
6373 The default should be fine for most people.
6374
6375 EOM
6376 fn=d~+
6377 rp='Installation prefix to use for add-on modules and utilities?'
6378 : XXX Here might be another good place for an installstyle setting.
6379 case "$siteprefix" in
6380 '') dflt=$prefix ;;
6381 *)  dflt=$siteprefix ;;
6382 esac
6383 . ./getfile
6384 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6385 oldsiteprefix=''
6386 case "$siteprefix" in
6387 '') ;;
6388 *)      case "$ans" in
6389         "$prefix") ;;
6390         *) oldsiteprefix="$prefix";;
6391         esac
6392         ;;
6393 esac
6394 siteprefix="$ans"
6395 siteprefixexp="$ansexp"
6396
6397 : determine where site specific libraries go.
6398 : Usual default is /usr/local/lib/perl5/site_perl/$version
6399 : The default "style" setting is made in installstyle.U
6400 : XXX No longer works with Prefixit stuff.
6401 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6402 case "$sitelib" in
6403 '') case "$installstyle" in
6404         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6405         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6406         esac
6407         ;;
6408 *)      dflt="$sitelib"
6409         ;;
6410 esac
6411 $cat <<EOM
6412
6413 The installation process will create a directory for
6414 site-specific extensions and modules.  Most users find it convenient
6415 to place all site-specific files in this directory rather than in the
6416 main distribution directory.
6417
6418 EOM
6419 fn=d~+
6420 rp='Pathname for the site-specific library files?'
6421 . ./getfile
6422 sitelib="$ans"
6423 sitelibexp="$ansexp"
6424 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6425 : Change installation prefix, if necessary.
6426 if $test X"$prefix" != X"$installprefix"; then
6427         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6428 else
6429         installsitelib="$sitelibexp"
6430 fi
6431
6432 : determine where site specific architecture-dependent libraries go.
6433 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6434 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6435 : sitelib may have an optional trailing /share.
6436 case "$sitearch" in
6437 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6438         dflt="$dflt/$archname"
6439         ;;
6440 *)      dflt="$sitearch"
6441         ;;
6442 esac
6443 set sitearch sitearch none
6444 eval $prefixit
6445 $cat <<EOM
6446
6447 The installation process will also create a directory for
6448 architecture-dependent site-specific extensions and modules.
6449
6450 EOM
6451 fn=d~+
6452 rp='Pathname for the site-specific architecture-dependent library files?'
6453 . ./getfile
6454 sitearch="$ans"
6455 sitearchexp="$ansexp"
6456 : Change installation prefix, if necessary.
6457 if $test X"$prefix" != X"$installprefix"; then
6458         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6459 else
6460         installsitearch="$sitearchexp"
6461 fi
6462
6463 $cat <<EOM
6464
6465 The installation process will also create a directory for
6466 vendor-supplied add-ons.  Vendors who supply perl with their system
6467 may find it convenient to place all vendor-supplied files in this
6468 directory rather than in the main distribution directory.  This will
6469 ease upgrades between binary-compatible maintenance versions of perl.
6470
6471 Of course you may also use these directories in whatever way you see
6472 fit.  For example, you might use them to access modules shared over a
6473 company-wide network.
6474
6475 The default answer should be fine for most people.
6476 This causes further questions about vendor add-ons to be skipped
6477 and no vendor-specific directories will be configured for perl.
6478
6479 EOM
6480 rp='Do you want to configure vendor-specific add-on directories?'
6481 case "$usevendorprefix" in
6482 define|true|[yY]*) dflt=y ;;
6483 *)      : User may have set vendorprefix directly on Configure command line.
6484         case "$vendorprefix" in
6485         ''|' ') dflt=n ;;
6486         *)      dflt=y ;;
6487         esac
6488         ;;
6489 esac
6490 . ./myread
6491 case "$ans" in
6492 [yY]*)  fn=d~+
6493         rp='Installation prefix to use for vendor-supplied add-ons?'
6494         case "$vendorprefix" in
6495         '') dflt='' ;;
6496         *)  dflt=$vendorprefix ;;
6497         esac
6498         . ./getfile
6499         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6500         oldvendorprefix=''
6501         case "$vendorprefix" in
6502         '') ;;
6503         *)      case "$ans" in
6504                 "$prefix") ;;
6505                 *) oldvendorprefix="$prefix";;
6506                 esac
6507                 ;;
6508         esac
6509         usevendorprefix="$define"
6510         vendorprefix="$ans"
6511         vendorprefixexp="$ansexp"
6512         ;;
6513 *)      usevendorprefix="$undef"
6514         vendorprefix=''
6515         vendorprefixexp=''
6516         ;;
6517 esac
6518
6519 case "$vendorprefix" in
6520 '')     d_vendorlib="$undef"
6521         vendorlib=''
6522         vendorlibexp=''
6523         ;;
6524 *)      d_vendorlib="$define"
6525         : determine where vendor-supplied modules go.
6526         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6527         case "$vendorlib" in
6528         '')
6529                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6530                 case "$installstyle" in
6531                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6532                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6533                 esac
6534                 ;;
6535         *)      dflt="$vendorlib"
6536                 ;;
6537         esac
6538         fn=d~+
6539         rp='Pathname for the vendor-supplied library files?'
6540         . ./getfile
6541         vendorlib="$ans"
6542         vendorlibexp="$ansexp"
6543         ;;
6544 esac
6545 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6546 : Change installation prefix, if necessary.
6547 if $test X"$prefix" != X"$installprefix"; then
6548         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6549 else
6550         installvendorlib="$vendorlibexp"
6551 fi
6552
6553 case "$vendorprefix" in
6554 '')     d_vendorarch="$undef"
6555         vendorarch=''
6556         vendorarchexp=''
6557         ;;
6558 *)      d_vendorarch="$define"
6559         : determine where vendor-supplied architecture-dependent libraries go.
6560         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6561         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6562         : vendorlib may have an optional trailing /share.
6563         case "$vendorarch" in
6564         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6565                 dflt="$dflt/$archname"
6566                 ;;
6567         *)      dflt="$vendorarch" ;;
6568         esac
6569         fn=d~+
6570         rp='Pathname for vendor-supplied architecture-dependent files?'
6571         . ./getfile
6572         vendorarch="$ans"
6573         vendorarchexp="$ansexp"
6574         ;;
6575 esac
6576 : Change installation prefix, if necessary.
6577 if $test X"$prefix" != X"$installprefix"; then
6578         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6579 else
6580         installvendorarch="$vendorarchexp"
6581 fi
6582
6583 : Final catch-all directories to search
6584 $cat <<EOM
6585
6586 Lastly, you can have perl look in other directories for extensions and
6587 modules in addition to those already specified.
6588 These directories will be searched after 
6589         $sitearch 
6590         $sitelib 
6591 EOM
6592 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6593 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6594 echo ' '
6595 case "$otherlibdirs" in
6596 ''|' ') dflt='none' ;;
6597 *)      dflt="$otherlibdirs" ;;
6598 esac
6599 $cat <<EOM
6600 Enter a colon-separated set of extra paths to include in perl's @INC
6601 search path, or enter 'none' for no extra paths.
6602
6603 EOM
6604
6605 rp='Colon-separated list of additional directories for perl to search?'
6606 . ./myread
6607 case "$ans" in
6608 ' '|''|none)    otherlibdirs=' ' ;;     
6609 *)      otherlibdirs="$ans" ;;
6610 esac
6611 case "$otherlibdirs" in
6612 ' ') val=$undef ;;
6613 *)      val=$define ;;
6614 esac
6615 set d_perl_otherlibdirs
6616 eval $setvar
6617
6618 : Cruising for prototypes
6619 echo " "
6620 echo "Checking out function prototypes..." >&4
6621 $cat >prototype.c <<'EOCP'
6622 int main(int argc, char *argv[]) {
6623         exit(0);}
6624 EOCP
6625 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6626         echo "Your C compiler appears to support function prototypes."
6627         val="$define"
6628 else
6629         echo "Your C compiler doesn't seem to understand function prototypes."
6630         val="$undef"
6631 fi
6632 set prototype
6633 eval $setvar
6634 $rm -f prototype*
6635
6636 case "$prototype" in
6637 "$define") ;;
6638 *)      ansi2knr='ansi2knr'
6639         echo " "
6640         cat <<EOM >&4
6641
6642 $me:  FATAL ERROR:
6643 This version of $package can only be compiled by a compiler that 
6644 understands function prototypes.  Unfortunately, your C compiler 
6645         $cc $ccflags
6646 doesn't seem to understand them.  Sorry about that.
6647
6648 If GNU cc is available for your system, perhaps you could try that instead.  
6649
6650 Eventually, we hope to support building Perl with pre-ANSI compilers.
6651 If you would like to help in that effort, please contact <perlbug@perl.org>.
6652
6653 Aborting Configure now.
6654 EOM
6655         exit 2
6656         ;;
6657 esac
6658
6659 : determine where public executables go
6660 echo " "
6661 set dflt bin bin
6662 eval $prefixit
6663 fn=d~
6664 rp='Pathname where the public executables will reside?'
6665 . ./getfile
6666 if $test "X$ansexp" != "X$binexp"; then
6667         installbin=''
6668 fi
6669 bin="$ans"
6670 binexp="$ansexp"
6671 : Change installation prefix, if necessary.
6672 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6673 if $test X"$prefix" != X"$installprefix"; then
6674         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6675 else
6676         installbin="$binexp"
6677 fi
6678
6679 : Find perl5.005 or later.
6680 echo "Looking for a previously installed perl5.005 or later... "
6681 case "$perl5" in
6682 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6683                 : Check if this perl is recent and can load a simple module
6684                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6685                         perl5=$tdir/perl
6686                         break;
6687                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6688                         perl5=$tdir/perl
6689                         break;
6690                 fi
6691         done
6692         ;;
6693 *)      perl5="$perl5"
6694         ;;
6695 esac
6696 case "$perl5" in
6697 '')     echo "None found.  That's ok.";;
6698 *)      echo "Using $perl5." ;;
6699 esac
6700
6701 : Determine list of previous versions to include in @INC
6702 $cat > getverlist <<EOPL
6703 #!$perl5 -w
6704 use File::Basename;
6705 \$api_versionstring = "$api_versionstring";
6706 \$version = "$version";
6707 \$stem = "$sitelib_stem";
6708 \$archname = "$archname";
6709 EOPL
6710         $cat >> getverlist <<'EOPL'
6711 # Can't have leading @ because metaconfig interprets it as a command!
6712 ;@inc_version_list=();
6713 # XXX Redo to do opendir/readdir? 
6714 if (-d $stem) {
6715     chdir($stem);
6716     ;@candidates = glob("5.*");
6717 }
6718 else {
6719     ;@candidates = ();
6720 }
6721
6722 # XXX ToDo:  These comparisons must be reworked when two-digit
6723 # subversions come along, so that 5.7.10 compares as greater than
6724 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6725 # widespread that we can use the built-in version vectors rather
6726 # than reinventing them here.  For 5.6.0, however, we must
6727 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6728 foreach $d (@candidates) {
6729     if ($d lt $version) {
6730         if ($d ge $api_versionstring) {
6731             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6732         }
6733         elsif ($d ge "5.005") {
6734             unshift(@inc_version_list, grep { -d } $d);
6735         }
6736     }
6737     else {
6738         # Skip newer version.  I.e. don't look in
6739         # 5.7.0 if we're installing 5.6.1.
6740     }
6741 }
6742
6743 if (@inc_version_list) {
6744     print join(' ', @inc_version_list);
6745 }
6746 else {
6747     # Blank space to preserve value for next Configure run.
6748     print " ";
6749 }
6750 EOPL
6751 chmod +x getverlist
6752 case "$inc_version_list" in
6753 '')     if test -x "$perl5"; then
6754                 dflt=`$perl5 getverlist`
6755         else
6756                 dflt='none'
6757         fi
6758         ;;
6759 $undef) dflt='none' ;;
6760 *)  dflt="$inc_version_list" ;;
6761 esac
6762 case "$dflt" in
6763 ''|' ') dflt=none ;;
6764 esac
6765 case "$dflt" in
6766 5.005) case "$bincompat5005" in
6767        $define|true|[yY]*) ;;
6768        *) dflt=none ;;
6769        esac
6770        ;;
6771 esac
6772 $cat <<'EOM'
6773
6774 In order to ease the process of upgrading, this version of perl 
6775 can be configured to use modules built and installed with earlier 
6776 versions of perl that were installed under $prefix.  Specify here
6777 the list of earlier versions that this version of perl should check.
6778 If Configure detected no earlier versions of perl installed under
6779 $prefix, then the list will be empty.  Answer 'none' to tell perl
6780 to not search earlier versions.
6781
6782 The default should almost always be sensible, so if you're not sure,
6783 just accept the default.
6784 EOM
6785
6786 rp='List of earlier versions to include in @INC?'
6787 . ./myread
6788 case "$ans" in
6789 [Nn]one|''|' ') inc_version_list=' ' ;;
6790 *) inc_version_list="$ans" ;;
6791 esac
6792 case "$inc_version_list" in
6793 ''|' ') 
6794         inc_version_list_init='0';;
6795 *)      inc_version_list_init=`echo $inc_version_list |
6796                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6797         ;;
6798 esac
6799 $rm -f getverlist
6800
6801 : determine whether to install perl also as /usr/bin/perl
6802
6803 echo " "
6804 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6805         $cat <<EOM
6806 Many scripts expect perl to be installed as /usr/bin/perl.
6807 I can install the perl you are about to compile also as /usr/bin/perl
6808 (in addition to $installbin/perl).
6809 EOM
6810         case "$installusrbinperl" in
6811         "$undef"|[nN]*) dflt='n';;
6812         *)              dflt='y';;
6813         esac
6814         rp="Do you want to install perl as /usr/bin/perl?"
6815         . ./myread
6816         case "$ans" in
6817         [yY]*)  val="$define";;
6818         *)      val="$undef" ;;
6819         esac
6820 else
6821         val="$undef"
6822 fi
6823 set installusrbinperl
6824 eval $setvar
6825
6826 : see if dld is available
6827 set dld.h i_dld
6828 eval $inhdr
6829
6830 : see if dlopen exists
6831 xxx_runnm="$runnm"
6832 runnm=false
6833 set dlopen d_dlopen
6834 eval $inlibc
6835 runnm="$xxx_runnm"
6836
6837 : determine which dynamic loading, if any, to compile in
6838 echo " "
6839 dldir="ext/DynaLoader"
6840 case "$usedl" in
6841 $define|y|true)
6842         dflt='y'
6843         usedl="$define"
6844         ;;
6845 $undef|n|false)
6846         dflt='n'
6847         usedl="$undef"
6848         ;;
6849 *) 
6850         dflt='n'
6851         case "$d_dlopen" in
6852             $define) dflt='y' ;;
6853         esac
6854         case "$i_dld" in
6855             $define) dflt='y' ;;
6856         esac
6857         : Does a dl_xxx.xs file exist for this operating system
6858         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6859         ;;
6860 esac
6861 rp="Do you wish to use dynamic loading?"
6862 . ./myread
6863 usedl="$ans"
6864 case "$ans" in
6865 y*) usedl="$define"
6866         case "$dlsrc" in
6867         '')
6868                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6869                         dflt="$dldir/dl_${osname}.xs"
6870                 elif $test "$d_dlopen" = "$define" ; then
6871                         dflt="$dldir/dl_dlopen.xs"
6872                 elif $test "$i_dld" = "$define" ; then
6873                         dflt="$dldir/dl_dld.xs"
6874                 else
6875                         dflt=''
6876                 fi
6877                 ;;
6878         *)      dflt="$dldir/$dlsrc"
6879                 ;;
6880         esac
6881     echo "The following dynamic loading files are available:"
6882         : Can not go over to $dldir because getfile has path hard-coded in.
6883         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6884         rp="Source file to use for dynamic loading"
6885         fn="fne"
6886         gfpth="$src"
6887         . ./getfile
6888         usedl="$define"
6889         : emulate basename
6890         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6891
6892         $cat << EOM
6893
6894 Some systems may require passing special flags to $cc -c to
6895 compile modules that will be used to create a shared library.
6896 To use no flags, say "none".
6897
6898 EOM
6899     case "$cccdlflags" in
6900     '') case "$gccversion" in
6901                 '') case "$osname" in
6902                         hpux)   dflt='+z' ;;
6903                         next)   dflt='none' ;;
6904                         irix*)  dflt='-KPIC' ;;
6905                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6906                         sunos)  dflt='-pic' ;;
6907                         *)      dflt='none' ;;
6908                     esac
6909                         ;;
6910                 *)  case "$osname" in
6911                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6912                         *)      dflt='-fpic' ;;
6913                     esac ;;
6914             esac ;;
6915         ' ') dflt='none' ;;
6916     *)  dflt="$cccdlflags" ;;
6917     esac
6918     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6919     . ./myread
6920     case "$ans" in
6921     none) cccdlflags=' ' ;;
6922     *) cccdlflags="$ans" ;;
6923     esac
6924
6925     cat << EOM
6926
6927 Some systems use ld to create libraries that can be dynamically loaded,
6928 while other systems (such as those using ELF) use $cc.
6929
6930 EOM
6931         case "$ld" in
6932         '')     $cat >try.c <<'EOM'
6933 /* Test for whether ELF binaries are produced */
6934 #include <fcntl.h>
6935 #include <stdlib.h>
6936 int main() {
6937         char b[4];
6938         int i = open("a.out",O_RDONLY);
6939         if(i == -1) 
6940                 exit(1); /* fail */
6941         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6942                 exit(0); /* succeed (yes, it's ELF) */
6943         else
6944                 exit(1); /* fail */
6945 }
6946 EOM
6947                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6948                         cat <<EOM
6949 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6950 EOM
6951                         dflt="$cc"
6952                 else
6953                         echo "I'll use ld to build dynamic libraries."
6954                         dflt='ld'
6955                 fi
6956                 rm -f try.c a.out
6957                 ;;
6958         *)      dflt="$ld"
6959                 ;;
6960         esac
6961
6962     rp="What command should be used to create dynamic libraries?"
6963     . ./myread
6964         ld="$ans"
6965
6966     cat << EOM
6967
6968 Some systems may require passing special flags to $ld to create a
6969 library that can be dynamically loaded.  If your ld flags include
6970 -L/other/path options to locate libraries outside your loader's normal
6971 search path, you may need to specify those -L options here as well.  To
6972 use no flags, say "none".
6973
6974 EOM
6975     case "$lddlflags" in
6976     '') case "$osname" in
6977                         beos) dflt='-nostart' ;;
6978                         hpux) dflt='-b';
6979                               case "$gccversion" in
6980                               '') dflt="$dflt +vnocompatwarnings" ;;
6981                               esac
6982                               ;;        
6983                         linux|irix*)    dflt='-shared' ;;
6984                         next)  dflt='none' ;;
6985                         solaris) dflt='-G' ;;
6986                         sunos) dflt='-assert nodefinitions' ;;
6987                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6988                 *)     dflt='none' ;;
6989                         esac
6990                         ;;
6991     *) dflt="$lddlflags" ;;
6992     esac
6993
6994         : Try to guess additional flags to pick up local libraries.
6995         : Be careful not to append to a plain 'none'
6996         case "$dflt" in
6997         none) dflt='' ;;
6998         esac
6999         for thisflag in $ldflags; do
7000                 case "$thisflag" in
7001                 -L*|-R*)
7002                         case " $dflt " in
7003                         *" $thisflag "*) ;;
7004                         *) dflt="$dflt $thisflag" ;;
7005                         esac
7006                         ;;
7007                 esac
7008         done
7009
7010         case "$dflt" in
7011         ''|' ') dflt='none' ;;
7012         esac
7013
7014     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7015     . ./myread
7016     case "$ans" in
7017     none) lddlflags=' ' ;;
7018     *) lddlflags="$ans" ;;
7019     esac
7020
7021         cat <<EOM
7022
7023 Some systems may require passing special flags to $cc to indicate that
7024 the resulting executable will use dynamic linking.  To use no flags,
7025 say "none".
7026
7027 EOM
7028     case "$ccdlflags" in
7029     '') case "$osname" in
7030                 hpux)   dflt='-Wl,-E' ;;
7031                 linux)  dflt='-rdynamic' ;;
7032                 next)   dflt='none' ;;
7033                 sunos)  dflt='none' ;;
7034                 *)      dflt='none' ;;
7035             esac ;;
7036     ' ')  dflt='none' ;;
7037     *)  dflt="$ccdlflags" ;;
7038     esac
7039     rp="Any special flags to pass to $cc to use dynamic linking?"
7040     . ./myread
7041     case "$ans" in
7042     none) ccdlflags=' ' ;;
7043     *) ccdlflags="$ans" ;;
7044     esac
7045     ;;
7046 *)  usedl="$undef"
7047         ld='ld'
7048     dlsrc='dl_none.xs'
7049     lddlflags=''
7050     ccdlflags=''
7051     ;;
7052 esac
7053
7054 also=''
7055 case "$usedl" in
7056 $undef)
7057         # No dynamic loading being used, so don't bother even to prompt.
7058         useshrplib='false'
7059         ;;
7060 *)      case "$useshrplib" in
7061         '')     case "$osname" in
7062                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7063                         dflt=y
7064                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7065                         ;;
7066                 next*)
7067                         case "$osvers" in
7068                         4*)     dflt=y
7069                                 also='Building a shared libperl is needed for MAB support.'
7070                                 ;;
7071                         *)      dflt=n
7072                                 ;;
7073                         esac
7074                         ;;
7075                 *)      dflt=n
7076                         ;;
7077                 esac
7078                 ;;
7079         $define|true|[Yy]*)
7080                 dflt=y
7081                 ;;
7082         *)      dflt=n
7083                 ;;
7084         esac
7085         $cat << EOM
7086
7087 The perl executable is normally obtained by linking perlmain.c with
7088 libperl${_a}, any static extensions (usually just DynaLoader), and
7089 any other libraries needed on this system (such as -lm, etc.).  Since
7090 your system supports dynamic loading, it is probably possible to build
7091 a shared libperl.$so.  If you will have more than one executable linked
7092 to libperl.$so, this will significantly reduce the size of each
7093 executable, but it may have a noticeable affect on performance.  The
7094 default is probably sensible for your system.
7095 $also
7096
7097 EOM
7098         rp="Build a shared libperl.$so (y/n)"
7099         . ./myread
7100         case "$ans" in
7101         true|$define|[Yy]*)
7102                 useshrplib='true'  ;;
7103         *)      useshrplib='false' ;;
7104         esac
7105         ;;
7106 esac
7107
7108 case "$useshrplib" in
7109 true)
7110         case "$libperl" in
7111         '')
7112                 # Figure out a good name for libperl.so.  Since it gets stored in
7113                 # a version-specific architecture-dependent library, the version
7114                 # number isn't really that important, except for making cc/ld happy.
7115                 #
7116                 # A name such as libperl.so.3.1
7117                 majmin="libperl.$so.$patchlevel.$subversion"
7118                 # A name such as libperl.so.301
7119                 majonly=`echo $patchlevel $subversion |
7120                         $awk '{printf "%d%02d", $1, $2}'`
7121                 majonly=libperl.$so.$majonly
7122                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7123                 # rely on figuring it out from the naming of libc.
7124                 case "${osname}${osvers}" in
7125                 next4*)
7126                         dflt=libperl.5.$so
7127                         # XXX How handle the --version stuff for MAB?
7128                         ;;
7129                 linux*)  # ld won't link with a bare -lperl otherwise.
7130                         dflt=libperl.$so
7131                         ;;
7132                 cygwin*) # include version
7133                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7134                         ;;
7135                 *)      # Try to guess based on whether libc has major.minor.
7136                         case "$libc" in
7137                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7138                         *libc.$so.[0-9]*) dflt=$majonly ;;
7139                         *)      dflt=libperl.$so ;;
7140                         esac
7141                         ;;
7142                 esac
7143                 ;;
7144         *)      dflt=$libperl
7145                 ;;
7146         esac
7147         cat << EOM
7148
7149 I need to select a good name for the shared libperl.  If your system uses
7150 library names with major and minor numbers, then you might want something
7151 like $majmin.  Alternatively, if your system uses a single version
7152 number for shared libraries, then you might want to use $majonly.
7153 Or, your system might be quite happy with a simple libperl.$so.
7154
7155 Since the shared libperl will get installed into a version-specific
7156 architecture-dependent directory, the version number of the shared perl
7157 library probably isn't important, so the default should be o.k.
7158
7159 EOM
7160         rp='What name do you want to give to the shared libperl?'
7161         . ./myread
7162         libperl=$ans
7163         echo "Ok, I'll use $libperl"
7164         ;;
7165 *)
7166         libperl="libperl${_a}"
7167         ;;
7168 esac
7169
7170 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7171 case "$shrpdir" in
7172 '') ;;
7173 *)      $cat >&4 <<EOM
7174 WARNING:  Use of the shrpdir variable for the installation location of
7175 the shared $libperl is not supported.  It was never documented and
7176 will not work in this version.  Let me (perlbug@perl.org)
7177 know of any problems this may cause.
7178
7179 EOM
7180         case "$shrpdir" in
7181         "$archlibexp/CORE")
7182                 $cat >&4 <<EOM
7183 But your current setting of $shrpdir is
7184 the default anyway, so it's harmless.
7185 EOM
7186                 ;;
7187         *)
7188                 $cat >&4 <<EOM
7189 Further, your current attempted setting of $shrpdir
7190 conflicts with the value of $archlibexp/CORE
7191 that installperl will use.
7192 EOM
7193                 ;;
7194         esac
7195         ;;
7196 esac
7197
7198 # How will the perl executable find the installed shared $libperl?
7199 # Add $xxx to ccdlflags.
7200 # If we can't figure out a command-line option, use $shrpenv to
7201 # set env LD_RUN_PATH.  The main perl makefile uses this.
7202 shrpdir=$archlibexp/CORE
7203 xxx=''
7204 tmp_shrpenv=''
7205 if "$useshrplib"; then
7206     case "$osname" in 
7207         aix)
7208                 # We'll set it in Makefile.SH...
7209                 ;;
7210         solaris|netbsd)
7211                 xxx="-R $shrpdir"
7212                 ;;
7213         freebsd)
7214                 xxx="-Wl,-R$shrpdir"
7215                 ;;
7216         linux|irix*|dec_osf)
7217                 xxx="-Wl,-rpath,$shrpdir"
7218                 ;;
7219         next)
7220                 # next doesn't like the default...
7221                 ;;
7222         beos)
7223                 # beos doesn't like the default, either.
7224                 ;;
7225         hpux*)
7226                 # hpux doesn't like the default, either.
7227                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7228                 ;;
7229         *)
7230                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7231                 ;;
7232         esac
7233         case "$xxx" in
7234         '') ;;
7235         *)      
7236                 # Only add $xxx if it isn't already in ccdlflags.
7237                 case " $ccdlflags " in
7238                 *" $xxx "*)     ;;
7239                 *)      ccdlflags="$ccdlflags $xxx"
7240                         cat <<EOM >&4
7241
7242 Adding $xxx to the flags
7243 passed to $ld so that the perl executable will find the 
7244 installed shared $libperl.
7245
7246 EOM
7247                         ;;
7248                 esac
7249                 ;;
7250         esac
7251 fi
7252 # Fix ccdlflags in AIX for building external extensions.
7253 # (For building Perl itself bare -bE:perl.exp is needed,
7254 #  Makefile.SH takes care of this.)
7255 case "$osname" in
7256 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7257 esac
7258 # Respect a hint or command-line value.
7259 case "$shrpenv" in
7260 '') shrpenv="$tmp_shrpenv" ;;
7261 esac
7262 case "$ldlibpthname" in
7263 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7264 none)   ldlibpthname='' ;;
7265 esac
7266
7267 : determine where manual pages are on this system
7268 echo " "
7269 case "$sysman" in
7270 '') 
7271         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7272         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7273         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7274         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7275         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7276         sysman=`./loc . /usr/man/man1 $syspath`
7277         ;;
7278 esac
7279 if $test -d "$sysman"; then
7280         echo "System manual is in $sysman." >&4
7281 else
7282         echo "Could not find manual pages in source form." >&4
7283 fi
7284
7285 : determine where manual pages go
7286 set man1dir man1dir none
7287 eval $prefixit
7288 $cat <<EOM
7289
7290 $spackage has manual pages available in source form.
7291 EOM
7292 case "$nroff" in
7293 nroff)
7294         echo "However, you don't have nroff, so they're probably useless to you."
7295         case "$man1dir" in
7296         '') man1dir="none";;
7297         esac;;
7298 esac
7299 echo "If you don't want the manual sources installed, answer 'none'."
7300 case "$man1dir" in
7301 ' ') dflt=none
7302         ;;
7303 '')
7304         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7305         lookpath="$lookpath $prefixexp/man/p_man/man1"
7306         lookpath="$lookpath $prefixexp/man/u_man/man1"
7307         lookpath="$lookpath $prefixexp/man/man.1"
7308         case "$sysman" in
7309         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7310         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7311         esac
7312         set dflt
7313         eval $prefixup
7314         ;;
7315 *)  dflt="$man1dir"
7316         ;;
7317 esac
7318 echo " "
7319 fn=dn+~
7320 rp="Where do the main $spackage manual pages (source) go?"
7321 . ./getfile
7322 if $test "X$man1direxp" != "X$ansexp"; then
7323         installman1dir=''
7324 fi
7325 man1dir="$ans"
7326 man1direxp="$ansexp"
7327 case "$man1dir" in
7328 '')     man1dir=' '
7329         installman1dir='';;
7330 esac
7331
7332 : Change installation prefix, if necessary.
7333 if $test X"$prefix" != X"$installprefix"; then
7334         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7335 else
7336         installman1dir="$man1direxp"
7337 fi
7338
7339 : What suffix to use on installed man pages
7340
7341 case "$man1dir" in
7342 ' ')
7343         man1ext='0'
7344         ;;
7345 *)
7346         rp="What suffix should be used for the main $spackage man pages?"
7347         case "$man1ext" in
7348         '')     case "$man1dir" in
7349                 *1)  dflt=1 ;;
7350                 *1p) dflt=1p ;;
7351                 *1pm) dflt=1pm ;;
7352                 *l) dflt=l;;
7353                 *n) dflt=n;;
7354                 *o) dflt=o;;
7355                 *p) dflt=p;;
7356                 *C) dflt=C;;
7357                 *L) dflt=L;;
7358                 *L1) dflt=L1;;
7359                 *) dflt=1;;
7360                 esac
7361                 ;;
7362         *)      dflt="$man1ext";;
7363         esac
7364         . ./myread
7365         man1ext="$ans"
7366         ;;
7367 esac
7368
7369 : see if we can have long filenames
7370 echo " "
7371 first=123456789abcdef
7372 $rm -f $first
7373 if (echo hi >$first) 2>/dev/null; then
7374         if $test -f 123456789abcde; then
7375                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7376                 val="$undef"
7377         else
7378                 echo 'You can have filenames longer than 14 characters.'>&4
7379                 val="$define"
7380         fi
7381 else
7382         $cat <<'EOM'
7383 You can't have filenames longer than 14 chars.
7384 You can't even think about them!
7385 EOM
7386         val="$undef"
7387 fi 
7388 set d_flexfnam
7389 eval $setvar
7390 $rm -rf 123456789abcde*
7391
7392 : determine where library module manual pages go
7393 set man3dir man3dir none
7394 eval $prefixit
7395 $cat <<EOM
7396
7397 $spackage has manual pages for many of the library modules.
7398 EOM
7399
7400 case "$nroff" in
7401 nroff)
7402         $cat <<'EOM'
7403 However, you don't have nroff, so they're probably useless to you.
7404 EOM
7405         case "$man3dir" in
7406         '') man3dir="none";;
7407         esac;;
7408 esac
7409
7410 case "$d_flexfnam" in
7411 undef)
7412         $cat <<'EOM'
7413 However, your system can't handle the long file names like File::Basename.3. 
7414 EOM
7415         case "$man3dir" in
7416         '') man3dir="none";;
7417         esac;;
7418 esac
7419
7420 echo "If you don't want the manual sources installed, answer 'none'."
7421 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7422 case "$man3dir" in
7423 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7424         if $test -d "$privlib/man/man3"; then
7425                 cat <<EOM >&4
7426
7427 WARNING:  Previous versions of perl installed man3 pages into
7428 $privlib/man/man3.  This version will suggest a 
7429 new default of $dflt.  
7430 EOM
7431                 tdflt=$dflt
7432                 dflt='n'
7433                 rp='Do you wish to preserve the old behavior?(y/n)'
7434                 . ./myread
7435                 case "$ans" in
7436                 y*) dflt="$privlib/man/man3" ;;
7437                 *)  dflt=$tdflt ;;
7438                 esac
7439     fi
7440         ;;
7441 *)      dflt="$man3dir" ;;
7442 esac
7443 case "$dflt" in
7444 ' ') dflt=none ;;
7445 esac
7446 echo " "
7447 fn=dn+~
7448 rp="Where do the $package library man pages (source) go?"
7449 . ./getfile
7450 man3dir="$ans"
7451 man3direxp="$ansexp"
7452 case "$man3dir" in
7453 '')     man3dir=' '
7454         installman3dir='';;
7455 esac
7456
7457 : Change installation prefix, if necessary.
7458 if $test X"$prefix" != X"$installprefix"; then
7459         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7460 else
7461         installman3dir="$man3direxp"
7462 fi
7463
7464 : What suffix to use on installed man pages
7465 case "$man3dir" in
7466 ' ')
7467         man3ext='0'
7468         ;;
7469 *)
7470         rp="What suffix should be used for the $package library man pages?"
7471         case "$man3ext" in
7472         '')     case "$man3dir" in
7473                 *3)  dflt=3 ;;
7474                 *3p) dflt=3p ;;
7475                 *3pm) dflt=3pm ;;
7476                 *l) dflt=l;;
7477                 *n) dflt=n;;
7478                 *o) dflt=o;;
7479                 *p) dflt=p;;
7480                 *C) dflt=C;;
7481                 *L) dflt=L;;
7482                 *L3) dflt=L3;;
7483                 *) dflt=3;;
7484                 esac
7485                 ;;
7486         *)      dflt="$man3ext";;
7487         esac
7488         . ./myread
7489         man3ext="$ans"
7490         ;;
7491 esac
7492
7493 : see if we have to deal with yellow pages, now NIS.
7494 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7495         if $test -f /usr/etc/nibindd; then
7496                 echo " "
7497                 echo "I'm fairly confident you're on a NeXT."
7498                 echo " "
7499                 rp='Do you get the hosts file via NetInfo?'
7500                 dflt=y
7501                 case "$hostcat" in
7502                 nidump*) ;;
7503                 '') ;;
7504                 *) dflt=n;;
7505                 esac
7506                 . ./myread
7507                 case "$ans" in
7508                 y*) hostcat='nidump hosts .';;
7509                 *)      case "$hostcat" in
7510                         nidump*) hostcat='';;
7511                         esac
7512                         ;;
7513                 esac
7514         fi
7515         case "$hostcat" in
7516         nidump*) ;;
7517         *)
7518                 case "$hostcat" in
7519                 *ypcat*) dflt=y;;
7520                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7521                                 dflt=y
7522                         else
7523                                 dflt=n
7524                         fi;;
7525                 *) dflt=n;;
7526                 esac
7527                 echo " "
7528                 rp='Are you getting the hosts file via yellow pages?'
7529                 . ./myread
7530                 case "$ans" in
7531                 y*) hostcat='ypcat hosts';;
7532                 *) hostcat='cat /etc/hosts';;
7533                 esac
7534                 ;;
7535         esac
7536 fi
7537 case "$hostcat" in
7538 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7539 esac
7540 case "$groupcat" in
7541 '') test -f /etc/group && groupcat='cat /etc/group';;
7542 esac
7543 case "$passcat" in
7544 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7545 esac
7546
7547 : now get the host name
7548 echo " "
7549 echo "Figuring out host name..." >&4
7550 case "$myhostname" in
7551 '') cont=true
7552         echo 'Maybe "hostname" will work...'
7553         if tans=`sh -c hostname 2>&1` ; then
7554                 myhostname=$tans
7555                 phostname=hostname
7556                 cont=''
7557         fi
7558         ;;
7559 *) cont='';;
7560 esac
7561 if $test "$cont"; then
7562         if ./xenix; then
7563                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7564                 if tans=`cat /etc/systemid 2>&1` ; then
7565                         myhostname=$tans
7566                         phostname='cat /etc/systemid'
7567                         echo "Whadyaknow.  Xenix always was a bit strange..."
7568                         cont=''
7569                 fi
7570         elif $test -r /etc/systemid; then
7571                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7572         fi
7573 fi
7574 if $test "$cont"; then
7575         echo 'No, maybe "uuname -l" will work...'
7576         if tans=`sh -c 'uuname -l' 2>&1` ; then
7577                 myhostname=$tans
7578                 phostname='uuname -l'
7579         else
7580                 echo 'Strange.  Maybe "uname -n" will work...'
7581                 if tans=`sh -c 'uname -n' 2>&1` ; then
7582                         myhostname=$tans
7583                         phostname='uname -n'
7584                 else
7585                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7586                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7587                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7588                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7589                         else
7590                                 case "$myhostname" in
7591                                 '') echo "Does this machine have an identity crisis or something?"
7592                                         phostname='';;
7593                                 *)
7594                                         echo "Well, you said $myhostname before..."
7595                                         phostname='echo $myhostname';;
7596                                 esac
7597                         fi
7598                 fi
7599         fi
7600 fi
7601 : you do not want to know about this
7602 set $myhostname
7603 myhostname=$1
7604
7605 : verify guess
7606 if $test "$myhostname" ; then
7607         dflt=y
7608         rp='Your host name appears to be "'$myhostname'".'" Right?"
7609         . ./myread
7610         case "$ans" in
7611         y*) ;;
7612         *) myhostname='';;
7613         esac
7614 fi
7615
7616 : bad guess or no guess
7617 while $test "X$myhostname" = X ; do
7618         dflt=''
7619         rp="Please type the (one word) name of your host:"
7620         . ./myread
7621         myhostname="$ans"
7622 done
7623
7624 : translate upper to lower if necessary
7625 case "$myhostname" in
7626 *[A-Z]*)
7627         echo "(Normalizing case in your host name)"
7628         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7629         ;;
7630 esac
7631
7632 case "$myhostname" in
7633 *.*)
7634         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7635         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7636         echo "(Trimming domain name from host name--host name is now $myhostname)"
7637         ;;
7638 *) case "$mydomain" in
7639         '')
7640                 {
7641                         test "X$hostcat" = "Xypcat hosts" &&
7642                         ypmatch "$myhostname" hosts 2>/dev/null |\
7643                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7644                         $test -s hosts
7645                 } || {
7646                         test "X$hostcat" != "X" &&
7647                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7648                                         /[       ]$myhostname[  . ]/p" > hosts
7649                 }
7650                 tmp_re="[       . ]"
7651                 if $test -f hosts; then
7652                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7653                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7654                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7655                                 hosts | $sort | $uniq | \
7656                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7657                         case `$echo X$dflt` in
7658                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7659                                 dflt=.
7660                                 ;;
7661                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7662                                 ;;
7663                         esac
7664                 else
7665                         echo "(I cannot locate a hosts database anywhere)"
7666                         dflt=.
7667                 fi
7668                 case "$dflt" in
7669                 .)
7670                         tans=`./loc resolv.conf X /etc /usr/etc`
7671                         if $test -f "$tans"; then
7672                                 echo "(Attempting domain name extraction from $tans)"
7673                                 dflt=.`$sed -n -e 's/   / /g' \
7674                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7675                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7676                                 case "$dflt" in
7677                                 .) dflt=.`$sed -n -e 's/        / /g' \
7678                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7679                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7680                                         ;;
7681                                 esac
7682                         fi
7683                         ;;
7684                 esac
7685                 case "$dflt" in
7686                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7687                         dflt=.`sh -c domainname 2>/dev/null`
7688                         case "$dflt" in
7689                         '') dflt='.';;
7690                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7691                         esac
7692                         ;;
7693                 esac
7694                 case "$dflt$osname" in
7695                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7696                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7697                         ;;
7698                 esac
7699                 case "$dflt" in
7700                 .) echo "(Lost all hope -- silly guess then)"
7701                         dflt='.uucp'
7702                         ;;
7703                 esac
7704                 $rm -f hosts
7705                 ;;
7706         *) dflt="$mydomain";;
7707         esac;;
7708 esac
7709 echo " "
7710 rp="What is your domain name?"
7711 . ./myread
7712 tans="$ans"
7713 case "$ans" in
7714 '') ;;
7715 .*) ;;
7716 *) tans=".$tans";;
7717 esac
7718 mydomain="$tans"
7719
7720 : translate upper to lower if necessary
7721 case "$mydomain" in
7722 *[A-Z]*)
7723         echo "(Normalizing case in your domain name)"
7724         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7725         ;;
7726 esac
7727
7728 : a little sanity check here
7729 case "$phostname" in
7730 '') ;;
7731 *)
7732         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7733         $myhostname$mydomain|$myhostname) ;;
7734         *)
7735                 case "$phostname" in
7736                 sed*)
7737                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7738                         ;;
7739                 *)
7740                         echo "(That doesn't agree with your $phostname command, by the way.)"
7741                         ;;
7742                 esac
7743         ;;
7744         esac
7745         ;;
7746 esac
7747
7748 $cat <<EOM
7749
7750 I need to get your e-mail address in Internet format if possible, i.e.
7751 something like user@host.domain. Please answer accurately since I have
7752 no easy means to double check it. The default value provided below
7753 is most probably close to reality but may not be valid from outside
7754 your organization...
7755
7756 EOM
7757 cont=x
7758 while test "$cont"; do
7759         case "$cf_email" in
7760         '') dflt="$cf_by@$myhostname$mydomain";;
7761         *) dflt="$cf_email";;
7762         esac
7763         rp='What is your e-mail address?'
7764         . ./myread
7765         cf_email="$ans"
7766         case "$cf_email" in
7767         *@*.*) cont='' ;;
7768         *)
7769                 rp='Address does not look like an Internet one.  Use it anyway?'
7770                 case "$fastread" in
7771                 yes) dflt=y ;;
7772                 *) dflt=n ;;
7773                 esac
7774                 . ./myread
7775                 case "$ans" in
7776                 y*) cont='' ;;
7777                 *) echo " " ;;
7778                 esac
7779                 ;;
7780         esac
7781 done
7782
7783 $cat <<EOM
7784
7785 If you or somebody else will be maintaining perl at your site, please
7786 fill in the correct e-mail address here so that they may be contacted
7787 if necessary. Currently, the "perlbug" program included with perl
7788 will send mail to this address in addition to perlbug@perl.org. You may
7789 enter "none" for no administrator.
7790
7791 EOM
7792 case "$perladmin" in
7793 '') dflt="$cf_email";;
7794 *) dflt="$perladmin";;
7795 esac
7796 rp='Perl administrator e-mail address'
7797 . ./myread
7798 perladmin="$ans"
7799
7800 : determine whether to only install version-specific parts.
7801 echo " "
7802 $cat <<EOM
7803 Do you want to install only the version-specific parts of the perl
7804 distribution?  Usually you do *not* want to do this.
7805 EOM
7806 case "$versiononly" in
7807 "$define"|[Yy]*|true) dflt='y' ;;
7808 *) dflt='n';
7809 esac
7810 rp="Do you want to install only the version-specific parts of perl?"
7811 . ./myread
7812 case "$ans" in
7813 [yY]*)  val="$define";;
7814 *)      val="$undef" ;;
7815 esac
7816 set versiononly
7817 eval $setvar
7818
7819 : figure out how to guarantee perl startup
7820 case "$startperl" in
7821 '')
7822         case "$sharpbang" in
7823         *!)
7824                 $cat <<EOH
7825
7826 I can use the #! construct to start perl on your system. This will
7827 make startup of perl scripts faster, but may cause problems if you
7828 want to share those scripts and perl is not in a standard place
7829 ($binexp/perl) on all your platforms. The alternative is to force
7830 a shell by starting the script with a single ':' character.
7831
7832 EOH
7833                 case "$versiononly" in
7834                 "$define")      dflt="$binexp/perl$version";;  
7835                 *)              dflt="$binexp/perl";;
7836                 esac
7837                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7838                 . ./myread
7839                 case "$ans" in
7840                 none)   startperl=": # use perl";;
7841                 *)      startperl="#!$ans"
7842                         if $test 30 -lt `echo "$ans" | wc -c`; then
7843                                 $cat >&4 <<EOM
7844
7845 WARNING:  Some systems limit the #! command to 32 characters.
7846 If you experience difficulty running Perl scripts with #!, try
7847 installing Perl in a directory with a shorter pathname.
7848
7849 EOM
7850                         fi ;;
7851                 esac
7852                 ;;
7853         *) startperl=": # use perl"
7854                 ;;
7855         esac
7856         ;;
7857 esac
7858 echo "I'll use $startperl to start perl scripts."
7859
7860 : figure best path for perl in scripts
7861 case "$perlpath" in
7862 '')
7863         perlpath="$binexp/perl"
7864         case "$startperl" in
7865         *!*) ;;
7866         *)
7867                 $cat <<EOH
7868
7869 I will use the "eval 'exec'" idiom to start Perl on your system.
7870 I can use the full path of your Perl binary for this purpose, but
7871 doing so may cause problems if you want to share those scripts and
7872 Perl is not always in a standard place ($binexp/perl).
7873
7874 EOH
7875                 dflt="$binexp/perl"
7876                 rp="What path shall I use in \"eval 'exec'\"?"
7877                 . ./myread
7878                 perlpath="$ans"
7879                 ;;
7880         esac
7881         ;;
7882 esac
7883 case "$startperl" in
7884 *!*)    ;;
7885 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7886 esac
7887
7888 : determine where public executable scripts go
7889 set scriptdir scriptdir
7890 eval $prefixit
7891 case "$scriptdir" in
7892 '')
7893         dflt="$bin"
7894         : guess some guesses
7895         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7896         $test -d /usr/share/bin     && dflt=/usr/share/bin
7897         $test -d /usr/local/script  && dflt=/usr/local/script
7898         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7899         $test -d $prefixexp/script  && dflt=$prefixexp/script
7900         set dflt
7901         eval $prefixup
7902         ;;
7903 *)  dflt="$scriptdir"
7904         ;;
7905 esac
7906 $cat <<EOM
7907  
7908 Some installations have a separate directory just for executable scripts so
7909 that they can mount it across multiple architectures but keep the scripts in
7910 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7911 Or you might just lump your scripts in with all your other executables.
7912  
7913 EOM
7914 fn=d~
7915 rp='Where do you keep publicly executable scripts?'
7916 . ./getfile
7917 if $test "X$ansexp" != "X$scriptdirexp"; then
7918         installscript=''
7919 fi
7920 scriptdir="$ans"
7921 scriptdirexp="$ansexp"
7922 : Change installation prefix, if necessary.
7923 if $test X"$prefix" != X"$installprefix"; then
7924         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7925 else
7926         installscript="$scriptdirexp"
7927 fi
7928
7929 : determine where add-on public executables go
7930 case "$sitebin" in
7931 '')     dflt=$siteprefix/bin ;;
7932 *)      dflt=$sitebin ;;
7933 esac
7934 fn=d~
7935 rp='Pathname where the add-on public executables should be installed?'
7936 . ./getfile
7937 sitebin="$ans"
7938 sitebinexp="$ansexp"
7939 : Change installation prefix, if necessary.
7940 if $test X"$prefix" != X"$installprefix"; then
7941         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7942 else
7943         installsitebin="$sitebinexp"
7944 fi
7945
7946 case "$vendorprefix" in
7947 '')     d_vendorbin="$undef"
7948         vendorbin=''
7949         vendorbinexp=''
7950         ;;
7951 *)      d_vendorbin="$define"
7952         : determine where vendor-supplied executables go.
7953         case "$vendorbin" in
7954         '') dflt=$vendorprefix/bin ;;
7955         *)      dflt="$vendorbin" ;;
7956         esac
7957         fn=d~+
7958         rp='Pathname for the vendor-supplied executables directory?'
7959         . ./getfile
7960         vendorbin="$ans"
7961         vendorbinexp="$ansexp"
7962         ;;
7963 esac
7964 : Change installation prefix, if necessary.
7965 if $test X"$prefix" != X"$installprefix"; then
7966         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7967 else
7968         installvendorbin="$vendorbinexp"
7969 fi
7970
7971 : see if qgcvt exists
7972 set qgcvt d_qgcvt
7973 eval $inlibc
7974
7975 echo " "
7976
7977 if $test X"$d_longdbl" = X"$define"; then
7978
7979 echo "Checking how to print long doubles..." >&4
7980
7981 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7982         $cat >try.c <<'EOCP'
7983 #include <sys/types.h>
7984 #include <stdio.h>
7985 int main() {
7986   double d = 123.456;
7987   printf("%.3f\n", d);
7988 }
7989 EOCP
7990         set try
7991         if eval $compile; then
7992                 yyy=`./try$exe_ext`
7993                 case "$yyy" in
7994                 123.456)
7995                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7996                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7997                         echo "We will use %f."
7998                         ;;
7999                 esac
8000         fi
8001 fi
8002
8003 if $test X"$sPRIfldbl" = X; then
8004         $cat >try.c <<'EOCP'
8005 #include <sys/types.h>
8006 #include <stdio.h>
8007 int main() {
8008   long double d = 123.456;
8009   printf("%.3llf\n", d);
8010 }
8011 EOCP
8012         set try
8013         if eval $compile; then
8014                 yyy=`./try$exe_ext`
8015                 case "$yyy" in
8016                 123.456)
8017                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8018                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8019                         echo "We will use %llf."
8020                         ;;
8021                 esac
8022         fi
8023 fi
8024
8025 if $test X"$sPRIfldbl" = X; then
8026         $cat >try.c <<'EOCP'
8027 #include <sys/types.h>
8028 #include <stdio.h>
8029 int main() {
8030   long double d = 123.456;
8031   printf("%.3Lf\n", d);
8032 }
8033 EOCP
8034         set try
8035         if eval $compile; then
8036                 yyy=`./try$exe_ext`
8037                 case "$yyy" in
8038                 123.456)
8039                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8040                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8041                         echo "We will use %Lf."
8042                         ;;
8043                 esac
8044         fi
8045 fi
8046
8047 if $test X"$sPRIfldbl" = X; then
8048         $cat >try.c <<'EOCP'
8049 #include <sys/types.h>
8050 #include <stdio.h>
8051 int main() {
8052   long double d = 123.456;
8053   printf("%.3lf\n", d);
8054 }
8055 EOCP
8056         set try
8057         if eval $compile; then
8058                 yyy=`./try$exe_ext`
8059                 case "$yyy" in
8060                 123.456)
8061                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8062                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8063                         echo "We will use %lf."
8064                         ;;
8065                 esac
8066         fi
8067 fi
8068
8069 if $test X"$sPRIfldbl" = X; then
8070         echo "Cannot figure out how to print long doubles." >&4
8071 else
8072         sSCNfldbl=$sPRIfldbl    # expect consistency
8073 fi
8074
8075 $rm -f try try.*
8076
8077 fi # d_longdbl
8078
8079 case "$sPRIfldbl" in
8080 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8081         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8082         d_SCNfldbl="$undef";
8083         ;;
8084 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8085         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8086         d_SCNfldbl="$define";
8087         ;;
8088 esac
8089
8090 : Check how to convert floats to strings.
8091 echo " "
8092 echo "Checking for an efficient way to convert floats to strings."
8093 echo " " > try.c
8094 case "$uselongdouble" in
8095 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8096 esac
8097 case "$d_longdbl" in
8098 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8099 esac
8100 case "$d_PRIgldbl" in
8101 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8102 esac
8103 $cat >>try.c <<EOP
8104 #ifdef TRY_gconvert
8105 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8106 char *myname = "gconvert";
8107 #endif
8108 #ifdef TRY_gcvt
8109 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8110 char *myname = "gcvt";
8111 #endif
8112 #ifdef TRY_qgcvt
8113 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8114 char *myname = "qgcvt";
8115 #define DOUBLETYPE long double
8116 #endif
8117 #ifdef TRY_sprintf
8118 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8119 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8120 #else
8121 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8122 #endif
8123 char *myname = "sprintf";
8124 #endif
8125
8126 #ifndef DOUBLETYPE
8127 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8128 #define DOUBLETYPE long double
8129 #else
8130 #define DOUBLETYPE double
8131 #endif
8132 #endif
8133
8134 #include <stdio.h>
8135
8136 #define I_STDLIB $i_stdlib
8137 #ifdef I_STDLIB
8138 #include <stdlib.h>
8139 #endif
8140
8141 int
8142 checkit(expect, got)
8143 char *expect;
8144 char *got;
8145 {
8146     if (strcmp(expect, got)) {
8147                 printf("%s oddity:  Expected %s, got %s\n",
8148                         myname, expect, got);
8149                 exit(1);
8150         }
8151 }
8152
8153 int main()
8154
8155         char buf[64]; 
8156         buf[63] = '\0';
8157
8158         /* This must be 1st test on (which?) platform */
8159         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8160         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8161         checkit("0.1", buf);
8162
8163         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8164         checkit("1", buf);
8165
8166         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8167         checkit("1.1", buf);
8168
8169         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8170         checkit("1.01", buf);
8171
8172         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8173         checkit("1.001", buf);
8174
8175         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8176         checkit("1.0001", buf);
8177
8178         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8179         checkit("1.00001", buf);
8180
8181         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8182         checkit("1.000001", buf);
8183
8184         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8185         checkit("0", buf);
8186
8187         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8188         checkit("-1", buf);
8189
8190         /* Some Linux gcvt's give 1.e+5 here. */
8191         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8192         checkit("100000", buf);
8193         
8194         /* Some Linux gcvt's give -1.e+5 here. */
8195         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8196         checkit("-100000", buf);
8197
8198         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8199         checkit("123.456", buf);
8200
8201         exit(0);
8202 }
8203 EOP
8204 case "$d_Gconvert" in
8205 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8206 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8207 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8208 *) xxx_list='gconvert gcvt sprintf' ;;
8209 esac
8210
8211 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8212 "$define$define$define")
8213     # for long doubles prefer first qgcvt, then sprintf
8214     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8215     xxx_list="sprintf $xxx_list"
8216     case "$d_qgcvt" in
8217     "$define") xxx_list="qgcvt $xxx_list" ;;
8218     esac
8219     ;;
8220 esac
8221
8222 for xxx_convert in $xxx_list; do
8223         echo "Trying $xxx_convert..."
8224         $rm -f try try$_o
8225         set try -DTRY_$xxx_convert
8226         if eval $compile; then
8227                 echo "$xxx_convert() found." >&4
8228                 if ./try; then
8229                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8230                         break;
8231                 else
8232                         echo "...But $xxx_convert didn't work as I expected."
8233                 fi
8234         else
8235                 echo "$xxx_convert NOT found." >&4
8236         fi
8237 done
8238         
8239 case "$xxx_convert" in
8240 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8241 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8242 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8243 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8244    "$define$define$define")
8245       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8246    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8247    esac
8248    ;;  
8249 esac
8250
8251 : see if _fwalk exists
8252 set fwalk d__fwalk
8253 eval $inlibc
8254
8255 : Initialize h_fcntl
8256 h_fcntl=false
8257
8258 : Initialize h_sysfile
8259 h_sysfile=false
8260
8261 : access call always available on UNIX
8262 set access d_access
8263 eval $inlibc
8264
8265 : locate the flags for 'access()'
8266 case "$d_access" in
8267 "$define")
8268         echo " "
8269         $cat >access.c <<'EOCP'
8270 #include <sys/types.h>
8271 #ifdef I_FCNTL
8272 #include <fcntl.h>
8273 #endif
8274 #ifdef I_SYS_FILE
8275 #include <sys/file.h>
8276 #endif
8277 #ifdef I_UNISTD
8278 #include <unistd.h>
8279 #endif
8280 int main() {
8281         exit(R_OK);
8282 }
8283 EOCP
8284         : check sys/file.h first, no particular reason here
8285         if $test `./findhdr sys/file.h` && \
8286                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8287                 h_sysfile=true;
8288                 echo "<sys/file.h> defines the *_OK access constants." >&4
8289         elif $test `./findhdr fcntl.h` && \
8290                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8291                 h_fcntl=true;
8292                 echo "<fcntl.h> defines the *_OK access constants." >&4
8293         elif $test `./findhdr unistd.h` && \
8294                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8295                 echo "<unistd.h> defines the *_OK access constants." >&4
8296         else
8297                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8298         fi
8299         ;;
8300 esac
8301 $rm -f access*
8302
8303 : see if accessx exists
8304 set accessx d_accessx
8305 eval $inlibc
8306
8307 : see if alarm exists
8308 set alarm d_alarm
8309 eval $inlibc
8310
8311 : see if atolf exists
8312 set atolf d_atolf
8313 eval $inlibc
8314
8315 : see if atoll exists
8316 set atoll d_atoll
8317 eval $inlibc
8318
8319 : Look for GNU-cc style attribute checking
8320 echo " "
8321 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8322 $cat >attrib.c <<'EOCP'
8323 #include <stdio.h>
8324 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8325 EOCP
8326 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8327         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8328                 echo "Your C compiler doesn't fully support __attribute__."
8329                 val="$undef"
8330         else
8331                 echo "Your C compiler supports __attribute__."
8332                 val="$define"
8333         fi
8334 else
8335         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8336         val="$undef"
8337 fi
8338 set d_attribut
8339 eval $setvar
8340 $rm -f attrib*
8341
8342 : see if bcmp exists
8343 set bcmp d_bcmp
8344 eval $inlibc
8345
8346 : see if bcopy exists
8347 set bcopy d_bcopy
8348 eval $inlibc
8349
8350 : see if this is a unistd.h system
8351 set unistd.h i_unistd
8352 eval $inhdr
8353
8354 : see if getpgrp exists
8355 set getpgrp d_getpgrp
8356 eval $inlibc
8357
8358 case "$d_getpgrp" in
8359 "$define")
8360         echo " "
8361         echo "Checking to see which flavor of getpgrp is in use..."
8362         $cat >set.c <<EOP
8363 #$i_unistd I_UNISTD
8364 #include <sys/types.h>
8365 #ifdef I_UNISTD
8366 #  include <unistd.h>
8367 #endif
8368 int main()
8369 {
8370         if (getuid() == 0) {
8371                 printf("(I see you are running Configure as super-user...)\n");
8372                 setuid(1);
8373         }
8374 #ifdef TRY_BSD_PGRP
8375         if (getpgrp(1) == 0)
8376                 exit(0);
8377 #else
8378         if (getpgrp() > 0)
8379                 exit(0);
8380 #endif
8381         exit(1);
8382 }
8383 EOP
8384         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8385                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8386                 val="$define"
8387         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8388                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8389                 val="$undef"
8390         else
8391                 echo "I can't seem to compile and run the test program."
8392                 if ./usg; then
8393                         xxx="a USG one, i.e. you use getpgrp()."
8394                 else
8395                         # SVR4 systems can appear rather BSD-ish.
8396                         case "$i_unistd" in
8397                         $undef)
8398                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8399                                 val="$define"
8400                                 ;;
8401                         $define)
8402                                 xxx="probably a USG one, i.e. you use getpgrp()."
8403                                 val="$undef"
8404                                 ;;
8405                         esac
8406                 fi
8407                 echo "Assuming your getpgrp is $xxx" >&4
8408         fi
8409         ;;
8410 *) val="$undef";;
8411 esac
8412 set d_bsdgetpgrp
8413 eval $setvar
8414 $rm -f set set.c
8415
8416 : see if setpgrp exists
8417 set setpgrp d_setpgrp
8418 eval $inlibc
8419
8420 case "$d_setpgrp" in
8421 "$define")
8422         echo " "
8423         echo "Checking to see which flavor of setpgrp is in use..."
8424         $cat >set.c <<EOP
8425 #$i_unistd I_UNISTD
8426 #include <sys/types.h>
8427 #ifdef I_UNISTD
8428 #  include <unistd.h>
8429 #endif
8430 int main()
8431 {
8432         if (getuid() == 0) {
8433                 printf("(I see you are running Configure as super-user...)\n");
8434                 setuid(1);
8435         }
8436 #ifdef TRY_BSD_PGRP
8437         if (-1 == setpgrp(1, 1))
8438                 exit(0);
8439 #else
8440         if (setpgrp() != -1)
8441                 exit(0);
8442 #endif
8443         exit(1);
8444 }
8445 EOP
8446         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8447                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8448                 val="$define"
8449         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8450                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8451                 val="$undef"
8452         else
8453                 echo "(I can't seem to compile and run the test program.)"
8454                 if ./usg; then
8455                         xxx="a USG one, i.e. you use setpgrp()."
8456                 else
8457                         # SVR4 systems can appear rather BSD-ish.
8458                         case "$i_unistd" in
8459                         $undef)
8460                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8461                                 val="$define"
8462                                 ;;
8463                         $define)
8464                                 xxx="probably a USG one, i.e. you use setpgrp()."
8465                                 val="$undef"
8466                                 ;;
8467                         esac
8468                 fi
8469                 echo "Assuming your setpgrp is $xxx" >&4
8470         fi
8471         ;;
8472 *) val="$undef";;
8473 esac
8474 set d_bsdsetpgrp
8475 eval $setvar
8476 $rm -f set set.c
8477 : see if bzero exists
8478 set bzero d_bzero
8479 eval $inlibc
8480
8481 : see if signal is declared as pointer to function returning int or void
8482 echo " "
8483 xxx=`./findhdr signal.h`
8484 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8485 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8486         echo "You have int (*signal())() instead of void." >&4
8487         val="$undef"
8488 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8489         echo "You have void (*signal())()." >&4
8490         val="$define"
8491 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8492         echo "You have int (*signal())() instead of void." >&4
8493         val="$undef"
8494 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8495         echo "You have void (*signal())()." >&4
8496         val="$define"
8497 else
8498         case "$d_voidsig" in
8499         '')
8500         echo "I can't determine whether signal handler returns void or int..." >&4
8501                 dflt=void
8502                 rp="What type does your signal handler return?"
8503                 . ./myread
8504                 case "$ans" in
8505                 v*) val="$define";;
8506                 *) val="$undef";;
8507                 esac;;
8508         "$define")
8509                 echo "As you already told me, signal handler returns void." >&4
8510                 val="$define"
8511                 ;;
8512         *)      echo "As you already told me, signal handler returns int." >&4
8513                 val="$undef"
8514                 ;;
8515         esac
8516 fi
8517 set d_voidsig
8518 eval $setvar
8519 case "$d_voidsig" in
8520 "$define") signal_t="void";;
8521 *) signal_t="int";;
8522 esac
8523 $rm -f $$.tmp
8524
8525 : check for ability to cast large floats to 32-bit ints.
8526 echo " "
8527 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8528 if $test "$intsize" -ge 4; then
8529         xxx=int
8530 else
8531         xxx=long
8532 fi
8533 $cat >try.c <<EOCP
8534 #include <stdio.h>
8535 #include <sys/types.h>
8536 #include <signal.h>
8537 $signal_t blech(s) int s; { exit(3); }
8538 int main()
8539 {
8540         $xxx i32;
8541         double f, g;
8542         int result = 0;
8543         char str[16];
8544         signal(SIGFPE, blech);
8545
8546         /* Don't let compiler optimize the test away.  Store the number 
8547            in a writable string for gcc to pass to sscanf under HP/UX.
8548         */
8549         sprintf(str, "2147483647");
8550         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8551         g = 10 * f;
8552         i32  = ($xxx) g;
8553
8554         /* x86 processors will probably give 0x8000 0000, which is a
8555        sign change.  We don't want that.  We want to mimic SPARC
8556            behavior here, which is to preserve the sign and give
8557            back 0x7fff ffff.
8558         */
8559         if (i32 != ($xxx) f)
8560                 result |= 1;
8561         exit(result);
8562 }
8563 EOCP
8564 set try
8565 if eval $compile_ok; then
8566         ./try
8567         yyy=$?
8568 else
8569         echo "(I can't seem to compile the test program--assuming it can't)"
8570         yyy=1
8571 fi
8572 case "$yyy" in
8573 0)      val="$define"
8574         echo "Yup, it can."
8575         ;;
8576 *)      val="$undef"
8577         echo "Nope, it can't."
8578         ;;
8579 esac
8580 set d_casti32
8581 eval $setvar
8582 $rm -f try try.*
8583
8584 : check for ability to cast negative floats to unsigned
8585 echo " "
8586 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8587 $cat >try.c <<EOCP
8588 #include <stdio.h>
8589 #include <sys/types.h>
8590 #include <signal.h>
8591 $signal_t blech(s) int s; { exit(7); }
8592 $signal_t blech_in_list(s) int s; { exit(4); }
8593 unsigned long dummy_long(p) unsigned long p; { return p; }
8594 unsigned int dummy_int(p) unsigned int p; { return p; }
8595 unsigned short dummy_short(p) unsigned short p; { return p; }
8596 int main()
8597 {
8598         double f;
8599         unsigned long along;
8600         unsigned int aint;
8601         unsigned short ashort;
8602         int result = 0;
8603         char str[16];
8604         
8605         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8606            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8607            optimized the whole file away
8608         */
8609         /* Store the number in a writable string for gcc to pass to 
8610            sscanf under HP/UX.
8611         */
8612         sprintf(str, "-123");
8613         sscanf(str, "%lf", &f);  /* f = -123.; */
8614
8615         signal(SIGFPE, blech);
8616         along = (unsigned long)f;
8617         aint = (unsigned int)f;
8618         ashort = (unsigned short)f;
8619         if (along != (unsigned long)-123)
8620                 result |= 1;
8621         if (aint != (unsigned int)-123)
8622                 result |= 1;
8623         if (ashort != (unsigned short)-123)
8624                 result |= 1;
8625         sprintf(str, "1073741824.");
8626         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8627         f = f + f;
8628         along = 0;
8629         along = (unsigned long)f;
8630         if (along != 0x80000000)
8631                 result |= 2;
8632         f -= 1.;
8633         along = 0;
8634         along = (unsigned long)f;
8635         if (along != 0x7fffffff)
8636                 result |= 1;
8637         f += 2.;
8638         along = 0;
8639         along = (unsigned long)f;
8640         if (along != 0x80000001)
8641                 result |= 2;
8642         if (result)
8643                 exit(result);
8644         signal(SIGFPE, blech_in_list);
8645         sprintf(str, "123.");
8646         sscanf(str, "%lf", &f);  /* f = 123.; */
8647         along = dummy_long((unsigned long)f);
8648         aint = dummy_int((unsigned int)f);
8649         ashort = dummy_short((unsigned short)f);
8650         if (along != (unsigned long)123)
8651                 result |= 4;
8652         if (aint != (unsigned int)123)
8653                 result |= 4;
8654         if (ashort != (unsigned short)123)
8655                 result |= 4;
8656         exit(result);
8657
8658 }
8659 EOCP
8660 set try
8661 if eval $compile_ok; then
8662         ./try
8663         castflags=$?
8664 else
8665         echo "(I can't seem to compile the test program--assuming it can't)"
8666         castflags=7
8667 fi
8668 case "$castflags" in
8669 0)      val="$define"
8670         echo "Yup, it can."
8671         ;;
8672 *)      val="$undef"
8673         echo "Nope, it can't."
8674         ;;
8675 esac
8676 set d_castneg
8677 eval $setvar
8678 $rm -f try.*
8679
8680 : see if vprintf exists
8681 echo " "
8682 if set vprintf val -f d_vprintf; eval $csym; $val; then
8683         echo 'vprintf() found.' >&4
8684         val="$define"
8685         $cat >vprintf.c <<'EOF'
8686 #include <varargs.h>
8687
8688 int main() { xxx("foo"); }
8689
8690 xxx(va_alist)
8691 va_dcl
8692 {
8693         va_list args;
8694         char buf[10];
8695
8696         va_start(args);
8697         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8698 }
8699 EOF
8700         set vprintf
8701         if eval $compile && ./vprintf; then
8702                 echo "Your vsprintf() returns (int)." >&4
8703                 val2="$undef"
8704         else
8705                 echo "Your vsprintf() returns (char*)." >&4
8706                 val2="$define"
8707         fi
8708 else
8709         echo 'vprintf() NOT found.' >&4
8710                 val="$undef"
8711                 val2="$undef"
8712 fi
8713 set d_vprintf
8714 eval $setvar
8715 val=$val2
8716 set d_charvspr
8717 eval $setvar
8718
8719 : see if chown exists
8720 set chown d_chown
8721 eval $inlibc
8722
8723 : see if chroot exists
8724 set chroot d_chroot
8725 eval $inlibc
8726
8727 : see if chsize exists
8728 set chsize d_chsize
8729 eval $inlibc
8730
8731 hasstruct='varname=$1; struct=$2; shift; shift;
8732 while $test $# -ge 2; do
8733         case "$1" in
8734         $define) echo "#include <$2>";;
8735         esac ;
8736     shift 2;
8737 done > try.c;
8738 echo "int main () { struct $struct foo; }" >> try.c;
8739 set try;
8740 if eval $compile; then
8741         val="$define";
8742 else
8743         val="$undef";
8744 fi;
8745 set $varname;
8746 eval $setvar;
8747 $rm -f try.c try.o'
8748
8749 : see if sys/types.h has to be included
8750 set sys/types.h i_systypes
8751 eval $inhdr
8752
8753 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8754 while $test $# -ge 2; do
8755         case "$1" in
8756         $define) echo "#include <$2>";;
8757         esac ;
8758     shift 2;
8759 done > try.c;
8760 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8761 set try;
8762 if eval $compile; then
8763         val="$define";
8764 else
8765         val="$undef";
8766 fi;
8767 set $varname;
8768 eval $setvar;
8769 $rm -f try.c try.o'
8770
8771 socketlib=''
8772 sockethdr=''
8773 : see whether socket exists
8774 echo " "
8775 $echo $n "Hmm... $c" >&4
8776 if set socket val -f d_socket; eval $csym; $val; then
8777         echo "Looks like you have Berkeley networking support." >&4
8778         d_socket="$define"
8779         if set setsockopt val -f; eval $csym; $val; then
8780                 d_oldsock="$undef"
8781         else
8782                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8783                 d_oldsock="$define"
8784         fi
8785 else
8786         if $contains socklib libc.list >/dev/null 2>&1; then
8787                 echo "Looks like you have Berkeley networking support." >&4
8788                 d_socket="$define"
8789                 : we will have to assume that it supports the 4.2 BSD interface
8790                 d_oldsock="$undef"
8791         else
8792                 echo "You don't have Berkeley networking in libc$_a..." >&4
8793                 if test "X$d_socket" = "X$define"; then
8794                    echo "...but you seem to believe that you have sockets." >&4
8795                 else
8796                         for net in net socket
8797                         do
8798                                 if test -f /usr/lib/lib$net$_a; then
8799                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8800                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8801                                         if $contains socket libc.list >/dev/null 2>&1; then
8802                                                 d_socket="$define"
8803                                                 socketlib="-l$net"
8804                                                 case "$net" in
8805                                                 net)
8806                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8807                                                         sockethdr="-I/usr/netinclude"
8808                                                         ;;
8809                                                 esac
8810                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8811                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8812                                                         d_oldsock="$undef"
8813                                                 else
8814                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8815                                                         d_oldsock="$define"
8816                                                 fi
8817                                                 break
8818                                         fi
8819                                 fi
8820                         done
8821                         if test "X$d_socket" != "X$define"; then
8822                            echo "or anywhere else I see." >&4
8823                            d_socket="$undef"
8824                            d_oldsock="$undef"
8825                         fi
8826                 fi
8827         fi
8828 fi
8829
8830 : see if socketpair exists
8831 set socketpair d_sockpair
8832 eval $inlibc
8833
8834
8835 echo " "
8836 echo "Checking the availability of certain socket constants..." >& 4
8837 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8838         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8839         $cat >try.c <<EOF
8840 #include <sys/types.h>
8841 #include <sys/socket.h>
8842 int main() {
8843     int i = $ENUM;
8844 }
8845 EOF
8846         val="$undef"
8847         set try; if eval $compile; then
8848                 val="$define"
8849         fi
8850         set d_${enum}; eval $setvar
8851         $rm -f try.c try
8852 done
8853
8854 : see if this is a sys/uio.h system
8855 set sys/uio.h i_sysuio
8856 eval $inhdr
8857
8858
8859 echo " "
8860 echo "Checking to see if your system supports struct cmsghdr..." >&4
8861 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8862 eval $hasstruct
8863 case "$d_cmsghdr_s" in
8864 "$define")      echo "Yes, it does."   ;;
8865 *)              echo "No, it doesn't." ;;
8866 esac
8867
8868
8869 : check for const keyword
8870 echo " "
8871 echo 'Checking to see if your C compiler knows about "const"...' >&4
8872 $cat >const.c <<'EOCP'
8873 typedef struct spug { int drokk; } spug;
8874 int main()
8875 {
8876         const char *foo;
8877         const spug y;
8878 }
8879 EOCP
8880 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8881         val="$define"
8882         echo "Yup, it does."
8883 else
8884         val="$undef"
8885         echo "Nope, it doesn't."
8886 fi
8887 set d_const
8888 eval $setvar
8889
8890 : see if crypt exists
8891 echo " "
8892 if set crypt val -f d_crypt; eval $csym; $val; then
8893         echo 'crypt() found.' >&4
8894         val="$define"
8895         cryptlib=''
8896 else
8897         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8898         if $test -z "$cryptlib"; then
8899                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8900         else
8901                 cryptlib=-lcrypt
8902         fi
8903         if $test -z "$cryptlib"; then
8904                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8905         else
8906                 cryptlib=-lcrypt
8907         fi
8908         if $test -z "$cryptlib"; then
8909                 cryptlib=`./loc libcrypt$_a "" $libpth`
8910         else
8911                 cryptlib=-lcrypt
8912         fi
8913         if $test -z "$cryptlib"; then
8914                 echo 'crypt() NOT found.' >&4
8915                 val="$undef"
8916         else
8917                 val="$define"
8918         fi
8919 fi
8920 set d_crypt
8921 eval $setvar
8922
8923 : get csh whereabouts
8924 case "$csh" in
8925 'csh') val="$undef" ;;
8926 *) val="$define" ;;
8927 esac
8928 set d_csh
8929 eval $setvar
8930 : Respect a hint or command line value for full_csh.
8931 case "$full_csh" in
8932 '') full_csh=$csh ;;
8933 esac
8934
8935 : see if cuserid exists
8936 set cuserid d_cuserid
8937 eval $inlibc
8938
8939 : see if this is a limits.h system
8940 set limits.h i_limits
8941 eval $inhdr
8942
8943 : see if this is a float.h system
8944 set float.h i_float
8945 eval $inhdr
8946
8947 : See if number of significant digits in a double precision number is known
8948 echo " "
8949 $cat >dbl_dig.c <<EOM
8950 #$i_limits I_LIMITS
8951 #$i_float I_FLOAT
8952 #ifdef I_LIMITS
8953 #include <limits.h>
8954 #endif
8955 #ifdef I_FLOAT
8956 #include <float.h>
8957 #endif
8958 #ifdef DBL_DIG
8959 printf("Contains DBL_DIG");
8960 #endif
8961 EOM
8962 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8963 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8964         echo "DBL_DIG found." >&4
8965         val="$define"
8966 else
8967         echo "DBL_DIG NOT found." >&4
8968         val="$undef"
8969 fi
8970 $rm -f dbl_dig.?
8971 set d_dbl_dig
8972 eval $setvar
8973
8974 : see if difftime exists
8975 set difftime d_difftime
8976 eval $inlibc
8977
8978 : see if this is a dirent system
8979 echo " "
8980 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8981         val="$define"
8982         echo "<dirent.h> found." >&4
8983 else
8984         val="$undef"
8985         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8986                 echo "<sys/dir.h> found." >&4
8987                 echo " "
8988         else
8989                 xinc=`./findhdr sys/ndir.h`
8990         fi
8991         echo "<dirent.h> NOT found." >&4
8992 fi
8993 set i_dirent
8994 eval $setvar
8995
8996 : Look for type of directory structure.
8997 echo " "
8998 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8999
9000 case "$direntrytype" in
9001 ''|' ')
9002         case "$i_dirent" in
9003         $define) guess1='struct dirent' ;;
9004         *) guess1='struct direct'  ;;
9005         esac
9006         ;;
9007 *)      guess1="$direntrytype"
9008         ;;
9009 esac
9010
9011 case "$guess1" in
9012 'struct dirent') guess2='struct direct' ;;
9013 *) guess2='struct dirent' ;;
9014 esac
9015                 
9016 if $contains "$guess1" try.c >/dev/null 2>&1; then
9017         direntrytype="$guess1"
9018         echo "Your directory entries are $direntrytype." >&4
9019 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9020         direntrytype="$guess2"
9021         echo "Your directory entries seem to be $direntrytype." >&4
9022 else
9023         echo "I don't recognize your system's directory entries." >&4
9024         rp="What type is used for directory entries on this system?"
9025         dflt="$guess1"
9026         . ./myread
9027         direntrytype="$ans"
9028 fi
9029 $rm -f try.c
9030
9031
9032 : see if the directory entry stores field length
9033 echo " "
9034 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9035 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9036         echo "Good, your directory entry keeps length information in d_namlen." >&4
9037         val="$define"
9038 else
9039         echo "Your directory entry does not know about the d_namlen field." >&4
9040         val="$undef"
9041 fi
9042 set d_dirnamlen
9043 eval $setvar
9044 $rm -f try.c
9045
9046 : see if dlerror exists
9047 xxx_runnm="$runnm"
9048 runnm=false
9049 set dlerror d_dlerror
9050 eval $inlibc
9051 runnm="$xxx_runnm"
9052
9053 : see if dlfcn is available
9054 set dlfcn.h i_dlfcn
9055 eval $inhdr
9056
9057 case "$usedl" in
9058 $define|y|true)
9059         $cat << EOM
9060
9061 On a few systems, the dynamically loaded modules that perl generates and uses
9062 will need a different extension than shared libs. The default will probably
9063 be appropriate.
9064
9065 EOM
9066         case "$dlext" in
9067         '')     dflt="$so" ;;
9068         *)      dflt="$dlext" ;;
9069         esac
9070         rp='What is the extension of dynamically loaded modules'
9071         . ./myread
9072         dlext="$ans"
9073         ;;
9074 *)
9075         dlext="none"
9076         ;;
9077 esac
9078
9079 : Check if dlsym need a leading underscore
9080 echo " "
9081 val="$undef"
9082
9083 case "$dlsrc" in
9084 dl_dlopen.xs)
9085         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9086         $cat >dyna.c <<'EOM'
9087 fred () { }
9088 EOM
9089
9090 $cat >fred.c<<EOM
9091
9092 #include <stdio.h>
9093 #$i_dlfcn I_DLFCN
9094 #ifdef I_DLFCN
9095 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9096 #else
9097 #include <sys/types.h>
9098 #include <nlist.h>
9099 #include <link.h>
9100 #endif
9101
9102 extern int fred() ;
9103
9104 int main()
9105 {
9106     void * handle ;
9107     void * symbol ;
9108 #ifndef RTLD_LAZY
9109     int mode = 1 ;
9110 #else
9111     int mode = RTLD_LAZY ;
9112 #endif
9113     handle = dlopen("./dyna.$dlext", mode) ;
9114     if (handle == NULL) {
9115         printf ("1\n") ;
9116         fflush (stdout) ;
9117         exit(0);
9118     }
9119     symbol = dlsym(handle, "fred") ;
9120     if (symbol == NULL) {
9121         /* try putting a leading underscore */
9122         symbol = dlsym(handle, "_fred") ;
9123         if (symbol == NULL) {
9124             printf ("2\n") ;
9125             fflush (stdout) ;
9126             exit(0);
9127         }
9128         printf ("3\n") ;
9129     }
9130     else
9131         printf ("4\n") ;
9132     fflush (stdout) ;
9133     exit(0);
9134 }
9135 EOM
9136         : Call the object file tmp-dyna.o in case dlext=o.
9137         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9138                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9139                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9140                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9141                 xxx=`./fred`
9142                 case $xxx in
9143                 1)      echo "Test program failed using dlopen." >&4
9144                         echo "Perhaps you should not use dynamic loading." >&4;;
9145                 2)      echo "Test program failed using dlsym." >&4
9146                         echo "Perhaps you should not use dynamic loading." >&4;;
9147                 3)      echo "dlsym needs a leading underscore" >&4
9148                         val="$define" ;;
9149                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9150                 esac
9151         else
9152                 echo "I can't compile and run the test program." >&4
9153                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9154         fi
9155         ;;
9156 esac
9157                 
9158 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9159
9160 set d_dlsymun
9161 eval $setvar
9162
9163 hasproto='varname=$1; func=$2; shift; shift;
9164 while $test $# -ge 2; do
9165         case "$1" in
9166         $define) echo "#include <$2>";;
9167         esac ;
9168     shift 2;
9169 done > try.c;
9170 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9171 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9172         echo "$func() prototype found.";
9173         val="$define";
9174 else
9175         echo "$func() prototype NOT found.";
9176         val="$undef";
9177 fi;
9178 set $varname;
9179 eval $setvar;
9180 $rm -f try.c tryout.c'
9181
9182 : see if prototype for drand48 is available
9183 echo " "
9184 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9185 eval $hasproto
9186
9187 : see if dup2 exists
9188 set dup2 d_dup2
9189 eval $inlibc
9190
9191 : see if eaccess exists
9192 set eaccess d_eaccess
9193 eval $inlibc
9194
9195 : see if endgrent exists
9196 set endgrent d_endgrent
9197 eval $inlibc
9198
9199 : see if endhostent exists
9200 set endhostent d_endhent
9201 eval $inlibc
9202
9203 : see if endnetent exists
9204 set endnetent d_endnent
9205 eval $inlibc
9206
9207 : see if endprotoent exists
9208 set endprotoent d_endpent
9209 eval $inlibc
9210
9211 : see if endpwent exists
9212 set endpwent d_endpwent
9213 eval $inlibc
9214
9215 : see if endservent exists
9216 set endservent d_endsent
9217 eval $inlibc
9218
9219 : Locate the flags for 'open()'
9220 echo " "
9221 $cat >open3.c <<'EOCP'
9222 #include <sys/types.h>
9223 #ifdef I_FCNTL
9224 #include <fcntl.h>
9225 #endif
9226 #ifdef I_SYS_FILE
9227 #include <sys/file.h>
9228 #endif
9229 int main() {
9230         if(O_RDONLY);
9231 #ifdef O_TRUNC
9232         exit(0);
9233 #else
9234         exit(1);
9235 #endif
9236 }
9237 EOCP
9238 : check sys/file.h first to get FREAD on Sun
9239 if $test `./findhdr sys/file.h` && \
9240                 set open3 -DI_SYS_FILE && eval $compile; then
9241         h_sysfile=true;
9242         echo "<sys/file.h> defines the O_* constants..." >&4
9243         if ./open3; then
9244                 echo "and you have the 3 argument form of open()." >&4
9245                 val="$define"
9246         else
9247                 echo "but not the 3 argument form of open().  Oh, well." >&4
9248                 val="$undef"
9249         fi
9250 elif $test `./findhdr fcntl.h` && \
9251                 set open3 -DI_FCNTL && eval $compile; then
9252         h_fcntl=true;
9253         echo "<fcntl.h> defines the O_* constants..." >&4
9254         if ./open3; then
9255                 echo "and you have the 3 argument form of open()." >&4
9256                 val="$define"
9257         else
9258                 echo "but not the 3 argument form of open().  Oh, well." >&4
9259                 val="$undef"
9260         fi
9261 else
9262         val="$undef"
9263         echo "I can't find the O_* constant definitions!  You got problems." >&4
9264 fi
9265 set d_open3
9266 eval $setvar
9267 $rm -f open3*
9268
9269 : see which of string.h or strings.h is needed
9270 echo " "
9271 strings=`./findhdr string.h`
9272 if $test "$strings" && $test -r "$strings"; then
9273         echo "Using <string.h> instead of <strings.h>." >&4
9274         val="$define"
9275 else
9276         val="$undef"
9277         strings=`./findhdr strings.h`
9278         if $test "$strings" && $test -r "$strings"; then
9279                 echo "Using <strings.h> instead of <string.h>." >&4
9280         else
9281                 echo "No string header found -- You'll surely have problems." >&4
9282         fi
9283 fi
9284 set i_string
9285 eval $setvar
9286 case "$i_string" in
9287 "$undef") strings=`./findhdr strings.h`;;
9288 *)        strings=`./findhdr string.h`;;
9289 esac
9290
9291 : check for non-blocking I/O stuff
9292 case "$h_sysfile" in
9293 true) echo "#include <sys/file.h>" > head.c;;
9294 *)
9295        case "$h_fcntl" in
9296        true) echo "#include <fcntl.h>" > head.c;;
9297        *) echo "#include <sys/fcntl.h>" > head.c;;
9298        esac
9299        ;;
9300 esac
9301 echo " "
9302 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9303 case "$o_nonblock" in
9304 '')
9305         $cat head.c > try.c
9306         $cat >>try.c <<'EOCP'
9307 #include <stdio.h>
9308 int main() {
9309 #ifdef O_NONBLOCK
9310         printf("O_NONBLOCK\n");
9311         exit(0);
9312 #endif
9313 #ifdef O_NDELAY
9314         printf("O_NDELAY\n");
9315         exit(0);
9316 #endif
9317 #ifdef FNDELAY
9318         printf("FNDELAY\n");
9319         exit(0);
9320 #endif
9321         exit(0);
9322 }
9323 EOCP
9324         set try
9325         if eval $compile_ok; then
9326                 o_nonblock=`./try`
9327                 case "$o_nonblock" in
9328                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9329                 *) echo "Seems like we can use $o_nonblock.";;
9330                 esac
9331         else
9332                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9333         fi
9334         ;;
9335 *) echo "Using $hint value $o_nonblock.";;
9336 esac
9337 $rm -f try try.* .out core
9338
9339 echo " "
9340 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9341 case "$eagain" in
9342 '')
9343         $cat head.c > try.c
9344         $cat >>try.c <<EOCP
9345 #include <errno.h>
9346 #include <sys/types.h>
9347 #include <signal.h>
9348 #include <stdio.h> 
9349 #define MY_O_NONBLOCK $o_nonblock
9350 #ifndef errno  /* XXX need better Configure test */
9351 extern int errno;
9352 #endif
9353 #$i_unistd I_UNISTD
9354 #ifdef I_UNISTD
9355 #include <unistd.h>
9356 #endif
9357 #$i_string I_STRING
9358 #ifdef I_STRING
9359 #include <string.h>
9360 #else
9361 #include <strings.h>
9362 #endif
9363 $signal_t blech(x) int x; { exit(3); }
9364 EOCP
9365         $cat >> try.c <<'EOCP'
9366 int main()
9367 {
9368         int pd[2];
9369         int pu[2];
9370         char buf[1];
9371         char string[100];
9372
9373         pipe(pd);       /* Down: child -> parent */
9374         pipe(pu);       /* Up: parent -> child */
9375         if (0 != fork()) {
9376                 int ret;
9377                 close(pd[1]);   /* Parent reads from pd[0] */
9378                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9379 #ifdef F_SETFL
9380                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9381                         exit(1);
9382 #else
9383                 exit(4);
9384 #endif
9385                 signal(SIGALRM, blech);
9386                 alarm(5);
9387                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9388                         exit(2);
9389                 sprintf(string, "%d\n", ret);
9390                 write(2, string, strlen(string));
9391                 alarm(0);
9392 #ifdef EAGAIN
9393                 if (errno == EAGAIN) {
9394                         printf("EAGAIN\n");
9395                         goto ok;
9396                 }
9397 #endif
9398 #ifdef EWOULDBLOCK
9399                 if (errno == EWOULDBLOCK)
9400                         printf("EWOULDBLOCK\n");
9401 #endif
9402         ok:
9403                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9404                 sleep(2);                               /* Give it time to close our pipe */
9405                 alarm(5);
9406                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9407                 alarm(0);
9408                 sprintf(string, "%d\n", ret);
9409                 write(3, string, strlen(string));
9410                 exit(0);
9411         }
9412
9413         close(pd[0]);                   /* We write to pd[1] */
9414         close(pu[1]);                   /* We read from pu[0] */
9415         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9416         close(pd[1]);                   /* Pipe pd is now fully closed! */
9417         exit(0);                                /* Bye bye, thank you for playing! */
9418 }
9419 EOCP
9420         set try
9421         if eval $compile_ok; then
9422                 echo "$startsh" >mtry
9423                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9424                 chmod +x mtry
9425                 ./mtry >/dev/null 2>&1
9426                 case $? in
9427                 0) eagain=`$cat try.out`;;
9428                 1) echo "Could not perform non-blocking setting!";;
9429                 2) echo "I did a successful read() for something that was not there!";;
9430                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9431                 4) echo "Could not find F_SETFL!";;
9432                 *) echo "Something terribly wrong happened during testing.";;
9433                 esac
9434                 rd_nodata=`$cat try.ret`
9435                 echo "A read() system call with no data present returns $rd_nodata."
9436                 case "$rd_nodata" in
9437                 0|-1) ;;
9438                 *)
9439                         echo "(That's peculiar, fixing that to be -1.)"
9440                         rd_nodata=-1
9441                         ;;
9442                 esac
9443                 case "$eagain" in
9444                 '')
9445                         echo "Forcing errno EAGAIN on read() with no data available."
9446                         eagain=EAGAIN
9447                         ;;
9448                 *)
9449                         echo "Your read() sets errno to $eagain when no data is available."
9450                         ;;
9451                 esac
9452                 status=`$cat try.err`
9453                 case "$status" in
9454                 0) echo "And it correctly returns 0 to signal EOF.";;
9455                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9456                 *) echo "However, your read() returns '$status' on EOF??";;
9457                 esac
9458                 val="$define"
9459                 if test "$status" = "$rd_nodata"; then
9460                         echo "WARNING: you can't distinguish between EOF and no data!"
9461                         val="$undef"
9462                 fi
9463         else
9464                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9465                 eagain=EAGAIN
9466         fi
9467         set d_eofnblk
9468         eval $setvar
9469         ;;
9470 *)
9471         echo "Using $hint value $eagain."
9472         echo "Your read() returns $rd_nodata when no data is present."
9473         case "$d_eofnblk" in
9474         "$define") echo "And you can see EOF because read() returns 0.";;
9475         "$undef") echo "But you can't see EOF status from read() returned value.";;
9476         *)
9477                 echo "(Assuming you can't see EOF status from read anyway.)"
9478                 d_eofnblk=$undef
9479                 ;;
9480         esac
9481         ;;
9482 esac
9483 $rm -f try try.* .out core head.c mtry
9484
9485 : see if fchmod exists
9486 set fchmod d_fchmod
9487 eval $inlibc
9488
9489 : see if fchown exists
9490 set fchown d_fchown
9491 eval $inlibc
9492
9493 : see if this is an fcntl system
9494 set fcntl d_fcntl
9495 eval $inlibc
9496
9497 echo " "
9498 : See if fcntl-based locking works.
9499 $cat >try.c <<'EOCP'
9500 #include <stdlib.h>
9501 #include <unistd.h>
9502 #include <fcntl.h>
9503 int main() {
9504 #if defined(F_SETLK) && defined(F_SETLKW)
9505      struct flock flock;
9506      int retval, fd;
9507      fd = open("try.c", O_RDONLY);
9508      flock.l_type = F_RDLCK;
9509      flock.l_whence = SEEK_SET;
9510      flock.l_start = flock.l_len = 0;
9511      retval = fcntl(fd, F_SETLK, &flock);
9512      close(fd);
9513      (retval < 0 ? exit(2) : exit(0));
9514 #else
9515      exit(2);
9516 #endif
9517 }
9518 EOCP
9519 echo "Checking if fcntl-based file locking works... "
9520 case "$d_fcntl" in
9521 "$define")
9522         set try
9523         if eval $compile_ok; then
9524                 if ./try; then
9525                         echo "Yes, it seems to work."
9526                         val="$define"
9527                 else
9528                         echo "Nope, it didn't work."
9529                         val="$undef"
9530                 fi
9531         else
9532                 echo "I'm unable to compile the test program, so I'll assume not."
9533                 val="$undef"
9534         fi
9535         ;;
9536 *) val="$undef";
9537         echo "Nope, since you don't even have fcntl()."
9538         ;;
9539 esac
9540 set d_fcntl_can_lock
9541 eval $setvar
9542 $rm -f try*
9543
9544
9545 : see if sys/select.h has to be included
9546 set sys/select.h i_sysselct
9547 eval $inhdr
9548
9549 : see if we should include time.h, sys/time.h, or both
9550 echo " "
9551 if test "X$timeincl" = X; then
9552         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9553         $echo $n "I'm now running the test program...$c"
9554         $cat >try.c <<'EOCP'
9555 #include <sys/types.h>
9556 #ifdef I_TIME
9557 #include <time.h>
9558 #endif
9559 #ifdef I_SYSTIME
9560 #ifdef SYSTIMEKERNEL
9561 #define KERNEL
9562 #endif
9563 #include <sys/time.h>
9564 #endif
9565 #ifdef I_SYSSELECT
9566 #include <sys/select.h>
9567 #endif
9568 int main()
9569 {
9570         struct tm foo;
9571 #ifdef S_TIMEVAL
9572         struct timeval bar;
9573 #endif
9574 #ifdef S_TIMEZONE
9575         struct timezone tzp;
9576 #endif
9577         if (foo.tm_sec == foo.tm_sec)
9578                 exit(0);
9579 #ifdef S_TIMEVAL
9580         if (bar.tv_sec == bar.tv_sec)
9581                 exit(0);
9582 #endif
9583         exit(1);
9584 }
9585 EOCP
9586         flags=''
9587         for s_timezone in '-DS_TIMEZONE' ''; do
9588         sysselect=''
9589         for s_timeval in '-DS_TIMEVAL' ''; do
9590         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9591         for i_time in '' '-DI_TIME'; do
9592         for i_systime in '-DI_SYSTIME' ''; do
9593                 case "$flags" in
9594                 '') $echo $n ".$c"
9595                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9596                         if eval $compile; then
9597                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9598                                 shift
9599                                 flags="$*"
9600                                 echo " "
9601                                 $echo $n "Succeeded with $flags$c"
9602                         fi
9603                         ;;
9604                 esac
9605         done
9606         done
9607         done
9608         done
9609         done
9610         timeincl=''
9611         echo " "
9612         case "$flags" in
9613         *SYSTIMEKERNEL*) i_systimek="$define"
9614                 timeincl=`./findhdr sys/time.h`
9615                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9616         *) i_systimek="$undef";;
9617         esac
9618         case "$flags" in
9619         *I_TIME*) i_time="$define"
9620                 timeincl=`./findhdr time.h`" $timeincl"
9621                 echo "We'll include <time.h>." >&4;;
9622         *) i_time="$undef";;
9623         esac
9624         case "$flags" in
9625         *I_SYSTIME*) i_systime="$define"
9626                 timeincl=`./findhdr sys/time.h`" $timeincl"
9627                 echo "We'll include <sys/time.h>." >&4;;
9628         *) i_systime="$undef";;
9629         esac
9630         $rm -f try.c try
9631 fi
9632
9633 : check for fd_set items
9634 $cat <<EOM
9635
9636 Checking to see how well your C compiler handles fd_set and friends ...
9637 EOM
9638 $cat >fd_set.c <<EOCP
9639 #$i_systime I_SYS_TIME
9640 #$i_sysselct I_SYS_SELECT
9641 #$d_socket HAS_SOCKET
9642 #include <sys/types.h>
9643 #ifdef HAS_SOCKET
9644 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9645 #endif
9646 #ifdef I_SYS_TIME
9647 #include <sys/time.h>
9648 #endif
9649 #ifdef I_SYS_SELECT
9650 #include <sys/select.h>
9651 #endif
9652 int main() {
9653         fd_set fds;
9654
9655 #ifdef TRYBITS
9656         if(fds.fds_bits);
9657 #endif
9658
9659 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9660         exit(0);
9661 #else
9662         exit(1);
9663 #endif
9664 }
9665 EOCP
9666 set fd_set -DTRYBITS
9667 if eval $compile; then
9668         d_fds_bits="$define"
9669         d_fd_set="$define"
9670         echo "Well, your system knows about the normal fd_set typedef..." >&4
9671         if ./fd_set; then
9672                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9673                 d_fd_macros="$define"
9674         else
9675                 $cat >&4 <<'EOM'
9676 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9677 EOM
9678                 d_fd_macros="$undef"
9679         fi
9680 else
9681         $cat <<'EOM'
9682 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9683 EOM
9684         set fd_set
9685         if eval $compile; then
9686                 d_fds_bits="$undef"
9687                 d_fd_set="$define"
9688                 echo "Well, your system has some sort of fd_set available..." >&4
9689                 if ./fd_set; then
9690                         echo "and you have the normal fd_set macros." >&4
9691                         d_fd_macros="$define"
9692                 else
9693                         $cat <<'EOM'
9694 but not the normal fd_set macros!  Gross!  More work for me...
9695 EOM
9696                         d_fd_macros="$undef"
9697                 fi
9698         else
9699         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9700                 d_fd_set="$undef"
9701                 d_fds_bits="$undef"
9702                 d_fd_macros="$undef"
9703         fi
9704 fi
9705 $rm -f fd_set*
9706
9707 : see if fgetpos exists
9708 set fgetpos d_fgetpos
9709 eval $inlibc
9710
9711 : see if flock exists
9712 set flock d_flock
9713 eval $inlibc
9714
9715 : see if fork exists
9716 set fork d_fork
9717 eval $inlibc
9718
9719 : see if pathconf exists
9720 set pathconf d_pathconf
9721 eval $inlibc
9722
9723 : see if fpathconf exists
9724 set fpathconf d_fpathconf
9725 eval $inlibc
9726
9727
9728 : check for fpos64_t
9729 echo " "
9730 echo "Checking to see if you have fpos64_t..." >&4
9731 $cat >try.c <<EOCP
9732 #include <stdio.h>
9733 int main() { fpos64_t x = 7; }
9734 EOCP
9735 set try
9736 if eval $compile; then
9737         val="$define"
9738         echo "You have fpos64_t."
9739 else
9740         val="$undef"
9741         echo "You do not have fpos64_t."
9742         case "$fpossize" in
9743         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9744         esac
9745 fi
9746 $rm -f try.* try
9747 set d_fpos64_t
9748 eval $setvar
9749
9750 : see if frexpl exists
9751 set frexpl d_frexpl
9752 eval $inlibc
9753
9754 : see if this is a sys/param system
9755 set sys/param.h i_sysparam
9756 eval $inhdr
9757
9758 : see if this is a sys/mount.h system
9759 set sys/mount.h i_sysmount
9760 eval $inhdr
9761
9762
9763 echo " "
9764 echo "Checking to see if your system supports struct fs_data..." >&4
9765 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9766 eval $hasstruct
9767 case "$d_fs_data_s" in
9768 "$define")      echo "Yes, it does."   ;;
9769 *)              echo "No, it doesn't." ;;
9770 esac
9771
9772 : see if fseeko exists
9773 set fseeko d_fseeko
9774 eval $inlibc
9775 case "$longsize" in
9776 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9777 esac
9778
9779 : see if fsetpos exists
9780 set fsetpos d_fsetpos
9781 eval $inlibc
9782
9783
9784 : see if fstatfs exists
9785 set fstatfs d_fstatfs
9786 eval $inlibc
9787
9788
9789 : see if statvfs exists
9790 set statvfs d_statvfs
9791 eval $inlibc
9792
9793 : see if fstatvfs exists
9794 set fstatvfs d_fstatvfs
9795 eval $inlibc
9796
9797
9798 : see if fsync exists
9799 set fsync d_fsync
9800 eval $inlibc
9801
9802 : see if ftello exists
9803 set ftello d_ftello
9804 eval $inlibc
9805 case "$longsize" in
9806 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9807 esac
9808
9809 : see if getcwd exists
9810 set getcwd d_getcwd
9811 eval $inlibc
9812
9813 : see if getespwnam exists
9814 set getespwnam d_getespwnam
9815 eval $inlibc
9816
9817
9818 : see if getfsstat exists
9819 set getfsstat d_getfsstat
9820 eval $inlibc
9821
9822 : see if getgrent exists
9823 set getgrent d_getgrent
9824 eval $inlibc
9825
9826 : see if gethostbyaddr exists
9827 set gethostbyaddr d_gethbyaddr
9828 eval $inlibc
9829
9830 : see if gethostbyname exists
9831 set gethostbyname d_gethbyname
9832 eval $inlibc
9833
9834 : see if gethostent exists
9835 set gethostent d_gethent
9836 eval $inlibc
9837
9838 : see how we will look up host name
9839 echo " "
9840 call=''
9841 if set gethostname val -f d_gethname; eval $csym; $val; then
9842         echo 'gethostname() found.' >&4
9843         d_gethname="$define"
9844         call=gethostname
9845 fi
9846 if set uname val -f d_uname; eval $csym; $val; then
9847         if ./xenix; then
9848                 $cat <<'EOM'
9849 uname() was found, but you're running xenix, and older versions of xenix
9850 have a broken uname(). If you don't really know whether your xenix is old
9851 enough to have a broken system call, use the default answer.
9852
9853 EOM
9854                 dflt=y
9855                 case "$d_uname" in
9856                 "$define") dflt=n;;
9857                 esac
9858                 rp='Is your uname() broken?'
9859                 . ./myread
9860                 case "$ans" in
9861                 n*) d_uname="$define"; call=uname;;
9862                 esac
9863         else
9864                 echo 'uname() found.' >&4
9865                 d_uname="$define"
9866                 case "$call" in
9867                 '') call=uname ;;
9868                 esac
9869         fi
9870 fi
9871 case "$d_gethname" in
9872 '') d_gethname="$undef";;
9873 esac
9874 case "$d_uname" in
9875 '') d_uname="$undef";;
9876 esac
9877 case "$d_uname$d_gethname" in
9878 *define*)
9879         dflt=n
9880         cat <<EOM
9881  
9882 Every now and then someone has a $call() that lies about the hostname
9883 but can't be fixed for political or economic reasons.  If you wish, I can
9884 pretend $call() isn't there and maybe compute hostname at run-time
9885 thanks to the '$phostname' command.
9886
9887 EOM
9888         rp="Shall I ignore $call() from now on?"
9889         . ./myread
9890         case "$ans" in
9891         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9892         esac;;
9893 esac
9894 case "$phostname" in
9895 '') aphostname='';;
9896 *) case "$aphostname" in
9897         /*) ;;
9898         *) set X $phostname
9899                 shift
9900                 file=$1
9901                 shift
9902                 file=`./loc $file $file $pth`
9903                 aphostname=`echo $file $*`
9904                 ;;
9905         esac
9906         ;;
9907 esac
9908 case "$d_uname$d_gethname" in
9909 *define*) ;;
9910 *)
9911         case "$phostname" in
9912         '')
9913                 echo "There will be no way for $package to get your hostname." >&4;;
9914         *)
9915         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9916                 ;;
9917         esac;;
9918 esac
9919 case "$d_phostname" in
9920 '') d_phostname="$undef";;
9921 esac
9922
9923 : see if this is a netdb.h system
9924 set netdb.h i_netdb
9925 eval $inhdr
9926
9927 : see if prototypes for various gethostxxx netdb.h functions are available
9928 echo " "
9929 set d_gethostprotos gethostent $i_netdb netdb.h
9930 eval $hasproto
9931
9932 : see if getitimer exists
9933 set getitimer d_getitimer
9934 eval $inlibc
9935
9936 : see if getlogin exists
9937 set getlogin d_getlogin
9938 eval $inlibc
9939
9940 : see if getmnt exists
9941 set getmnt d_getmnt
9942 eval $inlibc
9943
9944 : see if getmntent exists
9945 set getmntent d_getmntent
9946 eval $inlibc
9947
9948 : see if getnetbyaddr exists
9949 set getnetbyaddr d_getnbyaddr
9950 eval $inlibc
9951
9952 : see if getnetbyname exists
9953 set getnetbyname d_getnbyname
9954 eval $inlibc
9955
9956 : see if getnetent exists
9957 set getnetent d_getnent
9958 eval $inlibc
9959
9960 : see if prototypes for various getnetxxx netdb.h functions are available
9961 echo " "
9962 set d_getnetprotos getnetent $i_netdb netdb.h
9963 eval $hasproto
9964
9965 : see if getpagesize exists
9966 set getpagesize d_getpagsz
9967 eval $inlibc
9968
9969
9970 : see if getprotobyname exists
9971 set getprotobyname d_getpbyname
9972 eval $inlibc
9973
9974 : see if getprotobynumber exists
9975 set getprotobynumber d_getpbynumber
9976 eval $inlibc
9977
9978 : see if getprotoent exists
9979 set getprotoent d_getpent
9980 eval $inlibc
9981
9982 : see if getpgid exists
9983 set getpgid d_getpgid
9984 eval $inlibc
9985
9986 : see if getpgrp2 exists
9987 set getpgrp2 d_getpgrp2
9988 eval $inlibc
9989
9990 : see if getppid exists
9991 set getppid d_getppid
9992 eval $inlibc
9993
9994 : see if getpriority exists
9995 set getpriority d_getprior
9996 eval $inlibc
9997
9998 : see if prototypes for various getprotoxxx netdb.h functions are available
9999 echo " "
10000 set d_getprotoprotos getprotoent $i_netdb netdb.h
10001 eval $hasproto
10002
10003 : see if getprpwnam exists
10004 set getprpwnam d_getprpwnam
10005 eval $inlibc
10006
10007 : see if getpwent exists
10008 set getpwent d_getpwent
10009 eval $inlibc
10010
10011
10012 : see if getservbyname exists
10013 set getservbyname d_getsbyname
10014 eval $inlibc
10015
10016 : see if getservbyport exists
10017 set getservbyport d_getsbyport
10018 eval $inlibc
10019
10020 : see if getservent exists
10021 set getservent d_getsent
10022 eval $inlibc
10023
10024 : see if prototypes for various getservxxx netdb.h functions are available
10025 echo " "
10026 set d_getservprotos getservent $i_netdb netdb.h
10027 eval $hasproto
10028
10029 : see if getspnam exists
10030 set getspnam d_getspnam
10031 eval $inlibc
10032
10033 : see if gettimeofday or ftime exists
10034 set gettimeofday d_gettimeod
10035 eval $inlibc
10036 case "$d_gettimeod" in
10037 "$undef")
10038         set ftime d_ftime 
10039         eval $inlibc
10040         ;;
10041 *)
10042         val="$undef"; set d_ftime; eval $setvar
10043         ;;
10044 esac
10045 case "$d_gettimeod$d_ftime" in
10046 "$undef$undef")
10047         echo " "
10048         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10049         ;;
10050 esac
10051
10052 : see if this is an grp system
10053 set grp.h i_grp
10054 eval $inhdr
10055
10056 case "$i_grp" in
10057 $define)
10058         xxx=`./findhdr grp.h`
10059         $cppstdin $cppflags $cppminus < $xxx >$$.h
10060
10061         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10062                 val="$define"
10063         else
10064                 val="$undef"
10065         fi
10066         set d_grpasswd
10067         eval $setvar
10068
10069         $rm -f $$.h
10070         ;;
10071 *)
10072         val="$undef";
10073         set d_grpasswd; eval $setvar
10074         ;;
10075 esac
10076
10077 : see if hasmntopt exists
10078 set hasmntopt d_hasmntopt
10079 eval $inlibc
10080
10081 : see if this is a netinet/in.h or sys/in.h system
10082 set netinet/in.h i_niin sys/in.h i_sysin
10083 eval $inhdr
10084
10085 : see if arpa/inet.h has to be included
10086 set arpa/inet.h i_arpainet
10087 eval $inhdr
10088
10089 : see if htonl --and friends-- exists
10090 val=''
10091 set htonl val
10092 eval $inlibc
10093
10094 : Maybe they are macros.
10095 case "$val" in
10096 $undef)
10097         $cat >htonl.c <<EOM
10098 #include <stdio.h>
10099 #include <sys/types.h>
10100 #$i_niin I_NETINET_IN
10101 #$i_sysin I_SYS_IN
10102 #$i_arpainet I_ARPA_INET
10103 #ifdef I_NETINET_IN
10104 #include <netinet/in.h>
10105 #endif
10106 #ifdef I_SYS_IN
10107 #include <sys/in.h>
10108 #endif
10109 #ifdef I_ARPA_INET
10110 #include <arpa/inet.h>
10111 #endif
10112 #ifdef htonl
10113 printf("Defined as a macro.");
10114 #endif
10115 EOM
10116         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10117         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10118                 val="$define"
10119                 echo "But it seems to be defined as a macro." >&4
10120         fi
10121         $rm -f htonl.?
10122         ;;
10123 esac
10124 set d_htonl
10125 eval $setvar
10126
10127 : see if iconv exists
10128 set iconv d_iconv
10129 eval $inlibc
10130
10131 : index or strchr
10132 echo " "
10133 if set index val -f; eval $csym; $val; then
10134         if set strchr val -f d_strchr; eval $csym; $val; then
10135                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10136                         val="$define"
10137                         vali="$undef"
10138                         echo "strchr() found." >&4
10139                 else
10140                         val="$undef"
10141                         vali="$define"
10142                         echo "index() found." >&4
10143                 fi
10144         else
10145                 val="$undef"
10146                 vali="$define"
10147                 echo "index() found." >&4
10148         fi
10149 else
10150         if set strchr val -f d_strchr; eval $csym; $val; then
10151                 val="$define"
10152                 vali="$undef"
10153                 echo "strchr() found." >&4
10154         else
10155                 echo "No index() or strchr() found!" >&4
10156                 val="$undef"
10157                 vali="$undef"
10158         fi
10159 fi
10160 set d_strchr; eval $setvar
10161 val="$vali"
10162 set d_index; eval $setvar
10163
10164 : check whether inet_aton exists
10165 set inet_aton d_inetaton
10166 eval $inlibc
10167
10168 : Look for isascii
10169 echo " "
10170 $cat >isascii.c <<'EOCP'
10171 #include <stdio.h>
10172 #include <ctype.h>
10173 int main() {
10174         int c = 'A';
10175         if (isascii(c))
10176                 exit(0);
10177         else
10178                 exit(1);
10179 }
10180 EOCP
10181 set isascii
10182 if eval $compile; then
10183         echo "isascii() found." >&4
10184         val="$define"
10185 else
10186         echo "isascii() NOT found." >&4
10187         val="$undef"
10188 fi
10189 set d_isascii
10190 eval $setvar
10191 $rm -f isascii*
10192
10193 : see if isnan exists
10194 set isnan d_isnan
10195 eval $inlibc
10196
10197 : see if isnanl exists
10198 set isnanl d_isnanl
10199 eval $inlibc
10200
10201 : see if killpg exists
10202 set killpg d_killpg
10203 eval $inlibc
10204
10205 : see if lchown exists
10206 echo " "
10207 $cat > try.c <<'EOCP'
10208 /* System header to define __stub macros and hopefully few prototypes,
10209     which can conflict with char lchown(); below.  */
10210 #include <assert.h>
10211 /* Override any gcc2 internal prototype to avoid an error.  */
10212 /* We use char because int might match the return type of a gcc2
10213    builtin and then its argument prototype would still apply.  */
10214 char lchown();
10215 int main() {
10216     /*  The GNU C library defines this for functions which it implements
10217         to always fail with ENOSYS.  Some functions are actually named
10218         something starting with __ and the normal name is an alias.  */
10219 #if defined (__stub_lchown) || defined (__stub___lchown)
10220 choke me
10221 #else
10222 lchown();
10223 #endif
10224 ; return 0; }
10225 EOCP
10226 set try
10227 if eval $compile; then
10228     $echo "lchown() found." >&4
10229     val="$define"
10230 else
10231     $echo "lchown() NOT found." >&4
10232     val="$undef"
10233 fi
10234 set d_lchown
10235 eval $setvar
10236
10237 : See if number of significant digits in a double precision number is known
10238 echo " "
10239 $cat >ldbl_dig.c <<EOM
10240 #$i_limits I_LIMITS
10241 #$i_float I_FLOAT
10242 #ifdef I_LIMITS
10243 #include <limits.h>
10244 #endif
10245 #ifdef I_FLOAT
10246 #include <float.h>
10247 #endif
10248 #ifdef LDBL_DIG
10249 printf("Contains LDBL_DIG");
10250 #endif
10251 EOM
10252 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10253 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10254         echo "LDBL_DIG found." >&4
10255         val="$define"
10256 else
10257         echo "LDBL_DIG NOT found." >&4
10258         val="$undef"
10259 fi
10260 $rm -f ldbl_dig.?
10261 set d_ldbl_dig
10262 eval $setvar
10263
10264 : see if link exists
10265 set link d_link
10266 eval $inlibc
10267
10268 : see if localeconv exists
10269 set localeconv d_locconv
10270 eval $inlibc
10271
10272 : see if lockf exists
10273 set lockf d_lockf
10274 eval $inlibc
10275
10276 : see if prototype for lseek is available
10277 echo " "
10278 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10279 eval $hasproto
10280
10281 : see if lstat exists
10282 set lstat d_lstat
10283 eval $inlibc
10284
10285 : see if madvise exists
10286 set madvise d_madvise
10287 eval $inlibc
10288
10289 : see if mblen exists
10290 set mblen d_mblen
10291 eval $inlibc
10292
10293 : see if mbstowcs exists
10294 set mbstowcs d_mbstowcs
10295 eval $inlibc
10296
10297 : see if mbtowc exists
10298 set mbtowc d_mbtowc
10299 eval $inlibc
10300
10301 : see if memchr exists
10302 set memchr d_memchr
10303 eval $inlibc
10304
10305 : see if memcmp exists
10306 set memcmp d_memcmp
10307 eval $inlibc
10308
10309 : see if memcpy exists
10310 set memcpy d_memcpy
10311 eval $inlibc
10312
10313 : see if memmove exists
10314 set memmove d_memmove
10315 eval $inlibc
10316
10317 : see if memset exists
10318 set memset d_memset
10319 eval $inlibc
10320
10321 : see if mkdir exists
10322 set mkdir d_mkdir
10323 eval $inlibc
10324
10325 : see if mkdtemp exists
10326 set mkdtemp d_mkdtemp
10327 eval $inlibc
10328
10329 : see if mkfifo exists
10330 set mkfifo d_mkfifo
10331 eval $inlibc
10332
10333 : see if mkstemp exists
10334 set mkstemp d_mkstemp
10335 eval $inlibc
10336
10337 : see if mkstemps exists
10338 set mkstemps d_mkstemps
10339 eval $inlibc
10340
10341 : see if mktime exists
10342 set mktime d_mktime
10343 eval $inlibc
10344
10345 : see if this is a sys/mman.h system
10346 set sys/mman.h i_sysmman
10347 eval $inhdr
10348
10349 : see if mmap exists
10350 set mmap d_mmap
10351 eval $inlibc
10352 : see what shmat returns
10353 : default to something harmless
10354 mmaptype='void *'
10355 case "$i_sysmman$d_mmap" in
10356 "$define$define")
10357         $cat >mmap.c <<'END'
10358 #include <sys/mman.h>
10359 void *mmap();
10360 END
10361         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10362                 mmaptype='void *'
10363         else
10364                 mmaptype='caddr_t'
10365         fi
10366         echo "and it returns ($mmaptype)." >&4
10367         ;;
10368 esac
10369
10370
10371
10372 : see if modfl exists
10373 set modfl d_modfl
10374 eval $inlibc
10375
10376 : see if mprotect exists
10377 set mprotect d_mprotect
10378 eval $inlibc
10379
10380 : see if msgctl exists
10381 set msgctl d_msgctl
10382 eval $inlibc
10383
10384 : see if msgget exists
10385 set msgget d_msgget
10386 eval $inlibc
10387
10388 : see if msgsnd exists
10389 set msgsnd d_msgsnd
10390 eval $inlibc
10391
10392 : see if msgrcv exists
10393 set msgrcv d_msgrcv
10394 eval $inlibc
10395
10396 : see how much of the 'msg*(2)' library is present.
10397 h_msg=true
10398 echo " "
10399 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10400 *"$undef"*) h_msg=false;;
10401 esac
10402 case "$osname" in
10403 freebsd)
10404     case "`ipcs 2>&1`" in
10405     "SVID messages"*"not configured"*)
10406         echo "Your $osname does not have the msg*(2) configured." >&4
10407         h_msg=false
10408         val="$undef"
10409         set msgctl d_msgctl
10410         eval $setvar
10411         set msgget d_msgget
10412         eval $setvar
10413         set msgsnd d_msgsnd
10414         eval $setvar
10415         set msgrcv d_msgrcv
10416         eval $setvar
10417         ;;
10418     esac
10419     ;;
10420 esac
10421 : we could also check for sys/ipc.h ...
10422 if $h_msg && $test `./findhdr sys/msg.h`; then
10423         echo "You have the full msg*(2) library." >&4
10424         val="$define"
10425 else
10426         echo "You don't have the full msg*(2) library." >&4
10427         val="$undef"
10428 fi
10429 set d_msg
10430 eval $setvar
10431
10432
10433 echo " "
10434 echo "Checking to see if your system supports struct msghdr..." >&4
10435 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10436 eval $hasstruct
10437 case "$d_msghdr_s" in
10438 "$define")      echo "Yes, it does."   ;;
10439 *)              echo "No, it doesn't." ;;
10440 esac
10441
10442
10443 : see if msync exists
10444 set msync d_msync
10445 eval $inlibc
10446
10447 : see if munmap exists
10448 set munmap d_munmap
10449 eval $inlibc
10450
10451 : see if nice exists
10452 set nice d_nice
10453 eval $inlibc
10454
10455 : check for length of character
10456 echo " "
10457 case "$charsize" in
10458 '')
10459         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10460         $cat >try.c <<'EOCP'
10461 #include <stdio.h>
10462 int main()
10463 {
10464     printf("%d\n", (int)sizeof(char));
10465     exit(0);
10466 }
10467 EOCP
10468         set try
10469         if eval $compile_ok; then
10470                 dflt=`./try`
10471         else
10472                 dflt='1'
10473                 echo "(I can't seem to compile the test program.  Guessing...)"
10474         fi
10475         ;;
10476 *)
10477         dflt="$charsize"
10478         ;;
10479 esac
10480 rp="What is the size of a character (in bytes)?"
10481 . ./myread
10482 charsize="$ans"
10483 $rm -f try.c try
10484
10485 : check for volatile keyword
10486 echo " "
10487 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10488 $cat >try.c <<'EOCP'
10489 int main()
10490 {
10491         typedef struct _goo_struct goo_struct;
10492         goo_struct * volatile goo = ((goo_struct *)0);
10493         struct _goo_struct {
10494                 long long_int;
10495                 int reg_int;
10496                 char char_var;
10497         };
10498         typedef unsigned short foo_t;
10499         char *volatile foo;
10500         volatile int bar;
10501         volatile foo_t blech;
10502         foo = foo;
10503 }
10504 EOCP
10505 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10506         val="$define"
10507         echo "Yup, it does."
10508 else
10509         val="$undef"
10510         echo "Nope, it doesn't."
10511 fi
10512 set d_volatile
10513 eval $setvar
10514 $rm -f try.*
10515
10516
10517 echo " "
10518 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10519
10520 case "$use64bitint:$d_quad:$quadtype" in
10521 define:define:?*)
10522         ivtype="$quadtype"
10523         uvtype="$uquadtype"
10524         ivsize=8
10525         uvsize=8
10526         ;;
10527 *)      ivtype="long"
10528         uvtype="unsigned long"
10529         ivsize=$longsize
10530         uvsize=$longsize
10531         ;;
10532 esac
10533
10534 case "$uselongdouble:$d_longdbl" in
10535 define:define)
10536         nvtype="long double"
10537         nvsize=$longdblsize
10538         ;;
10539 *)      nvtype=double
10540         nvsize=$doublesize
10541         ;;
10542 esac
10543
10544 $echo "(IV will be "$ivtype", $ivsize bytes)"
10545 $echo "(UV will be "$uvtype", $uvsize bytes)"
10546 $echo "(NV will be "$nvtype", $nvsize bytes)"
10547
10548 $cat >try.c <<EOCP
10549 #$i_inttypes I_INTTYPES
10550 #ifdef I_INTTYPES
10551 #include <inttypes.h>
10552 #endif
10553 #include <stdio.h>
10554 int main() {
10555 #ifdef INT8
10556    int8_t i =  INT8_MAX;
10557   uint8_t u = UINT8_MAX;
10558   printf("int8_t\n");
10559 #endif
10560 #ifdef INT16
10561    int16_t i =  INT16_MAX;
10562   uint16_t i = UINT16_MAX;
10563   printf("int16_t\n");
10564 #endif
10565 #ifdef INT32
10566    int32_t i =  INT32_MAX;
10567   uint32_t u = UINT32_MAX;
10568   printf("int32_t\n");
10569 #endif
10570 }
10571 EOCP
10572
10573 case "$i8type" in
10574 '')     case "$charsize" in
10575         1)      i8type=char
10576                 u8type="unsigned char"
10577                 i8size=$charsize
10578                 u8size=$charsize
10579                 ;;
10580         esac
10581         ;;
10582 esac
10583 case "$i8type" in
10584 '')     set try -DINT8
10585         if eval $compile; then
10586                 case "`./try$exe_ext`" in
10587                 int8_t) i8type=int8_t
10588                         u8type=uint8_t
10589                         i8size=1
10590                         u8size=1
10591                         ;;
10592                 esac
10593         fi
10594         ;;
10595 esac
10596 case "$i8type" in
10597 '')     if $test $charsize -ge 1; then
10598                 i8type=char
10599                 u8type="unsigned char"
10600                 i8size=$charsize
10601                 u8size=$charsize
10602         fi
10603         ;;
10604 esac
10605
10606 case "$i16type" in
10607 '')     case "$shortsize" in
10608         2)      i16type=short
10609                 u16type="unsigned short"
10610                 i16size=$shortsize
10611                 u16size=$shortsize
10612                 ;;
10613         esac
10614         ;;
10615 esac
10616 case "$i16type" in
10617 '')     set try -DINT16
10618         if eval $compile; then
10619                 case "`./try$exe_ext`" in
10620                 int16_t)
10621                         i16type=int16_t
10622                         u16type=uint16_t
10623                         i16size=2
10624                         u16size=2
10625                         ;;
10626                 esac
10627         fi
10628         ;;
10629 esac
10630 case "$i16type" in
10631 '')     if $test $shortsize -ge 2; then
10632                 i16type=short
10633                 u16type="unsigned short"
10634                 i16size=$shortsize
10635                 u16size=$shortsize
10636         fi
10637         ;;
10638 esac
10639
10640 case "$i32type" in
10641 '')     case "$longsize" in
10642         4)      i32type=long
10643                 u32type="unsigned long"
10644                 i32size=$longsize
10645                 u32size=$longsize
10646                 ;;
10647         *)      case "$intsize" in
10648                 4)      i32type=int
10649                         u32type="unsigned int"
10650                         i32size=$intsize
10651                         u32size=$intsize
10652                         ;;
10653                 esac
10654                 ;;
10655         esac
10656         ;;
10657 esac
10658 case "$i32type" in
10659 '')     set try -DINT32
10660         if eval $compile; then
10661                 case "`./try$exe_ext`" in
10662                 int32_t)
10663                         i32type=int32_t
10664                         u32type=uint32_t
10665                         i32size=4
10666                         u32size=4
10667                         ;;
10668                 esac
10669         fi
10670         ;;
10671 esac
10672 case "$i32type" in
10673 '')     if $test $intsize -ge 4; then
10674                 i32type=int
10675                 u32type="unsigned int"
10676                 i32size=$intsize
10677                 u32size=$intsize
10678         fi
10679         ;;
10680 esac
10681
10682 case "$i64type" in
10683 '')     case "$d_quad:$quadtype" in
10684         define:?*)
10685                 i64type="$quadtype"
10686                 u64type="$uquadtype"
10687                 i64size=8
10688                 u64size=8
10689                 ;;
10690         esac
10691         ;;
10692 esac
10693
10694 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10695 : volatile so that the compiler has to store it out to memory.
10696 if test X"$d_volatile" = X"$define"; then
10697         volatile=volatile
10698 fi
10699 $cat <<EOP >try.c
10700 #include <stdio.h>
10701 #include <sys/types.h>
10702 #include <signal.h>
10703 #ifdef SIGFPE
10704 $volatile int bletched = 0;
10705 $signal_t blech(s) int s; { bletched = 1; }
10706 #endif
10707 int main() {
10708     $uvtype u = 0;
10709     $nvtype d;
10710     int     n = 8 * $uvsize;
10711     int     i;
10712 #ifdef SIGFPE
10713     signal(SIGFPE, blech);
10714 #endif
10715
10716     for (i = 0; i < n; i++) {
10717       u = u << 1 | ($uvtype)1;
10718       d = ($nvtype)u;
10719       if (($uvtype)d != u)
10720         break;
10721       if (d <= 0)
10722         break;
10723       d = ($nvtype)(u - 1);
10724       if (($uvtype)d != (u - 1))
10725         break;
10726 #ifdef SIGFPE
10727       if (bletched) {
10728         break;
10729 #endif
10730       } 
10731     }
10732     printf("%d\n", ((i == n) ? -n : i));
10733     exit(0);
10734 }
10735 EOP
10736 set try
10737
10738 d_nv_preserves_uv="$undef"
10739 if eval $compile; then
10740         d_nv_preserves_uv_bits="`./try$exe_ext`"
10741 fi
10742 case "$d_nv_preserves_uv_bits" in
10743 \-[1-9]*)       
10744         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10745         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10746         d_nv_preserves_uv="$define"
10747         ;;
10748 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10749         d_nv_preserves_uv="$undef" ;;
10750 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10751         d_nv_preserves_uv_bits="$undef" ;;
10752 esac
10753
10754 $rm -f try.* try
10755
10756
10757 : check for off64_t
10758 echo " "
10759 echo "Checking to see if you have off64_t..." >&4
10760 $cat >try.c <<EOCP
10761 #include <sys/types.h>
10762 #include <unistd.h>
10763 int main() { off64_t x = 7; }
10764 EOCP
10765 set try
10766 if eval $compile; then
10767         val="$define"
10768         echo "You have off64_t."
10769 else
10770         val="$undef"
10771         echo "You do not have off64_t."
10772         case "$lseeksize" in
10773         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10774         esac
10775 fi
10776 $rm -f try.* try
10777 set d_off64_t
10778 eval $setvar
10779
10780 : see if POSIX threads are available
10781 set pthread.h i_pthread
10782 eval $inhdr
10783
10784
10785
10786
10787 : how to create joinable pthreads
10788 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10789         echo " "
10790         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10791         $cat >try.c <<'EOCP'
10792 #include <pthread.h>
10793 int main() {
10794     int detachstate = JOINABLE;
10795 }
10796 EOCP
10797         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10798         if eval $compile; then
10799                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10800                 val="$undef" # Yes, undef.
10801                 set d_old_pthread_create_joinable
10802                 eval $setvar
10803                 val=""
10804                 set old_pthread_create_joinable
10805                 eval $setvar
10806         else
10807                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10808                 if eval $compile; then
10809                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10810                         val="$define"
10811                         set d_old_pthread_create_joinable
10812                         eval $setvar
10813                         val=PTHREAD_CREATE_UNDETACHED
10814                         set old_pthread_create_joinable
10815                         eval $setvar
10816                 else            
10817                         set try -DJOINABLE=__UNDETACHED
10818                         if eval $compile; then
10819                                 echo "You seem to use __UNDETACHED." >&4
10820                                 val="$define"
10821                                 set d_old_pthread_create_joinable
10822                                 eval $setvar
10823                                 val=__UNDETACHED
10824                                 set old_pthread_create_joinable
10825                                 eval $setvar
10826                         else
10827                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10828                                 val="$define"
10829                                 set d_old_pthread_create_joinable
10830                                 eval $setvar
10831                                 val=0
10832                                 set old_pthread_create_joinable
10833                                 eval $setvar
10834                         fi
10835                 fi
10836         fi
10837         $rm -f try try.*
10838 else
10839     d_old_pthread_create_joinable="$undef"
10840     old_pthread_create_joinable=""
10841 fi
10842
10843 : see if pause exists
10844 set pause d_pause
10845 eval $inlibc
10846
10847 : see if pipe exists
10848 set pipe d_pipe
10849 eval $inlibc
10850
10851 : see if poll exists
10852 set poll d_poll
10853 eval $inlibc
10854
10855
10856 : see whether the various POSIXish _yields exist
10857 $cat >try.c <<EOP
10858 #include <pthread.h>
10859 #include <stdio.h>
10860 int main() {
10861 #ifdef SCHED_YIELD
10862         sched_yield();
10863 #else
10864 #ifdef PTHREAD_YIELD
10865         pthread_yield();
10866 #else
10867 #ifdef PTHREAD_YIELD_NULL
10868         pthread_yield(NULL);
10869 #endif
10870 #endif
10871 #endif
10872 }
10873 EOP
10874 : see if sched_yield exists
10875 set try -DSCHED_YIELD
10876 if eval $compile; then
10877     val="$define"
10878     sched_yield='sched_yield()'
10879 else
10880     val="$undef"
10881 fi
10882 case "$usethreads" in
10883 $define)
10884         case "$val" in
10885         $define) echo 'sched_yield() found.' >&4        ;;
10886         *)       echo 'sched_yield() NOT found.' >&4    ;;
10887         esac
10888 esac
10889 set d_sched_yield
10890 eval $setvar
10891
10892 : see if pthread_yield exists
10893 set try -DPTHREAD_YIELD
10894 if eval $compile; then
10895     val="$define"
10896     case "$sched_yield" in
10897     '') sched_yield='pthread_yield()' ;;
10898     esac
10899 else
10900     set try -DPTHREAD_YIELD_NULL
10901     if eval $compile; then
10902         val="$define"
10903         case "$sched_yield" in
10904         '') sched_yield='pthread_yield(NULL)' ;;
10905         esac
10906     else
10907         val="$undef"
10908     fi
10909 fi
10910 case "$usethreads" in
10911 $define)
10912         case "$val" in
10913         $define) echo 'pthread_yield() found.' >&4      ;;
10914         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10915         esac
10916         ;;
10917 esac
10918 set d_pthread_yield
10919 eval $setvar
10920
10921 case "$sched_yield" in
10922 '') sched_yield=undef ;;
10923 esac
10924
10925 $rm -f try try.*
10926
10927 : see if this is a pwd.h system
10928 set pwd.h i_pwd
10929 eval $inhdr
10930
10931 case "$i_pwd" in
10932 $define)
10933         xxx=`./findhdr pwd.h`
10934         $cppstdin $cppflags $cppminus < $xxx >$$.h
10935
10936         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10937                 val="$define"
10938         else
10939                 val="$undef"
10940         fi
10941         set d_pwquota
10942         eval $setvar
10943
10944         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10945                 val="$define"
10946         else
10947                 val="$undef"
10948         fi
10949         set d_pwage
10950         eval $setvar
10951
10952         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10953                 val="$define"
10954         else
10955                 val="$undef"
10956         fi
10957         set d_pwchange
10958         eval $setvar
10959
10960         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10961                 val="$define"
10962         else
10963                 val="$undef"
10964         fi
10965         set d_pwclass
10966         eval $setvar
10967
10968         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10969                 val="$define"
10970         else
10971                 val="$undef"
10972         fi
10973         set d_pwexpire
10974         eval $setvar
10975
10976         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10977                 val="$define"
10978         else
10979                 val="$undef"
10980         fi
10981         set d_pwcomment
10982         eval $setvar
10983
10984         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10985                 val="$define"
10986         else
10987                 val="$undef"
10988         fi
10989         set d_pwgecos
10990         eval $setvar
10991
10992         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10993                 val="$define"
10994         else
10995                 val="$undef"
10996         fi
10997         set d_pwpasswd
10998         eval $setvar
10999
11000         $rm -f $$.h
11001         ;;
11002 *)
11003         val="$undef"; 
11004         set d_pwquota; eval $setvar
11005         set d_pwage; eval $setvar
11006         set d_pwchange; eval $setvar
11007         set d_pwclass; eval $setvar
11008         set d_pwexpire; eval $setvar
11009         set d_pwcomment; eval $setvar
11010         set d_pwgecos; eval $setvar
11011         set d_pwpasswd; eval $setvar
11012         ;;
11013 esac
11014
11015 : see if readdir and friends exist
11016 set readdir d_readdir
11017 eval $inlibc
11018 set seekdir d_seekdir
11019 eval $inlibc
11020 set telldir d_telldir
11021 eval $inlibc
11022 set rewinddir d_rewinddir
11023 eval $inlibc
11024
11025 : see if readlink exists
11026 set readlink d_readlink
11027 eval $inlibc
11028
11029 : see if readv exists
11030 set readv d_readv
11031 eval $inlibc
11032
11033 : see if recvmsg exists
11034 set recvmsg d_recvmsg
11035 eval $inlibc
11036
11037 : see if rename exists
11038 set rename d_rename
11039 eval $inlibc
11040
11041 : see if rmdir exists
11042 set rmdir d_rmdir
11043 eval $inlibc
11044
11045 : see if memory.h is available.
11046 val=''
11047 set memory.h val
11048 eval $inhdr
11049
11050 : See if it conflicts with string.h
11051 case "$val" in
11052 $define)
11053         case "$strings" in
11054         '') ;;
11055         *)
11056                 $cppstdin $cppflags $cppminus < $strings > mem.h
11057                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11058                         echo " "
11059                         echo "We won't be including <memory.h>."
11060                         val="$undef"
11061                 fi
11062                 $rm -f mem.h
11063                 ;;
11064         esac
11065 esac
11066 set i_memory
11067 eval $setvar
11068
11069 : can bcopy handle overlapping blocks?
11070 val="$undef"
11071 case "$d_bcopy" in
11072 "$define")
11073         echo " "
11074         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11075         $cat >try.c <<EOCP
11076 #$i_memory I_MEMORY
11077 #$i_stdlib I_STDLIB
11078 #$i_string I_STRING
11079 #$i_unistd I_UNISTD
11080 EOCP
11081         $cat >>try.c <<'EOCP'
11082 #include <stdio.h>
11083 #ifdef I_MEMORY
11084 #  include <memory.h>
11085 #endif
11086 #ifdef I_STDLIB
11087 #  include <stdlib.h>
11088 #endif
11089 #ifdef I_STRING
11090 #  include <string.h>
11091 #else
11092 #  include <strings.h>
11093 #endif
11094 #ifdef I_UNISTD
11095 #  include <unistd.h>  /* Needed for NetBSD */
11096 #endif
11097 int main()
11098 {
11099 char buf[128], abc[128];
11100 char *b;
11101 int len;
11102 int off;
11103 int align;
11104
11105 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11106
11107 for (align = 7; align >= 0; align--) {
11108         for (len = 36; len; len--) {
11109                 b = buf+align;
11110                 bcopy(abc, b, len);
11111                 for (off = 1; off <= len; off++) {
11112                         bcopy(b, b+off, len);
11113                         bcopy(b+off, b, len);
11114                         if (bcmp(b, abc, len))
11115                                 exit(1);
11116                 }
11117         }
11118 }
11119 exit(0);
11120 }
11121 EOCP
11122         set try
11123         if eval $compile_ok; then
11124                 if ./try 2>/dev/null; then
11125                         echo "Yes, it can."
11126                         val="$define"
11127                 else
11128                         echo "It can't, sorry."
11129                         case "$d_memmove" in
11130                         "$define") echo "But that's Ok since you have memmove()." ;;
11131                         esac
11132                 fi
11133         else
11134                 echo "(I can't compile the test program, so we'll assume not...)"
11135                 case "$d_memmove" in
11136                 "$define") echo "But that's Ok since you have memmove()." ;;
11137                 esac
11138         fi
11139         ;;
11140 esac
11141 $rm -f try.* try core
11142 set d_safebcpy
11143 eval $setvar
11144
11145 : can memcpy handle overlapping blocks?
11146 val="$undef"
11147 case "$d_memcpy" in
11148 "$define")
11149         echo " "
11150         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11151         $cat >try.c <<EOCP
11152 #$i_memory I_MEMORY
11153 #$i_stdlib I_STDLIB
11154 #$i_string I_STRING
11155 #$i_unistd I_UNISTD
11156 EOCP
11157         $cat >>try.c <<'EOCP'
11158 #include <stdio.h>
11159 #ifdef I_MEMORY
11160 #  include <memory.h>
11161 #endif
11162 #ifdef I_STDLIB
11163 #  include <stdlib.h>
11164 #endif
11165 #ifdef I_STRING
11166 #  include <string.h>
11167 #else
11168 #  include <strings.h>
11169 #endif
11170 #ifdef I_UNISTD
11171 #  include <unistd.h>  /* Needed for NetBSD */
11172 #endif
11173 int main()
11174 {
11175 char buf[128], abc[128];
11176 char *b;
11177 int len;
11178 int off;
11179 int align;
11180
11181 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11182    try to store the string in read-only memory. */
11183 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11184
11185 for (align = 7; align >= 0; align--) {
11186         for (len = 36; len; len--) {
11187                 b = buf+align;
11188                 memcpy(b, abc, len);
11189                 for (off = 1; off <= len; off++) {
11190                         memcpy(b+off, b, len);
11191                         memcpy(b, b+off, len);
11192                         if (memcmp(b, abc, len))
11193                                 exit(1);
11194                 }
11195         }
11196 }
11197 exit(0);
11198 }
11199 EOCP
11200         set try
11201         if eval $compile_ok; then
11202                 if ./try 2>/dev/null; then
11203                         echo "Yes, it can."
11204                         val="$define"
11205                 else
11206                         echo "It can't, sorry."
11207                         case "$d_memmove" in
11208                         "$define") echo "But that's Ok since you have memmove()." ;;
11209                         esac
11210                 fi
11211         else
11212                 echo "(I can't compile the test program, so we'll assume not...)"
11213                 case "$d_memmove" in
11214                 "$define") echo "But that's Ok since you have memmove()." ;;
11215                 esac
11216         fi
11217         ;;
11218 esac
11219 $rm -f try.* try core
11220 set d_safemcpy
11221 eval $setvar
11222
11223 : can memcmp be trusted to compare relative magnitude?
11224 val="$undef"
11225 case "$d_memcmp" in
11226 "$define")
11227         echo " "
11228         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11229         $cat >try.c <<EOCP
11230 #$i_memory I_MEMORY
11231 #$i_stdlib I_STDLIB
11232 #$i_string I_STRING
11233 #$i_unistd I_UNISTD
11234 EOCP
11235         $cat >>try.c <<'EOCP'
11236 #include <stdio.h>
11237 #ifdef I_MEMORY
11238 #  include <memory.h>
11239 #endif
11240 #ifdef I_STDLIB
11241 #  include <stdlib.h>
11242 #endif
11243 #ifdef I_STRING
11244 #  include <string.h>
11245 #else
11246 #  include <strings.h>
11247 #endif
11248 #ifdef I_UNISTD
11249 #  include <unistd.h>  /* Needed for NetBSD */
11250 #endif
11251 int main()
11252 {
11253 char a = -1;
11254 char b = 0;
11255 if ((a < b) && memcmp(&a, &b, 1) < 0)
11256         exit(1);
11257 exit(0);
11258 }
11259 EOCP
11260         set try
11261         if eval $compile_ok; then
11262                 if ./try 2>/dev/null; then
11263                         echo "Yes, it can."
11264                         val="$define"
11265                 else
11266                         echo "No, it can't (it uses signed chars)."
11267                 fi
11268         else
11269                 echo "(I can't compile the test program, so we'll assume not...)"
11270         fi
11271         ;;
11272 esac
11273 $rm -f try.* try core
11274 set d_sanemcmp
11275 eval $setvar
11276
11277 : see if prototype for sbrk is available
11278 echo " "
11279 set d_sbrkproto sbrk $i_unistd unistd.h
11280 eval $hasproto
11281
11282 : see if select exists
11283 set select d_select
11284 eval $inlibc
11285
11286 : see if semctl exists
11287 set semctl d_semctl
11288 eval $inlibc
11289
11290 : see if semget exists
11291 set semget d_semget
11292 eval $inlibc
11293
11294 : see if semop exists
11295 set semop d_semop
11296 eval $inlibc
11297
11298 : see how much of the 'sem*(2)' library is present.
11299 h_sem=true
11300 echo " "
11301 case "$d_semctl$d_semget$d_semop" in
11302 *"$undef"*) h_sem=false;;
11303 esac
11304 case "$osname" in
11305 freebsd)
11306     case "`ipcs 2>&1`" in
11307     "SVID messages"*"not configured"*)
11308         echo "Your $osname does not have the sem*(2) configured." >&4
11309         h_sem=false
11310         val="$undef"
11311         set semctl d_semctl
11312         eval $setvar
11313         set semget d_semget
11314         eval $setvar
11315         set semop d_semop
11316         eval $setvar
11317         ;;
11318     esac
11319     ;;
11320 esac
11321 : we could also check for sys/ipc.h ...
11322 if $h_sem && $test `./findhdr sys/sem.h`; then
11323         echo "You have the full sem*(2) library." >&4
11324         val="$define"
11325 else
11326         echo "You don't have the full sem*(2) library." >&4
11327         val="$undef"
11328 fi
11329 set d_sem
11330 eval $setvar
11331
11332 : see whether sys/sem.h defines union semun
11333 echo " "
11334 $cat > try.c <<'END'
11335 #include <sys/types.h>
11336 #include <sys/ipc.h>
11337 #include <sys/sem.h>
11338 int main () { union semun semun; semun.buf = 0; }
11339 END
11340 set try
11341 if eval $compile; then
11342     echo "You have union semun in <sys/sem.h>." >&4
11343     val="$define"
11344 else
11345     echo "You do not have union semun in <sys/sem.h>." >&4
11346     val="$undef"
11347 fi
11348 $rm -f try try.c try.h
11349 set d_union_semun
11350 eval $setvar
11351
11352 : see how to do semctl IPC_STAT
11353 case "$d_sem" in
11354 $define)
11355     : see whether semctl IPC_STAT can use union semun
11356     echo " "
11357     $cat > try.h <<END
11358 #ifndef S_IRUSR
11359 #   ifdef S_IREAD
11360 #       define S_IRUSR S_IREAD
11361 #       define S_IWUSR S_IWRITE
11362 #       define S_IXUSR S_IEXEC
11363 #   else
11364 #       define S_IRUSR 0400
11365 #       define S_IWUSR 0200
11366 #       define S_IXUSR 0100
11367 #   endif
11368 #   define S_IRGRP (S_IRUSR>>3)
11369 #   define S_IWGRP (S_IWUSR>>3)
11370 #   define S_IXGRP (S_IXUSR>>3)
11371 #   define S_IROTH (S_IRUSR>>6)
11372 #   define S_IWOTH (S_IWUSR>>6)
11373 #   define S_IXOTH (S_IXUSR>>6)
11374 #endif
11375 #ifndef S_IRWXU
11376 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11377 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11378 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11379 #endif
11380 END
11381
11382     $cat > try.c <<END
11383 #include <sys/types.h>
11384 #include <sys/ipc.h>
11385 #include <sys/sem.h>
11386 #include <sys/stat.h>
11387 #include <stdio.h>
11388 #include <errno.h>
11389 #include "try.h"
11390 #ifndef errno
11391 extern int errno;
11392 #endif
11393 #$d_union_semun HAS_UNION_SEMUN
11394 int main() {
11395     union semun
11396 #ifndef HAS_UNION_SEMUN
11397     {
11398         int val;
11399         struct semid_ds *buf;
11400         unsigned short *array;
11401     }
11402 #endif
11403     arg;
11404     int sem, st;
11405
11406 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11407     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11408     if (sem > -1) {
11409         struct semid_ds argbuf;
11410         arg.buf = &argbuf;
11411 #       ifdef IPC_STAT
11412         st = semctl(sem, 0, IPC_STAT, arg);
11413         if (st == 0)
11414             printf("semun\n");
11415         else
11416 #       endif /* IPC_STAT */
11417             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11418 #       ifdef IPC_RMID
11419         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11420 #       endif /* IPC_RMID */
11421             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11422     } else
11423 #endif /* IPC_PRIVATE && ... */
11424         printf("semget failed: errno = %d\n", errno);
11425   return 0;
11426 }
11427 END
11428     val="$undef"
11429     set try
11430     if eval $compile; then
11431         xxx=`./try`
11432         case "$xxx" in
11433         semun) val="$define" ;;
11434         esac
11435     fi
11436     $rm -f try try.c
11437     set d_semctl_semun
11438     eval $setvar
11439     case "$d_semctl_semun" in
11440     $define)
11441         echo "You can use union semun for semctl IPC_STAT." >&4
11442         also='also'
11443         ;;
11444     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11445         also=''
11446         ;;
11447     esac
11448
11449     : see whether semctl IPC_STAT can use struct semid_ds pointer
11450     $cat > try.c <<'END'
11451 #include <sys/types.h>
11452 #include <sys/ipc.h>
11453 #include <sys/sem.h>
11454 #include <sys/stat.h>
11455 #include "try.h"
11456 #include <stdio.h>
11457 #include <errno.h>
11458 #ifndef errno
11459 extern int errno;
11460 #endif
11461 int main() {
11462     struct semid_ds arg;
11463     int sem, st;
11464
11465 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11466     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11467     if (sem > -1) {
11468 #       ifdef IPC_STAT
11469         st = semctl(sem, 0, IPC_STAT, &arg);
11470         if (st == 0)
11471             printf("semid_ds\n");
11472         else
11473 #       endif /* IPC_STAT */
11474             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11475 #       ifdef IPC_RMID
11476         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11477 #       endif /* IPC_RMID */
11478             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11479     } else
11480 #endif /* IPC_PRIVATE && ... */
11481         printf("semget failed: errno = %d\n", errno);
11482
11483     return 0;
11484 }
11485 END
11486     val="$undef"
11487     set try
11488     if eval $compile; then
11489         xxx=`./try`
11490         case "$xxx" in
11491         semid_ds) val="$define" ;;
11492         esac
11493     fi
11494     $rm -f try try.c
11495     set d_semctl_semid_ds
11496     eval $setvar
11497     case "$d_semctl_semid_ds" in
11498     $define)
11499         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11500         ;;
11501     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11502         ;;
11503     esac
11504     $rm -f try.h
11505     ;;
11506 *)  val="$undef"
11507
11508     # We do not have the full sem*(2) library, so assume we can not
11509     # use either.
11510
11511     set d_semctl_semun
11512     eval $setvar
11513
11514     set d_semctl_semid_ds
11515     eval $setvar
11516     ;;
11517 esac
11518
11519 : see if sendmsg exists
11520 set sendmsg d_sendmsg
11521 eval $inlibc
11522
11523 : see if setegid exists
11524 set setegid d_setegid
11525 eval $inlibc
11526
11527 : see if seteuid exists
11528 set seteuid d_seteuid
11529 eval $inlibc
11530
11531 : see if setgrent exists
11532 set setgrent d_setgrent
11533 eval $inlibc
11534
11535 : see if sethostent exists
11536 set sethostent d_sethent
11537 eval $inlibc
11538
11539 : see if setitimer exists
11540 set setitimer d_setitimer
11541 eval $inlibc
11542
11543 : see if setlinebuf exists
11544 set setlinebuf d_setlinebuf
11545 eval $inlibc
11546
11547 : see if setlocale exists
11548 set setlocale d_setlocale
11549 eval $inlibc
11550
11551 : see if setnetent exists
11552 set setnetent d_setnent
11553 eval $inlibc
11554
11555 : see if setprotoent exists
11556 set setprotoent d_setpent
11557 eval $inlibc
11558
11559 : see if setpgid exists
11560 set setpgid d_setpgid
11561 eval $inlibc
11562
11563 : see if setpgrp2 exists
11564 set setpgrp2 d_setpgrp2
11565 eval $inlibc
11566
11567 : see if setpriority exists
11568 set setpriority d_setprior
11569 eval $inlibc
11570
11571 : see if setproctitle exists
11572 set setproctitle d_setproctitle
11573 eval $inlibc
11574
11575 : see if setpwent exists
11576 set setpwent d_setpwent
11577 eval $inlibc
11578
11579 : see if setregid exists
11580 set setregid d_setregid
11581 eval $inlibc
11582 set setresgid d_setresgid
11583 eval $inlibc
11584
11585 : see if setreuid exists
11586 set setreuid d_setreuid
11587 eval $inlibc
11588 set setresuid d_setresuid
11589 eval $inlibc
11590
11591 : see if setrgid exists
11592 set setrgid d_setrgid
11593 eval $inlibc
11594
11595 : see if setruid exists
11596 set setruid d_setruid
11597 eval $inlibc
11598
11599 : see if setservent exists
11600 set setservent d_setsent
11601 eval $inlibc
11602
11603 : see if setsid exists
11604 set setsid d_setsid
11605 eval $inlibc
11606
11607 : see if setvbuf exists
11608 set setvbuf d_setvbuf
11609 eval $inlibc
11610
11611 : see if sfio.h is available
11612 set sfio.h i_sfio
11613 eval $inhdr
11614
11615
11616 : see if sfio library is available
11617 case "$i_sfio" in
11618 $define)
11619         val=''
11620         set sfreserve val
11621         eval $inlibc
11622         ;;
11623 *)
11624         val="$undef"
11625         ;;
11626 esac
11627 : Ok, but do we want to use it.
11628 case "$val" in
11629 $define)
11630         case "$usesfio" in
11631         true|$define|[yY]*) dflt='y';;
11632         *) dflt='n';;
11633         esac
11634         echo "$package can use the sfio library, but it is experimental."
11635         case "$useperlio" in
11636         "$undef")
11637             echo "For sfio also the PerlIO abstraction layer is needed."
11638             echo "Earlier you said you wouldn't want that."
11639             ;;
11640         esac
11641         rp="You seem to have sfio available, do you want to try using it?"
11642         . ./myread
11643         case "$ans" in
11644         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11645                 useperlio="$define"
11646                 val="$define"
11647                 ;;
11648         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11649                 val="$undef"
11650                 ;;
11651         esac
11652         ;;
11653 *)      case "$usesfio" in
11654         true|$define|[yY]*)
11655                 echo "Sorry, cannot find sfio on this machine." >&4
11656                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11657                 val="$undef"
11658                 ;;
11659         esac
11660         ;;
11661 esac
11662 set d_sfio
11663 eval $setvar
11664 case "$d_sfio" in
11665 $define) usesfio='true';;
11666 *) usesfio='false';;
11667 esac
11668 case "$d_sfio" in
11669 $define) ;;
11670 *)      : Remove sfio from list of libraries to use
11671         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11672         shift
11673         libs="$*"
11674         echo "libs = $libs" >&4
11675 ;;
11676 esac
11677
11678
11679 : see if shmctl exists
11680 set shmctl d_shmctl
11681 eval $inlibc
11682
11683 : see if shmget exists
11684 set shmget d_shmget
11685 eval $inlibc
11686
11687 : see if shmat exists
11688 set shmat d_shmat
11689 eval $inlibc
11690 : see what shmat returns
11691 case "$d_shmat" in
11692 "$define")
11693         $cat >shmat.c <<'END'
11694 #include <sys/shm.h>
11695 void *shmat();
11696 END
11697         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11698                 shmattype='void *'
11699         else
11700                 shmattype='char *'
11701         fi
11702         echo "and it returns ($shmattype)." >&4
11703         : see if a prototype for shmat is available
11704         xxx=`./findhdr sys/shm.h`
11705         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11706         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11707                 val="$define"
11708         else
11709                 val="$undef"
11710         fi
11711         $rm -f shmat.[co]
11712         ;;
11713 *)
11714         val="$undef"
11715         ;;
11716 esac
11717 set d_shmatprototype
11718 eval $setvar
11719
11720 : see if shmdt exists
11721 set shmdt d_shmdt
11722 eval $inlibc
11723
11724 : see how much of the 'shm*(2)' library is present.
11725 h_shm=true
11726 echo " "
11727 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11728 *"$undef"*) h_shm=false;;
11729 esac
11730 case "$osname" in
11731 freebsd)
11732     case "`ipcs 2>&1`" in
11733     "SVID shared memory"*"not configured"*)
11734         echo "Your $osname does not have the shm*(2) configured." >&4
11735         h_shm=false
11736         val="$undef"
11737         set shmctl d_shmctl
11738         evat $setvar
11739         set shmget d_shmget
11740         evat $setvar
11741         set shmat d_shmat
11742         evat $setvar
11743         set shmdt d_shmdt
11744         evat $setvar
11745         ;;
11746     esac
11747     ;;
11748 esac
11749 : we could also check for sys/ipc.h ...
11750 if $h_shm && $test `./findhdr sys/shm.h`; then
11751         echo "You have the full shm*(2) library." >&4
11752         val="$define"
11753 else
11754         echo "You don't have the full shm*(2) library." >&4
11755         val="$undef"
11756 fi
11757 set d_shm
11758 eval $setvar
11759
11760 echo " "
11761 : see if we have sigaction
11762 if set sigaction val -f d_sigaction; eval $csym; $val; then
11763         echo 'sigaction() found.' >&4
11764         $cat > try.c <<'EOP'
11765 #include <stdio.h>
11766 #include <sys/types.h>
11767 #include <signal.h>
11768 int main()
11769 {
11770     struct sigaction act, oact;
11771     act.sa_flags = 0;
11772     oact.sa_handler = 0;
11773     /* so that act and oact are used */
11774     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11775 }
11776 EOP
11777         set try
11778         if eval $compile_ok; then
11779                 val="$define"
11780         else
11781                 echo "But you don't seem to have a useable struct sigaction." >&4
11782                 val="$undef"
11783         fi
11784 else
11785         echo 'sigaction NOT found.' >&4
11786         val="$undef"
11787 fi
11788 set d_sigaction; eval $setvar
11789 $rm -f try try$_o try.c
11790
11791 : see if sigprocmask exists
11792 set sigprocmask d_sigprocmask
11793 eval $inlibc
11794
11795 : see if sigsetjmp exists
11796 echo " "
11797 case "$d_sigsetjmp" in
11798 '')
11799         $cat >try.c <<'EOP'
11800 #include <setjmp.h>
11801 sigjmp_buf env;
11802 int set = 1;
11803 int main()
11804 {
11805         if (sigsetjmp(env,1))
11806                 exit(set);
11807         set = 0;
11808         siglongjmp(env, 1);
11809         exit(1);
11810 }
11811 EOP
11812         set try
11813         if eval $compile; then
11814                 if ./try >/dev/null 2>&1; then
11815                         echo "POSIX sigsetjmp found." >&4
11816                         val="$define"
11817                 else
11818                         $cat >&4 <<EOM
11819 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11820 I'll ignore them.
11821 EOM
11822                         val="$undef"
11823                 fi
11824         else
11825                 echo "sigsetjmp not found." >&4
11826                 val="$undef"
11827         fi
11828         ;;
11829 *) val="$d_sigsetjmp"
11830         case "$d_sigsetjmp" in
11831         $define) echo "POSIX sigsetjmp found." >&4;;
11832         $undef) echo "sigsetjmp not found." >&4;;
11833         esac
11834         ;;
11835 esac
11836 set d_sigsetjmp
11837 eval $setvar
11838 $rm -f try.c try
11839
11840 : see if sockatmark exists
11841 set sockatmark d_sockatmark
11842 eval $inlibc
11843
11844 : see if socks5_init exists
11845 set socks5_init d_socks5_init
11846 eval $inlibc
11847
11848 : see if sys/stat.h is available
11849 set sys/stat.h i_sysstat
11850 eval $inhdr
11851
11852
11853 : see if stat knows about block sizes
11854 echo " "
11855 echo "Checking to see if your struct stat has st_blocks field..." >&4
11856 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11857 eval $hasfield
11858
11859
11860 : see if this is a sys/vfs.h system
11861 set sys/vfs.h i_sysvfs
11862 eval $inhdr
11863
11864
11865 : see if this is a sys/statfs.h system
11866 set sys/statfs.h i_sysstatfs
11867 eval $inhdr
11868
11869
11870 echo " "
11871 echo "Checking to see if your system supports struct statfs..." >&4
11872 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
11873 eval $hasstruct
11874 case "$d_statfs_s" in
11875 "$define")      echo "Yes, it does."   ;;
11876 *)              echo "No, it doesn't." ;;
11877 esac
11878
11879
11880
11881 : see if struct statfs knows about f_flags
11882 case "$d_statfs_s" in
11883 define) 
11884         echo " "
11885         echo "Checking to see if your struct statfs has f_flags field..." >&4
11886         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
11887         eval $hasfield
11888         ;;
11889 *)      val="$undef"
11890         set d_statfs_f_flags
11891         eval $setvar
11892         ;;
11893 esac
11894 case "$d_statfs_f_flags" in
11895 "$define")      echo "Yes, it does."   ;;
11896 *)              echo "No, it doesn't." ;;
11897 esac
11898
11899 : see if _ptr and _cnt from stdio act std
11900 echo " "
11901
11902 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11903         echo "(Looks like you have stdio.h from BSD.)"
11904         case "$stdio_ptr" in
11905         '') stdio_ptr='((fp)->_p)'
11906                 ptr_lval=$define
11907                 ;;
11908         *)      ptr_lval=$d_stdio_ptr_lval;;
11909         esac
11910         case "$stdio_cnt" in
11911         '') stdio_cnt='((fp)->_r)'
11912                 cnt_lval=$define
11913                 ;;
11914         *)      cnt_lval=$d_stdio_cnt_lval;;
11915         esac
11916         case "$stdio_base" in
11917         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11918         esac
11919         case "$stdio_bufsiz" in
11920         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11921         esac
11922 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11923         echo "(Looks like you have stdio.h from Linux.)"
11924         case "$stdio_ptr" in
11925         '') stdio_ptr='((fp)->_IO_read_ptr)'
11926                 ptr_lval=$define
11927                 ;;
11928         *)      ptr_lval=$d_stdio_ptr_lval;;
11929         esac
11930         case "$stdio_cnt" in
11931         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11932                 cnt_lval=$undef
11933                 ;;
11934         *)      cnt_lval=$d_stdio_cnt_lval;;
11935         esac
11936         case "$stdio_base" in
11937         '') stdio_base='((fp)->_IO_read_base)';;
11938         esac
11939         case "$stdio_bufsiz" in
11940         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11941         esac
11942 else
11943         case "$stdio_ptr" in
11944         '') stdio_ptr='((fp)->_ptr)'
11945                 ptr_lval=$define
11946                 ;;
11947         *)      ptr_lval=$d_stdio_ptr_lval;;
11948         esac
11949         case "$stdio_cnt" in
11950         '') stdio_cnt='((fp)->_cnt)'
11951                 cnt_lval=$define
11952                 ;;
11953         *)      cnt_lval=$d_stdio_cnt_lval;;
11954         esac
11955         case "$stdio_base" in
11956         '') stdio_base='((fp)->_base)';;
11957         esac
11958         case "$stdio_bufsiz" in
11959         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11960         esac
11961 fi
11962
11963 : test whether _ptr and _cnt really work
11964 echo "Checking how std your stdio is..." >&4
11965 $cat >try.c <<EOP
11966 #include <stdio.h>
11967 #define FILE_ptr(fp)    $stdio_ptr
11968 #define FILE_cnt(fp)    $stdio_cnt
11969 int main() {
11970         FILE *fp = fopen("try.c", "r");
11971         char c = getc(fp);
11972         if (
11973                 18 <= FILE_cnt(fp) &&
11974                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11975         )
11976                 exit(0);
11977         exit(1);
11978 }
11979 EOP
11980 val="$undef"
11981 set try
11982 if eval $compile; then
11983         if ./try; then
11984                 echo "Your stdio acts pretty std."
11985                 val="$define"
11986         else
11987                 echo "Your stdio isn't very std."
11988         fi
11989 else
11990         echo "Your stdio doesn't appear very std."
11991 fi
11992 $rm -f try.c try
11993 set d_stdstdio
11994 eval $setvar
11995
11996 : Can _ptr be used as an lvalue?
11997 case "$d_stdstdio$ptr_lval" in
11998 $define$define) val=$define ;;
11999 *) val=$undef ;;
12000 esac
12001 set d_stdio_ptr_lval
12002 eval $setvar
12003
12004 : Can _cnt be used as an lvalue?
12005 case "$d_stdstdio$cnt_lval" in
12006 $define$define) val=$define ;;
12007 *) val=$undef ;;
12008 esac
12009 set d_stdio_cnt_lval
12010 eval $setvar
12011
12012
12013 : test whether setting _ptr sets _cnt as a side effect
12014 d_stdio_ptr_lval_sets_cnt="$undef"
12015 d_stdio_ptr_lval_nochange_cnt="$undef"
12016 case "$d_stdio_ptr_lval$d_stdstdio" in
12017 $define$define)
12018         echo "Checking to see what happens if we set the stdio ptr..." >&4
12019 $cat >try.c <<EOP
12020 #include <stdio.h>
12021 /* Can we scream? */
12022 /* Eat dust sed :-) */
12023 /* In the buffer space, no one can hear you scream. */
12024 #define FILE_ptr(fp)    $stdio_ptr
12025 #define FILE_cnt(fp)    $stdio_cnt
12026 #include <sys/types.h>
12027 int main() {
12028         FILE *fp = fopen("try.c", "r");
12029         int c;
12030         char *ptr;
12031         size_t cnt;
12032         if (!fp) {
12033             puts("Fail even to read");
12034             exit(1);
12035         }
12036         c = getc(fp); /* Read away the first # */
12037         if (c == EOF) {
12038             puts("Fail even to read");
12039             exit(1);
12040         }
12041         if (!(
12042                 18 <= FILE_cnt(fp) &&
12043                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12044         )) {
12045                 puts("Fail even to read");
12046                 exit (1);
12047         }
12048         ptr = (char*) FILE_ptr(fp);
12049         cnt = (size_t)FILE_cnt(fp);
12050
12051         FILE_ptr(fp) += 42;
12052
12053         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12054                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12055                 exit (1);
12056         }
12057         if (FILE_cnt(fp) <= 20) {
12058                 printf ("Fail (<20 chars to test)");
12059                 exit (1);
12060         }
12061         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12062                 puts("Fail compare");
12063                 exit (1);
12064         }
12065         if (cnt == FILE_cnt(fp)) {
12066                 puts("Pass_unchanged");
12067                 exit (0);
12068         }       
12069         if (FILE_cnt(fp) == (cnt - 42)) {
12070                 puts("Pass_changed");
12071                 exit (0);
12072         }
12073         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12074         return 1;
12075
12076 }
12077 EOP
12078         set try
12079         if eval $compile; then
12080                 case `./try$exe_ext` in
12081                 Pass_changed)
12082                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12083                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12084                 Pass_unchanged)
12085                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12086                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12087                 Fail*)
12088                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12089                 *)
12090                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12091         esac
12092         else
12093                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12094         fi
12095         $rm -f try.c try
12096         ;;
12097 esac
12098
12099 : see if _base is also standard
12100 val="$undef"
12101 case "$d_stdstdio" in
12102 $define)
12103         $cat >try.c <<EOP
12104 #include <stdio.h>
12105 #define FILE_base(fp)   $stdio_base
12106 #define FILE_bufsiz(fp) $stdio_bufsiz
12107 int main() {
12108         FILE *fp = fopen("try.c", "r");
12109         char c = getc(fp);
12110         if (
12111                 19 <= FILE_bufsiz(fp) &&
12112                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12113         )
12114                 exit(0);
12115         exit(1);
12116 }
12117 EOP
12118         set try
12119         if eval $compile; then
12120                 if ./try; then
12121                         echo "And its _base field acts std."
12122                         val="$define"
12123                 else
12124                         echo "But its _base field isn't std."
12125                 fi
12126         else
12127                 echo "However, it seems to be lacking the _base field."
12128         fi
12129         $rm -f try.c try
12130         ;;
12131 esac
12132 set d_stdiobase
12133 eval $setvar
12134
12135 $cat >&4 <<EOM
12136 Checking how to access stdio streams by file descriptor number...
12137 EOM
12138 case "$stdio_stream_array" in
12139 '')     $cat >try.c <<EOCP
12140 #include <stdio.h>
12141 int main() {
12142   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12143     printf("yes\n");
12144 }
12145 EOCP
12146         for s in _iob __iob __sF
12147         do
12148                 set try -DSTDIO_STREAM_ARRAY=$s
12149                 if eval $compile; then
12150                         case "`./try$exe_ext`" in
12151                         yes)    stdio_stream_array=$s; break ;;
12152                         esac
12153                 fi
12154         done
12155         $rm -f try.* try$exe_ext
12156 esac
12157 case "$stdio_stream_array" in
12158 '')     $cat >&4 <<EOM
12159 I can't figure out how to access stdio streams by file descriptor number.
12160 EOM
12161         d_stdio_stream_array="$undef"
12162         ;;
12163 *)      $cat >&4 <<EOM
12164 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12165 EOM
12166         d_stdio_stream_array="$define"
12167         ;;
12168 esac
12169
12170 : see if strcoll exists
12171 set strcoll d_strcoll
12172 eval $inlibc
12173
12174 : check for structure copying
12175 echo " "
12176 echo "Checking to see if your C compiler can copy structs..." >&4
12177 $cat >try.c <<'EOCP'
12178 int main()
12179 {
12180         struct blurfl {
12181                 int dyick;
12182         } foo, bar;
12183
12184         foo = bar;
12185 }
12186 EOCP
12187 if $cc -c try.c >/dev/null 2>&1 ; then
12188         val="$define"
12189         echo "Yup, it can."
12190 else
12191         val="$undef"
12192         echo "Nope, it can't."
12193 fi
12194 set d_strctcpy
12195 eval $setvar
12196 $rm -f try.*
12197
12198 : see if strerror and/or sys_errlist[] exist
12199 echo " "
12200 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12201     if set strerror val -f d_strerror; eval $csym; $val; then
12202                 echo 'strerror() found.' >&4
12203                 d_strerror="$define"
12204                 d_strerrm='strerror(e)'
12205                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12206                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12207                         d_syserrlst="$define"
12208                 else
12209                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12210                         d_syserrlst="$undef"
12211                 fi
12212     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12213                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12214                 echo 'strerror() found in string header.' >&4
12215                 d_strerror="$define"
12216                 d_strerrm='strerror(e)'
12217                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12218                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12219                                 d_syserrlst="$define"
12220                 else
12221                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12222                         d_syserrlst="$undef"
12223                 fi
12224     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12225                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12226                 d_strerror="$undef"
12227                 d_syserrlst="$define"
12228                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12229     else
12230                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12231                 d_strerror="$undef"
12232                 d_syserrlst="$undef"
12233                 d_strerrm='"unknown"'
12234     fi
12235 fi
12236
12237 : see if strftime exists
12238 set strftime d_strftime
12239 eval $inlibc
12240
12241 : see if strtod exists
12242 set strtod d_strtod
12243 eval $inlibc
12244
12245 : see if strtol exists
12246 set strtol d_strtol
12247 eval $inlibc
12248
12249 : see if strtold exists
12250 set strtold d_strtold
12251 eval $inlibc
12252
12253 : see if strtoll exists
12254 set strtoll d_strtoll
12255 eval $inlibc
12256
12257 case "$d_longlong-$d_strtoll" in
12258 "$define-$define")
12259         $cat <<EOM
12260 Checking whether your strtoll() works okay...
12261 EOM
12262         $cat >try.c <<'EOCP'
12263 #include <errno.h>
12264 #ifdef __hpux
12265 #define strtoll __strtoll
12266 #endif
12267 #ifdef __EMX__
12268 #define strtoll _strtoll
12269 #endif
12270 #include <stdio.h>
12271 extern long long int strtoll(char *s, char **, int); 
12272 static int bad = 0;
12273 int check(char *s, long long ell, int een) {
12274         long long gll;
12275         errno = 0;
12276         gll = strtoll(s, 0, 10);
12277         if (!((gll == ell) && (errno == een)))
12278                 bad++;
12279 }
12280 int main() {
12281         check(" 1",                                      1LL, 0);
12282         check(" 0",                                      0LL, 0);
12283         check("-1",                                     -1LL, 0);
12284         check("-9223372036854775808", -9223372036854775808LL, 0);
12285         check("-9223372036854775808", -9223372036854775808LL, 0);
12286         check(" 9223372036854775807",  9223372036854775807LL, 0);
12287         check("-9223372036854775808", -9223372036854775808LL, 0);
12288         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12289         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12290         if (!bad)
12291                 printf("ok\n");
12292 }
12293 EOCP
12294         set try
12295         if eval $compile; then
12296                 yyy=`./try`
12297                 case "$yyy" in
12298                 ok) echo "Your strtoll() seems to be working okay." ;;
12299                 *) cat <<EOM >&4
12300 Your strtoll() doesn't seem to be working okay.
12301 EOM
12302                    d_strtoll="$undef"
12303                    ;;
12304                 esac
12305         else
12306                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12307                 d_strtoll="$undef"
12308         fi
12309         ;;
12310 esac
12311
12312 : see if strtoq exists
12313 set strtoq d_strtoq
12314 eval $inlibc
12315
12316 : see if strtoul exists
12317 set strtoul d_strtoul
12318 eval $inlibc
12319
12320 case "$d_strtoul" in
12321 "$define")
12322         $cat <<EOM
12323 Checking whether your strtoul() works okay...
12324 EOM
12325         $cat >try.c <<'EOCP'
12326 #include <errno.h>
12327 #include <stdio.h>
12328 extern unsigned long int strtoul(char *s, char **, int); 
12329 static int bad = 0;
12330 void check(char *s, unsigned long eul, int een) {
12331         unsigned long gul;
12332         errno = 0;
12333         gul = strtoul(s, 0, 10);
12334         if (!((gul == eul) && (errno == een)))
12335                 bad++;
12336 }
12337 int main() {
12338         check(" 1", 1L, 0);
12339         check(" 0", 0L, 0);
12340 EOCP
12341         case "$longsize" in
12342         8)
12343             $cat >>try.c <<'EOCP'
12344         check("18446744073709551615", 18446744073709551615UL, 0);
12345         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12346 #if 0 /* strtoul() for /^-/ strings is undefined. */
12347         check("-1", 18446744073709551615UL, 0);
12348         check("-18446744073709551614", 2, 0);
12349         check("-18446744073709551615", 1, 0);
12350         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12351         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12352 #endif
12353 EOCP
12354                 ;;
12355         4)
12356                     $cat >>try.c <<'EOCP'
12357         check("4294967295", 4294967295UL, 0);
12358         check("4294967296", 4294967295UL, ERANGE);
12359 #if 0 /* strtoul() for /^-/ strings is undefined. */
12360         check("-1", 4294967295UL, 0);
12361         check("-4294967294", 2, 0);
12362         check("-4294967295", 1, 0);
12363         check("-4294967296", 4294967295UL, ERANGE);
12364         check("-4294967297", 4294967295UL, ERANGE);
12365 #endif
12366 EOCP
12367                 ;;
12368         *)
12369 : Should we write these tests to be more portable by sprintf-ing
12370 : ~0 and then manipulating that char string as input for strtol?
12371                 ;;
12372         esac
12373         $cat >>try.c <<'EOCP'
12374         if (!bad)
12375                 printf("ok\n");
12376         return 0;
12377 }
12378 EOCP
12379         set try
12380         if eval $compile; then
12381                 case "`./try`" in
12382                 ok) echo "Your strtoul() seems to be working okay." ;;
12383                 *) cat <<EOM >&4
12384 Your strtoul() doesn't seem to be working okay.
12385 EOM
12386                    d_strtoul="$undef"
12387                    ;;
12388                 esac
12389         fi
12390         ;;
12391 esac
12392
12393 : see if strtoull exists
12394 set strtoull d_strtoull
12395 eval $inlibc
12396
12397 case "$d_longlong-$d_strtoull" in
12398 "$define-$define")
12399         $cat <<EOM
12400 Checking whether your strtoull() works okay...
12401 EOM
12402         $cat >try.c <<'EOCP'
12403 #include <errno.h>
12404 #ifdef __hpux
12405 #define strtoull __strtoull
12406 #endif
12407 #include <stdio.h>
12408 extern unsigned long long int strtoull(char *s, char **, int); 
12409 static int bad = 0;
12410 int check(char *s, long long eull, int een) {
12411         long long gull;
12412         errno = 0;
12413         gull = strtoull(s, 0, 10);
12414         if (!((gull == eull) && (errno == een)))
12415                 bad++;
12416 }
12417 int main() {
12418         check(" 1",                                        1LL, 0);
12419         check(" 0",                                        0LL, 0);
12420         check("18446744073709551615",  18446744073709551615ULL, 0);
12421         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12422 #if 0 /* strtoull() for /^-/ strings is undefined. */
12423         check("-1",                    18446744073709551615ULL, 0);
12424         check("-18446744073709551614",                     2LL, 0);
12425         check("-18446744073709551615",                     1LL, 0);
12426         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12427         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12428 #endif
12429         if (!bad)
12430                 printf("ok\n");
12431 }
12432 EOCP
12433         set try
12434         if eval $compile; then
12435                 case "`./try`" in
12436                 ok) echo "Your strtoull() seems to be working okay." ;;
12437                 *) cat <<EOM >&4
12438 Your strtoull() doesn't seem to be working okay.
12439 EOM
12440                    d_strtoull="$undef"
12441                    ;;
12442                 esac
12443         fi
12444         ;;
12445 esac
12446
12447 : see if strtouq exists
12448 set strtouq d_strtouq
12449 eval $inlibc
12450
12451 case "$d_strtouq" in
12452 "$define")
12453         $cat <<EOM
12454 Checking whether your strtouq() works okay...
12455 EOM
12456         $cat >try.c <<'EOCP'
12457 #include <errno.h>
12458 #include <stdio.h>
12459 extern unsigned long long int strtouq(char *s, char **, int); 
12460 static int bad = 0;
12461 void check(char *s, unsigned long long eull, int een) {
12462         unsigned long long gull;
12463         errno = 0;
12464         gull = strtouq(s, 0, 10);
12465         if (!((gull == eull) && (errno == een)))
12466                 bad++;
12467 }
12468 int main() {
12469         check(" 1",                                        1LL, 0);
12470         check(" 0",                                        0LL, 0);
12471         check("18446744073709551615",  18446744073709551615ULL, 0);
12472         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12473 #if 0 /* strtouq() for /^-/ strings is undefined. */
12474         check("-1",                    18446744073709551615ULL, 0);
12475         check("-18446744073709551614",                     2LL, 0);
12476         check("-18446744073709551615",                     1LL, 0);
12477         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12478         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12479 #endif
12480         if (!bad)
12481                 printf("ok\n");
12482         return 0;
12483 }
12484 EOCP
12485         set try
12486         if eval $compile; then
12487                 case "`./try`" in
12488                 ok) echo "Your strtouq() seems to be working okay." ;;
12489                 *) cat <<EOM >&4
12490 Your strtouq() doesn't seem to be working okay.
12491 EOM
12492                    d_strtouq="$undef"
12493                    ;;
12494                 esac
12495         fi
12496         ;;
12497 esac
12498
12499 : see if strxfrm exists
12500 set strxfrm d_strxfrm
12501 eval $inlibc
12502
12503 : see if symlink exists
12504 set symlink d_symlink
12505 eval $inlibc
12506
12507 : see if syscall exists
12508 set syscall d_syscall
12509 eval $inlibc
12510
12511 : see if sysconf exists
12512 set sysconf d_sysconf
12513 eval $inlibc
12514
12515 : see if system exists
12516 set system d_system
12517 eval $inlibc
12518
12519 : see if tcgetpgrp exists
12520 set tcgetpgrp d_tcgetpgrp
12521 eval $inlibc
12522
12523 : see if tcsetpgrp exists
12524 set tcsetpgrp d_tcsetpgrp
12525 eval $inlibc
12526
12527 : see if prototype for telldir is available
12528 echo " "
12529 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12530 eval $hasproto
12531
12532 : see if this is a sys/times.h system
12533 set sys/times.h i_systimes
12534 eval $inhdr
12535
12536 : see if times exists
12537 echo " "
12538 if set times val -f d_times; eval $csym; $val; then
12539         echo 'times() found.' >&4
12540         d_times="$define"
12541         inc=''
12542         case "$i_systimes" in
12543         "$define") inc='sys/times.h';;
12544         esac
12545         rp="What is the type returned by times() on this system?"
12546         set clock_t clocktype long stdio.h sys/types.h $inc
12547         eval $typedef_ask
12548 else
12549         echo 'times() NOT found, hope that will do.' >&4
12550         d_times="$undef"
12551         clocktype='int'
12552 fi
12553
12554 : see if truncate exists
12555 set truncate d_truncate
12556 eval $inlibc
12557
12558 : see if tzname[] exists
12559 echo " "
12560 if set tzname val -a d_tzname; eval $csym; $val; then
12561         val="$define"
12562         echo 'tzname[] found.' >&4
12563 else
12564         val="$undef"
12565         echo 'tzname[] NOT found.' >&4
12566 fi
12567 set d_tzname
12568 eval $setvar
12569
12570 case "$crosscompile" in
12571 ''|[nN]*) crosscompile="$undef" ;;
12572 esac
12573
12574 case "$osname" in
12575 next|rhapsody|darwin) multiarch="$define" ;;
12576 esac
12577 case "$multiarch" in
12578 ''|[nN]*) multiarch="$undef" ;;
12579 esac
12580
12581 : check for ordering of bytes in a long
12582 echo " "
12583 case "$crosscompile$multiarch" in
12584 *$define*)
12585         $cat <<EOM
12586 You seem to be either cross-compiling or doing a multiarchitecture build,
12587 skipping the byteorder check.
12588
12589 EOM
12590         byteorder='0xffff'
12591         ;;
12592 *)
12593         case "$byteorder" in
12594         '')
12595                 $cat <<'EOM'
12596 In the following, larger digits indicate more significance.  A big-endian
12597 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12598 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12599 machines may have weird orders like 3412.  A Cray will report 87654321,
12600 an Alpha will report 12345678. If the test program works the default is
12601 probably right.
12602 I'm now running the test program...
12603 EOM
12604                 $cat >try.c <<'EOCP'
12605 #include <stdio.h>
12606 int main()
12607 {
12608         int i;
12609         union {
12610                 unsigned long l;
12611                 char c[sizeof(long)];
12612         } u;
12613
12614         if (sizeof(long) > 4)
12615                 u.l = (0x08070605L << 32) | 0x04030201L;
12616         else
12617                 u.l = 0x04030201L;
12618         for (i = 0; i < sizeof(long); i++)
12619                 printf("%c", u.c[i]+'0');
12620         printf("\n");
12621         exit(0);
12622 }
12623 EOCP
12624                 xxx_prompt=y
12625                 set try
12626                 if eval $compile && ./try > /dev/null; then
12627                         dflt=`./try`
12628                         case "$dflt" in
12629                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12630                                 echo "(The test program ran ok.)"
12631                                 echo "byteorder=$dflt"
12632                                 xxx_prompt=n
12633                         ;;
12634                         ????|????????) echo "(The test program ran ok.)" ;;
12635                         *) echo "(The test program didn't run right for some reason.)" ;;
12636                         esac
12637                 else
12638                         dflt='4321'
12639                         cat <<'EOM'
12640 (I can't seem to compile the test program.  Guessing big-endian...)
12641 EOM
12642                 fi
12643                 case "$xxx_prompt" in
12644                 y)
12645                         rp="What is the order of bytes in a long?"
12646                         . ./myread
12647                         byteorder="$ans"
12648                         ;;
12649                 *)      byteorder=$dflt
12650                         ;;
12651                 esac
12652                 ;;
12653         esac
12654         $rm -f try.c try
12655         ;;
12656 esac
12657
12658
12659 $cat <<EOM
12660
12661 Checking to see whether you can access character data unalignedly...
12662 EOM
12663 $cat >try.c <<EOCP
12664 #include <stdio.h>
12665 #define U32 $u32type
12666 #define BYTEORDER $byteorder
12667 int main() {
12668 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12669     U8 buf[] = "\0\0\0\1\0\0\0\0";
12670     U32 *up;
12671     int i;
12672
12673     if (sizeof(U32) != 4) {
12674         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12675         exit(1);
12676     }
12677
12678     fflush(stdout);
12679
12680     for (i = 0; i < 4; i++) {
12681         up = (U32*)(buf + i);
12682         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12683                (*up == 1 << (8*(3-i)))  /* little-endian */
12684               )
12685            )
12686         {
12687             printf("read failed (%x)\n", *up);
12688             exit(2);
12689         }
12690     }
12691
12692     /* write test */
12693     for (i = 0; i < 4; i++) {
12694         up = (U32*)(buf + i);
12695         *up = 0xBeef;
12696         if (*up != 0xBeef) {
12697             printf("write failed (%x)\n", *up);
12698             exit(3);
12699         }
12700     }
12701
12702     exit(0);
12703 #else
12704     printf("1\n");
12705     exit(1);
12706 #endif
12707     return 0;
12708 }
12709 EOCP
12710 set try
12711 if eval $compile_ok; then
12712         echo "(This test may dump core.)" >&4
12713         ./try >&2 >/dev/null
12714         case "$?" in
12715         0)      cat >&4 <<EOM
12716 You can access character data pretty unalignedly.
12717 EOM
12718                 d_u32align="$undef"
12719                 ;;
12720         *)      cat >&4 <<EOM
12721 It seems that you must access character data in an aligned manner.
12722 EOM
12723                 d_u32align="$define"
12724                 ;;
12725         esac
12726         $rm -f core core.try.* try.core
12727 else
12728         rp='Can you access character data at unaligned addresses?'
12729         dflt='n'
12730         . ./myread
12731         case "$ans" in
12732         [yY]*)  d_u32align="$undef"  ;;
12733         *)      d_u32align="$define" ;;
12734         esac
12735 fi
12736
12737 : see if ualarm exists
12738 set ualarm d_ualarm
12739 eval $inlibc
12740
12741 : see if umask exists
12742 set umask d_umask
12743 eval $inlibc
12744
12745 : see if usleep exists
12746 set usleep d_usleep
12747 eval $inlibc
12748
12749 : see if ustat exists
12750 set ustat d_ustat
12751 eval $inlibc
12752
12753 : backward compatibility for d_hvfork
12754 if test X$d_hvfork != X; then
12755         d_vfork="$d_hvfork"
12756         d_hvfork=''
12757 fi
12758 : see if there is a vfork
12759 val=''
12760 set vfork val
12761 eval $inlibc
12762
12763 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12764 : perl on Solaris 2.x, and probably elsewhere.
12765 case "$val" in
12766 $define)
12767         echo " "
12768         case "$usevfork" in
12769         false) dflt='n';;
12770         *) dflt='y';;
12771         esac
12772         cat <<'EOM'
12773  
12774 Perl can only use a vfork() that doesn't suffer from strict
12775 restrictions on calling functions or modifying global data in
12776 the child.  For example, glibc-2.1 contains such a vfork()
12777 that is unsuitable.  If your system provides a proper fork()
12778 call, chances are that you do NOT want perl to use vfork().
12779
12780 EOM
12781         rp="Do you still want to use vfork()?"
12782         . ./myread
12783         case "$ans" in
12784         y|Y) ;;
12785         *)
12786                 echo "Ok, we won't use vfork()."
12787                 val="$undef"
12788                 ;;
12789         esac
12790         ;;
12791 esac
12792 set d_vfork
12793 eval $setvar
12794 case "$d_vfork" in
12795 $define) usevfork='true';;
12796 *) usevfork='false';;
12797 esac
12798
12799 : see if this is an sysdir system
12800 set sys/dir.h i_sysdir
12801 eval $inhdr
12802
12803 : see if this is an sysndir system
12804 set sys/ndir.h i_sysndir
12805 eval $inhdr
12806
12807 : see if closedir exists
12808 set closedir d_closedir
12809 eval $inlibc
12810
12811 case "$d_closedir" in
12812 "$define")
12813         echo " "
12814         echo "Checking whether closedir() returns a status..." >&4
12815         cat > closedir.c <<EOM
12816 #$i_dirent I_DIRENT             /**/
12817 #$i_sysdir I_SYS_DIR            /**/
12818 #$i_sysndir I_SYS_NDIR          /**/
12819 #$i_systypes I_SYS_TYPES        /**/
12820
12821 #if defined(I_SYS_TYPES)
12822 #include <sys/types.h>
12823 #endif
12824 #if defined(I_DIRENT)
12825 #include <dirent.h>
12826 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12827 #include <sys/dir.h>
12828 #endif
12829 #else
12830 #ifdef I_SYS_NDIR
12831 #include <sys/ndir.h>
12832 #else
12833 #ifdef I_SYS_DIR
12834 #ifdef hp9000s500
12835 #include <ndir.h>       /* may be wrong in the future */
12836 #else
12837 #include <sys/dir.h>
12838 #endif
12839 #endif
12840 #endif
12841 #endif 
12842 int main() { return closedir(opendir(".")); }
12843 EOM
12844         set closedir
12845         if eval $compile_ok; then
12846                 if ./closedir > /dev/null 2>&1 ; then
12847                         echo "Yes, it does."
12848                         val="$undef"
12849                 else
12850                         echo "No, it doesn't."
12851                         val="$define"
12852                 fi
12853         else
12854                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12855                 val="$define"
12856         fi
12857         ;;
12858 *)
12859         val="$undef";
12860         ;;
12861 esac
12862 set d_void_closedir
12863 eval $setvar
12864 $rm -f closedir*
12865 : see if there is a wait4
12866 set wait4 d_wait4
12867 eval $inlibc
12868
12869 : see if waitpid exists
12870 set waitpid d_waitpid
12871 eval $inlibc
12872
12873 : see if wcstombs exists
12874 set wcstombs d_wcstombs
12875 eval $inlibc
12876
12877 : see if wctomb exists
12878 set wctomb d_wctomb
12879 eval $inlibc
12880
12881 : see if writev exists
12882 set writev d_writev
12883 eval $inlibc
12884
12885 : preserve RCS keywords in files with variable substitution, grrr
12886 Date='$Date'
12887 Id='$Id'
12888 Log='$Log'
12889 RCSfile='$RCSfile'
12890 Revision='$Revision'
12891
12892 : check for alignment requirements
12893 echo " "
12894 case "$crosscompile$multiarch" in
12895 *$define*)
12896         $cat <<EOM
12897 You seem to be either cross-compiling or doing a multiarchitecture build,
12898 skipping the memory alignment check.
12899
12900 EOM
12901         case "$alignbytes" in
12902         '') alignbytes=8 ;;
12903         esac
12904         ;;
12905 *)
12906         case "$alignbytes" in
12907         '') echo "Checking alignment constraints..." >&4
12908                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12909                         $cat >try.c <<'EOCP'
12910 typedef long double NV;
12911 EOCP
12912                 else
12913                         $cat >try.c <<'EOCP'
12914 typedef double NV;
12915 EOCP
12916                 fi
12917                 $cat >>try.c <<'EOCP'
12918 #include <stdio.h>
12919 struct foobar {
12920         char foo;
12921         NV bar;
12922 } try_algn;
12923 int main()
12924 {
12925     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12926     return(0);
12927 }
12928 EOCP
12929                 set try
12930                 if eval $compile_ok; then
12931                         dflt=`./try`
12932                 else
12933                         dflt='8'
12934                         echo "(I can't seem to compile the test program...)"
12935                 fi
12936                 ;;
12937         *) dflt="$alignbytes"
12938                 ;;
12939         esac
12940         rp="Doubles must be aligned on a how-many-byte boundary?"
12941         . ./myread
12942         alignbytes="$ans"
12943         $rm -f try.c try
12944         ;;
12945 esac
12946
12947
12948 : set the base revision
12949 baserev=5.0
12950
12951 : how do we catenate cpp tokens here?
12952 echo " "
12953 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12954 $cat >cpp_stuff.c <<'EOCP'
12955 #define RCAT(a,b)a/**/b
12956 #define ACAT(a,b)a ## b
12957 RCAT(Rei,ser)
12958 ACAT(Cir,cus)
12959 EOCP
12960 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12961 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12962         echo "Oh!  Smells like ANSI's been here." >&4
12963         echo "We can catify or stringify, separately or together!"
12964         cpp_stuff=42
12965 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12966         echo "Ah, yes!  The good old days!" >&4
12967         echo "However, in the good old days we don't know how to stringify and"
12968         echo "catify at the same time."
12969         cpp_stuff=1
12970 else
12971         $cat >&4 <<EOM
12972 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12973 to have to edit the values of CAT[2-5] in config.h...
12974 EOM
12975         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12976 fi
12977 $rm -f cpp_stuff.*
12978
12979 : see if this is a db.h system
12980 set db.h i_db
12981 eval $inhdr
12982
12983 case "$i_db" in
12984 $define)
12985         : Check db version.
12986         echo " "
12987         echo "Checking Berkeley DB version ..." >&4
12988         $cat >try.c <<EOCP
12989 #$d_const HASCONST
12990 #ifndef HASCONST
12991 #define const
12992 #endif
12993 #include <sys/types.h>
12994 #include <stdio.h>
12995 #include <db.h>
12996 int main()
12997 {
12998 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12999     int Major, Minor, Patch ;
13000     unsigned long Version ;
13001     (void)db_version(&Major, &Minor, &Patch) ;
13002     printf("You have Berkeley DB Version 2 or greater\n");
13003
13004     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13005                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13006     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13007                 Major, Minor, Patch) ;
13008
13009     /* check that db.h & libdb are compatible */
13010     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13011         printf("db.h and libdb are incompatible\n") ;
13012         exit(3);        
13013     }
13014
13015     printf("db.h and libdb are compatible\n") ;
13016
13017     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13018                 + DB_VERSION_PATCH ;
13019
13020     /* needs to be >= 2.3.4 */
13021     if (Version < 2003004) {
13022     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13023         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
13024         exit(2);        
13025     }
13026
13027     exit(0);
13028 #else
13029 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13030     printf("You have Berkeley DB Version 1\n");
13031     exit(0);    /* DB version < 2: the coast is clear. */
13032 #else
13033     exit(1);    /* <db.h> not Berkeley DB? */
13034 #endif
13035 #endif
13036 }
13037 EOCP
13038         set try
13039         if eval $compile_ok && ./try; then
13040                 echo 'Looks OK.' >&4
13041         else
13042                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13043                 i_db=$undef
13044                 case " $libs " in
13045                 *"-ldb "*)
13046                         : Remove db from list of libraries to use
13047                         echo "Removing unusable -ldb from library list" >&4
13048                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13049                         shift
13050                         libs="$*"
13051                         echo "libs = $libs" >&4
13052                         ;;
13053                 esac
13054         fi
13055         $rm -f try.*
13056         ;;
13057 esac
13058
13059 case "$i_db" in
13060 define)
13061         : Check the return type needed for hash 
13062         echo " "
13063         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13064         $cat >try.c <<EOCP
13065 #$d_const HASCONST
13066 #ifndef HASCONST
13067 #define const
13068 #endif
13069 #include <sys/types.h>
13070 #include <db.h>
13071
13072 #ifndef DB_VERSION_MAJOR
13073 u_int32_t hash_cb (ptr, size)
13074 const void *ptr;
13075 size_t size;
13076 {
13077 }
13078 HASHINFO info;
13079 int main()
13080 {
13081         info.hash = hash_cb;
13082 }
13083 #endif
13084 EOCP
13085         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13086                 if $contains warning try.out >>/dev/null 2>&1 ; then
13087                         db_hashtype='int'
13088                 else
13089                         db_hashtype='u_int32_t'
13090                 fi
13091         else
13092                 : XXX Maybe we should just give up here.
13093                 db_hashtype=u_int32_t
13094                 $cat try.out >&4
13095                 echo "Help:  I can't seem to compile the db test program." >&4
13096                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13097         fi
13098         $rm -f try.*
13099         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13100         ;;
13101 *)      db_hashtype=u_int32_t
13102         ;;
13103 esac
13104 case "$i_db" in
13105 define)
13106         : Check the return type needed for prefix 
13107         echo " "
13108         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13109         cat >try.c <<EOCP
13110 #$d_const HASCONST
13111 #ifndef HASCONST
13112 #define const
13113 #endif
13114 #include <sys/types.h>
13115 #include <db.h>
13116
13117 #ifndef DB_VERSION_MAJOR
13118 size_t prefix_cb (key1, key2)
13119 const DBT *key1;
13120 const DBT *key2;
13121 {
13122 }
13123 BTREEINFO info;
13124 int main()
13125 {
13126         info.prefix = prefix_cb;
13127 }
13128 #endif
13129 EOCP
13130         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13131                 if $contains warning try.out >>/dev/null 2>&1 ; then
13132                         db_prefixtype='int'
13133                 else
13134                         db_prefixtype='size_t'
13135                 fi
13136         else
13137                 db_prefixtype='size_t'
13138                 : XXX Maybe we should just give up here.
13139                 $cat try.out >&4
13140                 echo "Help:  I can't seem to compile the db test program." >&4
13141                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13142         fi
13143         $rm -f try.*
13144         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13145         ;;
13146 *)      db_prefixtype='size_t'
13147         ;;
13148 esac
13149
13150
13151 : How can we generate normalized random numbers ?
13152 echo " "
13153 echo "Looking for a random number function..." >&4
13154 case "$randfunc" in
13155 '')
13156         if set drand48 val -f; eval $csym; $val; then
13157                 dflt="drand48"
13158                 echo "Good, found drand48()." >&4
13159         elif set random val -f; eval $csym; $val; then
13160                 dflt="random"
13161                 echo "OK, found random()." >&4
13162         else
13163                 dflt="rand"
13164                 echo "Yick, looks like I have to use rand()." >&4
13165         fi
13166         echo " "
13167         ;;
13168 *)
13169         dflt="$randfunc"
13170         ;;
13171 esac
13172 cont=true
13173
13174 case "$ccflags" in
13175 *-Dmy_rand=*|*-Dmy_srand=*)
13176         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13177         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13178         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13179         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13180         ;;
13181 esac
13182
13183 while $test "$cont"; do
13184         rp="Use which function to generate random numbers?"
13185         . ./myread
13186         if $test "$ans" = "$dflt"; then
13187                 : null
13188         else
13189                 randbits=''
13190         fi
13191         randfunc="$ans"
13192         if set $ans val -f; eval $csym; $val; then
13193                 cont=''
13194         else
13195                 dflt=y
13196                 rp="I cannot find function $ans. Use that name anyway?"
13197                 . ./myread
13198                 dflt=rand
13199                 case "$ans" in
13200                         [yY]*) cont='';;
13201                 esac
13202         fi
13203         case "$cont" in
13204         '')
13205                 case "$randfunc" in
13206                 drand48)
13207                         drand01="drand48()"
13208                         seedfunc="srand48"
13209                         randbits=48
13210                         randseedtype=long
13211                         ;;
13212                 rand|random)
13213                         case "$randbits" in
13214                         '')
13215 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13216                                 $cat >try.c <<EOCP
13217 #$i_unistd I_UNISTD
13218 #$i_stdlib I_STDLIB
13219 #include <stdio.h>
13220 #ifdef I_UNISTD
13221 #  include <unistd.h>
13222 #endif
13223 #ifdef I_STDLIB
13224 #  include <stdlib.h>
13225 #endif
13226 int main()
13227 {
13228         register int i;
13229         register unsigned long tmp;
13230         register unsigned long max = 0L;
13231
13232         for (i = 1000; i; i--) {
13233                 tmp = (unsigned long) $randfunc();
13234                 if (tmp > max) max = tmp;
13235         }
13236         for (i = 0; max; i++)
13237                 max /= 2;
13238         printf("%d\n",i);
13239 }
13240 EOCP
13241                                 set try
13242                                 if eval $compile_ok; then
13243                                         dflt=`try`
13244                                 else
13245                                         dflt='?'
13246                                         echo "(I can't seem to compile the test program...)"
13247                                 fi
13248                                 ;;
13249                         *)
13250                                 dflt="$randbits"
13251                                 ;;
13252                         esac
13253                         rp="How many bits does your $randfunc() function produce?"
13254                         . ./myread
13255                         randbits="$ans"
13256                         $rm -f try.c try
13257                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13258                         seedfunc="s$randfunc"
13259                         randseedtype=unsigned
13260                         ;;
13261                 *)
13262                         dflt="31"
13263                         rp="How many bits does your $randfunc() function produce?"
13264                         . ./myread
13265                         randbits="$ans"
13266                         seedfunc="s$randfunc"
13267                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13268                         if set $seedfunc val -f; eval $csym; $val; then
13269                                 echo "(Using $seedfunc() to seed random generator)"
13270                         else
13271                                 echo "(Warning: no $seedfunc() to seed random generator)"
13272                                 seedfunc=rand
13273                         fi
13274                         randseedtype=unsigned
13275                         ;;
13276                 esac
13277                 ;;
13278         esac
13279 done
13280
13281 echo " "
13282 echo "Determining whether or not we are on an EBCDIC system..." >&4
13283 $cat >tebcdic.c <<'EOM'
13284 int main()
13285 {
13286   if ('M'==0xd4) return 0;
13287   return 1;
13288 }
13289 EOM
13290
13291 val=$undef
13292 set tebcdic
13293 if eval $compile_ok; then
13294         if ./tebcdic; then
13295                 echo "You seem to speak EBCDIC." >&4
13296                 val="$define"
13297         else
13298                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13299         fi
13300 else
13301         echo "I'm unable to compile the test program." >&4
13302         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13303 fi
13304 $rm -f tebcdic.c tebcdic
13305 set ebcdic
13306 eval $setvar
13307
13308 echo " "
13309 $cat >&4 <<EOM
13310 Checking how to flush all pending stdio output...
13311 EOM
13312 # I only know how to find the first 32 possibly open files on SunOS.
13313 # See also hints/sunos_4_1.sh and util.c  --AD
13314 case "$osname" in
13315 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13316 esac
13317 $cat >>try.c <<EOCP
13318 #include <stdio.h>
13319 #$i_unistd I_UNISTD
13320 #ifdef I_UNISTD
13321 # include <unistd.h>
13322 #endif
13323 #$d_sysconf HAS_SYSCONF
13324 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13325 #ifdef HAS_STDIO_STREAM_ARRAY
13326 # define STDIO_STREAM_ARRAY $stdio_stream_array
13327 #endif
13328 int main() {
13329   FILE* p = fopen("try.out", "w");
13330 #ifdef TRY_FPUTC
13331   fputc('x', p);
13332 #else
13333 # ifdef TRY_FPRINTF
13334   fprintf(p, "x");
13335 # endif
13336 #endif
13337 #ifdef TRY_FFLUSH_NULL
13338   fflush(NULL);
13339 #endif
13340 #ifdef TRY_FFLUSH_ALL
13341   {
13342     long open_max = -1;
13343 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13344     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13345 # else
13346 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13347     open_max = sysconf(_SC_OPEN_MAX);
13348 #  else
13349 #   ifdef FOPEN_MAX
13350     open_max = FOPEN_MAX;
13351 #   else
13352 #    ifdef OPEN_MAX
13353     open_max = OPEN_MAX;
13354 #    else
13355 #     ifdef _NFILE
13356     open_max = _NFILE;
13357 #     endif
13358 #    endif
13359 #   endif
13360 #  endif
13361 # endif 
13362 # ifdef HAS_STDIO_STREAM_ARRAY
13363     if (open_max > 0) {
13364       long i;
13365       for (i = 0; i < open_max; i++)
13366             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13367                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13368                 STDIO_STREAM_ARRAY[i]._flag)
13369                 fflush(&STDIO_STREAM_ARRAY[i]);
13370     }   
13371   }
13372 # endif
13373 #endif
13374   _exit(42);
13375 }
13376 EOCP
13377 : first we have to find out how _not_ to flush
13378 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13379     output=''
13380     set try -DTRY_FPUTC
13381     if eval $compile; then
13382             $rm -f try.out
13383             ./try$exe_ext 2>/dev/null
13384             if $test ! -s try.out -a "X$?" = X42; then
13385                 output=-DTRY_FPUTC
13386             fi
13387     fi
13388     case "$output" in
13389     '')
13390             set try -DTRY_FPRINTF
13391             $rm -f try.out
13392             if eval $compile; then
13393                     $rm -f try.out
13394                     ./try$exe_ext 2>/dev/null
13395                     if $test ! -s try.out -a "X$?" = X42; then
13396                         output=-DTRY_FPRINTF
13397                     fi
13398             fi
13399         ;;
13400     esac
13401 fi
13402 : check for fflush NULL behaviour
13403 case "$fflushNULL" in
13404 '')     set try -DTRY_FFLUSH_NULL $output
13405         if eval $compile; then
13406                 $rm -f try.out
13407                 ./try$exe_ext 2>/dev/null
13408                 code="$?"
13409                 if $test -s try.out -a "X$code" = X42; then
13410                         fflushNULL="`$cat try.out`"
13411                 else
13412                         if $test "X$code" != X42; then
13413                                 $cat >&4 <<EOM
13414 (If this test failed, don't worry, we'll try another method shortly.)
13415 EOM
13416                         fi
13417                 fi
13418         fi
13419         $rm -f core try.core core.try.*
13420         case "$fflushNULL" in
13421         x)      $cat >&4 <<EOM
13422 Your fflush(NULL) works okay for output streams.
13423 Let's see if it clobbers input pipes...
13424 EOM
13425 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13426 # bug that improperly flushes the input end of pipes.  So we avoid the
13427 # autoflush on fork/system/exec support for now. :-(
13428 $cat >tryp.c <<EOCP
13429 #include <stdio.h>
13430 int
13431 main(int argc, char **argv)
13432 {
13433     char buf[1024];
13434     int i;
13435     char *bp = buf;
13436     while (1) {
13437         while ((i = getc(stdin)) != -1
13438                && (*bp++ = i) != '\n'
13439                && bp < &buf[1024])
13440         /* DO NOTHING */ ;
13441         *bp = '\0';
13442         fprintf(stdout, "%s", buf);
13443         fflush(NULL);
13444         if (i == -1)
13445             return 0;
13446         bp = buf;
13447     }
13448 }
13449 EOCP
13450                 fflushNULL="$define"
13451                 set tryp
13452                 if eval $compile; then
13453                     $rm -f tryp.out
13454                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13455                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13456                        $cat >&4 <<EOM
13457 fflush(NULL) seems to behave okay with input streams.
13458 EOM
13459                         fflushNULL="$define"
13460                     else
13461                         $cat >&4 <<EOM
13462 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13463 EOM
13464                         fflushNULL="$undef"
13465                     fi
13466                 fi
13467                 $rm -f core tryp.c tryp.core core.tryp.*
13468                 ;;
13469         '')     $cat >&4 <<EOM
13470 Your fflush(NULL) isn't working (contrary to ANSI C).
13471 EOM
13472                 fflushNULL="$undef"
13473                 ;;
13474         *)      $cat >&4 <<EOM
13475 Cannot figure out whether your fflush(NULL) works or not.
13476 I'm assuming it doesn't (contrary to ANSI C).
13477 EOM
13478                 fflushNULL="$undef"
13479                 ;;
13480         esac
13481         ;;
13482 $define|true|[yY]*)
13483         fflushNULL="$define"
13484         ;;
13485 *)
13486         fflushNULL="$undef"
13487         ;;
13488 esac
13489 : check explicit looping only if NULL did not work, and if the pipe
13490 : bug does not show up on an explicit flush too
13491 case "$fflushNULL" in
13492 "$undef")
13493         $cat >tryp.c <<EOCP
13494 #include <stdio.h>
13495 int
13496 main(int argc, char **argv)
13497 {
13498     char buf[1024];
13499     int i;
13500     char *bp = buf;
13501     while (1) {
13502         while ((i = getc(stdin)) != -1
13503                && (*bp++ = i) != '\n'
13504                && bp < &buf[1024])
13505         /* DO NOTHING */ ;
13506         *bp = '\0';
13507         fprintf(stdout, "%s", buf);
13508         fflush(stdin);
13509         if (i == -1)
13510             return 0;
13511         bp = buf;
13512     }
13513 }
13514 EOCP
13515         set tryp
13516         if eval $compile; then
13517             $rm -f tryp.out
13518             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13519             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13520                $cat >&4 <<EOM
13521 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13522 EOM
13523                 : now check for fflushall behaviour
13524                 case "$fflushall" in
13525                 '')     set try -DTRY_FFLUSH_ALL $output
13526                         if eval $compile; then
13527                                 $cat >&4 <<EOM
13528 (Now testing the other method--but note that this also may fail.)
13529 EOM
13530                                 $rm -f try.out
13531                                 ./try$exe_ext 2>/dev/null
13532                                 if $test -s try.out -a "X$?" = X42; then
13533                                         fflushall="`$cat try.out`"
13534                                 fi
13535                         fi
13536                         $rm -f core try.core core.try.*
13537                         case "$fflushall" in
13538                         x)      $cat >&4 <<EOM
13539 Whew. Flushing explicitly all the stdio streams works.
13540 EOM
13541                                 fflushall="$define"
13542                                 ;;
13543                         '')     $cat >&4 <<EOM
13544 Sigh. Flushing explicitly all the stdio streams doesn't work.
13545 EOM
13546                                 fflushall="$undef"
13547                                 ;;
13548                         *)      $cat >&4 <<EOM
13549 Cannot figure out whether flushing stdio streams explicitly works or not.
13550 I'm assuming it doesn't.
13551 EOM
13552                                 fflushall="$undef"
13553                                 ;;
13554                         esac
13555                         ;;
13556                 "$define"|true|[yY]*)
13557                         fflushall="$define"
13558                         ;;
13559                 *)
13560                         fflushall="$undef"
13561                         ;;
13562                 esac
13563             else
13564                 $cat >&4 <<EOM
13565 All is futile.  Even fflush(stdin) clobbers input pipes!
13566 EOM
13567                 fflushall="$undef"
13568             fi
13569         else
13570             fflushall="$undef"
13571         fi
13572         $rm -f core tryp.c tryp.core core.tryp.*
13573         ;;
13574 *)      fflushall="$undef"
13575         ;;
13576 esac
13577
13578 case "$fflushNULL$fflushall" in
13579 undefundef)
13580         $cat <<EOM
13581 OK, I give up.  I cannot figure out how to flush pending stdio output.
13582 We won't be flushing handles at all before fork/exec/popen.
13583 EOM
13584         ;;
13585 esac
13586 $rm -f try.* try$exe_ext
13587
13588 : Store the full pathname to the ar program for use in the C program
13589 : Respect a hint or command line value for full_ar.
13590 case "$full_ar" in
13591 '') full_ar=$ar ;;
13592 esac
13593
13594 : Store the full pathname to the sed program for use in the C program
13595 full_sed=$sed
13596
13597 : see what type gids are declared as in the kernel
13598 echo " "
13599 echo "Looking for the type for group ids returned by getgid()."
13600 set gid_t gidtype xxx stdio.h sys/types.h
13601 eval $typedef
13602 case "$gidtype" in
13603 xxx)
13604         xxx=`./findhdr sys/user.h`
13605         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13606         case $1 in
13607         unsigned) dflt="$1 $2" ;;
13608         *) dflt="$1" ;;
13609         esac
13610         ;;
13611 *) dflt="$gidtype";;
13612 esac
13613 case "$gidtype" in
13614 gid_t) echo "gid_t found." ;;
13615 *)      rp="What is the type for group ids returned by getgid()?"
13616         . ./myread
13617         gidtype="$ans"
13618         ;;
13619 esac
13620
13621 echo " "
13622 case "$gidtype" in
13623 *_t) zzz="$gidtype"     ;;
13624 *)   zzz="gid"          ;;
13625 esac
13626 echo "Checking the size of $zzz..." >&4 
13627 cat > try.c <<EOCP
13628 #include <sys/types.h>
13629 #include <stdio.h>
13630 int main() {
13631     printf("%d\n", (int)sizeof($gidtype));
13632     exit(0);
13633 }
13634 EOCP
13635 set try
13636 if eval $compile_ok; then
13637         yyy=`./try`
13638         case "$yyy" in
13639         '')     gidsize=4
13640                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13641                 ;;
13642         *)      gidsize=$yyy
13643                 echo "Your $zzz is $gidsize bytes long."
13644                 ;;
13645         esac
13646 else
13647         gidsize=4
13648         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13649 fi
13650
13651
13652 echo " "
13653 case "$gidtype" in
13654 *_t) zzz="$gidtype"     ;;
13655 *)   zzz="gid"          ;;
13656 esac
13657 echo "Checking the sign of $zzz..." >&4 
13658 cat > try.c <<EOCP
13659 #include <sys/types.h>
13660 #include <stdio.h>
13661 int main() {
13662         $gidtype foo = -1;
13663         if (foo < 0)
13664                 printf("-1\n");
13665         else
13666                 printf("1\n");
13667 }
13668 EOCP
13669 set try
13670 if eval $compile; then
13671         yyy=`./try`
13672         case "$yyy" in
13673         '')     gidsign=1
13674                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13675                 ;;
13676         *)      gidsign=$yyy
13677                 case "$gidsign" in
13678                  1) echo "Your $zzz is unsigned." ;;
13679                 -1) echo "Your $zzz is signed."   ;;
13680                 esac
13681                 ;;
13682         esac
13683 else
13684         gidsign=1
13685         echo "(I can't compile the test program--guessing unsigned.)" >&4
13686 fi
13687
13688
13689 echo " "
13690
13691 if $test X"$quadtype" != X; then
13692
13693 echo "Checking how to print 64-bit integers..." >&4
13694
13695 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13696         $cat >try.c <<'EOCP'
13697 #include <sys/types.h>
13698 #include <stdio.h>
13699 int main() {
13700   int q = 12345678901;
13701   printf("%ld\n", q);
13702 }
13703 EOCP
13704         set try
13705         if eval $compile; then
13706                 yyy=`./try$exe_ext`
13707                 case "$yyy" in
13708                 12345678901)
13709                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13710                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13711                         echo "We will use %d."
13712                         ;;
13713                 esac
13714         fi
13715 fi
13716
13717 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13718         $cat >try.c <<'EOCP'
13719 #include <sys/types.h>
13720 #include <stdio.h>
13721 int main() {
13722   long q = 12345678901;
13723   printf("%ld\n", q);
13724 }
13725 EOCP
13726         set try
13727         if eval $compile; then
13728                 yyy=`./try$exe_ext`
13729                 case "$yyy" in
13730                 12345678901)
13731                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13732                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13733                         echo "We will use %ld."
13734                         ;;
13735                 esac
13736         fi
13737 fi
13738
13739 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13740         $cat >try.c <<'EOCP'
13741 #include <sys/types.h>
13742 #include <inttypes.h>
13743 #include <stdio.h>
13744 int main() {
13745   int64_t q = 12345678901;
13746   printf("%" PRId64 "\n", q);
13747 }
13748 EOCP
13749         set try
13750         if eval $compile; then
13751                 yyy=`./try$exe_ext`
13752                 case "$yyy" in
13753                 12345678901)
13754                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13755                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13756                         echo "We will use the C9X style."
13757                         ;;
13758                 esac
13759         fi
13760 fi
13761
13762 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13763         $cat >try.c <<'EOCP'
13764 #include <sys/types.h>
13765 #include <stdio.h>
13766 int main() {
13767   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13768   printf("%lld\n", q);
13769 }
13770 EOCP
13771         set try
13772         if eval $compile; then
13773                 yyy=`./try$exe_ext`
13774                 case "$yyy" in
13775                 12345678901)
13776                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13777                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13778                         echo "We will use the %lld style."
13779                         ;;
13780                 esac
13781         fi
13782 fi
13783
13784 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13785         $cat >try.c <<EOCP
13786 #include <sys/types.h>
13787 #include <stdio.h>
13788 int main() {
13789   $quadtype q = 12345678901;
13790   printf("%Ld\n", q);
13791 }
13792 EOCP
13793         set try
13794         if eval $compile; then
13795                 yyy=`./try$exe_ext`
13796                 case "$yyy" in
13797                 12345678901)
13798                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13799                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13800                         echo "We will use %Ld."
13801                         ;;
13802                 esac
13803         fi
13804 fi
13805
13806 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13807         $cat >try.c <<EOCP
13808 #include <sys/types.h>
13809 #include <stdio.h>
13810 int main() {
13811   $quadtype q = 12345678901;
13812   printf("%qd\n", q);
13813 }
13814 EOCP
13815         set try
13816         if eval $compile; then
13817                 yyy=`./try$exe_ext`
13818                 case "$yyy" in
13819                 12345678901)
13820                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13821                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13822                         echo "We will use %qd."
13823                         ;;
13824                 esac
13825         fi
13826 fi
13827
13828 if $test X"$sPRId64" = X; then
13829         echo "Cannot figure out how to print 64-bit integers." >&4
13830 fi
13831
13832 $rm -f try try.*
13833
13834 fi
13835
13836 case "$sPRId64" in
13837 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13838         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13839         ;;
13840 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13841         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13842         ;;
13843 esac
13844
13845
13846 echo " "
13847 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13848
13849 if $test X"$ivsize" = X8; then
13850         ivdformat="$sPRId64"
13851         uvuformat="$sPRIu64"
13852         uvoformat="$sPRIo64"
13853         uvxformat="$sPRIx64"
13854         uvXUformat="$sPRIXU64"
13855 else
13856         if $test X"$ivsize" = X"$longsize"; then
13857                 ivdformat='"ld"'
13858                 uvuformat='"lu"'
13859                 uvoformat='"lo"'
13860                 uvxformat='"lx"'
13861                 uvXUformat='"lX"'
13862         else
13863                 if $test X"$ivsize" = X"$intsize"; then
13864                         ivdformat='"d"'
13865                         uvuformat='"u"'
13866                         uvoformat='"o"'
13867                         uvxformat='"x"'
13868                         uvXUformat='"X"'
13869                 else
13870                         : far out
13871                         if $test X"$ivsize" = X"$shortsize"; then
13872                                 ivdformat='"hd"'
13873                                 uvuformat='"hu"'
13874                                 uvoformat='"ho"'
13875                                 uvxformat='"hx"'
13876                                 uvXUformat='"hX"'
13877                         fi
13878                 fi
13879         fi
13880 fi
13881
13882 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13883         nveformat="$sPRIeldbl"
13884         nvfformat="$sPRIfldbl"
13885         nvgformat="$sPRIgldbl"
13886         nvEUformat="$sPRIEUldbl"
13887         nvFUformat="$sPRIFUldbl"
13888         nvGUformat="$sPRIGUldbl"
13889 else
13890         nveformat='"e"'
13891         nvfformat='"f"'
13892         nvgformat='"g"'
13893         nvEUformat='"E"'
13894         nvFUformat='"F"'
13895         nvGUformat='"G"'
13896 fi
13897
13898 case "$ivdformat" in
13899 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13900     exit 1
13901     ;;
13902 esac
13903
13904
13905 echo " "
13906 $echo "Checking the format string to be used for gids..." >&4
13907
13908 case "$gidsign" in
13909 -1)     if $test X"$gidsize" = X"$ivsize"; then
13910                 gidformat="$ivdformat"
13911         else
13912                 if $test X"$gidsize" = X"$longsize"; then
13913                         gidformat='"ld"'
13914                 else
13915                         if $test X"$gidsize" = X"$intsize"; then
13916                                 gidformat='"d"'
13917                         else
13918                                 if $test X"$gidsize" = X"$shortsize"; then
13919                                         gidformat='"hd"'
13920                                 fi
13921                         fi
13922                 fi
13923         fi
13924         ;;
13925 *)      if $test X"$gidsize" = X"$uvsize"; then
13926                 gidformat="$uvuformat"
13927         else
13928                 if $test X"$gidsize" = X"$longsize"; then
13929                         gidformat='"lu"'
13930                 else
13931                         if $test X"$gidsize" = X"$intsize"; then
13932                                 gidformat='"u"'
13933                         else
13934                                 if $test X"$gidsize" = X"$shortsize"; then
13935                                         gidformat='"hu"'
13936                                 fi
13937                         fi
13938                 fi
13939         fi
13940         ;;
13941 esac
13942
13943 : see if getgroups exists
13944 set getgroups d_getgrps
13945 eval $inlibc
13946
13947 : see if setgroups exists
13948 set setgroups d_setgrps
13949 eval $inlibc
13950
13951
13952 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13953 echo " "
13954 case "$d_getgrps$d_setgrps" in
13955 *define*)
13956         case "$groupstype" in
13957         '') dflt="$gidtype" ;;
13958         *)  dflt="$groupstype" ;;
13959         esac
13960         $cat <<EOM
13961 What type of pointer is the second argument to getgroups() and setgroups()?
13962 Usually this is the same as group ids, $gidtype, but not always.
13963
13964 EOM
13965         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13966         . ./myread
13967         groupstype="$ans"
13968         ;;
13969 *)  groupstype="$gidtype";;
13970 esac
13971
13972 echo " "
13973 echo "Checking if your $make program sets \$(MAKE)..." >&4
13974 case "$make_set_make" in
13975 '')
13976         $sed 's/^X //' > testmake.mak << 'EOF'
13977 Xall:
13978 X       @echo 'maketemp="$(MAKE)"'
13979 EOF
13980         case "`$make -f testmake.mak 2>/dev/null`" in
13981         *maketemp=*) make_set_make='#' ;;
13982         *)      make_set_make="MAKE=$make" ;;
13983         esac
13984         $rm -f testmake.mak
13985         ;;
13986 esac
13987 case "$make_set_make" in
13988 '#') echo "Yup, it does.";;
13989 *) echo "Nope, it doesn't.";;
13990 esac
13991
13992 : see what type is used for mode_t
13993 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13994 set mode_t modetype int stdio.h sys/types.h
13995 eval $typedef_ask
13996
13997 : see if stdarg is available
13998 echo " "
13999 if $test `./findhdr stdarg.h`; then
14000         echo "<stdarg.h> found." >&4
14001         valstd="$define"
14002 else
14003         echo "<stdarg.h> NOT found." >&4
14004         valstd="$undef"
14005 fi
14006
14007 : see if varags is available
14008 echo " "
14009 if $test `./findhdr varargs.h`; then
14010         echo "<varargs.h> found." >&4
14011 else
14012         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14013 fi
14014
14015 : set up the varargs testing programs
14016 $cat > varargs.c <<EOP
14017 #ifdef I_STDARG
14018 #include <stdarg.h>
14019 #endif
14020 #ifdef I_VARARGS
14021 #include <varargs.h>
14022 #endif
14023
14024 #ifdef I_STDARG
14025 int f(char *p, ...)
14026 #else
14027 int f(va_alist)
14028 va_dcl
14029 #endif
14030 {
14031         va_list ap;
14032 #ifndef I_STDARG
14033         char *p;
14034 #endif
14035 #ifdef I_STDARG
14036         va_start(ap,p);
14037 #else
14038         va_start(ap);
14039         p = va_arg(ap, char *);
14040 #endif
14041         va_end(ap);
14042 }
14043 EOP
14044 $cat > varargs <<EOP
14045 $startsh
14046 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14047         echo "true"
14048 else
14049         echo "false"
14050 fi
14051 $rm -f varargs$_o
14052 EOP
14053 chmod +x varargs
14054
14055 : now check which varargs header should be included
14056 echo " "
14057 i_varhdr=''
14058 case "$valstd" in
14059 "$define")
14060         if `./varargs I_STDARG`; then
14061                 val='stdarg.h'
14062         elif `./varargs I_VARARGS`; then
14063                 val='varargs.h'
14064         fi
14065         ;;
14066 *)
14067         if `./varargs I_VARARGS`; then
14068                 val='varargs.h'
14069         fi
14070         ;;
14071 esac
14072 case "$val" in
14073 '')
14074 echo "I could not find the definition for va_dcl... You have problems..." >&4
14075         val="$undef"; set i_stdarg; eval $setvar
14076         val="$undef"; set i_varargs; eval $setvar
14077         ;;
14078 *) 
14079         set i_varhdr
14080         eval $setvar
14081         case "$i_varhdr" in
14082         stdarg.h)
14083                 val="$define"; set i_stdarg; eval $setvar
14084                 val="$undef"; set i_varargs; eval $setvar
14085                 ;;
14086         varargs.h)
14087                 val="$undef"; set i_stdarg; eval $setvar
14088                 val="$define"; set i_varargs; eval $setvar
14089                 ;;
14090         esac
14091         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14092 esac
14093 $rm -f varargs*
14094
14095 : see if we need va_copy
14096 echo " "
14097 case "$i_stdarg" in
14098 "$define")
14099         $cat >try.c <<EOCP
14100 #include <stdarg.h>
14101 #include <stdio.h>
14102 #$i_stdlib I_STDLIB
14103 #ifdef I_STDLIB
14104 #include <stdlib.h>
14105 #endif
14106 #include <signal.h>
14107
14108 int
14109 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14110 {
14111   return vfprintf(f, fmt, *valp);
14112 }
14113  
14114 int    
14115 myvfprintf(FILE *f, const  char *fmt, va_list val)
14116 {
14117   return ivfprintf(f, fmt, &val);
14118 }
14119       
14120 int
14121 myprintf(char *fmt, ...) 
14122 {
14123   va_list val;
14124   va_start(val, fmt);
14125   return myvfprintf(stdout, fmt, val); 
14126 }         
14127
14128 int
14129 main(int ac, char **av)
14130 {
14131   signal(SIGSEGV, exit);
14132
14133   myprintf("%s%cs all right, then\n", "that", '\'');                            
14134   exit(0);      
14135 }
14136 EOCP
14137         set try
14138         if eval $compile && ./try 2>&1 >/dev/null; then
14139                 case "`./try`" in
14140                 "that's all right, then")
14141                         okay=yes
14142                         ;;
14143                 esac
14144         fi
14145         case "$okay" in
14146         yes)    echo "It seems that you don't need va_copy()." >&4
14147                 need_va_copy="$undef"
14148                 ;;
14149         *)      echo "It seems that va_copy() or similar will be needed." >&4
14150                 need_va_copy="$define"
14151                 ;;
14152         esac
14153         $rm -f try.* core core.* *.core *.core.*
14154         ;;
14155 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14156         ;;
14157 esac
14158
14159 : define a fucntion to check prototypes
14160 $cat > protochk <<EOSH
14161 $startsh
14162 cc="$cc"
14163 optimize="$optimize"
14164 ccflags="$ccflags"
14165 prototype="$prototype"
14166 define="$define"
14167 rm=$rm
14168 EOSH
14169
14170 $cat >> protochk <<'EOSH'
14171
14172 $rm -f try.c
14173 foo="$1"
14174 shift
14175 while test $# -ge 2; do
14176         case "$1" in
14177                 $define) echo "#include <$2>" >> try.c ;;
14178                 literal) echo "$2" >> try.c ;;
14179         esac
14180     shift 2
14181 done
14182 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14183 cat >> try.c <<'EOCP'
14184 #ifdef CAN_PROTOTYPE
14185 #define _(args) args
14186 #else
14187 #define _(args) ()
14188 #endif
14189 EOCP
14190 echo "$foo" >> try.c
14191 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14192 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14193 status=$?
14194 $rm -f try.[co]
14195 exit $status
14196 EOSH
14197 chmod +x protochk
14198 $eunicefix protochk
14199
14200 : see what type is used for size_t
14201 rp="What is the type used for the length parameter for string functions?"
14202 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14203 eval $typedef_ask
14204
14205 : check for type of arguments to gethostbyaddr. 
14206 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14207         case "$d_gethbyaddr" in
14208         $define)
14209                 $cat <<EOM
14210
14211 Checking to see what type of arguments are accepted by gethostbyaddr().
14212 EOM
14213                 hdrs="$define sys/types.h
14214                         $d_socket sys/socket.h 
14215                         $i_niin netinet/in.h 
14216                         $i_netdb netdb.h
14217                         $i_unistd unistd.h"
14218                 : The first arg can 'char *' or 'void *'
14219                 : The second arg is some of integral type
14220                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14221                         for yyy in size_t long int; do
14222                                 case "$netdb_host_type" in
14223                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14224                                         if ./protochk "$try" $hdrs; then
14225                                                 echo "Your system accepts $xxx for the first arg."
14226                                                 echo "...and $yyy for the second arg."
14227                                                 netdb_host_type="$xxx"
14228                                                 netdb_hlen_type="$yyy"
14229                                         fi
14230                                         ;;
14231                                 esac
14232                         done
14233                 done
14234                 : In case none of those worked, prompt the user.
14235                 case "$netdb_host_type" in
14236                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14237                         dflt='char *'
14238                         . ./myread
14239                         netdb_host_type=$ans
14240                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14241                         dflt="$sizetype"
14242                         . ./myread
14243                         netdb_hlen_type=$ans
14244                         ;;
14245                 esac
14246                 ;;
14247         *)      : no gethostbyaddr, so pick harmless defaults
14248                 netdb_host_type='char *'
14249                 netdb_hlen_type="$sizetype"
14250                 ;;
14251         esac
14252         # Remove the "const" if needed. -- but then we'll have a 
14253         # prototype clash!
14254         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14255 fi
14256
14257 : check for type of argument to gethostbyname. 
14258 if test "X$netdb_name_type" = X ; then
14259         case "$d_gethbyname" in
14260         $define)
14261                 $cat <<EOM
14262
14263 Checking to see what type of argument is accepted by gethostbyname().
14264 EOM
14265                 hdrs="$define sys/types.h
14266                         $d_socket sys/socket.h 
14267                         $i_niin netinet/in.h 
14268                         $i_netdb netdb.h
14269                         $i_unistd unistd.h"
14270                 for xxx in "const char *" "char *"; do
14271                         case "$netdb_name_type" in
14272                         '')     try="extern struct hostent *gethostbyname($xxx);"
14273                                 if ./protochk "$try" $hdrs; then
14274                                         echo "Your system accepts $xxx."
14275                                         netdb_name_type="$xxx"
14276                                 fi
14277                                 ;;
14278                         esac
14279                 done
14280                 : In case none of those worked, prompt the user.
14281                 case "$netdb_name_type" in
14282                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14283                         dflt='char *'
14284                         . ./myread
14285                         netdb_name_type=$ans
14286                         ;;
14287                 esac
14288                 ;;
14289         *)      : no gethostbyname, so pick harmless default
14290                 netdb_name_type='char *'
14291                 ;;
14292         esac
14293 fi
14294
14295 : check for type of 1st argument to getnetbyaddr. 
14296 if test "X$netdb_net_type" = X ; then
14297         case "$d_getnbyaddr" in
14298         $define)
14299                 $cat <<EOM
14300
14301 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14302 EOM
14303                 hdrs="$define sys/types.h
14304                         $d_socket sys/socket.h 
14305                         $i_niin netinet/in.h 
14306                         $i_netdb netdb.h
14307                         $i_unistd unistd.h"
14308                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14309                         case "$netdb_net_type" in
14310                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14311                                 if ./protochk "$try" $hdrs; then
14312                                         echo "Your system accepts $xxx."
14313                                         netdb_net_type="$xxx"
14314                                 fi
14315                                 ;;
14316                         esac
14317                 done
14318                 : In case none of those worked, prompt the user.
14319                 case "$netdb_net_type" in
14320                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14321                         dflt='long'
14322                         . ./myread
14323                         netdb_net_type=$ans
14324                         ;;
14325                 esac
14326                 ;;
14327         *)      : no getnetbyaddr, so pick harmless default
14328                 netdb_net_type='long'
14329                 ;;
14330         esac
14331 fi
14332 : locate the preferred pager for this system
14333 case "$pager" in
14334 '')
14335         dflt=''
14336         case "$pg" in
14337         /*) dflt=$pg;;
14338         [a-zA-Z]:/*) dflt=$pg;;
14339         esac
14340         case "$more" in
14341         /*) dflt=$more;;
14342         [a-zA-Z]:/*) dflt=$more;;
14343         esac
14344         case "$less" in
14345         /*) dflt=$less;;
14346         [a-zA-Z]:/*) dflt=$less;;
14347         esac
14348         case "$dflt" in
14349         '') dflt=/usr/ucb/more;;
14350         esac
14351         ;;
14352 *) dflt="$pager";;
14353 esac
14354 echo " "
14355 fn=f/
14356 rp='What pager is used on your system?'
14357 . ./getfile
14358 pager="$ans"
14359
14360 : see what type pids are declared as in the kernel
14361 rp="What is the type of process ids on this system?"
14362 set pid_t pidtype int stdio.h sys/types.h
14363 eval $typedef_ask
14364
14365 : Find earliest binary compatible site_perl subdirectory perl can use.
14366 case "$bincompat5005" in
14367 "$define") xs_apiversion='5.005' ;;
14368 *) xs_apiversion=$version ;;   # The current site_perl version.
14369 esac
14370 : Find earliest pure perl site_perl subdirectory perl can use.
14371 : The versioned directories started at 5.005.
14372 pm_apiversion='5.005'
14373
14374 : see if ar generates random libraries by itself
14375 echo " "
14376 echo "Checking how to generate random libraries on your machine..." >&4
14377 echo 'int bar1() { return bar2(); }' > bar1.c
14378 echo 'int bar2() { return 2; }' > bar2.c
14379 $cat > foo.c <<'EOP'
14380 int main() { printf("%d\n", bar1()); exit(0); }
14381 EOP
14382 $cc $ccflags -c bar1.c >/dev/null 2>&1
14383 $cc $ccflags -c bar2.c >/dev/null 2>&1
14384 $cc $ccflags -c foo.c >/dev/null 2>&1
14385 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14386 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14387         ./foobar >/dev/null 2>&1; then
14388         echo "$ar appears to generate random libraries itself."
14389         orderlib=false
14390         ranlib=":"
14391 elif $ar ts bar$_a >/dev/null 2>&1 &&
14392         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14393         ./foobar >/dev/null 2>&1; then
14394                 echo "a table of contents needs to be added with '$ar ts'."
14395                 orderlib=false
14396                 ranlib="$ar ts"
14397 else
14398         case "$ranlib" in
14399         :) ranlib='';;
14400         '')
14401                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14402                 $test -f $ranlib || ranlib=''
14403                 ;;
14404         esac
14405         if $test -n "$ranlib"; then
14406                 echo "your system has '$ranlib'; we'll use that."
14407                 orderlib=false
14408         else
14409                 echo "your system doesn't seem to support random libraries"
14410                 echo "so we'll use lorder and tsort to order the libraries."
14411                 orderlib=true
14412                 ranlib=":"
14413         fi
14414 fi
14415 $rm -f foo* bar* 
14416
14417 : check for type of arguments to select. 
14418 case "$selecttype" in
14419 '') case "$d_select" in
14420         $define)
14421                 echo " "
14422                 $cat <<EOM
14423 Checking to see what type of arguments are accepted by select().
14424 EOM
14425                 hdrs="$define sys/types.h
14426                         $i_systime sys/time.h 
14427                         $i_sysselct sys/select.h
14428                         $d_socket sys/socket.h"
14429                 : The first arg can be int, unsigned, or size_t
14430                 : The last arg may or may not be 'const'
14431                 val=''
14432                 : void pointer has been seen but using that
14433                 : breaks the selectminbits test
14434                 for xxx in 'fd_set *' 'int *'; do
14435                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14436                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14437                                         case "$val" in
14438                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14439                                                 if ./protochk "$try" $hdrs; then
14440                                                         echo "Your system accepts $xxx."
14441                                                         val="$xxx"
14442                                                 fi
14443                                                 ;;
14444                                         esac
14445                                 done
14446                         done
14447                 done
14448                 case "$val" in
14449                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14450                         case "$d_fd_set" in
14451                                 $define) dflt="fd_set *" ;;
14452                                 *)              dflt="int *" ;;
14453                         esac
14454                         . ./myread
14455                         val=$ans
14456                         ;;
14457                 esac
14458                 selecttype="$val"
14459                 ;;
14460         *)      : no select, so pick a harmless default
14461                 selecttype='int *'
14462                 ;;
14463         esac
14464         ;;
14465 esac
14466
14467 : check for the select 'width'
14468 case "$selectminbits" in
14469 '') case "$d_select" in
14470         $define)
14471                 $cat <<EOM
14472
14473 Checking to see on how many bits at a time your select() operates...
14474 EOM
14475                 $cat >try.c <<EOCP
14476 #include <sys/types.h>
14477 #$i_time I_TIME
14478 #$i_systime I_SYS_TIME
14479 #$i_systimek I_SYS_TIME_KERNEL
14480 #ifdef I_TIME
14481 #   include <time.h>
14482 #endif
14483 #ifdef I_SYS_TIME
14484 #   ifdef I_SYS_TIME_KERNEL
14485 #       define KERNEL
14486 #   endif
14487 #   include <sys/time.h>
14488 #   ifdef I_SYS_TIME_KERNEL
14489 #       undef KERNEL
14490 #   endif
14491 #endif
14492 #$i_sysselct I_SYS_SELECT
14493 #ifdef I_SYS_SELECT
14494 #include <sys/select.h>
14495 #endif
14496 #$d_socket HAS_SOCKET
14497 #ifdef HAS_SOCKET
14498 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14499 #endif
14500 #include <stdio.h>
14501 $selecttype b;
14502 #define S sizeof(*(b))
14503 #define MINBITS 64
14504 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14505 #define NBITS  (NBYTES * 8)
14506 int main() {
14507     char s[NBYTES];
14508     struct timeval t;
14509     int i;
14510     FILE* fp;
14511     int fd;
14512
14513     fclose(stdin);
14514     fp = fopen("try.c", "r");
14515     if (fp == 0)
14516       exit(1);
14517     fd = fileno(fp);
14518     if (fd < 0)
14519       exit(2);
14520     b = ($selecttype)s;
14521     for (i = 0; i < NBITS; i++)
14522         FD_SET(i, b);
14523     t.tv_sec  = 0;
14524     t.tv_usec = 0;
14525     select(fd + 1, b, 0, 0, &t);
14526     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14527     printf("%d\n", i + 1);
14528     return 0;
14529 }
14530 EOCP
14531                 set try
14532                 if eval $compile_ok; then
14533                         selectminbits=`./try`
14534                         case "$selectminbits" in
14535                         '')     cat >&4 <<EOM
14536 Cannot figure out on how many bits at a time your select() operates.
14537 I'll play safe and guess it is 32 bits.
14538 EOM
14539                                 selectminbits=32
14540                                 bits="32 bits"
14541                                 ;;
14542                         1)      bits="1 bit" ;;
14543                         *)      bits="$selectminbits bits" ;;
14544                         esac
14545                         echo "Your select() operates on $bits at a time." >&4
14546                 else
14547                         rp='What is the minimum number of bits your select() operates on?'
14548                         case "$byteorder" in
14549                         1234|12345678)  dflt=32 ;;
14550                         *)              dflt=1  ;;
14551                         esac
14552                         . ./myread
14553                         val=$ans
14554                         selectminbits="$val"
14555                 fi
14556                 $rm -f try.* try
14557                 ;;
14558         *)      : no select, so pick a harmless default
14559                 selectminbits='32'
14560                 ;;
14561         esac
14562         ;;
14563 esac
14564
14565 : Trace out the files included by signal.h, then look for SIGxxx names.
14566 : Remove SIGARRAYSIZE used by HPUX.
14567 : Remove SIGSTKSIZE used by Linux.
14568 : Remove SIGSTKSZ used by Posix.
14569 : Remove SIGTYP void lines used by OS2.
14570 : Some cpps, like os390, dont give the file name anywhere
14571 if [ "X$fieldn" = X ]; then
14572         : Just make some guesses.  We check them later.
14573         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14574 else
14575         xxx=`echo '#include <signal.h>' |
14576         $cppstdin $cppminus $cppflags 2>/dev/null |
14577         $grep '^[       ]*#.*include' | 
14578         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14579 fi
14580 : Check this list of files to be sure we have parsed the cpp output ok.
14581 : This will also avoid potentially non-existent files, such 
14582 : as ../foo/bar.h
14583 xxxfiles=''
14584 for xx in $xxx /dev/null ; do
14585         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14586 done
14587 : If we have found no files, at least try signal.h
14588 case "$xxxfiles" in
14589 '')     xxxfiles=`./findhdr signal.h` ;;
14590 esac
14591 xxx=`awk '
14592 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14593         print substr($2, 4, 20)
14594 }
14595 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14596         print substr($3, 4, 20)
14597 }' $xxxfiles`
14598 : Append some common names just in case the awk scan failed.
14599 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14600 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14601 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14602 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14603 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14604
14605 : generate a few handy files for later
14606 $cat > signal.c <<'EOCP'
14607 #include <sys/types.h>
14608 #include <signal.h>
14609 #include <stdio.h>
14610 int main() {
14611
14612 /* Strange style to avoid deeply-nested #if/#else/#endif */
14613 #ifndef NSIG
14614 #  ifdef _NSIG
14615 #    define NSIG (_NSIG)
14616 #  endif
14617 #endif
14618
14619 #ifndef NSIG
14620 #  ifdef SIGMAX
14621 #    define NSIG (SIGMAX+1)
14622 #  endif
14623 #endif
14624
14625 #ifndef NSIG
14626 #  ifdef SIG_MAX
14627 #    define NSIG (SIG_MAX+1)
14628 #  endif
14629 #endif
14630
14631 #ifndef NSIG
14632 #  ifdef MAXSIG
14633 #    define NSIG (MAXSIG+1)
14634 #  endif
14635 #endif
14636
14637 #ifndef NSIG
14638 #  ifdef MAX_SIG
14639 #    define NSIG (MAX_SIG+1)
14640 #  endif
14641 #endif
14642
14643 #ifndef NSIG
14644 #  ifdef SIGARRAYSIZE
14645 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14646 #  endif
14647 #endif
14648
14649 #ifndef NSIG
14650 #  ifdef _sys_nsig
14651 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14652 #  endif
14653 #endif
14654
14655 /* Default to some arbitrary number that's big enough to get most
14656    of the common signals.
14657 */
14658 #ifndef NSIG
14659 #    define NSIG 50
14660 #endif
14661
14662 printf("NSIG %d\n", NSIG);
14663
14664 #ifndef JUST_NSIG
14665
14666 EOCP
14667
14668 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14669 {
14670         printf "#ifdef SIG"; printf $1; printf "\n"
14671         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14672         printf $1; printf ");\n"
14673         printf "#endif\n"
14674 }
14675 END {
14676         printf "#endif /* JUST_NSIG */\n";
14677         printf "exit(0);\n}\n";
14678 }
14679 ' >>signal.c
14680 $cat >signal.awk <<'EOP'
14681 BEGIN { ndups = 0 }
14682 $1 ~ /^NSIG$/ { nsig = $2 }
14683 ($1 !~ /^NSIG$/) && (NF == 2) {
14684     if ($2 > maxsig) { maxsig = $2 }
14685     if (sig_name[$2]) {
14686         dup_name[ndups] = $1
14687         dup_num[ndups] = $2
14688         ndups++ 
14689     }
14690     else {
14691         sig_name[$2] = $1
14692         sig_num[$2] = $2
14693     }
14694 }
14695 END { 
14696     if (nsig == 0) {
14697         nsig = maxsig + 1
14698     }
14699     printf("NSIG %d\n", nsig);
14700     for (n = 1; n < nsig; n++) {
14701         if (sig_name[n]) {
14702             printf("%s %d\n", sig_name[n], sig_num[n])
14703         }
14704         else {
14705             printf("NUM%d %d\n", n, n) 
14706         }
14707     }
14708     for (n = 0; n < ndups; n++) {
14709         printf("%s %d\n", dup_name[n], dup_num[n])
14710     }
14711 }
14712 EOP
14713 $cat >signal_cmd <<EOS
14714 $startsh
14715 if $test -s signal.lst; then
14716     echo "Using your existing signal.lst file"
14717         exit 0
14718 fi
14719 xxx="$xxx"
14720 EOS
14721 $cat >>signal_cmd <<'EOS'
14722
14723 set signal
14724 if eval $compile_ok; then
14725         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14726 else
14727         echo "(I can't seem be able to compile the whole test program)" >&4
14728         echo "(I'll try it in little pieces.)" >&4
14729         set signal -DJUST_NSIG
14730         if eval $compile_ok; then
14731                 ./signal$_exe > signal.nsg
14732                 $cat signal.nsg
14733         else
14734                 echo "I can't seem to figure out how many signals you have." >&4
14735                 echo "Guessing 50." >&4
14736                 echo 'NSIG 50' > signal.nsg
14737         fi
14738         : Now look at all the signal names, one at a time.
14739         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14740                 $cat > signal.c <<EOCP
14741 #include <sys/types.h>
14742 #include <signal.h>
14743 #include <stdio.h>
14744 int main() {
14745 printf("$xx %d\n", SIG${xx});
14746 return 0;
14747 }
14748 EOCP
14749                 set signal
14750                 if eval $compile; then
14751                         echo "SIG${xx} found."
14752                         ./signal$_exe  >> signal.ls1
14753                 else
14754                         echo "SIG${xx} NOT found."
14755                 fi
14756         done
14757         if $test -s signal.ls1; then
14758                 $cat signal.nsg signal.ls1 |
14759                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14760         fi
14761
14762 fi
14763 if $test -s signal.lst; then
14764         :
14765 else
14766         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14767         echo 'kill -l' >signal
14768         set X `csh -f <signal`
14769         $rm -f signal
14770         shift
14771         case $# in
14772         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14773         esac
14774         echo $@ | $tr ' ' $trnl | \
14775             $awk '{ printf "%s %d\n", $1, ++s; }
14776                   END { printf "NSIG %d\n", ++s }' >signal.lst
14777 fi
14778 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14779 EOS
14780 chmod a+x signal_cmd
14781 $eunicefix signal_cmd
14782
14783 : generate list of signal names
14784 echo " "
14785 case "$sig_name_init" in
14786 '') doinit=yes ;;
14787 *)  case "$sig_num_init" in
14788     ''|*,*) doinit=yes ;;
14789     esac ;;
14790 esac
14791 case "$doinit" in
14792 yes)
14793         echo "Generating a list of signal names and numbers..." >&4
14794         . ./signal_cmd
14795         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14796         sig_name=`$awk 'BEGIN { printf "ZERO " }
14797                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14798         sig_num=`$awk  'BEGIN { printf "0 " }
14799                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14800         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14801                              !/^NSIG/   { printf "\"%s\", ", $1 }
14802                              END        { printf "0\n" }' signal.lst`
14803         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14804                              !/^NSIG/   { printf "%d, ", $2}
14805                              END        { printf "0\n"}' signal.lst`
14806         ;;
14807 esac
14808 echo "The following $sig_count signals are available:"
14809 echo " "
14810 echo $sig_name | $awk \
14811 'BEGIN { linelen = 0 }
14812 {
14813         for (i = 1; i <= NF; i++) {
14814                 name = "SIG" $i " "
14815                 linelen = linelen + length(name)
14816                 if (linelen > 70) {
14817                         printf "\n"
14818                         linelen = length(name)
14819                 }
14820                 printf "%s", name
14821         }
14822         printf "\n"
14823 }'
14824 sig_size=`echo $sig_name | awk '{print NF}'`
14825 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14826
14827 echo " "
14828 case "$sizetype" in
14829 *_t) zzz="$sizetype"    ;;
14830 *)   zzz="filesize"     ;;
14831 esac
14832 echo "Checking the size of $zzz..." >&4 
14833 cat > try.c <<EOCP
14834 #include <sys/types.h>
14835 #include <stdio.h>
14836 int main() {
14837     printf("%d\n", (int)sizeof($sizetype));
14838     exit(0);
14839 }
14840 EOCP
14841 set try
14842 if eval $compile_ok; then
14843         yyy=`./try`
14844         case "$yyy" in
14845         '')     sizesize=4
14846                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14847                 ;;
14848         *)      sizesize=$yyy
14849                 echo "Your $zzz size is $sizesize bytes."
14850                 ;;
14851         esac
14852 else
14853         sizesize=4
14854         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14855 fi
14856
14857
14858 : check for socklen_t
14859 echo " "
14860 echo "Checking to see if you have socklen_t..." >&4
14861 $cat >try.c <<EOCP
14862 #include <sys/types.h>
14863 #$d_socket HAS_SOCKET
14864 #ifdef HAS_SOCKET
14865 #include <sys/socket.h>
14866 #endif
14867 int main() { socklen_t x = 16; }
14868 EOCP
14869 set try
14870 if eval $compile; then
14871         val="$define"
14872         echo "You have socklen_t."
14873 else
14874         val="$undef"
14875         echo "You do not have socklen_t."
14876         case "$sizetype" in
14877         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14878         esac
14879 fi
14880 $rm -f try try.*
14881 set d_socklen_t
14882 eval $setvar
14883
14884 : see if this is a socks.h system
14885 set socks.h i_socks
14886 eval $inhdr
14887
14888 : check for type of the size argument to socket calls
14889 case "$d_socket" in
14890 "$define")
14891         $cat <<EOM
14892
14893 Checking to see what type is the last argument of accept().
14894 EOM
14895         yyy=''
14896         case "$d_socklen_t" in
14897         "$define") yyy="$yyy socklen_t"
14898         esac
14899         yyy="$yyy $sizetype int long unsigned"
14900         for xxx in $yyy; do
14901                 case "$socksizetype" in
14902                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14903                         case "$usesocks" in
14904                         "$define")
14905                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14906                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14907                                         socksizetype="$xxx"
14908                                 fi
14909                                 ;;
14910                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14911                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14912                                         socksizetype="$xxx"
14913                                 fi
14914                                 ;;
14915                         esac
14916                         ;;
14917                 esac
14918         done
14919 : In case none of those worked, prompt the user.
14920         case "$socksizetype" in
14921         '')     rp='What is the type for socket address structure sizes?'
14922                 dflt='int'
14923                 . ./myread
14924                 socksizetype=$ans
14925                 ;;
14926         esac
14927         ;;
14928 *)      : no sockets, so pick relatively harmless default
14929         socksizetype='int'
14930         ;;
14931 esac
14932
14933 : see what type is used for signed size_t
14934 set ssize_t ssizetype int stdio.h sys/types.h
14935 eval $typedef
14936 dflt="$ssizetype"
14937 $cat > ssize.c <<EOM
14938 #include <stdio.h>
14939 #include <sys/types.h>
14940 #define Size_t $sizetype
14941 #define SSize_t $dflt
14942 int main()
14943 {
14944         if (sizeof(Size_t) == sizeof(SSize_t))
14945                 printf("$dflt\n");
14946         else if (sizeof(Size_t) == sizeof(int))
14947                 printf("int\n");
14948         else 
14949                 printf("long\n");
14950         exit(0);
14951 }
14952 EOM
14953 echo " "
14954 set ssize
14955 if eval $compile_ok && ./ssize > /dev/null; then
14956         ssizetype=`./ssize`
14957         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14958 else
14959         $cat >&4 <<EOM
14960 Help! I can't compile and run the ssize_t test program: please enlighten me!
14961 (This is probably a misconfiguration in your system or libraries, and
14962 you really ought to fix it.  Still, I'll try anyway.)
14963
14964 I need a type that is the same size as $sizetype, but is guaranteed to
14965 be signed.  Common values are ssize_t, int and long.
14966
14967 EOM
14968         rp="What signed type is the same size as $sizetype?"
14969         . ./myread
14970         ssizetype="$ans"
14971 fi
14972 $rm -f ssize ssize.*
14973
14974 : see what type of char stdio uses.
14975 echo " "
14976 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14977 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14978         echo "Your stdio uses unsigned chars." >&4
14979         stdchar="unsigned char"
14980 else
14981         echo "Your stdio uses signed chars." >&4
14982         stdchar="char"
14983 fi
14984 $rm -f stdioh
14985
14986
14987
14988 : see if time exists
14989 echo " "
14990 if test "X$d_time" = X -o X"$timetype" = X; then
14991     if set time val -f d_time; eval $csym; $val; then
14992                 echo 'time() found.' >&4
14993                 val="$define"
14994                 rp="What is the type returned by time() on this system?"
14995                 set time_t timetype long stdio.h sys/types.h
14996                 eval $typedef_ask
14997     else
14998                 echo 'time() not found, hope that will do.' >&4
14999                 val="$undef"
15000                 timetype='int';
15001     fi
15002     set d_time
15003     eval $setvar
15004 fi
15005
15006 : see what type uids are declared as in the kernel
15007 echo " "
15008 echo "Looking for the type for user ids returned by getuid()."
15009 set uid_t uidtype xxx stdio.h sys/types.h
15010 eval $typedef
15011 case "$uidtype" in
15012 xxx)
15013         xxx=`./findhdr sys/user.h`
15014         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15015         case $1 in
15016         unsigned) dflt="$1 $2" ;;
15017         *) dflt="$1" ;;
15018         esac
15019         ;;
15020 *) dflt="$uidtype";;
15021 esac
15022 case "$uidtype" in
15023 uid_t)  echo "uid_t found." ;;
15024 *)      rp="What is the type for user ids returned by getuid()?"
15025         . ./myread
15026         uidtype="$ans"
15027         ;;
15028 esac
15029
15030 echo " "
15031 case "$uidtype" in
15032 *_t) zzz="$uidtype"     ;;
15033 *)   zzz="uid"          ;;
15034 esac
15035 echo "Checking the size of $zzz..." >&4 
15036 cat > try.c <<EOCP
15037 #include <sys/types.h>
15038 #include <stdio.h>
15039 int main() {
15040     printf("%d\n", (int)sizeof($uidtype));
15041     exit(0);
15042 }
15043 EOCP
15044 set try
15045 if eval $compile_ok; then
15046         yyy=`./try`
15047         case "$yyy" in
15048         '')     uidsize=4
15049                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15050                 ;;
15051         *)      uidsize=$yyy
15052                 echo "Your $zzz is $uidsize bytes long."
15053                 ;;
15054         esac
15055 else
15056         uidsize=4
15057         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15058 fi
15059
15060 echo " "
15061 case "$uidtype" in
15062 *_t) zzz="$uidtype"     ;;
15063 *)   zzz="uid"          ;;
15064 esac
15065 echo "Checking the sign of $zzz..." >&4
15066 cat > try.c <<EOCP
15067 #include <sys/types.h>
15068 #include <stdio.h>
15069 int main() {
15070         $uidtype foo = -1;
15071         if (foo < 0)
15072                 printf("-1\n");
15073         else
15074                 printf("1\n");
15075 }
15076 EOCP
15077 set try
15078 if eval $compile; then
15079         yyy=`./try`
15080         case "$yyy" in
15081         '')     uidsign=1
15082                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15083                 ;;
15084         *)      uidsign=$yyy
15085                 case "$uidsign" in
15086                  1) echo "Your $zzz is unsigned." ;;
15087                 -1) echo "Your $zzz is signed."   ;;
15088                 esac
15089                 ;;
15090         esac
15091 else
15092         uidsign=1
15093         echo "(I can't compile the test program--guessing unsigned.)" >&4
15094 fi
15095
15096
15097
15098 echo " "
15099 $echo "Checking the format string to be used for uids..." >&4
15100
15101 case "$uidsign" in
15102 -1)     if $test X"$uidsize" = X"$ivsize"; then
15103                 uidformat="$ivdformat"
15104         else
15105                 if $test X"$uidsize" = X"$longsize"; then
15106                         uidformat='"ld"'
15107                 else
15108                         if $test X"$uidsize" = X"$intsize"; then
15109                                 uidformat='"d"'
15110                         else
15111                                 if $test X"$uidsize" = X"$shortsize"; then
15112                                         uidformat='"hd"'
15113                                 fi
15114                         fi
15115                 fi
15116         fi
15117         ;;
15118 *)      if $test X"$uidsize" = X"$uvsize"; then
15119                 uidformat="$uvuformat"
15120         else
15121                 if $test X"$uidsize" = X"$longsize"; then
15122                         uidformat='"lu"'
15123                 else
15124                         if $test X"$uidsize" = X"$intsize"; then
15125                                 uidformat='"u"'
15126                         else
15127                                 if $test X"$uidsize" = X"$shortsize"; then
15128                                         uidformat='"hu"'
15129                                 fi
15130                         fi
15131                 fi
15132         fi
15133         ;;
15134 esac
15135
15136 : determine compiler compiler
15137 case "$yacc" in
15138 '')
15139         dflt=yacc;;
15140 *)
15141         dflt="$yacc";;
15142 esac
15143 echo " "
15144 comp='yacc'
15145 if $test -f "$byacc"; then
15146         dflt="$byacc"
15147         comp="byacc or $comp"
15148 fi
15149 if $test -f "$bison"; then
15150         comp="$comp or bison -y"
15151 fi
15152 rp="Which compiler compiler ($comp) shall I use?"
15153 . ./myread
15154 yacc="$ans"
15155 case "$yacc" in
15156 *bis*)
15157         case "$yacc" in
15158         *-y*) ;;
15159         *)
15160                 yacc="$yacc -y"
15161                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15162                 ;;
15163         esac
15164         ;;
15165 esac
15166
15167 : see if dbm.h is available
15168 : see if dbmclose exists
15169 set dbmclose d_dbmclose
15170 eval $inlibc
15171
15172 case "$d_dbmclose" in
15173 $define)
15174         set dbm.h i_dbm
15175         eval $inhdr
15176         case "$i_dbm" in
15177         $define)
15178                 val="$undef"
15179                 set i_rpcsvcdbm
15180                 eval $setvar
15181                 ;;
15182         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15183                 eval $inhdr
15184                 ;;
15185         esac
15186         ;;
15187 *)      echo "We won't be including <dbm.h>"
15188         val="$undef"
15189         set i_dbm
15190         eval $setvar
15191         val="$undef"
15192         set i_rpcsvcdbm
15193         eval $setvar
15194         ;;
15195 esac
15196
15197 : see if this is a sys/file.h system
15198 val=''
15199 set sys/file.h val
15200 eval $inhdr
15201
15202 : do we need to include sys/file.h ?
15203 case "$val" in
15204 "$define")
15205         echo " "
15206         if $h_sysfile; then
15207                 val="$define"
15208                 echo "We'll be including <sys/file.h>." >&4
15209         else
15210                 val="$undef"
15211                 echo "We won't be including <sys/file.h>." >&4
15212         fi
15213         ;;
15214 *)
15215         h_sysfile=false
15216         ;;
15217 esac
15218 set i_sysfile
15219 eval $setvar
15220
15221 : see if fcntl.h is there
15222 val=''
15223 set fcntl.h val
15224 eval $inhdr
15225
15226 : see if we can include fcntl.h
15227 case "$val" in
15228 "$define")
15229         echo " "
15230         if $h_fcntl; then
15231                 val="$define"
15232                 echo "We'll be including <fcntl.h>." >&4
15233         else
15234                 val="$undef"
15235                 if $h_sysfile; then
15236         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15237                 else
15238                         echo "We won't be including <fcntl.h>." >&4
15239                 fi
15240         fi
15241         ;;
15242 *)
15243         h_fcntl=false
15244         val="$undef"
15245         ;;
15246 esac
15247 set i_fcntl
15248 eval $setvar
15249
15250 : see if this is a iconv.h system
15251 set iconv.h i_iconv
15252 eval $inhdr
15253
15254 : see if this is a ieeefp.h system
15255 set ieeefp.h i_ieeefp
15256 eval $inhdr
15257
15258 : see if this is a libutil.h system
15259 set libutil.h i_libutil
15260 eval $inhdr
15261
15262 : see if locale.h is available
15263 set locale.h i_locale
15264 eval $inhdr
15265
15266 : see if mach cthreads are available
15267 if test "X$usethreads" = "X$define"; then
15268         set mach/cthreads.h i_machcthr
15269         eval $inhdr
15270 else
15271         i_machcthr="$undef"
15272 fi
15273
15274
15275
15276 : see if this is a math.h system
15277 set math.h i_math
15278 eval $inhdr
15279
15280 : see if this is a mntent.h system
15281 set mntent.h i_mntent
15282 eval $inhdr
15283
15284 : see if ndbm.h is available
15285 set ndbm.h t_ndbm
15286 eval $inhdr
15287 case "$t_ndbm" in
15288 $define)
15289         : see if dbm_open exists
15290         set dbm_open d_dbm_open
15291         eval $inlibc
15292         case "$d_dbm_open" in
15293         $undef)
15294                 t_ndbm="$undef"
15295                 echo "We won't be including <ndbm.h>"
15296                 ;;
15297         esac
15298         ;;
15299 esac
15300 val="$t_ndbm"
15301 set i_ndbm
15302 eval $setvar
15303
15304 : see if net/errno.h is available
15305 val=''
15306 set net/errno.h val
15307 eval $inhdr
15308
15309 : Unfortunately, it causes problems on some systems.  Arrgh.
15310 case "$val" in
15311 $define)
15312         cat > try.c <<'EOM'
15313 #include <stdio.h>
15314 #include <errno.h>
15315 #include <net/errno.h>
15316 int func()
15317 {
15318         return ENOTSOCK;
15319 }
15320 EOM
15321         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15322                 echo "We'll be including <net/errno.h>." >&4
15323         else
15324                 echo "We won't be including <net/errno.h>." >&4
15325                 val="$undef"
15326         fi
15327         $rm -f try.* try
15328         ;;
15329 esac
15330 set i_neterrno
15331 eval $setvar
15332
15333 : see if netinet/tcp.h is available
15334 set netinet/tcp.h i_netinettcp
15335 eval $inhdr
15336
15337 : see if this is a poll.h system
15338 set poll.h i_poll
15339 eval $inhdr
15340
15341 : see if this is a prot.h system
15342 set prot.h i_prot
15343 eval $inhdr
15344
15345 echo " "
15346 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15347 $cat <<'EOSH' > Cppsym.know
15348 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15349 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15350 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15351 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15352 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15353 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15354 bull c cadmus clipper CMU COFF COMPILER_VERSION
15355 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15356 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15357 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15358 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15359 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15360 H3050R H3050RX hbullx20 hcx host_mips
15361 hp200 hp300 hp700 HP700 hp800 hp9000
15362 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15363 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15364 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15365 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15366 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15367 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15368 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15369 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15370 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15371 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15372 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15373 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15374 MATH_HAS_NO_SIDE_EFFECTS
15375 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15376 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15377 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15378 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15379 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15380 NetBSD news1500 news1700 news1800 news1900 news3700
15381 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15382 ns32016 ns32332 ns32k nsc32000
15383 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15384 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15385 pc532 pdp11 PGC PIC plexus PORTAR posix
15386 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15387 POSIX_C_SOURCE POSIX_SOURCE POWER
15388 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15389 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15390 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15391 sony sony_news sonyrisc sparc sparclite spectrum
15392 stardent stdc STDC_EXT stratos sun sun3 sun386
15393 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15394 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15395 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15396 sysV68 sysV88 Tek4132 Tek4300 titan
15397 TM3200 TM5400 TM5600
15398 tower tower32 tower32_200 tower32_600 tower32_700
15399 tower32_800 tower32_850 tss
15400 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15401 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15402 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15403 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15404 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15405 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15406 z8000
15407 EOSH
15408 # Maybe put other stuff here too.
15409 cat <<EOSH >>Cppsym.know
15410 $osname
15411 EOSH
15412 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15413 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15414 $cat Cppsym.know > Cppsym.c
15415 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15416 $rm -f Cppsym.a Cppsym.b Cppsym.c
15417 cat <<EOSH > Cppsym
15418 $startsh
15419 if $test \$# -gt 0; then
15420     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15421     if $test -s Cppsym.got; then
15422         $rm -f Cppsym.got
15423         exit 0
15424     fi
15425     $rm -f Cppsym.got
15426     exit 1
15427 else
15428     $tr " " "$trnl" | ./Cppsym.try
15429     exit 0
15430 fi
15431 EOSH
15432 chmod +x Cppsym
15433 $eunicefix Cppsym
15434 cat <<EOSH > Cppsym.try
15435 $startsh
15436 cat <<'EOCP' > try.c
15437 #include <stdio.h>
15438 int main() {
15439 EOCP
15440 $awk \\
15441 EOSH
15442 cat <<'EOSH' >> Cppsym.try
15443 'length($1) > 0 {
15444     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15445     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15446     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15447     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15448 }'       >> try.c
15449 echo '}' >> try.c
15450 EOSH
15451 cat <<EOSH >> Cppsym.try
15452 ccflags="$ccflags"
15453 case "$osname-$gccversion" in
15454 irix-) ccflags="\$ccflags -woff 1178" ;;
15455 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15456 esac
15457 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15458 EOSH
15459 chmod +x Cppsym.try
15460 $eunicefix Cppsym.try
15461 ./Cppsym < Cppsym.know > Cppsym.true
15462 : now check the C compiler for additional symbols
15463 postprocess_cc_v=''
15464 case "$osname" in
15465 aix) postprocess_cc_v="|$tr , ' '" ;;
15466 esac
15467 $cat >ccsym <<EOS
15468 $startsh
15469 $cat >tmp.c <<EOF
15470 extern int foo;
15471 EOF
15472 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15473 do
15474         case "\$i" in
15475         -D*) echo "\$i" | $sed 's/^-D//';;
15476         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15477         esac
15478 done
15479 $rm -f try.c
15480 EOS
15481 postprocess_cc_v=''
15482 chmod +x ccsym
15483 $eunicefix ccsym
15484 ./ccsym > ccsym1.raw
15485 if $test -s ccsym1.raw; then
15486        $sort ccsym1.raw | $uniq >ccsym.raw
15487 else
15488        mv ccsym1.raw ccsym.raw
15489 fi
15490
15491 $awk '/\=/ { print $0; next }
15492         { print $0"=1" }' ccsym.raw >ccsym.list
15493 $awk '/\=/ { print $0; next }
15494         { print $0"=1" }' Cppsym.true >ccsym.true
15495 $comm -13 ccsym.true ccsym.list >ccsym.own
15496 $comm -12 ccsym.true ccsym.list >ccsym.com
15497 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15498 also=''
15499 if $test -z ccsym.raw; then
15500         echo "Your C compiler doesn't seem to define any symbols!" >&4
15501         echo " "
15502         echo "However, your C preprocessor defines the following symbols:"
15503         $cat Cppsym.true
15504         ccsymbols=''
15505         cppsymbols=`$cat Cppsym.true`
15506         cppsymbols=`echo $cppsymbols`
15507         cppccsymbols="$cppsymbols"
15508 else
15509         if $test -s ccsym.com; then
15510                 echo "Your C compiler and pre-processor define these symbols:"
15511                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15512                 also='also '
15513                 symbols='ones'
15514                 cppccsymbols=`$cat ccsym.com`
15515                 cppccsymbols=`echo $cppccsymbols`
15516                 $test "$silent" || sleep 1
15517         fi
15518         if $test -s ccsym.cpp; then
15519                 $test "$also" && echo " "
15520                 echo "Your C pre-processor ${also}defines the following symbols:"
15521                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15522                 also='further '
15523                 cppsymbols=`$cat ccsym.cpp`
15524                 cppsymbols=`echo $cppsymbols`
15525                 $test "$silent" || sleep 1
15526         fi
15527         if $test -s ccsym.own; then
15528                 $test "$also" && echo " "
15529                 echo "Your C compiler ${also}defines the following cpp symbols:"
15530                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15531                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15532                 ccsymbols=`$cat ccsym.own`
15533                 ccsymbols=`echo $ccsymbols`
15534                 $test "$silent" || sleep 1
15535         fi
15536 fi
15537 $rm -f ccsym* Cppsym.*
15538
15539 : see if this is a termio system
15540 val="$undef"
15541 val2="$undef"
15542 val3="$undef"
15543 if $test `./findhdr termios.h`; then
15544         set tcsetattr i_termios
15545         eval $inlibc
15546         val3="$i_termios"
15547 fi
15548 echo " "
15549 case "$val3" in
15550 "$define") echo "You have POSIX termios.h... good!" >&4;;
15551 *) if ./Cppsym pyr; then
15552                 case "`/bin/universe`" in
15553                 ucb) if $test `./findhdr sgtty.h`; then
15554                                 val2="$define"
15555                                 echo "<sgtty.h> found." >&4
15556                         else
15557                                 echo "System is pyramid with BSD universe."
15558                                 echo "<sgtty.h> not found--you could have problems." >&4
15559                         fi;;
15560                 *) if $test `./findhdr termio.h`; then
15561                                 val="$define"
15562                                 echo "<termio.h> found." >&4
15563                         else
15564                                 echo "System is pyramid with USG universe."
15565                                 echo "<termio.h> not found--you could have problems." >&4
15566                         fi;;
15567                 esac
15568         elif ./usg; then
15569                 if $test `./findhdr termio.h`; then
15570                         echo "<termio.h> found." >&4
15571                         val="$define"
15572                 elif $test `./findhdr sgtty.h`; then
15573                         echo "<sgtty.h> found." >&4
15574                         val2="$define"
15575                 else
15576 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15577                 fi
15578         else
15579                 if $test `./findhdr sgtty.h`; then
15580                         echo "<sgtty.h> found." >&4
15581                         val2="$define"
15582                 elif $test `./findhdr termio.h`; then
15583                         echo "<termio.h> found." >&4
15584                         val="$define"
15585                 else
15586 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15587                 fi
15588         fi;;
15589 esac
15590 set i_termio; eval $setvar
15591 val=$val2; set i_sgtty; eval $setvar
15592 val=$val3; set i_termios; eval $setvar
15593
15594 : see if this is a shadow.h system
15595 set shadow.h i_shadow
15596 eval $inhdr
15597
15598 : see if stddef is available
15599 set stddef.h i_stddef
15600 eval $inhdr
15601
15602 : see if this is a sunmath.h system
15603 set sunmath.h i_sunmath
15604 eval $inhdr
15605
15606 : see if sys/access.h is available
15607 set sys/access.h i_sysaccess
15608 eval $inhdr
15609
15610 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15611 set sys/filio.h i_sysfilio
15612 eval $inhdr
15613 echo " "
15614 if $test `./findhdr sys/ioctl.h`; then
15615         val="$define"
15616         echo '<sys/ioctl.h> found.' >&4
15617 else
15618         val="$undef"
15619         if $test $i_sysfilio = "$define"; then
15620             echo '<sys/ioctl.h> NOT found.' >&4
15621         else
15622                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15623                 $test $i_termio = "$define" && xxx="termio.h"
15624                 $test $i_termios = "$define" && xxx="termios.h"
15625 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15626         fi
15627 fi
15628 set i_sysioctl
15629 eval $setvar
15630
15631 : see if socket ioctl defs are in sys/sockio.h
15632 echo " "
15633 xxx=`./findhdr sys/sockio.h`
15634 if $test "$xxx"; then
15635         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15636                 val="$define"
15637                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15638         else
15639                 val="$undef"
15640                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15641         fi
15642 else
15643         val="$undef"
15644         $cat <<EOM
15645 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15646 EOM
15647 fi
15648 set i_syssockio
15649 eval $setvar
15650
15651
15652 : see if this is a syslog.h system
15653 set syslog.h i_syslog
15654 eval $inhdr
15655
15656
15657 : see if this is a sys/mode.h system
15658 set sys/mode.h i_sysmode
15659 eval $inhdr
15660
15661 : see if sys/resource.h has to be included
15662 set sys/resource.h i_sysresrc
15663 eval $inhdr
15664
15665 : see if sys/security.h is available
15666 set sys/security.h i_syssecrt
15667 eval $inhdr
15668
15669 : see if this is a sys/statvfs.h system
15670 set sys/statvfs.h i_sysstatvfs
15671 eval $inhdr
15672
15673 : see if this is a sys/un.h system
15674 set sys/un.h i_sysun
15675 eval $inhdr
15676
15677
15678 : see if this is a sys/utsname.h system
15679 set sys/utsname.h i_sysutsname
15680 eval $inhdr
15681
15682 : see if this is a syswait system
15683 set sys/wait.h i_syswait
15684 eval $inhdr
15685
15686 : see if this is a ustat.h system
15687 set ustat.h i_ustat
15688 eval $inhdr
15689
15690 : see if this is an utime system
15691 set utime.h i_utime
15692 eval $inhdr
15693
15694 : see if this is a values.h system
15695 set values.h i_values
15696 eval $inhdr
15697
15698 : see if this is a vfork system
15699 case "$d_vfork" in
15700 "$define")
15701         set vfork.h i_vfork
15702         eval $inhdr
15703         ;;
15704 *)
15705         i_vfork="$undef"
15706         ;;
15707 esac
15708
15709 : see if gdbm.h is available
15710 set gdbm.h t_gdbm
15711 eval $inhdr
15712 case "$t_gdbm" in
15713 $define)
15714         : see if gdbm_open exists
15715         set gdbm_open d_gdbm_open
15716         eval $inlibc
15717         case "$d_gdbm_open" in
15718         $undef)
15719                 t_gdbm="$undef"
15720                 echo "We won't be including <gdbm.h>"
15721                 ;;
15722         esac
15723         ;;
15724 esac
15725 val="$t_gdbm"
15726 set i_gdbm
15727 eval $setvar
15728
15729 echo " "
15730 echo "Looking for extensions..." >&4
15731 : If we are using the old config.sh, known_extensions may contain
15732 : old or inaccurate or duplicate values.
15733 known_extensions=''
15734 nonxs_extensions=''
15735 : We do not use find because it might not be available.
15736 : We do not just use MANIFEST because the user may have dropped
15737 : some additional extensions into the source tree and expect them
15738 : to be built.
15739
15740 : Function to recursively find available extensions, ignoring DynaLoader
15741 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15742 find_extensions='
15743     for xxx in *; do
15744        case "$xxx" in
15745            DynaLoader|dynaload) ;;
15746            *)
15747            if $test -f $xxx/$xxx.xs; then
15748                known_extensions="$known_extensions $1$xxx";
15749            elif $test -f $xxx/Makefile.PL; then
15750                nonxs_extensions="$nonxs_extensions $1$xxx";
15751            else
15752                if $test -d $xxx -a $# -lt 10; then
15753                    set $1$xxx/ $*;
15754                    cd $xxx;
15755                    eval $find_extensions;
15756                    cd ..;
15757                    shift;
15758                fi;
15759            fi
15760            ;;
15761        esac;
15762     done'
15763 tdir=`pwd`
15764 cd $rsrc/ext
15765 set X
15766 shift
15767 eval $find_extensions
15768 set X $nonxs_extensions
15769 shift
15770 nonxs_extensions="$*"
15771 set X $known_extensions
15772 shift
15773 known_extensions="$*"
15774 cd $tdir
15775
15776 : Now see which are supported on this system.
15777 avail_ext=''
15778 for xxx in $known_extensions ; do
15779         case "$xxx" in
15780         DB_File|db_file)
15781                 case "$i_db" in
15782                 $define) avail_ext="$avail_ext $xxx" ;;
15783                 esac
15784                 ;;
15785         GDBM_File|gdbm_fil)
15786                 case "$i_gdbm" in 
15787                 $define) avail_ext="$avail_ext $xxx" ;;
15788                 esac
15789                 ;;
15790         NDBM_File|ndbm_fil)
15791                 case "$i_ndbm" in
15792                 $define)
15793                     case "$osname-$use64bitint" in
15794                     hpux-define)
15795                         case "$libs" in
15796                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15797                         esac
15798                         ;;
15799                     *) avail_ext="$avail_ext $xxx" ;;
15800                     esac
15801                     ;;
15802                 esac
15803                 ;;
15804         ODBM_File|odbm_fil) 
15805                 case "${i_dbm}${i_rpcsvcdbm}" in
15806                 *"${define}"*)
15807                     case "$osname-$use64bitint" in
15808                     hpux-define)
15809                         case "$libs" in
15810                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15811                         esac
15812                         ;;
15813                     *) avail_ext="$avail_ext $xxx" ;;
15814                     esac
15815                     ;;
15816                 esac
15817                 ;;
15818         POSIX|posix)
15819                 case "$useposix" in
15820                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15821                 esac
15822                 ;;
15823         Opcode|opcode)
15824                 case "$useopcode" in
15825                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15826                 esac
15827                 ;;
15828         Socket|socket)
15829                 case "$d_socket" in 
15830                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15831                 esac
15832                 ;;
15833         Sys/Syslog|sys/syslog)
15834                 : XXX syslog requires socket
15835                 case "$d_socket" in 
15836                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15837                 esac
15838                 ;;
15839         Thread|thread)
15840                 case "$usethreads" in 
15841                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15842                 esac
15843                 ;;
15844         IPC/SysV|ipc/sysv)
15845                 : XXX Do we need a useipcsysv variable here
15846                 case "${d_msg}${d_sem}${d_shm}" in 
15847                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15848                 esac
15849                 ;;
15850         *)      avail_ext="$avail_ext $xxx"
15851                 ;;
15852         esac
15853 done
15854
15855 set X $avail_ext
15856 shift
15857 avail_ext="$*"
15858
15859 : Now see which nonxs extensions are supported on this system.
15860 : For now assume all are.
15861 nonxs_ext=''
15862 for xxx in $nonxs_extensions ; do
15863         case "$xxx" in
15864         *)      nonxs_ext="$nonxs_ext $xxx"
15865                 ;;
15866         esac
15867 done
15868
15869 set X $nonxs_ext
15870 shift
15871 nonxs_ext="$*"
15872
15873 case $usedl in
15874 $define)
15875         $cat <<EOM
15876 A number of extensions are supplied with $package.  You may choose to
15877 compile these extensions for dynamic loading (the default), compile
15878 them into the $package executable (static loading), or not include
15879 them at all.  Answer "none" to include no extensions.
15880 Note that DynaLoader is always built and need not be mentioned here.
15881
15882 EOM
15883         case "$dynamic_ext" in
15884         '') dflt="$avail_ext" ;;
15885         *)      dflt="$dynamic_ext"
15886                 # Perhaps we are reusing an old out-of-date config.sh.
15887                 case "$hint" in
15888                 previous)
15889                         if test X"$dynamic_ext" != X"$avail_ext"; then
15890                                 $cat <<EOM
15891 NOTICE:  Your previous config.sh list may be incorrect. 
15892 The extensions now available to you are 
15893         ${avail_ext}
15894 but the default list from your previous config.sh is
15895         ${dynamic_ext} 
15896
15897 EOM
15898                         fi
15899                         ;;
15900                 esac
15901                 ;;
15902         esac
15903         case "$dflt" in
15904         '')     dflt=none;;
15905         esac
15906         rp="What extensions do you wish to load dynamically?"
15907         . ./myread
15908         case "$ans" in
15909         none) dynamic_ext=' ' ;;
15910         *) dynamic_ext="$ans" ;;
15911         esac
15912
15913         case "$static_ext" in
15914         '')
15915                 : Exclude those already listed in dynamic linking
15916                 dflt=''
15917                 for xxx in $avail_ext; do
15918                         case " $dynamic_ext " in
15919                         *" $xxx "*) ;;
15920                         *) dflt="$dflt $xxx" ;;
15921                         esac
15922                 done
15923                 set X $dflt
15924                 shift
15925                 dflt="$*"
15926                 ;;
15927         *)  dflt="$static_ext" 
15928                 ;;
15929         esac
15930
15931         case "$dflt" in
15932         '')     dflt=none;;
15933         esac
15934         rp="What extensions do you wish to load statically?"
15935         . ./myread
15936         case "$ans" in
15937         none) static_ext=' ' ;;
15938         *) static_ext="$ans" ;;
15939         esac
15940         ;;
15941 *)
15942         $cat <<EOM
15943 A number of extensions are supplied with $package.  Answer "none" 
15944 to include no extensions. 
15945 Note that DynaLoader is always built and need not be mentioned here.
15946
15947 EOM
15948         case "$static_ext" in
15949         '') dflt="$avail_ext" ;;
15950         *)      dflt="$static_ext"
15951                 # Perhaps we are reusing an old out-of-date config.sh.
15952                 case "$hint" in
15953                 previous)
15954                         if test X"$static_ext" != X"$avail_ext"; then
15955                                 $cat <<EOM
15956 NOTICE:  Your previous config.sh list may be incorrect. 
15957 The extensions now available to you are 
15958         ${avail_ext}
15959 but the default list from your previous config.sh is
15960         ${static_ext} 
15961
15962 EOM
15963                         fi
15964                         ;;
15965                 esac
15966                 ;;
15967         esac
15968         : Exclude those that are not xs extensions
15969         case "$dflt" in
15970         '')     dflt=none;;
15971         esac
15972         rp="What extensions do you wish to include?"
15973         . ./myread
15974         case "$ans" in
15975         none) static_ext=' ' ;;
15976         *) static_ext="$ans" ;;
15977         esac
15978         ;;
15979 esac
15980
15981 set X $dynamic_ext $static_ext $nonxs_ext
15982 shift
15983 extensions="$*"
15984
15985 : Remove libraries needed only for extensions
15986 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15987 : The exception is SunOS 4.x, which needs them.
15988 case "${osname}X${osvers}" in
15989 sunos*X4*)
15990     perllibs="$libs"
15991     ;;
15992 *) case "$usedl" in
15993     $define|true|[yY]*)
15994             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15995             shift
15996             perllibs="$*"
15997             ;;
15998     *)  perllibs="$libs"
15999             ;;
16000     esac
16001     ;;
16002 esac
16003
16004 : Remove build directory name from cppstdin so it can be used from
16005 : either the present location or the final installed location.
16006 echo " "
16007 : Get out of the UU directory to get correct path name.
16008 cd ..
16009 case "$cppstdin" in
16010 `pwd`/cppstdin)
16011         echo "Stripping down cppstdin path name"
16012         cppstdin=cppstdin
16013         ;;
16014 esac
16015 cd UU
16016
16017 : end of configuration questions
16018 echo " "
16019 echo "End of configuration questions."
16020 echo " "
16021
16022 : back to where it started
16023 if test -d ../UU; then
16024         cd ..
16025 fi
16026
16027 : configuration may be patched via a 'config.over' file
16028 if $test -f config.over; then
16029         echo " "
16030         dflt=y
16031         rp='I see a config.over file.  Do you wish to load it?'
16032         . UU/myread
16033         case "$ans" in
16034         n*) echo "OK, I'll ignore it.";;
16035         *)      . ./config.over
16036                 echo "Configuration override changes have been loaded."
16037                 ;;
16038         esac
16039 fi
16040
16041 : in case they want portability, strip down executable paths
16042 case "$d_portable" in
16043 "$define")
16044         echo " "
16045         echo "Stripping down executable paths..." >&4
16046         for file in $loclist $trylist; do
16047                 eval temp=\$$file
16048                 eval $file=`basename $temp`
16049         done
16050         ;;
16051 esac
16052
16053 : create config.sh file
16054 echo " "
16055 echo "Creating config.sh..." >&4
16056 $spitshell <<EOT >config.sh
16057 $startsh
16058 #
16059 # This file was produced by running the Configure script. It holds all the
16060 # definitions figured out by Configure. Should you modify one of these values,
16061 # do not forget to propagate your changes by running "Configure -der". You may
16062 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16063 #
16064
16065 # Package name      : $package
16066 # Source directory  : $src
16067 # Configuration time: $cf_time
16068 # Configured by     : $cf_by
16069 # Target system     : $myuname
16070
16071 Author='$Author'
16072 Date='$Date'
16073 Header='$Header'
16074 Id='$Id'
16075 Locker='$Locker'
16076 Log='$Log'
16077 Mcc='$Mcc'
16078 RCSfile='$RCSfile'
16079 Revision='$Revision'
16080 Source='$Source'
16081 State='$State'
16082 _a='$_a'
16083 _exe='$_exe'
16084 _o='$_o'
16085 afs='$afs'
16086 alignbytes='$alignbytes'
16087 ansi2knr='$ansi2knr'
16088 aphostname='$aphostname'
16089 api_revision='$api_revision'
16090 api_subversion='$api_subversion'
16091 api_version='$api_version'
16092 api_versionstring='$api_versionstring'
16093 ar='$ar'
16094 archlib='$archlib'
16095 archlibexp='$archlibexp'
16096 archname64='$archname64'
16097 archname='$archname'
16098 archobjs='$archobjs'
16099 awk='$awk'
16100 baserev='$baserev'
16101 bash='$bash'
16102 bin='$bin'
16103 bincompat5005='$bincompat5005'
16104 binexp='$binexp'
16105 bison='$bison'
16106 byacc='$byacc'
16107 byteorder='$byteorder'
16108 c='$c'
16109 castflags='$castflags'
16110 cat='$cat'
16111 cc='$cc'
16112 cccdlflags='$cccdlflags'
16113 ccdlflags='$ccdlflags'
16114 ccflags='$ccflags'
16115 ccflags_uselargefiles='$ccflags_uselargefiles'
16116 ccname='$ccname'
16117 ccsymbols='$ccsymbols'
16118 ccversion='$ccversion'
16119 cf_by='$cf_by'
16120 cf_email='$cf_email'
16121 cf_time='$cf_time'
16122 charsize='$charsize'
16123 chgrp='$chgrp'
16124 chmod='$chmod'
16125 chown='$chown'
16126 clocktype='$clocktype'
16127 comm='$comm'
16128 compress='$compress'
16129 contains='$contains'
16130 cp='$cp'
16131 cpio='$cpio'
16132 cpp='$cpp'
16133 cpp_stuff='$cpp_stuff'
16134 cppccsymbols='$cppccsymbols'
16135 cppflags='$cppflags'
16136 cpplast='$cpplast'
16137 cppminus='$cppminus'
16138 cpprun='$cpprun'
16139 cppstdin='$cppstdin'
16140 cppsymbols='$cppsymbols'
16141 crosscompile='$crosscompile'
16142 cryptlib='$cryptlib'
16143 csh='$csh'
16144 d_Gconvert='$d_Gconvert'
16145 d_PRIEUldbl='$d_PRIEUldbl'
16146 d_PRIFUldbl='$d_PRIFUldbl'
16147 d_PRIGUldbl='$d_PRIGUldbl'
16148 d_PRIXU64='$d_PRIXU64'
16149 d_PRId64='$d_PRId64'
16150 d_PRIeldbl='$d_PRIeldbl'
16151 d_PRIfldbl='$d_PRIfldbl'
16152 d_PRIgldbl='$d_PRIgldbl'
16153 d_PRIi64='$d_PRIi64'
16154 d_PRIo64='$d_PRIo64'
16155 d_PRIu64='$d_PRIu64'
16156 d_PRIx64='$d_PRIx64'
16157 d_SCNfldbl='$d_SCNfldbl'
16158 d__fwalk='$d__fwalk'
16159 d_access='$d_access'
16160 d_accessx='$d_accessx'
16161 d_alarm='$d_alarm'
16162 d_archlib='$d_archlib'
16163 d_atolf='$d_atolf'
16164 d_atoll='$d_atoll'
16165 d_attribut='$d_attribut'
16166 d_bcmp='$d_bcmp'
16167 d_bcopy='$d_bcopy'
16168 d_bincompat5005='$d_bincompat5005'
16169 d_bsd='$d_bsd'
16170 d_bsdgetpgrp='$d_bsdgetpgrp'
16171 d_bsdsetpgrp='$d_bsdsetpgrp'
16172 d_bzero='$d_bzero'
16173 d_casti32='$d_casti32'
16174 d_castneg='$d_castneg'
16175 d_charvspr='$d_charvspr'
16176 d_chown='$d_chown'
16177 d_chroot='$d_chroot'
16178 d_chsize='$d_chsize'
16179 d_closedir='$d_closedir'
16180 d_cmsghdr_s='$d_cmsghdr_s'
16181 d_const='$d_const'
16182 d_crypt='$d_crypt'
16183 d_csh='$d_csh'
16184 d_cuserid='$d_cuserid'
16185 d_dbl_dig='$d_dbl_dig'
16186 d_difftime='$d_difftime'
16187 d_dirnamlen='$d_dirnamlen'
16188 d_dlerror='$d_dlerror'
16189 d_dlopen='$d_dlopen'
16190 d_dlsymun='$d_dlsymun'
16191 d_dosuid='$d_dosuid'
16192 d_drand48proto='$d_drand48proto'
16193 d_dup2='$d_dup2'
16194 d_eaccess='$d_eaccess'
16195 d_endgrent='$d_endgrent'
16196 d_endhent='$d_endhent'
16197 d_endnent='$d_endnent'
16198 d_endpent='$d_endpent'
16199 d_endpwent='$d_endpwent'
16200 d_endsent='$d_endsent'
16201 d_eofnblk='$d_eofnblk'
16202 d_eunice='$d_eunice'
16203 d_fchmod='$d_fchmod'
16204 d_fchown='$d_fchown'
16205 d_fcntl='$d_fcntl'
16206 d_fcntl_can_lock='$d_fcntl_can_lock'
16207 d_fd_macros='$d_fd_macros'
16208 d_fd_set='$d_fd_set'
16209 d_fds_bits='$d_fds_bits'
16210 d_fgetpos='$d_fgetpos'
16211 d_flexfnam='$d_flexfnam'
16212 d_flock='$d_flock'
16213 d_fork='$d_fork'
16214 d_fpathconf='$d_fpathconf'
16215 d_fpos64_t='$d_fpos64_t'
16216 d_frexpl='$d_frexpl'
16217 d_fs_data_s='$d_fs_data_s'
16218 d_fseeko='$d_fseeko'
16219 d_fsetpos='$d_fsetpos'
16220 d_fstatfs='$d_fstatfs'
16221 d_fstatvfs='$d_fstatvfs'
16222 d_fsync='$d_fsync'
16223 d_ftello='$d_ftello'
16224 d_ftime='$d_ftime'
16225 d_getcwd='$d_getcwd'
16226 d_getespwnam='$d_getespwnam'
16227 d_getfsstat='$d_getfsstat'
16228 d_getgrent='$d_getgrent'
16229 d_getgrps='$d_getgrps'
16230 d_gethbyaddr='$d_gethbyaddr'
16231 d_gethbyname='$d_gethbyname'
16232 d_gethent='$d_gethent'
16233 d_gethname='$d_gethname'
16234 d_gethostprotos='$d_gethostprotos'
16235 d_getitimer='$d_getitimer'
16236 d_getlogin='$d_getlogin'
16237 d_getmnt='$d_getmnt'
16238 d_getmntent='$d_getmntent'
16239 d_getnbyaddr='$d_getnbyaddr'
16240 d_getnbyname='$d_getnbyname'
16241 d_getnent='$d_getnent'
16242 d_getnetprotos='$d_getnetprotos'
16243 d_getpagsz='$d_getpagsz'
16244 d_getpbyname='$d_getpbyname'
16245 d_getpbynumber='$d_getpbynumber'
16246 d_getpent='$d_getpent'
16247 d_getpgid='$d_getpgid'
16248 d_getpgrp2='$d_getpgrp2'
16249 d_getpgrp='$d_getpgrp'
16250 d_getppid='$d_getppid'
16251 d_getprior='$d_getprior'
16252 d_getprotoprotos='$d_getprotoprotos'
16253 d_getprpwnam='$d_getprpwnam'
16254 d_getpwent='$d_getpwent'
16255 d_getsbyname='$d_getsbyname'
16256 d_getsbyport='$d_getsbyport'
16257 d_getsent='$d_getsent'
16258 d_getservprotos='$d_getservprotos'
16259 d_getspnam='$d_getspnam'
16260 d_gettimeod='$d_gettimeod'
16261 d_gnulibc='$d_gnulibc'
16262 d_grpasswd='$d_grpasswd'
16263 d_hasmntopt='$d_hasmntopt'
16264 d_htonl='$d_htonl'
16265 d_iconv='$d_iconv'
16266 d_index='$d_index'
16267 d_inetaton='$d_inetaton'
16268 d_int64_t='$d_int64_t'
16269 d_isascii='$d_isascii'
16270 d_isnan='$d_isnan'
16271 d_isnanl='$d_isnanl'
16272 d_killpg='$d_killpg'
16273 d_lchown='$d_lchown'
16274 d_ldbl_dig='$d_ldbl_dig'
16275 d_link='$d_link'
16276 d_locconv='$d_locconv'
16277 d_lockf='$d_lockf'
16278 d_longdbl='$d_longdbl'
16279 d_longlong='$d_longlong'
16280 d_lseekproto='$d_lseekproto'
16281 d_lstat='$d_lstat'
16282 d_madvise='$d_madvise'
16283 d_mblen='$d_mblen'
16284 d_mbstowcs='$d_mbstowcs'
16285 d_mbtowc='$d_mbtowc'
16286 d_memchr='$d_memchr'
16287 d_memcmp='$d_memcmp'
16288 d_memcpy='$d_memcpy'
16289 d_memmove='$d_memmove'
16290 d_memset='$d_memset'
16291 d_mkdir='$d_mkdir'
16292 d_mkdtemp='$d_mkdtemp'
16293 d_mkfifo='$d_mkfifo'
16294 d_mkstemp='$d_mkstemp'
16295 d_mkstemps='$d_mkstemps'
16296 d_mktime='$d_mktime'
16297 d_mmap='$d_mmap'
16298 d_modfl='$d_modfl'
16299 d_mprotect='$d_mprotect'
16300 d_msg='$d_msg'
16301 d_msg_ctrunc='$d_msg_ctrunc'
16302 d_msg_dontroute='$d_msg_dontroute'
16303 d_msg_oob='$d_msg_oob'
16304 d_msg_peek='$d_msg_peek'
16305 d_msg_proxy='$d_msg_proxy'
16306 d_msgctl='$d_msgctl'
16307 d_msgget='$d_msgget'
16308 d_msghdr_s='$d_msghdr_s'
16309 d_msgrcv='$d_msgrcv'
16310 d_msgsnd='$d_msgsnd'
16311 d_msync='$d_msync'
16312 d_munmap='$d_munmap'
16313 d_mymalloc='$d_mymalloc'
16314 d_nice='$d_nice'
16315 d_nv_preserves_uv='$d_nv_preserves_uv'
16316 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16317 d_off64_t='$d_off64_t'
16318 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16319 d_oldpthreads='$d_oldpthreads'
16320 d_oldsock='$d_oldsock'
16321 d_open3='$d_open3'
16322 d_pathconf='$d_pathconf'
16323 d_pause='$d_pause'
16324 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16325 d_phostname='$d_phostname'
16326 d_pipe='$d_pipe'
16327 d_poll='$d_poll'
16328 d_portable='$d_portable'
16329 d_pthread_yield='$d_pthread_yield'
16330 d_pwage='$d_pwage'
16331 d_pwchange='$d_pwchange'
16332 d_pwclass='$d_pwclass'
16333 d_pwcomment='$d_pwcomment'
16334 d_pwexpire='$d_pwexpire'
16335 d_pwgecos='$d_pwgecos'
16336 d_pwpasswd='$d_pwpasswd'
16337 d_pwquota='$d_pwquota'
16338 d_qgcvt='$d_qgcvt'
16339 d_quad='$d_quad'
16340 d_readdir='$d_readdir'
16341 d_readlink='$d_readlink'
16342 d_readv='$d_readv'
16343 d_recvmsg='$d_recvmsg'
16344 d_rename='$d_rename'
16345 d_rewinddir='$d_rewinddir'
16346 d_rmdir='$d_rmdir'
16347 d_safebcpy='$d_safebcpy'
16348 d_safemcpy='$d_safemcpy'
16349 d_sanemcmp='$d_sanemcmp'
16350 d_sbrkproto='$d_sbrkproto'
16351 d_sched_yield='$d_sched_yield'
16352 d_scm_rights='$d_scm_rights'
16353 d_seekdir='$d_seekdir'
16354 d_select='$d_select'
16355 d_sem='$d_sem'
16356 d_semctl='$d_semctl'
16357 d_semctl_semid_ds='$d_semctl_semid_ds'
16358 d_semctl_semun='$d_semctl_semun'
16359 d_semget='$d_semget'
16360 d_semop='$d_semop'
16361 d_sendmsg='$d_sendmsg'
16362 d_setegid='$d_setegid'
16363 d_seteuid='$d_seteuid'
16364 d_setgrent='$d_setgrent'
16365 d_setgrps='$d_setgrps'
16366 d_sethent='$d_sethent'
16367 d_setitimer='$d_setitimer'
16368 d_setlinebuf='$d_setlinebuf'
16369 d_setlocale='$d_setlocale'
16370 d_setnent='$d_setnent'
16371 d_setpent='$d_setpent'
16372 d_setpgid='$d_setpgid'
16373 d_setpgrp2='$d_setpgrp2'
16374 d_setpgrp='$d_setpgrp'
16375 d_setprior='$d_setprior'
16376 d_setproctitle='$d_setproctitle'
16377 d_setpwent='$d_setpwent'
16378 d_setregid='$d_setregid'
16379 d_setresgid='$d_setresgid'
16380 d_setresuid='$d_setresuid'
16381 d_setreuid='$d_setreuid'
16382 d_setrgid='$d_setrgid'
16383 d_setruid='$d_setruid'
16384 d_setsent='$d_setsent'
16385 d_setsid='$d_setsid'
16386 d_setvbuf='$d_setvbuf'
16387 d_sfio='$d_sfio'
16388 d_shm='$d_shm'
16389 d_shmat='$d_shmat'
16390 d_shmatprototype='$d_shmatprototype'
16391 d_shmctl='$d_shmctl'
16392 d_shmdt='$d_shmdt'
16393 d_shmget='$d_shmget'
16394 d_sigaction='$d_sigaction'
16395 d_sigprocmask='$d_sigprocmask'
16396 d_sigsetjmp='$d_sigsetjmp'
16397 d_sockatmark='$d_sockatmark'
16398 d_socket='$d_socket'
16399 d_socklen_t='$d_socklen_t'
16400 d_sockpair='$d_sockpair'
16401 d_socks5_init='$d_socks5_init'
16402 d_sqrtl='$d_sqrtl'
16403 d_statblks='$d_statblks'
16404 d_statfs_f_flags='$d_statfs_f_flags'
16405 d_statfs_s='$d_statfs_s'
16406 d_statvfs='$d_statvfs'
16407 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16408 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16409 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16410 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16411 d_stdio_stream_array='$d_stdio_stream_array'
16412 d_stdiobase='$d_stdiobase'
16413 d_stdstdio='$d_stdstdio'
16414 d_strchr='$d_strchr'
16415 d_strcoll='$d_strcoll'
16416 d_strctcpy='$d_strctcpy'
16417 d_strerrm='$d_strerrm'
16418 d_strerror='$d_strerror'
16419 d_strftime='$d_strftime'
16420 d_strtod='$d_strtod'
16421 d_strtol='$d_strtol'
16422 d_strtold='$d_strtold'
16423 d_strtoll='$d_strtoll'
16424 d_strtoq='$d_strtoq'
16425 d_strtoul='$d_strtoul'
16426 d_strtoull='$d_strtoull'
16427 d_strtouq='$d_strtouq'
16428 d_strxfrm='$d_strxfrm'
16429 d_suidsafe='$d_suidsafe'
16430 d_symlink='$d_symlink'
16431 d_syscall='$d_syscall'
16432 d_sysconf='$d_sysconf'
16433 d_sysernlst='$d_sysernlst'
16434 d_syserrlst='$d_syserrlst'
16435 d_system='$d_system'
16436 d_tcgetpgrp='$d_tcgetpgrp'
16437 d_tcsetpgrp='$d_tcsetpgrp'
16438 d_telldir='$d_telldir'
16439 d_telldirproto='$d_telldirproto'
16440 d_time='$d_time'
16441 d_times='$d_times'
16442 d_truncate='$d_truncate'
16443 d_tzname='$d_tzname'
16444 d_u32align='$d_u32align'
16445 d_ualarm='$d_ualarm'
16446 d_umask='$d_umask'
16447 d_uname='$d_uname'
16448 d_union_semun='$d_union_semun'
16449 d_usleep='$d_usleep'
16450 d_ustat='$d_ustat'
16451 d_vendorarch='$d_vendorarch'
16452 d_vendorbin='$d_vendorbin'
16453 d_vendorlib='$d_vendorlib'
16454 d_vfork='$d_vfork'
16455 d_void_closedir='$d_void_closedir'
16456 d_voidsig='$d_voidsig'
16457 d_voidtty='$d_voidtty'
16458 d_volatile='$d_volatile'
16459 d_vprintf='$d_vprintf'
16460 d_wait4='$d_wait4'
16461 d_waitpid='$d_waitpid'
16462 d_wcstombs='$d_wcstombs'
16463 d_wctomb='$d_wctomb'
16464 d_writev='$d_writev'
16465 d_xenix='$d_xenix'
16466 date='$date'
16467 db_hashtype='$db_hashtype'
16468 db_prefixtype='$db_prefixtype'
16469 defvoidused='$defvoidused'
16470 direntrytype='$direntrytype'
16471 dlext='$dlext'
16472 dlsrc='$dlsrc'
16473 doublesize='$doublesize'
16474 drand01='$drand01'
16475 dynamic_ext='$dynamic_ext'
16476 eagain='$eagain'
16477 ebcdic='$ebcdic'
16478 echo='$echo'
16479 egrep='$egrep'
16480 emacs='$emacs'
16481 eunicefix='$eunicefix'
16482 exe_ext='$exe_ext'
16483 expr='$expr'
16484 extensions='$extensions'
16485 fflushNULL='$fflushNULL'
16486 fflushall='$fflushall'
16487 find='$find'
16488 firstmakefile='$firstmakefile'
16489 flex='$flex'
16490 fpossize='$fpossize'
16491 fpostype='$fpostype'
16492 freetype='$freetype'
16493 full_ar='$full_ar'
16494 full_csh='$full_csh'
16495 full_sed='$full_sed'
16496 gccosandvers='$gccosandvers'
16497 gccversion='$gccversion'
16498 gidformat='$gidformat'
16499 gidsign='$gidsign'
16500 gidsize='$gidsize'
16501 gidtype='$gidtype'
16502 glibpth='$glibpth'
16503 grep='$grep'
16504 groupcat='$groupcat'
16505 groupstype='$groupstype'
16506 gzip='$gzip'
16507 h_fcntl='$h_fcntl'
16508 h_sysfile='$h_sysfile'
16509 hint='$hint'
16510 hostcat='$hostcat'
16511 i16size='$i16size'
16512 i16type='$i16type'
16513 i32size='$i32size'
16514 i32type='$i32type'
16515 i64size='$i64size'
16516 i64type='$i64type'
16517 i8size='$i8size'
16518 i8type='$i8type'
16519 i_arpainet='$i_arpainet'
16520 i_bsdioctl='$i_bsdioctl'
16521 i_db='$i_db'
16522 i_dbm='$i_dbm'
16523 i_dirent='$i_dirent'
16524 i_dld='$i_dld'
16525 i_dlfcn='$i_dlfcn'
16526 i_fcntl='$i_fcntl'
16527 i_float='$i_float'
16528 i_gdbm='$i_gdbm'
16529 i_grp='$i_grp'
16530 i_iconv='$i_iconv'
16531 i_ieeefp='$i_ieeefp'
16532 i_inttypes='$i_inttypes'
16533 i_libutil='$i_libutil'
16534 i_limits='$i_limits'
16535 i_locale='$i_locale'
16536 i_machcthr='$i_machcthr'
16537 i_malloc='$i_malloc'
16538 i_math='$i_math'
16539 i_memory='$i_memory'
16540 i_mntent='$i_mntent'
16541 i_ndbm='$i_ndbm'
16542 i_netdb='$i_netdb'
16543 i_neterrno='$i_neterrno'
16544 i_netinettcp='$i_netinettcp'
16545 i_niin='$i_niin'
16546 i_poll='$i_poll'
16547 i_prot='$i_prot'
16548 i_pthread='$i_pthread'
16549 i_pwd='$i_pwd'
16550 i_rpcsvcdbm='$i_rpcsvcdbm'
16551 i_sfio='$i_sfio'
16552 i_sgtty='$i_sgtty'
16553 i_shadow='$i_shadow'
16554 i_socks='$i_socks'
16555 i_stdarg='$i_stdarg'
16556 i_stddef='$i_stddef'
16557 i_stdlib='$i_stdlib'
16558 i_string='$i_string'
16559 i_sunmath='$i_sunmath'
16560 i_sysaccess='$i_sysaccess'
16561 i_sysdir='$i_sysdir'
16562 i_sysfile='$i_sysfile'
16563 i_sysfilio='$i_sysfilio'
16564 i_sysin='$i_sysin'
16565 i_sysioctl='$i_sysioctl'
16566 i_syslog='$i_syslog'
16567 i_sysmman='$i_sysmman'
16568 i_sysmode='$i_sysmode'
16569 i_sysmount='$i_sysmount'
16570 i_sysndir='$i_sysndir'
16571 i_sysparam='$i_sysparam'
16572 i_sysresrc='$i_sysresrc'
16573 i_syssecrt='$i_syssecrt'
16574 i_sysselct='$i_sysselct'
16575 i_syssockio='$i_syssockio'
16576 i_sysstat='$i_sysstat'
16577 i_sysstatfs='$i_sysstatfs'
16578 i_sysstatvfs='$i_sysstatvfs'
16579 i_systime='$i_systime'
16580 i_systimek='$i_systimek'
16581 i_systimes='$i_systimes'
16582 i_systypes='$i_systypes'
16583 i_sysuio='$i_sysuio'
16584 i_sysun='$i_sysun'
16585 i_sysutsname='$i_sysutsname'
16586 i_sysvfs='$i_sysvfs'
16587 i_syswait='$i_syswait'
16588 i_termio='$i_termio'
16589 i_termios='$i_termios'
16590 i_time='$i_time'
16591 i_unistd='$i_unistd'
16592 i_ustat='$i_ustat'
16593 i_utime='$i_utime'
16594 i_values='$i_values'
16595 i_varargs='$i_varargs'
16596 i_varhdr='$i_varhdr'
16597 i_vfork='$i_vfork'
16598 ignore_versioned_solibs='$ignore_versioned_solibs'
16599 inc_version_list='$inc_version_list'
16600 inc_version_list_init='$inc_version_list_init'
16601 incpath='$incpath'
16602 inews='$inews'
16603 installarchlib='$installarchlib'
16604 installbin='$installbin'
16605 installman1dir='$installman1dir'
16606 installman3dir='$installman3dir'
16607 installprefix='$installprefix'
16608 installprefixexp='$installprefixexp'
16609 installprivlib='$installprivlib'
16610 installscript='$installscript'
16611 installsitearch='$installsitearch'
16612 installsitebin='$installsitebin'
16613 installsitelib='$installsitelib'
16614 installstyle='$installstyle'
16615 installusrbinperl='$installusrbinperl'
16616 installvendorarch='$installvendorarch'
16617 installvendorbin='$installvendorbin'
16618 installvendorlib='$installvendorlib'
16619 intsize='$intsize'
16620 issymlink='$issymlink'
16621 ivdformat='$ivdformat'
16622 ivsize='$ivsize'
16623 ivtype='$ivtype'
16624 known_extensions='$known_extensions'
16625 ksh='$ksh'
16626 ld='$ld'
16627 lddlflags='$lddlflags'
16628 ldflags='$ldflags'
16629 ldflags_uselargefiles='$ldflags_uselargefiles'
16630 ldlibpthname='$ldlibpthname'
16631 less='$less'
16632 lib_ext='$lib_ext'
16633 libc='$libc'
16634 libperl='$libperl'
16635 libpth='$libpth'
16636 libs='$libs'
16637 libsdirs='$libsdirs'
16638 libsfiles='$libsfiles'
16639 libsfound='$libsfound'
16640 libspath='$libspath'
16641 libswanted='$libswanted'
16642 libswanted_uselargefiles='$libswanted_uselargefiles'
16643 line='$line'
16644 lint='$lint'
16645 lkflags='$lkflags'
16646 ln='$ln'
16647 lns='$lns'
16648 locincpth='$locincpth'
16649 loclibpth='$loclibpth'
16650 longdblsize='$longdblsize'
16651 longlongsize='$longlongsize'
16652 longsize='$longsize'
16653 lp='$lp'
16654 lpr='$lpr'
16655 ls='$ls'
16656 lseeksize='$lseeksize'
16657 lseektype='$lseektype'
16658 mail='$mail'
16659 mailx='$mailx'
16660 make='$make'
16661 make_set_make='$make_set_make'
16662 mallocobj='$mallocobj'
16663 mallocsrc='$mallocsrc'
16664 malloctype='$malloctype'
16665 man1dir='$man1dir'
16666 man1direxp='$man1direxp'
16667 man1ext='$man1ext'
16668 man3dir='$man3dir'
16669 man3direxp='$man3direxp'
16670 man3ext='$man3ext'
16671 mips_type='$mips_type'
16672 mkdir='$mkdir'
16673 mmaptype='$mmaptype'
16674 modetype='$modetype'
16675 more='$more'
16676 multiarch='$multiarch'
16677 mv='$mv'
16678 myarchname='$myarchname'
16679 mydomain='$mydomain'
16680 myhostname='$myhostname'
16681 myuname='$myuname'
16682 n='$n'
16683 need_va_copy='$need_va_copy'
16684 netdb_hlen_type='$netdb_hlen_type'
16685 netdb_host_type='$netdb_host_type'
16686 netdb_name_type='$netdb_name_type'
16687 netdb_net_type='$netdb_net_type'
16688 nm='$nm'
16689 nm_opt='$nm_opt'
16690 nm_so_opt='$nm_so_opt'
16691 nonxs_ext='$nonxs_ext'
16692 nroff='$nroff'
16693 nvEUformat='$nvEUformat'
16694 nvFUformat='$nvFUformat'
16695 nvGUformat='$nvGUformat'
16696 nveformat='$nveformat'
16697 nvfformat='$nvfformat'
16698 nvgformat='$nvgformat'
16699 nvsize='$nvsize'
16700 nvtype='$nvtype'
16701 o_nonblock='$o_nonblock'
16702 obj_ext='$obj_ext'
16703 old_pthread_create_joinable='$old_pthread_create_joinable'
16704 optimize='$optimize'
16705 orderlib='$orderlib'
16706 osname='$osname'
16707 osvers='$osvers'
16708 otherlibdirs='$otherlibdirs'
16709 package='$package'
16710 pager='$pager'
16711 passcat='$passcat'
16712 patchlevel='$patchlevel'
16713 path_sep='$path_sep'
16714 perl5='$perl5'
16715 perl='$perl'
16716 perladmin='$perladmin'
16717 perllibs='$perllibs'
16718 perlpath='$perlpath'
16719 pg='$pg'
16720 phostname='$phostname'
16721 pidtype='$pidtype'
16722 plibpth='$plibpth'
16723 pm_apiversion='$pm_apiversion'
16724 pmake='$pmake'
16725 pr='$pr'
16726 prefix='$prefix'
16727 prefixexp='$prefixexp'
16728 privlib='$privlib'
16729 privlibexp='$privlibexp'
16730 prototype='$prototype'
16731 ptrsize='$ptrsize'
16732 quadkind='$quadkind'
16733 quadtype='$quadtype'
16734 randbits='$randbits'
16735 randfunc='$randfunc'
16736 randseedtype='$randseedtype'
16737 ranlib='$ranlib'
16738 rd_nodata='$rd_nodata'
16739 revision='$revision'
16740 rm='$rm'
16741 rmail='$rmail'
16742 runnm='$runnm'
16743 sPRIEUldbl='$sPRIEUldbl'
16744 sPRIFUldbl='$sPRIFUldbl'
16745 sPRIGUldbl='$sPRIGUldbl'
16746 sPRIXU64='$sPRIXU64'
16747 sPRId64='$sPRId64'
16748 sPRIeldbl='$sPRIeldbl'
16749 sPRIfldbl='$sPRIfldbl'
16750 sPRIgldbl='$sPRIgldbl'
16751 sPRIi64='$sPRIi64'
16752 sPRIo64='$sPRIo64'
16753 sPRIu64='$sPRIu64'
16754 sPRIx64='$sPRIx64'
16755 sSCNfldbl='$sSCNfldbl'
16756 sched_yield='$sched_yield'
16757 scriptdir='$scriptdir'
16758 scriptdirexp='$scriptdirexp'
16759 sed='$sed'
16760 seedfunc='$seedfunc'
16761 selectminbits='$selectminbits'
16762 selecttype='$selecttype'
16763 sendmail='$sendmail'
16764 sh='$sh'
16765 shar='$shar'
16766 sharpbang='$sharpbang'
16767 shmattype='$shmattype'
16768 shortsize='$shortsize'
16769 shrpenv='$shrpenv'
16770 shsharp='$shsharp'
16771 sig_count='$sig_count'
16772 sig_name='$sig_name'
16773 sig_name_init='$sig_name_init'
16774 sig_num='$sig_num'
16775 sig_num_init='$sig_num_init'
16776 sig_size='$sig_size'
16777 signal_t='$signal_t'
16778 sitearch='$sitearch'
16779 sitearchexp='$sitearchexp'
16780 sitebin='$sitebin'
16781 sitebinexp='$sitebinexp'
16782 sitelib='$sitelib'
16783 sitelib_stem='$sitelib_stem'
16784 sitelibexp='$sitelibexp'
16785 siteprefix='$siteprefix'
16786 siteprefixexp='$siteprefixexp'
16787 sizesize='$sizesize'
16788 sizetype='$sizetype'
16789 sleep='$sleep'
16790 smail='$smail'
16791 so='$so'
16792 sockethdr='$sockethdr'
16793 socketlib='$socketlib'
16794 socksizetype='$socksizetype'
16795 sort='$sort'
16796 spackage='$spackage'
16797 spitshell='$spitshell'
16798 src='$src'
16799 ssizetype='$ssizetype'
16800 startperl='$startperl'
16801 startsh='$startsh'
16802 static_ext='$static_ext'
16803 stdchar='$stdchar'
16804 stdio_base='$stdio_base'
16805 stdio_bufsiz='$stdio_bufsiz'
16806 stdio_cnt='$stdio_cnt'
16807 stdio_filbuf='$stdio_filbuf'
16808 stdio_ptr='$stdio_ptr'
16809 stdio_stream_array='$stdio_stream_array'
16810 strings='$strings'
16811 submit='$submit'
16812 subversion='$subversion'
16813 sysman='$sysman'
16814 tail='$tail'
16815 tar='$tar'
16816 tbl='$tbl'
16817 tee='$tee'
16818 test='$test'
16819 timeincl='$timeincl'
16820 timetype='$timetype'
16821 touch='$touch'
16822 tr='$tr'
16823 trnl='$trnl'
16824 troff='$troff'
16825 u16size='$u16size'
16826 u16type='$u16type'
16827 u32size='$u32size'
16828 u32type='$u32type'
16829 u64size='$u64size'
16830 u64type='$u64type'
16831 u8size='$u8size'
16832 u8type='$u8type'
16833 uidformat='$uidformat'
16834 uidsign='$uidsign'
16835 uidsize='$uidsize'
16836 uidtype='$uidtype'
16837 uname='$uname'
16838 uniq='$uniq'
16839 uquadtype='$uquadtype'
16840 use5005threads='$use5005threads'
16841 use64bitall='$use64bitall'
16842 use64bitint='$use64bitint'
16843 usedl='$usedl'
16844 useithreads='$useithreads'
16845 uselargefiles='$uselargefiles'
16846 uselongdouble='$uselongdouble'
16847 usemorebits='$usemorebits'
16848 usemultiplicity='$usemultiplicity'
16849 usemymalloc='$usemymalloc'
16850 usenm='$usenm'
16851 useopcode='$useopcode'
16852 useperlio='$useperlio'
16853 useposix='$useposix'
16854 usesfio='$usesfio'
16855 useshrplib='$useshrplib'
16856 usesocks='$usesocks'
16857 usethreads='$usethreads'
16858 usevendorprefix='$usevendorprefix'
16859 usevfork='$usevfork'
16860 usrinc='$usrinc'
16861 uuname='$uuname'
16862 uvXUformat='$uvXUformat'
16863 uvoformat='$uvoformat'
16864 uvsize='$uvsize'
16865 uvtype='$uvtype'
16866 uvuformat='$uvuformat'
16867 uvxformat='$uvxformat'
16868 vendorarch='$vendorarch'
16869 vendorarchexp='$vendorarchexp'
16870 vendorbin='$vendorbin'
16871 vendorbinexp='$vendorbinexp'
16872 vendorlib='$vendorlib'
16873 vendorlib_stem='$vendorlib_stem'
16874 vendorlibexp='$vendorlibexp'
16875 vendorprefix='$vendorprefix'
16876 vendorprefixexp='$vendorprefixexp'
16877 version='$version'
16878 versiononly='$versiononly'
16879 vi='$vi'
16880 voidflags='$voidflags'
16881 xlibpth='$xlibpth'
16882 xs_apiversion='$xs_apiversion'
16883 yacc='$yacc'
16884 yaccflags='$yaccflags'
16885 zcat='$zcat'
16886 zip='$zip'
16887 EOT
16888
16889 : Add in command line options if available
16890 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16891
16892 : add special variables
16893 $test -f $src/patchlevel.h && \
16894 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16895 echo "PERL_CONFIG_SH=true" >>config.sh
16896
16897 : propagate old symbols
16898 if $test -f UU/config.sh; then
16899         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16900         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16901         $sort | $uniq -u >UU/oldsyms
16902         set X `cat UU/oldsyms`
16903         shift
16904         case $# in
16905         0) ;;
16906         *)
16907                 cat <<EOM
16908 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16909 EOM
16910                 echo "# Variables propagated from previous config.sh file." >>config.sh
16911                 for sym in `cat UU/oldsyms`; do
16912                         echo "    Propagating $hint variable "'$'"$sym..."
16913                         eval 'tmp="$'"${sym}"'"'
16914                         echo "$tmp" | \
16915                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16916                 done
16917                 ;;
16918         esac
16919 fi
16920
16921 : Finish up by extracting the .SH files
16922 case "$alldone" in
16923 exit)
16924         $rm -rf UU
16925         echo "Done."
16926         exit 0
16927         ;;
16928 cont)
16929         ;;
16930 '')
16931         dflt=''
16932         nostick=true
16933         $cat <<EOM
16934
16935 If you'd like to make any changes to the config.sh file before I begin
16936 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16937
16938 EOM
16939         rp="Press return or use a shell escape to edit config.sh:"
16940         . UU/myread
16941         nostick=''
16942         case "$ans" in
16943         '') ;;
16944         *) : in case they cannot read
16945                 sh 1>&4 -c "$ans";;
16946         esac
16947         ;;
16948 esac
16949
16950 : if this fails, just run all the .SH files by hand
16951 . ./config.sh
16952
16953 echo " "
16954 exec 1>&4
16955 . ./UU/extract
16956
16957 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16958         dflt=y
16959         case "$silent" in
16960         true) ;;
16961         *)
16962                 $cat <<EOM
16963
16964 Now you need to generate make dependencies by running "$make depend".
16965 You might prefer to run it in background: "$make depend > makedepend.out &"
16966 It can take a while, so you might not want to run it right now.
16967
16968 EOM
16969                 ;;
16970         esac
16971         rp="Run $make depend now?"
16972         . UU/myread
16973         case "$ans" in
16974         y*)
16975                 $make depend && echo "Now you must run '$make'."
16976                 ;;
16977         *)
16978                 echo "You must run '$make depend' then '$make'."
16979                 ;;
16980         esac
16981 elif test -f [Mm]akefile; then
16982         echo " "
16983         echo "Now you must run a $make."
16984 else
16985         echo "Done."
16986 fi
16987
16988 if $test -f Policy.sh; then
16989     $cat <<EOM
16990
16991 If you compile $package on a different machine or from a different object
16992 directory, copy the Policy.sh file from this object directory to the
16993 new one before you run Configure -- this will help you with most of
16994 the policy defaults.
16995
16996 EOM
16997 fi
16998 if $test -f config.msg; then
16999     echo "Hmm.  I also noted the following information while running:"
17000     echo " "
17001     $cat config.msg >&4
17002     $rm -f config.msg
17003 fi
17004 $rm -f kit*isdone ark*isdone
17005 $rm -rf UU
17006
17007 : End of Configure
17008