Bump patchlevel to 5.7.1.
[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 Sun Apr  8 02:03:47 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_strtod=''
571 d_strtol=''
572 d_strtold=''
573 d_strtoll=''
574 d_strtoq=''
575 d_strtoul=''
576 d_strtoull=''
577 d_strtouq=''
578 d_strxfrm=''
579 d_symlink=''
580 d_syscall=''
581 d_sysconf=''
582 d_system=''
583 d_tcgetpgrp=''
584 d_tcsetpgrp=''
585 d_telldirproto=''
586 d_time=''
587 timetype=''
588 clocktype=''
589 d_times=''
590 d_truncate=''
591 d_tzname=''
592 d_u32align=''
593 d_ualarm=''
594 d_umask=''
595 d_semctl_semid_ds=''
596 d_semctl_semun=''
597 d_union_semun=''
598 d_usleep=''
599 d_ustat=''
600 d_vfork=''
601 usevfork=''
602 d_voidsig=''
603 signal_t=''
604 d_volatile=''
605 d_charvspr=''
606 d_vprintf=''
607 d_wait4=''
608 d_waitpid=''
609 d_wcstombs=''
610 d_wctomb=''
611 d_writev=''
612 dlext=''
613 cccdlflags=''
614 ccdlflags=''
615 dlsrc=''
616 ld=''
617 lddlflags=''
618 usedl=''
619 doublesize=''
620 ebcdic=''
621 fflushNULL=''
622 fflushall=''
623 fpossize=''
624 fpostype=''
625 gccosandvers=''
626 gccversion=''
627 gidformat=''
628 gidsign=''
629 gidsize=''
630 gidtype=''
631 groupstype=''
632 h_fcntl=''
633 h_sysfile=''
634 i_arpainet=''
635 db_hashtype=''
636 db_prefixtype=''
637 i_db=''
638 i_dbm=''
639 i_rpcsvcdbm=''
640 d_dirnamlen=''
641 direntrytype=''
642 i_dirent=''
643 i_dld=''
644 i_dlfcn=''
645 i_fcntl=''
646 i_float=''
647 i_gdbm=''
648 d_grpasswd=''
649 i_grp=''
650 i_iconv=''
651 i_ieeefp=''
652 i_inttypes=''
653 i_libutil=''
654 i_limits=''
655 i_locale=''
656 i_machcthr=''
657 i_malloc=''
658 i_math=''
659 i_memory=''
660 i_mntent=''
661 i_ndbm=''
662 i_netdb=''
663 i_neterrno=''
664 i_netinettcp=''
665 i_niin=''
666 i_sysin=''
667 i_poll=''
668 i_prot=''
669 i_pthread=''
670 d_pwage=''
671 d_pwchange=''
672 d_pwclass=''
673 d_pwcomment=''
674 d_pwexpire=''
675 d_pwgecos=''
676 d_pwpasswd=''
677 d_pwquota=''
678 i_pwd=''
679 i_sfio=''
680 i_shadow=''
681 i_socks=''
682 i_stddef=''
683 i_stdlib=''
684 i_string=''
685 strings=''
686 i_sunmath=''
687 i_sysaccess=''
688 i_sysdir=''
689 i_sysfile=''
690 d_voidtty=''
691 i_bsdioctl=''
692 i_sysfilio=''
693 i_sysioctl=''
694 i_syssockio=''
695 i_syslog=''
696 i_sysmman=''
697 i_sysmode=''
698 i_sysmount=''
699 i_sysndir=''
700 i_sysparam=''
701 i_sysresrc=''
702 i_syssecrt=''
703 i_sysselct=''
704 i_sysstat=''
705 i_sysstatfs=''
706 i_sysstatvfs=''
707 i_systimes=''
708 i_systypes=''
709 i_sysuio=''
710 i_sysun=''
711 i_sysutsname=''
712 i_sysvfs=''
713 i_syswait=''
714 i_sgtty=''
715 i_termio=''
716 i_termios=''
717 i_systime=''
718 i_systimek=''
719 i_time=''
720 timeincl=''
721 i_unistd=''
722 i_ustat=''
723 i_utime=''
724 i_values=''
725 i_stdarg=''
726 i_varargs=''
727 i_varhdr=''
728 i_vfork=''
729 inc_version_list=''
730 inc_version_list_init=''
731 installprefix=''
732 installprefixexp=''
733 installstyle=''
734 installusrbinperl=''
735 intsize=''
736 longsize=''
737 shortsize=''
738 issymlink=''
739 libc=''
740 ldlibpthname=''
741 libperl=''
742 shrpenv=''
743 useshrplib=''
744 glibpth=''
745 libpth=''
746 loclibpth=''
747 plibpth=''
748 xlibpth=''
749 ignore_versioned_solibs=''
750 libs=''
751 libsdirs=''
752 libsfiles=''
753 libsfound=''
754 libspath=''
755 lns=''
756 d_PRIEUldbl=''
757 d_PRIFUldbl=''
758 d_PRIGUldbl=''
759 d_PRIeldbl=''
760 d_PRIfldbl=''
761 d_PRIgldbl=''
762 d_SCNfldbl=''
763 sPRIEUldbl=''
764 sPRIFUldbl=''
765 sPRIGUldbl=''
766 sPRIeldbl=''
767 sPRIfldbl=''
768 sPRIgldbl=''
769 sSCNfldbl=''
770 lseeksize=''
771 lseektype=''
772 make_set_make=''
773 d_mymalloc=''
774 freetype=''
775 mallocobj=''
776 mallocsrc=''
777 malloctype=''
778 usemymalloc=''
779 installman1dir=''
780 man1dir=''
781 man1direxp=''
782 man1ext=''
783 installman3dir=''
784 man3dir=''
785 man3direxp=''
786 man3ext=''
787 modetype=''
788 multiarch=''
789 mydomain=''
790 myhostname=''
791 phostname=''
792 c=''
793 n=''
794 d_eofnblk=''
795 eagain=''
796 o_nonblock=''
797 rd_nodata=''
798 need_va_copy=''
799 netdb_hlen_type=''
800 netdb_host_type=''
801 netdb_name_type=''
802 netdb_net_type=''
803 groupcat=''
804 hostcat=''
805 passcat=''
806 orderlib=''
807 ranlib=''
808 d_perl_otherlibdirs=''
809 otherlibdirs=''
810 package=''
811 spackage=''
812 pager=''
813 api_revision=''
814 api_subversion=''
815 api_version=''
816 api_versionstring=''
817 patchlevel=''
818 revision=''
819 subversion=''
820 version=''
821 perl5=''
822 perladmin=''
823 perlpath=''
824 d_nv_preserves_uv=''
825 d_nv_preserves_uv_bits=''
826 i16size=''
827 i16type=''
828 i32size=''
829 i32type=''
830 i64size=''
831 i64type=''
832 i8size=''
833 i8type=''
834 ivsize=''
835 ivtype=''
836 nvsize=''
837 nvtype=''
838 u16size=''
839 u16type=''
840 u32size=''
841 u32type=''
842 u64size=''
843 u64type=''
844 u8size=''
845 u8type=''
846 uvsize=''
847 uvtype=''
848 ivdformat=''
849 nvEUformat=''
850 nvFUformat=''
851 nvGUformat=''
852 nveformat=''
853 nvfformat=''
854 nvgformat=''
855 uvXUformat=''
856 uvoformat=''
857 uvuformat=''
858 uvxformat=''
859 pidtype=''
860 prefix=''
861 prefixexp=''
862 installprivlib=''
863 privlib=''
864 privlibexp=''
865 prototype=''
866 ptrsize=''
867 d_PRIXU64=''
868 d_PRId64=''
869 d_PRIi64=''
870 d_PRIo64=''
871 d_PRIu64=''
872 d_PRIx64=''
873 sPRIXU64=''
874 sPRId64=''
875 sPRIi64=''
876 sPRIo64=''
877 sPRIu64=''
878 sPRIx64=''
879 d_quad=''
880 quadkind=''
881 quadtype=''
882 uquadtype=''
883 drand01=''
884 randbits=''
885 randfunc=''
886 randseedtype=''
887 seedfunc=''
888 installscript=''
889 scriptdir=''
890 scriptdirexp=''
891 selectminbits=''
892 selecttype=''
893 sh=''
894 sig_count=''
895 sig_name=''
896 sig_name_init=''
897 sig_num=''
898 sig_num_init=''
899 sig_size=''
900 installsitearch=''
901 sitearch=''
902 sitearchexp=''
903 installsitebin=''
904 sitebin=''
905 sitebinexp=''
906 installsitelib=''
907 sitelib=''
908 sitelib_stem=''
909 sitelibexp=''
910 siteprefix=''
911 siteprefixexp=''
912 sizesize=''
913 sizetype=''
914 so=''
915 socksizetype=''
916 sharpbang=''
917 shsharp=''
918 spitshell=''
919 src=''
920 ssizetype=''
921 startperl=''
922 startsh=''
923 stdchar=''
924 d_stdio_stream_array=''
925 stdio_stream_array=''
926 sysman=''
927 trnl=''
928 uidformat=''
929 uidsign=''
930 uidsize=''
931 uidtype=''
932 archname64=''
933 use64bitall=''
934 use64bitint=''
935 ccflags_uselargefiles=''
936 ldflags_uselargefiles=''
937 libswanted_uselargefiles=''
938 uselargefiles=''
939 uselongdouble=''
940 usemorebits=''
941 usemultiplicity=''
942 nm_opt=''
943 nm_so_opt=''
944 runnm=''
945 usenm=''
946 useperlio=''
947 usesocks=''
948 d_oldpthreads=''
949 use5005threads=''
950 useithreads=''
951 usethreads=''
952 incpath=''
953 mips_type=''
954 usrinc=''
955 d_vendorarch=''
956 installvendorarch=''
957 vendorarch=''
958 vendorarchexp=''
959 d_vendorbin=''
960 installvendorbin=''
961 vendorbin=''
962 vendorbinexp=''
963 d_vendorlib=''
964 installvendorlib=''
965 vendorlib=''
966 vendorlib_stem=''
967 vendorlibexp=''
968 usevendorprefix=''
969 vendorprefix=''
970 vendorprefixexp=''
971 versiononly=''
972 defvoidused=''
973 voidflags=''
974 pm_apiversion=''
975 xs_apiversion=''
976 yacc=''
977 yaccflags=''
978 CONFIG=''
979
980 define='define'
981 undef='undef'
982 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
983 rmlist=''
984
985 : We must find out about Eunice early
986 eunicefix=':'
987 if test -f /etc/unixtovms; then
988         eunicefix=/etc/unixtovms
989 fi
990 if test -f /etc/unixtovms.exe; then
991         eunicefix=/etc/unixtovms.exe
992 fi
993
994 i_whoami=''
995 ccname=''
996 ccversion=''
997 perllibs=''
998 : set useposix=false in your hint file to disable the POSIX extension.
999 useposix=true
1000 : set useopcode=false in your hint file to disable the Opcode extension.
1001 useopcode=true
1002 : Trailing extension.  Override this in a hint file, if needed.
1003 _exe=''
1004 : Extra object files, if any, needed on this platform.
1005 archobjs=''
1006 archname=''
1007 : Possible local include directories to search.
1008 : Set locincpth to "" in a hint file to defeat local include searches.
1009 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1010 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1011 :
1012 : no include file wanted by default
1013 inclwanted=''
1014
1015 groupstype=''
1016 : change the next line if compiling for Xenix/286 on Xenix/386
1017 xlibpth='/usr/lib/386 /lib/386'
1018 : Possible local library directories to search.
1019 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1020 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1021
1022 : general looking path for locating libraries
1023 glibpth="/lib /usr/lib $xlibpth"
1024 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1025 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1026 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1027
1028 : Private path used by Configure to find libraries.  Its value
1029 : is prepended to libpth. This variable takes care of special
1030 : machines, like the mips.  Usually, it should be empty.
1031 plibpth=''
1032
1033 : default library list
1034 libswanted=''
1035 : some systems want to use only the non-versioned libso:s
1036 ignore_versioned_solibs=''
1037 archname64=''
1038 ccflags_uselargefiles=''
1039 ldflags_uselargefiles=''
1040 libswanted_uselargefiles=''
1041 : set usemultiplicity on the Configure command line to enable multiplicity.
1042 : set usesocks on the Configure command line to enable socks.
1043 : set usethreads on the Configure command line to enable threads.
1044 : full support for void wanted by default
1045 defvoidused=15
1046
1047 : List of libraries we want.
1048 : If anyone needs -lnet, put it in a hint file.
1049 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1050 libswanted="$libswanted dld ld sun m c cposix posix"
1051 libswanted="$libswanted ndir dir crypt sec"
1052 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1053 : We probably want to search /usr/shlib before most other libraries.
1054 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1055 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1056 glibpth="/usr/shlib $glibpth"
1057 : Do not use vfork unless overridden by a hint file.
1058 usevfork=false
1059
1060 : Find the basic shell for Bourne shell scripts
1061 case "$sh" in
1062 '')
1063         case "$SYSTYPE" in
1064         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1065         *) xxx='/bin/sh';;
1066         esac
1067         if test -f "$xxx"; then
1068                 sh="$xxx"
1069         else
1070                 : Build up a list and do a single loop so we can 'break' out.
1071                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1072                 for xxx in sh bash ksh pdksh ash; do
1073                         for p in $pth; do
1074                                 try="$try ${p}/${xxx}"
1075                         done
1076                 done
1077                 for xxx in $try; do
1078                         if test -f "$xxx"; then
1079                                 sh="$xxx";
1080                                 break
1081                         elif test -f "$xxx.exe"; then
1082                                 sh="$xxx";
1083                                 break
1084                         fi
1085                 done
1086         fi
1087         ;;
1088 esac
1089
1090 case "$sh" in
1091 '')     cat <<EOM >&2
1092 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1093
1094 Usually it's in /bin/sh.  How did you even get this far?
1095 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1096 we'll try to straighten this all out.
1097 EOM
1098         exit 1
1099         ;;
1100 esac
1101
1102 : see if sh knows # comments
1103 if `$sh -c '#' >/dev/null 2>&1`; then
1104         shsharp=true
1105         spitshell=cat
1106         xcat=/bin/cat
1107         test -f $xcat || xcat=/usr/bin/cat
1108         echo "#!$xcat" >try
1109         $eunicefix try
1110         chmod +x try
1111         ./try > today
1112         if test -s today; then
1113                 sharpbang='#!'
1114         else
1115                 echo "#! $xcat" > try
1116                 $eunicefix try
1117                 chmod +x try
1118                 ./try > today
1119                 if test -s today; then
1120                         sharpbang='#! '
1121                 else
1122                         sharpbang=': use '
1123                 fi
1124         fi
1125 else
1126         echo " "
1127         echo "Your $sh doesn't grok # comments--I will strip them later on."
1128         shsharp=false
1129         cd ..
1130         echo "exec grep -v '^[  ]*#'" >spitshell
1131         chmod +x spitshell
1132         $eunicefix spitshell
1133         spitshell=`pwd`/spitshell
1134         cd UU
1135         echo "I presume that if # doesn't work, #! won't work either!"
1136         sharpbang=': use '
1137 fi
1138 rm -f try today
1139
1140 : figure out how to guarantee sh startup
1141 case "$startsh" in
1142 '') startsh=${sharpbang}${sh} ;;
1143 *)
1144 esac
1145 cat >try <<EOSS
1146 $startsh
1147 set abc
1148 test "$?abc" != 1
1149 EOSS
1150
1151 chmod +x try
1152 $eunicefix try
1153 if ./try; then
1154         : echo "Yup, it does."
1155 else
1156         echo "Hmm... '$startsh' does not guarantee sh startup..."
1157         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1158 fi
1159 rm -f try
1160
1161
1162 : Save command line options in file UU/cmdline.opt for later use in
1163 : generating config.sh.
1164 cat > cmdline.opt <<EOSH
1165 # Configure command line arguments.
1166 config_arg0='$0'
1167 config_args='$*'
1168 config_argc=$#
1169 EOSH
1170 argn=1
1171 for arg in "$@"; do
1172         cat >>cmdline.opt <<EOSH
1173 config_arg$argn='$arg'
1174 EOSH
1175         argn=`expr $argn + 1`
1176 done
1177
1178 : produce awk script to parse command line options
1179 cat >options.awk <<'EOF'
1180 BEGIN {
1181         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1182
1183         len = length(optstr);
1184         for (i = 1; i <= len; i++) {
1185                 c = substr(optstr, i, 1);
1186                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1187                 if (a == ":") {
1188                         arg[c] = 1;
1189                         i++;
1190                 }
1191                 opt[c] = 1;
1192         }
1193 }
1194 {
1195         expect = 0;
1196         str = $0;
1197         if (substr(str, 1, 1) != "-") {
1198                 printf("'%s'\n", str);
1199                 next;
1200         }
1201         len = length($0);
1202         for (i = 2; i <= len; i++) {
1203                 c = substr(str, i, 1);
1204                 if (!opt[c]) {
1205                         printf("-%s\n", substr(str, i));
1206                         next;
1207                 }
1208                 printf("-%s\n", c);
1209                 if (arg[c]) {
1210                         if (i < len)
1211                                 printf("'%s'\n", substr(str, i + 1));
1212                         else
1213                                 expect = 1;
1214                         next;
1215                 }
1216         }
1217 }
1218 END {
1219         if (expect)
1220                 print "?";
1221 }
1222 EOF
1223
1224 : process the command line options
1225 set X `for arg in "$@"; do echo "X$arg"; done |
1226         sed -e s/X// | awk -f options.awk`
1227 eval "set $*"
1228 shift
1229 rm -f options.awk
1230
1231 : set up default values
1232 fastread=''
1233 reuseval=false
1234 config_sh=''
1235 alldone=''
1236 error=''
1237 silent=''
1238 extractsh=''
1239 override=''
1240 knowitall=''
1241 rm -f optdef.sh posthint.sh
1242 cat >optdef.sh <<EOS
1243 $startsh
1244 EOS
1245
1246
1247 : option parsing
1248 while test $# -gt 0; do
1249         case "$1" in
1250         -d) shift; fastread=yes;;
1251         -e) shift; alldone=cont;;
1252         -f)
1253                 shift
1254                 cd ..
1255                 if test -r "$1"; then
1256                         config_sh="$1"
1257                 else
1258                         echo "$me: cannot read config file $1." >&2
1259                         error=true
1260                 fi
1261                 cd UU
1262                 shift;;
1263         -h) shift; error=true;;
1264         -r) shift; reuseval=true;;
1265         -s) shift; silent=true; realsilent=true;;
1266         -E) shift; alldone=exit;;
1267         -K) shift; knowitall=true;;
1268         -O) shift; override=true;;
1269         -S) shift; silent=true; extractsh=true;;
1270         -D)
1271                 shift
1272                 case "$1" in
1273                 *=)
1274                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1275                         echo "$me: ignoring -D $1" >&2
1276                         ;;
1277                 *=*) echo "$1" | \
1278                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1279                 *) echo "$1='define'" >> optdef.sh;;
1280                 esac
1281                 shift
1282                 ;;
1283         -U)
1284                 shift
1285                 case "$1" in
1286                 *=) echo "$1" >> optdef.sh;;
1287                 *=*)
1288                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1289                         echo "$me: ignoring -U $1" >&2
1290                         ;;
1291                 *) echo "$1='undef'" >> optdef.sh;;
1292                 esac
1293                 shift
1294                 ;;
1295         -A)
1296             shift
1297             xxx=''
1298             yyy="$1"
1299             zzz=''
1300             uuu=undef
1301             case "$yyy" in
1302             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1303                  case "$zzz" in
1304                  *:*) zzz='' ;;
1305                  *)   xxx=append
1306                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1307                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1308                  esac
1309                  ;;
1310             esac
1311             case "$xxx" in
1312             '')  case "$yyy" in
1313                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1314                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1315                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1316                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1317                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1318                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1319                  esac
1320                  ;;       
1321             esac
1322             case "$xxx" in
1323             append)
1324                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1325             clear)
1326                 echo "$yyy=''"                  >> posthint.sh ;;
1327             define)
1328                 case "$zzz" in
1329                 '') zzz=define ;;
1330                 esac
1331                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1332             eval)
1333                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1334             prepend)
1335                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1336             undef)
1337                 case "$zzz" in
1338                 '') zzz="$uuu" ;;
1339                 esac
1340                 echo "$yyy=$zzz"                >> posthint.sh ;;
1341             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1342             esac
1343             shift
1344             ;;
1345         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1346             exit 0;;
1347         --) break;;
1348         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1349         *) break;;
1350         esac
1351 done
1352
1353 case "$error" in
1354 true)
1355         cat >&2 <<EOM
1356 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1357                  [-U symbol] [-U symbol=] [-A command:symbol...]
1358   -d : use defaults for all answers.
1359   -e : go on without questioning past the production of config.sh.
1360   -f : specify an alternate default configuration file.
1361   -h : print this help message and exit (with an error status).
1362   -r : reuse C symbols value if possible (skips costly nm extraction).
1363   -s : silent mode, only echoes questions and essential information.
1364   -D : define symbol to have some value:
1365          -D symbol         symbol gets the value 'define'
1366          -D symbol=value   symbol gets the value 'value'
1367   -E : stop at the end of questions, after having produced config.sh.
1368   -K : do not use unless you know what you are doing.
1369   -O : let -D and -U override definitions from loaded configuration file.
1370   -S : perform variable substitutions on all .SH files (can mix with -f)
1371   -U : undefine symbol:
1372          -U symbol    symbol gets the value 'undef'
1373          -U symbol=   symbol gets completely empty
1374   -A : manipulate symbol after the platform specific hints have been applied:
1375          -A symbol=value                append " "value to symbol
1376          -A append:symbol=value         append value to symbol
1377          -A define:symbol=value         define symbol to have value
1378          -A clear:symbol                define symbol to be ''
1379          -A define:symbol               define symbol to be 'define'
1380          -A eval:symbol=value           define symbol to be eval of value
1381          -A prepend:symbol=value        prepend value to symbol
1382          -A undef:symbol                define symbol to be 'undef'
1383          -A undef:symbol=               define symbol to be ''
1384   -V : print version number and exit (with a zero status).
1385 EOM
1386         exit 1
1387         ;;
1388 esac
1389
1390 : Sanity checks
1391 case "$fastread$alldone" in
1392 yescont|yesexit) ;;
1393 *)
1394         case "$extractsh" in
1395         true) ;;
1396         *)
1397                 if test ! -t 0; then
1398                         echo "Say 'sh Configure', not 'sh <Configure'"
1399                         exit 1
1400                 fi
1401                 ;;
1402         esac
1403         ;;
1404 esac
1405
1406 exec 4>&1
1407 case "$silent" in
1408 true) exec 1>/dev/null;;
1409 esac
1410
1411 : run the defines and the undefines, if any, but leave the file out there...
1412 touch optdef.sh
1413 . ./optdef.sh
1414 : create the posthint manipulation script and leave the file out there...
1415 touch posthint.sh
1416
1417 : set package name
1418 package=perl5
1419 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1420 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1421 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1422 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1423 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1424 esac
1425
1426 : Some greps do not return status, grrr.
1427 echo "grimblepritz" >grimble
1428 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1429         contains=contains
1430 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1431         contains=grep
1432 else
1433         contains=contains
1434 fi
1435 rm -f grimble
1436 : the following should work in any shell
1437 case "$contains" in
1438 contains*)
1439         echo " "
1440         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1441         cat >contains <<'EOSS'
1442 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1443 EOSS
1444 chmod +x contains
1445 esac
1446
1447 : Find the path to the source tree
1448 case "$src" in
1449 '') case "$0" in
1450     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1451          case "$src" in
1452          /*)    ;;
1453          .)     ;;
1454          *)     src=`cd ../$src && pwd` ;;
1455          esac
1456          ;;
1457     *)   src='.';;
1458     esac;;
1459 esac
1460 case "$src" in
1461 '')     src=/
1462         rsrc=/
1463         ;;
1464 /*) rsrc="$src";;
1465 *) rsrc="../$src";;
1466 esac
1467 if test -f $rsrc/Configure && \
1468         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1469 then
1470    : found it, so we are ok.
1471 else
1472         rsrc=''
1473         for src in . .. ../.. ../../.. ../../../..; do
1474                 if test -f ../$src/Configure && \
1475                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1476                 then
1477                         rsrc=../$src
1478                         break
1479                 fi
1480         done
1481 fi
1482 case "$rsrc" in
1483 '')
1484         cat <<EOM >&4
1485
1486 Sorry, I can't seem to locate the source dir for $package.  Please start
1487 Configure with an explicit path -- i.e. /some/path/Configure.
1488
1489 EOM
1490         exit 1
1491         ;;
1492 ../.)   rsrc='..';;
1493 *)
1494         echo " "
1495         echo "Sources for $package found in \"$src\"." >&4
1496         ;;
1497 esac
1498
1499 : script used to extract .SH files with variable substitutions
1500 cat >extract <<'EOS'
1501 CONFIGDOTSH=true
1502 echo "Doing variable substitutions on .SH files..."
1503 if test -f $src/MANIFEST; then
1504         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1505 else
1506         echo "(Looking for .SH files under the source directory.)"
1507         set x `(cd $src; find . -name "*.SH" -print)`
1508 fi
1509 shift
1510 case $# in
1511 0) set x `(cd $src; echo *.SH)`; shift;;
1512 esac
1513 if test ! -f $src/$1; then
1514         shift
1515 fi
1516 mkdir_p='
1517 name=$1;
1518 create="";
1519 while test $name; do
1520         if test ! -d "$name"; then
1521                 create="$name $create";
1522                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1523                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1524         else
1525                 name="";
1526         fi;
1527 done;
1528 for file in $create; do
1529         mkdir $file;
1530 done
1531 '
1532 for file in $*; do
1533         case "$src" in
1534         ".")
1535                 case "$file" in
1536                 */*)
1537                         dir=`expr X$file : 'X\(.*\)/'`
1538                         file=`expr X$file : 'X.*/\(.*\)'`
1539                         (cd $dir && . ./$file)
1540                         ;;
1541                 *)
1542                         . ./$file
1543                         ;;
1544                 esac
1545                 ;;
1546         *)
1547                 case "$file" in
1548                 */*)
1549                         dir=`expr X$file : 'X\(.*\)/'`
1550                         file=`expr X$file : 'X.*/\(.*\)'`
1551                         (set x $dir; shift; eval $mkdir_p)
1552                         sh <$src/$dir/$file
1553                         ;;
1554                 *)
1555                         sh <$src/$file
1556                         ;;
1557                 esac
1558                 ;;
1559         esac
1560 done
1561 if test -f $src/config_h.SH; then
1562         if test ! -f config.h; then
1563         : oops, they left it out of MANIFEST, probably, so do it anyway.
1564         . $src/config_h.SH
1565         fi
1566 fi
1567 EOS
1568
1569 : extract files and exit if asked to do so
1570 case "$extractsh" in
1571 true)
1572         case "$realsilent" in
1573         true) ;;
1574         *) exec 1>&4;;
1575         esac
1576         case "$config_sh" in
1577         '') config_sh='config.sh';;
1578         esac
1579         echo " "
1580         echo "Fetching answers from $config_sh..."
1581         cd ..
1582         . $config_sh
1583         test "$override" && . ./optdef.sh
1584         echo " "
1585         . UU/extract
1586         rm -rf UU
1587         echo "Done."
1588         exit 0
1589         ;;
1590 esac
1591
1592 : Eunice requires " " instead of "", can you believe it
1593 echo " "
1594 : Here we go...
1595 echo "Beginning of configuration questions for $package."
1596
1597 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1598
1599 : first determine how to suppress newline on echo command
1600 echo " "
1601 echo "Checking echo to see how to suppress newlines..."
1602 (echo "hi there\c" ; echo " ") >.echotmp
1603 if $contains c .echotmp >/dev/null 2>&1 ; then
1604         echo "...using -n."
1605         n='-n'
1606         c=''
1607 else
1608         cat <<'EOM'
1609 ...using \c
1610 EOM
1611         n=''
1612         c='\c'
1613 fi
1614 echo $n "The star should be here-->$c"
1615 echo '*'
1616 rm -f .echotmp
1617
1618 : Now test for existence of everything in MANIFEST
1619 echo " "
1620 if test -f $rsrc/MANIFEST; then
1621         echo "First let's make sure your kit is complete.  Checking..." >&4
1622         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1623         rm -f missing
1624         tmppwd=`pwd`
1625         for filelist in x??; do
1626                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1627         done
1628         if test -s missing; then
1629                 cat missing >&4
1630                 cat >&4 <<'EOM'
1631
1632 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1633
1634 You have the option of continuing the configuration process, despite the
1635 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1636 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1637 and contact the author (perlbug@perl.org).
1638
1639 EOM
1640                 echo $n "Continue? [n] $c" >&4
1641                 read ans
1642                 case "$ans" in
1643                 y*)
1644                         echo "Continuing..." >&4
1645                         rm -f missing
1646                         ;;
1647                 *)
1648                         echo "ABORTING..." >&4
1649                         kill $$
1650                         ;;
1651                 esac
1652         else
1653                 echo "Looks good..."
1654         fi
1655 else
1656         echo "There is no MANIFEST file.  I hope your kit is complete !"
1657 fi
1658 rm -f missing x??
1659
1660 echo " "
1661 : Find the appropriate value for a newline for tr
1662 if test -n "$DJGPP"; then
1663        trnl='\012'
1664 fi
1665 if test X"$trnl" = X; then
1666         case "`echo foo|tr '\n' x 2>/dev/null`" in
1667         foox) trnl='\n' ;;
1668         esac
1669 fi
1670 if test X"$trnl" = X; then
1671         case "`echo foo|tr '\012' x 2>/dev/null`" in
1672         foox) trnl='\012' ;;
1673         esac
1674 fi
1675 if test X"$trnl" = X; then
1676         cat <<EOM >&2
1677
1678 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1679
1680 EOM
1681         exit 1
1682 fi
1683
1684 : compute the number of columns on the terminal for proper question formatting
1685 case "$COLUMNS" in
1686 '') COLUMNS='80';;
1687 esac
1688
1689 : set up the echo used in my read
1690 myecho="case \"\$xxxm\" in
1691 '') echo $n \"\$rp $c\" >&4;;
1692 *) case \"\$rp\" in
1693         '') echo $n \"[\$xxxm] $c\";;
1694         *)
1695                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1696                         echo \"\$rp\" >&4
1697                         echo $n \"[\$xxxm] $c\" >&4
1698                 else
1699                         echo $n \"\$rp [\$xxxm] $c\" >&4
1700                 fi
1701                 ;;
1702         esac;;
1703 esac"
1704
1705 : now set up to do reads with possible shell escape and default assignment
1706 cat <<EOSC >myread
1707 $startsh
1708 xxxm=\$dflt
1709 $myecho
1710 ans='!'
1711 case "\$fastread" in
1712 yes) case "\$dflt" in
1713         '') ;;
1714         *) ans='';
1715                 case "\$silent-\$rp" in
1716                 true-) ;;
1717                 *) echo " " >&4;;
1718                 esac;;
1719         esac;;
1720 *) case "\$silent" in
1721         true) case "\$rp" in
1722                 '') ans='';;
1723                 esac;;
1724         esac;;
1725 esac
1726 while expr "X\$ans" : "X!" >/dev/null; do
1727         read answ
1728         set x \$xxxm
1729         shift
1730         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1731         case  "\$answ" in
1732         "!")
1733                 sh 1>&4
1734                 echo " "
1735                 $myecho
1736                 ;;
1737         !*)
1738                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1739                 shift
1740                 sh 1>&4 -c "\$*"
1741                 echo " "
1742                 $myecho
1743                 ;;
1744         "\$ans")
1745                 case "\$ans" in
1746                 \\&*)
1747                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1748                         shift
1749                         case "\$1" in
1750                         -d)
1751                                 fastread=yes
1752                                 echo "(OK, I'll run with -d after this question.)" >&4
1753                                 ;;
1754                         -*)
1755                                 echo "*** Sorry, \$1 not supported yet." >&4
1756                                 ;;
1757                         esac
1758                         $myecho
1759                         ans=!
1760                         ;;
1761                 esac;;
1762         *)
1763                 case "\$aok" in
1764                 y)
1765                         echo "*** Substitution done -- please confirm."
1766                         xxxm="\$ans"
1767                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1768                         xxxm="\$ans"
1769                         ans=!
1770                         ;;
1771                 *)
1772                         echo "*** Error -- try again."
1773                         ans=!
1774                         ;;
1775                 esac
1776                 $myecho
1777                 ;;
1778         esac
1779         case "\$ans\$xxxm\$nostick" in
1780         '')
1781                 ans=!
1782                 $myecho
1783                 ;;
1784         esac
1785 done
1786 case "\$ans" in
1787 '') ans="\$xxxm";;
1788 esac
1789 EOSC
1790
1791 : create .config dir to save info across Configure sessions
1792 test -d ../.config || mkdir ../.config
1793 cat >../.config/README <<EOF
1794 This directory created by Configure to save information that should
1795 persist across sessions for $package.
1796
1797 You may safely delete it if you wish.
1798 EOF
1799
1800 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1801 case "$usedevel" in
1802 $define|true|[yY]*) ;;
1803 *) case "$xversion" in
1804    *[13579])
1805         cat >&4 <<EOH
1806 *** WHOA THERE!!! ***
1807
1808     This is an UNSTABLE DEVELOPMENT release.
1809     The version of this $package distribution is $xversion, that is, odd,
1810     (as opposed to even) and that signifies a development release.
1811     If you want a maintenance release, you want an even-numbered version.
1812
1813     Do ***NOT*** install this into production use.
1814     Data corruption and crashes are possible.
1815
1816     It is most seriously suggested that you do not continue any further
1817     unless you want to help in developing and debugging Perl.
1818
1819     If you *still* want to build perl, you can answer 'y' now,
1820     or pass -Dusedevel to Configure.
1821
1822 EOH
1823         rp='Do you really want to continue?'
1824         dflt='n'
1825         . ./myread
1826         case "$ans" in
1827         [yY]) echo >&4 "Okay, continuing."
1828               usedevel="$define" ;;
1829         *) echo >&4 "Okay, bye."
1830            exit 1
1831            ;;
1832         esac
1833         ;;
1834     esac
1835     ;;
1836 esac
1837 case "$usedevel" in
1838 $define|true|[yY]*)
1839         case "$versiononly" in
1840         '') versiononly="$define" ;;
1841         esac
1842         case "$installusrbinperl" in
1843         '') installusrbinperl="$undef" ;;
1844         esac
1845         ;;
1846 esac
1847
1848 : general instructions
1849 needman=true
1850 firsttime=true
1851 user=`(logname) 2>/dev/null`
1852 case "$user" in
1853 '') user=`whoami 2>&1`;;
1854 esac
1855 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1856         firsttime=false
1857         echo " "
1858         rp='Would you like to see the instructions?'
1859         dflt=n
1860         . ./myread
1861         case "$ans" in
1862         [yY]*) ;;
1863         *) needman=false;;
1864         esac
1865 fi
1866 if $needman; then
1867         cat <<EOH
1868
1869 This installation shell script will examine your system and ask you questions
1870 to determine how the perl5 package should be installed. If you get
1871 stuck on a question, you may use a ! shell escape to start a subshell or
1872 execute a command.  Many of the questions will have default answers in square
1873 brackets; typing carriage return will give you the default.
1874
1875 On some of the questions which ask for file or directory names you are allowed
1876 to use the ~name construct to specify the login directory belonging to "name",
1877 even if you don't have a shell which knows about that.  Questions where this is
1878 allowed will be marked "(~name ok)".
1879
1880 EOH
1881         rp=''
1882         dflt='Type carriage return to continue'
1883         . ./myread
1884         cat <<'EOH'
1885
1886 The prompter used in this script allows you to use shell variables and
1887 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1888 in the default answer, as if the default line was a set of arguments given to a
1889 script shell.  This means you may also use $* to repeat the whole default line,
1890 so you do not have to re-type everything to add something to the default.
1891
1892 Everytime there is a substitution, you will have to confirm.  If there is an
1893 error (e.g. an unmatched backtick), the default answer will remain unchanged
1894 and you will be prompted again.
1895
1896 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1897 the questions and use the computed defaults (or the previous answers if there
1898 was already a config.sh file). Type 'Configure -h' for a list of options.
1899 You may also start interactively and then answer '& -d' at any prompt to turn
1900 on the non-interactive behaviour for the remainder of the execution.
1901
1902 EOH
1903         . ./myread
1904         cat <<EOH
1905
1906 Much effort has been expended to ensure that this shell script will run on any
1907 Unix system.  If despite that it blows up on yours, your best bet is to edit
1908 Configure and run it again.  If you can't run Configure for some reason,
1909 you'll have to generate a config.sh file by hand.  Whatever problems you
1910 have, let me (perlbug@perl.org) know how I blew it.
1911
1912 This installation script affects things in two ways:
1913
1914 1) it may do direct variable substitutions on some of the files included
1915    in this kit.
1916 2) it builds a config.h file for inclusion in C programs.  You may edit
1917    any of these files as the need arises after running this script.
1918
1919 If you make a mistake on a question, there is no easy way to back up to it
1920 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1921 files.  Configure will offer to let you do this before it runs the SH files.
1922
1923 EOH
1924         dflt='Type carriage return to continue'
1925         . ./myread
1926         case "$firsttime" in
1927         true) echo $user >>../.config/instruct;;
1928         esac
1929 fi
1930
1931 : find out where common programs are
1932 echo " "
1933 echo "Locating common programs..." >&4
1934 cat <<EOSC >loc
1935 $startsh
1936 case \$# in
1937 0) exit 1;;
1938 esac
1939 thing=\$1
1940 shift
1941 dflt=\$1
1942 shift
1943 for dir in \$*; do
1944         case "\$thing" in
1945         .)
1946         if test -d \$dir/\$thing; then
1947                 echo \$dir
1948                 exit 0
1949         fi
1950         ;;
1951         *)
1952         for thisthing in \$dir/\$thing; do
1953                 : just loop through to pick last item
1954         done
1955         if test -f \$thisthing; then
1956                 echo \$thisthing
1957                 exit 0
1958         elif test -f \$dir/\$thing.exe; then
1959                 if test -n "$DJGPP"; then
1960                         echo \$dir/\$thing.exe
1961                 else
1962                         : on Eunice apparently
1963                         echo \$dir/\$thing
1964                 fi
1965                 exit 0
1966         fi
1967         ;;
1968         esac
1969 done
1970 echo \$dflt
1971 exit 1
1972 EOSC
1973 chmod +x loc
1974 $eunicefix loc
1975 loclist="
1976 awk
1977 cat
1978 comm
1979 cp
1980 echo
1981 expr
1982 grep
1983 ls
1984 make
1985 mkdir
1986 rm
1987 sed
1988 sort
1989 touch
1990 tr
1991 uniq
1992 "
1993 trylist="
1994 Mcc
1995 ar
1996 bison
1997 byacc
1998 cpp
1999 csh
2000 date
2001 egrep
2002 gzip
2003 less
2004 ln
2005 more
2006 nm
2007 nroff
2008 pg
2009 test
2010 uname
2011 zip
2012 "
2013 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2014 pth="$pth /lib /usr/lib"
2015 for file in $loclist; do
2016         eval xxx=\$$file
2017         case "$xxx" in
2018         /*|?:[\\/]*)
2019                 if test -f "$xxx"; then
2020                         : ok
2021                 else
2022                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2023                         xxx=`./loc $file $file $pth`
2024                 fi
2025                 ;;
2026         '') xxx=`./loc $file $file $pth`;;
2027         *) xxx=`./loc $xxx $xxx $pth`;;
2028         esac
2029         eval $file=$xxx
2030         eval _$file=$xxx
2031         case "$xxx" in
2032         /*)
2033                 echo $file is in $xxx.
2034                 ;;
2035         ?:[\\/]*)
2036                 echo $file is in $xxx.
2037                 ;;
2038         *)
2039                 echo "I don't know where '$file' is, and my life depends on it." >&4
2040                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2041                 exit 1
2042                 ;;
2043         esac
2044 done
2045 echo " "
2046 echo "Don't worry if any of the following aren't found..."
2047 say=offhand
2048 for file in $trylist; do
2049         eval xxx=\$$file
2050         case "$xxx" in
2051         /*|?:[\\/]*)
2052                 if test -f "$xxx"; then
2053                         : ok
2054                 else
2055                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2056                         xxx=`./loc $file $file $pth`
2057                 fi
2058                 ;;
2059         '') xxx=`./loc $file $file $pth`;;
2060         *) xxx=`./loc $xxx $xxx $pth`;;
2061         esac
2062         eval $file=$xxx
2063         eval _$file=$xxx
2064         case "$xxx" in
2065         /*)
2066                 echo $file is in $xxx.
2067                 ;;
2068         ?:[\\/]*)
2069                 echo $file is in $xxx.
2070                 ;;
2071         *)
2072                 echo "I don't see $file out there, $say."
2073                 say=either
2074                 ;;
2075         esac
2076 done
2077 case "$egrep" in
2078 egrep)
2079         echo "Substituting grep for egrep."
2080         egrep=$grep
2081         ;;
2082 esac
2083 case "$ln" in
2084 ln)
2085         echo "Substituting cp for ln."
2086         ln=$cp
2087         ;;
2088 esac
2089 case "$test" in
2090 test)
2091         echo "Hopefully test is built into your sh."
2092         ;;
2093 *)
2094         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2095                 echo "Using the test built into your sh."
2096                 test=test
2097                 _test=test
2098         fi
2099         ;;
2100 esac
2101 case "$echo" in
2102 echo)
2103         echo "Hopefully echo is built into your sh."
2104         ;;
2105 '') ;;
2106 *)
2107         echo " "
2108 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2109         $echo $n "hi there$c" >foo1
2110         echo $n "hi there$c" >foo2
2111         if cmp foo1 foo2 >/dev/null 2>&1; then
2112                 echo "They are compatible.  In fact, they may be identical."
2113         else
2114                 case "$n" in
2115                 '-n') n='' c='\c';;
2116                 *) n='-n' c='';;
2117                 esac
2118                 cat <<FOO
2119 They are not compatible!  You are probably running ksh on a non-USG system.
2120 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2121 have echo built in and we may have to run some Bourne shell scripts.  That
2122 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2123
2124 FOO
2125                 $echo $n "The star should be here-->$c"
2126                 $echo "*"
2127         fi
2128         $rm -f foo1 foo2
2129         ;;
2130 esac
2131
2132 cat <<EOS >checkcc
2133 $startsh
2134 EOS
2135 cat <<'EOSC' >>checkcc
2136 case "$cc" in
2137 '') ;;
2138 *)  $rm -f try try.*
2139     $cat >try.c <<EOM
2140 int main(int argc, char *argv[]) {
2141   return 0;
2142 }
2143 EOM
2144     if $cc -o try $ccflags try.c; then
2145        :
2146     else
2147         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2148         despair=yes
2149         trygcc=yes
2150         case "$cc" in
2151         *gcc*) trygcc=no ;;
2152         esac
2153         case "`$cc -v -c try.c 2>&1`" in
2154         *gcc*) trygcc=no ;;
2155         esac
2156         if $test X"$trygcc" = Xyes; then
2157             if gcc -o try -c try.c; then
2158                 echo " "
2159                 echo "You seem to have a working gcc, though." >&4
2160                 rp="Would you like to use it?"
2161                 dflt=y
2162                 if $test -f myread; then
2163                     . ./myread
2164                 else
2165                     if $test -f UU/myread; then
2166                         . ./UU/myread
2167                     else
2168                         echo "Cannot find myread, sorry.  Aborting." >&2
2169                         exit 1
2170                     fi
2171                 fi  
2172                 case "$ans" in
2173                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2174                 esac
2175             fi
2176         fi
2177         if $test X"$despair" = Xyes; then
2178             $cat >&4 <<EOM
2179 You need to find a working C compiler.
2180 Either (purchase and) install the C compiler supplied by your OS vendor,
2181 or for a free C compiler try http://gcc.gnu.org/
2182 I cannot continue any further, aborting.
2183 EOM
2184             exit 1
2185         fi
2186     fi
2187     $rm -f try try.*
2188     ;;
2189 esac
2190 EOSC
2191
2192 : determine whether symbolic links are supported
2193 echo " "
2194 $touch blurfl
2195 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2196         echo "Symbolic links are supported." >&4
2197         lns="$ln -s"
2198 else
2199         echo "Symbolic links are NOT supported." >&4
2200         lns="$ln"
2201 fi
2202 $rm -f blurfl sym
2203
2204 : determine whether symbolic links are supported
2205 echo " "
2206 case "$lns" in
2207 *"ln -s")
2208         echo "Checking how to test for symbolic links..." >&4
2209         $lns blurfl sym
2210         if $test "X$issymlink" = X; then
2211                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2212                 if test $? = 0; then
2213                         issymlink="test -h"
2214                 fi              
2215         fi
2216         if $test "X$issymlink" = X; then
2217                 if  $test -h >/dev/null 2>&1; then
2218                         issymlink="$test -h"
2219                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2220                 fi              
2221         fi
2222         if $test "X$issymlink" = X; then
2223                 if $test -L sym 2>/dev/null; then
2224                         issymlink="$test -L"
2225                 fi
2226         fi
2227         if $test "X$issymlink" != X; then
2228                 echo "You can test for symbolic links with '$issymlink'." >&4
2229         else
2230                 echo "I do not know how you can test for symbolic links." >&4
2231         fi
2232         $rm -f blurfl sym
2233         ;;
2234 *)      echo "No symbolic links, so not testing for their testing..." >&4
2235         ;;
2236 esac
2237 echo " "
2238
2239
2240 case "$mksymlinks" in
2241 $define|true|[yY]*)
2242         case "$src" in
2243         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2244                 exit 1
2245                 ;;
2246         *)      case "$lns:$issymlink" in
2247                 *"ln -s:"*"test -"?)
2248                         echo "Creating the symbolic links..." >&4
2249                         echo "(First creating the subdirectories...)" >&4
2250                         cd ..
2251                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2252                                 read directory
2253                                 test -z "$directory" && break
2254                                 mkdir -p $directory
2255                         done
2256                         # Sanity check 1.
2257                         if test ! -d t/base; then
2258                                 echo "Failed to create the subdirectories.  Aborting." >&4
2259                                 exit 1
2260                         fi
2261                         echo "(Then creating the symlinks...)" >&4
2262                         awk '{print $1}' $src/MANIFEST | while true; do
2263                                 read filename
2264                                 test -z "$filename" && break
2265                                 if test -f $filename; then
2266                                         if $issymlink $filename; then
2267                                                 rm -f $filename
2268                                         fi
2269                                 fi
2270                                 if test -f $filename; then
2271                                         echo "$filename already exists, not symlinking."
2272                                 else
2273                                         ln -s $src/$filename $filename
2274                                 fi
2275                         done
2276                         # Sanity check 2.
2277                         if test ! -f t/base/commonsense.t; then
2278                                 echo "Failed to create the symlinks.  Aborting." >&4
2279                                 exit 1
2280                         fi
2281                         cd UU
2282                         ;;
2283                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2284                         ;;
2285                 esac
2286                 ;;
2287         esac
2288         ;;
2289 esac
2290
2291 : see whether [:lower:] and [:upper:] are supported character classes
2292 echo " "
2293 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2294 ABYZ)
2295         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2296         up='[:upper:]'
2297         low='[:lower:]'
2298         ;;
2299 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2300         # (0xc9 and 0xd1), therefore that is a nice testing point.
2301         if test "X$up" = X -o "X$low" = X; then
2302             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2303             ij) up='[A-Z]'
2304                 low='[a-z]'
2305                 ;;
2306             esac
2307         fi
2308         if test "X$up" = X -o "X$low" = X; then
2309             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2310             ij) up='A-Z'
2311                 low='a-z'
2312                 ;;
2313             esac
2314         fi
2315         if test "X$up" = X -o "X$low" = X; then
2316             case "`echo IJ | od -x 2>/dev/null`" in
2317             *C9D1*|*c9d1*)
2318                 echo "Hey, this might be EBCDIC." >&4
2319                 if test "X$up" = X -o "X$low" = X; then
2320                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2321                     ij) up='[A-IJ-RS-Z]'
2322                         low='[a-ij-rs-z]'
2323                         ;;
2324                     esac
2325                 fi
2326                 if test "X$up" = X -o "X$low" = X; then
2327                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2328                     ij) up='A-IJ-RS-Z'
2329                         low='a-ij-rs-z'
2330                         ;;
2331                     esac
2332                 fi
2333                 ;;
2334             esac
2335         fi
2336 esac
2337 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2338 ij)
2339     echo "Using $up and $low to convert case." >&4
2340     ;;
2341 *)
2342     echo "I don't know how to translate letters from upper to lower case." >&4
2343     echo "Your tr is not acting any way I know of." >&4
2344     exit 1
2345     ;;
2346 esac
2347 : set up the translation script tr, must be called with ./tr of course
2348 cat >tr <<EOSC
2349 $startsh
2350 case "\$1\$2" in
2351 '[A-Z][a-z]') exec $tr '$up' '$low';;
2352 '[a-z][A-Z]') exec $tr '$low' '$up';;
2353 esac
2354 exec $tr "\$@"
2355 EOSC
2356 chmod +x tr
2357 $eunicefix tr
2358
2359 : Try to determine whether config.sh was made on this system
2360 case "$config_sh" in
2361 '')
2362 myuname=`$uname -a 2>/dev/null`
2363 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2364 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2365 # because the A-Z/a-z are not consecutive.
2366 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2367         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2368 newmyuname="$myuname"
2369 dflt=n
2370 case "$knowitall" in
2371 '')
2372         if test -f ../config.sh; then
2373                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2374                         eval "`grep myuname= ../config.sh`"
2375                 fi
2376                 if test "X$myuname" = "X$newmyuname"; then
2377                         dflt=y
2378                 fi
2379         fi
2380         ;;
2381 *) dflt=y;;
2382 esac
2383
2384 : Get old answers from old config file if Configure was run on the
2385 : same system, otherwise use the hints.
2386 hint=default
2387 cd ..
2388 if test -f config.sh; then
2389         echo " "
2390         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2391         . UU/myread
2392         case "$ans" in
2393         n*|N*) echo "OK, I'll ignore it."
2394                 mv config.sh config.sh.old
2395                 myuname="$newmyuname"
2396                 ;;
2397         *)  echo "Fetching default answers from your old config.sh file..." >&4
2398                 tmp_n="$n"
2399                 tmp_c="$c"
2400                 tmp_sh="$sh"
2401                 . ./config.sh
2402                 cp config.sh UU
2403                 n="$tmp_n"
2404                 c="$tmp_c"
2405                 : Older versions did not always set $sh.  Catch re-use of such
2406                 : an old config.sh.
2407                 case "$sh" in
2408                 '') sh="$tmp_sh" ;;
2409                 esac
2410                 hint=previous
2411                 ;;
2412         esac
2413 fi
2414 . ./UU/checkcc
2415 if test ! -f config.sh; then
2416         $cat <<EOM
2417
2418 First time through, eh?  I have some defaults handy for some systems
2419 that need some extra help getting the Configure answers right:
2420
2421 EOM
2422         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2423         dflt=''
2424         : Half the following guesses are probably wrong... If you have better
2425         : tests or hints, please send them to perlbug@perl.org
2426         : The metaconfig authors would also appreciate a copy...
2427         $test -f /irix && osname=irix
2428         $test -f /xenix && osname=sco_xenix
2429         $test -f /dynix && osname=dynix
2430         $test -f /dnix && osname=dnix
2431         $test -f /lynx.os && osname=lynxos
2432         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2433         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2434         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2435         $test -f /bin/mips && /bin/mips && osname=mips
2436         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2437                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2438         $test -d /usr/apollo/bin && osname=apollo
2439         $test -f /etc/saf/_sactab && osname=svr4
2440         $test -d /usr/include/minix && osname=minix
2441         if $test -d /MachTen -o -d /MachTen_Folder; then
2442                 osname=machten
2443                 if $test -x /sbin/version; then
2444                         osvers=`/sbin/version | $awk '{print $2}' |
2445                         $sed -e 's/[A-Za-z]$//'`
2446                 elif $test -x /usr/etc/version; then
2447                         osvers=`/usr/etc/version | $awk '{print $2}' |
2448                         $sed -e 's/[A-Za-z]$//'`
2449                 else
2450                         osvers="$2.$3"
2451                 fi
2452         fi
2453
2454         $test -f /sys/posix.dll &&
2455                 $test -f /usr/bin/what &&
2456                 set X `/usr/bin/what /sys/posix.dll` &&
2457                 $test "$3" = UWIN &&
2458                 osname=uwin &&
2459                 osvers="$5"
2460
2461         if $test -f $uname; then
2462                 set X $myuname
2463                 shift
2464
2465                 case "$5" in
2466                 fps*) osname=fps ;;
2467                 mips*)
2468                         case "$4" in
2469                         umips) osname=umips ;;
2470                         *) osname=mips ;;
2471                         esac;;
2472                 [23]100) osname=mips ;;
2473                 next*) osname=next ;;
2474                 i386*)
2475                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2476                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2477                                 osname='sco'
2478                                 osvers=$tmp
2479                         elif $test -f /etc/kconfig; then
2480                                 osname=isc
2481                                 if test "$lns" = "$ln -s"; then
2482                                         osvers=4
2483                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2484                                         osvers=3
2485                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2486                                         osvers=2
2487                                 fi
2488                         fi
2489                         tmp=''
2490                         ;;
2491                 pc*)
2492                         if test -n "$DJGPP"; then
2493                                 osname=dos
2494                                 osvers=djgpp
2495                         fi
2496                         ;;
2497                 esac
2498
2499                 case "$1" in
2500                 aix) osname=aix
2501                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2502                         case "$tmp" in
2503                         'not found') osvers="$4"."$3" ;;
2504                         '<3240'|'<>3240') osvers=3.2.0 ;;
2505                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2506                         '=3250'|'>3250') osvers=3.2.5 ;;
2507                         *) osvers=$tmp;;
2508                         esac
2509                         ;;
2510                 bsd386) osname=bsd386
2511                         osvers=`$uname -r`
2512                         ;;
2513                 cygwin*) osname=cygwin
2514                         osvers="$3"
2515                         ;;
2516                 *dc.osx) osname=dcosx
2517                         osvers="$3"
2518                         ;;
2519                 dnix) osname=dnix
2520                         osvers="$3"
2521                         ;;
2522                 domainos) osname=apollo
2523                         osvers="$3"
2524                         ;;
2525                 dgux) osname=dgux 
2526                         osvers="$3"
2527                         ;;
2528                 dynixptx*) osname=dynixptx
2529                         osvers=`echo "$4"|sed 's/^v//'`
2530                         ;;
2531                 freebsd) osname=freebsd 
2532                         osvers="$3" ;;
2533                 genix) osname=genix ;;
2534                 hp*) osname=hpux 
2535                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2536                         ;;
2537                 irix*) osname=irix
2538                         case "$3" in
2539                         4*) osvers=4 ;;
2540                         5*) osvers=5 ;;
2541                         *)      osvers="$3" ;;
2542                         esac
2543                         ;;
2544                 linux) osname=linux
2545                         case "$3" in
2546                         *)      osvers="$3" ;;
2547                         esac
2548                         ;;
2549                 MiNT) osname=mint
2550                         ;;
2551                 netbsd*) osname=netbsd
2552                         osvers="$3"
2553                         ;;
2554                 news-os) osvers="$3"
2555                         case "$3" in
2556                         4*) osname=newsos4 ;;
2557                         *) osname=newsos ;;
2558                         esac
2559                         ;;
2560                 next*) osname=next ;;
2561                 nonstop-ux) osname=nonstopux ;;
2562                 POSIX-BC | posix-bc ) osname=posix-bc
2563                         osvers="$3"
2564                         ;;
2565                 powerux | power_ux | powermax_os | powermaxos | \
2566                 powerunix | power_unix) osname=powerux
2567                         osvers="$3"
2568                         ;;
2569                 qnx) osname=qnx
2570                         osvers="$4"
2571                         ;;
2572                 solaris) osname=solaris
2573                         case "$3" in
2574                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2575                         *)      osvers="$3" ;;
2576                         esac
2577                         ;;
2578                 sunos) osname=sunos
2579                         case "$3" in
2580                         5*) osname=solaris
2581                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2582                         *)      osvers="$3" ;;
2583                         esac
2584                         ;;
2585                 titanos) osname=titanos
2586                         case "$3" in
2587                         1*) osvers=1 ;;
2588                         2*) osvers=2 ;;
2589                         3*) osvers=3 ;;
2590                         4*) osvers=4 ;;
2591                         *)      osvers="$3" ;;
2592                         esac
2593                         ;;
2594                 ultrix) osname=ultrix
2595                         osvers="$3"
2596                         ;;
2597                 osf1|mls+)      case "$5" in
2598                                 alpha)
2599                                         osname=dec_osf
2600                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2601                                         case "$osvers" in
2602                                         [1-9].[0-9]*) ;;
2603                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2604                                         esac
2605                                         ;;
2606                         hp*)    osname=hp_osf1  ;;
2607                         mips)   osname=mips_osf1 ;;
2608                         esac
2609                         ;;
2610                 unixware) osname=svr5
2611                         osvers="$4"
2612                         ;;
2613                 uts) osname=uts
2614                         osvers="$3"
2615                         ;;
2616                 $2) case "$osname" in
2617                         *isc*) ;;
2618                         *freebsd*) ;;
2619                         svr*)
2620                                 : svr4.x or possibly later
2621                                 case "svr$3" in 
2622                                 ${osname}*)
2623                                         osname=svr$3
2624                                         osvers=$4
2625                                         ;;
2626                                 esac
2627                                 case "$osname" in
2628                                 svr4.0)
2629                                         : Check for ESIX
2630                                         if test -f /stand/boot ; then
2631                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2632                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2633                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2634                                                         if test -n "$isesix"; then
2635                                                                 osname=esix4
2636                                                         fi
2637                                                 fi
2638                                         fi
2639                                         ;;
2640                                 esac
2641                                 ;;
2642                         *)      if test -f /etc/systemid; then
2643                                         osname=sco
2644                                         set `echo $3 | $sed 's/\./ /g'` $4
2645                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2646                                                 osvers=$1.$2.$3
2647                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2648                                                 osvers=$1.$2
2649                                         elif $test -f $src/hints/sco_$1.sh; then
2650                                                 osvers=$1
2651                                         fi
2652                                 else
2653                                         case "$osname" in
2654                                         '') : Still unknown.  Probably a generic Sys V.
2655                                                 osname="sysv"
2656                                                 osvers="$3"
2657                                                 ;;
2658                                         esac
2659                                 fi
2660                                 ;;
2661                         esac
2662                         ;;
2663                 *)      case "$osname" in
2664                         '') : Still unknown.  Probably a generic BSD.
2665                                 osname="$1"
2666                                 osvers="$3"
2667                                 ;;
2668                         esac
2669                         ;;
2670                 esac
2671         else
2672                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2673                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2674                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2675                                 osname=news_os
2676                         fi
2677                         $rm -f UU/kernel.what
2678                 elif test -d c:/.; then
2679                         set X $myuname
2680                         osname=os2
2681                         osvers="$5"
2682                 fi
2683         fi
2684         
2685         : Now look for a hint file osname_osvers, unless one has been
2686         : specified already.
2687         case "$hintfile" in
2688         ''|' ')
2689                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2690                 : Also try without trailing minor version numbers.
2691                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2692                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2693                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2694                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2695                 case "$file" in
2696                 '') dflt=none ;;
2697                 *)  case "$osvers" in
2698                         '') dflt=$file
2699                                 ;;
2700                         *)  if $test -f $src/hints/$file.sh ; then
2701                                         dflt=$file
2702                                 elif $test -f $src/hints/$xfile.sh ; then
2703                                         dflt=$xfile
2704                                 elif $test -f $src/hints/$xxfile.sh ; then
2705                                         dflt=$xxfile
2706                                 elif $test -f $src/hints/$xxxfile.sh ; then
2707                                         dflt=$xxxfile
2708                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2709                                         dflt=$xxxxfile
2710                                 elif $test -f "$src/hints/${osname}.sh" ; then
2711                                         dflt="${osname}"
2712                                 else
2713                                         dflt=none
2714                                 fi
2715                                 ;;
2716                         esac
2717                         ;;
2718                 esac
2719                 if $test -f Policy.sh ; then
2720                         case "$dflt" in
2721                         *Policy*) ;;
2722                         none) dflt="Policy" ;;
2723                         *) dflt="Policy $dflt" ;;
2724                         esac
2725                 fi
2726                 ;;
2727         *)
2728                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2729                 ;;
2730         esac
2731
2732         if $test -f Policy.sh ; then
2733                 $cat <<EOM
2734
2735 There's also a Policy hint file available, which should make the
2736 site-specific (policy) questions easier to answer.
2737 EOM
2738
2739         fi
2740
2741         $cat <<EOM
2742
2743 You may give one or more space-separated answers, or "none" if appropriate.
2744 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2745 is a good thing.  DO NOT give a wrong version or a wrong OS.
2746
2747 EOM
2748
2749         rp="Which of these apply, if any?"
2750         . UU/myread
2751         tans=$ans
2752         for file in $tans; do
2753                 if $test X$file = XPolicy -a -f Policy.sh; then
2754                         . Policy.sh
2755                         $cat Policy.sh >> UU/config.sh
2756                 elif $test -f $src/hints/$file.sh; then
2757                         . $src/hints/$file.sh
2758                         $cat $src/hints/$file.sh >> UU/config.sh
2759                 elif $test X$tans = X -o X$tans = Xnone ; then
2760                         : nothing
2761                 else
2762                         : Give one chance to correct a possible typo.
2763                         echo "$file.sh does not exist"
2764                         dflt=$file
2765                         rp="hint to use instead?"
2766                         . UU/myread
2767                         for file in $ans; do
2768                                 if $test -f "$src/hints/$file.sh"; then
2769                                         . $src/hints/$file.sh
2770                                         $cat $src/hints/$file.sh >> UU/config.sh
2771                                 elif $test X$ans = X -o X$ans = Xnone ; then
2772                                         : nothing
2773                                 else
2774                                         echo "$file.sh does not exist -- ignored."
2775                                 fi
2776                         done
2777                 fi
2778         done
2779
2780         hint=recommended
2781         : Remember our hint file for later.
2782         if $test -f "$src/hints/$file.sh" ; then
2783                 hintfile="$file"
2784         else
2785                 hintfile=''
2786         fi
2787 fi
2788 cd UU
2789 ;;
2790 *)
2791         echo " "
2792         echo "Fetching default answers from $config_sh..." >&4
2793         tmp_n="$n"
2794         tmp_c="$c"
2795         cd ..
2796         cp $config_sh config.sh 2>/dev/null
2797         chmod +w config.sh
2798         . ./config.sh
2799         cd UU
2800         cp ../config.sh .
2801         n="$tmp_n"
2802         c="$tmp_c"
2803         hint=previous
2804         ;;
2805 esac
2806 test "$override" && . ./optdef.sh
2807
2808 : Restore computed paths
2809 for file in $loclist $trylist; do
2810         eval $file="\$_$file"
2811 done
2812
2813 cat << EOM
2814
2815 Configure uses the operating system name and version to set some defaults.
2816 The default value is probably right if the name rings a bell. Otherwise,
2817 since spelling matters for me, either accept the default or answer "none"
2818 to leave it blank.
2819
2820 EOM
2821 case "$osname" in
2822         ''|' ')
2823                 case "$hintfile" in
2824                 ''|' '|none) dflt=none ;;
2825                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2826                 esac
2827                 ;;
2828         *) dflt="$osname" ;;
2829 esac
2830 rp="Operating system name?"
2831 . ./myread
2832 case "$ans" in
2833 none)  osname='' ;;
2834 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2835 esac
2836 echo " "
2837 case "$osvers" in
2838         ''|' ')
2839                 case "$hintfile" in
2840                 ''|' '|none) dflt=none ;;
2841                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2842                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2843                         case "$dflt" in
2844                         ''|' ') dflt=none ;;
2845                         esac
2846                         ;;
2847                 esac
2848                 ;;
2849         *) dflt="$osvers" ;;
2850 esac
2851 rp="Operating system version?"
2852 . ./myread
2853 case "$ans" in
2854 none)  osvers='' ;;
2855 *) osvers="$ans" ;;
2856 esac
2857
2858
2859 . ./posthint.sh
2860
2861 : who configured the system
2862 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2863 cf_by=`(logname) 2>/dev/null`
2864 case "$cf_by" in
2865 "")
2866         cf_by=`(whoami) 2>/dev/null`
2867         case "$cf_by" in
2868         "") cf_by=unknown ;;
2869         esac ;;
2870 esac
2871
2872 : set up the script used to warn in case of inconsistency
2873 cat <<EOS >whoa
2874 $startsh
2875 EOS
2876 cat <<'EOSC' >>whoa
2877 dflt=y
2878 echo " "
2879 echo "*** WHOA THERE!!! ***" >&4
2880 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2881 rp="    Keep the $hint value?"
2882 . ./myread
2883 case "$ans" in
2884 y) td=$was; tu=$was;;
2885 esac
2886 EOSC
2887
2888 : function used to set $1 to $val
2889 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2890 case "$val$was" in
2891 $define$undef) . ./whoa; eval "$var=\$td";;
2892 $undef$define) . ./whoa; eval "$var=\$tu";;
2893 *) eval "$var=$val";;
2894 esac'
2895
2896 case "$usethreads" in
2897 $define|true|[yY]*)     dflt='y';;
2898 *) dflt='n';;
2899 esac
2900 cat <<EOM
2901
2902 Perl can be built to take advantage of threads on some systems.
2903 To do so, Configure can be run with -Dusethreads.
2904
2905 Note that threading is a highly experimental feature, and
2906 some known race conditions still remain.  If you choose to try
2907 it, be very sure to not actually deploy it for production
2908 purposes.  README.threads has more details, and is required
2909 reading if you enable threads.
2910
2911 If this doesn't make any sense to you, just accept the default '$dflt'.
2912 EOM
2913 rp='Build a threading Perl?'
2914 . ./myread
2915 case "$ans" in
2916 y|Y)    val="$define" ;;
2917 *)      val="$undef" ;;
2918 esac
2919 set usethreads
2920 eval $setvar
2921
2922 case "$usethreads" in
2923 $define)
2924         $cat <<EOM
2925
2926 As of 5.5.640, Perl has two different internal threading implementations,
2927 the 5.005 version (5005threads) and an interpreter-based version
2928 (ithreads) that has one interpreter per thread.  Both are very 
2929 experimental.  This arrangement exists to help developers work out
2930 which one is better.
2931
2932 If you're a casual user, you probably don't want interpreter-threads
2933 at this time.  There doesn't yet exist a way to create threads from
2934 within Perl in this model, i.e., "use Thread;" will NOT work.
2935 EOM
2936         : Default to ithreads unless overridden on command line or with
2937         : old config.sh
2938         dflt='y'
2939         case "$use5005threads" in
2940                 $define|true|[yY]*) dflt='n';;
2941         esac
2942         case "$useithreads" in
2943                 $undef|false|[nN]*) dflt='n';;
2944         esac
2945         rp='Use interpreter-based ithreads?'
2946         . ./myread
2947         case "$ans" in
2948         y|Y)    val="$define" ;;
2949         *)      val="$undef" ;;
2950         esac
2951         set useithreads
2952         eval $setvar
2953         : Now set use5005threads to the opposite value.
2954         case "$useithreads" in
2955         $define) val="$undef" ;;
2956         *) val="$define" ;;
2957         esac
2958         set use5005threads
2959         eval $setvar
2960         ;;
2961 *)
2962         useithreads="$undef"
2963         use5005threads="$undef"
2964         ;;
2965 esac
2966
2967 case "$useithreads$use5005threads" in
2968 "$define$define")
2969         $cat >&4 <<EOM
2970
2971 You cannot have both the ithreads and the 5.005 threads enabled
2972 at the same time.  Disabling the 5.005 threads since they are
2973 much less stable than the ithreads.
2974
2975 EOM
2976         use5005threads="$undef"
2977         ;;
2978 esac
2979
2980 case "$d_oldpthreads" in
2981 '')     : Configure tests would be welcome here.  For now, assume undef.
2982         val="$undef" ;;
2983 *)      val="$d_oldpthreads" ;;
2984 esac
2985 set d_oldpthreads
2986 eval $setvar
2987
2988
2989 case "$usethreads" in
2990 "$define"|true|[yY]*)
2991 : Look for a hint-file generated 'call-back-unit'.  If the
2992 : user has specified that a threading perl is to be built,
2993 : we may need to set or change some other defaults.
2994         if $test -f usethreads.cbu; then
2995                 echo "Your platform has some specific hints for threaded builds, using them..."
2996                 . ./usethreads.cbu
2997         else
2998                 $cat <<EOM
2999 (Your platform doesn't have any specific hints for threaded builds.
3000  Assuming POSIX threads, then.)
3001 EOM
3002         fi
3003         ;;
3004 esac
3005
3006 cat <<EOM
3007
3008 Perl can be built so that multiple Perl interpreters can coexist
3009 within the same Perl executable.
3010 EOM
3011
3012 case "$useithreads" in
3013 $define)
3014         cat <<EOM
3015 This multiple interpreter support is required for interpreter-based threads.
3016 EOM
3017         val="$define"
3018         ;;
3019 *)      case "$usemultiplicity" in
3020         $define|true|[yY]*)     dflt='y';;
3021         *) dflt='n';;
3022         esac
3023         echo " "
3024         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3025         rp='Build Perl for multiplicity?'
3026         . ./myread
3027         case "$ans" in
3028         y|Y)    val="$define" ;;
3029         *)      val="$undef" ;;
3030         esac
3031         ;;
3032 esac
3033 set usemultiplicity
3034 eval $setvar
3035
3036 : make some quick guesses about what we are up against
3037 echo " "
3038 $echo $n "Hmm...  $c"
3039 echo exit 1 >bsd
3040 echo exit 1 >usg
3041 echo exit 1 >v7
3042 echo exit 1 >osf1
3043 echo exit 1 >eunice
3044 echo exit 1 >xenix
3045 echo exit 1 >venix
3046 echo exit 1 >os2
3047 d_bsd="$undef"
3048 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3049 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3050 then
3051         echo "Looks kind of like an OSF/1 system, but we'll see..."
3052         echo exit 0 >osf1
3053 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3054         xxx=`./loc addbib blurfl $pth`
3055         if $test -f $xxx; then
3056         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3057                 echo exit 0 >bsd
3058                 echo exit 0 >usg
3059         else
3060                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3061                         echo "Looks kind of like an extended USG system, but we'll see..."
3062                 else
3063                         echo "Looks kind of like a USG system, but we'll see..."
3064                 fi
3065                 echo exit 0 >usg
3066         fi
3067 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3068         echo "Looks kind of like a BSD system, but we'll see..."
3069         d_bsd="$define"
3070         echo exit 0 >bsd
3071 else
3072         echo "Looks kind of like a Version 7 system, but we'll see..."
3073         echo exit 0 >v7
3074 fi
3075 case "$eunicefix" in
3076 *unixtovms*)
3077         $cat <<'EOI'
3078 There is, however, a strange, musty smell in the air that reminds me of
3079 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3080 EOI
3081         echo exit 0 >eunice
3082         d_eunice="$define"
3083 : it so happens the Eunice I know will not run shell scripts in Unix format
3084         ;;
3085 *)
3086         echo " "
3087         echo "Congratulations.  You aren't running Eunice."
3088         d_eunice="$undef"
3089         ;;
3090 esac
3091 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3092 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3093 : semicolon as a patch separator
3094 case "$p_" in
3095 :) ;;
3096 *)
3097         $cat <<'EOI'
3098 I have the feeling something is not exactly right, however...don't tell me...
3099 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3100 (Or you may be running DOS with DJGPP.)
3101 EOI
3102         echo exit 0 >os2
3103         ;;
3104 esac
3105 if test -f /xenix; then
3106         echo "Actually, this looks more like a XENIX system..."
3107         echo exit 0 >xenix
3108         d_xenix="$define"
3109 else
3110         echo " "
3111         echo "It's not Xenix..."
3112         d_xenix="$undef"
3113 fi
3114 chmod +x xenix
3115 $eunicefix xenix
3116 if test -f /venix; then
3117         echo "Actually, this looks more like a VENIX system..."
3118         echo exit 0 >venix
3119 else
3120         echo " "
3121         if ./xenix; then
3122                 : null
3123         else
3124                 echo "Nor is it Venix..."
3125         fi
3126 fi
3127 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3128 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3129 $rm -f foo
3130
3131 case "$cc" in
3132 '') dflt=cc;;
3133 *) dflt="$cc";;
3134 esac
3135 rp="Use which C compiler?"
3136 . ./myread
3137 cc="$ans"
3138 : Look for a hint-file generated 'call-back-unit'.  Now that the
3139 : user has specified the compiler, we may need to set or change some
3140 : other defaults.
3141 if $test -f cc.cbu; then
3142     . ./cc.cbu
3143 fi
3144 . ./checkcc
3145
3146 echo " "
3147 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3148 $cat >gccvers.c <<EOM
3149 #include <stdio.h>
3150 int main() {
3151 #ifdef __GNUC__
3152 #ifdef __VERSION__
3153         printf("%s\n", __VERSION__);
3154 #else
3155         printf("%s\n", "1");
3156 #endif
3157 #endif
3158         exit(0);
3159 }
3160 EOM
3161 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3162         gccversion=`./gccvers`
3163         case "$gccversion" in
3164         '') echo "You are not using GNU cc." ;;
3165         *)  echo "You are using GNU cc $gccversion."
3166             ccname=gcc  
3167             ;;
3168         esac
3169 else
3170         echo " "
3171         echo "*** WHOA THERE!!! ***" >&4
3172         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3173         case "$knowitall" in
3174         '')
3175         echo "    You'd better start hunting for one and let me know about it." >&4
3176                 exit 1
3177                 ;;
3178         esac
3179 fi
3180 $rm -f gccvers*
3181 case "$gccversion" in
3182 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3183 esac
3184 case "$gccversion" in
3185 '') gccosandvers='' ;;
3186 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3187    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3188    gccshortvers=''
3189    case "$gccosandvers" in
3190    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3191    $osname$osvers) ;; # looking good
3192    $osname*) cat <<EOM >&4
3193
3194 *** WHOA THERE!!! ***
3195
3196     Your gcc has not been compiled for the exact release of
3197     your operating system ($gccosandvers versus $osname$osvers).
3198
3199     In general it is a good idea to keep gcc synchronized with
3200     the operating system because otherwise serious problems
3201     may ensue when trying to compile software, like Perl.
3202
3203     I'm trying to be optimistic here, though, and will continue.
3204     If later during the configuration and build icky compilation
3205     problems appear (headerfile conflicts being the most common
3206     manifestation), I suggest reinstalling the gcc to match
3207     your operating system release.
3208
3209 EOM
3210       ;;
3211    *) gccosandvers='' ;; # failed to parse, better be silent
3212    esac
3213    ;;
3214 esac
3215 case "$ccname" in
3216 '') ccname="$cc" ;;
3217 esac
3218
3219 : see how we invoke the C preprocessor
3220 echo " "
3221 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3222 cat <<'EOT' >testcpp.c
3223 #define ABC abc
3224 #define XYZ xyz
3225 ABC.XYZ
3226 EOT
3227 cd ..
3228 if test ! -f cppstdin; then
3229         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3230                 # AIX cc -E doesn't show the absolute headerfile
3231                 # locations but we'll cheat by using the -M flag.
3232                 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
3233         else
3234                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3235         fi
3236 else
3237         echo "Keeping your $hint cppstdin wrapper."
3238 fi
3239 chmod 755 cppstdin
3240 wrapper=`pwd`/cppstdin
3241 ok='false'
3242 cd UU
3243
3244 if $test "X$cppstdin" != "X" && \
3245         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3246         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3247 then
3248         echo "You used to use $cppstdin $cppminus so we'll use that again."
3249         case "$cpprun" in
3250         '') echo "But let's see if we can live without a wrapper..." ;;
3251         *)
3252                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3253                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3254                 then
3255                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3256                         ok='true'
3257                 else
3258                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3259                 fi
3260                 ;;
3261         esac
3262 else
3263         case "$cppstdin" in
3264         '') ;;
3265         *)
3266                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3267                 ;;
3268         esac
3269 fi
3270
3271 if $ok; then
3272         : nothing
3273 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3274         $cc -E <testcpp.c >testcpp.out 2>&1; \
3275         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3276         echo "Yup, it does."
3277         x_cpp="$cc -E"
3278         x_minus='';
3279 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3280         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3281         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3282         echo "Yup, it does."
3283         x_cpp="$cc -E"
3284         x_minus='-';
3285 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3286         $cc -P <testcpp.c >testcpp.out 2>&1; \
3287         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3288         echo "Yipee, that works!"
3289         x_cpp="$cc -P"
3290         x_minus='';
3291 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3292         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3293         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3294         echo "At long last!"
3295         x_cpp="$cc -P"
3296         x_minus='-';
3297 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3298         $cpp <testcpp.c >testcpp.out 2>&1; \
3299         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3300         echo "It works!"
3301         x_cpp="$cpp"
3302         x_minus='';
3303 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3304         $cpp - <testcpp.c >testcpp.out 2>&1; \
3305         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3306         echo "Hooray, it works!  I was beginning to wonder."
3307         x_cpp="$cpp"
3308         x_minus='-';
3309 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3310         $wrapper <testcpp.c >testcpp.out 2>&1; \
3311         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3312         x_cpp="$wrapper"
3313         x_minus=''
3314         echo "Eureka!"
3315 else
3316         dflt=''
3317         rp="No dice.  I can't find a C preprocessor.  Name one:"
3318         . ./myread
3319         x_cpp="$ans"
3320         x_minus=''
3321         $x_cpp <testcpp.c >testcpp.out 2>&1
3322         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3323                 echo "OK, that will do." >&4
3324         else
3325 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3326                 exit 1
3327         fi
3328 fi
3329
3330 case "$ok" in
3331 false)
3332         cppstdin="$x_cpp"
3333         cppminus="$x_minus"
3334         cpprun="$x_cpp"
3335         cpplast="$x_minus"
3336         set X $x_cpp
3337         shift
3338         case "$1" in
3339         "$cpp")
3340                 echo "Perhaps can we force $cc -E using a wrapper..."
3341                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3342                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3343                 then
3344                         echo "Yup, we can."
3345                         cppstdin="$wrapper"
3346                         cppminus='';
3347                 else
3348                         echo "Nope, we'll have to live without it..."
3349                 fi
3350                 ;;
3351         esac
3352         case "$cpprun" in
3353         "$wrapper")
3354                 cpprun=''
3355                 cpplast=''
3356                 ;;
3357         esac
3358         ;;
3359 esac
3360
3361 case "$cppstdin" in
3362 "$wrapper"|'cppstdin') ;;
3363 *) $rm -f $wrapper;;
3364 esac
3365 $rm -f testcpp.c testcpp.out
3366
3367 : decide how portable to be.  Allow command line overrides.
3368 case "$d_portable" in
3369 "$undef") ;;
3370 *)      d_portable="$define" ;;
3371 esac
3372
3373 : set up shell script to do ~ expansion
3374 cat >filexp <<EOSS
3375 $startsh
3376 : expand filename
3377 case "\$1" in
3378  ~/*|~)
3379         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3380         ;;
3381  ~*)
3382         if $test -f /bin/csh; then
3383                 /bin/csh -f -c "glob \$1"
3384                 failed=\$?
3385                 echo ""
3386                 exit \$failed
3387         else
3388                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3389                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3390                 if $test ! -d "\$dir"; then
3391                         me=\`basename \$0\`
3392                         echo "\$me: can't locate home directory for: \$name" >&2
3393                         exit 1
3394                 fi
3395                 case "\$1" in
3396                 */*)
3397                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3398                         ;;
3399                 *)
3400                         echo \$dir
3401                         ;;
3402                 esac
3403         fi
3404         ;;
3405 *)
3406         echo \$1
3407         ;;
3408 esac
3409 EOSS
3410 chmod +x filexp
3411 $eunicefix filexp
3412
3413 : now set up to get a file name
3414 cat <<EOS >getfile
3415 $startsh
3416 EOS
3417 cat <<'EOSC' >>getfile
3418 tilde=''
3419 fullpath=''
3420 already=''
3421 skip=''
3422 none_ok=''
3423 exp_file=''
3424 nopath_ok=''
3425 orig_rp="$rp"
3426 orig_dflt="$dflt"
3427 case "$gfpth" in
3428 '') gfpth='.' ;;
3429 esac
3430
3431 case "$fn" in
3432 *\(*)
3433         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3434         fn=`echo $fn | sed 's/(.*)//'`
3435         ;;
3436 esac
3437
3438 case "$fn" in
3439 *:*)
3440         loc_file=`expr $fn : '.*:\(.*\)'`
3441         fn=`expr $fn : '\(.*\):.*'`
3442         ;;
3443 esac
3444
3445 case "$fn" in
3446 *~*) tilde=true;;
3447 esac
3448 case "$fn" in
3449 */*) fullpath=true;;
3450 esac
3451 case "$fn" in
3452 *+*) skip=true;;
3453 esac
3454 case "$fn" in
3455 *n*) none_ok=true;;
3456 esac
3457 case "$fn" in
3458 *e*) exp_file=true;;
3459 esac
3460 case "$fn" in
3461 *p*) nopath_ok=true;;
3462 esac
3463
3464 case "$fn" in
3465 *f*) type='File';;
3466 *d*) type='Directory';;
3467 *l*) type='Locate';;
3468 esac
3469
3470 what="$type"
3471 case "$what" in
3472 Locate) what='File';;
3473 esac
3474
3475 case "$exp_file" in
3476 '')
3477         case "$d_portable" in
3478         "$define") ;;
3479         *) exp_file=true;;
3480         esac
3481         ;;
3482 esac
3483
3484 cd ..
3485 while test "$type"; do
3486         redo=''
3487         rp="$orig_rp"
3488         dflt="$orig_dflt"
3489         case "$tilde" in
3490         true) rp="$rp (~name ok)";;
3491         esac
3492         . UU/myread
3493         if test -f UU/getfile.ok && \
3494                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3495         then
3496                 value="$ans"
3497                 ansexp="$ans"
3498                 break
3499         fi
3500         case "$ans" in
3501         none)
3502                 value=''
3503                 ansexp=''
3504                 case "$none_ok" in
3505                 true) type='';;
3506                 esac
3507                 ;;
3508         *)
3509                 case "$tilde" in
3510                 '') value="$ans"
3511                         ansexp="$ans";;
3512                 *)
3513                         value=`UU/filexp $ans`
3514                         case $? in
3515                         0)
3516                                 if test "$ans" != "$value"; then
3517                                         echo "(That expands to $value on this system.)"
3518                                 fi
3519                                 ;;
3520                         *) value="$ans";;
3521                         esac
3522                         ansexp="$value"
3523                         case "$exp_file" in
3524                         '') value="$ans";;
3525                         esac
3526                         ;;
3527                 esac
3528                 case "$fullpath" in
3529                 true)
3530                         case "$ansexp" in
3531                         /*) value="$ansexp" ;;
3532                         [a-zA-Z]:/*) value="$ansexp" ;;
3533                         *)
3534                                 redo=true
3535                                 case "$already" in
3536                                 true)
3537                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3538                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3539                                         ;;
3540                                 *)
3541                                 echo "Please give a full path name, starting with slash." >&4
3542                                         case "$tilde" in
3543                                         true)
3544                                 echo "Note that using ~name is ok provided it expands well." >&4
3545                                                 already=true
3546                                                 ;;
3547                                         esac
3548                                 esac
3549                                 ;;
3550                         esac
3551                         ;;
3552                 esac
3553                 case "$redo" in
3554                 '')
3555                         case "$type" in
3556                         File)
3557                                 for fp in $gfpth; do
3558                                         if test "X$fp" = X.; then
3559                                             pf="$ansexp"
3560                                         else    
3561                                             pf="$fp/$ansexp"
3562                                         fi
3563                                         if test -f "$pf"; then
3564                                                 type=''
3565                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3566                                         then
3567                                                 echo "($value is not a plain file, but that's ok.)"
3568                                                 type=''
3569                                         fi
3570                                         if test X"$type" = X; then
3571                                             value="$pf"
3572                                             break
3573                                         fi
3574                                 done
3575                                 ;;
3576                         Directory)
3577                                 for fp in $gfpth; do
3578                                         if test "X$fp" = X.; then
3579                                             dir="$ans"
3580                                             direxp="$ansexp"
3581                                         else    
3582                                             dir="$fp/$ansexp"
3583                                             direxp="$fp/$ansexp"
3584                                         fi
3585                                         if test -d "$direxp"; then
3586                                                 type=''
3587                                                 value="$dir"
3588                                                 break
3589                                         fi
3590                                 done
3591                                 ;;
3592                         Locate)
3593                                 if test -d "$ansexp"; then
3594                                         echo "(Looking for $loc_file in directory $value.)"
3595                                         value="$value/$loc_file"
3596                                         ansexp="$ansexp/$loc_file"
3597                                 fi
3598                                 if test -f "$ansexp"; then
3599                                         type=''
3600                                 fi
3601                                 case "$nopath_ok" in
3602                                 true)   case "$value" in
3603                                         */*) ;;
3604                                         *)      echo "Assuming $value will be in people's path."
3605                                                 type=''
3606                                                 ;;
3607                                         esac
3608                                         ;;
3609                                 esac
3610                                 ;;
3611                         esac
3612
3613                         case "$skip" in
3614                         true) type='';
3615                         esac
3616
3617                         case "$type" in
3618                         '') ;;
3619                         *)
3620                                 if test "$fastread" = yes; then
3621                                         dflt=y
3622                                 else
3623                                         dflt=n
3624                                 fi
3625                                 rp="$what $value doesn't exist.  Use that name anyway?"
3626                                 . UU/myread
3627                                 dflt=''
3628                                 case "$ans" in
3629                                 y*) type='';;
3630                                 *) echo " ";;
3631                                 esac
3632                                 ;;
3633                         esac
3634                         ;;
3635                 esac
3636                 ;;
3637         esac
3638 done
3639 cd UU
3640 ans="$value"
3641 rp="$orig_rp"
3642 dflt="$orig_dflt"
3643 rm -f getfile.ok
3644 test "X$gfpthkeep" != Xy && gfpth=""
3645 EOSC
3646
3647 : What should the include directory be ?
3648 echo " "
3649 $echo $n "Hmm...  $c"
3650 dflt='/usr/include'
3651 incpath=''
3652 mips_type=''
3653 if $test -f /bin/mips && /bin/mips; then
3654         echo "Looks like a MIPS system..."
3655         $cat >usr.c <<'EOCP'
3656 #ifdef SYSTYPE_BSD43
3657 /bsd43
3658 #endif
3659 EOCP
3660         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3661                 dflt='/bsd43/usr/include'
3662                 incpath='/bsd43'
3663                 mips_type='BSD 4.3'
3664         else
3665                 mips_type='System V'
3666         fi
3667         $rm -f usr.c usr.out
3668         echo "and you're compiling with the $mips_type compiler and libraries."
3669         xxx_prompt=y
3670         echo "exit 0" >mips
3671 else
3672         echo "Doesn't look like a MIPS system."
3673         xxx_prompt=n
3674         echo "exit 1" >mips
3675 fi
3676 chmod +x mips
3677 $eunicefix mips
3678 case "$usrinc" in
3679 '') ;;
3680 *) dflt="$usrinc";;
3681 esac
3682 case "$xxx_prompt" in
3683 y)      fn=d/
3684         echo " "
3685         rp='Where are the include files you want to use?'
3686         . ./getfile
3687         usrinc="$ans"
3688         ;;
3689 *)      usrinc="$dflt"
3690         ;;
3691 esac
3692
3693 : Set private lib path
3694 case "$plibpth" in
3695 '') if ./mips; then
3696                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3697         fi;;
3698 esac
3699 case "$libpth" in
3700 ' ') dlist='';;
3701 '') dlist="$loclibpth $plibpth $glibpth";;
3702 *) dlist="$libpth";;
3703 esac
3704
3705 : Now check and see which directories actually exist, avoiding duplicates
3706 libpth=''
3707 for xxx in $dlist
3708 do
3709     if $test -d $xxx; then
3710                 case " $libpth " in
3711                 *" $xxx "*) ;;
3712                 *) libpth="$libpth $xxx";;
3713                 esac
3714     fi
3715 done
3716 $cat <<'EOM'
3717
3718 Some systems have incompatible or broken versions of libraries.  Among
3719 the directories listed in the question below, please remove any you
3720 know not to be holding relevant libraries, and add any that are needed.
3721 Say "none" for none.
3722
3723 EOM
3724 case "$libpth" in
3725 '') dflt='none';;
3726 *)
3727         set X $libpth
3728         shift
3729         dflt=${1+"$@"}
3730         ;;
3731 esac
3732 rp="Directories to use for library searches?"
3733 . ./myread
3734 case "$ans" in
3735 none) libpth=' ';;
3736 *) libpth="$ans";;
3737 esac
3738
3739 : compute shared library extension
3740 case "$so" in
3741 '')
3742         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3743                 dflt='sl'
3744         else
3745                 dflt='so'
3746         fi
3747         ;;
3748 *) dflt="$so";;
3749 esac
3750 $cat <<EOM
3751
3752 On some systems, shared libraries may be available.  Answer 'none' if
3753 you want to suppress searching of shared libraries for the remainder
3754 of this configuration.
3755
3756 EOM
3757 rp='What is the file extension used for shared libraries?'
3758 . ./myread
3759 so="$ans"
3760
3761 : Define several unixisms.
3762 : Hints files or command line option can be used to override them.
3763 : The convoluted testing is in case hints files set either the old
3764 : or the new name.
3765 case "$_exe" in
3766 '')     case "$exe_ext" in
3767     '') ;;
3768         *)      _exe="$exe_ext" ;;
3769         esac
3770         ;;
3771 esac
3772 case "$_a" in
3773 '')     case "$lib_ext" in
3774     '') _a='.a';;
3775         *)      _a="$lib_ext" ;;
3776         esac
3777         ;;
3778 esac
3779 case "$_o" in
3780 '') case "$obj_ext" in
3781         '')     _o='.o';;
3782         *)      _o="$obj_ext";;
3783         esac
3784         ;;
3785 esac
3786 case "$p_" in
3787 '') case "$path_sep" in
3788         '')     p_=':';;
3789         *)      p_="$path_sep";;
3790         esac
3791         ;;
3792 esac
3793 exe_ext=$_exe
3794 lib_ext=$_a
3795 obj_ext=$_o
3796 path_sep=$p_
3797
3798 : Which makefile gets called first.  This is used by make depend.
3799 case "$firstmakefile" in
3800 '') firstmakefile='makefile';;
3801 esac
3802
3803 case "$usesocks" in
3804 $define|true|[yY]*)     dflt='y';;
3805 *) dflt='n';;
3806 esac
3807 cat <<EOM
3808
3809 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3810 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3811 to use the PerlIO abstraction layer, this will be implicitly selected.
3812
3813 If this doesn't make any sense to you, just accept the default '$dflt'.
3814 EOM
3815 rp='Build Perl for SOCKS?'
3816 . ./myread
3817 case "$ans" in
3818 y|Y)    val="$define" ;;     
3819 *)      val="$undef" ;;
3820 esac
3821 set usesocks
3822 eval $setvar
3823
3824 case "$usesocks" in
3825 $define|true|[yY]*) useperlio="$define";;
3826 esac
3827
3828 : Looking for optional libraries
3829 echo " "
3830 echo "Checking for optional libraries..." >&4
3831 case "$libs" in
3832 ' '|'') dflt='';;
3833 *) dflt="$libs";;
3834 esac
3835 case "$libswanted" in
3836 '') libswanted='c_s';;
3837 esac
3838 case "$usesocks" in
3839 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3840 esac
3841 libsfound=''
3842 libsfiles=''
3843 libsdirs=''
3844 libspath=''
3845 for thisdir in $libpth $xlibpth; do
3846   test -d $thisdir && libspath="$libspath $thisdir"
3847 done
3848 for thislib in $libswanted; do
3849         for thisdir in $libspath; do
3850             xxx=''
3851             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3852                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3853                 $test -f "$xxx" && eval $libscheck
3854                 $test -f "$xxx" && libstyle=shared
3855             fi
3856             if test ! -f "$xxx"; then
3857                 xxx=$thisdir/lib$thislib.$so
3858                 $test -f "$xxx" && eval $libscheck
3859                 $test -f "$xxx" && libstyle=shared
3860             fi  
3861             if test ! -f "$xxx"; then
3862                 xxx=$thisdir/lib$thislib$_a
3863                 $test -f "$xxx" && eval $libscheck
3864                 $test -f "$xxx" && libstyle=static
3865             fi
3866             if test ! -f "$xxx"; then
3867                 xxx=$thisdir/$thislib$_a
3868                 $test -f "$xxx" && eval $libscheck
3869                 $test -f "$xxx" && libstyle=static
3870             fi
3871             if test ! -f "$xxx"; then
3872                 xxx=$thisdir/lib${thislib}_s$_a
3873                 $test -f "$xxx" && eval $libscheck
3874                 $test -f "$xxx" && libstyle=static
3875                 $test -f "$xxx" && thislib=${thislib}_s
3876             fi
3877             if test ! -f "$xxx"; then
3878                 xxx=$thisdir/Slib$thislib$_a
3879                 $test -f "$xxx" && eval $libscheck
3880                 $test -f "$xxx" && libstyle=static
3881             fi
3882             if $test -f "$xxx"; then
3883                 case "$libstyle" in
3884                 shared) echo "Found -l$thislib (shared)." ;;
3885                 static) echo "Found -l$thislib." ;;
3886                 *)      echo "Found -l$thislib ($libstyle)." ;;
3887                 esac
3888                 case " $dflt " in
3889                 *"-l$thislib "*);;
3890                 *) dflt="$dflt -l$thislib"
3891                    libsfound="$libsfound $xxx"
3892                    yyy=`basename $xxx`
3893                    libsfiles="$libsfiles $yyy"
3894                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3895                    case " $libsdirs " in
3896                    *" $yyy "*) ;;
3897                    *) libsdirs="$libsdirs $yyy" ;;
3898                    esac
3899                    ;;
3900                 esac
3901                 break
3902             fi  
3903         done
3904         if $test ! -f "$xxx"; then
3905             echo "No -l$thislib."
3906         fi
3907 done
3908 set X $dflt
3909 shift
3910 dflt="$*"
3911 case "$libs" in
3912 '') dflt="$dflt";;
3913 *) dflt="$libs";;
3914 esac
3915 case "$dflt" in
3916 ' '|'') dflt='none';;
3917 esac
3918
3919 $cat <<EOM
3920
3921 In order to compile $package on your machine, a number of libraries
3922 are usually needed.  Include any other special libraries here as well.
3923 Say "none" for none.  The default list is almost always right.
3924 EOM
3925
3926 echo " "
3927 rp="What libraries to use?"
3928 . ./myread
3929 case "$ans" in
3930 none) libs=' ';;
3931 *) libs="$ans";;
3932 esac
3933
3934 : determine optimization, if desired, or use for debug flag also
3935 case "$optimize" in
3936 ' '|$undef) dflt='none';;
3937 '') dflt='-O';;
3938 *) dflt="$optimize";;
3939 esac
3940 $cat <<EOH
3941
3942 By default, $package compiles with the -O flag to use the optimizer.
3943 Alternately, you might want to use the symbolic debugger, which uses
3944 the -g flag (on traditional Unix systems).  Either flag can be
3945 specified here.  To use neither flag, specify the word "none".
3946
3947 EOH
3948 rp="What optimizer/debugger flag should be used?"
3949 . ./myread
3950 optimize="$ans"
3951 case "$optimize" in
3952 'none') optimize=" ";;
3953 esac
3954
3955 dflt=''
3956 : We will not override a previous value, but we might want to
3957 : augment a hint file
3958 case "$hint" in
3959 default|recommended)
3960         case "$gccversion" in
3961         1*) dflt='-fpcc-struct-return' ;;
3962         esac
3963         case "$optimize" in
3964         *-g*) dflt="$dflt -DDEBUGGING";;
3965         esac
3966         case "$gccversion" in
3967         2*) if test -d /etc/conf/kconfig.d &&
3968                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3969                 then
3970                         dflt="$dflt -posix"
3971                 fi
3972                 ;;
3973         esac
3974         case "$gccversion" in
3975         1*) ;;
3976         2.[0-8]*) ;;
3977         ?*)     echo " "
3978                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3979                 echo 'int main(void) { return 0; }' > gcctest.c
3980                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3981                         echo "Yes, it does." 2>&1
3982                         case "$ccflags" in
3983                         *strict-aliasing*) 
3984                                 echo "Leaving current flags $ccflags alone." 2>&1
3985                                 ;;
3986                         *) dflt="$dflt -fno-strict-aliasing" ;;
3987                         esac
3988                 else
3989                         echo "Nope, it doesn't, but that's ok." 2>&1
3990                 fi
3991                 ;;
3992         esac
3993         ;;
3994 esac
3995
3996 case "$mips_type" in
3997 *BSD*|'') inclwanted="$locincpth $usrinc";;
3998 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3999 esac
4000 for thisincl in $inclwanted; do
4001         if $test -d $thisincl; then
4002                 if $test x$thisincl != x$usrinc; then
4003                         case "$dflt" in
4004                         *" -I$thisincl "*);;
4005                         *) dflt="$dflt -I$thisincl ";;
4006                         esac
4007                 fi
4008         fi
4009 done
4010
4011 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4012         xxx=true;
4013 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4014         xxx=true;
4015 else
4016         xxx=false;
4017 fi;
4018 if $xxx; then
4019         case "$dflt" in
4020         *$2*);;
4021         *) dflt="$dflt -D$2";;
4022         esac;
4023 fi'
4024
4025 set signal.h LANGUAGE_C; eval $inctest
4026
4027 case "$usesocks" in
4028 $define)
4029         ccflags="$ccflags -DSOCKS"
4030         ;;
4031 esac
4032
4033 case "$hint" in
4034 default|recommended) dflt="$ccflags $dflt" ;;
4035 *) dflt="$ccflags";;
4036 esac
4037
4038 case "$dflt" in
4039 ''|' ') dflt=none;;
4040 esac
4041
4042 $cat <<EOH
4043
4044 Your C compiler may want other flags.  For this question you should include
4045 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4046 but you should NOT include libraries or ld flags like -lwhatever.  If you
4047 want $package to honor its debug switch, you should include -DDEBUGGING here.
4048 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4049
4050 To use no flags, specify the word "none".
4051
4052 EOH
4053 set X $dflt
4054 shift
4055 dflt=${1+"$@"}
4056 rp="Any additional cc flags?"
4057 . ./myread
4058 case "$ans" in
4059 none) ccflags='';;
4060 *) ccflags="$ans";;
4061 esac
4062
4063 : the following weeds options from ccflags that are of no interest to cpp
4064 cppflags="$ccflags"
4065 case "$gccversion" in
4066 1*) cppflags="$cppflags -D__GNUC__"
4067 esac
4068 case "$mips_type" in
4069 '');;
4070 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4071 esac
4072 case "$cppflags" in
4073 '');;
4074 *)
4075         echo " "
4076         echo "Let me guess what the preprocessor flags are..." >&4
4077         set X $cppflags
4078         shift
4079         cppflags=''
4080         $cat >cpp.c <<'EOM'
4081 #define BLURFL foo
4082
4083 BLURFL xx LFRULB
4084 EOM
4085         previous=''
4086         for flag in $*
4087         do
4088                 case "$flag" in
4089                 -*) ftry="$flag";;
4090                 *) ftry="$previous $flag";;
4091                 esac
4092                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4093                         >cpp1.out 2>/dev/null && \
4094                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4095                         >cpp2.out 2>/dev/null && \
4096                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4097                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4098                 then
4099                         cppflags="$cppflags $ftry"
4100                         previous=''
4101                 else
4102                         previous="$flag"
4103                 fi
4104         done
4105         set X $cppflags
4106         shift
4107         cppflags=${1+"$@"}
4108         case "$cppflags" in
4109         *-*)  echo "They appear to be: $cppflags";;
4110         esac
4111         $rm -f cpp.c cpp?.out
4112         ;;
4113 esac
4114
4115 : flags used in final linking phase
4116 case "$ldflags" in
4117 '') if ./venix; then
4118                 dflt='-i -z'
4119         else
4120                 dflt=''
4121         fi
4122         case "$ccflags" in
4123         *-posix*) dflt="$dflt -posix" ;;
4124         esac
4125         ;;
4126 *) dflt="$ldflags";;
4127 esac
4128
4129 : Try to guess additional flags to pick up local libraries.
4130 for thislibdir in $libpth; do
4131         case " $loclibpth " in
4132         *" $thislibdir "*)
4133                 case "$dflt " in 
4134                 *"-L$thislibdir "*) ;;
4135                 *)  dflt="$dflt -L$thislibdir" ;;
4136                 esac
4137                 ;;
4138         esac
4139 done
4140
4141 case "$dflt" in
4142 '') dflt='none' ;;
4143 esac
4144
4145 $cat <<EOH
4146
4147 Your C linker may need flags.  For this question you should
4148 include -L/whatever and any other flags used by the C linker, but you
4149 should NOT include libraries like -lwhatever.
4150
4151 Make sure you include the appropriate -L/path flags if your C linker
4152 does not normally search all of the directories you specified above,
4153 namely
4154         $libpth
4155 To use no flags, specify the word "none".
4156
4157 EOH
4158
4159 rp="Any additional ld flags (NOT including libraries)?"
4160 . ./myread
4161 case "$ans" in
4162 none) ldflags='';;
4163 *) ldflags="$ans";;
4164 esac
4165 rmlist="$rmlist pdp11"
4166
4167 : coherency check
4168 echo " "
4169 echo "Checking your choice of C compiler and flags for coherency..." >&4
4170 $cat > try.c <<'EOF'
4171 #include <stdio.h>
4172 int main() { printf("Ok\n"); exit(0); }
4173 EOF
4174 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4175 shift
4176 $cat >try.msg <<'EOM'
4177 I've tried to compile and run the following simple program:
4178
4179 EOM
4180 $cat try.c >> try.msg
4181
4182 $cat >> try.msg <<EOM
4183
4184 I used the command:
4185
4186         $*
4187         ./try
4188
4189 and I got the following output:
4190
4191 EOM
4192 dflt=y
4193 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4194         if $sh -c './try' >>try.msg 2>&1; then
4195                 xxx=`./try`
4196                 case "$xxx" in
4197                 "Ok") dflt=n ;;
4198                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4199                         case " $libs " in
4200                         *" -lsfio "*)
4201                                 cat >> try.msg <<'EOQS'
4202 If $libs contains -lsfio, and sfio is mis-configured, then it
4203 sometimes (apparently) runs and exits with a 0 status, but with no
4204 output!  It may have to do with sfio's use of _exit vs. exit.
4205
4206 EOQS
4207                                 rp="You have a big problem.  Shall I abort Configure"
4208                                 dflt=y
4209                                 ;;
4210                         esac
4211                         ;;
4212                 esac
4213         else
4214                 echo "The program compiled OK, but exited with status $?." >>try.msg
4215                 rp="You have a problem.  Shall I abort Configure"
4216                 dflt=y
4217         fi
4218 else
4219         echo "I can't compile the test program." >>try.msg
4220         rp="You have a BIG problem.  Shall I abort Configure"
4221         dflt=y
4222 fi
4223 case "$dflt" in
4224 y)
4225         $cat try.msg >&4
4226         case "$knowitall" in
4227         '')
4228                 echo "(The supplied flags or libraries might be incorrect.)"
4229                 ;;
4230         *) dflt=n;;
4231         esac
4232         echo " "
4233         . ./myread
4234         case "$ans" in
4235         n*|N*) ;;
4236         *)      echo "Ok.  Stopping Configure." >&4
4237                 exit 1
4238                 ;;
4239         esac
4240         ;;
4241 n) echo "OK, that should do.";;
4242 esac
4243 $rm -f try try.* core
4244
4245 : define an is-a-typedef? function
4246 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4247 case "$inclist" in
4248 "") inclist="sys/types.h";;
4249 esac;
4250 eval "varval=\$$var";
4251 case "$varval" in
4252 "")
4253         $rm -f temp.c;
4254         for inc in $inclist; do
4255                 echo "#include <$inc>" >>temp.c;
4256         done;
4257         echo "#ifdef $type" >> temp.c;
4258         echo "printf(\"We have $type\");" >> temp.c;
4259         echo "#endif" >> temp.c;
4260         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4261         if $contains $type temp.E >/dev/null 2>&1; then
4262                 eval "$var=\$type";
4263         else
4264                 eval "$var=\$def";
4265         fi;
4266         $rm -f temp.?;;
4267 *) eval "$var=\$varval";;
4268 esac'
4269
4270 : define an is-a-typedef? function that prompts if the type is not available.
4271 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4272 case "$inclist" in
4273 "") inclist="sys/types.h";;
4274 esac;
4275 eval "varval=\$$var";
4276 case "$varval" in
4277 "")
4278         $rm -f temp.c;
4279         for inc in $inclist; do
4280                 echo "#include <$inc>" >>temp.c;
4281         done;
4282         echo "#ifdef $type" >> temp.c;
4283         echo "printf(\"We have $type\");" >> temp.c;
4284         echo "#endif" >> temp.c;
4285         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4286         echo " " ;
4287         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4288         if $contains $type temp.E >/dev/null 2>&1; then
4289                 echo "$type found." >&4;
4290                 eval "$var=\$type";
4291         else
4292                 echo "$type NOT found." >&4;
4293                 dflt="$def";
4294                 . ./myread ;
4295                 eval "$var=\$ans";
4296         fi;
4297         $rm -f temp.?;;
4298 *) eval "$var=\$varval";;
4299 esac'
4300
4301 : define a shorthand compile call
4302 compile='
4303 mc_file=$1;
4304 shift;
4305 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4306 : define a shorthand compile call for compilations that should be ok.
4307 compile_ok='
4308 mc_file=$1;
4309 shift;
4310 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4311
4312 : check for lengths of integral types
4313 echo " "
4314 case "$intsize" in
4315 '')
4316         echo "Checking to see how big your integers are..." >&4
4317         $cat >intsize.c <<'EOCP'
4318 #include <stdio.h>
4319 int main()
4320 {
4321         printf("intsize=%d;\n", (int)sizeof(int));
4322         printf("longsize=%d;\n", (int)sizeof(long));
4323         printf("shortsize=%d;\n", (int)sizeof(short));
4324         exit(0);
4325 }
4326 EOCP
4327         set intsize
4328         if eval $compile_ok && ./intsize > /dev/null; then
4329                 eval `./intsize`
4330                 echo "Your integers are $intsize bytes long."
4331                 echo "Your long integers are $longsize bytes long."
4332                 echo "Your short integers are $shortsize bytes long."
4333         else
4334                 $cat >&4 <<EOM
4335 !
4336 Help! I can't compile and run the intsize test program: please enlighten me!
4337 (This is probably a misconfiguration in your system or libraries, and
4338 you really ought to fix it.  Still, I'll try anyway.)
4339 !
4340 EOM
4341                 dflt=4
4342                 rp="What is the size of an integer (in bytes)?"
4343                 . ./myread
4344                 intsize="$ans"
4345                 dflt=$intsize
4346                 rp="What is the size of a long integer (in bytes)?"
4347                 . ./myread
4348                 longsize="$ans"
4349                 dflt=2
4350                 rp="What is the size of a short integer (in bytes)?"
4351                 . ./myread
4352                 shortsize="$ans"
4353         fi
4354         ;;
4355 esac
4356 $rm -f intsize intsize.*
4357
4358 : see what type lseek is declared as in the kernel
4359 rp="What is the type used for lseek's offset on this system?"
4360 set off_t lseektype long stdio.h sys/types.h
4361 eval $typedef_ask
4362
4363 echo " "
4364 echo "Checking to see how big your file offsets are..." >&4
4365 $cat >try.c <<EOCP
4366 #include <sys/types.h>
4367 #include <stdio.h>
4368 int main()
4369 {
4370     printf("%d\n", (int)sizeof($lseektype));
4371     return(0); 
4372 }
4373 EOCP
4374 set try
4375 if eval $compile_ok; then
4376         lseeksize=`./try`
4377         echo "Your file offsets are $lseeksize bytes long."
4378 else
4379         dflt=$longsize
4380         echo " "
4381         echo "(I can't seem to compile the test program.  Guessing...)"
4382         rp="What is the size of your file offsets (in bytes)?"
4383         . ./myread
4384         lseeksize="$ans"
4385 fi
4386 $rm -f try.c try
4387
4388 : see what type file positions are declared as in the library
4389 rp="What is the type for file position used by fsetpos()?"
4390 set fpos_t fpostype long stdio.h sys/types.h
4391 eval $typedef_ask
4392
4393 echo " "
4394 case "$fpostype" in
4395 *_t) zzz="$fpostype"    ;;
4396 *)   zzz="fpos_t"       ;;
4397 esac
4398 echo "Checking the size of $zzz..." >&4 
4399 cat > try.c <<EOCP
4400 #include <sys/types.h>
4401 #include <stdio.h>
4402 int main() {
4403     printf("%d\n", (int)sizeof($fpostype));
4404     exit(0);
4405 }
4406 EOCP
4407 set try
4408 if eval $compile_ok; then
4409         yyy=`./try`
4410         case "$yyy" in
4411         '')     fpossize=4
4412                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4413                 ;;
4414         *)      fpossize=$yyy
4415                 echo "Your $zzz is $fpossize bytes long."
4416                 ;;
4417         esac
4418 else
4419         dflt="$longsize"
4420         echo " " >&4
4421         echo "(I can't compile the test program.  Guessing...)" >&4
4422         rp="What is the size of your file positions (in bytes)?"
4423         . ./myread
4424         fpossize="$ans"
4425 fi
4426
4427
4428
4429 # Backward compatibility (uselfs is deprecated).
4430 case "$uselfs" in
4431 "$define"|true|[yY]*)
4432         cat <<EOM >&4
4433
4434 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4435 EOM
4436         uselargefiles="$define"
4437         ;;
4438 esac                          
4439
4440 case "$lseeksize:$fpossize" in
4441 8:8) cat <<EOM
4442
4443 You can have files larger than 2 gigabytes.
4444 EOM
4445    val="$define" ;;
4446 *)    case "$uselargefiles" in
4447    "$undef"|false|[nN]*) dflt='n' ;;
4448    *)   dflt='y' ;;
4449    esac
4450    cat <<EOM
4451
4452 Perl can be built to understand large files (files larger than 2 gigabytes)
4453 on some systems.  To do so, Configure can be run with -Duselargefiles.
4454
4455 If this doesn't make any sense to you, just accept the default '$dflt'.
4456 EOM
4457    rp='Try to understand large files, if available?'
4458    . ./myread
4459    case "$ans" in
4460    y|Y)         val="$define" ;;
4461    *)           val="$undef"  ;;
4462    esac
4463    ;;
4464 esac
4465 set uselargefiles
4466 eval $setvar
4467 case "$uselargefiles" in
4468 "$define")
4469 : Look for a hint-file generated 'call-back-unit'.  If the
4470 : user has specified that a large files perl is to be built,
4471 : we may need to set or change some other defaults.
4472         if $test -f uselargefiles.cbu; then
4473                 echo "Your platform has some specific hints for large file builds, using them..."
4474                 . ./uselargefiles.cbu
4475                 echo " "
4476                 echo "Rechecking to see how big your file offsets are..." >&4
4477                 $cat >try.c <<EOCP
4478 #include <sys/types.h>
4479 #include <stdio.h>
4480 int main()
4481 {
4482     printf("%d\n", (int)sizeof($lseektype));
4483     return(0); 
4484 }
4485 EOCP
4486                 set try
4487                 if eval $compile_ok; then
4488                         lseeksize=`./try`
4489                         $echo "Your file offsets are now $lseeksize bytes long."
4490                 else
4491                         dflt="$lseeksize"
4492                         echo " "
4493                         echo "(I can't seem to compile the test program.  Guessing...)"
4494                         rp="What is the size of your file offsets (in bytes)?"
4495                         . ./myread
4496                         lseeksize="$ans"
4497                 fi
4498                 case "$fpostype" in
4499                 *_t) zzz="$fpostype"    ;;
4500                 *)   zzz="fpos_t"       ;;
4501                 esac
4502                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4503                 $cat > try.c <<EOCP
4504 #include <sys/types.h>
4505 #include <stdio.h>
4506 int main() {
4507     printf("%d\n", (int)sizeof($fpostype));
4508     exit(0);
4509 }
4510 EOCP
4511                 set try
4512                 if eval $compile_ok; then
4513                         yyy=`./try`
4514                         dflt="$lseeksize"
4515                         case "$yyy" in
4516                         '')     echo " "
4517                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4518                                 ;;
4519                         *)      fpossize=$yyy
4520                                 echo " $fpossize bytes." >&4
4521                                 ;;
4522                         esac
4523                 else
4524                         dflt="$fpossize"
4525                         echo " "
4526                         echo "(I can't compile the test program.  Guessing...)" >&4
4527                         rp="What is the size of your file positions (in bytes)?"
4528                         . ./myread
4529                         fpossize="$ans"
4530                 fi
4531                 $rm -f try.c try
4532         fi
4533         ;;
4534 esac
4535
4536
4537 case "$usemorebits" in
4538 "$define"|true|[yY]*)
4539         use64bitint="$define"
4540         uselongdouble="$define"
4541         usemorebits="$define"
4542         ;;
4543 *)      usemorebits="$undef"
4544         ;;
4545 esac
4546
4547 : check for void type
4548 echo " "
4549 echo "Checking to see how well your C compiler groks the void type..." >&4
4550 case "$voidflags" in
4551 '')
4552         $cat >try.c <<'EOCP'
4553 #if TRY & 1
4554 void sub() {
4555 #else
4556 sub() {
4557 #endif
4558         extern void moo();      /* function returning void */
4559         void (*goo)();          /* ptr to func returning void */
4560 #if TRY & 8
4561         void *hue;              /* generic ptr */
4562 #endif
4563 #if TRY & 2
4564         void (*foo[10])();
4565 #endif
4566
4567 #if TRY & 4
4568         if(goo == moo) {
4569                 exit(0);
4570         }
4571 #endif
4572         exit(0);
4573 }
4574 int main() { sub(); }
4575 EOCP
4576         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4577                 voidflags=$defvoidused
4578         echo "Good.  It appears to support void to the level $package wants.">&4
4579                 if $contains warning .out >/dev/null 2>&1; then
4580                         echo "However, you might get some warnings that look like this:"
4581                         $cat .out
4582                 fi
4583         else
4584 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4585                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4586                         echo "It supports 1..."
4587                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4588                                 echo "It also supports 2..."
4589                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4590                                         voidflags=7
4591                                         echo "And it supports 4 but not 8 definitely."
4592                                 else
4593                                         echo "It doesn't support 4..."
4594                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4595                                                 voidflags=11
4596                                                 echo "But it supports 8."
4597                                         else
4598                                                 voidflags=3
4599                                                 echo "Neither does it support 8."
4600                                         fi
4601                                 fi
4602                         else
4603                                 echo "It does not support 2..."
4604                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4605                                         voidflags=13
4606                                         echo "But it supports 4 and 8."
4607                                 else
4608                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4609                                                 voidflags=5
4610                                                 echo "And it supports 4 but has not heard about 8."
4611                                         else
4612                                                 echo "However it supports 8 but not 4."
4613                                         fi
4614                                 fi
4615                         fi
4616                 else
4617                         echo "There is no support at all for void."
4618                         voidflags=0
4619                 fi
4620         fi
4621 esac
4622 case "$voidflags" in
4623 "$defvoidused") ;;
4624 *)      $cat >&4 <<'EOM'
4625   Support flag bits are:
4626     1: basic void declarations.
4627     2: arrays of pointers to functions returning void.
4628     4: operations between pointers to and addresses of void functions.
4629     8: generic void pointers.
4630 EOM
4631         dflt="$voidflags";
4632         rp="Your void support flags add up to what?"
4633         . ./myread
4634         voidflags="$ans"
4635         ;;
4636 esac
4637 $rm -f try.* .out
4638
4639 : check for length of pointer
4640 echo " "
4641 case "$ptrsize" in
4642 '')
4643         echo "Checking to see how big your pointers are..." >&4
4644         if test "$voidflags" -gt 7; then
4645                 echo '#define VOID_PTR char *' > try.c
4646         else
4647                 echo '#define VOID_PTR void *' > try.c
4648         fi
4649         $cat >>try.c <<'EOCP'
4650 #include <stdio.h>
4651 int main()
4652 {
4653     printf("%d\n", (int)sizeof(VOID_PTR));
4654     exit(0);
4655 }
4656 EOCP
4657         set try
4658         if eval $compile_ok; then
4659                 ptrsize=`./try`
4660                 echo "Your pointers are $ptrsize bytes long."
4661         else
4662                 dflt='4'
4663                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4664                 rp="What is the size of a pointer (in bytes)?"
4665                 . ./myread
4666                 ptrsize="$ans"
4667         fi
4668         ;;
4669 esac
4670 $rm -f try.c try
4671
4672 : check for long long
4673 echo " "
4674 echo "Checking to see if you have long long..." >&4
4675 echo 'int main() { long long x = 7; return 0; }' > try.c
4676 set try
4677 if eval $compile; then
4678         val="$define"
4679         echo "You have long long."
4680 else
4681         val="$undef"
4682         echo "You do not have long long."
4683 fi
4684 $rm try.*
4685 set d_longlong
4686 eval $setvar
4687
4688 : check for length of long long
4689 case "${d_longlong}${longlongsize}" in
4690 $define)
4691         echo " "
4692         echo "Checking to see how big your long longs are..." >&4
4693         $cat >try.c <<'EOCP'
4694 #include <stdio.h>
4695 int main()
4696 {
4697     printf("%d\n", (int)sizeof(long long));
4698     return(0);
4699 }
4700 EOCP
4701         set try
4702         if eval $compile_ok; then
4703                 longlongsize=`./try$exe_ext`
4704                 echo "Your long longs are $longlongsize bytes long."
4705         else
4706                 dflt='8'
4707                 echo " "
4708                 echo "(I can't seem to compile the test program.  Guessing...)"
4709                 rp="What is the size of a long long (in bytes)?"
4710                 . ./myread
4711                 longlongsize="$ans"
4712         fi
4713         if $test "X$longsize" = "X$longlongsize"; then
4714                 echo "(That isn't any different from an ordinary long.)"
4715         fi      
4716         ;;
4717 esac
4718 $rm -f try.* try
4719
4720 : determine filename position in cpp output
4721 echo " "
4722 echo "Computing filename position in cpp output for #include directives..." >&4
4723 echo '#include <stdio.h>' > foo.c
4724 $cat >fieldn <<EOF
4725 $startsh
4726 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4727 $grep '^[       ]*#.*stdio\.h' | \
4728 while read cline; do
4729         pos=1
4730         set \$cline
4731         while $test \$# -gt 0; do
4732                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4733                         echo "\$pos"
4734                         exit 0
4735                 fi
4736                 shift
4737                 pos=\`expr \$pos + 1\`
4738         done
4739 done
4740 EOF
4741 chmod +x fieldn
4742 fieldn=`./fieldn`
4743 $rm -f foo.c fieldn
4744 case $fieldn in
4745 '') pos='???';;
4746 1) pos=first;;
4747 2) pos=second;;
4748 3) pos=third;;
4749 *) pos="${fieldn}th";;
4750 esac
4751 echo "Your cpp writes the filename in the $pos field of the line."
4752
4753 : locate header file
4754 $cat >findhdr <<EOF
4755 $startsh
4756 wanted=\$1
4757 name=''
4758 for usrincdir in $usrinc
4759 do
4760         if test -f \$usrincdir/\$wanted; then
4761                 echo "\$usrincdir/\$wanted"
4762                 exit 0
4763         fi
4764 done
4765 awkprg='{ print \$$fieldn }'
4766 echo "#include <\$wanted>" > foo\$\$.c
4767 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4768 $grep "^[       ]*#.*\$wanted" | \
4769 while read cline; do
4770         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4771         case "\$name" in
4772         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4773         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4774         *) exit 2;;
4775         esac;
4776 done;
4777 #
4778 # status = 0: grep returned 0 lines, case statement not executed
4779 # status = 1: headerfile found
4780 # status = 2: while loop executed, no headerfile found
4781 #
4782 status=\$?
4783 $rm -f foo\$\$.c;
4784 if test \$status -eq 1; then
4785         exit 0;
4786 fi
4787 exit 1
4788 EOF
4789 chmod +x findhdr
4790
4791 : define an alternate in-header-list? function
4792 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4793 cont=true; xxf="echo \"<\$1> found.\" >&4";
4794 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4795 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4796 esac;
4797 case $# in 4) instead=instead;; *) instead="at last";; esac;
4798 while $test "$cont"; do
4799         xxx=`./findhdr $1`
4800         var=$2; eval "was=\$$2";
4801         if $test "$xxx" && $test -r "$xxx";
4802         then eval $xxf;
4803         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4804                 cont="";
4805         else eval $xxnf;
4806         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4807         set $yyy; shift; shift; yyy=$@;
4808         case $# in 0) cont="";;
4809         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4810                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4811         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4812                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4813         esac;
4814 done;
4815 while $test "$yyy";
4816 do set $yyy; var=$2; eval "was=\$$2";
4817         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4818         set $yyy; shift; shift; yyy=$@;
4819 done'
4820
4821 : see if inttypes.h is available
4822 : we want a real compile instead of Inhdr because some systems
4823 : have an inttypes.h which includes non-existent headers
4824 echo " "
4825 $cat >try.c <<EOCP
4826 #include <inttypes.h>
4827 int main() {
4828         static int32_t foo32 = 0x12345678;
4829 }
4830 EOCP
4831 set try
4832 if eval $compile; then
4833         echo "<inttypes.h> found." >&4
4834         val="$define"
4835 else
4836         echo "<inttypes.h> NOT found." >&4
4837         val="$undef"
4838 fi
4839 $rm -f try.c try
4840 set i_inttypes
4841 eval $setvar
4842
4843 : check for int64_t
4844 echo " "
4845 echo "Checking to see if you have int64_t..." >&4
4846 $cat >try.c <<EOCP
4847 #include <sys/types.h>
4848 #$i_inttypes I_INTTYPES
4849 #ifdef I_INTTYPES
4850 #include <inttypes.h>
4851 #endif
4852 int main() { int64_t x = 7; }
4853 EOCP
4854 set try
4855 if eval $compile; then
4856         val="$define"
4857         echo "You have int64_t."
4858 else
4859         val="$undef"
4860         echo "You do not have int64_t."
4861 fi
4862 $rm -f try try.*
4863 set d_int64_t
4864 eval $setvar
4865
4866
4867 echo " "
4868 echo "Checking which 64-bit integer type we could use..." >&4
4869
4870 case "$intsize" in
4871 8) val=int
4872    set quadtype
4873    eval $setvar
4874    val='"unsigned int"'
4875    set uquadtype
4876    eval $setvar
4877    quadkind=1
4878    ;;
4879 *) case "$longsize" in
4880    8) val=long
4881       set quadtype
4882       eval $setvar
4883       val='"unsigned long"'
4884       set uquadtype
4885       eval $setvar
4886       quadkind=2
4887       ;;
4888    *) case "$d_longlong:$longlongsize" in
4889       define:8)
4890         val='"long long"'
4891         set quadtype
4892         eval $setvar
4893         val='"unsigned long long"'
4894         set uquadtype
4895         eval $setvar
4896         quadkind=3
4897         ;;
4898       *) case "$d_int64_t" in
4899          define)
4900            val=int64_t
4901            set quadtype
4902            eval $setvar
4903            val=uint64_t
4904            set uquadtype
4905            eval $setvar
4906            quadkind=4
4907            ;;
4908          esac
4909          ;;
4910       esac
4911       ;;
4912    esac
4913    ;;
4914 esac
4915
4916 case "$quadtype" in
4917 '')     echo "Alas, no 64-bit integer types in sight." >&4
4918         d_quad="$undef"
4919         ;;
4920 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4921         d_quad="$define"
4922         ;;
4923 esac
4924
4925
4926 case "$uselonglong" in
4927 "$define"|true|[yY]*)
4928         cat <<EOM >&4
4929
4930 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4931 EOM
4932         use64bitint="$define"
4933         ;;
4934 esac                          
4935 case "$use64bits" in
4936 "$define"|true|[yY]*)
4937         cat <<EOM >&4
4938
4939 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4940 EOM
4941         use64bitint="$define"
4942         ;;
4943 esac                          
4944 case "$use64bitints" in
4945 "$define"|true|[yY]*)
4946         cat <<EOM >&4
4947
4948 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4949 EOM
4950         use64bitint="$define"
4951         ;;
4952 esac                          
4953 case "$use64bitsint" in
4954 "$define"|true|[yY]*)
4955         cat <<EOM >&4
4956
4957 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4958 EOM
4959         use64bitint="$define"
4960         ;;
4961 esac                          
4962 case "$uselonglongs" in
4963 "$define"|true|[yY]*)
4964         cat <<EOM >&4
4965
4966 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4967 EOM
4968         use64bitint="$define"
4969         ;;
4970 esac                          
4971 case "$use64bitsall" in
4972 "$define"|true|[yY]*)
4973         cat <<EOM >&4
4974
4975 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4976 EOM
4977         use64bitall="$define"
4978         ;;
4979 esac                          
4980
4981 case "$ccflags" in
4982 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4983 esac
4984 case "$use64bitall" in
4985 "$define"|true|[yY]*) use64bitint="$define" ;;
4986 esac
4987
4988 case "$longsize" in
4989 8) cat <<EOM
4990
4991 You have natively 64-bit long integers.
4992 EOM
4993    val="$define"
4994    ;;
4995 *) case "$use64bitint" in
4996    "$define"|true|[yY]*) dflt='y';;
4997    *) dflt='n';;
4998    esac
4999    case "$d_quad" in
5000    "$define") ;;
5001    *) dflt='n' ;;
5002    esac
5003    cat <<EOM
5004
5005 Perl can be built to take advantage of 64-bit integer types
5006 on some systems.  To do so, Configure can be run with -Duse64bitint.
5007 Choosing this option will most probably introduce binary incompatibilities.
5008
5009 If this doesn't make any sense to you, just accept the default '$dflt'.
5010 (The default has been chosen based on your configuration.)
5011 EOM
5012    rp='Try to use 64-bit integers, if available?'
5013    . ./myread
5014    case "$ans" in
5015    [yY]*) val="$define" ;;
5016    *)     val="$undef"  ;;
5017    esac
5018    ;;
5019 esac
5020 set use64bitint
5021 eval $setvar
5022
5023 case "$use64bitall" in
5024 "$define"|true|[yY]*) dflt='y' ;;
5025 *) case "$longsize" in
5026    8) dflt='y' ;;
5027    *) dflt='n' ;;
5028    esac
5029    ;;
5030 esac    
5031 cat <<EOM
5032
5033 You may also choose to try maximal 64-bitness.  It means using as much
5034 64-bitness as possible on the platform.  This in turn means even more
5035 binary incompatibilities.  On the other hand, your platform may not
5036 have any more 64-bitness available than what you already have chosen.
5037
5038 If this doesn't make any sense to you, just accept the default '$dflt'.
5039 (The default has been chosen based on your configuration.)
5040 EOM
5041 rp='Try to use maximal 64-bit support, if available?'
5042 . ./myread
5043 case "$ans" in
5044 [yY]*) val="$define" ;;
5045 *)     val="$undef"  ;;
5046 esac
5047 set use64bitall
5048 eval $setvar
5049 case "$use64bitall" in
5050 "$define")
5051         case "$use64bitint" in
5052         "$undef")
5053                 cat <<EOM
5054
5055 Since you have chosen a maximally 64-bit build, I'm also turning on
5056 the use of 64-bit integers.
5057 EOM
5058                 use64bitint="$define" ;;
5059         esac
5060         ;;
5061 esac
5062
5063 case "$use64bitall" in
5064 "$define"|true|[yY]*)
5065         case "$ptrsize" in
5066         4)      cat <<EOM >&4
5067
5068 *** You have chosen a maximally 64-bit build, but your pointers
5069 *** are only 4 bytes wide, disabling maximal 64-bitness.
5070
5071 EOM
5072                 use64bitall="$undef"
5073                 case "$use64bitint" in
5074                 "$define"|true|[yY]*) ;;
5075                 *)      cat <<EOM >&4
5076
5077 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5078
5079 EOM
5080                         use64bitint="$define"
5081                         ;;
5082                 esac
5083                 ;;
5084         esac
5085         ;;
5086 esac
5087
5088 case "$use64bitint" in
5089 "$define"|true|[yY]*)
5090 : Look for a hint-file generated 'call-back-unit'.  If the
5091 : user has specified that a 64-bit perl is to be built,
5092 : we may need to set or change some other defaults.
5093         if $test -f use64bitint.cbu; then
5094                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5095                 . ./use64bitint.cbu
5096         fi
5097         case "$longsize" in
5098         4) case "$archname64" in
5099            '') archname64=64int ;;
5100            esac
5101            ;;
5102         esac
5103         ;;
5104 esac
5105
5106 case "$use64bitall" in
5107 "$define"|true|[yY]*)
5108 : Look for a hint-file generated 'call-back-unit'.  If the
5109 : user has specified that a maximally 64-bit perl is to be built,
5110 : we may need to set or change some other defaults.
5111         if $test -f use64bitall.cbu; then
5112                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5113                 . ./use64bitall.cbu
5114         fi
5115         case "$longsize" in
5116         4) case "$archname64" in
5117            ''|64int) archname64=64all ;;
5118            esac
5119            ;;
5120         esac
5121         ;;
5122 esac
5123
5124 echo " "
5125 echo "Checking for GNU C Library..." >&4
5126 cat >gnulibc.c <<EOM
5127 #include <stdio.h>
5128 int main()
5129 {
5130 #ifdef __GLIBC__
5131     exit(0);
5132 #else
5133     exit(1);
5134 #endif
5135 }
5136 EOM
5137 set gnulibc
5138 if eval $compile_ok && ./gnulibc; then
5139         val="$define"
5140         echo "You are using the GNU C Library"
5141 else
5142         val="$undef"
5143         echo "You are not using the GNU C Library"
5144 fi
5145 $rm -f gnulibc*
5146 set d_gnulibc
5147 eval $setvar
5148
5149 : see if nm is to be used to determine whether a symbol is defined or not
5150 case "$usenm" in
5151 '')
5152         dflt=''
5153         case "$d_gnulibc" in
5154         "$define")
5155                 echo " "
5156                 echo "nm probably won't work on the GNU C Library." >&4
5157                 dflt=n
5158                 ;;
5159         esac
5160         case "$dflt" in
5161         '') 
5162                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5163                         echo " "
5164                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5165                         echo "'nm' won't be sufficient on this sytem." >&4
5166                         dflt=n
5167                 fi
5168                 ;;
5169         esac
5170         case "$dflt" in
5171         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5172                 if $test $dflt -gt 20; then
5173                         dflt=y
5174                 else
5175                         dflt=n
5176                 fi
5177                 ;;
5178         esac
5179         ;;
5180 *)
5181         case "$usenm" in
5182         true|$define) dflt=y;;
5183         *) dflt=n;;
5184         esac
5185         ;;
5186 esac
5187 $cat <<EOM
5188
5189 I can use $nm to extract the symbols from your C libraries. This
5190 is a time consuming task which may generate huge output on the disk (up
5191 to 3 megabytes) but that should make the symbols extraction faster. The
5192 alternative is to skip the 'nm' extraction part and to compile a small
5193 test program instead to determine whether each symbol is present. If
5194 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5195 this may be the best solution.
5196
5197 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5198
5199 EOM
5200 rp="Shall I use $nm to extract C symbols from the libraries?"
5201 . ./myread
5202 case "$ans" in
5203 [Nn]*) usenm=false;;
5204 *) usenm=true;;
5205 esac
5206
5207 runnm=$usenm
5208 case "$reuseval" in
5209 true) runnm=false;;
5210 esac
5211
5212 : nm options which may be necessary
5213 case "$nm_opt" in
5214 '') if $test -f /mach_boot; then
5215                 nm_opt=''       # Mach
5216         elif $test -d /usr/ccs/lib; then
5217                 nm_opt='-p'     # Solaris (and SunOS?)
5218         elif $test -f /dgux; then
5219                 nm_opt='-p'     # DG-UX
5220         elif $test -f /lib64/rld; then
5221                 nm_opt='-p'     # 64-bit Irix
5222         else
5223                 nm_opt=''
5224         fi;;
5225 esac
5226
5227 : nm options which may be necessary for shared libraries but illegal
5228 : for archive libraries.  Thank you, Linux.
5229 case "$nm_so_opt" in
5230 '')     case "$myuname" in
5231         *linux*)
5232                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5233                         nm_so_opt='--dynamic'
5234                 fi
5235                 ;;
5236         esac
5237         ;;
5238 esac
5239
5240 case "$runnm" in
5241 true)
5242 : get list of predefined functions in a handy place
5243 echo " "
5244 case "$libc" in
5245 '') libc=unknown
5246         case "$libs" in
5247         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5248         esac
5249         ;;
5250 esac
5251 libnames='';
5252 case "$libs" in
5253 '') ;;
5254 *)  for thislib in $libs; do
5255         case "$thislib" in
5256         -lc|-lc_s)
5257                 : Handle C library specially below.
5258                 ;;
5259         -l*)
5260                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5261                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5262                         :
5263                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5264                         :
5265                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5266                         :
5267                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5268                         :
5269                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5270                         :
5271                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5272                         :
5273                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5274                         :
5275                 else
5276                         try=''
5277                 fi
5278                 libnames="$libnames $try"
5279                 ;;
5280         *) libnames="$libnames $thislib" ;;
5281         esac
5282         done
5283         ;;
5284 esac
5285 xxx=normal
5286 case "$libc" in
5287 unknown)
5288         set /lib/libc.$so
5289         for xxx in $libpth; do
5290                 $test -r $1 || set $xxx/libc.$so
5291                 : The messy sed command sorts on library version numbers.
5292                 $test -r $1 || \
5293                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5294                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5295                                 h
5296                                 s/[0-9][0-9]*/0000&/g
5297                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5298                                 G
5299                                 s/\n/ /' | \
5300                          $sort | $sed -e 's/^.* //'`
5301                 eval set \$$#
5302         done
5303         $test -r $1 || set /usr/ccs/lib/libc.$so
5304         $test -r $1 || set /lib/libsys_s$_a
5305         ;;
5306 *)
5307         set blurfl
5308         ;;
5309 esac
5310 if $test -r "$1"; then
5311         echo "Your (shared) C library seems to be in $1."
5312         libc="$1"
5313 elif $test -r /lib/libc && $test -r /lib/clib; then
5314         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5315         xxx=apollo
5316         libc='/lib/clib /lib/libc'
5317         if $test -r /lib/syslib; then
5318                 echo "(Your math library is in /lib/syslib.)"
5319                 libc="$libc /lib/syslib"
5320         fi
5321 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5322         echo "Your C library seems to be in $libc, as you said before."
5323 elif $test -r $incpath/usr/lib/libc$_a; then
5324         libc=$incpath/usr/lib/libc$_a;
5325         echo "Your C library seems to be in $libc.  That's fine."
5326 elif $test -r /lib/libc$_a; then
5327         libc=/lib/libc$_a;
5328         echo "Your C library seems to be in $libc.  You're normal."
5329 else
5330         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5331                 :
5332         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5333                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5334         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5335                 :
5336         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5337                 :
5338         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5339                 :
5340         else
5341                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5342         fi
5343         if $test -r "$tans"; then
5344                 echo "Your C library seems to be in $tans, of all places."
5345                 libc=$tans
5346         else
5347                 libc='blurfl'
5348         fi
5349 fi
5350 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5351         dflt="$libc"
5352         cat <<EOM
5353
5354 If the guess above is wrong (which it might be if you're using a strange
5355 compiler, or your machine supports multiple models), you can override it here.
5356
5357 EOM
5358 else
5359         dflt=''
5360         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5361         cat >&4 <<EOM
5362 I can't seem to find your C library.  I've looked in the following places:
5363
5364 EOM
5365         $sed 's/^/      /' libpath
5366         cat <<EOM
5367
5368 None of these seems to contain your C library. I need to get its name...
5369
5370 EOM
5371 fi
5372 fn=f
5373 rp='Where is your C library?'
5374 . ./getfile
5375 libc="$ans"
5376
5377 echo " "
5378 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5379 set X `cat libnames`
5380 shift
5381 xxx=files
5382 case $# in 1) xxx=file; esac
5383 echo "Extracting names from the following $xxx for later perusal:" >&4
5384 echo " "
5385 $sed 's/^/      /' libnames >&4
5386 echo " "
5387 $echo $n "This may take a while...$c" >&4
5388
5389 for file in $*; do
5390         case $file in
5391         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5392         *) $nm $nm_opt $file 2>/dev/null;;
5393         esac
5394 done >libc.tmp
5395
5396 $echo $n ".$c"
5397 $grep fprintf libc.tmp > libc.ptf
5398 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5399 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5400 xxx='[ADTSIW]'
5401 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5402         eval $xscan;\
5403         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5404                 eval $xrun
5405 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5406         eval $xscan;\
5407         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5408                 eval $xrun
5409 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5410         eval $xscan;\
5411         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5412                 eval $xrun
5413 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5414         eval $xscan;\
5415         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5416                 eval $xrun
5417 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5418         eval $xscan;\
5419         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5420                 eval $xrun
5421 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5422         eval $xscan;\
5423         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5424                 eval $xrun
5425 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5426                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5427         eval $xscan;\
5428         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5429                 eval $xrun
5430 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5431         eval $xscan;\
5432         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5433                 eval $xrun
5434 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5435         eval $xscan;\
5436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5437                 eval $xrun
5438 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5439         eval $xscan;\
5440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5441                 eval $xrun
5442 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5443         eval $xscan;\
5444         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5445                 eval $xrun
5446 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
5451         eval $xscan;\
5452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5453                 eval $xrun
5454 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5455         eval $xscan;\
5456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5457                 eval $xrun
5458 else
5459         $nm -p $* 2>/dev/null >libc.tmp
5460         $grep fprintf libc.tmp > libc.ptf
5461         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5462                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5463         then
5464                 nm_opt='-p'
5465                 eval $xrun
5466         else
5467                 echo " "
5468                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5469                 com=''
5470                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5471                         for thisname in $libnames $libc; do
5472                                 $ar t $thisname >>libc.tmp
5473                         done
5474                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5475                         echo "Ok." >&4
5476                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5477                         # Repeat libc to extract forwarders to DLL entries too
5478                         for thisname in $libnames $libc; do
5479                                 $ar tv $thisname >>libc.tmp
5480                                 # Revision 50 of EMX has bug in $ar.
5481                                 # it will not extract forwarders to DLL entries
5482                                 # Use emximp which will extract exactly them.
5483                                 emximp -o tmp.imp $thisname \
5484                                     2>/dev/null && \
5485                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5486                                     < tmp.imp >>libc.tmp
5487                                 $rm tmp.imp
5488                         done
5489                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5490                         echo "Ok." >&4
5491                 else
5492                         echo "$ar didn't seem to work right." >&4
5493                         echo "Maybe this is a Cray...trying bld instead..." >&4
5494                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5495                         then
5496                                 for thisname in $libnames; do
5497                                         bld t $libnames | \
5498                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5499                                         $ar t $thisname >>libc.tmp
5500                                 done
5501                                 echo "Ok." >&4
5502                         else
5503                                 echo "That didn't work either.  Giving up." >&4
5504                                 exit 1
5505                         fi
5506                 fi
5507         fi
5508 fi
5509 nm_extract="$com"
5510 if $test -f /lib/syscalls.exp; then
5511         echo " "
5512         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5513         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5514 fi
5515 ;;
5516 esac
5517 $rm -f libnames libpath
5518
5519 : is a C symbol defined?
5520 csym='tlook=$1;
5521 case "$3" in
5522 -v) tf=libc.tmp; tc=""; tdc="";;
5523 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5524 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5525 esac;
5526 tx=yes;
5527 case "$reuseval-$4" in
5528 true-) ;;
5529 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5530 esac;
5531 case "$tx" in
5532 yes)
5533         case "$runnm" in
5534         true)
5535                 if $contains $tlook $tf >/dev/null 2>&1;
5536                 then tval=true;
5537                 else tval=false;
5538                 fi;;
5539         *)
5540                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5541                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5542                 then tval=true;
5543                 else tval=false;
5544                 fi;
5545                 $rm -f t t.c;;
5546         esac;;
5547 *)
5548         case "$tval" in
5549         $define) tval=true;;
5550         *) tval=false;;
5551         esac;;
5552 esac;
5553 eval "$2=$tval"'
5554
5555 : define an is-in-libc? function
5556 inlibc='echo " "; td=$define; tu=$undef;
5557 sym=$1; var=$2; eval "was=\$$2";
5558 tx=yes;
5559 case "$reuseval$was" in
5560 true) ;;
5561 true*) tx=no;;
5562 esac;
5563 case "$tx" in
5564 yes)
5565         set $sym tres -f;
5566         eval $csym;
5567         case "$tres" in
5568         true)
5569                 echo "$sym() found." >&4;
5570                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5571         *)
5572                 echo "$sym() NOT found." >&4;
5573                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5574         esac;;
5575 *)
5576         case "$was" in
5577         $define) echo "$sym() found." >&4;;
5578         *) echo "$sym() NOT found." >&4;;
5579         esac;;
5580 esac'
5581
5582 : see if sqrtl exists
5583 set sqrtl d_sqrtl
5584 eval $inlibc
5585
5586 case "$ccflags" in
5587 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5588 esac
5589
5590 case "$uselongdouble" in
5591 $define|true|[yY]*)     dflt='y';;
5592 *) dflt='n';;
5593 esac
5594 cat <<EOM
5595
5596 Perl can be built to take advantage of long doubles which
5597 (if available) may give more accuracy and range for floating point numbers.
5598
5599 If this doesn't make any sense to you, just accept the default '$dflt'.
5600 EOM
5601 rp='Try to use long doubles if available?'
5602 . ./myread
5603 case "$ans" in
5604 y|Y)    val="$define"   ;;
5605 *)      val="$undef"    ;;
5606 esac
5607 set uselongdouble
5608 eval $setvar
5609
5610 case "$uselongdouble" in
5611 true|[yY]*) uselongdouble="$define" ;;
5612 esac
5613
5614 case "$uselongdouble" in
5615 $define)
5616 : Look for a hint-file generated 'call-back-unit'.  If the
5617 : user has specified that long doubles should be used,
5618 : we may need to set or change some other defaults.
5619         if $test -f uselongdouble.cbu; then
5620                 echo "Your platform has some specific hints for long doubles, using them..."
5621                 . ./uselongdouble.cbu
5622         else
5623                 $cat <<EOM
5624 (Your platform doesn't have any specific hints for long doubles.)
5625 EOM
5626         fi
5627         ;;
5628 esac
5629
5630 case "$uselongdouble:$d_sqrtl" in
5631 $define:$undef)
5632                 $cat <<EOM >&4
5633
5634 *** You requested the use of long doubles but you do not seem to have
5635 *** the mathematic functions for long doubles.  I'm disabling the use
5636 *** of long doubles.
5637
5638 EOM
5639         uselongdouble=$undef
5640         ;;
5641 esac
5642
5643 : check for length of double
5644 echo " "
5645 case "$doublesize" in
5646 '')
5647         echo "Checking to see how big your double precision numbers are..." >&4
5648         $cat >try.c <<'EOCP'
5649 #include <stdio.h>
5650 int main()
5651 {
5652     printf("%d\n", (int)sizeof(double));
5653     exit(0);
5654 }
5655 EOCP
5656         set try
5657         if eval $compile_ok; then
5658                 doublesize=`./try`
5659                 echo "Your double is $doublesize bytes long."
5660         else
5661                 dflt='8'
5662                 echo "(I can't seem to compile the test program.  Guessing...)"
5663                 rp="What is the size of a double precision number (in bytes)?"
5664                 . ./myread
5665                 doublesize="$ans"
5666         fi
5667         ;;
5668 esac
5669 $rm -f try.c try
5670
5671 : check for long doubles
5672 echo " "
5673 echo "Checking to see if you have long double..." >&4
5674 echo 'int main() { long double x = 7.0; }' > try.c
5675 set try
5676 if eval $compile; then
5677         val="$define"
5678         echo "You have long double."
5679 else
5680         val="$undef"
5681         echo "You do not have long double."
5682 fi
5683 $rm try.*
5684 set d_longdbl
5685 eval $setvar
5686
5687 : check for length of long double
5688 case "${d_longdbl}${longdblsize}" in
5689 $define)
5690         echo " "
5691         echo "Checking to see how big your long doubles are..." >&4
5692         $cat >try.c <<'EOCP'
5693 #include <stdio.h>
5694 int main()
5695 {
5696         printf("%d\n", sizeof(long double));
5697 }
5698 EOCP
5699         set try
5700         set try
5701         if eval $compile; then
5702                 longdblsize=`./try$exe_ext`
5703                 echo "Your long doubles are $longdblsize bytes long."
5704         else
5705                 dflt='8'
5706                 echo " "
5707                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5708                 rp="What is the size of a long double (in bytes)?"
5709                 . ./myread
5710                 longdblsize="$ans"
5711         fi
5712         if $test "X$doublesize" = "X$longdblsize"; then
5713                 echo "(That isn't any different from an ordinary double.)"
5714         fi      
5715         ;;
5716 esac
5717 $rm -f try.* try
5718
5719 case "$useperlio" in
5720 $define|true|[yY]*|'')  dflt='y';;
5721 *) dflt='n';;
5722 esac
5723 cat <<EOM
5724
5725 Previous version of $package used the standard IO mechanisms as
5726 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5727 alternate IO mechanisms via the PerlIO abstraction layer, but the
5728 stdio mechanism is still available if needed.  The abstraction layer
5729 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5730 Using PerlIO with sfio may cause problems with some extension modules.
5731
5732 If this doesn't make any sense to you, just accept the default '$dflt'.
5733 EOM
5734 rp='Use the PerlIO abstraction layer?'
5735 . ./myread
5736 case "$ans" in
5737 y|Y) 
5738         val="$define"
5739         ;;
5740 *)      
5741         echo "Ok, doing things the stdio way."
5742         val="$undef"
5743         ;;
5744 esac
5745 set useperlio
5746 eval $setvar 
5747
5748 case "$usesocks" in
5749 $define|true|[yY]*)
5750         case "$useperlio" in
5751         $define|true|[yY]*) ;;
5752         *)      cat >&4 <<EOM
5753
5754 You are using the SOCKS proxy protocol library which means that you
5755 should also use the PerlIO layer.  You may be headed for trouble.
5756
5757 EOM
5758                 ;;
5759         esac
5760         ;;
5761 esac
5762
5763         
5764 : determine the architecture name
5765 echo " "
5766 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5767         tarch=`arch`"-$osname"
5768 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5769         if uname -m > tmparch 2>&1 ; then
5770                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5771                         -e 's/$/'"-$osname/" tmparch`
5772         else
5773                 tarch="$osname"
5774         fi
5775         $rm -f tmparch
5776 else
5777         tarch="$osname"
5778 fi
5779 case "$myarchname" in
5780 ''|"$tarch") ;;
5781 *)
5782         echo "(Your architecture name used to be $myarchname.)"
5783         archname=''
5784         ;;
5785 esac
5786 myarchname="$tarch"
5787 case "$archname" in
5788 '') dflt="$tarch";;
5789 *) dflt="$archname";;
5790 esac
5791 rp='What is your architecture name'
5792 . ./myread
5793 archname="$ans"
5794 case "$usethreads" in
5795 $define)
5796         echo "Threads selected." >&4
5797         case "$archname" in
5798         *-thread*) echo "...and architecture name already has -thread." >&4
5799                 ;;
5800         *)      archname="$archname-thread"
5801                 echo "...setting architecture name to $archname." >&4
5802                 ;;
5803         esac
5804         ;;
5805 esac
5806 case "$usemultiplicity" in
5807 $define)
5808         echo "Multiplicity selected." >&4
5809         case "$archname" in
5810         *-multi*) echo "...and architecture name already has -multi." >&4
5811                 ;;
5812         *)      archname="$archname-multi"
5813                 echo "...setting architecture name to $archname." >&4
5814                 ;;
5815         esac
5816         ;;
5817 esac
5818 case "$use64bitint$use64bitall" in
5819 *"$define"*)
5820         case "$archname64" in
5821         '')
5822                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5823                 ;;
5824         *)
5825                 case "$use64bitint" in
5826                 "$define") echo "64 bit integers selected." >&4 ;;
5827                 esac
5828                 case "$use64bitall" in
5829                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5830                 esac
5831                 case "$archname" in
5832                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5833                         ;;
5834                 *)      archname="$archname-$archname64"
5835                         echo "...setting architecture name to $archname." >&4
5836                         ;;
5837                 esac
5838                 ;;
5839         esac
5840 esac
5841 case "$uselongdouble" in
5842 $define)
5843         echo "Long doubles selected." >&4
5844         case "$longdblsize" in
5845         $doublesize)
5846                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5847                 ;;
5848         *)
5849                 case "$archname" in
5850                 *-ld*) echo "...and architecture name already has -ld." >&4
5851                         ;;
5852                 *)      archname="$archname-ld"
5853                         echo "...setting architecture name to $archname." >&4
5854                         ;;
5855                 esac
5856                 ;;
5857         esac
5858         ;;
5859 esac
5860 case "$useperlio" in
5861 $define)
5862         echo "Perlio selected." >&4
5863         ;;
5864 *)
5865         echo "Perlio not selected, using stdio." >&4
5866         case "$archname" in
5867         *-stdio*) echo "...and architecture name already has -stdio." >&4
5868                 ;;
5869         *)      archname="$archname-stdio"
5870                 echo "...setting architecture name to $archname." >&4
5871                 ;;
5872         esac
5873         ;;
5874 esac
5875
5876 : determine root of directory hierarchy where package will be installed.
5877 case "$prefix" in
5878 '')
5879         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5880         ;;
5881 *)
5882         dflt="$prefix"
5883         ;;
5884 esac
5885 $cat <<EOM
5886
5887 By default, $package will be installed in $dflt/bin, manual pages
5888 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5889 installation directories. Typically this is something like /usr/local.
5890 If you wish to have binaries under /usr/bin but other parts of the
5891 installation under /usr/local, that's ok: you will be prompted
5892 separately for each of the installation directories, the prefix being
5893 only used to set the defaults.
5894
5895 EOM
5896 fn=d~
5897 rp='Installation prefix to use?'
5898 . ./getfile
5899 oldprefix=''
5900 case "$prefix" in
5901 '') ;;
5902 *)
5903         case "$ans" in
5904         "$prefix") ;;
5905         *) oldprefix="$prefix";;
5906         esac
5907         ;;
5908 esac
5909 prefix="$ans"
5910 prefixexp="$ansexp"
5911
5912 : is AFS running?
5913 echo " "
5914 case "$afs" in
5915 $define|true)   afs=true ;;
5916 $undef|false)   afs=false ;;
5917 *)      if test -d /afs; then
5918                 afs=true
5919         else
5920                 afs=false
5921         fi
5922         ;;
5923 esac
5924 if $afs; then
5925         echo "AFS may be running... I'll be extra cautious then..." >&4
5926 else
5927         echo "AFS does not seem to be running..." >&4
5928 fi
5929
5930 : determine installation prefix for where package is to be installed.
5931 if $afs; then 
5932 $cat <<EOM
5933
5934 Since you are running AFS, I need to distinguish the directory in which
5935 files will reside from the directory in which they are installed (and from
5936 which they are presumably copied to the former directory by occult means).
5937
5938 EOM
5939         case "$installprefix" in
5940         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5941         *) dflt="$installprefix";;
5942         esac
5943 else
5944 $cat <<EOM
5945
5946 In some special cases, particularly when building $package for distribution,
5947 it is convenient to distinguish between the directory in which files should 
5948 be installed from the directory ($prefix) in which they 
5949 will eventually reside.  For most users, these two directories are the same.
5950
5951 EOM
5952         case "$installprefix" in
5953         '') dflt=$prefix ;;
5954         *) dflt=$installprefix;;
5955         esac
5956 fi
5957 fn=d~
5958 rp='What installation prefix should I use for installing files?'
5959 . ./getfile
5960 installprefix="$ans"
5961 installprefixexp="$ansexp"
5962
5963 : set the prefixit variable, to compute a suitable default value
5964 prefixit='case "$3" in
5965 ""|none)
5966         case "$oldprefix" in
5967         "") eval "$1=\"\$$2\"";;
5968         *)
5969                 case "$3" in
5970                 "") eval "$1=";;
5971                 none)
5972                         eval "tp=\"\$$2\"";
5973                         case "$tp" in
5974                         ""|" ") eval "$1=\"\$$2\"";;
5975                         *) eval "$1=";;
5976                         esac;;
5977                 esac;;
5978         esac;;
5979 *)
5980         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5981         case "$tp" in
5982         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5983         /*-$oldprefix/*|\~*-$oldprefix/*)
5984                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5985         *) eval "$1=\"\$$2\"";;
5986         esac;;
5987 esac'
5988
5989
5990 : get the patchlevel
5991 echo " "
5992 echo "Getting the current patchlevel..." >&4
5993 if $test -r $rsrc/patchlevel.h;then
5994         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5995         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5996         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5997         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5998         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5999         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6000 else
6001         revision=0
6002         patchlevel=0
6003         subversion=0
6004         api_revision=0
6005         api_version=0
6006         api_subversion=0
6007 fi
6008 $echo "(You have $package version $patchlevel subversion $subversion.)"
6009 case "$osname" in
6010 dos|vms)
6011         : XXX Should be a Configure test for double-dots in filenames.
6012         version=`echo $revision $patchlevel $subversion | \
6013                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6014         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6015                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6016         ;;
6017 *)
6018         version=`echo $revision $patchlevel $subversion | \
6019                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6020         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6021                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6022         ;;
6023 esac
6024 : Special case the 5.005_xx maintenance series, which used 5.005
6025 : without any subversion label as a subdirectory in $sitelib
6026 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6027         api_versionstring='5.005'
6028 fi
6029
6030 : determine installation style
6031 : For now, try to deduce it from prefix unless it is already set.
6032 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6033 case "$installstyle" in
6034 '')     case "$prefix" in
6035                 *perl*) dflt='lib';;
6036                 *) dflt='lib/perl5' ;;
6037         esac
6038         ;;
6039 *)      dflt="$installstyle" ;;
6040 esac
6041 : Probably not worth prompting for this since we prompt for all
6042 : the directories individually, and the prompt would be too long and
6043 : confusing anyway.
6044 installstyle=$dflt
6045
6046 : determine where private library files go
6047 : Usual default is /usr/local/lib/perl5/$version.
6048 : Also allow things like /opt/perl/lib/$version, since 
6049 : /opt/perl/lib/perl5... would be redundant.
6050 : The default "style" setting is made in installstyle.U
6051 case "$installstyle" in
6052 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6053 *)       set dflt privlib lib/$version ;;
6054 esac
6055 eval $prefixit
6056 $cat <<EOM
6057
6058 There are some auxiliary files for $package that need to be put into a
6059 private library directory that is accessible by everyone.
6060
6061 EOM
6062 fn=d~+
6063 rp='Pathname where the private library files will reside?'
6064 . ./getfile
6065 privlib="$ans"
6066 privlibexp="$ansexp"
6067 : Change installation prefix, if necessary.
6068 if $test X"$prefix" != X"$installprefix"; then
6069         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6070 else
6071         installprivlib="$privlibexp"
6072 fi
6073
6074 : set the prefixup variable, to restore leading tilda escape
6075 prefixup='case "$prefixexp" in
6076 "$prefix") ;;
6077 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6078 esac'
6079
6080 : determine where public architecture dependent libraries go
6081 set archlib archlib
6082 eval $prefixit
6083 : privlib default is /usr/local/lib/$package/$version
6084 : archlib default is /usr/local/lib/$package/$version/$archname
6085 : privlib may have an optional trailing /share.
6086 tdflt=`echo $privlib | $sed 's,/share$,,'`
6087 tdflt=$tdflt/$archname
6088 case "$archlib" in
6089 '')     dflt=$tdflt
6090         ;;
6091 *)      dflt="$archlib"
6092     ;;
6093 esac
6094 $cat <<EOM
6095
6096 $spackage contains architecture-dependent library files.  If you are
6097 sharing libraries in a heterogeneous environment, you might store
6098 these files in a separate location.  Otherwise, you can just include
6099 them with the rest of the public library files.
6100
6101 EOM
6102 fn=d+~
6103 rp='Where do you want to put the public architecture-dependent libraries?'
6104 . ./getfile
6105 archlib="$ans"
6106 archlibexp="$ansexp"
6107 if $test X"$archlib" = X"$privlib"; then
6108         d_archlib="$undef"
6109 else
6110         d_archlib="$define"
6111 fi
6112 : Change installation prefix, if necessary.
6113 if $test X"$prefix" != X"$installprefix"; then
6114         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6115 else
6116         installarchlib="$archlibexp"
6117 fi
6118
6119
6120 : Binary compatibility with 5.005 is not possible for builds
6121 : with advanced features
6122 case "$usethreads$usemultiplicity" in
6123 *define*)
6124         bincompat5005="$undef"
6125         d_bincompat5005="$undef"
6126         ;;
6127 *)      $cat <<EOM
6128
6129 This version of Perl can be compiled for binary compatibility with 5.005.
6130 If you decide to do so, you will be able to continue using most of the
6131 extensions that were compiled for Perl 5.005.
6132
6133 EOM
6134         case "$bincompat5005$d_bincompat5005" in
6135         *"$undef"*) dflt=n ;;
6136         *) dflt=y ;;
6137         esac
6138         rp='Binary compatibility with Perl 5.005?'
6139         . ./myread
6140         case "$ans" in
6141         y*) val="$define" ;;
6142         *)  val="$undef" ;;
6143         esac
6144         set d_bincompat5005
6145         eval $setvar
6146         case "$d_bincompat5005" in
6147         "$define")
6148                 bincompat5005="$define"
6149                 ;;
6150         *)      bincompat5005="$undef"
6151                 d_bincompat5005="$undef"
6152                 ;;
6153         esac
6154         ;;
6155 esac
6156
6157
6158 : see if setuid scripts can be secure
6159 $cat <<EOM
6160
6161 Some kernels have a bug that prevents setuid #! scripts from being
6162 secure.  Some sites have disabled setuid #! scripts because of this.
6163
6164 First let's decide if your kernel supports secure setuid #! scripts.
6165 (If setuid #! scripts would be secure but have been disabled anyway,
6166 don't say that they are secure if asked.)
6167
6168 EOM
6169
6170 val="$undef"
6171 if $test -d /dev/fd; then
6172         echo "#!$ls" >reflect
6173         chmod +x,u+s reflect
6174         ./reflect >flect 2>&1
6175         if $contains "/dev/fd" flect >/dev/null; then
6176                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6177                 val="$define"
6178         else
6179                 $cat <<EOM
6180 If you are not sure if they are secure, I can check but I'll need a
6181 username and password different from the one you are using right now.
6182 If you don't have such a username or don't want me to test, simply
6183 enter 'none'.
6184
6185 EOM
6186                 rp='Other username to test security of setuid scripts with?'
6187                 dflt='none'
6188                 . ./myread
6189                 case "$ans" in
6190                 n|none)
6191                         case "$d_suidsafe" in
6192                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6193                                 dflt=n;;
6194                         "$undef")
6195                                 echo "Well, the $hint value is *not* secure." >&4
6196                                 dflt=n;;
6197                         *)      echo "Well, the $hint value *is* secure." >&4
6198                                 dflt=y;;
6199                         esac
6200                         ;;
6201                 *)
6202                         $rm -f reflect flect
6203                         echo "#!$ls" >reflect
6204                         chmod +x,u+s reflect
6205                         echo >flect
6206                         chmod a+w flect
6207                         echo '"su" will (probably) prompt you for '"$ans's password."
6208                         su $ans -c './reflect >flect'
6209                         if $contains "/dev/fd" flect >/dev/null; then
6210                                 echo "Okay, it looks like setuid scripts are secure." >&4
6211                                 dflt=y
6212                         else
6213                                 echo "I don't think setuid scripts are secure." >&4
6214                                 dflt=n
6215                         fi
6216                         ;;
6217                 esac
6218                 rp='Does your kernel have *secure* setuid scripts?'
6219                 . ./myread
6220                 case "$ans" in
6221                 [yY]*)  val="$define";;
6222                 *)      val="$undef";;
6223                 esac
6224         fi
6225 else
6226         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6227         echo "(That's for file descriptors, not floppy disks.)"
6228         val="$undef"
6229 fi
6230 set d_suidsafe
6231 eval $setvar
6232
6233 $rm -f reflect flect
6234
6235 : now see if they want to do setuid emulation
6236 echo " "
6237 val="$undef"
6238 case "$d_suidsafe" in
6239 "$define")
6240         val="$undef"
6241         echo "No need to emulate SUID scripts since they are secure here." >& 4
6242         ;;
6243 *)
6244         $cat <<EOM
6245 Some systems have disabled setuid scripts, especially systems where
6246 setuid scripts cannot be secure.  On systems where setuid scripts have
6247 been disabled, the setuid/setgid bits on scripts are currently
6248 useless.  It is possible for $package to detect those bits and emulate
6249 setuid/setgid in a secure fashion.  This emulation will only work if
6250 setuid scripts have been disabled in your kernel.
6251
6252 EOM
6253         case "$d_dosuid" in
6254         "$define") dflt=y ;;
6255         *) dflt=n ;;
6256         esac
6257         rp="Do you want to do setuid/setgid emulation?"
6258         . ./myread
6259         case "$ans" in
6260         [yY]*)  val="$define";;
6261         *)      val="$undef";;
6262         esac
6263         ;;
6264 esac
6265 set d_dosuid
6266 eval $setvar
6267
6268 : see if this is a malloc.h system
6269 set malloc.h i_malloc
6270 eval $inhdr
6271
6272 : see if stdlib is available
6273 set stdlib.h i_stdlib
6274 eval $inhdr
6275
6276 : determine which malloc to compile in
6277 echo " "
6278 case "$usemymalloc" in
6279 ''|[yY]*|true|$define)  dflt='y' ;;
6280 *)      dflt='n' ;;
6281 esac
6282 case "$ptrsize" in
6283 4) ;;
6284 *) dflt='n' ;;
6285 esac
6286 rp="Do you wish to attempt to use the malloc that comes with $package?"
6287 . ./myread
6288 usemymalloc="$ans"
6289 case "$ans" in
6290 y*|true)
6291         usemymalloc='y'
6292         mallocsrc='malloc.c'
6293         mallocobj="malloc$_o"
6294         d_mymalloc="$define"
6295         case "$libs" in
6296         *-lmalloc*)
6297                 : Remove malloc from list of libraries to use
6298                 echo "Removing unneeded -lmalloc from library list" >&4
6299                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6300                 shift
6301                 libs="$*"
6302                 echo "libs = $libs" >&4
6303                 ;;
6304         esac
6305         ;;
6306 *)
6307         usemymalloc='n'
6308         mallocsrc=''
6309         mallocobj=''
6310         d_mymalloc="$undef"
6311         ;;
6312 esac
6313
6314 : compute the return types of malloc and free
6315 echo " "
6316 $cat >malloc.c <<END
6317 #$i_malloc I_MALLOC
6318 #$i_stdlib I_STDLIB
6319 #include <stdio.h>
6320 #include <sys/types.h>
6321 #ifdef I_MALLOC
6322 #include <malloc.h>
6323 #endif
6324 #ifdef I_STDLIB
6325 #include <stdlib.h>
6326 #endif
6327 #ifdef TRY_MALLOC
6328 void *malloc();
6329 #endif
6330 #ifdef TRY_FREE
6331 void free();
6332 #endif
6333 END
6334 case "$malloctype" in
6335 '')
6336         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6337                 malloctype='void *'
6338         else
6339                 malloctype='char *'
6340         fi
6341         ;;
6342 esac
6343 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6344
6345 case "$freetype" in
6346 '')
6347         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6348                 freetype='void'
6349         else
6350                 freetype='int'
6351         fi
6352         ;;
6353 esac
6354 echo "Your system uses $freetype free(), it would seem." >&4
6355 $rm -f malloc.[co]
6356 $cat <<EOM
6357
6358 After $package is installed, you may wish to install various
6359 add-on modules and utilities.  Typically, these add-ons will
6360 be installed under $prefix with the rest
6361 of this package.  However, you may wish to install such add-ons
6362 elsewhere under a different prefix.
6363
6364 If you do not wish to put everything under a single prefix, that's
6365 ok.  You will be prompted for the individual locations; this siteprefix
6366 is only used to suggest the defaults.
6367
6368 The default should be fine for most people.
6369
6370 EOM
6371 fn=d~+
6372 rp='Installation prefix to use for add-on modules and utilities?'
6373 : XXX Here might be another good place for an installstyle setting.
6374 case "$siteprefix" in
6375 '') dflt=$prefix ;;
6376 *)  dflt=$siteprefix ;;
6377 esac
6378 . ./getfile
6379 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6380 oldsiteprefix=''
6381 case "$siteprefix" in
6382 '') ;;
6383 *)      case "$ans" in
6384         "$prefix") ;;
6385         *) oldsiteprefix="$prefix";;
6386         esac
6387         ;;
6388 esac
6389 siteprefix="$ans"
6390 siteprefixexp="$ansexp"
6391
6392 : determine where site specific libraries go.
6393 : Usual default is /usr/local/lib/perl5/site_perl/$version
6394 : The default "style" setting is made in installstyle.U
6395 : XXX No longer works with Prefixit stuff.
6396 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6397 case "$sitelib" in
6398 '') case "$installstyle" in
6399         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6400         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6401         esac
6402         ;;
6403 *)      dflt="$sitelib"
6404         ;;
6405 esac
6406 $cat <<EOM
6407
6408 The installation process will create a directory for
6409 site-specific extensions and modules.  Most users find it convenient
6410 to place all site-specific files in this directory rather than in the
6411 main distribution directory.
6412
6413 EOM
6414 fn=d~+
6415 rp='Pathname for the site-specific library files?'
6416 . ./getfile
6417 sitelib="$ans"
6418 sitelibexp="$ansexp"
6419 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6420 : Change installation prefix, if necessary.
6421 if $test X"$prefix" != X"$installprefix"; then
6422         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6423 else
6424         installsitelib="$sitelibexp"
6425 fi
6426
6427 : determine where site specific architecture-dependent libraries go.
6428 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6429 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6430 : sitelib may have an optional trailing /share.
6431 case "$sitearch" in
6432 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6433         dflt="$dflt/$archname"
6434         ;;
6435 *)      dflt="$sitearch"
6436         ;;
6437 esac
6438 set sitearch sitearch none
6439 eval $prefixit
6440 $cat <<EOM
6441
6442 The installation process will also create a directory for
6443 architecture-dependent site-specific extensions and modules.
6444
6445 EOM
6446 fn=d~+
6447 rp='Pathname for the site-specific architecture-dependent library files?'
6448 . ./getfile
6449 sitearch="$ans"
6450 sitearchexp="$ansexp"
6451 : Change installation prefix, if necessary.
6452 if $test X"$prefix" != X"$installprefix"; then
6453         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6454 else
6455         installsitearch="$sitearchexp"
6456 fi
6457
6458 $cat <<EOM
6459
6460 The installation process will also create a directory for
6461 vendor-supplied add-ons.  Vendors who supply perl with their system
6462 may find it convenient to place all vendor-supplied files in this
6463 directory rather than in the main distribution directory.  This will
6464 ease upgrades between binary-compatible maintenance versions of perl.
6465
6466 Of course you may also use these directories in whatever way you see
6467 fit.  For example, you might use them to access modules shared over a
6468 company-wide network.
6469
6470 The default answer should be fine for most people.
6471 This causes further questions about vendor add-ons to be skipped
6472 and no vendor-specific directories will be configured for perl.
6473
6474 EOM
6475 rp='Do you want to configure vendor-specific add-on directories?'
6476 case "$usevendorprefix" in
6477 define|true|[yY]*) dflt=y ;;
6478 *)      : User may have set vendorprefix directly on Configure command line.
6479         case "$vendorprefix" in
6480         ''|' ') dflt=n ;;
6481         *)      dflt=y ;;
6482         esac
6483         ;;
6484 esac
6485 . ./myread
6486 case "$ans" in
6487 [yY]*)  fn=d~+
6488         rp='Installation prefix to use for vendor-supplied add-ons?'
6489         case "$vendorprefix" in
6490         '') dflt='' ;;
6491         *)  dflt=$vendorprefix ;;
6492         esac
6493         . ./getfile
6494         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6495         oldvendorprefix=''
6496         case "$vendorprefix" in
6497         '') ;;
6498         *)      case "$ans" in
6499                 "$prefix") ;;
6500                 *) oldvendorprefix="$prefix";;
6501                 esac
6502                 ;;
6503         esac
6504         usevendorprefix="$define"
6505         vendorprefix="$ans"
6506         vendorprefixexp="$ansexp"
6507         ;;
6508 *)      usevendorprefix="$undef"
6509         vendorprefix=''
6510         vendorprefixexp=''
6511         ;;
6512 esac
6513
6514 case "$vendorprefix" in
6515 '')     d_vendorlib="$undef"
6516         vendorlib=''
6517         vendorlibexp=''
6518         ;;
6519 *)      d_vendorlib="$define"
6520         : determine where vendor-supplied modules go.
6521         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6522         case "$vendorlib" in
6523         '')
6524                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6525                 case "$installstyle" in
6526                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6527                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6528                 esac
6529                 ;;
6530         *)      dflt="$vendorlib"
6531                 ;;
6532         esac
6533         fn=d~+
6534         rp='Pathname for the vendor-supplied library files?'
6535         . ./getfile
6536         vendorlib="$ans"
6537         vendorlibexp="$ansexp"
6538         ;;
6539 esac
6540 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6541 : Change installation prefix, if necessary.
6542 if $test X"$prefix" != X"$installprefix"; then
6543         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6544 else
6545         installvendorlib="$vendorlibexp"
6546 fi
6547
6548 case "$vendorprefix" in
6549 '')     d_vendorarch="$undef"
6550         vendorarch=''
6551         vendorarchexp=''
6552         ;;
6553 *)      d_vendorarch="$define"
6554         : determine where vendor-supplied architecture-dependent libraries go.
6555         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6556         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6557         : vendorlib may have an optional trailing /share.
6558         case "$vendorarch" in
6559         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6560                 dflt="$dflt/$archname"
6561                 ;;
6562         *)      dflt="$vendorarch" ;;
6563         esac
6564         fn=d~+
6565         rp='Pathname for vendor-supplied architecture-dependent files?'
6566         . ./getfile
6567         vendorarch="$ans"
6568         vendorarchexp="$ansexp"
6569         ;;
6570 esac
6571 : Change installation prefix, if necessary.
6572 if $test X"$prefix" != X"$installprefix"; then
6573         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6574 else
6575         installvendorarch="$vendorarchexp"
6576 fi
6577
6578 : Final catch-all directories to search
6579 $cat <<EOM
6580
6581 Lastly, you can have perl look in other directories for extensions and
6582 modules in addition to those already specified.
6583 These directories will be searched after 
6584         $sitearch 
6585         $sitelib 
6586 EOM
6587 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6588 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6589 echo ' '
6590 case "$otherlibdirs" in
6591 ''|' ') dflt='none' ;;
6592 *)      dflt="$otherlibdirs" ;;
6593 esac
6594 $cat <<EOM
6595 Enter a colon-separated set of extra paths to include in perl's @INC
6596 search path, or enter 'none' for no extra paths.
6597
6598 EOM
6599
6600 rp='Colon-separated list of additional directories for perl to search?'
6601 . ./myread
6602 case "$ans" in
6603 ' '|''|none)    otherlibdirs=' ' ;;     
6604 *)      otherlibdirs="$ans" ;;
6605 esac
6606 case "$otherlibdirs" in
6607 ' ') val=$undef ;;
6608 *)      val=$define ;;
6609 esac
6610 set d_perl_otherlibdirs
6611 eval $setvar
6612
6613 : Cruising for prototypes
6614 echo " "
6615 echo "Checking out function prototypes..." >&4
6616 $cat >prototype.c <<'EOCP'
6617 int main(int argc, char *argv[]) {
6618         exit(0);}
6619 EOCP
6620 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6621         echo "Your C compiler appears to support function prototypes."
6622         val="$define"
6623 else
6624         echo "Your C compiler doesn't seem to understand function prototypes."
6625         val="$undef"
6626 fi
6627 set prototype
6628 eval $setvar
6629 $rm -f prototype*
6630
6631 case "$prototype" in
6632 "$define") ;;
6633 *)      ansi2knr='ansi2knr'
6634         echo " "
6635         cat <<EOM >&4
6636
6637 $me:  FATAL ERROR:
6638 This version of $package can only be compiled by a compiler that 
6639 understands function prototypes.  Unfortunately, your C compiler 
6640         $cc $ccflags
6641 doesn't seem to understand them.  Sorry about that.
6642
6643 If GNU cc is available for your system, perhaps you could try that instead.  
6644
6645 Eventually, we hope to support building Perl with pre-ANSI compilers.
6646 If you would like to help in that effort, please contact <perlbug@perl.org>.
6647
6648 Aborting Configure now.
6649 EOM
6650         exit 2
6651         ;;
6652 esac
6653
6654 : determine where public executables go
6655 echo " "
6656 set dflt bin bin
6657 eval $prefixit
6658 fn=d~
6659 rp='Pathname where the public executables will reside?'
6660 . ./getfile
6661 if $test "X$ansexp" != "X$binexp"; then
6662         installbin=''
6663 fi
6664 bin="$ans"
6665 binexp="$ansexp"
6666 : Change installation prefix, if necessary.
6667 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6668 if $test X"$prefix" != X"$installprefix"; then
6669         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6670 else
6671         installbin="$binexp"
6672 fi
6673
6674 : Find perl5.005 or later.
6675 echo "Looking for a previously installed perl5.005 or later... "
6676 case "$perl5" in
6677 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6678                 : Check if this perl is recent and can load a simple module
6679                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6680                         perl5=$tdir/perl
6681                         break;
6682                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6683                         perl5=$tdir/perl
6684                         break;
6685                 fi
6686         done
6687         ;;
6688 *)      perl5="$perl5"
6689         ;;
6690 esac
6691 case "$perl5" in
6692 '')     echo "None found.  That's ok.";;
6693 *)      echo "Using $perl5." ;;
6694 esac
6695
6696 : Determine list of previous versions to include in @INC
6697 $cat > getverlist <<EOPL
6698 #!$perl5 -w
6699 use File::Basename;
6700 \$api_versionstring = "$api_versionstring";
6701 \$version = "$version";
6702 \$stem = "$sitelib_stem";
6703 \$archname = "$archname";
6704 EOPL
6705         $cat >> getverlist <<'EOPL'
6706 # Can't have leading @ because metaconfig interprets it as a command!
6707 ;@inc_version_list=();
6708 # XXX Redo to do opendir/readdir? 
6709 if (-d $stem) {
6710     chdir($stem);
6711     ;@candidates = glob("5.*");
6712 }
6713 else {
6714     ;@candidates = ();
6715 }
6716
6717 # XXX ToDo:  These comparisons must be reworked when two-digit
6718 # subversions come along, so that 5.7.10 compares as greater than
6719 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6720 # widespread that we can use the built-in version vectors rather
6721 # than reinventing them here.  For 5.6.0, however, we must
6722 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6723 foreach $d (@candidates) {
6724     if ($d lt $version) {
6725         if ($d ge $api_versionstring) {
6726             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6727         }
6728         elsif ($d ge "5.005") {
6729             unshift(@inc_version_list, grep { -d } $d);
6730         }
6731     }
6732     else {
6733         # Skip newer version.  I.e. don't look in
6734         # 5.7.0 if we're installing 5.6.1.
6735     }
6736 }
6737
6738 if (@inc_version_list) {
6739     print join(' ', @inc_version_list);
6740 }
6741 else {
6742     # Blank space to preserve value for next Configure run.
6743     print " ";
6744 }
6745 EOPL
6746 chmod +x getverlist
6747 case "$inc_version_list" in
6748 '')     if test -x "$perl5"; then
6749                 dflt=`$perl5 getverlist`
6750         else
6751                 dflt='none'
6752         fi
6753         ;;
6754 $undef) dflt='none' ;;
6755 *)  dflt="$inc_version_list" ;;
6756 esac
6757 case "$dflt" in
6758 ''|' ') dflt=none ;;
6759 esac
6760 case "$dflt" in
6761 5.005) case "$bincompat5005" in
6762        $define|true|[yY]*) ;;
6763        *) dflt=none ;;
6764        esac
6765        ;;
6766 esac
6767 $cat <<'EOM'
6768
6769 In order to ease the process of upgrading, this version of perl 
6770 can be configured to use modules built and installed with earlier 
6771 versions of perl that were installed under $prefix.  Specify here
6772 the list of earlier versions that this version of perl should check.
6773 If Configure detected no earlier versions of perl installed under
6774 $prefix, then the list will be empty.  Answer 'none' to tell perl
6775 to not search earlier versions.
6776
6777 The default should almost always be sensible, so if you're not sure,
6778 just accept the default.
6779 EOM
6780
6781 rp='List of earlier versions to include in @INC?'
6782 . ./myread
6783 case "$ans" in
6784 [Nn]one|''|' ') inc_version_list=' ' ;;
6785 *) inc_version_list="$ans" ;;
6786 esac
6787 case "$inc_version_list" in
6788 ''|' ') 
6789         inc_version_list_init='0';;
6790 *)      inc_version_list_init=`echo $inc_version_list |
6791                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6792         ;;
6793 esac
6794 $rm -f getverlist
6795
6796 : determine whether to install perl also as /usr/bin/perl
6797
6798 echo " "
6799 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6800         $cat <<EOM
6801 Many scripts expect perl to be installed as /usr/bin/perl.
6802 I can install the perl you are about to compile also as /usr/bin/perl
6803 (in addition to $installbin/perl).
6804 EOM
6805         case "$installusrbinperl" in
6806         "$undef"|[nN]*) dflt='n';;
6807         *)              dflt='y';;
6808         esac
6809         rp="Do you want to install perl as /usr/bin/perl?"
6810         . ./myread
6811         case "$ans" in
6812         [yY]*)  val="$define";;
6813         *)      val="$undef" ;;
6814         esac
6815 else
6816         val="$undef"
6817 fi
6818 set installusrbinperl
6819 eval $setvar
6820
6821 : see if dld is available
6822 set dld.h i_dld
6823 eval $inhdr
6824
6825 : see if dlopen exists
6826 xxx_runnm="$runnm"
6827 runnm=false
6828 set dlopen d_dlopen
6829 eval $inlibc
6830 runnm="$xxx_runnm"
6831
6832 : determine which dynamic loading, if any, to compile in
6833 echo " "
6834 dldir="ext/DynaLoader"
6835 case "$usedl" in
6836 $define|y|true)
6837         dflt='y'
6838         usedl="$define"
6839         ;;
6840 $undef|n|false)
6841         dflt='n'
6842         usedl="$undef"
6843         ;;
6844 *) 
6845         dflt='n'
6846         case "$d_dlopen" in
6847             $define) dflt='y' ;;
6848         esac
6849         case "$i_dld" in
6850             $define) dflt='y' ;;
6851         esac
6852         : Does a dl_xxx.xs file exist for this operating system
6853         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6854         ;;
6855 esac
6856 rp="Do you wish to use dynamic loading?"
6857 . ./myread
6858 usedl="$ans"
6859 case "$ans" in
6860 y*) usedl="$define"
6861         case "$dlsrc" in
6862         '')
6863                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6864                         dflt="$dldir/dl_${osname}.xs"
6865                 elif $test "$d_dlopen" = "$define" ; then
6866                         dflt="$dldir/dl_dlopen.xs"
6867                 elif $test "$i_dld" = "$define" ; then
6868                         dflt="$dldir/dl_dld.xs"
6869                 else
6870                         dflt=''
6871                 fi
6872                 ;;
6873         *)      dflt="$dldir/$dlsrc"
6874                 ;;
6875         esac
6876     echo "The following dynamic loading files are available:"
6877         : Can not go over to $dldir because getfile has path hard-coded in.
6878         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6879         rp="Source file to use for dynamic loading"
6880         fn="fne"
6881         gfpth="$src"
6882         . ./getfile
6883         usedl="$define"
6884         : emulate basename
6885         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6886
6887         $cat << EOM
6888
6889 Some systems may require passing special flags to $cc -c to
6890 compile modules that will be used to create a shared library.
6891 To use no flags, say "none".
6892
6893 EOM
6894     case "$cccdlflags" in
6895     '') case "$gccversion" in
6896                 '') case "$osname" in
6897                         hpux)   dflt='+z' ;;
6898                         next)   dflt='none' ;;
6899                         irix*)  dflt='-KPIC' ;;
6900                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6901                         sunos)  dflt='-pic' ;;
6902                         *)      dflt='none' ;;
6903                     esac
6904                         ;;
6905                 *)  case "$osname" in
6906                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6907                         *)      dflt='-fpic' ;;
6908                     esac ;;
6909             esac ;;
6910         ' ') dflt='none' ;;
6911     *)  dflt="$cccdlflags" ;;
6912     esac
6913     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6914     . ./myread
6915     case "$ans" in
6916     none) cccdlflags=' ' ;;
6917     *) cccdlflags="$ans" ;;
6918     esac
6919
6920     cat << EOM
6921
6922 Some systems use ld to create libraries that can be dynamically loaded,
6923 while other systems (such as those using ELF) use $cc.
6924
6925 EOM
6926         case "$ld" in
6927         '')     $cat >try.c <<'EOM'
6928 /* Test for whether ELF binaries are produced */
6929 #include <fcntl.h>
6930 #include <stdlib.h>
6931 int main() {
6932         char b[4];
6933         int i = open("a.out",O_RDONLY);
6934         if(i == -1) 
6935                 exit(1); /* fail */
6936         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6937                 exit(0); /* succeed (yes, it's ELF) */
6938         else
6939                 exit(1); /* fail */
6940 }
6941 EOM
6942                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6943                         cat <<EOM
6944 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6945 EOM
6946                         dflt="$cc"
6947                 else
6948                         echo "I'll use ld to build dynamic libraries."
6949                         dflt='ld'
6950                 fi
6951                 rm -f try.c a.out
6952                 ;;
6953         *)      dflt="$ld"
6954                 ;;
6955         esac
6956
6957     rp="What command should be used to create dynamic libraries?"
6958     . ./myread
6959         ld="$ans"
6960
6961     cat << EOM
6962
6963 Some systems may require passing special flags to $ld to create a
6964 library that can be dynamically loaded.  If your ld flags include
6965 -L/other/path options to locate libraries outside your loader's normal
6966 search path, you may need to specify those -L options here as well.  To
6967 use no flags, say "none".
6968
6969 EOM
6970     case "$lddlflags" in
6971     '') case "$osname" in
6972                         beos) dflt='-nostart' ;;
6973                         hpux) dflt='-b';
6974                               case "$gccversion" in
6975                               '') dflt="$dflt +vnocompatwarnings" ;;
6976                               esac
6977                               ;;        
6978                         linux|irix*)    dflt='-shared' ;;
6979                         next)  dflt='none' ;;
6980                         solaris) dflt='-G' ;;
6981                         sunos) dflt='-assert nodefinitions' ;;
6982                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6983                 *)     dflt='none' ;;
6984                         esac
6985                         ;;
6986     *) dflt="$lddlflags" ;;
6987     esac
6988
6989         : Try to guess additional flags to pick up local libraries.
6990         : Be careful not to append to a plain 'none'
6991         case "$dflt" in
6992         none) dflt='' ;;
6993         esac
6994         for thisflag in $ldflags; do
6995                 case "$thisflag" in
6996                 -L*|-R*)
6997                         case " $dflt " in
6998                         *" $thisflag "*) ;;
6999                         *) dflt="$dflt $thisflag" ;;
7000                         esac
7001                         ;;
7002                 esac
7003         done
7004
7005         case "$dflt" in
7006         ''|' ') dflt='none' ;;
7007         esac
7008
7009     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7010     . ./myread
7011     case "$ans" in
7012     none) lddlflags=' ' ;;
7013     *) lddlflags="$ans" ;;
7014     esac
7015
7016         cat <<EOM
7017
7018 Some systems may require passing special flags to $cc to indicate that
7019 the resulting executable will use dynamic linking.  To use no flags,
7020 say "none".
7021
7022 EOM
7023     case "$ccdlflags" in
7024     '') case "$osname" in
7025                 hpux)   dflt='-Wl,-E' ;;
7026                 linux)  dflt='-rdynamic' ;;
7027                 next)   dflt='none' ;;
7028                 sunos)  dflt='none' ;;
7029                 *)      dflt='none' ;;
7030             esac ;;
7031     ' ')  dflt='none' ;;
7032     *)  dflt="$ccdlflags" ;;
7033     esac
7034     rp="Any special flags to pass to $cc to use dynamic linking?"
7035     . ./myread
7036     case "$ans" in
7037     none) ccdlflags=' ' ;;
7038     *) ccdlflags="$ans" ;;
7039     esac
7040     ;;
7041 *)  usedl="$undef"
7042         ld='ld'
7043     dlsrc='dl_none.xs'
7044     lddlflags=''
7045     ccdlflags=''
7046     ;;
7047 esac
7048
7049 also=''
7050 case "$usedl" in
7051 $undef)
7052         # No dynamic loading being used, so don't bother even to prompt.
7053         useshrplib='false'
7054         ;;
7055 *)      case "$useshrplib" in
7056         '')     case "$osname" in
7057                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7058                         dflt=y
7059                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7060                         ;;
7061                 next*)
7062                         case "$osvers" in
7063                         4*)     dflt=y
7064                                 also='Building a shared libperl is needed for MAB support.'
7065                                 ;;
7066                         *)      dflt=n
7067                                 ;;
7068                         esac
7069                         ;;
7070                 *)      dflt=n
7071                         ;;
7072                 esac
7073                 ;;
7074         $define|true|[Yy]*)
7075                 dflt=y
7076                 ;;
7077         *)      dflt=n
7078                 ;;
7079         esac
7080         $cat << EOM
7081
7082 The perl executable is normally obtained by linking perlmain.c with
7083 libperl${_a}, any static extensions (usually just DynaLoader), and
7084 any other libraries needed on this system (such as -lm, etc.).  Since
7085 your system supports dynamic loading, it is probably possible to build
7086 a shared libperl.$so.  If you will have more than one executable linked
7087 to libperl.$so, this will significantly reduce the size of each
7088 executable, but it may have a noticeable affect on performance.  The
7089 default is probably sensible for your system.
7090 $also
7091
7092 EOM
7093         rp="Build a shared libperl.$so (y/n)"
7094         . ./myread
7095         case "$ans" in
7096         true|$define|[Yy]*)
7097                 useshrplib='true'  ;;
7098         *)      useshrplib='false' ;;
7099         esac
7100         ;;
7101 esac
7102
7103 case "$useshrplib" in
7104 true)
7105         case "$libperl" in
7106         '')
7107                 # Figure out a good name for libperl.so.  Since it gets stored in
7108                 # a version-specific architecture-dependent library, the version
7109                 # number isn't really that important, except for making cc/ld happy.
7110                 #
7111                 # A name such as libperl.so.3.1
7112                 majmin="libperl.$so.$patchlevel.$subversion"
7113                 # A name such as libperl.so.301
7114                 majonly=`echo $patchlevel $subversion |
7115                         $awk '{printf "%d%02d", $1, $2}'`
7116                 majonly=libperl.$so.$majonly
7117                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7118                 # rely on figuring it out from the naming of libc.
7119                 case "${osname}${osvers}" in
7120                 next4*)
7121                         dflt=libperl.5.$so
7122                         # XXX How handle the --version stuff for MAB?
7123                         ;;
7124                 linux*)  # ld won't link with a bare -lperl otherwise.
7125                         dflt=libperl.$so
7126                         ;;
7127                 cygwin*) # include version
7128                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7129                         ;;
7130                 *)      # Try to guess based on whether libc has major.minor.
7131                         case "$libc" in
7132                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7133                         *libc.$so.[0-9]*) dflt=$majonly ;;
7134                         *)      dflt=libperl.$so ;;
7135                         esac
7136                         ;;
7137                 esac
7138                 ;;
7139         *)      dflt=$libperl
7140                 ;;
7141         esac
7142         cat << EOM
7143
7144 I need to select a good name for the shared libperl.  If your system uses
7145 library names with major and minor numbers, then you might want something
7146 like $majmin.  Alternatively, if your system uses a single version
7147 number for shared libraries, then you might want to use $majonly.
7148 Or, your system might be quite happy with a simple libperl.$so.
7149
7150 Since the shared libperl will get installed into a version-specific
7151 architecture-dependent directory, the version number of the shared perl
7152 library probably isn't important, so the default should be o.k.
7153
7154 EOM
7155         rp='What name do you want to give to the shared libperl?'
7156         . ./myread
7157         libperl=$ans
7158         echo "Ok, I'll use $libperl"
7159         ;;
7160 *)
7161         libperl="libperl${_a}"
7162         ;;
7163 esac
7164
7165 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7166 case "$shrpdir" in
7167 '') ;;
7168 *)      $cat >&4 <<EOM
7169 WARNING:  Use of the shrpdir variable for the installation location of
7170 the shared $libperl is not supported.  It was never documented and
7171 will not work in this version.  Let me (perlbug@perl.org)
7172 know of any problems this may cause.
7173
7174 EOM
7175         case "$shrpdir" in
7176         "$archlibexp/CORE")
7177                 $cat >&4 <<EOM
7178 But your current setting of $shrpdir is
7179 the default anyway, so it's harmless.
7180 EOM
7181                 ;;
7182         *)
7183                 $cat >&4 <<EOM
7184 Further, your current attempted setting of $shrpdir
7185 conflicts with the value of $archlibexp/CORE
7186 that installperl will use.
7187 EOM
7188                 ;;
7189         esac
7190         ;;
7191 esac
7192
7193 # How will the perl executable find the installed shared $libperl?
7194 # Add $xxx to ccdlflags.
7195 # If we can't figure out a command-line option, use $shrpenv to
7196 # set env LD_RUN_PATH.  The main perl makefile uses this.
7197 shrpdir=$archlibexp/CORE
7198 xxx=''
7199 tmp_shrpenv=''
7200 if "$useshrplib"; then
7201     case "$osname" in 
7202         aix)
7203                 # We'll set it in Makefile.SH...
7204                 ;;
7205         solaris|netbsd)
7206                 xxx="-R $shrpdir"
7207                 ;;
7208         freebsd)
7209                 xxx="-Wl,-R$shrpdir"
7210                 ;;
7211         linux|irix*|dec_osf)
7212                 xxx="-Wl,-rpath,$shrpdir"
7213                 ;;
7214         next)
7215                 # next doesn't like the default...
7216                 ;;
7217         beos)
7218                 # beos doesn't like the default, either.
7219                 ;;
7220         hpux*)
7221                 # hpux doesn't like the default, either.
7222                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7223                 ;;
7224         *)
7225                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7226                 ;;
7227         esac
7228         case "$xxx" in
7229         '') ;;
7230         *)      
7231                 # Only add $xxx if it isn't already in ccdlflags.
7232                 case " $ccdlflags " in
7233                 *" $xxx "*)     ;;
7234                 *)      ccdlflags="$ccdlflags $xxx"
7235                         cat <<EOM >&4
7236
7237 Adding $xxx to the flags
7238 passed to $ld so that the perl executable will find the 
7239 installed shared $libperl.
7240
7241 EOM
7242                         ;;
7243                 esac
7244                 ;;
7245         esac
7246 fi
7247 # Fix ccdlflags in AIX for building external extensions.
7248 # (For building Perl itself bare -bE:perl.exp is needed,
7249 #  Makefile.SH takes care of this.)
7250 case "$osname" in
7251 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7252 esac
7253 # Respect a hint or command-line value.
7254 case "$shrpenv" in
7255 '') shrpenv="$tmp_shrpenv" ;;
7256 esac
7257 case "$ldlibpthname" in
7258 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7259 none)   ldlibpthname='' ;;
7260 esac
7261
7262 : determine where manual pages are on this system
7263 echo " "
7264 case "$sysman" in
7265 '') 
7266         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7267         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7268         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7269         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7270         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7271         sysman=`./loc . /usr/man/man1 $syspath`
7272         ;;
7273 esac
7274 if $test -d "$sysman"; then
7275         echo "System manual is in $sysman." >&4
7276 else
7277         echo "Could not find manual pages in source form." >&4
7278 fi
7279
7280 : determine where manual pages go
7281 set man1dir man1dir none
7282 eval $prefixit
7283 $cat <<EOM
7284
7285 $spackage has manual pages available in source form.
7286 EOM
7287 case "$nroff" in
7288 nroff)
7289         echo "However, you don't have nroff, so they're probably useless to you."
7290         case "$man1dir" in
7291         '') man1dir="none";;
7292         esac;;
7293 esac
7294 echo "If you don't want the manual sources installed, answer 'none'."
7295 case "$man1dir" in
7296 ' ') dflt=none
7297         ;;
7298 '')
7299         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7300         lookpath="$lookpath $prefixexp/man/p_man/man1"
7301         lookpath="$lookpath $prefixexp/man/u_man/man1"
7302         lookpath="$lookpath $prefixexp/man/man.1"
7303         case "$sysman" in
7304         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7305         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7306         esac
7307         set dflt
7308         eval $prefixup
7309         ;;
7310 *)  dflt="$man1dir"
7311         ;;
7312 esac
7313 echo " "
7314 fn=dn+~
7315 rp="Where do the main $spackage manual pages (source) go?"
7316 . ./getfile
7317 if $test "X$man1direxp" != "X$ansexp"; then
7318         installman1dir=''
7319 fi
7320 man1dir="$ans"
7321 man1direxp="$ansexp"
7322 case "$man1dir" in
7323 '')     man1dir=' '
7324         installman1dir='';;
7325 esac
7326
7327 : Change installation prefix, if necessary.
7328 if $test X"$prefix" != X"$installprefix"; then
7329         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7330 else
7331         installman1dir="$man1direxp"
7332 fi
7333
7334 : What suffix to use on installed man pages
7335
7336 case "$man1dir" in
7337 ' ')
7338         man1ext='0'
7339         ;;
7340 *)
7341         rp="What suffix should be used for the main $spackage man pages?"
7342         case "$man1ext" in
7343         '')     case "$man1dir" in
7344                 *1)  dflt=1 ;;
7345                 *1p) dflt=1p ;;
7346                 *1pm) dflt=1pm ;;
7347                 *l) dflt=l;;
7348                 *n) dflt=n;;
7349                 *o) dflt=o;;
7350                 *p) dflt=p;;
7351                 *C) dflt=C;;
7352                 *L) dflt=L;;
7353                 *L1) dflt=L1;;
7354                 *) dflt=1;;
7355                 esac
7356                 ;;
7357         *)      dflt="$man1ext";;
7358         esac
7359         . ./myread
7360         man1ext="$ans"
7361         ;;
7362 esac
7363
7364 : see if we can have long filenames
7365 echo " "
7366 first=123456789abcdef
7367 $rm -f $first
7368 if (echo hi >$first) 2>/dev/null; then
7369         if $test -f 123456789abcde; then
7370                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7371                 val="$undef"
7372         else
7373                 echo 'You can have filenames longer than 14 characters.'>&4
7374                 val="$define"
7375         fi
7376 else
7377         $cat <<'EOM'
7378 You can't have filenames longer than 14 chars.
7379 You can't even think about them!
7380 EOM
7381         val="$undef"
7382 fi 
7383 set d_flexfnam
7384 eval $setvar
7385 $rm -rf 123456789abcde*
7386
7387 : determine where library module manual pages go
7388 set man3dir man3dir none
7389 eval $prefixit
7390 $cat <<EOM
7391
7392 $spackage has manual pages for many of the library modules.
7393 EOM
7394
7395 case "$nroff" in
7396 nroff)
7397         $cat <<'EOM'
7398 However, you don't have nroff, so they're probably useless to you.
7399 EOM
7400         case "$man3dir" in
7401         '') man3dir="none";;
7402         esac;;
7403 esac
7404
7405 case "$d_flexfnam" in
7406 undef)
7407         $cat <<'EOM'
7408 However, your system can't handle the long file names like File::Basename.3. 
7409 EOM
7410         case "$man3dir" in
7411         '') man3dir="none";;
7412         esac;;
7413 esac
7414
7415 echo "If you don't want the manual sources installed, answer 'none'."
7416 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7417 case "$man3dir" in
7418 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7419         if $test -d "$privlib/man/man3"; then
7420                 cat <<EOM >&4
7421
7422 WARNING:  Previous versions of perl installed man3 pages into
7423 $privlib/man/man3.  This version will suggest a 
7424 new default of $dflt.  
7425 EOM
7426                 tdflt=$dflt
7427                 dflt='n'
7428                 rp='Do you wish to preserve the old behavior?(y/n)'
7429                 . ./myread
7430                 case "$ans" in
7431                 y*) dflt="$privlib/man/man3" ;;
7432                 *)  dflt=$tdflt ;;
7433                 esac
7434     fi
7435         ;;
7436 *)      dflt="$man3dir" ;;
7437 esac
7438 case "$dflt" in
7439 ' ') dflt=none ;;
7440 esac
7441 echo " "
7442 fn=dn+~
7443 rp="Where do the $package library man pages (source) go?"
7444 . ./getfile
7445 man3dir="$ans"
7446 man3direxp="$ansexp"
7447 case "$man3dir" in
7448 '')     man3dir=' '
7449         installman3dir='';;
7450 esac
7451
7452 : Change installation prefix, if necessary.
7453 if $test X"$prefix" != X"$installprefix"; then
7454         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7455 else
7456         installman3dir="$man3direxp"
7457 fi
7458
7459 : What suffix to use on installed man pages
7460 case "$man3dir" in
7461 ' ')
7462         man3ext='0'
7463         ;;
7464 *)
7465         rp="What suffix should be used for the $package library man pages?"
7466         case "$man3ext" in
7467         '')     case "$man3dir" in
7468                 *3)  dflt=3 ;;
7469                 *3p) dflt=3p ;;
7470                 *3pm) dflt=3pm ;;
7471                 *l) dflt=l;;
7472                 *n) dflt=n;;
7473                 *o) dflt=o;;
7474                 *p) dflt=p;;
7475                 *C) dflt=C;;
7476                 *L) dflt=L;;
7477                 *L3) dflt=L3;;
7478                 *) dflt=3;;
7479                 esac
7480                 ;;
7481         *)      dflt="$man3ext";;
7482         esac
7483         . ./myread
7484         man3ext="$ans"
7485         ;;
7486 esac
7487
7488 : see if we have to deal with yellow pages, now NIS.
7489 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7490         if $test -f /usr/etc/nibindd; then
7491                 echo " "
7492                 echo "I'm fairly confident you're on a NeXT."
7493                 echo " "
7494                 rp='Do you get the hosts file via NetInfo?'
7495                 dflt=y
7496                 case "$hostcat" in
7497                 nidump*) ;;
7498                 '') ;;
7499                 *) dflt=n;;
7500                 esac
7501                 . ./myread
7502                 case "$ans" in
7503                 y*) hostcat='nidump hosts .';;
7504                 *)      case "$hostcat" in
7505                         nidump*) hostcat='';;
7506                         esac
7507                         ;;
7508                 esac
7509         fi
7510         case "$hostcat" in
7511         nidump*) ;;
7512         *)
7513                 case "$hostcat" in
7514                 *ypcat*) dflt=y;;
7515                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7516                                 dflt=y
7517                         else
7518                                 dflt=n
7519                         fi;;
7520                 *) dflt=n;;
7521                 esac
7522                 echo " "
7523                 rp='Are you getting the hosts file via yellow pages?'
7524                 . ./myread
7525                 case "$ans" in
7526                 y*) hostcat='ypcat hosts';;
7527                 *) hostcat='cat /etc/hosts';;
7528                 esac
7529                 ;;
7530         esac
7531 fi
7532 case "$hostcat" in
7533 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7534 esac
7535 case "$groupcat" in
7536 '') test -f /etc/group && groupcat='cat /etc/group';;
7537 esac
7538 case "$passcat" in
7539 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7540 esac
7541
7542 : now get the host name
7543 echo " "
7544 echo "Figuring out host name..." >&4
7545 case "$myhostname" in
7546 '') cont=true
7547         echo 'Maybe "hostname" will work...'
7548         if tans=`sh -c hostname 2>&1` ; then
7549                 myhostname=$tans
7550                 phostname=hostname
7551                 cont=''
7552         fi
7553         ;;
7554 *) cont='';;
7555 esac
7556 if $test "$cont"; then
7557         if ./xenix; then
7558                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7559                 if tans=`cat /etc/systemid 2>&1` ; then
7560                         myhostname=$tans
7561                         phostname='cat /etc/systemid'
7562                         echo "Whadyaknow.  Xenix always was a bit strange..."
7563                         cont=''
7564                 fi
7565         elif $test -r /etc/systemid; then
7566                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7567         fi
7568 fi
7569 if $test "$cont"; then
7570         echo 'No, maybe "uuname -l" will work...'
7571         if tans=`sh -c 'uuname -l' 2>&1` ; then
7572                 myhostname=$tans
7573                 phostname='uuname -l'
7574         else
7575                 echo 'Strange.  Maybe "uname -n" will work...'
7576                 if tans=`sh -c 'uname -n' 2>&1` ; then
7577                         myhostname=$tans
7578                         phostname='uname -n'
7579                 else
7580                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7581                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7582                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7583                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7584                         else
7585                                 case "$myhostname" in
7586                                 '') echo "Does this machine have an identity crisis or something?"
7587                                         phostname='';;
7588                                 *)
7589                                         echo "Well, you said $myhostname before..."
7590                                         phostname='echo $myhostname';;
7591                                 esac
7592                         fi
7593                 fi
7594         fi
7595 fi
7596 : you do not want to know about this
7597 set $myhostname
7598 myhostname=$1
7599
7600 : verify guess
7601 if $test "$myhostname" ; then
7602         dflt=y
7603         rp='Your host name appears to be "'$myhostname'".'" Right?"
7604         . ./myread
7605         case "$ans" in
7606         y*) ;;
7607         *) myhostname='';;
7608         esac
7609 fi
7610
7611 : bad guess or no guess
7612 while $test "X$myhostname" = X ; do
7613         dflt=''
7614         rp="Please type the (one word) name of your host:"
7615         . ./myread
7616         myhostname="$ans"
7617 done
7618
7619 : translate upper to lower if necessary
7620 case "$myhostname" in
7621 *[A-Z]*)
7622         echo "(Normalizing case in your host name)"
7623         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7624         ;;
7625 esac
7626
7627 case "$myhostname" in
7628 *.*)
7629         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7630         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7631         echo "(Trimming domain name from host name--host name is now $myhostname)"
7632         ;;
7633 *) case "$mydomain" in
7634         '')
7635                 {
7636                         test "X$hostcat" = "Xypcat hosts" &&
7637                         ypmatch "$myhostname" hosts 2>/dev/null |\
7638                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7639                         $test -s hosts
7640                 } || {
7641                         test "X$hostcat" != "X" &&
7642                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7643                                         /[       ]$myhostname[  . ]/p" > hosts
7644                 }
7645                 tmp_re="[       . ]"
7646                 if $test -f hosts; then
7647                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7648                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7649                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7650                                 hosts | $sort | $uniq | \
7651                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7652                         case `$echo X$dflt` in
7653                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7654                                 dflt=.
7655                                 ;;
7656                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7657                                 ;;
7658                         esac
7659                 else
7660                         echo "(I cannot locate a hosts database anywhere)"
7661                         dflt=.
7662                 fi
7663                 case "$dflt" in
7664                 .)
7665                         tans=`./loc resolv.conf X /etc /usr/etc`
7666                         if $test -f "$tans"; then
7667                                 echo "(Attempting domain name extraction from $tans)"
7668                                 dflt=.`$sed -n -e 's/   / /g' \
7669                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7670                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7671                                 case "$dflt" in
7672                                 .) dflt=.`$sed -n -e 's/        / /g' \
7673                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7674                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7675                                         ;;
7676                                 esac
7677                         fi
7678                         ;;
7679                 esac
7680                 case "$dflt" in
7681                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7682                         dflt=.`sh -c domainname 2>/dev/null`
7683                         case "$dflt" in
7684                         '') dflt='.';;
7685                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7686                         esac
7687                         ;;
7688                 esac
7689                 case "$dflt$osname" in
7690                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7691                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7692                         ;;
7693                 esac
7694                 case "$dflt" in
7695                 .) echo "(Lost all hope -- silly guess then)"
7696                         dflt='.uucp'
7697                         ;;
7698                 esac
7699                 $rm -f hosts
7700                 ;;
7701         *) dflt="$mydomain";;
7702         esac;;
7703 esac
7704 echo " "
7705 rp="What is your domain name?"
7706 . ./myread
7707 tans="$ans"
7708 case "$ans" in
7709 '') ;;
7710 .*) ;;
7711 *) tans=".$tans";;
7712 esac
7713 mydomain="$tans"
7714
7715 : translate upper to lower if necessary
7716 case "$mydomain" in
7717 *[A-Z]*)
7718         echo "(Normalizing case in your domain name)"
7719         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7720         ;;
7721 esac
7722
7723 : a little sanity check here
7724 case "$phostname" in
7725 '') ;;
7726 *)
7727         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7728         $myhostname$mydomain|$myhostname) ;;
7729         *)
7730                 case "$phostname" in
7731                 sed*)
7732                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7733                         ;;
7734                 *)
7735                         echo "(That doesn't agree with your $phostname command, by the way.)"
7736                         ;;
7737                 esac
7738         ;;
7739         esac
7740         ;;
7741 esac
7742
7743 $cat <<EOM
7744
7745 I need to get your e-mail address in Internet format if possible, i.e.
7746 something like user@host.domain. Please answer accurately since I have
7747 no easy means to double check it. The default value provided below
7748 is most probably close to reality but may not be valid from outside
7749 your organization...
7750
7751 EOM
7752 cont=x
7753 while test "$cont"; do
7754         case "$cf_email" in
7755         '') dflt="$cf_by@$myhostname$mydomain";;
7756         *) dflt="$cf_email";;
7757         esac
7758         rp='What is your e-mail address?'
7759         . ./myread
7760         cf_email="$ans"
7761         case "$cf_email" in
7762         *@*.*) cont='' ;;
7763         *)
7764                 rp='Address does not look like an Internet one.  Use it anyway?'
7765                 case "$fastread" in
7766                 yes) dflt=y ;;
7767                 *) dflt=n ;;
7768                 esac
7769                 . ./myread
7770                 case "$ans" in
7771                 y*) cont='' ;;
7772                 *) echo " " ;;
7773                 esac
7774                 ;;
7775         esac
7776 done
7777
7778 $cat <<EOM
7779
7780 If you or somebody else will be maintaining perl at your site, please
7781 fill in the correct e-mail address here so that they may be contacted
7782 if necessary. Currently, the "perlbug" program included with perl
7783 will send mail to this address in addition to perlbug@perl.org. You may
7784 enter "none" for no administrator.
7785
7786 EOM
7787 case "$perladmin" in
7788 '') dflt="$cf_email";;
7789 *) dflt="$perladmin";;
7790 esac
7791 rp='Perl administrator e-mail address'
7792 . ./myread
7793 perladmin="$ans"
7794
7795 : determine whether to only install version-specific parts.
7796 echo " "
7797 $cat <<EOM
7798 Do you want to install only the version-specific parts of the perl
7799 distribution?  Usually you do *not* want to do this.
7800 EOM
7801 case "$versiononly" in
7802 "$define"|[Yy]*|true) dflt='y' ;;
7803 *) dflt='n';
7804 esac
7805 rp="Do you want to install only the version-specific parts of perl?"
7806 . ./myread
7807 case "$ans" in
7808 [yY]*)  val="$define";;
7809 *)      val="$undef" ;;
7810 esac
7811 set versiononly
7812 eval $setvar
7813
7814 : figure out how to guarantee perl startup
7815 case "$startperl" in
7816 '')
7817         case "$sharpbang" in
7818         *!)
7819                 $cat <<EOH
7820
7821 I can use the #! construct to start perl on your system. This will
7822 make startup of perl scripts faster, but may cause problems if you
7823 want to share those scripts and perl is not in a standard place
7824 ($binexp/perl) on all your platforms. The alternative is to force
7825 a shell by starting the script with a single ':' character.
7826
7827 EOH
7828                 case "$versiononly" in
7829                 "$define")      dflt="$binexp/perl$version";;  
7830                 *)              dflt="$binexp/perl";;
7831                 esac
7832                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7833                 . ./myread
7834                 case "$ans" in
7835                 none)   startperl=": # use perl";;
7836                 *)      startperl="#!$ans"
7837                         if $test 30 -lt `echo "$ans" | wc -c`; then
7838                                 $cat >&4 <<EOM
7839
7840 WARNING:  Some systems limit the #! command to 32 characters.
7841 If you experience difficulty running Perl scripts with #!, try
7842 installing Perl in a directory with a shorter pathname.
7843
7844 EOM
7845                         fi ;;
7846                 esac
7847                 ;;
7848         *) startperl=": # use perl"
7849                 ;;
7850         esac
7851         ;;
7852 esac
7853 echo "I'll use $startperl to start perl scripts."
7854
7855 : figure best path for perl in scripts
7856 case "$perlpath" in
7857 '')
7858         perlpath="$binexp/perl"
7859         case "$startperl" in
7860         *!*) ;;
7861         *)
7862                 $cat <<EOH
7863
7864 I will use the "eval 'exec'" idiom to start Perl on your system.
7865 I can use the full path of your Perl binary for this purpose, but
7866 doing so may cause problems if you want to share those scripts and
7867 Perl is not always in a standard place ($binexp/perl).
7868
7869 EOH
7870                 dflt="$binexp/perl"
7871                 rp="What path shall I use in \"eval 'exec'\"?"
7872                 . ./myread
7873                 perlpath="$ans"
7874                 ;;
7875         esac
7876         ;;
7877 esac
7878 case "$startperl" in
7879 *!*)    ;;
7880 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7881 esac
7882
7883 : determine where public executable scripts go
7884 set scriptdir scriptdir
7885 eval $prefixit
7886 case "$scriptdir" in
7887 '')
7888         dflt="$bin"
7889         : guess some guesses
7890         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7891         $test -d /usr/share/bin     && dflt=/usr/share/bin
7892         $test -d /usr/local/script  && dflt=/usr/local/script
7893         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7894         $test -d $prefixexp/script  && dflt=$prefixexp/script
7895         set dflt
7896         eval $prefixup
7897         ;;
7898 *)  dflt="$scriptdir"
7899         ;;
7900 esac
7901 $cat <<EOM
7902  
7903 Some installations have a separate directory just for executable scripts so
7904 that they can mount it across multiple architectures but keep the scripts in
7905 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7906 Or you might just lump your scripts in with all your other executables.
7907  
7908 EOM
7909 fn=d~
7910 rp='Where do you keep publicly executable scripts?'
7911 . ./getfile
7912 if $test "X$ansexp" != "X$scriptdirexp"; then
7913         installscript=''
7914 fi
7915 scriptdir="$ans"
7916 scriptdirexp="$ansexp"
7917 : Change installation prefix, if necessary.
7918 if $test X"$prefix" != X"$installprefix"; then
7919         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7920 else
7921         installscript="$scriptdirexp"
7922 fi
7923
7924 : determine where add-on public executables go
7925 case "$sitebin" in
7926 '')     dflt=$siteprefix/bin ;;
7927 *)      dflt=$sitebin ;;
7928 esac
7929 fn=d~
7930 rp='Pathname where the add-on public executables should be installed?'
7931 . ./getfile
7932 sitebin="$ans"
7933 sitebinexp="$ansexp"
7934 : Change installation prefix, if necessary.
7935 if $test X"$prefix" != X"$installprefix"; then
7936         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7937 else
7938         installsitebin="$sitebinexp"
7939 fi
7940
7941 case "$vendorprefix" in
7942 '')     d_vendorbin="$undef"
7943         vendorbin=''
7944         vendorbinexp=''
7945         ;;
7946 *)      d_vendorbin="$define"
7947         : determine where vendor-supplied executables go.
7948         case "$vendorbin" in
7949         '') dflt=$vendorprefix/bin ;;
7950         *)      dflt="$vendorbin" ;;
7951         esac
7952         fn=d~+
7953         rp='Pathname for the vendor-supplied executables directory?'
7954         . ./getfile
7955         vendorbin="$ans"
7956         vendorbinexp="$ansexp"
7957         ;;
7958 esac
7959 : Change installation prefix, if necessary.
7960 if $test X"$prefix" != X"$installprefix"; then
7961         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7962 else
7963         installvendorbin="$vendorbinexp"
7964 fi
7965
7966 : see if qgcvt exists
7967 set qgcvt d_qgcvt
7968 eval $inlibc
7969
7970 echo " "
7971
7972 if $test X"$d_longdbl" = X"$define"; then
7973
7974 echo "Checking how to print long doubles..." >&4
7975
7976 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7977         $cat >try.c <<'EOCP'
7978 #include <sys/types.h>
7979 #include <stdio.h>
7980 int main() {
7981   double d = 123.456;
7982   printf("%.3f\n", d);
7983 }
7984 EOCP
7985         set try
7986         if eval $compile; then
7987                 yyy=`./try$exe_ext`
7988                 case "$yyy" in
7989                 123.456)
7990                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7991                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7992                         echo "We will use %f."
7993                         ;;
7994                 esac
7995         fi
7996 fi
7997
7998 if $test X"$sPRIfldbl" = X; then
7999         $cat >try.c <<'EOCP'
8000 #include <sys/types.h>
8001 #include <stdio.h>
8002 int main() {
8003   long double d = 123.456;
8004   printf("%.3llf\n", d);
8005 }
8006 EOCP
8007         set try
8008         if eval $compile; then
8009                 yyy=`./try$exe_ext`
8010                 case "$yyy" in
8011                 123.456)
8012                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8013                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8014                         echo "We will use %llf."
8015                         ;;
8016                 esac
8017         fi
8018 fi
8019
8020 if $test X"$sPRIfldbl" = X; then
8021         $cat >try.c <<'EOCP'
8022 #include <sys/types.h>
8023 #include <stdio.h>
8024 int main() {
8025   long double d = 123.456;
8026   printf("%.3Lf\n", d);
8027 }
8028 EOCP
8029         set try
8030         if eval $compile; then
8031                 yyy=`./try$exe_ext`
8032                 case "$yyy" in
8033                 123.456)
8034                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8035                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8036                         echo "We will use %Lf."
8037                         ;;
8038                 esac
8039         fi
8040 fi
8041
8042 if $test X"$sPRIfldbl" = X; then
8043         $cat >try.c <<'EOCP'
8044 #include <sys/types.h>
8045 #include <stdio.h>
8046 int main() {
8047   long double d = 123.456;
8048   printf("%.3lf\n", d);
8049 }
8050 EOCP
8051         set try
8052         if eval $compile; then
8053                 yyy=`./try$exe_ext`
8054                 case "$yyy" in
8055                 123.456)
8056                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8057                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8058                         echo "We will use %lf."
8059                         ;;
8060                 esac
8061         fi
8062 fi
8063
8064 if $test X"$sPRIfldbl" = X; then
8065         echo "Cannot figure out how to print long doubles." >&4
8066 else
8067         sSCNfldbl=$sPRIfldbl    # expect consistency
8068 fi
8069
8070 $rm -f try try.*
8071
8072 fi # d_longdbl
8073
8074 case "$sPRIfldbl" in
8075 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8076         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8077         d_SCNfldbl="$undef";
8078         ;;
8079 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8080         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8081         d_SCNfldbl="$define";
8082         ;;
8083 esac
8084
8085 : Check how to convert floats to strings.
8086 echo " "
8087 echo "Checking for an efficient way to convert floats to strings."
8088 echo " " > try.c
8089 case "$uselongdouble" in
8090 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8091 esac
8092 case "$d_longdbl" in
8093 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8094 esac
8095 case "$d_PRIgldbl" in
8096 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8097 esac
8098 $cat >>try.c <<EOP
8099 #ifdef TRY_gconvert
8100 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8101 char *myname = "gconvert";
8102 #endif
8103 #ifdef TRY_gcvt
8104 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8105 char *myname = "gcvt";
8106 #endif
8107 #ifdef TRY_qgcvt
8108 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8109 char *myname = "qgcvt";
8110 #define DOUBLETYPE long double
8111 #endif
8112 #ifdef TRY_sprintf
8113 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8114 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8115 #else
8116 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8117 #endif
8118 char *myname = "sprintf";
8119 #endif
8120
8121 #ifndef DOUBLETYPE
8122 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8123 #define DOUBLETYPE long double
8124 #else
8125 #define DOUBLETYPE double
8126 #endif
8127 #endif
8128
8129 #include <stdio.h>
8130
8131 #define I_STDLIB $i_stdlib
8132 #ifdef I_STDLIB
8133 #include <stdlib.h>
8134 #endif
8135
8136 int
8137 checkit(expect, got)
8138 char *expect;
8139 char *got;
8140 {
8141     if (strcmp(expect, got)) {
8142                 printf("%s oddity:  Expected %s, got %s\n",
8143                         myname, expect, got);
8144                 exit(1);
8145         }
8146 }
8147
8148 int main()
8149
8150         char buf[64]; 
8151         buf[63] = '\0';
8152
8153         /* This must be 1st test on (which?) platform */
8154         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8155         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8156         checkit("0.1", buf);
8157
8158         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8159         checkit("1", buf);
8160
8161         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8162         checkit("1.1", buf);
8163
8164         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8165         checkit("1.01", buf);
8166
8167         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8168         checkit("1.001", buf);
8169
8170         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8171         checkit("1.0001", buf);
8172
8173         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8174         checkit("1.00001", buf);
8175
8176         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8177         checkit("1.000001", buf);
8178
8179         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8180         checkit("0", buf);
8181
8182         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8183         checkit("-1", buf);
8184
8185         /* Some Linux gcvt's give 1.e+5 here. */
8186         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8187         checkit("100000", buf);
8188         
8189         /* Some Linux gcvt's give -1.e+5 here. */
8190         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8191         checkit("-100000", buf);
8192
8193         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8194         checkit("123.456", buf);
8195
8196         exit(0);
8197 }
8198 EOP
8199 case "$d_Gconvert" in
8200 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8201 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8202 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8203 *) xxx_list='gconvert gcvt sprintf' ;;
8204 esac
8205
8206 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8207 "$define$define$define")
8208     # for long doubles prefer first qgcvt, then sprintf
8209     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8210     xxx_list="sprintf $xxx_list"
8211     case "$d_qgcvt" in
8212     "$define") xxx_list="qgcvt $xxx_list" ;;
8213     esac
8214     ;;
8215 esac
8216
8217 for xxx_convert in $xxx_list; do
8218         echo "Trying $xxx_convert..."
8219         $rm -f try try$_o
8220         set try -DTRY_$xxx_convert
8221         if eval $compile; then
8222                 echo "$xxx_convert() found." >&4
8223                 if ./try; then
8224                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8225                         break;
8226                 else
8227                         echo "...But $xxx_convert didn't work as I expected."
8228                 fi
8229         else
8230                 echo "$xxx_convert NOT found." >&4
8231         fi
8232 done
8233         
8234 case "$xxx_convert" in
8235 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8236 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8237 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8238 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8239    "$define$define$define")
8240       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8241    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8242    esac
8243    ;;  
8244 esac
8245
8246 : see if _fwalk exists
8247 set fwalk d__fwalk
8248 eval $inlibc
8249
8250 : Initialize h_fcntl
8251 h_fcntl=false
8252
8253 : Initialize h_sysfile
8254 h_sysfile=false
8255
8256 : access call always available on UNIX
8257 set access d_access
8258 eval $inlibc
8259
8260 : locate the flags for 'access()'
8261 case "$d_access" in
8262 "$define")
8263         echo " "
8264         $cat >access.c <<'EOCP'
8265 #include <sys/types.h>
8266 #ifdef I_FCNTL
8267 #include <fcntl.h>
8268 #endif
8269 #ifdef I_SYS_FILE
8270 #include <sys/file.h>
8271 #endif
8272 #ifdef I_UNISTD
8273 #include <unistd.h>
8274 #endif
8275 int main() {
8276         exit(R_OK);
8277 }
8278 EOCP
8279         : check sys/file.h first, no particular reason here
8280         if $test `./findhdr sys/file.h` && \
8281                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8282                 h_sysfile=true;
8283                 echo "<sys/file.h> defines the *_OK access constants." >&4
8284         elif $test `./findhdr fcntl.h` && \
8285                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8286                 h_fcntl=true;
8287                 echo "<fcntl.h> defines the *_OK access constants." >&4
8288         elif $test `./findhdr unistd.h` && \
8289                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8290                 echo "<unistd.h> defines the *_OK access constants." >&4
8291         else
8292                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8293         fi
8294         ;;
8295 esac
8296 $rm -f access*
8297
8298 : see if accessx exists
8299 set accessx d_accessx
8300 eval $inlibc
8301
8302 : see if alarm exists
8303 set alarm d_alarm
8304 eval $inlibc
8305
8306 : see if atolf exists
8307 set atolf d_atolf
8308 eval $inlibc
8309
8310 : see if atoll exists
8311 set atoll d_atoll
8312 eval $inlibc
8313
8314 : Look for GNU-cc style attribute checking
8315 echo " "
8316 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8317 $cat >attrib.c <<'EOCP'
8318 #include <stdio.h>
8319 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8320 EOCP
8321 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8322         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8323                 echo "Your C compiler doesn't fully support __attribute__."
8324                 val="$undef"
8325         else
8326                 echo "Your C compiler supports __attribute__."
8327                 val="$define"
8328         fi
8329 else
8330         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8331         val="$undef"
8332 fi
8333 set d_attribut
8334 eval $setvar
8335 $rm -f attrib*
8336
8337 : see if bcmp exists
8338 set bcmp d_bcmp
8339 eval $inlibc
8340
8341 : see if bcopy exists
8342 set bcopy d_bcopy
8343 eval $inlibc
8344
8345 : see if this is a unistd.h system
8346 set unistd.h i_unistd
8347 eval $inhdr
8348
8349 : see if getpgrp exists
8350 set getpgrp d_getpgrp
8351 eval $inlibc
8352
8353 case "$d_getpgrp" in
8354 "$define")
8355         echo " "
8356         echo "Checking to see which flavor of getpgrp is in use..."
8357         $cat >set.c <<EOP
8358 #$i_unistd I_UNISTD
8359 #include <sys/types.h>
8360 #ifdef I_UNISTD
8361 #  include <unistd.h>
8362 #endif
8363 int main()
8364 {
8365         if (getuid() == 0) {
8366                 printf("(I see you are running Configure as super-user...)\n");
8367                 setuid(1);
8368         }
8369 #ifdef TRY_BSD_PGRP
8370         if (getpgrp(1) == 0)
8371                 exit(0);
8372 #else
8373         if (getpgrp() > 0)
8374                 exit(0);
8375 #endif
8376         exit(1);
8377 }
8378 EOP
8379         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8380                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8381                 val="$define"
8382         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8383                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8384                 val="$undef"
8385         else
8386                 echo "I can't seem to compile and run the test program."
8387                 if ./usg; then
8388                         xxx="a USG one, i.e. you use getpgrp()."
8389                 else
8390                         # SVR4 systems can appear rather BSD-ish.
8391                         case "$i_unistd" in
8392                         $undef)
8393                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8394                                 val="$define"
8395                                 ;;
8396                         $define)
8397                                 xxx="probably a USG one, i.e. you use getpgrp()."
8398                                 val="$undef"
8399                                 ;;
8400                         esac
8401                 fi
8402                 echo "Assuming your getpgrp is $xxx" >&4
8403         fi
8404         ;;
8405 *) val="$undef";;
8406 esac
8407 set d_bsdgetpgrp
8408 eval $setvar
8409 $rm -f set set.c
8410
8411 : see if setpgrp exists
8412 set setpgrp d_setpgrp
8413 eval $inlibc
8414
8415 case "$d_setpgrp" in
8416 "$define")
8417         echo " "
8418         echo "Checking to see which flavor of setpgrp is in use..."
8419         $cat >set.c <<EOP
8420 #$i_unistd I_UNISTD
8421 #include <sys/types.h>
8422 #ifdef I_UNISTD
8423 #  include <unistd.h>
8424 #endif
8425 int main()
8426 {
8427         if (getuid() == 0) {
8428                 printf("(I see you are running Configure as super-user...)\n");
8429                 setuid(1);
8430         }
8431 #ifdef TRY_BSD_PGRP
8432         if (-1 == setpgrp(1, 1))
8433                 exit(0);
8434 #else
8435         if (setpgrp() != -1)
8436                 exit(0);
8437 #endif
8438         exit(1);
8439 }
8440 EOP
8441         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8442                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8443                 val="$define"
8444         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8445                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8446                 val="$undef"
8447         else
8448                 echo "(I can't seem to compile and run the test program.)"
8449                 if ./usg; then
8450                         xxx="a USG one, i.e. you use setpgrp()."
8451                 else
8452                         # SVR4 systems can appear rather BSD-ish.
8453                         case "$i_unistd" in
8454                         $undef)
8455                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8456                                 val="$define"
8457                                 ;;
8458                         $define)
8459                                 xxx="probably a USG one, i.e. you use setpgrp()."
8460                                 val="$undef"
8461                                 ;;
8462                         esac
8463                 fi
8464                 echo "Assuming your setpgrp is $xxx" >&4
8465         fi
8466         ;;
8467 *) val="$undef";;
8468 esac
8469 set d_bsdsetpgrp
8470 eval $setvar
8471 $rm -f set set.c
8472 : see if bzero exists
8473 set bzero d_bzero
8474 eval $inlibc
8475
8476 : see if signal is declared as pointer to function returning int or void
8477 echo " "
8478 xxx=`./findhdr signal.h`
8479 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8480 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8481         echo "You have int (*signal())() instead of void." >&4
8482         val="$undef"
8483 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8484         echo "You have void (*signal())()." >&4
8485         val="$define"
8486 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8487         echo "You have int (*signal())() instead of void." >&4
8488         val="$undef"
8489 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8490         echo "You have void (*signal())()." >&4
8491         val="$define"
8492 else
8493         case "$d_voidsig" in
8494         '')
8495         echo "I can't determine whether signal handler returns void or int..." >&4
8496                 dflt=void
8497                 rp="What type does your signal handler return?"
8498                 . ./myread
8499                 case "$ans" in
8500                 v*) val="$define";;
8501                 *) val="$undef";;
8502                 esac;;
8503         "$define")
8504                 echo "As you already told me, signal handler returns void." >&4
8505                 val="$define"
8506                 ;;
8507         *)      echo "As you already told me, signal handler returns int." >&4
8508                 val="$undef"
8509                 ;;
8510         esac
8511 fi
8512 set d_voidsig
8513 eval $setvar
8514 case "$d_voidsig" in
8515 "$define") signal_t="void";;
8516 *) signal_t="int";;
8517 esac
8518 $rm -f $$.tmp
8519
8520 : check for ability to cast large floats to 32-bit ints.
8521 echo " "
8522 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8523 if $test "$intsize" -ge 4; then
8524         xxx=int
8525 else
8526         xxx=long
8527 fi
8528 $cat >try.c <<EOCP
8529 #include <stdio.h>
8530 #include <sys/types.h>
8531 #include <signal.h>
8532 $signal_t blech(s) int s; { exit(3); }
8533 int main()
8534 {
8535         $xxx i32;
8536         double f, g;
8537         int result = 0;
8538         char str[16];
8539         signal(SIGFPE, blech);
8540
8541         /* Don't let compiler optimize the test away.  Store the number 
8542            in a writable string for gcc to pass to sscanf under HP/UX.
8543         */
8544         sprintf(str, "2147483647");
8545         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8546         g = 10 * f;
8547         i32  = ($xxx) g;
8548
8549         /* x86 processors will probably give 0x8000 0000, which is a
8550        sign change.  We don't want that.  We want to mimic SPARC
8551            behavior here, which is to preserve the sign and give
8552            back 0x7fff ffff.
8553         */
8554         if (i32 != ($xxx) f)
8555                 result |= 1;
8556         exit(result);
8557 }
8558 EOCP
8559 set try
8560 if eval $compile_ok; then
8561         ./try
8562         yyy=$?
8563 else
8564         echo "(I can't seem to compile the test program--assuming it can't)"
8565         yyy=1
8566 fi
8567 case "$yyy" in
8568 0)      val="$define"
8569         echo "Yup, it can."
8570         ;;
8571 *)      val="$undef"
8572         echo "Nope, it can't."
8573         ;;
8574 esac
8575 set d_casti32
8576 eval $setvar
8577 $rm -f try try.*
8578
8579 : check for ability to cast negative floats to unsigned
8580 echo " "
8581 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8582 $cat >try.c <<EOCP
8583 #include <stdio.h>
8584 #include <sys/types.h>
8585 #include <signal.h>
8586 $signal_t blech(s) int s; { exit(7); }
8587 $signal_t blech_in_list(s) int s; { exit(4); }
8588 unsigned long dummy_long(p) unsigned long p; { return p; }
8589 unsigned int dummy_int(p) unsigned int p; { return p; }
8590 unsigned short dummy_short(p) unsigned short p; { return p; }
8591 int main()
8592 {
8593         double f;
8594         unsigned long along;
8595         unsigned int aint;
8596         unsigned short ashort;
8597         int result = 0;
8598         char str[16];
8599         
8600         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8601            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8602            optimized the whole file away
8603         */
8604         /* Store the number in a writable string for gcc to pass to 
8605            sscanf under HP/UX.
8606         */
8607         sprintf(str, "-123");
8608         sscanf(str, "%lf", &f);  /* f = -123.; */
8609
8610         signal(SIGFPE, blech);
8611         along = (unsigned long)f;
8612         aint = (unsigned int)f;
8613         ashort = (unsigned short)f;
8614         if (along != (unsigned long)-123)
8615                 result |= 1;
8616         if (aint != (unsigned int)-123)
8617                 result |= 1;
8618         if (ashort != (unsigned short)-123)
8619                 result |= 1;
8620         sprintf(str, "1073741824.");
8621         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8622         f = f + f;
8623         along = 0;
8624         along = (unsigned long)f;
8625         if (along != 0x80000000)
8626                 result |= 2;
8627         f -= 1.;
8628         along = 0;
8629         along = (unsigned long)f;
8630         if (along != 0x7fffffff)
8631                 result |= 1;
8632         f += 2.;
8633         along = 0;
8634         along = (unsigned long)f;
8635         if (along != 0x80000001)
8636                 result |= 2;
8637         if (result)
8638                 exit(result);
8639         signal(SIGFPE, blech_in_list);
8640         sprintf(str, "123.");
8641         sscanf(str, "%lf", &f);  /* f = 123.; */
8642         along = dummy_long((unsigned long)f);
8643         aint = dummy_int((unsigned int)f);
8644         ashort = dummy_short((unsigned short)f);
8645         if (along != (unsigned long)123)
8646                 result |= 4;
8647         if (aint != (unsigned int)123)
8648                 result |= 4;
8649         if (ashort != (unsigned short)123)
8650                 result |= 4;
8651         exit(result);
8652
8653 }
8654 EOCP
8655 set try
8656 if eval $compile_ok; then
8657         ./try
8658         castflags=$?
8659 else
8660         echo "(I can't seem to compile the test program--assuming it can't)"
8661         castflags=7
8662 fi
8663 case "$castflags" in
8664 0)      val="$define"
8665         echo "Yup, it can."
8666         ;;
8667 *)      val="$undef"
8668         echo "Nope, it can't."
8669         ;;
8670 esac
8671 set d_castneg
8672 eval $setvar
8673 $rm -f try.*
8674
8675 : see if vprintf exists
8676 echo " "
8677 if set vprintf val -f d_vprintf; eval $csym; $val; then
8678         echo 'vprintf() found.' >&4
8679         val="$define"
8680         $cat >vprintf.c <<'EOF'
8681 #include <varargs.h>
8682
8683 int main() { xxx("foo"); }
8684
8685 xxx(va_alist)
8686 va_dcl
8687 {
8688         va_list args;
8689         char buf[10];
8690
8691         va_start(args);
8692         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8693 }
8694 EOF
8695         set vprintf
8696         if eval $compile && ./vprintf; then
8697                 echo "Your vsprintf() returns (int)." >&4
8698                 val2="$undef"
8699         else
8700                 echo "Your vsprintf() returns (char*)." >&4
8701                 val2="$define"
8702         fi
8703 else
8704         echo 'vprintf() NOT found.' >&4
8705                 val="$undef"
8706                 val2="$undef"
8707 fi
8708 set d_vprintf
8709 eval $setvar
8710 val=$val2
8711 set d_charvspr
8712 eval $setvar
8713
8714 : see if chown exists
8715 set chown d_chown
8716 eval $inlibc
8717
8718 : see if chroot exists
8719 set chroot d_chroot
8720 eval $inlibc
8721
8722 : see if chsize exists
8723 set chsize d_chsize
8724 eval $inlibc
8725
8726 hasstruct='varname=$1; struct=$2; shift; shift;
8727 while $test $# -ge 2; do
8728         case "$1" in
8729         $define) echo "#include <$2>";;
8730         esac ;
8731     shift 2;
8732 done > try.c;
8733 echo "int main () { struct $struct foo; }" >> try.c;
8734 set try;
8735 if eval $compile; then
8736         val="$define";
8737 else
8738         val="$undef";
8739 fi;
8740 set $varname;
8741 eval $setvar;
8742 $rm -f try.c try.o'
8743
8744 : see if sys/types.h has to be included
8745 set sys/types.h i_systypes
8746 eval $inhdr
8747
8748 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8749 while $test $# -ge 2; do
8750         case "$1" in
8751         $define) echo "#include <$2>";;
8752         esac ;
8753     shift 2;
8754 done > try.c;
8755 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8756 set try;
8757 if eval $compile; then
8758         val="$define";
8759 else
8760         val="$undef";
8761 fi;
8762 set $varname;
8763 eval $setvar;
8764 $rm -f try.c try.o'
8765
8766 socketlib=''
8767 sockethdr=''
8768 : see whether socket exists
8769 echo " "
8770 $echo $n "Hmm... $c" >&4
8771 if set socket val -f d_socket; eval $csym; $val; then
8772         echo "Looks like you have Berkeley networking support." >&4
8773         d_socket="$define"
8774         if set setsockopt val -f; eval $csym; $val; then
8775                 d_oldsock="$undef"
8776         else
8777                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8778                 d_oldsock="$define"
8779         fi
8780 else
8781         if $contains socklib libc.list >/dev/null 2>&1; then
8782                 echo "Looks like you have Berkeley networking support." >&4
8783                 d_socket="$define"
8784                 : we will have to assume that it supports the 4.2 BSD interface
8785                 d_oldsock="$undef"
8786         else
8787                 echo "You don't have Berkeley networking in libc$_a..." >&4
8788                 if test "X$d_socket" = "X$define"; then
8789                    echo "...but you seem to believe that you have sockets." >&4
8790                 else
8791                         for net in net socket
8792                         do
8793                                 if test -f /usr/lib/lib$net$_a; then
8794                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8795                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8796                                         if $contains socket libc.list >/dev/null 2>&1; then
8797                                                 d_socket="$define"
8798                                                 socketlib="-l$net"
8799                                                 case "$net" in
8800                                                 net)
8801                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8802                                                         sockethdr="-I/usr/netinclude"
8803                                                         ;;
8804                                                 esac
8805                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8806                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8807                                                         d_oldsock="$undef"
8808                                                 else
8809                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8810                                                         d_oldsock="$define"
8811                                                 fi
8812                                                 break
8813                                         fi
8814                                 fi
8815                         done
8816                         if test "X$d_socket" != "X$define"; then
8817                            echo "or anywhere else I see." >&4
8818                            d_socket="$undef"
8819                            d_oldsock="$undef"
8820                         fi
8821                 fi
8822         fi
8823 fi
8824
8825 : see if socketpair exists
8826 set socketpair d_sockpair
8827 eval $inlibc
8828
8829
8830 echo " "
8831 echo "Checking the availability of certain socket constants..." >& 4
8832 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8833         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8834         $cat >try.c <<EOF
8835 #include <sys/types.h>
8836 #include <sys/socket.h>
8837 int main() {
8838     int i = $ENUM;
8839 }
8840 EOF
8841         val="$undef"
8842         set try; if eval $compile; then
8843                 val="$define"
8844         fi
8845         set d_${enum}; eval $setvar
8846         $rm -f try.c try
8847 done
8848
8849 : see if this is a sys/uio.h system
8850 set sys/uio.h i_sysuio
8851 eval $inhdr
8852
8853
8854 echo " "
8855 echo "Checking to see if your system supports struct cmsghdr..." >&4
8856 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8857 eval $hasstruct
8858 case "$d_cmsghdr_s" in
8859 "$define")      echo "Yes, it does."   ;;
8860 *)              echo "No, it doesn't." ;;
8861 esac
8862
8863
8864 : check for const keyword
8865 echo " "
8866 echo 'Checking to see if your C compiler knows about "const"...' >&4
8867 $cat >const.c <<'EOCP'
8868 typedef struct spug { int drokk; } spug;
8869 int main()
8870 {
8871         const char *foo;
8872         const spug y;
8873 }
8874 EOCP
8875 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8876         val="$define"
8877         echo "Yup, it does."
8878 else
8879         val="$undef"
8880         echo "Nope, it doesn't."
8881 fi
8882 set d_const
8883 eval $setvar
8884
8885 : see if crypt exists
8886 echo " "
8887 if set crypt val -f d_crypt; eval $csym; $val; then
8888         echo 'crypt() found.' >&4
8889         val="$define"
8890         cryptlib=''
8891 else
8892         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8893         if $test -z "$cryptlib"; then
8894                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8895         else
8896                 cryptlib=-lcrypt
8897         fi
8898         if $test -z "$cryptlib"; then
8899                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8900         else
8901                 cryptlib=-lcrypt
8902         fi
8903         if $test -z "$cryptlib"; then
8904                 cryptlib=`./loc libcrypt$_a "" $libpth`
8905         else
8906                 cryptlib=-lcrypt
8907         fi
8908         if $test -z "$cryptlib"; then
8909                 echo 'crypt() NOT found.' >&4
8910                 val="$undef"
8911         else
8912                 val="$define"
8913         fi
8914 fi
8915 set d_crypt
8916 eval $setvar
8917
8918 : get csh whereabouts
8919 case "$csh" in
8920 'csh') val="$undef" ;;
8921 *) val="$define" ;;
8922 esac
8923 set d_csh
8924 eval $setvar
8925 : Respect a hint or command line value for full_csh.
8926 case "$full_csh" in
8927 '') full_csh=$csh ;;
8928 esac
8929
8930 : see if cuserid exists
8931 set cuserid d_cuserid
8932 eval $inlibc
8933
8934 : see if this is a limits.h system
8935 set limits.h i_limits
8936 eval $inhdr
8937
8938 : see if this is a float.h system
8939 set float.h i_float
8940 eval $inhdr
8941
8942 : See if number of significant digits in a double precision number is known
8943 echo " "
8944 $cat >dbl_dig.c <<EOM
8945 #$i_limits I_LIMITS
8946 #$i_float I_FLOAT
8947 #ifdef I_LIMITS
8948 #include <limits.h>
8949 #endif
8950 #ifdef I_FLOAT
8951 #include <float.h>
8952 #endif
8953 #ifdef DBL_DIG
8954 printf("Contains DBL_DIG");
8955 #endif
8956 EOM
8957 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8958 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8959         echo "DBL_DIG found." >&4
8960         val="$define"
8961 else
8962         echo "DBL_DIG NOT found." >&4
8963         val="$undef"
8964 fi
8965 $rm -f dbl_dig.?
8966 set d_dbl_dig
8967 eval $setvar
8968
8969 : see if difftime exists
8970 set difftime d_difftime
8971 eval $inlibc
8972
8973 : see if this is a dirent system
8974 echo " "
8975 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8976         val="$define"
8977         echo "<dirent.h> found." >&4
8978 else
8979         val="$undef"
8980         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8981                 echo "<sys/dir.h> found." >&4
8982                 echo " "
8983         else
8984                 xinc=`./findhdr sys/ndir.h`
8985         fi
8986         echo "<dirent.h> NOT found." >&4
8987 fi
8988 set i_dirent
8989 eval $setvar
8990
8991 : Look for type of directory structure.
8992 echo " "
8993 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8994
8995 case "$direntrytype" in
8996 ''|' ')
8997         case "$i_dirent" in
8998         $define) guess1='struct dirent' ;;
8999         *) guess1='struct direct'  ;;
9000         esac
9001         ;;
9002 *)      guess1="$direntrytype"
9003         ;;
9004 esac
9005
9006 case "$guess1" in
9007 'struct dirent') guess2='struct direct' ;;
9008 *) guess2='struct dirent' ;;
9009 esac
9010                 
9011 if $contains "$guess1" try.c >/dev/null 2>&1; then
9012         direntrytype="$guess1"
9013         echo "Your directory entries are $direntrytype." >&4
9014 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9015         direntrytype="$guess2"
9016         echo "Your directory entries seem to be $direntrytype." >&4
9017 else
9018         echo "I don't recognize your system's directory entries." >&4
9019         rp="What type is used for directory entries on this system?"
9020         dflt="$guess1"
9021         . ./myread
9022         direntrytype="$ans"
9023 fi
9024 $rm -f try.c
9025
9026
9027 : see if the directory entry stores field length
9028 echo " "
9029 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9030 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9031         echo "Good, your directory entry keeps length information in d_namlen." >&4
9032         val="$define"
9033 else
9034         echo "Your directory entry does not know about the d_namlen field." >&4
9035         val="$undef"
9036 fi
9037 set d_dirnamlen
9038 eval $setvar
9039 $rm -f try.c
9040
9041 : see if dlerror exists
9042 xxx_runnm="$runnm"
9043 runnm=false
9044 set dlerror d_dlerror
9045 eval $inlibc
9046 runnm="$xxx_runnm"
9047
9048 : see if dlfcn is available
9049 set dlfcn.h i_dlfcn
9050 eval $inhdr
9051
9052 case "$usedl" in
9053 $define|y|true)
9054         $cat << EOM
9055
9056 On a few systems, the dynamically loaded modules that perl generates and uses
9057 will need a different extension than shared libs. The default will probably
9058 be appropriate.
9059
9060 EOM
9061         case "$dlext" in
9062         '')     dflt="$so" ;;
9063         *)      dflt="$dlext" ;;
9064         esac
9065         rp='What is the extension of dynamically loaded modules'
9066         . ./myread
9067         dlext="$ans"
9068         ;;
9069 *)
9070         dlext="none"
9071         ;;
9072 esac
9073
9074 : Check if dlsym need a leading underscore
9075 echo " "
9076 val="$undef"
9077
9078 case "$dlsrc" in
9079 dl_dlopen.xs)
9080         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9081         $cat >dyna.c <<'EOM'
9082 fred () { }
9083 EOM
9084
9085 $cat >fred.c<<EOM
9086
9087 #include <stdio.h>
9088 #$i_dlfcn I_DLFCN
9089 #ifdef I_DLFCN
9090 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9091 #else
9092 #include <sys/types.h>
9093 #include <nlist.h>
9094 #include <link.h>
9095 #endif
9096
9097 extern int fred() ;
9098
9099 int main()
9100 {
9101     void * handle ;
9102     void * symbol ;
9103 #ifndef RTLD_LAZY
9104     int mode = 1 ;
9105 #else
9106     int mode = RTLD_LAZY ;
9107 #endif
9108     handle = dlopen("./dyna.$dlext", mode) ;
9109     if (handle == NULL) {
9110         printf ("1\n") ;
9111         fflush (stdout) ;
9112         exit(0);
9113     }
9114     symbol = dlsym(handle, "fred") ;
9115     if (symbol == NULL) {
9116         /* try putting a leading underscore */
9117         symbol = dlsym(handle, "_fred") ;
9118         if (symbol == NULL) {
9119             printf ("2\n") ;
9120             fflush (stdout) ;
9121             exit(0);
9122         }
9123         printf ("3\n") ;
9124     }
9125     else
9126         printf ("4\n") ;
9127     fflush (stdout) ;
9128     exit(0);
9129 }
9130 EOM
9131         : Call the object file tmp-dyna.o in case dlext=o.
9132         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9133                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9134                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9135                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9136                 xxx=`./fred`
9137                 case $xxx in
9138                 1)      echo "Test program failed using dlopen." >&4
9139                         echo "Perhaps you should not use dynamic loading." >&4;;
9140                 2)      echo "Test program failed using dlsym." >&4
9141                         echo "Perhaps you should not use dynamic loading." >&4;;
9142                 3)      echo "dlsym needs a leading underscore" >&4
9143                         val="$define" ;;
9144                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9145                 esac
9146         else
9147                 echo "I can't compile and run the test program." >&4
9148                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9149         fi
9150         ;;
9151 esac
9152                 
9153 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9154
9155 set d_dlsymun
9156 eval $setvar
9157
9158 hasproto='varname=$1; func=$2; shift; shift;
9159 while $test $# -ge 2; do
9160         case "$1" in
9161         $define) echo "#include <$2>";;
9162         esac ;
9163     shift 2;
9164 done > try.c;
9165 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9166 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9167         echo "$func() prototype found.";
9168         val="$define";
9169 else
9170         echo "$func() prototype NOT found.";
9171         val="$undef";
9172 fi;
9173 set $varname;
9174 eval $setvar;
9175 $rm -f try.c tryout.c'
9176
9177 : see if prototype for drand48 is available
9178 echo " "
9179 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9180 eval $hasproto
9181
9182 : see if dup2 exists
9183 set dup2 d_dup2
9184 eval $inlibc
9185
9186 : see if eaccess exists
9187 set eaccess d_eaccess
9188 eval $inlibc
9189
9190 : see if endgrent exists
9191 set endgrent d_endgrent
9192 eval $inlibc
9193
9194 : see if endhostent exists
9195 set endhostent d_endhent
9196 eval $inlibc
9197
9198 : see if endnetent exists
9199 set endnetent d_endnent
9200 eval $inlibc
9201
9202 : see if endprotoent exists
9203 set endprotoent d_endpent
9204 eval $inlibc
9205
9206 : see if endpwent exists
9207 set endpwent d_endpwent
9208 eval $inlibc
9209
9210 : see if endservent exists
9211 set endservent d_endsent
9212 eval $inlibc
9213
9214 : Locate the flags for 'open()'
9215 echo " "
9216 $cat >open3.c <<'EOCP'
9217 #include <sys/types.h>
9218 #ifdef I_FCNTL
9219 #include <fcntl.h>
9220 #endif
9221 #ifdef I_SYS_FILE
9222 #include <sys/file.h>
9223 #endif
9224 int main() {
9225         if(O_RDONLY);
9226 #ifdef O_TRUNC
9227         exit(0);
9228 #else
9229         exit(1);
9230 #endif
9231 }
9232 EOCP
9233 : check sys/file.h first to get FREAD on Sun
9234 if $test `./findhdr sys/file.h` && \
9235                 set open3 -DI_SYS_FILE && eval $compile; then
9236         h_sysfile=true;
9237         echo "<sys/file.h> defines the O_* constants..." >&4
9238         if ./open3; then
9239                 echo "and you have the 3 argument form of open()." >&4
9240                 val="$define"
9241         else
9242                 echo "but not the 3 argument form of open().  Oh, well." >&4
9243                 val="$undef"
9244         fi
9245 elif $test `./findhdr fcntl.h` && \
9246                 set open3 -DI_FCNTL && eval $compile; then
9247         h_fcntl=true;
9248         echo "<fcntl.h> defines the O_* constants..." >&4
9249         if ./open3; then
9250                 echo "and you have the 3 argument form of open()." >&4
9251                 val="$define"
9252         else
9253                 echo "but not the 3 argument form of open().  Oh, well." >&4
9254                 val="$undef"
9255         fi
9256 else
9257         val="$undef"
9258         echo "I can't find the O_* constant definitions!  You got problems." >&4
9259 fi
9260 set d_open3
9261 eval $setvar
9262 $rm -f open3*
9263
9264 : see which of string.h or strings.h is needed
9265 echo " "
9266 strings=`./findhdr string.h`
9267 if $test "$strings" && $test -r "$strings"; then
9268         echo "Using <string.h> instead of <strings.h>." >&4
9269         val="$define"
9270 else
9271         val="$undef"
9272         strings=`./findhdr strings.h`
9273         if $test "$strings" && $test -r "$strings"; then
9274                 echo "Using <strings.h> instead of <string.h>." >&4
9275         else
9276                 echo "No string header found -- You'll surely have problems." >&4
9277         fi
9278 fi
9279 set i_string
9280 eval $setvar
9281 case "$i_string" in
9282 "$undef") strings=`./findhdr strings.h`;;
9283 *)        strings=`./findhdr string.h`;;
9284 esac
9285
9286 : check for non-blocking I/O stuff
9287 case "$h_sysfile" in
9288 true) echo "#include <sys/file.h>" > head.c;;
9289 *)
9290        case "$h_fcntl" in
9291        true) echo "#include <fcntl.h>" > head.c;;
9292        *) echo "#include <sys/fcntl.h>" > head.c;;
9293        esac
9294        ;;
9295 esac
9296 echo " "
9297 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9298 case "$o_nonblock" in
9299 '')
9300         $cat head.c > try.c
9301         $cat >>try.c <<'EOCP'
9302 #include <stdio.h>
9303 int main() {
9304 #ifdef O_NONBLOCK
9305         printf("O_NONBLOCK\n");
9306         exit(0);
9307 #endif
9308 #ifdef O_NDELAY
9309         printf("O_NDELAY\n");
9310         exit(0);
9311 #endif
9312 #ifdef FNDELAY
9313         printf("FNDELAY\n");
9314         exit(0);
9315 #endif
9316         exit(0);
9317 }
9318 EOCP
9319         set try
9320         if eval $compile_ok; then
9321                 o_nonblock=`./try`
9322                 case "$o_nonblock" in
9323                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9324                 *) echo "Seems like we can use $o_nonblock.";;
9325                 esac
9326         else
9327                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9328         fi
9329         ;;
9330 *) echo "Using $hint value $o_nonblock.";;
9331 esac
9332 $rm -f try try.* .out core
9333
9334 echo " "
9335 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9336 case "$eagain" in
9337 '')
9338         $cat head.c > try.c
9339         $cat >>try.c <<EOCP
9340 #include <errno.h>
9341 #include <sys/types.h>
9342 #include <signal.h>
9343 #include <stdio.h> 
9344 #define MY_O_NONBLOCK $o_nonblock
9345 #ifndef errno  /* XXX need better Configure test */
9346 extern int errno;
9347 #endif
9348 #$i_unistd I_UNISTD
9349 #ifdef I_UNISTD
9350 #include <unistd.h>
9351 #endif
9352 #$i_string I_STRING
9353 #ifdef I_STRING
9354 #include <string.h>
9355 #else
9356 #include <strings.h>
9357 #endif
9358 $signal_t blech(x) int x; { exit(3); }
9359 EOCP
9360         $cat >> try.c <<'EOCP'
9361 int main()
9362 {
9363         int pd[2];
9364         int pu[2];
9365         char buf[1];
9366         char string[100];
9367
9368         pipe(pd);       /* Down: child -> parent */
9369         pipe(pu);       /* Up: parent -> child */
9370         if (0 != fork()) {
9371                 int ret;
9372                 close(pd[1]);   /* Parent reads from pd[0] */
9373                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9374 #ifdef F_SETFL
9375                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9376                         exit(1);
9377 #else
9378                 exit(4);
9379 #endif
9380                 signal(SIGALRM, blech);
9381                 alarm(5);
9382                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9383                         exit(2);
9384                 sprintf(string, "%d\n", ret);
9385                 write(2, string, strlen(string));
9386                 alarm(0);
9387 #ifdef EAGAIN
9388                 if (errno == EAGAIN) {
9389                         printf("EAGAIN\n");
9390                         goto ok;
9391                 }
9392 #endif
9393 #ifdef EWOULDBLOCK
9394                 if (errno == EWOULDBLOCK)
9395                         printf("EWOULDBLOCK\n");
9396 #endif
9397         ok:
9398                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9399                 sleep(2);                               /* Give it time to close our pipe */
9400                 alarm(5);
9401                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9402                 alarm(0);
9403                 sprintf(string, "%d\n", ret);
9404                 write(3, string, strlen(string));
9405                 exit(0);
9406         }
9407
9408         close(pd[0]);                   /* We write to pd[1] */
9409         close(pu[1]);                   /* We read from pu[0] */
9410         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9411         close(pd[1]);                   /* Pipe pd is now fully closed! */
9412         exit(0);                                /* Bye bye, thank you for playing! */
9413 }
9414 EOCP
9415         set try
9416         if eval $compile_ok; then
9417                 echo "$startsh" >mtry
9418                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9419                 chmod +x mtry
9420                 ./mtry >/dev/null 2>&1
9421                 case $? in
9422                 0) eagain=`$cat try.out`;;
9423                 1) echo "Could not perform non-blocking setting!";;
9424                 2) echo "I did a successful read() for something that was not there!";;
9425                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9426                 4) echo "Could not find F_SETFL!";;
9427                 *) echo "Something terribly wrong happened during testing.";;
9428                 esac
9429                 rd_nodata=`$cat try.ret`
9430                 echo "A read() system call with no data present returns $rd_nodata."
9431                 case "$rd_nodata" in
9432                 0|-1) ;;
9433                 *)
9434                         echo "(That's peculiar, fixing that to be -1.)"
9435                         rd_nodata=-1
9436                         ;;
9437                 esac
9438                 case "$eagain" in
9439                 '')
9440                         echo "Forcing errno EAGAIN on read() with no data available."
9441                         eagain=EAGAIN
9442                         ;;
9443                 *)
9444                         echo "Your read() sets errno to $eagain when no data is available."
9445                         ;;
9446                 esac
9447                 status=`$cat try.err`
9448                 case "$status" in
9449                 0) echo "And it correctly returns 0 to signal EOF.";;
9450                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9451                 *) echo "However, your read() returns '$status' on EOF??";;
9452                 esac
9453                 val="$define"
9454                 if test "$status" = "$rd_nodata"; then
9455                         echo "WARNING: you can't distinguish between EOF and no data!"
9456                         val="$undef"
9457                 fi
9458         else
9459                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9460                 eagain=EAGAIN
9461         fi
9462         set d_eofnblk
9463         eval $setvar
9464         ;;
9465 *)
9466         echo "Using $hint value $eagain."
9467         echo "Your read() returns $rd_nodata when no data is present."
9468         case "$d_eofnblk" in
9469         "$define") echo "And you can see EOF because read() returns 0.";;
9470         "$undef") echo "But you can't see EOF status from read() returned value.";;
9471         *)
9472                 echo "(Assuming you can't see EOF status from read anyway.)"
9473                 d_eofnblk=$undef
9474                 ;;
9475         esac
9476         ;;
9477 esac
9478 $rm -f try try.* .out core head.c mtry
9479
9480 : see if fchmod exists
9481 set fchmod d_fchmod
9482 eval $inlibc
9483
9484 : see if fchown exists
9485 set fchown d_fchown
9486 eval $inlibc
9487
9488 : see if this is an fcntl system
9489 set fcntl d_fcntl
9490 eval $inlibc
9491
9492 echo " "
9493 : See if fcntl-based locking works.
9494 $cat >try.c <<'EOCP'
9495 #include <stdlib.h>
9496 #include <unistd.h>
9497 #include <fcntl.h>
9498 int main() {
9499 #if defined(F_SETLK) && defined(F_SETLKW)
9500      struct flock flock;
9501      int retval, fd;
9502      fd = open("try.c", O_RDONLY);
9503      flock.l_type = F_RDLCK;
9504      flock.l_whence = SEEK_SET;
9505      flock.l_start = flock.l_len = 0;
9506      retval = fcntl(fd, F_SETLK, &flock);
9507      close(fd);
9508      (retval < 0 ? exit(2) : exit(0));
9509 #else
9510      exit(2);
9511 #endif
9512 }
9513 EOCP
9514 echo "Checking if fcntl-based file locking works... "
9515 case "$d_fcntl" in
9516 "$define")
9517         set try
9518         if eval $compile_ok; then
9519                 if ./try; then
9520                         echo "Yes, it seems to work."
9521                         val="$define"
9522                 else
9523                         echo "Nope, it didn't work."
9524                         val="$undef"
9525                 fi
9526         else
9527                 echo "I'm unable to compile the test program, so I'll assume not."
9528                 val="$undef"
9529         fi
9530         ;;
9531 *) val="$undef";
9532         echo "Nope, since you don't even have fcntl()."
9533         ;;
9534 esac
9535 set d_fcntl_can_lock
9536 eval $setvar
9537 $rm -f try*
9538
9539
9540 : see if sys/select.h has to be included
9541 set sys/select.h i_sysselct
9542 eval $inhdr
9543
9544 : see if we should include time.h, sys/time.h, or both
9545 echo " "
9546 if test "X$timeincl" = X; then
9547         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9548         $echo $n "I'm now running the test program...$c"
9549         $cat >try.c <<'EOCP'
9550 #include <sys/types.h>
9551 #ifdef I_TIME
9552 #include <time.h>
9553 #endif
9554 #ifdef I_SYSTIME
9555 #ifdef SYSTIMEKERNEL
9556 #define KERNEL
9557 #endif
9558 #include <sys/time.h>
9559 #endif
9560 #ifdef I_SYSSELECT
9561 #include <sys/select.h>
9562 #endif
9563 int main()
9564 {
9565         struct tm foo;
9566 #ifdef S_TIMEVAL
9567         struct timeval bar;
9568 #endif
9569 #ifdef S_TIMEZONE
9570         struct timezone tzp;
9571 #endif
9572         if (foo.tm_sec == foo.tm_sec)
9573                 exit(0);
9574 #ifdef S_TIMEVAL
9575         if (bar.tv_sec == bar.tv_sec)
9576                 exit(0);
9577 #endif
9578         exit(1);
9579 }
9580 EOCP
9581         flags=''
9582         for s_timezone in '-DS_TIMEZONE' ''; do
9583         sysselect=''
9584         for s_timeval in '-DS_TIMEVAL' ''; do
9585         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9586         for i_time in '' '-DI_TIME'; do
9587         for i_systime in '-DI_SYSTIME' ''; do
9588                 case "$flags" in
9589                 '') $echo $n ".$c"
9590                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9591                         if eval $compile; then
9592                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9593                                 shift
9594                                 flags="$*"
9595                                 echo " "
9596                                 $echo $n "Succeeded with $flags$c"
9597                         fi
9598                         ;;
9599                 esac
9600         done
9601         done
9602         done
9603         done
9604         done
9605         timeincl=''
9606         echo " "
9607         case "$flags" in
9608         *SYSTIMEKERNEL*) i_systimek="$define"
9609                 timeincl=`./findhdr sys/time.h`
9610                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9611         *) i_systimek="$undef";;
9612         esac
9613         case "$flags" in
9614         *I_TIME*) i_time="$define"
9615                 timeincl=`./findhdr time.h`" $timeincl"
9616                 echo "We'll include <time.h>." >&4;;
9617         *) i_time="$undef";;
9618         esac
9619         case "$flags" in
9620         *I_SYSTIME*) i_systime="$define"
9621                 timeincl=`./findhdr sys/time.h`" $timeincl"
9622                 echo "We'll include <sys/time.h>." >&4;;
9623         *) i_systime="$undef";;
9624         esac
9625         $rm -f try.c try
9626 fi
9627
9628 : check for fd_set items
9629 $cat <<EOM
9630
9631 Checking to see how well your C compiler handles fd_set and friends ...
9632 EOM
9633 $cat >fd_set.c <<EOCP
9634 #$i_systime I_SYS_TIME
9635 #$i_sysselct I_SYS_SELECT
9636 #$d_socket HAS_SOCKET
9637 #include <sys/types.h>
9638 #ifdef HAS_SOCKET
9639 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9640 #endif
9641 #ifdef I_SYS_TIME
9642 #include <sys/time.h>
9643 #endif
9644 #ifdef I_SYS_SELECT
9645 #include <sys/select.h>
9646 #endif
9647 int main() {
9648         fd_set fds;
9649
9650 #ifdef TRYBITS
9651         if(fds.fds_bits);
9652 #endif
9653
9654 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9655         exit(0);
9656 #else
9657         exit(1);
9658 #endif
9659 }
9660 EOCP
9661 set fd_set -DTRYBITS
9662 if eval $compile; then
9663         d_fds_bits="$define"
9664         d_fd_set="$define"
9665         echo "Well, your system knows about the normal fd_set typedef..." >&4
9666         if ./fd_set; then
9667                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9668                 d_fd_macros="$define"
9669         else
9670                 $cat >&4 <<'EOM'
9671 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9672 EOM
9673                 d_fd_macros="$undef"
9674         fi
9675 else
9676         $cat <<'EOM'
9677 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9678 EOM
9679         set fd_set
9680         if eval $compile; then
9681                 d_fds_bits="$undef"
9682                 d_fd_set="$define"
9683                 echo "Well, your system has some sort of fd_set available..." >&4
9684                 if ./fd_set; then
9685                         echo "and you have the normal fd_set macros." >&4
9686                         d_fd_macros="$define"
9687                 else
9688                         $cat <<'EOM'
9689 but not the normal fd_set macros!  Gross!  More work for me...
9690 EOM
9691                         d_fd_macros="$undef"
9692                 fi
9693         else
9694         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9695                 d_fd_set="$undef"
9696                 d_fds_bits="$undef"
9697                 d_fd_macros="$undef"
9698         fi
9699 fi
9700 $rm -f fd_set*
9701
9702 : see if fgetpos exists
9703 set fgetpos d_fgetpos
9704 eval $inlibc
9705
9706 : see if flock exists
9707 set flock d_flock
9708 eval $inlibc
9709
9710 : see if fork exists
9711 set fork d_fork
9712 eval $inlibc
9713
9714 : see if pathconf exists
9715 set pathconf d_pathconf
9716 eval $inlibc
9717
9718 : see if fpathconf exists
9719 set fpathconf d_fpathconf
9720 eval $inlibc
9721
9722
9723 : check for fpos64_t
9724 echo " "
9725 echo "Checking to see if you have fpos64_t..." >&4
9726 $cat >try.c <<EOCP
9727 #include <stdio.h>
9728 int main() { fpos64_t x = 7; }
9729 EOCP
9730 set try
9731 if eval $compile; then
9732         val="$define"
9733         echo "You have fpos64_t."
9734 else
9735         val="$undef"
9736         echo "You do not have fpos64_t."
9737         case "$fpossize" in
9738         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9739         esac
9740 fi
9741 $rm -f try.* try
9742 set d_fpos64_t
9743 eval $setvar
9744
9745 : see if frexpl exists
9746 set frexpl d_frexpl
9747 eval $inlibc
9748
9749 : see if this is a sys/param system
9750 set sys/param.h i_sysparam
9751 eval $inhdr
9752
9753 : see if this is a sys/mount.h system
9754 set sys/mount.h i_sysmount
9755 eval $inhdr
9756
9757
9758 echo " "
9759 echo "Checking to see if your system supports struct fs_data..." >&4
9760 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9761 eval $hasstruct
9762 case "$d_fs_data_s" in
9763 "$define")      echo "Yes, it does."   ;;
9764 *)              echo "No, it doesn't." ;;
9765 esac
9766
9767 : see if fseeko exists
9768 set fseeko d_fseeko
9769 eval $inlibc
9770 case "$longsize" in
9771 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9772 esac
9773
9774 : see if fsetpos exists
9775 set fsetpos d_fsetpos
9776 eval $inlibc
9777
9778
9779 : see if fstatfs exists
9780 set fstatfs d_fstatfs
9781 eval $inlibc
9782
9783
9784 : see if statvfs exists
9785 set statvfs d_statvfs
9786 eval $inlibc
9787
9788 : see if fstatvfs exists
9789 set fstatvfs d_fstatvfs
9790 eval $inlibc
9791
9792
9793 : see if fsync exists
9794 set fsync d_fsync
9795 eval $inlibc
9796
9797 : see if ftello exists
9798 set ftello d_ftello
9799 eval $inlibc
9800 case "$longsize" in
9801 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9802 esac
9803
9804 : see if getcwd exists
9805 set getcwd d_getcwd
9806 eval $inlibc
9807
9808 : see if getespwnam exists
9809 set getespwnam d_getespwnam
9810 eval $inlibc
9811
9812
9813 : see if getfsstat exists
9814 set getfsstat d_getfsstat
9815 eval $inlibc
9816
9817 : see if getgrent exists
9818 set getgrent d_getgrent
9819 eval $inlibc
9820
9821 : see if gethostbyaddr exists
9822 set gethostbyaddr d_gethbyaddr
9823 eval $inlibc
9824
9825 : see if gethostbyname exists
9826 set gethostbyname d_gethbyname
9827 eval $inlibc
9828
9829 : see if gethostent exists
9830 set gethostent d_gethent
9831 eval $inlibc
9832
9833 : see how we will look up host name
9834 echo " "
9835 call=''
9836 if set gethostname val -f d_gethname; eval $csym; $val; then
9837         echo 'gethostname() found.' >&4
9838         d_gethname="$define"
9839         call=gethostname
9840 fi
9841 if set uname val -f d_uname; eval $csym; $val; then
9842         if ./xenix; then
9843                 $cat <<'EOM'
9844 uname() was found, but you're running xenix, and older versions of xenix
9845 have a broken uname(). If you don't really know whether your xenix is old
9846 enough to have a broken system call, use the default answer.
9847
9848 EOM
9849                 dflt=y
9850                 case "$d_uname" in
9851                 "$define") dflt=n;;
9852                 esac
9853                 rp='Is your uname() broken?'
9854                 . ./myread
9855                 case "$ans" in
9856                 n*) d_uname="$define"; call=uname;;
9857                 esac
9858         else
9859                 echo 'uname() found.' >&4
9860                 d_uname="$define"
9861                 case "$call" in
9862                 '') call=uname ;;
9863                 esac
9864         fi
9865 fi
9866 case "$d_gethname" in
9867 '') d_gethname="$undef";;
9868 esac
9869 case "$d_uname" in
9870 '') d_uname="$undef";;
9871 esac
9872 case "$d_uname$d_gethname" in
9873 *define*)
9874         dflt=n
9875         cat <<EOM
9876  
9877 Every now and then someone has a $call() that lies about the hostname
9878 but can't be fixed for political or economic reasons.  If you wish, I can
9879 pretend $call() isn't there and maybe compute hostname at run-time
9880 thanks to the '$phostname' command.
9881
9882 EOM
9883         rp="Shall I ignore $call() from now on?"
9884         . ./myread
9885         case "$ans" in
9886         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9887         esac;;
9888 esac
9889 case "$phostname" in
9890 '') aphostname='';;
9891 *) case "$aphostname" in
9892         /*) ;;
9893         *) set X $phostname
9894                 shift
9895                 file=$1
9896                 shift
9897                 file=`./loc $file $file $pth`
9898                 aphostname=`echo $file $*`
9899                 ;;
9900         esac
9901         ;;
9902 esac
9903 case "$d_uname$d_gethname" in
9904 *define*) ;;
9905 *)
9906         case "$phostname" in
9907         '')
9908                 echo "There will be no way for $package to get your hostname." >&4;;
9909         *)
9910         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9911                 ;;
9912         esac;;
9913 esac
9914 case "$d_phostname" in
9915 '') d_phostname="$undef";;
9916 esac
9917
9918 : see if this is a netdb.h system
9919 set netdb.h i_netdb
9920 eval $inhdr
9921
9922 : see if prototypes for various gethostxxx netdb.h functions are available
9923 echo " "
9924 set d_gethostprotos gethostent $i_netdb netdb.h
9925 eval $hasproto
9926
9927 : see if getitimer exists
9928 set getitimer d_getitimer
9929 eval $inlibc
9930
9931 : see if getlogin exists
9932 set getlogin d_getlogin
9933 eval $inlibc
9934
9935 : see if getmnt exists
9936 set getmnt d_getmnt
9937 eval $inlibc
9938
9939 : see if getmntent exists
9940 set getmntent d_getmntent
9941 eval $inlibc
9942
9943 : see if getnetbyaddr exists
9944 set getnetbyaddr d_getnbyaddr
9945 eval $inlibc
9946
9947 : see if getnetbyname exists
9948 set getnetbyname d_getnbyname
9949 eval $inlibc
9950
9951 : see if getnetent exists
9952 set getnetent d_getnent
9953 eval $inlibc
9954
9955 : see if prototypes for various getnetxxx netdb.h functions are available
9956 echo " "
9957 set d_getnetprotos getnetent $i_netdb netdb.h
9958 eval $hasproto
9959
9960 : see if getpagesize exists
9961 set getpagesize d_getpagsz
9962 eval $inlibc
9963
9964
9965 : see if getprotobyname exists
9966 set getprotobyname d_getpbyname
9967 eval $inlibc
9968
9969 : see if getprotobynumber exists
9970 set getprotobynumber d_getpbynumber
9971 eval $inlibc
9972
9973 : see if getprotoent exists
9974 set getprotoent d_getpent
9975 eval $inlibc
9976
9977 : see if getpgid exists
9978 set getpgid d_getpgid
9979 eval $inlibc
9980
9981 : see if getpgrp2 exists
9982 set getpgrp2 d_getpgrp2
9983 eval $inlibc
9984
9985 : see if getppid exists
9986 set getppid d_getppid
9987 eval $inlibc
9988
9989 : see if getpriority exists
9990 set getpriority d_getprior
9991 eval $inlibc
9992
9993 : see if prototypes for various getprotoxxx netdb.h functions are available
9994 echo " "
9995 set d_getprotoprotos getprotoent $i_netdb netdb.h
9996 eval $hasproto
9997
9998 : see if getprpwnam exists
9999 set getprpwnam d_getprpwnam
10000 eval $inlibc
10001
10002 : see if getpwent exists
10003 set getpwent d_getpwent
10004 eval $inlibc
10005
10006
10007 : see if getservbyname exists
10008 set getservbyname d_getsbyname
10009 eval $inlibc
10010
10011 : see if getservbyport exists
10012 set getservbyport d_getsbyport
10013 eval $inlibc
10014
10015 : see if getservent exists
10016 set getservent d_getsent
10017 eval $inlibc
10018
10019 : see if prototypes for various getservxxx netdb.h functions are available
10020 echo " "
10021 set d_getservprotos getservent $i_netdb netdb.h
10022 eval $hasproto
10023
10024 : see if getspnam exists
10025 set getspnam d_getspnam
10026 eval $inlibc
10027
10028 : see if gettimeofday or ftime exists
10029 set gettimeofday d_gettimeod
10030 eval $inlibc
10031 case "$d_gettimeod" in
10032 "$undef")
10033         set ftime d_ftime 
10034         eval $inlibc
10035         ;;
10036 *)
10037         val="$undef"; set d_ftime; eval $setvar
10038         ;;
10039 esac
10040 case "$d_gettimeod$d_ftime" in
10041 "$undef$undef")
10042         echo " "
10043         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10044         ;;
10045 esac
10046
10047 : see if this is an grp system
10048 set grp.h i_grp
10049 eval $inhdr
10050
10051 case "$i_grp" in
10052 $define)
10053         xxx=`./findhdr grp.h`
10054         $cppstdin $cppflags $cppminus < $xxx >$$.h
10055
10056         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10057                 val="$define"
10058         else
10059                 val="$undef"
10060         fi
10061         set d_grpasswd
10062         eval $setvar
10063
10064         $rm -f $$.h
10065         ;;
10066 *)
10067         val="$undef";
10068         set d_grpasswd; eval $setvar
10069         ;;
10070 esac
10071
10072 : see if hasmntopt exists
10073 set hasmntopt d_hasmntopt
10074 eval $inlibc
10075
10076 : see if this is a netinet/in.h or sys/in.h system
10077 set netinet/in.h i_niin sys/in.h i_sysin
10078 eval $inhdr
10079
10080 : see if arpa/inet.h has to be included
10081 set arpa/inet.h i_arpainet
10082 eval $inhdr
10083
10084 : see if htonl --and friends-- exists
10085 val=''
10086 set htonl val
10087 eval $inlibc
10088
10089 : Maybe they are macros.
10090 case "$val" in
10091 $undef)
10092         $cat >htonl.c <<EOM
10093 #include <stdio.h>
10094 #include <sys/types.h>
10095 #$i_niin I_NETINET_IN
10096 #$i_sysin I_SYS_IN
10097 #$i_arpainet I_ARPA_INET
10098 #ifdef I_NETINET_IN
10099 #include <netinet/in.h>
10100 #endif
10101 #ifdef I_SYS_IN
10102 #include <sys/in.h>
10103 #endif
10104 #ifdef I_ARPA_INET
10105 #include <arpa/inet.h>
10106 #endif
10107 #ifdef htonl
10108 printf("Defined as a macro.");
10109 #endif
10110 EOM
10111         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10112         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10113                 val="$define"
10114                 echo "But it seems to be defined as a macro." >&4
10115         fi
10116         $rm -f htonl.?
10117         ;;
10118 esac
10119 set d_htonl
10120 eval $setvar
10121
10122 : see if iconv exists
10123 set iconv d_iconv
10124 eval $inlibc
10125
10126 : index or strchr
10127 echo " "
10128 if set index val -f; eval $csym; $val; then
10129         if set strchr val -f d_strchr; eval $csym; $val; then
10130                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10131                         val="$define"
10132                         vali="$undef"
10133                         echo "strchr() found." >&4
10134                 else
10135                         val="$undef"
10136                         vali="$define"
10137                         echo "index() found." >&4
10138                 fi
10139         else
10140                 val="$undef"
10141                 vali="$define"
10142                 echo "index() found." >&4
10143         fi
10144 else
10145         if set strchr val -f d_strchr; eval $csym; $val; then
10146                 val="$define"
10147                 vali="$undef"
10148                 echo "strchr() found." >&4
10149         else
10150                 echo "No index() or strchr() found!" >&4
10151                 val="$undef"
10152                 vali="$undef"
10153         fi
10154 fi
10155 set d_strchr; eval $setvar
10156 val="$vali"
10157 set d_index; eval $setvar
10158
10159 : check whether inet_aton exists
10160 set inet_aton d_inetaton
10161 eval $inlibc
10162
10163 : Look for isascii
10164 echo " "
10165 $cat >isascii.c <<'EOCP'
10166 #include <stdio.h>
10167 #include <ctype.h>
10168 int main() {
10169         int c = 'A';
10170         if (isascii(c))
10171                 exit(0);
10172         else
10173                 exit(1);
10174 }
10175 EOCP
10176 set isascii
10177 if eval $compile; then
10178         echo "isascii() found." >&4
10179         val="$define"
10180 else
10181         echo "isascii() NOT found." >&4
10182         val="$undef"
10183 fi
10184 set d_isascii
10185 eval $setvar
10186 $rm -f isascii*
10187
10188 : see if isnan exists
10189 set isnan d_isnan
10190 eval $inlibc
10191
10192 : see if isnanl exists
10193 set isnanl d_isnanl
10194 eval $inlibc
10195
10196 : see if killpg exists
10197 set killpg d_killpg
10198 eval $inlibc
10199
10200 : see if lchown exists
10201 echo " "
10202 $cat > try.c <<'EOCP'
10203 /* System header to define __stub macros and hopefully few prototypes,
10204     which can conflict with char lchown(); below.  */
10205 #include <assert.h>
10206 /* Override any gcc2 internal prototype to avoid an error.  */
10207 /* We use char because int might match the return type of a gcc2
10208    builtin and then its argument prototype would still apply.  */
10209 char lchown();
10210 int main() {
10211     /*  The GNU C library defines this for functions which it implements
10212         to always fail with ENOSYS.  Some functions are actually named
10213         something starting with __ and the normal name is an alias.  */
10214 #if defined (__stub_lchown) || defined (__stub___lchown)
10215 choke me
10216 #else
10217 lchown();
10218 #endif
10219 ; return 0; }
10220 EOCP
10221 set try
10222 if eval $compile; then
10223     $echo "lchown() found." >&4
10224     val="$define"
10225 else
10226     $echo "lchown() NOT found." >&4
10227     val="$undef"
10228 fi
10229 set d_lchown
10230 eval $setvar
10231
10232 : See if number of significant digits in a double precision number is known
10233 echo " "
10234 $cat >ldbl_dig.c <<EOM
10235 #$i_limits I_LIMITS
10236 #$i_float I_FLOAT
10237 #ifdef I_LIMITS
10238 #include <limits.h>
10239 #endif
10240 #ifdef I_FLOAT
10241 #include <float.h>
10242 #endif
10243 #ifdef LDBL_DIG
10244 printf("Contains LDBL_DIG");
10245 #endif
10246 EOM
10247 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10248 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10249         echo "LDBL_DIG found." >&4
10250         val="$define"
10251 else
10252         echo "LDBL_DIG NOT found." >&4
10253         val="$undef"
10254 fi
10255 $rm -f ldbl_dig.?
10256 set d_ldbl_dig
10257 eval $setvar
10258
10259 : see if link exists
10260 set link d_link
10261 eval $inlibc
10262
10263 : see if localeconv exists
10264 set localeconv d_locconv
10265 eval $inlibc
10266
10267 : see if lockf exists
10268 set lockf d_lockf
10269 eval $inlibc
10270
10271 : see if prototype for lseek is available
10272 echo " "
10273 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10274 eval $hasproto
10275
10276 : see if lstat exists
10277 set lstat d_lstat
10278 eval $inlibc
10279
10280 : see if madvise exists
10281 set madvise d_madvise
10282 eval $inlibc
10283
10284 : see if mblen exists
10285 set mblen d_mblen
10286 eval $inlibc
10287
10288 : see if mbstowcs exists
10289 set mbstowcs d_mbstowcs
10290 eval $inlibc
10291
10292 : see if mbtowc exists
10293 set mbtowc d_mbtowc
10294 eval $inlibc
10295
10296 : see if memchr exists
10297 set memchr d_memchr
10298 eval $inlibc
10299
10300 : see if memcmp exists
10301 set memcmp d_memcmp
10302 eval $inlibc
10303
10304 : see if memcpy exists
10305 set memcpy d_memcpy
10306 eval $inlibc
10307
10308 : see if memmove exists
10309 set memmove d_memmove
10310 eval $inlibc
10311
10312 : see if memset exists
10313 set memset d_memset
10314 eval $inlibc
10315
10316 : see if mkdir exists
10317 set mkdir d_mkdir
10318 eval $inlibc
10319
10320 : see if mkdtemp exists
10321 set mkdtemp d_mkdtemp
10322 eval $inlibc
10323
10324 : see if mkfifo exists
10325 set mkfifo d_mkfifo
10326 eval $inlibc
10327
10328 : see if mkstemp exists
10329 set mkstemp d_mkstemp
10330 eval $inlibc
10331
10332 : see if mkstemps exists
10333 set mkstemps d_mkstemps
10334 eval $inlibc
10335
10336 : see if mktime exists
10337 set mktime d_mktime
10338 eval $inlibc
10339
10340 : see if this is a sys/mman.h system
10341 set sys/mman.h i_sysmman
10342 eval $inhdr
10343
10344 : see if mmap exists
10345 set mmap d_mmap
10346 eval $inlibc
10347 : see what shmat returns
10348 : default to something harmless
10349 mmaptype='void *'
10350 case "$i_sysmman$d_mmap" in
10351 "$define$define")
10352         $cat >mmap.c <<'END'
10353 #include <sys/mman.h>
10354 void *mmap();
10355 END
10356         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10357                 mmaptype='void *'
10358         else
10359                 mmaptype='caddr_t'
10360         fi
10361         echo "and it returns ($mmaptype)." >&4
10362         ;;
10363 esac
10364
10365
10366
10367 : see if modfl exists
10368 set modfl d_modfl
10369 eval $inlibc
10370
10371 : see if mprotect exists
10372 set mprotect d_mprotect
10373 eval $inlibc
10374
10375 : see if msgctl exists
10376 set msgctl d_msgctl
10377 eval $inlibc
10378
10379 : see if msgget exists
10380 set msgget d_msgget
10381 eval $inlibc
10382
10383 : see if msgsnd exists
10384 set msgsnd d_msgsnd
10385 eval $inlibc
10386
10387 : see if msgrcv exists
10388 set msgrcv d_msgrcv
10389 eval $inlibc
10390
10391 : see how much of the 'msg*(2)' library is present.
10392 h_msg=true
10393 echo " "
10394 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10395 *"$undef"*) h_msg=false;;
10396 esac
10397 case "$osname" in
10398 freebsd)
10399     case "`ipcs 2>&1`" in
10400     "SVID messages"*"not configured"*)
10401         echo "Your $osname does not have the msg*(2) configured." >&4
10402         h_msg=false
10403         val="$undef"
10404         set msgctl d_msgctl
10405         eval $setvar
10406         set msgget d_msgget
10407         eval $setvar
10408         set msgsnd d_msgsnd
10409         eval $setvar
10410         set msgrcv d_msgrcv
10411         eval $setvar
10412         ;;
10413     esac
10414     ;;
10415 esac
10416 : we could also check for sys/ipc.h ...
10417 if $h_msg && $test `./findhdr sys/msg.h`; then
10418         echo "You have the full msg*(2) library." >&4
10419         val="$define"
10420 else
10421         echo "You don't have the full msg*(2) library." >&4
10422         val="$undef"
10423 fi
10424 set d_msg
10425 eval $setvar
10426
10427
10428 echo " "
10429 echo "Checking to see if your system supports struct msghdr..." >&4
10430 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10431 eval $hasstruct
10432 case "$d_msghdr_s" in
10433 "$define")      echo "Yes, it does."   ;;
10434 *)              echo "No, it doesn't." ;;
10435 esac
10436
10437
10438 : see if msync exists
10439 set msync d_msync
10440 eval $inlibc
10441
10442 : see if munmap exists
10443 set munmap d_munmap
10444 eval $inlibc
10445
10446 : see if nice exists
10447 set nice d_nice
10448 eval $inlibc
10449
10450 : check for length of character
10451 echo " "
10452 case "$charsize" in
10453 '')
10454         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10455         $cat >try.c <<'EOCP'
10456 #include <stdio.h>
10457 int main()
10458 {
10459     printf("%d\n", (int)sizeof(char));
10460     exit(0);
10461 }
10462 EOCP
10463         set try
10464         if eval $compile_ok; then
10465                 dflt=`./try`
10466         else
10467                 dflt='1'
10468                 echo "(I can't seem to compile the test program.  Guessing...)"
10469         fi
10470         ;;
10471 *)
10472         dflt="$charsize"
10473         ;;
10474 esac
10475 rp="What is the size of a character (in bytes)?"
10476 . ./myread
10477 charsize="$ans"
10478 $rm -f try.c try
10479
10480 : check for volatile keyword
10481 echo " "
10482 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10483 $cat >try.c <<'EOCP'
10484 int main()
10485 {
10486         typedef struct _goo_struct goo_struct;
10487         goo_struct * volatile goo = ((goo_struct *)0);
10488         struct _goo_struct {
10489                 long long_int;
10490                 int reg_int;
10491                 char char_var;
10492         };
10493         typedef unsigned short foo_t;
10494         char *volatile foo;
10495         volatile int bar;
10496         volatile foo_t blech;
10497         foo = foo;
10498 }
10499 EOCP
10500 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10501         val="$define"
10502         echo "Yup, it does."
10503 else
10504         val="$undef"
10505         echo "Nope, it doesn't."
10506 fi
10507 set d_volatile
10508 eval $setvar
10509 $rm -f try.*
10510
10511
10512 echo " "
10513 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10514
10515 case "$use64bitint:$d_quad:$quadtype" in
10516 define:define:?*)
10517         ivtype="$quadtype"
10518         uvtype="$uquadtype"
10519         ivsize=8
10520         uvsize=8
10521         ;;
10522 *)      ivtype="long"
10523         uvtype="unsigned long"
10524         ivsize=$longsize
10525         uvsize=$longsize
10526         ;;
10527 esac
10528
10529 case "$uselongdouble:$d_longdbl" in
10530 define:define)
10531         nvtype="long double"
10532         nvsize=$longdblsize
10533         ;;
10534 *)      nvtype=double
10535         nvsize=$doublesize
10536         ;;
10537 esac
10538
10539 $echo "(IV will be "$ivtype", $ivsize bytes)"
10540 $echo "(UV will be "$uvtype", $uvsize bytes)"
10541 $echo "(NV will be "$nvtype", $nvsize bytes)"
10542
10543 $cat >try.c <<EOCP
10544 #$i_inttypes I_INTTYPES
10545 #ifdef I_INTTYPES
10546 #include <inttypes.h>
10547 #endif
10548 #include <stdio.h>
10549 int main() {
10550 #ifdef INT8
10551    int8_t i =  INT8_MAX;
10552   uint8_t u = UINT8_MAX;
10553   printf("int8_t\n");
10554 #endif
10555 #ifdef INT16
10556    int16_t i =  INT16_MAX;
10557   uint16_t i = UINT16_MAX;
10558   printf("int16_t\n");
10559 #endif
10560 #ifdef INT32
10561    int32_t i =  INT32_MAX;
10562   uint32_t u = UINT32_MAX;
10563   printf("int32_t\n");
10564 #endif
10565 }
10566 EOCP
10567
10568 case "$i8type" in
10569 '')     case "$charsize" in
10570         1)      i8type=char
10571                 u8type="unsigned char"
10572                 i8size=$charsize
10573                 u8size=$charsize
10574                 ;;
10575         esac
10576         ;;
10577 esac
10578 case "$i8type" in
10579 '')     set try -DINT8
10580         if eval $compile; then
10581                 case "`./try$exe_ext`" in
10582                 int8_t) i8type=int8_t
10583                         u8type=uint8_t
10584                         i8size=1
10585                         u8size=1
10586                         ;;
10587                 esac
10588         fi
10589         ;;
10590 esac
10591 case "$i8type" in
10592 '')     if $test $charsize -ge 1; then
10593                 i8type=char
10594                 u8type="unsigned char"
10595                 i8size=$charsize
10596                 u8size=$charsize
10597         fi
10598         ;;
10599 esac
10600
10601 case "$i16type" in
10602 '')     case "$shortsize" in
10603         2)      i16type=short
10604                 u16type="unsigned short"
10605                 i16size=$shortsize
10606                 u16size=$shortsize
10607                 ;;
10608         esac
10609         ;;
10610 esac
10611 case "$i16type" in
10612 '')     set try -DINT16
10613         if eval $compile; then
10614                 case "`./try$exe_ext`" in
10615                 int16_t)
10616                         i16type=int16_t
10617                         u16type=uint16_t
10618                         i16size=2
10619                         u16size=2
10620                         ;;
10621                 esac
10622         fi
10623         ;;
10624 esac
10625 case "$i16type" in
10626 '')     if $test $shortsize -ge 2; then
10627                 i16type=short
10628                 u16type="unsigned short"
10629                 i16size=$shortsize
10630                 u16size=$shortsize
10631         fi
10632         ;;
10633 esac
10634
10635 case "$i32type" in
10636 '')     case "$longsize" in
10637         4)      i32type=long
10638                 u32type="unsigned long"
10639                 i32size=$longsize
10640                 u32size=$longsize
10641                 ;;
10642         *)      case "$intsize" in
10643                 4)      i32type=int
10644                         u32type="unsigned int"
10645                         i32size=$intsize
10646                         u32size=$intsize
10647                         ;;
10648                 esac
10649                 ;;
10650         esac
10651         ;;
10652 esac
10653 case "$i32type" in
10654 '')     set try -DINT32
10655         if eval $compile; then
10656                 case "`./try$exe_ext`" in
10657                 int32_t)
10658                         i32type=int32_t
10659                         u32type=uint32_t
10660                         i32size=4
10661                         u32size=4
10662                         ;;
10663                 esac
10664         fi
10665         ;;
10666 esac
10667 case "$i32type" in
10668 '')     if $test $intsize -ge 4; then
10669                 i32type=int
10670                 u32type="unsigned int"
10671                 i32size=$intsize
10672                 u32size=$intsize
10673         fi
10674         ;;
10675 esac
10676
10677 case "$i64type" in
10678 '')     case "$d_quad:$quadtype" in
10679         define:?*)
10680                 i64type="$quadtype"
10681                 u64type="$uquadtype"
10682                 i64size=8
10683                 u64size=8
10684                 ;;
10685         esac
10686         ;;
10687 esac
10688
10689 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10690 : volatile so that the compiler has to store it out to memory.
10691 if test X"$d_volatile" = X"$define"; then
10692         volatile=volatile
10693 fi
10694 $cat <<EOP >try.c
10695 #include <stdio.h>
10696 #include <sys/types.h>
10697 #include <signal.h>
10698 #ifdef SIGFPE
10699 $volatile int bletched = 0;
10700 $signal_t blech(s) int s; { bletched = 1; }
10701 #endif
10702 int main() {
10703     $uvtype u = 0;
10704     $nvtype d;
10705     int     n = 8 * $uvsize;
10706     int     i;
10707 #ifdef SIGFPE
10708     signal(SIGFPE, blech);
10709 #endif
10710
10711     for (i = 0; i < n; i++) {
10712       u = u << 1 | ($uvtype)1;
10713       d = ($nvtype)u;
10714       if (($uvtype)d != u)
10715         break;
10716       if (d <= 0)
10717         break;
10718       d = ($nvtype)(u - 1);
10719       if (($uvtype)d != (u - 1))
10720         break;
10721 #ifdef SIGFPE
10722       if (bletched) {
10723         break;
10724 #endif
10725       } 
10726     }
10727     printf("%d\n", ((i == n) ? -n : i));
10728     exit(0);
10729 }
10730 EOP
10731 set try
10732
10733 d_nv_preserves_uv="$undef"
10734 if eval $compile; then
10735         d_nv_preserves_uv_bits="`./try$exe_ext`"
10736 fi
10737 case "$d_nv_preserves_uv_bits" in
10738 \-[1-9]*)       
10739         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10740         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10741         d_nv_preserves_uv="$define"
10742         ;;
10743 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10744         d_nv_preserves_uv="$undef" ;;
10745 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10746         d_nv_preserves_uv_bits="$undef" ;;
10747 esac
10748
10749 $rm -f try.* try
10750
10751
10752 : check for off64_t
10753 echo " "
10754 echo "Checking to see if you have off64_t..." >&4
10755 $cat >try.c <<EOCP
10756 #include <sys/types.h>
10757 #include <unistd.h>
10758 int main() { off64_t x = 7; }
10759 EOCP
10760 set try
10761 if eval $compile; then
10762         val="$define"
10763         echo "You have off64_t."
10764 else
10765         val="$undef"
10766         echo "You do not have off64_t."
10767         case "$lseeksize" in
10768         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10769         esac
10770 fi
10771 $rm -f try.* try
10772 set d_off64_t
10773 eval $setvar
10774
10775 : see if POSIX threads are available
10776 set pthread.h i_pthread
10777 eval $inhdr
10778
10779
10780
10781
10782 : how to create joinable pthreads
10783 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10784         echo " "
10785         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10786         $cat >try.c <<'EOCP'
10787 #include <pthread.h>
10788 int main() {
10789     int detachstate = JOINABLE;
10790 }
10791 EOCP
10792         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10793         if eval $compile; then
10794                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10795                 val="$undef" # Yes, undef.
10796                 set d_old_pthread_create_joinable
10797                 eval $setvar
10798                 val=""
10799                 set old_pthread_create_joinable
10800                 eval $setvar
10801         else
10802                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10803                 if eval $compile; then
10804                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10805                         val="$define"
10806                         set d_old_pthread_create_joinable
10807                         eval $setvar
10808                         val=PTHREAD_CREATE_UNDETACHED
10809                         set old_pthread_create_joinable
10810                         eval $setvar
10811                 else            
10812                         set try -DJOINABLE=__UNDETACHED
10813                         if eval $compile; then
10814                                 echo "You seem to use __UNDETACHED." >&4
10815                                 val="$define"
10816                                 set d_old_pthread_create_joinable
10817                                 eval $setvar
10818                                 val=__UNDETACHED
10819                                 set old_pthread_create_joinable
10820                                 eval $setvar
10821                         else
10822                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10823                                 val="$define"
10824                                 set d_old_pthread_create_joinable
10825                                 eval $setvar
10826                                 val=0
10827                                 set old_pthread_create_joinable
10828                                 eval $setvar
10829                         fi
10830                 fi
10831         fi
10832         $rm -f try try.*
10833 else
10834     d_old_pthread_create_joinable="$undef"
10835     old_pthread_create_joinable=""
10836 fi
10837
10838 : see if pause exists
10839 set pause d_pause
10840 eval $inlibc
10841
10842 : see if pipe exists
10843 set pipe d_pipe
10844 eval $inlibc
10845
10846 : see if poll exists
10847 set poll d_poll
10848 eval $inlibc
10849
10850
10851 : see whether the various POSIXish _yields exist
10852 $cat >try.c <<EOP
10853 #include <pthread.h>
10854 #include <stdio.h>
10855 int main() {
10856 #ifdef SCHED_YIELD
10857         sched_yield();
10858 #else
10859 #ifdef PTHREAD_YIELD
10860         pthread_yield();
10861 #else
10862 #ifdef PTHREAD_YIELD_NULL
10863         pthread_yield(NULL);
10864 #endif
10865 #endif
10866 #endif
10867 }
10868 EOP
10869 : see if sched_yield exists
10870 set try -DSCHED_YIELD
10871 if eval $compile; then
10872     val="$define"
10873     sched_yield='sched_yield()'
10874 else
10875     val="$undef"
10876 fi
10877 case "$usethreads" in
10878 $define)
10879         case "$val" in
10880         $define) echo 'sched_yield() found.' >&4        ;;
10881         *)       echo 'sched_yield() NOT found.' >&4    ;;
10882         esac
10883 esac
10884 set d_sched_yield
10885 eval $setvar
10886
10887 : see if pthread_yield exists
10888 set try -DPTHREAD_YIELD
10889 if eval $compile; then
10890     val="$define"
10891     case "$sched_yield" in
10892     '') sched_yield='pthread_yield()' ;;
10893     esac
10894 else
10895     set try -DPTHREAD_YIELD_NULL
10896     if eval $compile; then
10897         val="$define"
10898         case "$sched_yield" in
10899         '') sched_yield='pthread_yield(NULL)' ;;
10900         esac
10901     else
10902         val="$undef"
10903     fi
10904 fi
10905 case "$usethreads" in
10906 $define)
10907         case "$val" in
10908         $define) echo 'pthread_yield() found.' >&4      ;;
10909         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10910         esac
10911         ;;
10912 esac
10913 set d_pthread_yield
10914 eval $setvar
10915
10916 case "$sched_yield" in
10917 '') sched_yield=undef ;;
10918 esac
10919
10920 $rm -f try try.*
10921
10922 : see if this is a pwd.h system
10923 set pwd.h i_pwd
10924 eval $inhdr
10925
10926 case "$i_pwd" in
10927 $define)
10928         xxx=`./findhdr pwd.h`
10929         $cppstdin $cppflags $cppminus < $xxx >$$.h
10930
10931         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10932                 val="$define"
10933         else
10934                 val="$undef"
10935         fi
10936         set d_pwquota
10937         eval $setvar
10938
10939         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10940                 val="$define"
10941         else
10942                 val="$undef"
10943         fi
10944         set d_pwage
10945         eval $setvar
10946
10947         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10948                 val="$define"
10949         else
10950                 val="$undef"
10951         fi
10952         set d_pwchange
10953         eval $setvar
10954
10955         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10956                 val="$define"
10957         else
10958                 val="$undef"
10959         fi
10960         set d_pwclass
10961         eval $setvar
10962
10963         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10964                 val="$define"
10965         else
10966                 val="$undef"
10967         fi
10968         set d_pwexpire
10969         eval $setvar
10970
10971         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10972                 val="$define"
10973         else
10974                 val="$undef"
10975         fi
10976         set d_pwcomment
10977         eval $setvar
10978
10979         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10980                 val="$define"
10981         else
10982                 val="$undef"
10983         fi
10984         set d_pwgecos
10985         eval $setvar
10986
10987         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10988                 val="$define"
10989         else
10990                 val="$undef"
10991         fi
10992         set d_pwpasswd
10993         eval $setvar
10994
10995         $rm -f $$.h
10996         ;;
10997 *)
10998         val="$undef"; 
10999         set d_pwquota; eval $setvar
11000         set d_pwage; eval $setvar
11001         set d_pwchange; eval $setvar
11002         set d_pwclass; eval $setvar
11003         set d_pwexpire; eval $setvar
11004         set d_pwcomment; eval $setvar
11005         set d_pwgecos; eval $setvar
11006         set d_pwpasswd; eval $setvar
11007         ;;
11008 esac
11009
11010 : see if readdir and friends exist
11011 set readdir d_readdir
11012 eval $inlibc
11013 set seekdir d_seekdir
11014 eval $inlibc
11015 set telldir d_telldir
11016 eval $inlibc
11017 set rewinddir d_rewinddir
11018 eval $inlibc
11019
11020 : see if readlink exists
11021 set readlink d_readlink
11022 eval $inlibc
11023
11024 : see if readv exists
11025 set readv d_readv
11026 eval $inlibc
11027
11028 : see if recvmsg exists
11029 set recvmsg d_recvmsg
11030 eval $inlibc
11031
11032 : see if rename exists
11033 set rename d_rename
11034 eval $inlibc
11035
11036 : see if rmdir exists
11037 set rmdir d_rmdir
11038 eval $inlibc
11039
11040 : see if memory.h is available.
11041 val=''
11042 set memory.h val
11043 eval $inhdr
11044
11045 : See if it conflicts with string.h
11046 case "$val" in
11047 $define)
11048         case "$strings" in
11049         '') ;;
11050         *)
11051                 $cppstdin $cppflags $cppminus < $strings > mem.h
11052                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11053                         echo " "
11054                         echo "We won't be including <memory.h>."
11055                         val="$undef"
11056                 fi
11057                 $rm -f mem.h
11058                 ;;
11059         esac
11060 esac
11061 set i_memory
11062 eval $setvar
11063
11064 : can bcopy handle overlapping blocks?
11065 val="$undef"
11066 case "$d_bcopy" in
11067 "$define")
11068         echo " "
11069         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11070         $cat >try.c <<EOCP
11071 #$i_memory I_MEMORY
11072 #$i_stdlib I_STDLIB
11073 #$i_string I_STRING
11074 #$i_unistd I_UNISTD
11075 EOCP
11076         $cat >>try.c <<'EOCP'
11077 #include <stdio.h>
11078 #ifdef I_MEMORY
11079 #  include <memory.h>
11080 #endif
11081 #ifdef I_STDLIB
11082 #  include <stdlib.h>
11083 #endif
11084 #ifdef I_STRING
11085 #  include <string.h>
11086 #else
11087 #  include <strings.h>
11088 #endif
11089 #ifdef I_UNISTD
11090 #  include <unistd.h>  /* Needed for NetBSD */
11091 #endif
11092 int main()
11093 {
11094 char buf[128], abc[128];
11095 char *b;
11096 int len;
11097 int off;
11098 int align;
11099
11100 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11101
11102 for (align = 7; align >= 0; align--) {
11103         for (len = 36; len; len--) {
11104                 b = buf+align;
11105                 bcopy(abc, b, len);
11106                 for (off = 1; off <= len; off++) {
11107                         bcopy(b, b+off, len);
11108                         bcopy(b+off, b, len);
11109                         if (bcmp(b, abc, len))
11110                                 exit(1);
11111                 }
11112         }
11113 }
11114 exit(0);
11115 }
11116 EOCP
11117         set try
11118         if eval $compile_ok; then
11119                 if ./try 2>/dev/null; then
11120                         echo "Yes, it can."
11121                         val="$define"
11122                 else
11123                         echo "It can't, sorry."
11124                         case "$d_memmove" in
11125                         "$define") echo "But that's Ok since you have memmove()." ;;
11126                         esac
11127                 fi
11128         else
11129                 echo "(I can't compile the test program, so we'll assume not...)"
11130                 case "$d_memmove" in
11131                 "$define") echo "But that's Ok since you have memmove()." ;;
11132                 esac
11133         fi
11134         ;;
11135 esac
11136 $rm -f try.* try core
11137 set d_safebcpy
11138 eval $setvar
11139
11140 : can memcpy handle overlapping blocks?
11141 val="$undef"
11142 case "$d_memcpy" in
11143 "$define")
11144         echo " "
11145         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11146         $cat >try.c <<EOCP
11147 #$i_memory I_MEMORY
11148 #$i_stdlib I_STDLIB
11149 #$i_string I_STRING
11150 #$i_unistd I_UNISTD
11151 EOCP
11152         $cat >>try.c <<'EOCP'
11153 #include <stdio.h>
11154 #ifdef I_MEMORY
11155 #  include <memory.h>
11156 #endif
11157 #ifdef I_STDLIB
11158 #  include <stdlib.h>
11159 #endif
11160 #ifdef I_STRING
11161 #  include <string.h>
11162 #else
11163 #  include <strings.h>
11164 #endif
11165 #ifdef I_UNISTD
11166 #  include <unistd.h>  /* Needed for NetBSD */
11167 #endif
11168 int main()
11169 {
11170 char buf[128], abc[128];
11171 char *b;
11172 int len;
11173 int off;
11174 int align;
11175
11176 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11177    try to store the string in read-only memory. */
11178 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11179
11180 for (align = 7; align >= 0; align--) {
11181         for (len = 36; len; len--) {
11182                 b = buf+align;
11183                 memcpy(b, abc, len);
11184                 for (off = 1; off <= len; off++) {
11185                         memcpy(b+off, b, len);
11186                         memcpy(b, b+off, len);
11187                         if (memcmp(b, abc, len))
11188                                 exit(1);
11189                 }
11190         }
11191 }
11192 exit(0);
11193 }
11194 EOCP
11195         set try
11196         if eval $compile_ok; then
11197                 if ./try 2>/dev/null; then
11198                         echo "Yes, it can."
11199                         val="$define"
11200                 else
11201                         echo "It can't, sorry."
11202                         case "$d_memmove" in
11203                         "$define") echo "But that's Ok since you have memmove()." ;;
11204                         esac
11205                 fi
11206         else
11207                 echo "(I can't compile the test program, so we'll assume not...)"
11208                 case "$d_memmove" in
11209                 "$define") echo "But that's Ok since you have memmove()." ;;
11210                 esac
11211         fi
11212         ;;
11213 esac
11214 $rm -f try.* try core
11215 set d_safemcpy
11216 eval $setvar
11217
11218 : can memcmp be trusted to compare relative magnitude?
11219 val="$undef"
11220 case "$d_memcmp" in
11221 "$define")
11222         echo " "
11223         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11224         $cat >try.c <<EOCP
11225 #$i_memory I_MEMORY
11226 #$i_stdlib I_STDLIB
11227 #$i_string I_STRING
11228 #$i_unistd I_UNISTD
11229 EOCP
11230         $cat >>try.c <<'EOCP'
11231 #include <stdio.h>
11232 #ifdef I_MEMORY
11233 #  include <memory.h>
11234 #endif
11235 #ifdef I_STDLIB
11236 #  include <stdlib.h>
11237 #endif
11238 #ifdef I_STRING
11239 #  include <string.h>
11240 #else
11241 #  include <strings.h>
11242 #endif
11243 #ifdef I_UNISTD
11244 #  include <unistd.h>  /* Needed for NetBSD */
11245 #endif
11246 int main()
11247 {
11248 char a = -1;
11249 char b = 0;
11250 if ((a < b) && memcmp(&a, &b, 1) < 0)
11251         exit(1);
11252 exit(0);
11253 }
11254 EOCP
11255         set try
11256         if eval $compile_ok; then
11257                 if ./try 2>/dev/null; then
11258                         echo "Yes, it can."
11259                         val="$define"
11260                 else
11261                         echo "No, it can't (it uses signed chars)."
11262                 fi
11263         else
11264                 echo "(I can't compile the test program, so we'll assume not...)"
11265         fi
11266         ;;
11267 esac
11268 $rm -f try.* try core
11269 set d_sanemcmp
11270 eval $setvar
11271
11272 : see if prototype for sbrk is available
11273 echo " "
11274 set d_sbrkproto sbrk $i_unistd unistd.h
11275 eval $hasproto
11276
11277 : see if select exists
11278 set select d_select
11279 eval $inlibc
11280
11281 : see if semctl exists
11282 set semctl d_semctl
11283 eval $inlibc
11284
11285 : see if semget exists
11286 set semget d_semget
11287 eval $inlibc
11288
11289 : see if semop exists
11290 set semop d_semop
11291 eval $inlibc
11292
11293 : see how much of the 'sem*(2)' library is present.
11294 h_sem=true
11295 echo " "
11296 case "$d_semctl$d_semget$d_semop" in
11297 *"$undef"*) h_sem=false;;
11298 esac
11299 case "$osname" in
11300 freebsd)
11301     case "`ipcs 2>&1`" in
11302     "SVID messages"*"not configured"*)
11303         echo "Your $osname does not have the sem*(2) configured." >&4
11304         h_sem=false
11305         val="$undef"
11306         set semctl d_semctl
11307         eval $setvar
11308         set semget d_semget
11309         eval $setvar
11310         set semop d_semop
11311         eval $setvar
11312         ;;
11313     esac
11314     ;;
11315 esac
11316 : we could also check for sys/ipc.h ...
11317 if $h_sem && $test `./findhdr sys/sem.h`; then
11318         echo "You have the full sem*(2) library." >&4
11319         val="$define"
11320 else
11321         echo "You don't have the full sem*(2) library." >&4
11322         val="$undef"
11323 fi
11324 set d_sem
11325 eval $setvar
11326
11327 : see whether sys/sem.h defines union semun
11328 echo " "
11329 $cat > try.c <<'END'
11330 #include <sys/types.h>
11331 #include <sys/ipc.h>
11332 #include <sys/sem.h>
11333 int main () { union semun semun; semun.buf = 0; }
11334 END
11335 set try
11336 if eval $compile; then
11337     echo "You have union semun in <sys/sem.h>." >&4
11338     val="$define"
11339 else
11340     echo "You do not have union semun in <sys/sem.h>." >&4
11341     val="$undef"
11342 fi
11343 $rm -f try try.c try.h
11344 set d_union_semun
11345 eval $setvar
11346
11347 : see how to do semctl IPC_STAT
11348 case "$d_sem" in
11349 $define)
11350     : see whether semctl IPC_STAT can use union semun
11351     echo " "
11352     $cat > try.h <<END
11353 #ifndef S_IRUSR
11354 #   ifdef S_IREAD
11355 #       define S_IRUSR S_IREAD
11356 #       define S_IWUSR S_IWRITE
11357 #       define S_IXUSR S_IEXEC
11358 #   else
11359 #       define S_IRUSR 0400
11360 #       define S_IWUSR 0200
11361 #       define S_IXUSR 0100
11362 #   endif
11363 #   define S_IRGRP (S_IRUSR>>3)
11364 #   define S_IWGRP (S_IWUSR>>3)
11365 #   define S_IXGRP (S_IXUSR>>3)
11366 #   define S_IROTH (S_IRUSR>>6)
11367 #   define S_IWOTH (S_IWUSR>>6)
11368 #   define S_IXOTH (S_IXUSR>>6)
11369 #endif
11370 #ifndef S_IRWXU
11371 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11372 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11373 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11374 #endif
11375 END
11376
11377     $cat > try.c <<END
11378 #include <sys/types.h>
11379 #include <sys/ipc.h>
11380 #include <sys/sem.h>
11381 #include <sys/stat.h>
11382 #include <stdio.h>
11383 #include <errno.h>
11384 #include "try.h"
11385 #ifndef errno
11386 extern int errno;
11387 #endif
11388 #$d_union_semun HAS_UNION_SEMUN
11389 int main() {
11390     union semun
11391 #ifndef HAS_UNION_SEMUN
11392     {
11393         int val;
11394         struct semid_ds *buf;
11395         unsigned short *array;
11396     }
11397 #endif
11398     arg;
11399     int sem, st;
11400
11401 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11402     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11403     if (sem > -1) {
11404         struct semid_ds argbuf;
11405         arg.buf = &argbuf;
11406 #       ifdef IPC_STAT
11407         st = semctl(sem, 0, IPC_STAT, arg);
11408         if (st == 0)
11409             printf("semun\n");
11410         else
11411 #       endif /* IPC_STAT */
11412             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11413 #       ifdef IPC_RMID
11414         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11415 #       endif /* IPC_RMID */
11416             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11417     } else
11418 #endif /* IPC_PRIVATE && ... */
11419         printf("semget failed: errno = %d\n", errno);
11420   return 0;
11421 }
11422 END
11423     val="$undef"
11424     set try
11425     if eval $compile; then
11426         xxx=`./try`
11427         case "$xxx" in
11428         semun) val="$define" ;;
11429         esac
11430     fi
11431     $rm -f try try.c
11432     set d_semctl_semun
11433     eval $setvar
11434     case "$d_semctl_semun" in
11435     $define)
11436         echo "You can use union semun for semctl IPC_STAT." >&4
11437         also='also'
11438         ;;
11439     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11440         also=''
11441         ;;
11442     esac
11443
11444     : see whether semctl IPC_STAT can use struct semid_ds pointer
11445     $cat > try.c <<'END'
11446 #include <sys/types.h>
11447 #include <sys/ipc.h>
11448 #include <sys/sem.h>
11449 #include <sys/stat.h>
11450 #include "try.h"
11451 #include <stdio.h>
11452 #include <errno.h>
11453 #ifndef errno
11454 extern int errno;
11455 #endif
11456 int main() {
11457     struct semid_ds arg;
11458     int sem, st;
11459
11460 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11461     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11462     if (sem > -1) {
11463 #       ifdef IPC_STAT
11464         st = semctl(sem, 0, IPC_STAT, &arg);
11465         if (st == 0)
11466             printf("semid_ds\n");
11467         else
11468 #       endif /* IPC_STAT */
11469             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11470 #       ifdef IPC_RMID
11471         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11472 #       endif /* IPC_RMID */
11473             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11474     } else
11475 #endif /* IPC_PRIVATE && ... */
11476         printf("semget failed: errno = %d\n", errno);
11477
11478     return 0;
11479 }
11480 END
11481     val="$undef"
11482     set try
11483     if eval $compile; then
11484         xxx=`./try`
11485         case "$xxx" in
11486         semid_ds) val="$define" ;;
11487         esac
11488     fi
11489     $rm -f try try.c
11490     set d_semctl_semid_ds
11491     eval $setvar
11492     case "$d_semctl_semid_ds" in
11493     $define)
11494         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11495         ;;
11496     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11497         ;;
11498     esac
11499     $rm -f try.h
11500     ;;
11501 *)  val="$undef"
11502
11503     # We do not have the full sem*(2) library, so assume we can not
11504     # use either.
11505
11506     set d_semctl_semun
11507     eval $setvar
11508
11509     set d_semctl_semid_ds
11510     eval $setvar
11511     ;;
11512 esac
11513
11514 : see if sendmsg exists
11515 set sendmsg d_sendmsg
11516 eval $inlibc
11517
11518 : see if setegid exists
11519 set setegid d_setegid
11520 eval $inlibc
11521
11522 : see if seteuid exists
11523 set seteuid d_seteuid
11524 eval $inlibc
11525
11526 : see if setgrent exists
11527 set setgrent d_setgrent
11528 eval $inlibc
11529
11530 : see if sethostent exists
11531 set sethostent d_sethent
11532 eval $inlibc
11533
11534 : see if setitimer exists
11535 set setitimer d_setitimer
11536 eval $inlibc
11537
11538 : see if setlinebuf exists
11539 set setlinebuf d_setlinebuf
11540 eval $inlibc
11541
11542 : see if setlocale exists
11543 set setlocale d_setlocale
11544 eval $inlibc
11545
11546 : see if setnetent exists
11547 set setnetent d_setnent
11548 eval $inlibc
11549
11550 : see if setprotoent exists
11551 set setprotoent d_setpent
11552 eval $inlibc
11553
11554 : see if setpgid exists
11555 set setpgid d_setpgid
11556 eval $inlibc
11557
11558 : see if setpgrp2 exists
11559 set setpgrp2 d_setpgrp2
11560 eval $inlibc
11561
11562 : see if setpriority exists
11563 set setpriority d_setprior
11564 eval $inlibc
11565
11566 : see if setproctitle exists
11567 set setproctitle d_setproctitle
11568 eval $inlibc
11569
11570 : see if setpwent exists
11571 set setpwent d_setpwent
11572 eval $inlibc
11573
11574 : see if setregid exists
11575 set setregid d_setregid
11576 eval $inlibc
11577 set setresgid d_setresgid
11578 eval $inlibc
11579
11580 : see if setreuid exists
11581 set setreuid d_setreuid
11582 eval $inlibc
11583 set setresuid d_setresuid
11584 eval $inlibc
11585
11586 : see if setrgid exists
11587 set setrgid d_setrgid
11588 eval $inlibc
11589
11590 : see if setruid exists
11591 set setruid d_setruid
11592 eval $inlibc
11593
11594 : see if setservent exists
11595 set setservent d_setsent
11596 eval $inlibc
11597
11598 : see if setsid exists
11599 set setsid d_setsid
11600 eval $inlibc
11601
11602 : see if setvbuf exists
11603 set setvbuf d_setvbuf
11604 eval $inlibc
11605
11606 : see if sfio.h is available
11607 set sfio.h i_sfio
11608 eval $inhdr
11609
11610
11611 : see if sfio library is available
11612 case "$i_sfio" in
11613 $define)
11614         val=''
11615         set sfreserve val
11616         eval $inlibc
11617         ;;
11618 *)
11619         val="$undef"
11620         ;;
11621 esac
11622 : Ok, but do we want to use it.
11623 case "$val" in
11624 $define)
11625         case "$usesfio" in
11626         true|$define|[yY]*) dflt='y';;
11627         *) dflt='n';;
11628         esac
11629         echo "$package can use the sfio library, but it is experimental."
11630         case "$useperlio" in
11631         "$undef")
11632             echo "For sfio also the PerlIO abstraction layer is needed."
11633             echo "Earlier you said you wouldn't want that."
11634             ;;
11635         esac
11636         rp="You seem to have sfio available, do you want to try using it?"
11637         . ./myread
11638         case "$ans" in
11639         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11640                 useperlio="$define"
11641                 val="$define"
11642                 ;;
11643         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11644                 val="$undef"
11645                 ;;
11646         esac
11647         ;;
11648 *)      case "$usesfio" in
11649         true|$define|[yY]*)
11650                 echo "Sorry, cannot find sfio on this machine." >&4
11651                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11652                 val="$undef"
11653                 ;;
11654         esac
11655         ;;
11656 esac
11657 set d_sfio
11658 eval $setvar
11659 case "$d_sfio" in
11660 $define) usesfio='true';;
11661 *) usesfio='false';;
11662 esac
11663 case "$d_sfio" in
11664 $define) ;;
11665 *)      : Remove sfio from list of libraries to use
11666         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11667         shift
11668         libs="$*"
11669         echo "libs = $libs" >&4
11670 ;;
11671 esac
11672
11673
11674 : see if shmctl exists
11675 set shmctl d_shmctl
11676 eval $inlibc
11677
11678 : see if shmget exists
11679 set shmget d_shmget
11680 eval $inlibc
11681
11682 : see if shmat exists
11683 set shmat d_shmat
11684 eval $inlibc
11685 : see what shmat returns
11686 case "$d_shmat" in
11687 "$define")
11688         $cat >shmat.c <<'END'
11689 #include <sys/shm.h>
11690 void *shmat();
11691 END
11692         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11693                 shmattype='void *'
11694         else
11695                 shmattype='char *'
11696         fi
11697         echo "and it returns ($shmattype)." >&4
11698         : see if a prototype for shmat is available
11699         xxx=`./findhdr sys/shm.h`
11700         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11701         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11702                 val="$define"
11703         else
11704                 val="$undef"
11705         fi
11706         $rm -f shmat.[co]
11707         ;;
11708 *)
11709         val="$undef"
11710         ;;
11711 esac
11712 set d_shmatprototype
11713 eval $setvar
11714
11715 : see if shmdt exists
11716 set shmdt d_shmdt
11717 eval $inlibc
11718
11719 : see how much of the 'shm*(2)' library is present.
11720 h_shm=true
11721 echo " "
11722 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11723 *"$undef"*) h_shm=false;;
11724 esac
11725 case "$osname" in
11726 freebsd)
11727     case "`ipcs 2>&1`" in
11728     "SVID shared memory"*"not configured"*)
11729         echo "Your $osname does not have the shm*(2) configured." >&4
11730         h_shm=false
11731         val="$undef"
11732         set shmctl d_shmctl
11733         evat $setvar
11734         set shmget d_shmget
11735         evat $setvar
11736         set shmat d_shmat
11737         evat $setvar
11738         set shmdt d_shmdt
11739         evat $setvar
11740         ;;
11741     esac
11742     ;;
11743 esac
11744 : we could also check for sys/ipc.h ...
11745 if $h_shm && $test `./findhdr sys/shm.h`; then
11746         echo "You have the full shm*(2) library." >&4
11747         val="$define"
11748 else
11749         echo "You don't have the full shm*(2) library." >&4
11750         val="$undef"
11751 fi
11752 set d_shm
11753 eval $setvar
11754
11755 echo " "
11756 : see if we have sigaction
11757 if set sigaction val -f d_sigaction; eval $csym; $val; then
11758         echo 'sigaction() found.' >&4
11759         $cat > try.c <<'EOP'
11760 #include <stdio.h>
11761 #include <sys/types.h>
11762 #include <signal.h>
11763 int main()
11764 {
11765     struct sigaction act, oact;
11766     act.sa_flags = 0;
11767     oact.sa_handler = 0;
11768     /* so that act and oact are used */
11769     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11770 }
11771 EOP
11772         set try
11773         if eval $compile_ok; then
11774                 val="$define"
11775         else
11776                 echo "But you don't seem to have a useable struct sigaction." >&4
11777                 val="$undef"
11778         fi
11779 else
11780         echo 'sigaction NOT found.' >&4
11781         val="$undef"
11782 fi
11783 set d_sigaction; eval $setvar
11784 $rm -f try try$_o try.c
11785
11786 : see if sigprocmask exists
11787 set sigprocmask d_sigprocmask
11788 eval $inlibc
11789
11790 : see if sigsetjmp exists
11791 echo " "
11792 case "$d_sigsetjmp" in
11793 '')
11794         $cat >try.c <<'EOP'
11795 #include <setjmp.h>
11796 sigjmp_buf env;
11797 int set = 1;
11798 int main()
11799 {
11800         if (sigsetjmp(env,1))
11801                 exit(set);
11802         set = 0;
11803         siglongjmp(env, 1);
11804         exit(1);
11805 }
11806 EOP
11807         set try
11808         if eval $compile; then
11809                 if ./try >/dev/null 2>&1; then
11810                         echo "POSIX sigsetjmp found." >&4
11811                         val="$define"
11812                 else
11813                         $cat >&4 <<EOM
11814 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11815 I'll ignore them.
11816 EOM
11817                         val="$undef"
11818                 fi
11819         else
11820                 echo "sigsetjmp not found." >&4
11821                 val="$undef"
11822         fi
11823         ;;
11824 *) val="$d_sigsetjmp"
11825         case "$d_sigsetjmp" in
11826         $define) echo "POSIX sigsetjmp found." >&4;;
11827         $undef) echo "sigsetjmp not found." >&4;;
11828         esac
11829         ;;
11830 esac
11831 set d_sigsetjmp
11832 eval $setvar
11833 $rm -f try.c try
11834
11835 : see if sockatmark exists
11836 set sockatmark d_sockatmark
11837 eval $inlibc
11838
11839 : see if socks5_init exists
11840 set socks5_init d_socks5_init
11841 eval $inlibc
11842
11843 : see if sys/stat.h is available
11844 set sys/stat.h i_sysstat
11845 eval $inhdr
11846
11847
11848 : see if stat knows about block sizes
11849 echo " "
11850 echo "Checking to see if your struct stat has st_blocks field..." >&4
11851 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11852 eval $hasfield
11853
11854
11855 : see if this is a sys/vfs.h system
11856 set sys/vfs.h i_sysvfs
11857 eval $inhdr
11858
11859
11860 : see if this is a sys/statfs.h system
11861 set sys/statfs.h i_sysstatfs
11862 eval $inhdr
11863
11864
11865 echo " "
11866 echo "Checking to see if your system supports struct statfs..." >&4
11867 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
11868 eval $hasstruct
11869 case "$d_statfs_s" in
11870 "$define")      echo "Yes, it does."   ;;
11871 *)              echo "No, it doesn't." ;;
11872 esac
11873
11874
11875
11876 : see if struct statfs knows about f_flags
11877 case "$d_statfs_s" in
11878 define) 
11879         echo " "
11880         echo "Checking to see if your struct statfs has f_flags field..." >&4
11881         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
11882         eval $hasfield
11883         ;;
11884 *)      val="$undef"
11885         set d_statfs_f_flags
11886         eval $setvar
11887         ;;
11888 esac
11889 case "$d_statfs_f_flags" in
11890 "$define")      echo "Yes, it does."   ;;
11891 *)              echo "No, it doesn't." ;;
11892 esac
11893
11894 : see if _ptr and _cnt from stdio act std
11895 echo " "
11896
11897 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11898         echo "(Looks like you have stdio.h from BSD.)"
11899         case "$stdio_ptr" in
11900         '') stdio_ptr='((fp)->_p)'
11901                 ptr_lval=$define
11902                 ;;
11903         *)      ptr_lval=$d_stdio_ptr_lval;;
11904         esac
11905         case "$stdio_cnt" in
11906         '') stdio_cnt='((fp)->_r)'
11907                 cnt_lval=$define
11908                 ;;
11909         *)      cnt_lval=$d_stdio_cnt_lval;;
11910         esac
11911         case "$stdio_base" in
11912         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11913         esac
11914         case "$stdio_bufsiz" in
11915         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11916         esac
11917 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11918         echo "(Looks like you have stdio.h from Linux.)"
11919         case "$stdio_ptr" in
11920         '') stdio_ptr='((fp)->_IO_read_ptr)'
11921                 ptr_lval=$define
11922                 ;;
11923         *)      ptr_lval=$d_stdio_ptr_lval;;
11924         esac
11925         case "$stdio_cnt" in
11926         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11927                 cnt_lval=$undef
11928                 ;;
11929         *)      cnt_lval=$d_stdio_cnt_lval;;
11930         esac
11931         case "$stdio_base" in
11932         '') stdio_base='((fp)->_IO_read_base)';;
11933         esac
11934         case "$stdio_bufsiz" in
11935         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11936         esac
11937 else
11938         case "$stdio_ptr" in
11939         '') stdio_ptr='((fp)->_ptr)'
11940                 ptr_lval=$define
11941                 ;;
11942         *)      ptr_lval=$d_stdio_ptr_lval;;
11943         esac
11944         case "$stdio_cnt" in
11945         '') stdio_cnt='((fp)->_cnt)'
11946                 cnt_lval=$define
11947                 ;;
11948         *)      cnt_lval=$d_stdio_cnt_lval;;
11949         esac
11950         case "$stdio_base" in
11951         '') stdio_base='((fp)->_base)';;
11952         esac
11953         case "$stdio_bufsiz" in
11954         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11955         esac
11956 fi
11957
11958 : test whether _ptr and _cnt really work
11959 echo "Checking how std your stdio is..." >&4
11960 $cat >try.c <<EOP
11961 #include <stdio.h>
11962 #define FILE_ptr(fp)    $stdio_ptr
11963 #define FILE_cnt(fp)    $stdio_cnt
11964 int main() {
11965         FILE *fp = fopen("try.c", "r");
11966         char c = getc(fp);
11967         if (
11968                 18 <= FILE_cnt(fp) &&
11969                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11970         )
11971                 exit(0);
11972         exit(1);
11973 }
11974 EOP
11975 val="$undef"
11976 set try
11977 if eval $compile; then
11978         if ./try; then
11979                 echo "Your stdio acts pretty std."
11980                 val="$define"
11981         else
11982                 echo "Your stdio isn't very std."
11983         fi
11984 else
11985         echo "Your stdio doesn't appear very std."
11986 fi
11987 $rm -f try.c try
11988 set d_stdstdio
11989 eval $setvar
11990
11991 : Can _ptr be used as an lvalue?
11992 case "$d_stdstdio$ptr_lval" in
11993 $define$define) val=$define ;;
11994 *) val=$undef ;;
11995 esac
11996 set d_stdio_ptr_lval
11997 eval $setvar
11998
11999 : Can _cnt be used as an lvalue?
12000 case "$d_stdstdio$cnt_lval" in
12001 $define$define) val=$define ;;
12002 *) val=$undef ;;
12003 esac
12004 set d_stdio_cnt_lval
12005 eval $setvar
12006
12007
12008 : test whether setting _ptr sets _cnt as a side effect
12009 d_stdio_ptr_lval_sets_cnt="$undef"
12010 d_stdio_ptr_lval_nochange_cnt="$undef"
12011 case "$d_stdio_ptr_lval$d_stdstdio" in
12012 $define$define)
12013         echo "Checking to see what happens if we set the stdio ptr..." >&4
12014 $cat >try.c <<EOP
12015 #include <stdio.h>
12016 /* Can we scream? */
12017 /* Eat dust sed :-) */
12018 /* In the buffer space, no one can hear you scream. */
12019 #define FILE_ptr(fp)    $stdio_ptr
12020 #define FILE_cnt(fp)    $stdio_cnt
12021 #include <sys/types.h>
12022 int main() {
12023         FILE *fp = fopen("try.c", "r");
12024         int c;
12025         char *ptr;
12026         size_t cnt;
12027         if (!fp) {
12028             puts("Fail even to read");
12029             exit(1);
12030         }
12031         c = getc(fp); /* Read away the first # */
12032         if (c == EOF) {
12033             puts("Fail even to read");
12034             exit(1);
12035         }
12036         if (!(
12037                 18 <= FILE_cnt(fp) &&
12038                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12039         )) {
12040                 puts("Fail even to read");
12041                 exit (1);
12042         }
12043         ptr = (char*) FILE_ptr(fp);
12044         cnt = (size_t)FILE_cnt(fp);
12045
12046         FILE_ptr(fp) += 42;
12047
12048         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12049                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12050                 exit (1);
12051         }
12052         if (FILE_cnt(fp) <= 20) {
12053                 printf ("Fail (<20 chars to test)");
12054                 exit (1);
12055         }
12056         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12057                 puts("Fail compare");
12058                 exit (1);
12059         }
12060         if (cnt == FILE_cnt(fp)) {
12061                 puts("Pass_unchanged");
12062                 exit (0);
12063         }       
12064         if (FILE_cnt(fp) == (cnt - 42)) {
12065                 puts("Pass_changed");
12066                 exit (0);
12067         }
12068         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12069         return 1;
12070
12071 }
12072 EOP
12073         set try
12074         if eval $compile; then
12075                 case `./try$exe_ext` in
12076                 Pass_changed)
12077                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12078                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12079                 Pass_unchanged)
12080                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12081                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12082                 Fail*)
12083                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12084                 *)
12085                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12086         esac
12087         else
12088                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12089         fi
12090         $rm -f try.c try
12091         ;;
12092 esac
12093
12094 : see if _base is also standard
12095 val="$undef"
12096 case "$d_stdstdio" in
12097 $define)
12098         $cat >try.c <<EOP
12099 #include <stdio.h>
12100 #define FILE_base(fp)   $stdio_base
12101 #define FILE_bufsiz(fp) $stdio_bufsiz
12102 int main() {
12103         FILE *fp = fopen("try.c", "r");
12104         char c = getc(fp);
12105         if (
12106                 19 <= FILE_bufsiz(fp) &&
12107                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12108         )
12109                 exit(0);
12110         exit(1);
12111 }
12112 EOP
12113         set try
12114         if eval $compile; then
12115                 if ./try; then
12116                         echo "And its _base field acts std."
12117                         val="$define"
12118                 else
12119                         echo "But its _base field isn't std."
12120                 fi
12121         else
12122                 echo "However, it seems to be lacking the _base field."
12123         fi
12124         $rm -f try.c try
12125         ;;
12126 esac
12127 set d_stdiobase
12128 eval $setvar
12129
12130 $cat >&4 <<EOM
12131 Checking how to access stdio streams by file descriptor number...
12132 EOM
12133 case "$stdio_stream_array" in
12134 '')     $cat >try.c <<EOCP
12135 #include <stdio.h>
12136 int main() {
12137   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12138     printf("yes\n");
12139 }
12140 EOCP
12141         for s in _iob __iob __sF
12142         do
12143                 set try -DSTDIO_STREAM_ARRAY=$s
12144                 if eval $compile; then
12145                         case "`./try$exe_ext`" in
12146                         yes)    stdio_stream_array=$s; break ;;
12147                         esac
12148                 fi
12149         done
12150         $rm -f try.* try$exe_ext
12151 esac
12152 case "$stdio_stream_array" in
12153 '')     $cat >&4 <<EOM
12154 I can't figure out how to access stdio streams by file descriptor number.
12155 EOM
12156         d_stdio_stream_array="$undef"
12157         ;;
12158 *)      $cat >&4 <<EOM
12159 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12160 EOM
12161         d_stdio_stream_array="$define"
12162         ;;
12163 esac
12164
12165 : see if strcoll exists
12166 set strcoll d_strcoll
12167 eval $inlibc
12168
12169 : check for structure copying
12170 echo " "
12171 echo "Checking to see if your C compiler can copy structs..." >&4
12172 $cat >try.c <<'EOCP'
12173 int main()
12174 {
12175         struct blurfl {
12176                 int dyick;
12177         } foo, bar;
12178
12179         foo = bar;
12180 }
12181 EOCP
12182 if $cc -c try.c >/dev/null 2>&1 ; then
12183         val="$define"
12184         echo "Yup, it can."
12185 else
12186         val="$undef"
12187         echo "Nope, it can't."
12188 fi
12189 set d_strctcpy
12190 eval $setvar
12191 $rm -f try.*
12192
12193 : see if strerror and/or sys_errlist[] exist
12194 echo " "
12195 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12196     if set strerror val -f d_strerror; eval $csym; $val; then
12197                 echo 'strerror() found.' >&4
12198                 d_strerror="$define"
12199                 d_strerrm='strerror(e)'
12200                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12201                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12202                         d_syserrlst="$define"
12203                 else
12204                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12205                         d_syserrlst="$undef"
12206                 fi
12207     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12208                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12209                 echo 'strerror() found in string header.' >&4
12210                 d_strerror="$define"
12211                 d_strerrm='strerror(e)'
12212                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12213                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12214                                 d_syserrlst="$define"
12215                 else
12216                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12217                         d_syserrlst="$undef"
12218                 fi
12219     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12220                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12221                 d_strerror="$undef"
12222                 d_syserrlst="$define"
12223                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12224     else
12225                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12226                 d_strerror="$undef"
12227                 d_syserrlst="$undef"
12228                 d_strerrm='"unknown"'
12229     fi
12230 fi
12231
12232 : see if strtod exists
12233 set strtod d_strtod
12234 eval $inlibc
12235
12236 : see if strtol exists
12237 set strtol d_strtol
12238 eval $inlibc
12239
12240 : see if strtold exists
12241 set strtold d_strtold
12242 eval $inlibc
12243
12244 : see if strtoll exists
12245 set strtoll d_strtoll
12246 eval $inlibc
12247
12248 case "$d_longlong-$d_strtoll" in
12249 "$define-$define")
12250         $cat <<EOM
12251 Checking whether your strtoll() works okay...
12252 EOM
12253         $cat >try.c <<'EOCP'
12254 #include <errno.h>
12255 #ifdef __hpux
12256 #define strtoll __strtoll
12257 #endif
12258 #ifdef __EMX__
12259 #define strtoll _strtoll
12260 #endif
12261 #include <stdio.h>
12262 extern long long int strtoll(char *s, char **, int); 
12263 static int bad = 0;
12264 int check(char *s, long long ell, int een) {
12265         long long gll;
12266         errno = 0;
12267         gll = strtoll(s, 0, 10);
12268         if (!((gll == ell) && (errno == een)))
12269                 bad++;
12270 }
12271 int main() {
12272         check(" 1",                                      1LL, 0);
12273         check(" 0",                                      0LL, 0);
12274         check("-1",                                     -1LL, 0);
12275         check("-9223372036854775808", -9223372036854775808LL, 0);
12276         check("-9223372036854775808", -9223372036854775808LL, 0);
12277         check(" 9223372036854775807",  9223372036854775807LL, 0);
12278         check("-9223372036854775808", -9223372036854775808LL, 0);
12279         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12280         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12281         if (!bad)
12282                 printf("ok\n");
12283 }
12284 EOCP
12285         set try
12286         if eval $compile; then
12287                 yyy=`./try`
12288                 case "$yyy" in
12289                 ok) echo "Your strtoll() seems to be working okay." ;;
12290                 *) cat <<EOM >&4
12291 Your strtoll() doesn't seem to be working okay.
12292 EOM
12293                    d_strtoll="$undef"
12294                    ;;
12295                 esac
12296         else
12297                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12298                 d_strtoll="$undef"
12299         fi
12300         ;;
12301 esac
12302
12303 : see if strtoq exists
12304 set strtoq d_strtoq
12305 eval $inlibc
12306
12307 : see if strtoul exists
12308 set strtoul d_strtoul
12309 eval $inlibc
12310
12311 case "$d_strtoul" in
12312 "$define")
12313         $cat <<EOM
12314 Checking whether your strtoul() works okay...
12315 EOM
12316         $cat >try.c <<'EOCP'
12317 #include <errno.h>
12318 #include <stdio.h>
12319 extern unsigned long int strtoul(char *s, char **, int); 
12320 static int bad = 0;
12321 void check(char *s, unsigned long eul, int een) {
12322         unsigned long gul;
12323         errno = 0;
12324         gul = strtoul(s, 0, 10);
12325         if (!((gul == eul) && (errno == een)))
12326                 bad++;
12327 }
12328 int main() {
12329         check(" 1", 1L, 0);
12330         check(" 0", 0L, 0);
12331 EOCP
12332         case "$longsize" in
12333         8)
12334             $cat >>try.c <<'EOCP'
12335         check("18446744073709551615", 18446744073709551615UL, 0);
12336         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12337 #if 0 /* strtoul() for /^-/ strings is undefined. */
12338         check("-1", 18446744073709551615UL, 0);
12339         check("-18446744073709551614", 2, 0);
12340         check("-18446744073709551615", 1, 0);
12341         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12342         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12343 #endif
12344 EOCP
12345                 ;;
12346         4)
12347                     $cat >>try.c <<'EOCP'
12348         check("4294967295", 4294967295UL, 0);
12349         check("4294967296", 4294967295UL, ERANGE);
12350 #if 0 /* strtoul() for /^-/ strings is undefined. */
12351         check("-1", 4294967295UL, 0);
12352         check("-4294967294", 2, 0);
12353         check("-4294967295", 1, 0);
12354         check("-4294967296", 4294967295UL, ERANGE);
12355         check("-4294967297", 4294967295UL, ERANGE);
12356 #endif
12357 EOCP
12358                 ;;
12359         *)
12360 : Should we write these tests to be more portable by sprintf-ing
12361 : ~0 and then manipulating that char string as input for strtol?
12362                 ;;
12363         esac
12364         $cat >>try.c <<'EOCP'
12365         if (!bad)
12366                 printf("ok\n");
12367         return 0;
12368 }
12369 EOCP
12370         set try
12371         if eval $compile; then
12372                 case "`./try`" in
12373                 ok) echo "Your strtoul() seems to be working okay." ;;
12374                 *) cat <<EOM >&4
12375 Your strtoul() doesn't seem to be working okay.
12376 EOM
12377                    d_strtoul="$undef"
12378                    ;;
12379                 esac
12380         fi
12381         ;;
12382 esac
12383
12384 : see if strtoull exists
12385 set strtoull d_strtoull
12386 eval $inlibc
12387
12388 case "$d_longlong-$d_strtoull" in
12389 "$define-$define")
12390         $cat <<EOM
12391 Checking whether your strtoull() works okay...
12392 EOM
12393         $cat >try.c <<'EOCP'
12394 #include <errno.h>
12395 #ifdef __hpux
12396 #define strtoull __strtoull
12397 #endif
12398 #include <stdio.h>
12399 extern unsigned long long int strtoull(char *s, char **, int); 
12400 static int bad = 0;
12401 int check(char *s, long long eull, int een) {
12402         long long gull;
12403         errno = 0;
12404         gull = strtoull(s, 0, 10);
12405         if (!((gull == eull) && (errno == een)))
12406                 bad++;
12407 }
12408 int main() {
12409         check(" 1",                                        1LL, 0);
12410         check(" 0",                                        0LL, 0);
12411         check("18446744073709551615",  18446744073709551615ULL, 0);
12412         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12413 #if 0 /* strtoull() for /^-/ strings is undefined. */
12414         check("-1",                    18446744073709551615ULL, 0);
12415         check("-18446744073709551614",                     2LL, 0);
12416         check("-18446744073709551615",                     1LL, 0);
12417         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12418         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12419 #endif
12420         if (!bad)
12421                 printf("ok\n");
12422 }
12423 EOCP
12424         set try
12425         if eval $compile; then
12426                 case "`./try`" in
12427                 ok) echo "Your strtoull() seems to be working okay." ;;
12428                 *) cat <<EOM >&4
12429 Your strtoull() doesn't seem to be working okay.
12430 EOM
12431                    d_strtoull="$undef"
12432                    ;;
12433                 esac
12434         fi
12435         ;;
12436 esac
12437
12438 : see if strtouq exists
12439 set strtouq d_strtouq
12440 eval $inlibc
12441
12442 case "$d_strtouq" in
12443 "$define")
12444         $cat <<EOM
12445 Checking whether your strtouq() works okay...
12446 EOM
12447         $cat >try.c <<'EOCP'
12448 #include <errno.h>
12449 #include <stdio.h>
12450 extern unsigned long long int strtouq(char *s, char **, int); 
12451 static int bad = 0;
12452 void check(char *s, unsigned long long eull, int een) {
12453         unsigned long long gull;
12454         errno = 0;
12455         gull = strtouq(s, 0, 10);
12456         if (!((gull == eull) && (errno == een)))
12457                 bad++;
12458 }
12459 int main() {
12460         check(" 1",                                        1LL, 0);
12461         check(" 0",                                        0LL, 0);
12462         check("18446744073709551615",  18446744073709551615ULL, 0);
12463         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12464 #if 0 /* strtouq() for /^-/ strings is undefined. */
12465         check("-1",                    18446744073709551615ULL, 0);
12466         check("-18446744073709551614",                     2LL, 0);
12467         check("-18446744073709551615",                     1LL, 0);
12468         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12469         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12470 #endif
12471         if (!bad)
12472                 printf("ok\n");
12473         return 0;
12474 }
12475 EOCP
12476         set try
12477         if eval $compile; then
12478                 case "`./try`" in
12479                 ok) echo "Your strtouq() seems to be working okay." ;;
12480                 *) cat <<EOM >&4
12481 Your strtouq() doesn't seem to be working okay.
12482 EOM
12483                    d_strtouq="$undef"
12484                    ;;
12485                 esac
12486         fi
12487         ;;
12488 esac
12489
12490 : see if strxfrm exists
12491 set strxfrm d_strxfrm
12492 eval $inlibc
12493
12494 : see if symlink exists
12495 set symlink d_symlink
12496 eval $inlibc
12497
12498 : see if syscall exists
12499 set syscall d_syscall
12500 eval $inlibc
12501
12502 : see if sysconf exists
12503 set sysconf d_sysconf
12504 eval $inlibc
12505
12506 : see if system exists
12507 set system d_system
12508 eval $inlibc
12509
12510 : see if tcgetpgrp exists
12511 set tcgetpgrp d_tcgetpgrp
12512 eval $inlibc
12513
12514 : see if tcsetpgrp exists
12515 set tcsetpgrp d_tcsetpgrp
12516 eval $inlibc
12517
12518 : see if prototype for telldir is available
12519 echo " "
12520 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12521 eval $hasproto
12522
12523 : see if this is a sys/times.h system
12524 set sys/times.h i_systimes
12525 eval $inhdr
12526
12527 : see if times exists
12528 echo " "
12529 if set times val -f d_times; eval $csym; $val; then
12530         echo 'times() found.' >&4
12531         d_times="$define"
12532         inc=''
12533         case "$i_systimes" in
12534         "$define") inc='sys/times.h';;
12535         esac
12536         rp="What is the type returned by times() on this system?"
12537         set clock_t clocktype long stdio.h sys/types.h $inc
12538         eval $typedef_ask
12539 else
12540         echo 'times() NOT found, hope that will do.' >&4
12541         d_times="$undef"
12542         clocktype='int'
12543 fi
12544
12545 : see if truncate exists
12546 set truncate d_truncate
12547 eval $inlibc
12548
12549 : see if tzname[] exists
12550 echo " "
12551 if set tzname val -a d_tzname; eval $csym; $val; then
12552         val="$define"
12553         echo 'tzname[] found.' >&4
12554 else
12555         val="$undef"
12556         echo 'tzname[] NOT found.' >&4
12557 fi
12558 set d_tzname
12559 eval $setvar
12560
12561 case "$crosscompile" in
12562 ''|[nN]*) crosscompile="$undef" ;;
12563 esac
12564
12565 case "$osname" in
12566 next|rhapsody|darwin) multiarch="$define" ;;
12567 esac
12568 case "$multiarch" in
12569 ''|[nN]*) multiarch="$undef" ;;
12570 esac
12571
12572 : check for ordering of bytes in a long
12573 echo " "
12574 case "$crosscompile$multiarch" in
12575 *$define*)
12576         $cat <<EOM
12577 You seem to be either cross-compiling or doing a multiarchitecture build,
12578 skipping the byteorder check.
12579
12580 EOM
12581         byteorder='0xffff'
12582         ;;
12583 *)
12584         case "$byteorder" in
12585         '')
12586                 $cat <<'EOM'
12587 In the following, larger digits indicate more significance.  A big-endian
12588 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12589 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12590 machines may have weird orders like 3412.  A Cray will report 87654321,
12591 an Alpha will report 12345678. If the test program works the default is
12592 probably right.
12593 I'm now running the test program...
12594 EOM
12595                 $cat >try.c <<'EOCP'
12596 #include <stdio.h>
12597 int main()
12598 {
12599         int i;
12600         union {
12601                 unsigned long l;
12602                 char c[sizeof(long)];
12603         } u;
12604
12605         if (sizeof(long) > 4)
12606                 u.l = (0x08070605L << 32) | 0x04030201L;
12607         else
12608                 u.l = 0x04030201L;
12609         for (i = 0; i < sizeof(long); i++)
12610                 printf("%c", u.c[i]+'0');
12611         printf("\n");
12612         exit(0);
12613 }
12614 EOCP
12615                 xxx_prompt=y
12616                 set try
12617                 if eval $compile && ./try > /dev/null; then
12618                         dflt=`./try`
12619                         case "$dflt" in
12620                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12621                                 echo "(The test program ran ok.)"
12622                                 echo "byteorder=$dflt"
12623                                 xxx_prompt=n
12624                         ;;
12625                         ????|????????) echo "(The test program ran ok.)" ;;
12626                         *) echo "(The test program didn't run right for some reason.)" ;;
12627                         esac
12628                 else
12629                         dflt='4321'
12630                         cat <<'EOM'
12631 (I can't seem to compile the test program.  Guessing big-endian...)
12632 EOM
12633                 fi
12634                 case "$xxx_prompt" in
12635                 y)
12636                         rp="What is the order of bytes in a long?"
12637                         . ./myread
12638                         byteorder="$ans"
12639                         ;;
12640                 *)      byteorder=$dflt
12641                         ;;
12642                 esac
12643                 ;;
12644         esac
12645         $rm -f try.c try
12646         ;;
12647 esac
12648
12649
12650 $cat <<EOM
12651
12652 Checking to see whether you can access character data unalignedly...
12653 EOM
12654 $cat >try.c <<EOCP
12655 #include <stdio.h>
12656 #define U32 $u32type
12657 #define BYTEORDER $byteorder
12658 int main() {
12659 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12660     U8 buf[] = "\0\0\0\1\0\0\0\0";
12661     U32 *up;
12662     int i;
12663
12664     if (sizeof(U32) != 4) {
12665         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12666         exit(1);
12667     }
12668
12669     fflush(stdout);
12670
12671     for (i = 0; i < 4; i++) {
12672         up = (U32*)(buf + i);
12673         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12674                (*up == 1 << (8*(3-i)))  /* little-endian */
12675               )
12676            )
12677         {
12678             printf("read failed (%x)\n", *up);
12679             exit(2);
12680         }
12681     }
12682
12683     /* write test */
12684     for (i = 0; i < 4; i++) {
12685         up = (U32*)(buf + i);
12686         *up = 0xBeef;
12687         if (*up != 0xBeef) {
12688             printf("write failed (%x)\n", *up);
12689             exit(3);
12690         }
12691     }
12692
12693     exit(0);
12694 #else
12695     printf("1\n");
12696     exit(1);
12697 #endif
12698     return 0;
12699 }
12700 EOCP
12701 set try
12702 if eval $compile_ok; then
12703         echo "(This test may dump core.)" >&4
12704         ./try >&2 >/dev/null
12705         case "$?" in
12706         0)      cat >&4 <<EOM
12707 You can access character data pretty unalignedly.
12708 EOM
12709                 d_u32align="$undef"
12710                 ;;
12711         *)      cat >&4 <<EOM
12712 It seems that you must access character data in an aligned manner.
12713 EOM
12714                 d_u32align="$define"
12715                 ;;
12716         esac
12717         $rm -f core core.try.* try.core
12718 else
12719         rp='Can you access character data at unaligned addresses?'
12720         dflt='n'
12721         . ./myread
12722         case "$ans" in
12723         [yY]*)  d_u32align="$undef"  ;;
12724         *)      d_u32align="$define" ;;
12725         esac
12726 fi
12727
12728 : see if ualarm exists
12729 set ualarm d_ualarm
12730 eval $inlibc
12731
12732 : see if umask exists
12733 set umask d_umask
12734 eval $inlibc
12735
12736 : see if usleep exists
12737 set usleep d_usleep
12738 eval $inlibc
12739
12740 : see if ustat exists
12741 set ustat d_ustat
12742 eval $inlibc
12743
12744 : backward compatibility for d_hvfork
12745 if test X$d_hvfork != X; then
12746         d_vfork="$d_hvfork"
12747         d_hvfork=''
12748 fi
12749 : see if there is a vfork
12750 val=''
12751 set vfork val
12752 eval $inlibc
12753
12754 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12755 : perl on Solaris 2.x, and probably elsewhere.
12756 case "$val" in
12757 $define)
12758         echo " "
12759         case "$usevfork" in
12760         false) dflt='n';;
12761         *) dflt='y';;
12762         esac
12763         cat <<'EOM'
12764  
12765 Perl can only use a vfork() that doesn't suffer from strict
12766 restrictions on calling functions or modifying global data in
12767 the child.  For example, glibc-2.1 contains such a vfork()
12768 that is unsuitable.  If your system provides a proper fork()
12769 call, chances are that you do NOT want perl to use vfork().
12770
12771 EOM
12772         rp="Do you still want to use vfork()?"
12773         . ./myread
12774         case "$ans" in
12775         y|Y) ;;
12776         *)
12777                 echo "Ok, we won't use vfork()."
12778                 val="$undef"
12779                 ;;
12780         esac
12781         ;;
12782 esac
12783 set d_vfork
12784 eval $setvar
12785 case "$d_vfork" in
12786 $define) usevfork='true';;
12787 *) usevfork='false';;
12788 esac
12789
12790 : see if this is an sysdir system
12791 set sys/dir.h i_sysdir
12792 eval $inhdr
12793
12794 : see if this is an sysndir system
12795 set sys/ndir.h i_sysndir
12796 eval $inhdr
12797
12798 : see if closedir exists
12799 set closedir d_closedir
12800 eval $inlibc
12801
12802 case "$d_closedir" in
12803 "$define")
12804         echo " "
12805         echo "Checking whether closedir() returns a status..." >&4
12806         cat > closedir.c <<EOM
12807 #$i_dirent I_DIRENT             /**/
12808 #$i_sysdir I_SYS_DIR            /**/
12809 #$i_sysndir I_SYS_NDIR          /**/
12810 #$i_systypes I_SYS_TYPES        /**/
12811
12812 #if defined(I_SYS_TYPES)
12813 #include <sys/types.h>
12814 #endif
12815 #if defined(I_DIRENT)
12816 #include <dirent.h>
12817 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12818 #include <sys/dir.h>
12819 #endif
12820 #else
12821 #ifdef I_SYS_NDIR
12822 #include <sys/ndir.h>
12823 #else
12824 #ifdef I_SYS_DIR
12825 #ifdef hp9000s500
12826 #include <ndir.h>       /* may be wrong in the future */
12827 #else
12828 #include <sys/dir.h>
12829 #endif
12830 #endif
12831 #endif
12832 #endif 
12833 int main() { return closedir(opendir(".")); }
12834 EOM
12835         set closedir
12836         if eval $compile_ok; then
12837                 if ./closedir > /dev/null 2>&1 ; then
12838                         echo "Yes, it does."
12839                         val="$undef"
12840                 else
12841                         echo "No, it doesn't."
12842                         val="$define"
12843                 fi
12844         else
12845                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12846                 val="$define"
12847         fi
12848         ;;
12849 *)
12850         val="$undef";
12851         ;;
12852 esac
12853 set d_void_closedir
12854 eval $setvar
12855 $rm -f closedir*
12856 : see if there is a wait4
12857 set wait4 d_wait4
12858 eval $inlibc
12859
12860 : see if waitpid exists
12861 set waitpid d_waitpid
12862 eval $inlibc
12863
12864 : see if wcstombs exists
12865 set wcstombs d_wcstombs
12866 eval $inlibc
12867
12868 : see if wctomb exists
12869 set wctomb d_wctomb
12870 eval $inlibc
12871
12872 : see if writev exists
12873 set writev d_writev
12874 eval $inlibc
12875
12876 : preserve RCS keywords in files with variable substitution, grrr
12877 Date='$Date'
12878 Id='$Id'
12879 Log='$Log'
12880 RCSfile='$RCSfile'
12881 Revision='$Revision'
12882
12883 : check for alignment requirements
12884 echo " "
12885 case "$crosscompile$multiarch" in
12886 *$define*)
12887         $cat <<EOM
12888 You seem to be either cross-compiling or doing a multiarchitecture build,
12889 skipping the memory alignment check.
12890
12891 EOM
12892         case "$alignbytes" in
12893         '') alignbytes=8 ;;
12894         esac
12895         ;;
12896 *)
12897         case "$alignbytes" in
12898         '') echo "Checking alignment constraints..." >&4
12899                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12900                         $cat >try.c <<'EOCP'
12901 typedef long double NV;
12902 EOCP
12903                 else
12904                         $cat >try.c <<'EOCP'
12905 typedef double NV;
12906 EOCP
12907                 fi
12908                 $cat >>try.c <<'EOCP'
12909 #include <stdio.h>
12910 struct foobar {
12911         char foo;
12912         NV bar;
12913 } try_algn;
12914 int main()
12915 {
12916     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12917     return(0);
12918 }
12919 EOCP
12920                 set try
12921                 if eval $compile_ok; then
12922                         dflt=`./try`
12923                 else
12924                         dflt='8'
12925                         echo "(I can't seem to compile the test program...)"
12926                 fi
12927                 ;;
12928         *) dflt="$alignbytes"
12929                 ;;
12930         esac
12931         rp="Doubles must be aligned on a how-many-byte boundary?"
12932         . ./myread
12933         alignbytes="$ans"
12934         $rm -f try.c try
12935         ;;
12936 esac
12937
12938
12939 : set the base revision
12940 baserev=5.0
12941
12942 : how do we catenate cpp tokens here?
12943 echo " "
12944 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12945 $cat >cpp_stuff.c <<'EOCP'
12946 #define RCAT(a,b)a/**/b
12947 #define ACAT(a,b)a ## b
12948 RCAT(Rei,ser)
12949 ACAT(Cir,cus)
12950 EOCP
12951 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12952 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12953         echo "Oh!  Smells like ANSI's been here." >&4
12954         echo "We can catify or stringify, separately or together!"
12955         cpp_stuff=42
12956 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12957         echo "Ah, yes!  The good old days!" >&4
12958         echo "However, in the good old days we don't know how to stringify and"
12959         echo "catify at the same time."
12960         cpp_stuff=1
12961 else
12962         $cat >&4 <<EOM
12963 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12964 to have to edit the values of CAT[2-5] in config.h...
12965 EOM
12966         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12967 fi
12968 $rm -f cpp_stuff.*
12969
12970 : see if this is a db.h system
12971 set db.h i_db
12972 eval $inhdr
12973
12974 case "$i_db" in
12975 $define)
12976         : Check db version.
12977         echo " "
12978         echo "Checking Berkeley DB version ..." >&4
12979         $cat >try.c <<EOCP
12980 #$d_const HASCONST
12981 #ifndef HASCONST
12982 #define const
12983 #endif
12984 #include <sys/types.h>
12985 #include <stdio.h>
12986 #include <db.h>
12987 int main()
12988 {
12989 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12990     int Major, Minor, Patch ;
12991     unsigned long Version ;
12992     (void)db_version(&Major, &Minor, &Patch) ;
12993     printf("You have Berkeley DB Version 2 or greater\n");
12994
12995     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12996                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12997     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12998                 Major, Minor, Patch) ;
12999
13000     /* check that db.h & libdb are compatible */
13001     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13002         printf("db.h and libdb are incompatible\n") ;
13003         exit(3);        
13004     }
13005
13006     printf("db.h and libdb are compatible\n") ;
13007
13008     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13009                 + DB_VERSION_PATCH ;
13010
13011     /* needs to be >= 2.3.4 */
13012     if (Version < 2003004) {
13013     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13014         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
13015         exit(2);        
13016     }
13017
13018     exit(0);
13019 #else
13020 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13021     printf("You have Berkeley DB Version 1\n");
13022     exit(0);    /* DB version < 2: the coast is clear. */
13023 #else
13024     exit(1);    /* <db.h> not Berkeley DB? */
13025 #endif
13026 #endif
13027 }
13028 EOCP
13029         set try
13030         if eval $compile_ok && ./try; then
13031                 echo 'Looks OK.' >&4
13032         else
13033                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13034                 i_db=$undef
13035                 case " $libs " in
13036                 *"-ldb "*)
13037                         : Remove db from list of libraries to use
13038                         echo "Removing unusable -ldb from library list" >&4
13039                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13040                         shift
13041                         libs="$*"
13042                         echo "libs = $libs" >&4
13043                         ;;
13044                 esac
13045         fi
13046         $rm -f try.*
13047         ;;
13048 esac
13049
13050 case "$i_db" in
13051 define)
13052         : Check the return type needed for hash 
13053         echo " "
13054         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13055         $cat >try.c <<EOCP
13056 #$d_const HASCONST
13057 #ifndef HASCONST
13058 #define const
13059 #endif
13060 #include <sys/types.h>
13061 #include <db.h>
13062
13063 #ifndef DB_VERSION_MAJOR
13064 u_int32_t hash_cb (ptr, size)
13065 const void *ptr;
13066 size_t size;
13067 {
13068 }
13069 HASHINFO info;
13070 int main()
13071 {
13072         info.hash = hash_cb;
13073 }
13074 #endif
13075 EOCP
13076         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13077                 if $contains warning try.out >>/dev/null 2>&1 ; then
13078                         db_hashtype='int'
13079                 else
13080                         db_hashtype='u_int32_t'
13081                 fi
13082         else
13083                 : XXX Maybe we should just give up here.
13084                 db_hashtype=u_int32_t
13085                 $cat try.out >&4
13086                 echo "Help:  I can't seem to compile the db test program." >&4
13087                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13088         fi
13089         $rm -f try.*
13090         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13091         ;;
13092 *)      db_hashtype=u_int32_t
13093         ;;
13094 esac
13095 case "$i_db" in
13096 define)
13097         : Check the return type needed for prefix 
13098         echo " "
13099         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13100         cat >try.c <<EOCP
13101 #$d_const HASCONST
13102 #ifndef HASCONST
13103 #define const
13104 #endif
13105 #include <sys/types.h>
13106 #include <db.h>
13107
13108 #ifndef DB_VERSION_MAJOR
13109 size_t prefix_cb (key1, key2)
13110 const DBT *key1;
13111 const DBT *key2;
13112 {
13113 }
13114 BTREEINFO info;
13115 int main()
13116 {
13117         info.prefix = prefix_cb;
13118 }
13119 #endif
13120 EOCP
13121         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13122                 if $contains warning try.out >>/dev/null 2>&1 ; then
13123                         db_prefixtype='int'
13124                 else
13125                         db_prefixtype='size_t'
13126                 fi
13127         else
13128                 db_prefixtype='size_t'
13129                 : XXX Maybe we should just give up here.
13130                 $cat try.out >&4
13131                 echo "Help:  I can't seem to compile the db test program." >&4
13132                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13133         fi
13134         $rm -f try.*
13135         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13136         ;;
13137 *)      db_prefixtype='size_t'
13138         ;;
13139 esac
13140
13141
13142 : How can we generate normalized random numbers ?
13143 echo " "
13144 echo "Looking for a random number function..." >&4
13145 case "$randfunc" in
13146 '')
13147         if set drand48 val -f; eval $csym; $val; then
13148                 dflt="drand48"
13149                 echo "Good, found drand48()." >&4
13150         elif set random val -f; eval $csym; $val; then
13151                 dflt="random"
13152                 echo "OK, found random()." >&4
13153         else
13154                 dflt="rand"
13155                 echo "Yick, looks like I have to use rand()." >&4
13156         fi
13157         echo " "
13158         ;;
13159 *)
13160         dflt="$randfunc"
13161         ;;
13162 esac
13163 cont=true
13164
13165 case "$ccflags" in
13166 *-Dmy_rand=*|*-Dmy_srand=*)
13167         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13168         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13169         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13170         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13171         ;;
13172 esac
13173
13174 while $test "$cont"; do
13175         rp="Use which function to generate random numbers?"
13176         . ./myread
13177         if $test "$ans" = "$dflt"; then
13178                 : null
13179         else
13180                 randbits=''
13181         fi
13182         randfunc="$ans"
13183         if set $ans val -f; eval $csym; $val; then
13184                 cont=''
13185         else
13186                 dflt=y
13187                 rp="I cannot find function $ans. Use that name anyway?"
13188                 . ./myread
13189                 dflt=rand
13190                 case "$ans" in
13191                         [yY]*) cont='';;
13192                 esac
13193         fi
13194         case "$cont" in
13195         '')
13196                 case "$randfunc" in
13197                 drand48)
13198                         drand01="drand48()"
13199                         seedfunc="srand48"
13200                         randbits=48
13201                         randseedtype=long
13202                         ;;
13203                 rand|random)
13204                         case "$randbits" in
13205                         '')
13206 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13207                                 $cat >try.c <<EOCP
13208 #$i_unistd I_UNISTD
13209 #$i_stdlib I_STDLIB
13210 #include <stdio.h>
13211 #ifdef I_UNISTD
13212 #  include <unistd.h>
13213 #endif
13214 #ifdef I_STDLIB
13215 #  include <stdlib.h>
13216 #endif
13217 int main()
13218 {
13219         register int i;
13220         register unsigned long tmp;
13221         register unsigned long max = 0L;
13222
13223         for (i = 1000; i; i--) {
13224                 tmp = (unsigned long) $randfunc();
13225                 if (tmp > max) max = tmp;
13226         }
13227         for (i = 0; max; i++)
13228                 max /= 2;
13229         printf("%d\n",i);
13230 }
13231 EOCP
13232                                 set try
13233                                 if eval $compile_ok; then
13234                                         dflt=`try`
13235                                 else
13236                                         dflt='?'
13237                                         echo "(I can't seem to compile the test program...)"
13238                                 fi
13239                                 ;;
13240                         *)
13241                                 dflt="$randbits"
13242                                 ;;
13243                         esac
13244                         rp="How many bits does your $randfunc() function produce?"
13245                         . ./myread
13246                         randbits="$ans"
13247                         $rm -f try.c try
13248                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13249                         seedfunc="s$randfunc"
13250                         randseedtype=unsigned
13251                         ;;
13252                 *)
13253                         dflt="31"
13254                         rp="How many bits does your $randfunc() function produce?"
13255                         . ./myread
13256                         randbits="$ans"
13257                         seedfunc="s$randfunc"
13258                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13259                         if set $seedfunc val -f; eval $csym; $val; then
13260                                 echo "(Using $seedfunc() to seed random generator)"
13261                         else
13262                                 echo "(Warning: no $seedfunc() to seed random generator)"
13263                                 seedfunc=rand
13264                         fi
13265                         randseedtype=unsigned
13266                         ;;
13267                 esac
13268                 ;;
13269         esac
13270 done
13271
13272 echo " "
13273 echo "Determining whether or not we are on an EBCDIC system..." >&4
13274 $cat >tebcdic.c <<'EOM'
13275 int main()
13276 {
13277   if ('M'==0xd4) return 0;
13278   return 1;
13279 }
13280 EOM
13281
13282 val=$undef
13283 set tebcdic
13284 if eval $compile_ok; then
13285         if ./tebcdic; then
13286                 echo "You seem to speak EBCDIC." >&4
13287                 val="$define"
13288         else
13289                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13290         fi
13291 else
13292         echo "I'm unable to compile the test program." >&4
13293         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13294 fi
13295 $rm -f tebcdic.c tebcdic
13296 set ebcdic
13297 eval $setvar
13298
13299 echo " "
13300 $cat >&4 <<EOM
13301 Checking how to flush all pending stdio output...
13302 EOM
13303 # I only know how to find the first 32 possibly open files on SunOS.
13304 # See also hints/sunos_4_1.sh and util.c  --AD
13305 case "$osname" in
13306 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13307 esac
13308 $cat >>try.c <<EOCP
13309 #include <stdio.h>
13310 #$i_unistd I_UNISTD
13311 #ifdef I_UNISTD
13312 # include <unistd.h>
13313 #endif
13314 #$d_sysconf HAS_SYSCONF
13315 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13316 #ifdef HAS_STDIO_STREAM_ARRAY
13317 # define STDIO_STREAM_ARRAY $stdio_stream_array
13318 #endif
13319 int main() {
13320   FILE* p = fopen("try.out", "w");
13321 #ifdef TRY_FPUTC
13322   fputc('x', p);
13323 #else
13324 # ifdef TRY_FPRINTF
13325   fprintf(p, "x");
13326 # endif
13327 #endif
13328 #ifdef TRY_FFLUSH_NULL
13329   fflush(NULL);
13330 #endif
13331 #ifdef TRY_FFLUSH_ALL
13332   {
13333     long open_max = -1;
13334 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13335     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13336 # else
13337 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13338     open_max = sysconf(_SC_OPEN_MAX);
13339 #  else
13340 #   ifdef FOPEN_MAX
13341     open_max = FOPEN_MAX;
13342 #   else
13343 #    ifdef OPEN_MAX
13344     open_max = OPEN_MAX;
13345 #    else
13346 #     ifdef _NFILE
13347     open_max = _NFILE;
13348 #     endif
13349 #    endif
13350 #   endif
13351 #  endif
13352 # endif 
13353 # ifdef HAS_STDIO_STREAM_ARRAY
13354     if (open_max > 0) {
13355       long i;
13356       for (i = 0; i < open_max; i++)
13357             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13358                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13359                 STDIO_STREAM_ARRAY[i]._flag)
13360                 fflush(&STDIO_STREAM_ARRAY[i]);
13361     }   
13362   }
13363 # endif
13364 #endif
13365   _exit(42);
13366 }
13367 EOCP
13368 : first we have to find out how _not_ to flush
13369 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13370     output=''
13371     set try -DTRY_FPUTC
13372     if eval $compile; then
13373             $rm -f try.out
13374             ./try$exe_ext 2>/dev/null
13375             if $test ! -s try.out -a "X$?" = X42; then
13376                 output=-DTRY_FPUTC
13377             fi
13378     fi
13379     case "$output" in
13380     '')
13381             set try -DTRY_FPRINTF
13382             $rm -f try.out
13383             if eval $compile; then
13384                     $rm -f try.out
13385                     ./try$exe_ext 2>/dev/null
13386                     if $test ! -s try.out -a "X$?" = X42; then
13387                         output=-DTRY_FPRINTF
13388                     fi
13389             fi
13390         ;;
13391     esac
13392 fi
13393 : check for fflush NULL behaviour
13394 case "$fflushNULL" in
13395 '')     set try -DTRY_FFLUSH_NULL $output
13396         if eval $compile; then
13397                 $rm -f try.out
13398                 ./try$exe_ext 2>/dev/null
13399                 code="$?"
13400                 if $test -s try.out -a "X$code" = X42; then
13401                         fflushNULL="`$cat try.out`"
13402                 else
13403                         if $test "X$code" != X42; then
13404                                 $cat >&4 <<EOM
13405 (If this test failed, don't worry, we'll try another method shortly.)
13406 EOM
13407                         fi
13408                 fi
13409         fi
13410         $rm -f core try.core core.try.*
13411         case "$fflushNULL" in
13412         x)      $cat >&4 <<EOM
13413 Your fflush(NULL) works okay for output streams.
13414 Let's see if it clobbers input pipes...
13415 EOM
13416 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13417 # bug that improperly flushes the input end of pipes.  So we avoid the
13418 # autoflush on fork/system/exec support for now. :-(
13419 $cat >tryp.c <<EOCP
13420 #include <stdio.h>
13421 int
13422 main(int argc, char **argv)
13423 {
13424     char buf[1024];
13425     int i;
13426     char *bp = buf;
13427     while (1) {
13428         while ((i = getc(stdin)) != -1
13429                && (*bp++ = i) != '\n'
13430                && bp < &buf[1024])
13431         /* DO NOTHING */ ;
13432         *bp = '\0';
13433         fprintf(stdout, "%s", buf);
13434         fflush(NULL);
13435         if (i == -1)
13436             return 0;
13437         bp = buf;
13438     }
13439 }
13440 EOCP
13441                 fflushNULL="$define"
13442                 set tryp
13443                 if eval $compile; then
13444                     $rm -f tryp.out
13445                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13446                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13447                        $cat >&4 <<EOM
13448 fflush(NULL) seems to behave okay with input streams.
13449 EOM
13450                         fflushNULL="$define"
13451                     else
13452                         $cat >&4 <<EOM
13453 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13454 EOM
13455                         fflushNULL="$undef"
13456                     fi
13457                 fi
13458                 $rm -f core tryp.c tryp.core core.tryp.*
13459                 ;;
13460         '')     $cat >&4 <<EOM
13461 Your fflush(NULL) isn't working (contrary to ANSI C).
13462 EOM
13463                 fflushNULL="$undef"
13464                 ;;
13465         *)      $cat >&4 <<EOM
13466 Cannot figure out whether your fflush(NULL) works or not.
13467 I'm assuming it doesn't (contrary to ANSI C).
13468 EOM
13469                 fflushNULL="$undef"
13470                 ;;
13471         esac
13472         ;;
13473 $define|true|[yY]*)
13474         fflushNULL="$define"
13475         ;;
13476 *)
13477         fflushNULL="$undef"
13478         ;;
13479 esac
13480 : check explicit looping only if NULL did not work, and if the pipe
13481 : bug does not show up on an explicit flush too
13482 case "$fflushNULL" in
13483 "$undef")
13484         $cat >tryp.c <<EOCP
13485 #include <stdio.h>
13486 int
13487 main(int argc, char **argv)
13488 {
13489     char buf[1024];
13490     int i;
13491     char *bp = buf;
13492     while (1) {
13493         while ((i = getc(stdin)) != -1
13494                && (*bp++ = i) != '\n'
13495                && bp < &buf[1024])
13496         /* DO NOTHING */ ;
13497         *bp = '\0';
13498         fprintf(stdout, "%s", buf);
13499         fflush(stdin);
13500         if (i == -1)
13501             return 0;
13502         bp = buf;
13503     }
13504 }
13505 EOCP
13506         set tryp
13507         if eval $compile; then
13508             $rm -f tryp.out
13509             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13510             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13511                $cat >&4 <<EOM
13512 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13513 EOM
13514                 : now check for fflushall behaviour
13515                 case "$fflushall" in
13516                 '')     set try -DTRY_FFLUSH_ALL $output
13517                         if eval $compile; then
13518                                 $cat >&4 <<EOM
13519 (Now testing the other method--but note that this also may fail.)
13520 EOM
13521                                 $rm -f try.out
13522                                 ./try$exe_ext 2>/dev/null
13523                                 if $test -s try.out -a "X$?" = X42; then
13524                                         fflushall="`$cat try.out`"
13525                                 fi
13526                         fi
13527                         $rm -f core try.core core.try.*
13528                         case "$fflushall" in
13529                         x)      $cat >&4 <<EOM
13530 Whew. Flushing explicitly all the stdio streams works.
13531 EOM
13532                                 fflushall="$define"
13533                                 ;;
13534                         '')     $cat >&4 <<EOM
13535 Sigh. Flushing explicitly all the stdio streams doesn't work.
13536 EOM
13537                                 fflushall="$undef"
13538                                 ;;
13539                         *)      $cat >&4 <<EOM
13540 Cannot figure out whether flushing stdio streams explicitly works or not.
13541 I'm assuming it doesn't.
13542 EOM
13543                                 fflushall="$undef"
13544                                 ;;
13545                         esac
13546                         ;;
13547                 "$define"|true|[yY]*)
13548                         fflushall="$define"
13549                         ;;
13550                 *)
13551                         fflushall="$undef"
13552                         ;;
13553                 esac
13554             else
13555                 $cat >&4 <<EOM
13556 All is futile.  Even fflush(stdin) clobbers input pipes!
13557 EOM
13558                 fflushall="$undef"
13559             fi
13560         else
13561             fflushall="$undef"
13562         fi
13563         $rm -f core tryp.c tryp.core core.tryp.*
13564         ;;
13565 *)      fflushall="$undef"
13566         ;;
13567 esac
13568
13569 case "$fflushNULL$fflushall" in
13570 undefundef)
13571         $cat <<EOM
13572 OK, I give up.  I cannot figure out how to flush pending stdio output.
13573 We won't be flushing handles at all before fork/exec/popen.
13574 EOM
13575         ;;
13576 esac
13577 $rm -f try.* try$exe_ext
13578
13579 : Store the full pathname to the ar program for use in the C program
13580 : Respect a hint or command line value for full_ar.
13581 case "$full_ar" in
13582 '') full_ar=$ar ;;
13583 esac
13584
13585 : Store the full pathname to the sed program for use in the C program
13586 full_sed=$sed
13587
13588 : see what type gids are declared as in the kernel
13589 echo " "
13590 echo "Looking for the type for group ids returned by getgid()."
13591 set gid_t gidtype xxx stdio.h sys/types.h
13592 eval $typedef
13593 case "$gidtype" in
13594 xxx)
13595         xxx=`./findhdr sys/user.h`
13596         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13597         case $1 in
13598         unsigned) dflt="$1 $2" ;;
13599         *) dflt="$1" ;;
13600         esac
13601         ;;
13602 *) dflt="$gidtype";;
13603 esac
13604 case "$gidtype" in
13605 gid_t) echo "gid_t found." ;;
13606 *)      rp="What is the type for group ids returned by getgid()?"
13607         . ./myread
13608         gidtype="$ans"
13609         ;;
13610 esac
13611
13612 echo " "
13613 case "$gidtype" in
13614 *_t) zzz="$gidtype"     ;;
13615 *)   zzz="gid"          ;;
13616 esac
13617 echo "Checking the size of $zzz..." >&4 
13618 cat > try.c <<EOCP
13619 #include <sys/types.h>
13620 #include <stdio.h>
13621 int main() {
13622     printf("%d\n", (int)sizeof($gidtype));
13623     exit(0);
13624 }
13625 EOCP
13626 set try
13627 if eval $compile_ok; then
13628         yyy=`./try`
13629         case "$yyy" in
13630         '')     gidsize=4
13631                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13632                 ;;
13633         *)      gidsize=$yyy
13634                 echo "Your $zzz is $gidsize bytes long."
13635                 ;;
13636         esac
13637 else
13638         gidsize=4
13639         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13640 fi
13641
13642
13643 echo " "
13644 case "$gidtype" in
13645 *_t) zzz="$gidtype"     ;;
13646 *)   zzz="gid"          ;;
13647 esac
13648 echo "Checking the sign of $zzz..." >&4 
13649 cat > try.c <<EOCP
13650 #include <sys/types.h>
13651 #include <stdio.h>
13652 int main() {
13653         $gidtype foo = -1;
13654         if (foo < 0)
13655                 printf("-1\n");
13656         else
13657                 printf("1\n");
13658 }
13659 EOCP
13660 set try
13661 if eval $compile; then
13662         yyy=`./try`
13663         case "$yyy" in
13664         '')     gidsign=1
13665                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13666                 ;;
13667         *)      gidsign=$yyy
13668                 case "$gidsign" in
13669                  1) echo "Your $zzz is unsigned." ;;
13670                 -1) echo "Your $zzz is signed."   ;;
13671                 esac
13672                 ;;
13673         esac
13674 else
13675         gidsign=1
13676         echo "(I can't compile the test program--guessing unsigned.)" >&4
13677 fi
13678
13679
13680 echo " "
13681
13682 if $test X"$quadtype" != X; then
13683
13684 echo "Checking how to print 64-bit integers..." >&4
13685
13686 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13687         $cat >try.c <<'EOCP'
13688 #include <sys/types.h>
13689 #include <stdio.h>
13690 int main() {
13691   int q = 12345678901;
13692   printf("%ld\n", q);
13693 }
13694 EOCP
13695         set try
13696         if eval $compile; then
13697                 yyy=`./try$exe_ext`
13698                 case "$yyy" in
13699                 12345678901)
13700                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13701                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13702                         echo "We will use %d."
13703                         ;;
13704                 esac
13705         fi
13706 fi
13707
13708 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13709         $cat >try.c <<'EOCP'
13710 #include <sys/types.h>
13711 #include <stdio.h>
13712 int main() {
13713   long q = 12345678901;
13714   printf("%ld\n", q);
13715 }
13716 EOCP
13717         set try
13718         if eval $compile; then
13719                 yyy=`./try$exe_ext`
13720                 case "$yyy" in
13721                 12345678901)
13722                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13723                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13724                         echo "We will use %ld."
13725                         ;;
13726                 esac
13727         fi
13728 fi
13729
13730 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13731         $cat >try.c <<'EOCP'
13732 #include <sys/types.h>
13733 #include <inttypes.h>
13734 #include <stdio.h>
13735 int main() {
13736   int64_t q = 12345678901;
13737   printf("%" PRId64 "\n", q);
13738 }
13739 EOCP
13740         set try
13741         if eval $compile; then
13742                 yyy=`./try$exe_ext`
13743                 case "$yyy" in
13744                 12345678901)
13745                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13746                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13747                         echo "We will use the C9X style."
13748                         ;;
13749                 esac
13750         fi
13751 fi
13752
13753 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13754         $cat >try.c <<'EOCP'
13755 #include <sys/types.h>
13756 #include <stdio.h>
13757 int main() {
13758   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13759   printf("%lld\n", q);
13760 }
13761 EOCP
13762         set try
13763         if eval $compile; then
13764                 yyy=`./try$exe_ext`
13765                 case "$yyy" in
13766                 12345678901)
13767                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13768                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13769                         echo "We will use the %lld style."
13770                         ;;
13771                 esac
13772         fi
13773 fi
13774
13775 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13776         $cat >try.c <<EOCP
13777 #include <sys/types.h>
13778 #include <stdio.h>
13779 int main() {
13780   $quadtype q = 12345678901;
13781   printf("%Ld\n", q);
13782 }
13783 EOCP
13784         set try
13785         if eval $compile; then
13786                 yyy=`./try$exe_ext`
13787                 case "$yyy" in
13788                 12345678901)
13789                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13790                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13791                         echo "We will use %Ld."
13792                         ;;
13793                 esac
13794         fi
13795 fi
13796
13797 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13798         $cat >try.c <<EOCP
13799 #include <sys/types.h>
13800 #include <stdio.h>
13801 int main() {
13802   $quadtype q = 12345678901;
13803   printf("%qd\n", q);
13804 }
13805 EOCP
13806         set try
13807         if eval $compile; then
13808                 yyy=`./try$exe_ext`
13809                 case "$yyy" in
13810                 12345678901)
13811                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13812                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13813                         echo "We will use %qd."
13814                         ;;
13815                 esac
13816         fi
13817 fi
13818
13819 if $test X"$sPRId64" = X; then
13820         echo "Cannot figure out how to print 64-bit integers." >&4
13821 fi
13822
13823 $rm -f try try.*
13824
13825 fi
13826
13827 case "$sPRId64" in
13828 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13829         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13830         ;;
13831 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13832         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13833         ;;
13834 esac
13835
13836
13837 echo " "
13838 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13839
13840 if $test X"$ivsize" = X8; then
13841         ivdformat="$sPRId64"
13842         uvuformat="$sPRIu64"
13843         uvoformat="$sPRIo64"
13844         uvxformat="$sPRIx64"
13845         uvXUformat="$sPRIXU64"
13846 else
13847         if $test X"$ivsize" = X"$longsize"; then
13848                 ivdformat='"ld"'
13849                 uvuformat='"lu"'
13850                 uvoformat='"lo"'
13851                 uvxformat='"lx"'
13852                 uvXUformat='"lX"'
13853         else
13854                 if $test X"$ivsize" = X"$intsize"; then
13855                         ivdformat='"d"'
13856                         uvuformat='"u"'
13857                         uvoformat='"o"'
13858                         uvxformat='"x"'
13859                         uvXUformat='"X"'
13860                 else
13861                         : far out
13862                         if $test X"$ivsize" = X"$shortsize"; then
13863                                 ivdformat='"hd"'
13864                                 uvuformat='"hu"'
13865                                 uvoformat='"ho"'
13866                                 uvxformat='"hx"'
13867                                 uvXUformat='"hX"'
13868                         fi
13869                 fi
13870         fi
13871 fi
13872
13873 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13874         nveformat="$sPRIeldbl"
13875         nvfformat="$sPRIfldbl"
13876         nvgformat="$sPRIgldbl"
13877         nvEUformat="$sPRIEUldbl"
13878         nvFUformat="$sPRIFUldbl"
13879         nvGUformat="$sPRIGUldbl"
13880 else
13881         nveformat='"e"'
13882         nvfformat='"f"'
13883         nvgformat='"g"'
13884         nvEUformat='"E"'
13885         nvFUformat='"F"'
13886         nvGUformat='"G"'
13887 fi
13888
13889 case "$ivdformat" in
13890 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13891     exit 1
13892     ;;
13893 esac
13894
13895
13896 echo " "
13897 $echo "Checking the format string to be used for gids..." >&4
13898
13899 case "$gidsign" in
13900 -1)     if $test X"$gidsize" = X"$ivsize"; then
13901                 gidformat="$ivdformat"
13902         else
13903                 if $test X"$gidsize" = X"$longsize"; then
13904                         gidformat='"ld"'
13905                 else
13906                         if $test X"$gidsize" = X"$intsize"; then
13907                                 gidformat='"d"'
13908                         else
13909                                 if $test X"$gidsize" = X"$shortsize"; then
13910                                         gidformat='"hd"'
13911                                 fi
13912                         fi
13913                 fi
13914         fi
13915         ;;
13916 *)      if $test X"$gidsize" = X"$uvsize"; then
13917                 gidformat="$uvuformat"
13918         else
13919                 if $test X"$gidsize" = X"$longsize"; then
13920                         gidformat='"lu"'
13921                 else
13922                         if $test X"$gidsize" = X"$intsize"; then
13923                                 gidformat='"u"'
13924                         else
13925                                 if $test X"$gidsize" = X"$shortsize"; then
13926                                         gidformat='"hu"'
13927                                 fi
13928                         fi
13929                 fi
13930         fi
13931         ;;
13932 esac
13933
13934 : see if getgroups exists
13935 set getgroups d_getgrps
13936 eval $inlibc
13937
13938 : see if setgroups exists
13939 set setgroups d_setgrps
13940 eval $inlibc
13941
13942
13943 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13944 echo " "
13945 case "$d_getgrps$d_setgrps" in
13946 *define*)
13947         case "$groupstype" in
13948         '') dflt="$gidtype" ;;
13949         *)  dflt="$groupstype" ;;
13950         esac
13951         $cat <<EOM
13952 What type of pointer is the second argument to getgroups() and setgroups()?
13953 Usually this is the same as group ids, $gidtype, but not always.
13954
13955 EOM
13956         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13957         . ./myread
13958         groupstype="$ans"
13959         ;;
13960 *)  groupstype="$gidtype";;
13961 esac
13962
13963 echo " "
13964 echo "Checking if your $make program sets \$(MAKE)..." >&4
13965 case "$make_set_make" in
13966 '')
13967         $sed 's/^X //' > testmake.mak << 'EOF'
13968 Xall:
13969 X       @echo 'maketemp="$(MAKE)"'
13970 EOF
13971         case "`$make -f testmake.mak 2>/dev/null`" in
13972         *maketemp=*) make_set_make='#' ;;
13973         *)      make_set_make="MAKE=$make" ;;
13974         esac
13975         $rm -f testmake.mak
13976         ;;
13977 esac
13978 case "$make_set_make" in
13979 '#') echo "Yup, it does.";;
13980 *) echo "Nope, it doesn't.";;
13981 esac
13982
13983 : see what type is used for mode_t
13984 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13985 set mode_t modetype int stdio.h sys/types.h
13986 eval $typedef_ask
13987
13988 : see if stdarg is available
13989 echo " "
13990 if $test `./findhdr stdarg.h`; then
13991         echo "<stdarg.h> found." >&4
13992         valstd="$define"
13993 else
13994         echo "<stdarg.h> NOT found." >&4
13995         valstd="$undef"
13996 fi
13997
13998 : see if varags is available
13999 echo " "
14000 if $test `./findhdr varargs.h`; then
14001         echo "<varargs.h> found." >&4
14002 else
14003         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14004 fi
14005
14006 : set up the varargs testing programs
14007 $cat > varargs.c <<EOP
14008 #ifdef I_STDARG
14009 #include <stdarg.h>
14010 #endif
14011 #ifdef I_VARARGS
14012 #include <varargs.h>
14013 #endif
14014
14015 #ifdef I_STDARG
14016 int f(char *p, ...)
14017 #else
14018 int f(va_alist)
14019 va_dcl
14020 #endif
14021 {
14022         va_list ap;
14023 #ifndef I_STDARG
14024         char *p;
14025 #endif
14026 #ifdef I_STDARG
14027         va_start(ap,p);
14028 #else
14029         va_start(ap);
14030         p = va_arg(ap, char *);
14031 #endif
14032         va_end(ap);
14033 }
14034 EOP
14035 $cat > varargs <<EOP
14036 $startsh
14037 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14038         echo "true"
14039 else
14040         echo "false"
14041 fi
14042 $rm -f varargs$_o
14043 EOP
14044 chmod +x varargs
14045
14046 : now check which varargs header should be included
14047 echo " "
14048 i_varhdr=''
14049 case "$valstd" in
14050 "$define")
14051         if `./varargs I_STDARG`; then
14052                 val='stdarg.h'
14053         elif `./varargs I_VARARGS`; then
14054                 val='varargs.h'
14055         fi
14056         ;;
14057 *)
14058         if `./varargs I_VARARGS`; then
14059                 val='varargs.h'
14060         fi
14061         ;;
14062 esac
14063 case "$val" in
14064 '')
14065 echo "I could not find the definition for va_dcl... You have problems..." >&4
14066         val="$undef"; set i_stdarg; eval $setvar
14067         val="$undef"; set i_varargs; eval $setvar
14068         ;;
14069 *) 
14070         set i_varhdr
14071         eval $setvar
14072         case "$i_varhdr" in
14073         stdarg.h)
14074                 val="$define"; set i_stdarg; eval $setvar
14075                 val="$undef"; set i_varargs; eval $setvar
14076                 ;;
14077         varargs.h)
14078                 val="$undef"; set i_stdarg; eval $setvar
14079                 val="$define"; set i_varargs; eval $setvar
14080                 ;;
14081         esac
14082         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14083 esac
14084 $rm -f varargs*
14085
14086 : see if we need va_copy
14087 echo " "
14088 case "$i_stdarg" in
14089 "$define")
14090         $cat >try.c <<EOCP
14091 #include <stdarg.h>
14092 #include <stdio.h>
14093 #$i_stdlib I_STDLIB
14094 #ifdef I_STDLIB
14095 #include <stdlib.h>
14096 #endif
14097 #include <signal.h>
14098
14099 int
14100 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14101 {
14102   return vfprintf(f, fmt, *valp);
14103 }
14104  
14105 int    
14106 myvfprintf(FILE *f, const  char *fmt, va_list val)
14107 {
14108   return ivfprintf(f, fmt, &val);
14109 }
14110       
14111 int
14112 myprintf(char *fmt, ...) 
14113 {
14114   va_list val;
14115   va_start(val, fmt);
14116   return myvfprintf(stdout, fmt, val); 
14117 }         
14118
14119 int
14120 main(int ac, char **av)
14121 {
14122   signal(SIGSEGV, exit);
14123
14124   myprintf("%s%cs all right, then\n", "that", '\'');                            
14125   exit(0);      
14126 }
14127 EOCP
14128         set try
14129         if eval $compile && ./try 2>&1 >/dev/null; then
14130                 case "`./try`" in
14131                 "that's all right, then")
14132                         okay=yes
14133                         ;;
14134                 esac
14135         fi
14136         case "$okay" in
14137         yes)    echo "It seems that you don't need va_copy()." >&4
14138                 need_va_copy="$undef"
14139                 ;;
14140         *)      echo "It seems that va_copy() or similar will be needed." >&4
14141                 need_va_copy="$define"
14142                 ;;
14143         esac
14144         $rm -f try.* core core.* *.core *.core.*
14145         ;;
14146 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14147         ;;
14148 esac
14149
14150 : define a fucntion to check prototypes
14151 $cat > protochk <<EOSH
14152 $startsh
14153 cc="$cc"
14154 optimize="$optimize"
14155 ccflags="$ccflags"
14156 prototype="$prototype"
14157 define="$define"
14158 rm=$rm
14159 EOSH
14160
14161 $cat >> protochk <<'EOSH'
14162
14163 $rm -f try.c
14164 foo="$1"
14165 shift
14166 while test $# -ge 2; do
14167         case "$1" in
14168                 $define) echo "#include <$2>" >> try.c ;;
14169                 literal) echo "$2" >> try.c ;;
14170         esac
14171     shift 2
14172 done
14173 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14174 cat >> try.c <<'EOCP'
14175 #ifdef CAN_PROTOTYPE
14176 #define _(args) args
14177 #else
14178 #define _(args) ()
14179 #endif
14180 EOCP
14181 echo "$foo" >> try.c
14182 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14183 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14184 status=$?
14185 $rm -f try.[co]
14186 exit $status
14187 EOSH
14188 chmod +x protochk
14189 $eunicefix protochk
14190
14191 : see what type is used for size_t
14192 rp="What is the type used for the length parameter for string functions?"
14193 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14194 eval $typedef_ask
14195
14196 : check for type of arguments to gethostbyaddr. 
14197 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14198         case "$d_gethbyaddr" in
14199         $define)
14200                 $cat <<EOM
14201
14202 Checking to see what type of arguments are accepted by gethostbyaddr().
14203 EOM
14204                 hdrs="$define sys/types.h
14205                         $d_socket sys/socket.h 
14206                         $i_niin netinet/in.h 
14207                         $i_netdb netdb.h
14208                         $i_unistd unistd.h"
14209                 : The first arg can 'char *' or 'void *'
14210                 : The second arg is some of integral type
14211                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14212                         for yyy in size_t long int; do
14213                                 case "$netdb_host_type" in
14214                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14215                                         if ./protochk "$try" $hdrs; then
14216                                                 echo "Your system accepts $xxx for the first arg."
14217                                                 echo "...and $yyy for the second arg."
14218                                                 netdb_host_type="$xxx"
14219                                                 netdb_hlen_type="$yyy"
14220                                         fi
14221                                         ;;
14222                                 esac
14223                         done
14224                 done
14225                 : In case none of those worked, prompt the user.
14226                 case "$netdb_host_type" in
14227                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14228                         dflt='char *'
14229                         . ./myread
14230                         netdb_host_type=$ans
14231                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14232                         dflt="$sizetype"
14233                         . ./myread
14234                         netdb_hlen_type=$ans
14235                         ;;
14236                 esac
14237                 ;;
14238         *)      : no gethostbyaddr, so pick harmless defaults
14239                 netdb_host_type='char *'
14240                 netdb_hlen_type="$sizetype"
14241                 ;;
14242         esac
14243         # Remove the "const" if needed. -- but then we'll have a 
14244         # prototype clash!
14245         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14246 fi
14247
14248 : check for type of argument to gethostbyname. 
14249 if test "X$netdb_name_type" = X ; then
14250         case "$d_gethbyname" in
14251         $define)
14252                 $cat <<EOM
14253
14254 Checking to see what type of argument is accepted by gethostbyname().
14255 EOM
14256                 hdrs="$define sys/types.h
14257                         $d_socket sys/socket.h 
14258                         $i_niin netinet/in.h 
14259                         $i_netdb netdb.h
14260                         $i_unistd unistd.h"
14261                 for xxx in "const char *" "char *"; do
14262                         case "$netdb_name_type" in
14263                         '')     try="extern struct hostent *gethostbyname($xxx);"
14264                                 if ./protochk "$try" $hdrs; then
14265                                         echo "Your system accepts $xxx."
14266                                         netdb_name_type="$xxx"
14267                                 fi
14268                                 ;;
14269                         esac
14270                 done
14271                 : In case none of those worked, prompt the user.
14272                 case "$netdb_name_type" in
14273                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14274                         dflt='char *'
14275                         . ./myread
14276                         netdb_name_type=$ans
14277                         ;;
14278                 esac
14279                 ;;
14280         *)      : no gethostbyname, so pick harmless default
14281                 netdb_name_type='char *'
14282                 ;;
14283         esac
14284 fi
14285
14286 : check for type of 1st argument to getnetbyaddr. 
14287 if test "X$netdb_net_type" = X ; then
14288         case "$d_getnbyaddr" in
14289         $define)
14290                 $cat <<EOM
14291
14292 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14293 EOM
14294                 hdrs="$define sys/types.h
14295                         $d_socket sys/socket.h 
14296                         $i_niin netinet/in.h 
14297                         $i_netdb netdb.h
14298                         $i_unistd unistd.h"
14299                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14300                         case "$netdb_net_type" in
14301                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14302                                 if ./protochk "$try" $hdrs; then
14303                                         echo "Your system accepts $xxx."
14304                                         netdb_net_type="$xxx"
14305                                 fi
14306                                 ;;
14307                         esac
14308                 done
14309                 : In case none of those worked, prompt the user.
14310                 case "$netdb_net_type" in
14311                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14312                         dflt='long'
14313                         . ./myread
14314                         netdb_net_type=$ans
14315                         ;;
14316                 esac
14317                 ;;
14318         *)      : no getnetbyaddr, so pick harmless default
14319                 netdb_net_type='long'
14320                 ;;
14321         esac
14322 fi
14323 : locate the preferred pager for this system
14324 case "$pager" in
14325 '')
14326         dflt=''
14327         case "$pg" in
14328         /*) dflt=$pg;;
14329         [a-zA-Z]:/*) dflt=$pg;;
14330         esac
14331         case "$more" in
14332         /*) dflt=$more;;
14333         [a-zA-Z]:/*) dflt=$more;;
14334         esac
14335         case "$less" in
14336         /*) dflt=$less;;
14337         [a-zA-Z]:/*) dflt=$less;;
14338         esac
14339         case "$dflt" in
14340         '') dflt=/usr/ucb/more;;
14341         esac
14342         ;;
14343 *) dflt="$pager";;
14344 esac
14345 echo " "
14346 fn=f/
14347 rp='What pager is used on your system?'
14348 . ./getfile
14349 pager="$ans"
14350
14351 : see what type pids are declared as in the kernel
14352 rp="What is the type of process ids on this system?"
14353 set pid_t pidtype int stdio.h sys/types.h
14354 eval $typedef_ask
14355
14356 : Find earliest binary compatible site_perl subdirectory perl can use.
14357 case "$bincompat5005" in
14358 "$define") xs_apiversion='5.005' ;;
14359 *) xs_apiversion=$version ;;   # The current site_perl version.
14360 esac
14361 : Find earliest pure perl site_perl subdirectory perl can use.
14362 : The versioned directories started at 5.005.
14363 pm_apiversion='5.005'
14364
14365 : see if ar generates random libraries by itself
14366 echo " "
14367 echo "Checking how to generate random libraries on your machine..." >&4
14368 echo 'int bar1() { return bar2(); }' > bar1.c
14369 echo 'int bar2() { return 2; }' > bar2.c
14370 $cat > foo.c <<'EOP'
14371 int main() { printf("%d\n", bar1()); exit(0); }
14372 EOP
14373 $cc $ccflags -c bar1.c >/dev/null 2>&1
14374 $cc $ccflags -c bar2.c >/dev/null 2>&1
14375 $cc $ccflags -c foo.c >/dev/null 2>&1
14376 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14377 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14378         ./foobar >/dev/null 2>&1; then
14379         echo "$ar appears to generate random libraries itself."
14380         orderlib=false
14381         ranlib=":"
14382 elif $ar ts bar$_a >/dev/null 2>&1 &&
14383         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14384         ./foobar >/dev/null 2>&1; then
14385                 echo "a table of contents needs to be added with '$ar ts'."
14386                 orderlib=false
14387                 ranlib="$ar ts"
14388 else
14389         case "$ranlib" in
14390         :) ranlib='';;
14391         '')
14392                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14393                 $test -f $ranlib || ranlib=''
14394                 ;;
14395         esac
14396         if $test -n "$ranlib"; then
14397                 echo "your system has '$ranlib'; we'll use that."
14398                 orderlib=false
14399         else
14400                 echo "your system doesn't seem to support random libraries"
14401                 echo "so we'll use lorder and tsort to order the libraries."
14402                 orderlib=true
14403                 ranlib=":"
14404         fi
14405 fi
14406 $rm -f foo* bar* 
14407
14408 : check for type of arguments to select. 
14409 case "$selecttype" in
14410 '') case "$d_select" in
14411         $define)
14412                 echo " "
14413                 $cat <<EOM
14414 Checking to see what type of arguments are accepted by select().
14415 EOM
14416                 hdrs="$define sys/types.h
14417                         $i_systime sys/time.h 
14418                         $i_sysselct sys/select.h
14419                         $d_socket sys/socket.h"
14420                 : The first arg can be int, unsigned, or size_t
14421                 : The last arg may or may not be 'const'
14422                 val=''
14423                 : void pointer has been seen but using that
14424                 : breaks the selectminbits test
14425                 for xxx in 'fd_set *' 'int *'; do
14426                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14427                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14428                                         case "$val" in
14429                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14430                                                 if ./protochk "$try" $hdrs; then
14431                                                         echo "Your system accepts $xxx."
14432                                                         val="$xxx"
14433                                                 fi
14434                                                 ;;
14435                                         esac
14436                                 done
14437                         done
14438                 done
14439                 case "$val" in
14440                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14441                         case "$d_fd_set" in
14442                                 $define) dflt="fd_set *" ;;
14443                                 *)              dflt="int *" ;;
14444                         esac
14445                         . ./myread
14446                         val=$ans
14447                         ;;
14448                 esac
14449                 selecttype="$val"
14450                 ;;
14451         *)      : no select, so pick a harmless default
14452                 selecttype='int *'
14453                 ;;
14454         esac
14455         ;;
14456 esac
14457
14458 : check for the select 'width'
14459 case "$selectminbits" in
14460 '') case "$d_select" in
14461         $define)
14462                 $cat <<EOM
14463
14464 Checking to see on how many bits at a time your select() operates...
14465 EOM
14466                 $cat >try.c <<EOCP
14467 #include <sys/types.h>
14468 #$i_time I_TIME
14469 #$i_systime I_SYS_TIME
14470 #$i_systimek I_SYS_TIME_KERNEL
14471 #ifdef I_TIME
14472 #   include <time.h>
14473 #endif
14474 #ifdef I_SYS_TIME
14475 #   ifdef I_SYS_TIME_KERNEL
14476 #       define KERNEL
14477 #   endif
14478 #   include <sys/time.h>
14479 #   ifdef I_SYS_TIME_KERNEL
14480 #       undef KERNEL
14481 #   endif
14482 #endif
14483 #$i_sysselct I_SYS_SELECT
14484 #ifdef I_SYS_SELECT
14485 #include <sys/select.h>
14486 #endif
14487 #$d_socket HAS_SOCKET
14488 #ifdef HAS_SOCKET
14489 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14490 #endif
14491 #include <stdio.h>
14492 $selecttype b;
14493 #define S sizeof(*(b))
14494 #define MINBITS 64
14495 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14496 #define NBITS  (NBYTES * 8)
14497 int main() {
14498     char s[NBYTES];
14499     struct timeval t;
14500     int i;
14501     FILE* fp;
14502     int fd;
14503
14504     fclose(stdin);
14505     fp = fopen("try.c", "r");
14506     if (fp == 0)
14507       exit(1);
14508     fd = fileno(fp);
14509     if (fd < 0)
14510       exit(2);
14511     b = ($selecttype)s;
14512     for (i = 0; i < NBITS; i++)
14513         FD_SET(i, b);
14514     t.tv_sec  = 0;
14515     t.tv_usec = 0;
14516     select(fd + 1, b, 0, 0, &t);
14517     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14518     printf("%d\n", i + 1);
14519     return 0;
14520 }
14521 EOCP
14522                 set try
14523                 if eval $compile_ok; then
14524                         selectminbits=`./try`
14525                         case "$selectminbits" in
14526                         '')     cat >&4 <<EOM
14527 Cannot figure out on how many bits at a time your select() operates.
14528 I'll play safe and guess it is 32 bits.
14529 EOM
14530                                 selectminbits=32
14531                                 bits="32 bits"
14532                                 ;;
14533                         1)      bits="1 bit" ;;
14534                         *)      bits="$selectminbits bits" ;;
14535                         esac
14536                         echo "Your select() operates on $bits at a time." >&4
14537                 else
14538                         rp='What is the minimum number of bits your select() operates on?'
14539                         case "$byteorder" in
14540                         1234|12345678)  dflt=32 ;;
14541                         *)              dflt=1  ;;
14542                         esac
14543                         . ./myread
14544                         val=$ans
14545                         selectminbits="$val"
14546                 fi
14547                 $rm -f try.* try
14548                 ;;
14549         *)      : no select, so pick a harmless default
14550                 selectminbits='32'
14551                 ;;
14552         esac
14553         ;;
14554 esac
14555
14556 : Trace out the files included by signal.h, then look for SIGxxx names.
14557 : Remove SIGARRAYSIZE used by HPUX.
14558 : Remove SIGSTKSIZE used by Linux.
14559 : Remove SIGSTKSZ used by Posix.
14560 : Remove SIGTYP void lines used by OS2.
14561 : Some cpps, like os390, dont give the file name anywhere
14562 if [ "X$fieldn" = X ]; then
14563         : Just make some guesses.  We check them later.
14564         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14565 else
14566         xxx=`echo '#include <signal.h>' |
14567         $cppstdin $cppminus $cppflags 2>/dev/null |
14568         $grep '^[       ]*#.*include' | 
14569         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14570 fi
14571 : Check this list of files to be sure we have parsed the cpp output ok.
14572 : This will also avoid potentially non-existent files, such 
14573 : as ../foo/bar.h
14574 xxxfiles=''
14575 for xx in $xxx /dev/null ; do
14576         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14577 done
14578 : If we have found no files, at least try signal.h
14579 case "$xxxfiles" in
14580 '')     xxxfiles=`./findhdr signal.h` ;;
14581 esac
14582 xxx=`awk '
14583 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14584         print substr($2, 4, 20)
14585 }
14586 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14587         print substr($3, 4, 20)
14588 }' $xxxfiles`
14589 : Append some common names just in case the awk scan failed.
14590 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14591 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14592 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14593 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14594 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14595
14596 : generate a few handy files for later
14597 $cat > signal.c <<'EOCP'
14598 #include <sys/types.h>
14599 #include <signal.h>
14600 #include <stdio.h>
14601 int main() {
14602
14603 /* Strange style to avoid deeply-nested #if/#else/#endif */
14604 #ifndef NSIG
14605 #  ifdef _NSIG
14606 #    define NSIG (_NSIG)
14607 #  endif
14608 #endif
14609
14610 #ifndef NSIG
14611 #  ifdef SIGMAX
14612 #    define NSIG (SIGMAX+1)
14613 #  endif
14614 #endif
14615
14616 #ifndef NSIG
14617 #  ifdef SIG_MAX
14618 #    define NSIG (SIG_MAX+1)
14619 #  endif
14620 #endif
14621
14622 #ifndef NSIG
14623 #  ifdef MAXSIG
14624 #    define NSIG (MAXSIG+1)
14625 #  endif
14626 #endif
14627
14628 #ifndef NSIG
14629 #  ifdef MAX_SIG
14630 #    define NSIG (MAX_SIG+1)
14631 #  endif
14632 #endif
14633
14634 #ifndef NSIG
14635 #  ifdef SIGARRAYSIZE
14636 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14637 #  endif
14638 #endif
14639
14640 #ifndef NSIG
14641 #  ifdef _sys_nsig
14642 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14643 #  endif
14644 #endif
14645
14646 /* Default to some arbitrary number that's big enough to get most
14647    of the common signals.
14648 */
14649 #ifndef NSIG
14650 #    define NSIG 50
14651 #endif
14652
14653 printf("NSIG %d\n", NSIG);
14654
14655 #ifndef JUST_NSIG
14656
14657 EOCP
14658
14659 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14660 {
14661         printf "#ifdef SIG"; printf $1; printf "\n"
14662         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14663         printf $1; printf ");\n"
14664         printf "#endif\n"
14665 }
14666 END {
14667         printf "#endif /* JUST_NSIG */\n";
14668         printf "exit(0);\n}\n";
14669 }
14670 ' >>signal.c
14671 $cat >signal.awk <<'EOP'
14672 BEGIN { ndups = 0 }
14673 $1 ~ /^NSIG$/ { nsig = $2 }
14674 ($1 !~ /^NSIG$/) && (NF == 2) {
14675     if ($2 > maxsig) { maxsig = $2 }
14676     if (sig_name[$2]) {
14677         dup_name[ndups] = $1
14678         dup_num[ndups] = $2
14679         ndups++ 
14680     }
14681     else {
14682         sig_name[$2] = $1
14683         sig_num[$2] = $2
14684     }
14685 }
14686 END { 
14687     if (nsig == 0) {
14688         nsig = maxsig + 1
14689     }
14690     printf("NSIG %d\n", nsig);
14691     for (n = 1; n < nsig; n++) {
14692         if (sig_name[n]) {
14693             printf("%s %d\n", sig_name[n], sig_num[n])
14694         }
14695         else {
14696             printf("NUM%d %d\n", n, n) 
14697         }
14698     }
14699     for (n = 0; n < ndups; n++) {
14700         printf("%s %d\n", dup_name[n], dup_num[n])
14701     }
14702 }
14703 EOP
14704 $cat >signal_cmd <<EOS
14705 $startsh
14706 if $test -s signal.lst; then
14707     echo "Using your existing signal.lst file"
14708         exit 0
14709 fi
14710 xxx="$xxx"
14711 EOS
14712 $cat >>signal_cmd <<'EOS'
14713
14714 set signal
14715 if eval $compile_ok; then
14716         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14717 else
14718         echo "(I can't seem be able to compile the whole test program)" >&4
14719         echo "(I'll try it in little pieces.)" >&4
14720         set signal -DJUST_NSIG
14721         if eval $compile_ok; then
14722                 ./signal$_exe > signal.nsg
14723                 $cat signal.nsg
14724         else
14725                 echo "I can't seem to figure out how many signals you have." >&4
14726                 echo "Guessing 50." >&4
14727                 echo 'NSIG 50' > signal.nsg
14728         fi
14729         : Now look at all the signal names, one at a time.
14730         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14731                 $cat > signal.c <<EOCP
14732 #include <sys/types.h>
14733 #include <signal.h>
14734 #include <stdio.h>
14735 int main() {
14736 printf("$xx %d\n", SIG${xx});
14737 return 0;
14738 }
14739 EOCP
14740                 set signal
14741                 if eval $compile; then
14742                         echo "SIG${xx} found."
14743                         ./signal$_exe  >> signal.ls1
14744                 else
14745                         echo "SIG${xx} NOT found."
14746                 fi
14747         done
14748         if $test -s signal.ls1; then
14749                 $cat signal.nsg signal.ls1 |
14750                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14751         fi
14752
14753 fi
14754 if $test -s signal.lst; then
14755         :
14756 else
14757         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14758         echo 'kill -l' >signal
14759         set X `csh -f <signal`
14760         $rm -f signal
14761         shift
14762         case $# in
14763         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14764         esac
14765         echo $@ | $tr ' ' $trnl | \
14766             $awk '{ printf "%s %d\n", $1, ++s; }
14767                   END { printf "NSIG %d\n", ++s }' >signal.lst
14768 fi
14769 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14770 EOS
14771 chmod a+x signal_cmd
14772 $eunicefix signal_cmd
14773
14774 : generate list of signal names
14775 echo " "
14776 case "$sig_name_init" in
14777 '') doinit=yes ;;
14778 *)  case "$sig_num_init" in
14779     ''|*,*) doinit=yes ;;
14780     esac ;;
14781 esac
14782 case "$doinit" in
14783 yes)
14784         echo "Generating a list of signal names and numbers..." >&4
14785         . ./signal_cmd
14786         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14787         sig_name=`$awk 'BEGIN { printf "ZERO " }
14788                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14789         sig_num=`$awk  'BEGIN { printf "0 " }
14790                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14791         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14792                              !/^NSIG/   { printf "\"%s\", ", $1 }
14793                              END        { printf "0\n" }' signal.lst`
14794         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14795                              !/^NSIG/   { printf "%d, ", $2}
14796                              END        { printf "0\n"}' signal.lst`
14797         ;;
14798 esac
14799 echo "The following $sig_count signals are available:"
14800 echo " "
14801 echo $sig_name | $awk \
14802 'BEGIN { linelen = 0 }
14803 {
14804         for (i = 1; i <= NF; i++) {
14805                 name = "SIG" $i " "
14806                 linelen = linelen + length(name)
14807                 if (linelen > 70) {
14808                         printf "\n"
14809                         linelen = length(name)
14810                 }
14811                 printf "%s", name
14812         }
14813         printf "\n"
14814 }'
14815 sig_size=`echo $sig_name | awk '{print NF}'`
14816 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14817
14818 echo " "
14819 case "$sizetype" in
14820 *_t) zzz="$sizetype"    ;;
14821 *)   zzz="filesize"     ;;
14822 esac
14823 echo "Checking the size of $zzz..." >&4 
14824 cat > try.c <<EOCP
14825 #include <sys/types.h>
14826 #include <stdio.h>
14827 int main() {
14828     printf("%d\n", (int)sizeof($sizetype));
14829     exit(0);
14830 }
14831 EOCP
14832 set try
14833 if eval $compile_ok; then
14834         yyy=`./try`
14835         case "$yyy" in
14836         '')     sizesize=4
14837                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14838                 ;;
14839         *)      sizesize=$yyy
14840                 echo "Your $zzz size is $sizesize bytes."
14841                 ;;
14842         esac
14843 else
14844         sizesize=4
14845         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14846 fi
14847
14848
14849 : check for socklen_t
14850 echo " "
14851 echo "Checking to see if you have socklen_t..." >&4
14852 $cat >try.c <<EOCP
14853 #include <sys/types.h>
14854 #$d_socket HAS_SOCKET
14855 #ifdef HAS_SOCKET
14856 #include <sys/socket.h>
14857 #endif
14858 int main() { socklen_t x = 16; }
14859 EOCP
14860 set try
14861 if eval $compile; then
14862         val="$define"
14863         echo "You have socklen_t."
14864 else
14865         val="$undef"
14866         echo "You do not have socklen_t."
14867         case "$sizetype" in
14868         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14869         esac
14870 fi
14871 $rm -f try try.*
14872 set d_socklen_t
14873 eval $setvar
14874
14875 : see if this is a socks.h system
14876 set socks.h i_socks
14877 eval $inhdr
14878
14879 : check for type of the size argument to socket calls
14880 case "$d_socket" in
14881 "$define")
14882         $cat <<EOM
14883
14884 Checking to see what type is the last argument of accept().
14885 EOM
14886         yyy=''
14887         case "$d_socklen_t" in
14888         "$define") yyy="$yyy socklen_t"
14889         esac
14890         yyy="$yyy $sizetype int long unsigned"
14891         for xxx in $yyy; do
14892                 case "$socksizetype" in
14893                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14894                         case "$usesocks" in
14895                         "$define")
14896                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14897                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14898                                         socksizetype="$xxx"
14899                                 fi
14900                                 ;;
14901                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14902                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14903                                         socksizetype="$xxx"
14904                                 fi
14905                                 ;;
14906                         esac
14907                         ;;
14908                 esac
14909         done
14910 : In case none of those worked, prompt the user.
14911         case "$socksizetype" in
14912         '')     rp='What is the type for socket address structure sizes?'
14913                 dflt='int'
14914                 . ./myread
14915                 socksizetype=$ans
14916                 ;;
14917         esac
14918         ;;
14919 *)      : no sockets, so pick relatively harmless default
14920         socksizetype='int'
14921         ;;
14922 esac
14923
14924 : see what type is used for signed size_t
14925 set ssize_t ssizetype int stdio.h sys/types.h
14926 eval $typedef
14927 dflt="$ssizetype"
14928 $cat > ssize.c <<EOM
14929 #include <stdio.h>
14930 #include <sys/types.h>
14931 #define Size_t $sizetype
14932 #define SSize_t $dflt
14933 int main()
14934 {
14935         if (sizeof(Size_t) == sizeof(SSize_t))
14936                 printf("$dflt\n");
14937         else if (sizeof(Size_t) == sizeof(int))
14938                 printf("int\n");
14939         else 
14940                 printf("long\n");
14941         exit(0);
14942 }
14943 EOM
14944 echo " "
14945 set ssize
14946 if eval $compile_ok && ./ssize > /dev/null; then
14947         ssizetype=`./ssize`
14948         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14949 else
14950         $cat >&4 <<EOM
14951 Help! I can't compile and run the ssize_t test program: please enlighten me!
14952 (This is probably a misconfiguration in your system or libraries, and
14953 you really ought to fix it.  Still, I'll try anyway.)
14954
14955 I need a type that is the same size as $sizetype, but is guaranteed to
14956 be signed.  Common values are ssize_t, int and long.
14957
14958 EOM
14959         rp="What signed type is the same size as $sizetype?"
14960         . ./myread
14961         ssizetype="$ans"
14962 fi
14963 $rm -f ssize ssize.*
14964
14965 : see what type of char stdio uses.
14966 echo " "
14967 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14968 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14969         echo "Your stdio uses unsigned chars." >&4
14970         stdchar="unsigned char"
14971 else
14972         echo "Your stdio uses signed chars." >&4
14973         stdchar="char"
14974 fi
14975 $rm -f stdioh
14976
14977
14978
14979 : see if time exists
14980 echo " "
14981 if test "X$d_time" = X -o X"$timetype" = X; then
14982     if set time val -f d_time; eval $csym; $val; then
14983                 echo 'time() found.' >&4
14984                 val="$define"
14985                 rp="What is the type returned by time() on this system?"
14986                 set time_t timetype long stdio.h sys/types.h
14987                 eval $typedef_ask
14988     else
14989                 echo 'time() not found, hope that will do.' >&4
14990                 val="$undef"
14991                 timetype='int';
14992     fi
14993     set d_time
14994     eval $setvar
14995 fi
14996
14997 : see what type uids are declared as in the kernel
14998 echo " "
14999 echo "Looking for the type for user ids returned by getuid()."
15000 set uid_t uidtype xxx stdio.h sys/types.h
15001 eval $typedef
15002 case "$uidtype" in
15003 xxx)
15004         xxx=`./findhdr sys/user.h`
15005         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15006         case $1 in
15007         unsigned) dflt="$1 $2" ;;
15008         *) dflt="$1" ;;
15009         esac
15010         ;;
15011 *) dflt="$uidtype";;
15012 esac
15013 case "$uidtype" in
15014 uid_t)  echo "uid_t found." ;;
15015 *)      rp="What is the type for user ids returned by getuid()?"
15016         . ./myread
15017         uidtype="$ans"
15018         ;;
15019 esac
15020
15021 echo " "
15022 case "$uidtype" in
15023 *_t) zzz="$uidtype"     ;;
15024 *)   zzz="uid"          ;;
15025 esac
15026 echo "Checking the size of $zzz..." >&4 
15027 cat > try.c <<EOCP
15028 #include <sys/types.h>
15029 #include <stdio.h>
15030 int main() {
15031     printf("%d\n", (int)sizeof($uidtype));
15032     exit(0);
15033 }
15034 EOCP
15035 set try
15036 if eval $compile_ok; then
15037         yyy=`./try`
15038         case "$yyy" in
15039         '')     uidsize=4
15040                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15041                 ;;
15042         *)      uidsize=$yyy
15043                 echo "Your $zzz is $uidsize bytes long."
15044                 ;;
15045         esac
15046 else
15047         uidsize=4
15048         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15049 fi
15050
15051 echo " "
15052 case "$uidtype" in
15053 *_t) zzz="$uidtype"     ;;
15054 *)   zzz="uid"          ;;
15055 esac
15056 echo "Checking the sign of $zzz..." >&4
15057 cat > try.c <<EOCP
15058 #include <sys/types.h>
15059 #include <stdio.h>
15060 int main() {
15061         $uidtype foo = -1;
15062         if (foo < 0)
15063                 printf("-1\n");
15064         else
15065                 printf("1\n");
15066 }
15067 EOCP
15068 set try
15069 if eval $compile; then
15070         yyy=`./try`
15071         case "$yyy" in
15072         '')     uidsign=1
15073                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15074                 ;;
15075         *)      uidsign=$yyy
15076                 case "$uidsign" in
15077                  1) echo "Your $zzz is unsigned." ;;
15078                 -1) echo "Your $zzz is signed."   ;;
15079                 esac
15080                 ;;
15081         esac
15082 else
15083         uidsign=1
15084         echo "(I can't compile the test program--guessing unsigned.)" >&4
15085 fi
15086
15087
15088
15089 echo " "
15090 $echo "Checking the format string to be used for uids..." >&4
15091
15092 case "$uidsign" in
15093 -1)     if $test X"$uidsize" = X"$ivsize"; then
15094                 uidformat="$ivdformat"
15095         else
15096                 if $test X"$uidsize" = X"$longsize"; then
15097                         uidformat='"ld"'
15098                 else
15099                         if $test X"$uidsize" = X"$intsize"; then
15100                                 uidformat='"d"'
15101                         else
15102                                 if $test X"$uidsize" = X"$shortsize"; then
15103                                         uidformat='"hd"'
15104                                 fi
15105                         fi
15106                 fi
15107         fi
15108         ;;
15109 *)      if $test X"$uidsize" = X"$uvsize"; then
15110                 uidformat="$uvuformat"
15111         else
15112                 if $test X"$uidsize" = X"$longsize"; then
15113                         uidformat='"lu"'
15114                 else
15115                         if $test X"$uidsize" = X"$intsize"; then
15116                                 uidformat='"u"'
15117                         else
15118                                 if $test X"$uidsize" = X"$shortsize"; then
15119                                         uidformat='"hu"'
15120                                 fi
15121                         fi
15122                 fi
15123         fi
15124         ;;
15125 esac
15126
15127 : determine compiler compiler
15128 case "$yacc" in
15129 '')
15130         dflt=yacc;;
15131 *)
15132         dflt="$yacc";;
15133 esac
15134 echo " "
15135 comp='yacc'
15136 if $test -f "$byacc"; then
15137         dflt="$byacc"
15138         comp="byacc or $comp"
15139 fi
15140 if $test -f "$bison"; then
15141         comp="$comp or bison -y"
15142 fi
15143 rp="Which compiler compiler ($comp) shall I use?"
15144 . ./myread
15145 yacc="$ans"
15146 case "$yacc" in
15147 *bis*)
15148         case "$yacc" in
15149         *-y*) ;;
15150         *)
15151                 yacc="$yacc -y"
15152                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15153                 ;;
15154         esac
15155         ;;
15156 esac
15157
15158 : see if dbm.h is available
15159 : see if dbmclose exists
15160 set dbmclose d_dbmclose
15161 eval $inlibc
15162
15163 case "$d_dbmclose" in
15164 $define)
15165         set dbm.h i_dbm
15166         eval $inhdr
15167         case "$i_dbm" in
15168         $define)
15169                 val="$undef"
15170                 set i_rpcsvcdbm
15171                 eval $setvar
15172                 ;;
15173         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15174                 eval $inhdr
15175                 ;;
15176         esac
15177         ;;
15178 *)      echo "We won't be including <dbm.h>"
15179         val="$undef"
15180         set i_dbm
15181         eval $setvar
15182         val="$undef"
15183         set i_rpcsvcdbm
15184         eval $setvar
15185         ;;
15186 esac
15187
15188 : see if this is a sys/file.h system
15189 val=''
15190 set sys/file.h val
15191 eval $inhdr
15192
15193 : do we need to include sys/file.h ?
15194 case "$val" in
15195 "$define")
15196         echo " "
15197         if $h_sysfile; then
15198                 val="$define"
15199                 echo "We'll be including <sys/file.h>." >&4
15200         else
15201                 val="$undef"
15202                 echo "We won't be including <sys/file.h>." >&4
15203         fi
15204         ;;
15205 *)
15206         h_sysfile=false
15207         ;;
15208 esac
15209 set i_sysfile
15210 eval $setvar
15211
15212 : see if fcntl.h is there
15213 val=''
15214 set fcntl.h val
15215 eval $inhdr
15216
15217 : see if we can include fcntl.h
15218 case "$val" in
15219 "$define")
15220         echo " "
15221         if $h_fcntl; then
15222                 val="$define"
15223                 echo "We'll be including <fcntl.h>." >&4
15224         else
15225                 val="$undef"
15226                 if $h_sysfile; then
15227         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15228                 else
15229                         echo "We won't be including <fcntl.h>." >&4
15230                 fi
15231         fi
15232         ;;
15233 *)
15234         h_fcntl=false
15235         val="$undef"
15236         ;;
15237 esac
15238 set i_fcntl
15239 eval $setvar
15240
15241 : see if this is a iconv.h system
15242 set iconv.h i_iconv
15243 eval $inhdr
15244
15245 : see if this is a ieeefp.h system
15246 set ieeefp.h i_ieeefp
15247 eval $inhdr
15248
15249 : see if this is a libutil.h system
15250 set libutil.h i_libutil
15251 eval $inhdr
15252
15253 : see if locale.h is available
15254 set locale.h i_locale
15255 eval $inhdr
15256
15257 : see if mach cthreads are available
15258 if test "X$usethreads" = "X$define"; then
15259         set mach/cthreads.h i_machcthr
15260         eval $inhdr
15261 else
15262         i_machcthr="$undef"
15263 fi
15264
15265
15266
15267 : see if this is a math.h system
15268 set math.h i_math
15269 eval $inhdr
15270
15271 : see if this is a mntent.h system
15272 set mntent.h i_mntent
15273 eval $inhdr
15274
15275 : see if ndbm.h is available
15276 set ndbm.h t_ndbm
15277 eval $inhdr
15278 case "$t_ndbm" in
15279 $define)
15280         : see if dbm_open exists
15281         set dbm_open d_dbm_open
15282         eval $inlibc
15283         case "$d_dbm_open" in
15284         $undef)
15285                 t_ndbm="$undef"
15286                 echo "We won't be including <ndbm.h>"
15287                 ;;
15288         esac
15289         ;;
15290 esac
15291 val="$t_ndbm"
15292 set i_ndbm
15293 eval $setvar
15294
15295 : see if net/errno.h is available
15296 val=''
15297 set net/errno.h val
15298 eval $inhdr
15299
15300 : Unfortunately, it causes problems on some systems.  Arrgh.
15301 case "$val" in
15302 $define)
15303         cat > try.c <<'EOM'
15304 #include <stdio.h>
15305 #include <errno.h>
15306 #include <net/errno.h>
15307 int func()
15308 {
15309         return ENOTSOCK;
15310 }
15311 EOM
15312         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15313                 echo "We'll be including <net/errno.h>." >&4
15314         else
15315                 echo "We won't be including <net/errno.h>." >&4
15316                 val="$undef"
15317         fi
15318         $rm -f try.* try
15319         ;;
15320 esac
15321 set i_neterrno
15322 eval $setvar
15323
15324 : see if netinet/tcp.h is available
15325 set netinet/tcp.h i_netinettcp
15326 eval $inhdr
15327
15328 : see if this is a poll.h system
15329 set poll.h i_poll
15330 eval $inhdr
15331
15332 : see if this is a prot.h system
15333 set prot.h i_prot
15334 eval $inhdr
15335
15336 echo " "
15337 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15338 $cat <<'EOSH' > Cppsym.know
15339 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15340 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15341 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15342 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15343 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15344 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15345 bull c cadmus clipper CMU COFF COMPILER_VERSION
15346 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15347 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15348 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15349 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15350 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15351 H3050R H3050RX hbullx20 hcx host_mips
15352 hp200 hp300 hp700 HP700 hp800 hp9000
15353 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15354 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15355 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15356 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15357 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15358 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15359 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15360 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15361 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15362 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15363 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15364 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15365 MATH_HAS_NO_SIDE_EFFECTS
15366 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15367 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15368 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15369 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15370 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15371 NetBSD news1500 news1700 news1800 news1900 news3700
15372 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15373 ns32016 ns32332 ns32k nsc32000
15374 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15375 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15376 pc532 pdp11 PGC PIC plexus PORTAR posix
15377 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15378 POSIX_C_SOURCE POSIX_SOURCE POWER
15379 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15380 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15381 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15382 sony sony_news sonyrisc sparc sparclite spectrum
15383 stardent stdc STDC_EXT stratos sun sun3 sun386
15384 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15385 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15386 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15387 sysV68 sysV88 Tek4132 Tek4300 titan
15388 TM3200 TM5400 TM5600
15389 tower tower32 tower32_200 tower32_600 tower32_700
15390 tower32_800 tower32_850 tss
15391 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15392 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15393 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15394 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15395 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15396 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15397 z8000
15398 EOSH
15399 # Maybe put other stuff here too.
15400 cat <<EOSH >>Cppsym.know
15401 $osname
15402 EOSH
15403 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15404 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15405 $cat Cppsym.know > Cppsym.c
15406 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15407 $rm -f Cppsym.a Cppsym.b Cppsym.c
15408 cat <<EOSH > Cppsym
15409 $startsh
15410 if $test \$# -gt 0; then
15411     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15412     if $test -s Cppsym.got; then
15413         $rm -f Cppsym.got
15414         exit 0
15415     fi
15416     $rm -f Cppsym.got
15417     exit 1
15418 else
15419     $tr " " "$trnl" | ./Cppsym.try
15420     exit 0
15421 fi
15422 EOSH
15423 chmod +x Cppsym
15424 $eunicefix Cppsym
15425 cat <<EOSH > Cppsym.try
15426 $startsh
15427 cat <<'EOCP' > try.c
15428 #include <stdio.h>
15429 int main() {
15430 EOCP
15431 $awk \\
15432 EOSH
15433 cat <<'EOSH' >> Cppsym.try
15434 'length($1) > 0 {
15435     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
15436     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
15437     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
15438     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
15439 }'       >> try.c
15440 echo '}' >> try.c
15441 EOSH
15442 cat <<EOSH >> Cppsym.try
15443 ccflags="$ccflags"
15444 case "$osname-$gccversion" in
15445 irix-) ccflags="\$ccflags -woff 1178" ;;
15446 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15447 esac
15448 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15449 EOSH
15450 chmod +x Cppsym.try
15451 $eunicefix Cppsym.try
15452 ./Cppsym < Cppsym.know > Cppsym.true
15453 : now check the C compiler for additional symbols
15454 postprocess_cc_v=''
15455 case "$osname" in
15456 aix) postprocess_cc_v="|$tr , ' '" ;;
15457 esac
15458 $cat >ccsym <<EOS
15459 $startsh
15460 $cat >tmp.c <<EOF
15461 extern int foo;
15462 EOF
15463 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15464 do
15465         case "\$i" in
15466         -D*) echo "\$i" | $sed 's/^-D//';;
15467         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15468         esac
15469 done
15470 $rm -f try.c
15471 EOS
15472 postprocess_cc_v=''
15473 chmod +x ccsym
15474 $eunicefix ccsym
15475 ./ccsym > ccsym1.raw
15476 if $test -s ccsym1.raw; then
15477        $sort ccsym1.raw | $uniq >ccsym.raw
15478 else
15479        mv ccsym1.raw ccsym.raw
15480 fi
15481
15482 $awk '/\=/ { print $0; next }
15483         { print $0"=1" }' ccsym.raw >ccsym.list
15484 $awk '/\=/ { print $0; next }
15485         { print $0"=1" }' Cppsym.true >ccsym.true
15486 $comm -13 ccsym.true ccsym.list >ccsym.own
15487 $comm -12 ccsym.true ccsym.list >ccsym.com
15488 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15489 also=''
15490 if $test -z ccsym.raw; then
15491         echo "Your C compiler doesn't seem to define any symbols!" >&4
15492         echo " "
15493         echo "However, your C preprocessor defines the following symbols:"
15494         $cat Cppsym.true
15495         ccsymbols=''
15496         cppsymbols=`$cat Cppsym.true`
15497         cppsymbols=`echo $cppsymbols`
15498         cppccsymbols="$cppsymbols"
15499 else
15500         if $test -s ccsym.com; then
15501                 echo "Your C compiler and pre-processor define these symbols:"
15502                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15503                 also='also '
15504                 symbols='ones'
15505                 cppccsymbols=`$cat ccsym.com`
15506                 cppccsymbols=`echo $cppccsymbols`
15507                 $test "$silent" || sleep 1
15508         fi
15509         if $test -s ccsym.cpp; then
15510                 $test "$also" && echo " "
15511                 echo "Your C pre-processor ${also}defines the following symbols:"
15512                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15513                 also='further '
15514                 cppsymbols=`$cat ccsym.cpp`
15515                 cppsymbols=`echo $cppsymbols`
15516                 $test "$silent" || sleep 1
15517         fi
15518         if $test -s ccsym.own; then
15519                 $test "$also" && echo " "
15520                 echo "Your C compiler ${also}defines the following cpp symbols:"
15521                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15522                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15523                 ccsymbols=`$cat ccsym.own`
15524                 ccsymbols=`echo $ccsymbols`
15525                 $test "$silent" || sleep 1
15526         fi
15527 fi
15528 $rm -f ccsym* Cppsym.*
15529
15530 : see if this is a termio system
15531 val="$undef"
15532 val2="$undef"
15533 val3="$undef"
15534 if $test `./findhdr termios.h`; then
15535         set tcsetattr i_termios
15536         eval $inlibc
15537         val3="$i_termios"
15538 fi
15539 echo " "
15540 case "$val3" in
15541 "$define") echo "You have POSIX termios.h... good!" >&4;;
15542 *) if ./Cppsym pyr; then
15543                 case "`/bin/universe`" in
15544                 ucb) if $test `./findhdr sgtty.h`; then
15545                                 val2="$define"
15546                                 echo "<sgtty.h> found." >&4
15547                         else
15548                                 echo "System is pyramid with BSD universe."
15549                                 echo "<sgtty.h> not found--you could have problems." >&4
15550                         fi;;
15551                 *) if $test `./findhdr termio.h`; then
15552                                 val="$define"
15553                                 echo "<termio.h> found." >&4
15554                         else
15555                                 echo "System is pyramid with USG universe."
15556                                 echo "<termio.h> not found--you could have problems." >&4
15557                         fi;;
15558                 esac
15559         elif ./usg; then
15560                 if $test `./findhdr termio.h`; then
15561                         echo "<termio.h> found." >&4
15562                         val="$define"
15563                 elif $test `./findhdr sgtty.h`; then
15564                         echo "<sgtty.h> found." >&4
15565                         val2="$define"
15566                 else
15567 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15568                 fi
15569         else
15570                 if $test `./findhdr sgtty.h`; then
15571                         echo "<sgtty.h> found." >&4
15572                         val2="$define"
15573                 elif $test `./findhdr termio.h`; then
15574                         echo "<termio.h> found." >&4
15575                         val="$define"
15576                 else
15577 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15578                 fi
15579         fi;;
15580 esac
15581 set i_termio; eval $setvar
15582 val=$val2; set i_sgtty; eval $setvar
15583 val=$val3; set i_termios; eval $setvar
15584
15585 : see if this is a shadow.h system
15586 set shadow.h i_shadow
15587 eval $inhdr
15588
15589 : see if stddef is available
15590 set stddef.h i_stddef
15591 eval $inhdr
15592
15593 : see if this is a sunmath.h system
15594 set sunmath.h i_sunmath
15595 eval $inhdr
15596
15597 : see if sys/access.h is available
15598 set sys/access.h i_sysaccess
15599 eval $inhdr
15600
15601 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15602 set sys/filio.h i_sysfilio
15603 eval $inhdr
15604 echo " "
15605 if $test `./findhdr sys/ioctl.h`; then
15606         val="$define"
15607         echo '<sys/ioctl.h> found.' >&4
15608 else
15609         val="$undef"
15610         if $test $i_sysfilio = "$define"; then
15611             echo '<sys/ioctl.h> NOT found.' >&4
15612         else
15613                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15614                 $test $i_termio = "$define" && xxx="termio.h"
15615                 $test $i_termios = "$define" && xxx="termios.h"
15616 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15617         fi
15618 fi
15619 set i_sysioctl
15620 eval $setvar
15621
15622 : see if socket ioctl defs are in sys/sockio.h
15623 echo " "
15624 xxx=`./findhdr sys/sockio.h`
15625 if $test "$xxx"; then
15626         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15627                 val="$define"
15628                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15629         else
15630                 val="$undef"
15631                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15632         fi
15633 else
15634         val="$undef"
15635         $cat <<EOM
15636 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15637 EOM
15638 fi
15639 set i_syssockio
15640 eval $setvar
15641
15642
15643 : see if this is a syslog.h system
15644 set syslog.h i_syslog
15645 eval $inhdr
15646
15647
15648 : see if this is a sys/mode.h system
15649 set sys/mode.h i_sysmode
15650 eval $inhdr
15651
15652 : see if sys/resource.h has to be included
15653 set sys/resource.h i_sysresrc
15654 eval $inhdr
15655
15656 : see if sys/security.h is available
15657 set sys/security.h i_syssecrt
15658 eval $inhdr
15659
15660 : see if this is a sys/statvfs.h system
15661 set sys/statvfs.h i_sysstatvfs
15662 eval $inhdr
15663
15664 : see if this is a sys/un.h system
15665 set sys/un.h i_sysun
15666 eval $inhdr
15667
15668
15669 : see if this is a sys/utsname.h system
15670 set sys/utsname.h i_sysutsname
15671 eval $inhdr
15672
15673 : see if this is a syswait system
15674 set sys/wait.h i_syswait
15675 eval $inhdr
15676
15677 : see if this is a ustat.h system
15678 set ustat.h i_ustat
15679 eval $inhdr
15680
15681 : see if this is an utime system
15682 set utime.h i_utime
15683 eval $inhdr
15684
15685 : see if this is a values.h system
15686 set values.h i_values
15687 eval $inhdr
15688
15689 : see if this is a vfork system
15690 case "$d_vfork" in
15691 "$define")
15692         set vfork.h i_vfork
15693         eval $inhdr
15694         ;;
15695 *)
15696         i_vfork="$undef"
15697         ;;
15698 esac
15699
15700 : see if gdbm.h is available
15701 set gdbm.h t_gdbm
15702 eval $inhdr
15703 case "$t_gdbm" in
15704 $define)
15705         : see if gdbm_open exists
15706         set gdbm_open d_gdbm_open
15707         eval $inlibc
15708         case "$d_gdbm_open" in
15709         $undef)
15710                 t_gdbm="$undef"
15711                 echo "We won't be including <gdbm.h>"
15712                 ;;
15713         esac
15714         ;;
15715 esac
15716 val="$t_gdbm"
15717 set i_gdbm
15718 eval $setvar
15719
15720 echo " "
15721 echo "Looking for extensions..." >&4
15722 : If we are using the old config.sh, known_extensions may contain
15723 : old or inaccurate or duplicate values.
15724 known_extensions=''
15725 nonxs_extensions=''
15726 : We do not use find because it might not be available.
15727 : We do not just use MANIFEST because the user may have dropped
15728 : some additional extensions into the source tree and expect them
15729 : to be built.
15730
15731 : Function to recursively find available extensions, ignoring DynaLoader
15732 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15733 find_extensions='
15734     for xxx in *; do
15735        case "$xxx" in
15736            DynaLoader|dynaload) ;;
15737            *)
15738            if $test -f $xxx/$xxx.xs; then
15739                known_extensions="$known_extensions $1$xxx";
15740            elif $test -f $xxx/Makefile.PL; then
15741                nonxs_extensions="$nonxs_extensions $1$xxx";
15742            else
15743                if $test -d $xxx -a $# -lt 10; then
15744                    set $1$xxx/ $*;
15745                    cd $xxx;
15746                    eval $find_extensions;
15747                    cd ..;
15748                    shift;
15749                fi;
15750            fi
15751            ;;
15752        esac;
15753     done'
15754 tdir=`pwd`
15755 cd $rsrc/ext
15756 set X
15757 shift
15758 eval $find_extensions
15759 set X $nonxs_extensions
15760 shift
15761 nonxs_extensions="$*"
15762 set X $known_extensions
15763 shift
15764 known_extensions="$*"
15765 cd $tdir
15766
15767 : Now see which are supported on this system.
15768 avail_ext=''
15769 for xxx in $known_extensions ; do
15770         case "$xxx" in
15771         DB_File|db_file)
15772                 case "$i_db" in
15773                 $define) avail_ext="$avail_ext $xxx" ;;
15774                 esac
15775                 ;;
15776         GDBM_File|gdbm_fil)
15777                 case "$i_gdbm" in 
15778                 $define) avail_ext="$avail_ext $xxx" ;;
15779                 esac
15780                 ;;
15781         NDBM_File|ndbm_fil)
15782                 case "$i_ndbm" in
15783                 $define)
15784                     case "$osname-$use64bitint" in
15785                     hpux-define)
15786                         case "$libs" in
15787                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15788                         esac
15789                         ;;
15790                     *) avail_ext="$avail_ext $xxx" ;;
15791                     esac
15792                     ;;
15793                 esac
15794                 ;;
15795         ODBM_File|odbm_fil) 
15796                 case "${i_dbm}${i_rpcsvcdbm}" in
15797                 *"${define}"*)
15798                     case "$osname-$use64bitint" in
15799                     hpux-define)
15800                         case "$libs" in
15801                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15802                         esac
15803                         ;;
15804                     *) avail_ext="$avail_ext $xxx" ;;
15805                     esac
15806                     ;;
15807                 esac
15808                 ;;
15809         POSIX|posix)
15810                 case "$useposix" in
15811                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15812                 esac
15813                 ;;
15814         Opcode|opcode)
15815                 case "$useopcode" in
15816                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15817                 esac
15818                 ;;
15819         Socket|socket)
15820                 case "$d_socket" in 
15821                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15822                 esac
15823                 ;;
15824         Sys/Syslog|sys/syslog)
15825                 : XXX syslog requires socket
15826                 case "$d_socket" in 
15827                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15828                 esac
15829                 ;;
15830         Thread|thread)
15831                 case "$usethreads" in 
15832                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15833                 esac
15834                 ;;
15835         IPC/SysV|ipc/sysv)
15836                 : XXX Do we need a useipcsysv variable here
15837                 case "${d_msg}${d_sem}${d_shm}" in 
15838                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15839                 esac
15840                 ;;
15841         *)      avail_ext="$avail_ext $xxx"
15842                 ;;
15843         esac
15844 done
15845
15846 set X $avail_ext
15847 shift
15848 avail_ext="$*"
15849
15850 : Now see which nonxs extensions are supported on this system.
15851 : For now assume all are.
15852 nonxs_ext=''
15853 for xxx in $nonxs_extensions ; do
15854         case "$xxx" in
15855         *)      nonxs_ext="$nonxs_ext $xxx"
15856                 ;;
15857         esac
15858 done
15859
15860 set X $nonxs_ext
15861 shift
15862 nonxs_ext="$*"
15863
15864 case $usedl in
15865 $define)
15866         $cat <<EOM
15867 A number of extensions are supplied with $package.  You may choose to
15868 compile these extensions for dynamic loading (the default), compile
15869 them into the $package executable (static loading), or not include
15870 them at all.  Answer "none" to include no extensions.
15871 Note that DynaLoader is always built and need not be mentioned here.
15872
15873 EOM
15874         case "$dynamic_ext" in
15875         '') dflt="$avail_ext" ;;
15876         *)      dflt="$dynamic_ext"
15877                 # Perhaps we are reusing an old out-of-date config.sh.
15878                 case "$hint" in
15879                 previous)
15880                         if test X"$dynamic_ext" != X"$avail_ext"; then
15881                                 $cat <<EOM
15882 NOTICE:  Your previous config.sh list may be incorrect. 
15883 The extensions now available to you are 
15884         ${avail_ext}
15885 but the default list from your previous config.sh is
15886         ${dynamic_ext} 
15887
15888 EOM
15889                         fi
15890                         ;;
15891                 esac
15892                 ;;
15893         esac
15894         case "$dflt" in
15895         '')     dflt=none;;
15896         esac
15897         rp="What extensions do you wish to load dynamically?"
15898         . ./myread
15899         case "$ans" in
15900         none) dynamic_ext=' ' ;;
15901         *) dynamic_ext="$ans" ;;
15902         esac
15903
15904         case "$static_ext" in
15905         '')
15906                 : Exclude those already listed in dynamic linking
15907                 dflt=''
15908                 for xxx in $avail_ext; do
15909                         case " $dynamic_ext " in
15910                         *" $xxx "*) ;;
15911                         *) dflt="$dflt $xxx" ;;
15912                         esac
15913                 done
15914                 set X $dflt
15915                 shift
15916                 dflt="$*"
15917                 ;;
15918         *)  dflt="$static_ext" 
15919                 ;;
15920         esac
15921
15922         case "$dflt" in
15923         '')     dflt=none;;
15924         esac
15925         rp="What extensions do you wish to load statically?"
15926         . ./myread
15927         case "$ans" in
15928         none) static_ext=' ' ;;
15929         *) static_ext="$ans" ;;
15930         esac
15931         ;;
15932 *)
15933         $cat <<EOM
15934 A number of extensions are supplied with $package.  Answer "none" 
15935 to include no extensions. 
15936 Note that DynaLoader is always built and need not be mentioned here.
15937
15938 EOM
15939         case "$static_ext" in
15940         '') dflt="$avail_ext" ;;
15941         *)      dflt="$static_ext"
15942                 # Perhaps we are reusing an old out-of-date config.sh.
15943                 case "$hint" in
15944                 previous)
15945                         if test X"$static_ext" != X"$avail_ext"; then
15946                                 $cat <<EOM
15947 NOTICE:  Your previous config.sh list may be incorrect. 
15948 The extensions now available to you are 
15949         ${avail_ext}
15950 but the default list from your previous config.sh is
15951         ${static_ext} 
15952
15953 EOM
15954                         fi
15955                         ;;
15956                 esac
15957                 ;;
15958         esac
15959         : Exclude those that are not xs extensions
15960         case "$dflt" in
15961         '')     dflt=none;;
15962         esac
15963         rp="What extensions do you wish to include?"
15964         . ./myread
15965         case "$ans" in
15966         none) static_ext=' ' ;;
15967         *) static_ext="$ans" ;;
15968         esac
15969         ;;
15970 esac
15971
15972 set X $dynamic_ext $static_ext $nonxs_ext
15973 shift
15974 extensions="$*"
15975
15976 : Remove libraries needed only for extensions
15977 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15978 : The exception is SunOS 4.x, which needs them.
15979 case "${osname}X${osvers}" in
15980 sunos*X4*)
15981     perllibs="$libs"
15982     ;;
15983 *) case "$usedl" in
15984     $define|true|[yY]*)
15985             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15986             shift
15987             perllibs="$*"
15988             ;;
15989     *)  perllibs="$libs"
15990             ;;
15991     esac
15992     ;;
15993 esac
15994
15995 : Remove build directory name from cppstdin so it can be used from
15996 : either the present location or the final installed location.
15997 echo " "
15998 : Get out of the UU directory to get correct path name.
15999 cd ..
16000 case "$cppstdin" in
16001 `pwd`/cppstdin)
16002         echo "Stripping down cppstdin path name"
16003         cppstdin=cppstdin
16004         ;;
16005 esac
16006 cd UU
16007
16008 : end of configuration questions
16009 echo " "
16010 echo "End of configuration questions."
16011 echo " "
16012
16013 : back to where it started
16014 if test -d ../UU; then
16015         cd ..
16016 fi
16017
16018 : configuration may be patched via a 'config.over' file
16019 if $test -f config.over; then
16020         echo " "
16021         dflt=y
16022         rp='I see a config.over file.  Do you wish to load it?'
16023         . UU/myread
16024         case "$ans" in
16025         n*) echo "OK, I'll ignore it.";;
16026         *)      . ./config.over
16027                 echo "Configuration override changes have been loaded."
16028                 ;;
16029         esac
16030 fi
16031
16032 : in case they want portability, strip down executable paths
16033 case "$d_portable" in
16034 "$define")
16035         echo " "
16036         echo "Stripping down executable paths..." >&4
16037         for file in $loclist $trylist; do
16038                 eval temp=\$$file
16039                 eval $file=`basename $temp`
16040         done
16041         ;;
16042 esac
16043
16044 : create config.sh file
16045 echo " "
16046 echo "Creating config.sh..." >&4
16047 $spitshell <<EOT >config.sh
16048 $startsh
16049 #
16050 # This file was produced by running the Configure script. It holds all the
16051 # definitions figured out by Configure. Should you modify one of these values,
16052 # do not forget to propagate your changes by running "Configure -der". You may
16053 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16054 #
16055
16056 # Package name      : $package
16057 # Source directory  : $src
16058 # Configuration time: $cf_time
16059 # Configured by     : $cf_by
16060 # Target system     : $myuname
16061
16062 Author='$Author'
16063 Date='$Date'
16064 Header='$Header'
16065 Id='$Id'
16066 Locker='$Locker'
16067 Log='$Log'
16068 Mcc='$Mcc'
16069 RCSfile='$RCSfile'
16070 Revision='$Revision'
16071 Source='$Source'
16072 State='$State'
16073 _a='$_a'
16074 _exe='$_exe'
16075 _o='$_o'
16076 afs='$afs'
16077 alignbytes='$alignbytes'
16078 ansi2knr='$ansi2knr'
16079 aphostname='$aphostname'
16080 api_revision='$api_revision'
16081 api_subversion='$api_subversion'
16082 api_version='$api_version'
16083 api_versionstring='$api_versionstring'
16084 ar='$ar'
16085 archlib='$archlib'
16086 archlibexp='$archlibexp'
16087 archname64='$archname64'
16088 archname='$archname'
16089 archobjs='$archobjs'
16090 awk='$awk'
16091 baserev='$baserev'
16092 bash='$bash'
16093 bin='$bin'
16094 bincompat5005='$bincompat5005'
16095 binexp='$binexp'
16096 bison='$bison'
16097 byacc='$byacc'
16098 byteorder='$byteorder'
16099 c='$c'
16100 castflags='$castflags'
16101 cat='$cat'
16102 cc='$cc'
16103 cccdlflags='$cccdlflags'
16104 ccdlflags='$ccdlflags'
16105 ccflags='$ccflags'
16106 ccflags_uselargefiles='$ccflags_uselargefiles'
16107 ccname='$ccname'
16108 ccsymbols='$ccsymbols'
16109 ccversion='$ccversion'
16110 cf_by='$cf_by'
16111 cf_email='$cf_email'
16112 cf_time='$cf_time'
16113 charsize='$charsize'
16114 chgrp='$chgrp'
16115 chmod='$chmod'
16116 chown='$chown'
16117 clocktype='$clocktype'
16118 comm='$comm'
16119 compress='$compress'
16120 contains='$contains'
16121 cp='$cp'
16122 cpio='$cpio'
16123 cpp='$cpp'
16124 cpp_stuff='$cpp_stuff'
16125 cppccsymbols='$cppccsymbols'
16126 cppflags='$cppflags'
16127 cpplast='$cpplast'
16128 cppminus='$cppminus'
16129 cpprun='$cpprun'
16130 cppstdin='$cppstdin'
16131 cppsymbols='$cppsymbols'
16132 crosscompile='$crosscompile'
16133 cryptlib='$cryptlib'
16134 csh='$csh'
16135 d_Gconvert='$d_Gconvert'
16136 d_PRIEUldbl='$d_PRIEUldbl'
16137 d_PRIFUldbl='$d_PRIFUldbl'
16138 d_PRIGUldbl='$d_PRIGUldbl'
16139 d_PRIXU64='$d_PRIXU64'
16140 d_PRId64='$d_PRId64'
16141 d_PRIeldbl='$d_PRIeldbl'
16142 d_PRIfldbl='$d_PRIfldbl'
16143 d_PRIgldbl='$d_PRIgldbl'
16144 d_PRIi64='$d_PRIi64'
16145 d_PRIo64='$d_PRIo64'
16146 d_PRIu64='$d_PRIu64'
16147 d_PRIx64='$d_PRIx64'
16148 d_SCNfldbl='$d_SCNfldbl'
16149 d__fwalk='$d__fwalk'
16150 d_access='$d_access'
16151 d_accessx='$d_accessx'
16152 d_alarm='$d_alarm'
16153 d_archlib='$d_archlib'
16154 d_atolf='$d_atolf'
16155 d_atoll='$d_atoll'
16156 d_attribut='$d_attribut'
16157 d_bcmp='$d_bcmp'
16158 d_bcopy='$d_bcopy'
16159 d_bincompat5005='$d_bincompat5005'
16160 d_bsd='$d_bsd'
16161 d_bsdgetpgrp='$d_bsdgetpgrp'
16162 d_bsdsetpgrp='$d_bsdsetpgrp'
16163 d_bzero='$d_bzero'
16164 d_casti32='$d_casti32'
16165 d_castneg='$d_castneg'
16166 d_charvspr='$d_charvspr'
16167 d_chown='$d_chown'
16168 d_chroot='$d_chroot'
16169 d_chsize='$d_chsize'
16170 d_closedir='$d_closedir'
16171 d_cmsghdr_s='$d_cmsghdr_s'
16172 d_const='$d_const'
16173 d_crypt='$d_crypt'
16174 d_csh='$d_csh'
16175 d_cuserid='$d_cuserid'
16176 d_dbl_dig='$d_dbl_dig'
16177 d_difftime='$d_difftime'
16178 d_dirnamlen='$d_dirnamlen'
16179 d_dlerror='$d_dlerror'
16180 d_dlopen='$d_dlopen'
16181 d_dlsymun='$d_dlsymun'
16182 d_dosuid='$d_dosuid'
16183 d_drand48proto='$d_drand48proto'
16184 d_dup2='$d_dup2'
16185 d_eaccess='$d_eaccess'
16186 d_endgrent='$d_endgrent'
16187 d_endhent='$d_endhent'
16188 d_endnent='$d_endnent'
16189 d_endpent='$d_endpent'
16190 d_endpwent='$d_endpwent'
16191 d_endsent='$d_endsent'
16192 d_eofnblk='$d_eofnblk'
16193 d_eunice='$d_eunice'
16194 d_fchmod='$d_fchmod'
16195 d_fchown='$d_fchown'
16196 d_fcntl='$d_fcntl'
16197 d_fcntl_can_lock='$d_fcntl_can_lock'
16198 d_fd_macros='$d_fd_macros'
16199 d_fd_set='$d_fd_set'
16200 d_fds_bits='$d_fds_bits'
16201 d_fgetpos='$d_fgetpos'
16202 d_flexfnam='$d_flexfnam'
16203 d_flock='$d_flock'
16204 d_fork='$d_fork'
16205 d_fpathconf='$d_fpathconf'
16206 d_fpos64_t='$d_fpos64_t'
16207 d_frexpl='$d_frexpl'
16208 d_fs_data_s='$d_fs_data_s'
16209 d_fseeko='$d_fseeko'
16210 d_fsetpos='$d_fsetpos'
16211 d_fstatfs='$d_fstatfs'
16212 d_fstatvfs='$d_fstatvfs'
16213 d_fsync='$d_fsync'
16214 d_ftello='$d_ftello'
16215 d_ftime='$d_ftime'
16216 d_getcwd='$d_getcwd'
16217 d_getespwnam='$d_getespwnam'
16218 d_getfsstat='$d_getfsstat'
16219 d_getgrent='$d_getgrent'
16220 d_getgrps='$d_getgrps'
16221 d_gethbyaddr='$d_gethbyaddr'
16222 d_gethbyname='$d_gethbyname'
16223 d_gethent='$d_gethent'
16224 d_gethname='$d_gethname'
16225 d_gethostprotos='$d_gethostprotos'
16226 d_getitimer='$d_getitimer'
16227 d_getlogin='$d_getlogin'
16228 d_getmnt='$d_getmnt'
16229 d_getmntent='$d_getmntent'
16230 d_getnbyaddr='$d_getnbyaddr'
16231 d_getnbyname='$d_getnbyname'
16232 d_getnent='$d_getnent'
16233 d_getnetprotos='$d_getnetprotos'
16234 d_getpagsz='$d_getpagsz'
16235 d_getpbyname='$d_getpbyname'
16236 d_getpbynumber='$d_getpbynumber'
16237 d_getpent='$d_getpent'
16238 d_getpgid='$d_getpgid'
16239 d_getpgrp2='$d_getpgrp2'
16240 d_getpgrp='$d_getpgrp'
16241 d_getppid='$d_getppid'
16242 d_getprior='$d_getprior'
16243 d_getprotoprotos='$d_getprotoprotos'
16244 d_getprpwnam='$d_getprpwnam'
16245 d_getpwent='$d_getpwent'
16246 d_getsbyname='$d_getsbyname'
16247 d_getsbyport='$d_getsbyport'
16248 d_getsent='$d_getsent'
16249 d_getservprotos='$d_getservprotos'
16250 d_getspnam='$d_getspnam'
16251 d_gettimeod='$d_gettimeod'
16252 d_gnulibc='$d_gnulibc'
16253 d_grpasswd='$d_grpasswd'
16254 d_hasmntopt='$d_hasmntopt'
16255 d_htonl='$d_htonl'
16256 d_iconv='$d_iconv'
16257 d_index='$d_index'
16258 d_inetaton='$d_inetaton'
16259 d_int64_t='$d_int64_t'
16260 d_isascii='$d_isascii'
16261 d_isnan='$d_isnan'
16262 d_isnanl='$d_isnanl'
16263 d_killpg='$d_killpg'
16264 d_lchown='$d_lchown'
16265 d_ldbl_dig='$d_ldbl_dig'
16266 d_link='$d_link'
16267 d_locconv='$d_locconv'
16268 d_lockf='$d_lockf'
16269 d_longdbl='$d_longdbl'
16270 d_longlong='$d_longlong'
16271 d_lseekproto='$d_lseekproto'
16272 d_lstat='$d_lstat'
16273 d_madvise='$d_madvise'
16274 d_mblen='$d_mblen'
16275 d_mbstowcs='$d_mbstowcs'
16276 d_mbtowc='$d_mbtowc'
16277 d_memchr='$d_memchr'
16278 d_memcmp='$d_memcmp'
16279 d_memcpy='$d_memcpy'
16280 d_memmove='$d_memmove'
16281 d_memset='$d_memset'
16282 d_mkdir='$d_mkdir'
16283 d_mkdtemp='$d_mkdtemp'
16284 d_mkfifo='$d_mkfifo'
16285 d_mkstemp='$d_mkstemp'
16286 d_mkstemps='$d_mkstemps'
16287 d_mktime='$d_mktime'
16288 d_mmap='$d_mmap'
16289 d_modfl='$d_modfl'
16290 d_mprotect='$d_mprotect'
16291 d_msg='$d_msg'
16292 d_msg_ctrunc='$d_msg_ctrunc'
16293 d_msg_dontroute='$d_msg_dontroute'
16294 d_msg_oob='$d_msg_oob'
16295 d_msg_peek='$d_msg_peek'
16296 d_msg_proxy='$d_msg_proxy'
16297 d_msgctl='$d_msgctl'
16298 d_msgget='$d_msgget'
16299 d_msghdr_s='$d_msghdr_s'
16300 d_msgrcv='$d_msgrcv'
16301 d_msgsnd='$d_msgsnd'
16302 d_msync='$d_msync'
16303 d_munmap='$d_munmap'
16304 d_mymalloc='$d_mymalloc'
16305 d_nice='$d_nice'
16306 d_nv_preserves_uv='$d_nv_preserves_uv'
16307 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16308 d_off64_t='$d_off64_t'
16309 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16310 d_oldpthreads='$d_oldpthreads'
16311 d_oldsock='$d_oldsock'
16312 d_open3='$d_open3'
16313 d_pathconf='$d_pathconf'
16314 d_pause='$d_pause'
16315 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16316 d_phostname='$d_phostname'
16317 d_pipe='$d_pipe'
16318 d_poll='$d_poll'
16319 d_portable='$d_portable'
16320 d_pthread_yield='$d_pthread_yield'
16321 d_pwage='$d_pwage'
16322 d_pwchange='$d_pwchange'
16323 d_pwclass='$d_pwclass'
16324 d_pwcomment='$d_pwcomment'
16325 d_pwexpire='$d_pwexpire'
16326 d_pwgecos='$d_pwgecos'
16327 d_pwpasswd='$d_pwpasswd'
16328 d_pwquota='$d_pwquota'
16329 d_qgcvt='$d_qgcvt'
16330 d_quad='$d_quad'
16331 d_readdir='$d_readdir'
16332 d_readlink='$d_readlink'
16333 d_readv='$d_readv'
16334 d_recvmsg='$d_recvmsg'
16335 d_rename='$d_rename'
16336 d_rewinddir='$d_rewinddir'
16337 d_rmdir='$d_rmdir'
16338 d_safebcpy='$d_safebcpy'
16339 d_safemcpy='$d_safemcpy'
16340 d_sanemcmp='$d_sanemcmp'
16341 d_sbrkproto='$d_sbrkproto'
16342 d_sched_yield='$d_sched_yield'
16343 d_scm_rights='$d_scm_rights'
16344 d_seekdir='$d_seekdir'
16345 d_select='$d_select'
16346 d_sem='$d_sem'
16347 d_semctl='$d_semctl'
16348 d_semctl_semid_ds='$d_semctl_semid_ds'
16349 d_semctl_semun='$d_semctl_semun'
16350 d_semget='$d_semget'
16351 d_semop='$d_semop'
16352 d_sendmsg='$d_sendmsg'
16353 d_setegid='$d_setegid'
16354 d_seteuid='$d_seteuid'
16355 d_setgrent='$d_setgrent'
16356 d_setgrps='$d_setgrps'
16357 d_sethent='$d_sethent'
16358 d_setitimer='$d_setitimer'
16359 d_setlinebuf='$d_setlinebuf'
16360 d_setlocale='$d_setlocale'
16361 d_setnent='$d_setnent'
16362 d_setpent='$d_setpent'
16363 d_setpgid='$d_setpgid'
16364 d_setpgrp2='$d_setpgrp2'
16365 d_setpgrp='$d_setpgrp'
16366 d_setprior='$d_setprior'
16367 d_setproctitle='$d_setproctitle'
16368 d_setpwent='$d_setpwent'
16369 d_setregid='$d_setregid'
16370 d_setresgid='$d_setresgid'
16371 d_setresuid='$d_setresuid'
16372 d_setreuid='$d_setreuid'
16373 d_setrgid='$d_setrgid'
16374 d_setruid='$d_setruid'
16375 d_setsent='$d_setsent'
16376 d_setsid='$d_setsid'
16377 d_setvbuf='$d_setvbuf'
16378 d_sfio='$d_sfio'
16379 d_shm='$d_shm'
16380 d_shmat='$d_shmat'
16381 d_shmatprototype='$d_shmatprototype'
16382 d_shmctl='$d_shmctl'
16383 d_shmdt='$d_shmdt'
16384 d_shmget='$d_shmget'
16385 d_sigaction='$d_sigaction'
16386 d_sigprocmask='$d_sigprocmask'
16387 d_sigsetjmp='$d_sigsetjmp'
16388 d_sockatmark='$d_sockatmark'
16389 d_socket='$d_socket'
16390 d_socklen_t='$d_socklen_t'
16391 d_sockpair='$d_sockpair'
16392 d_socks5_init='$d_socks5_init'
16393 d_sqrtl='$d_sqrtl'
16394 d_statblks='$d_statblks'
16395 d_statfs_f_flags='$d_statfs_f_flags'
16396 d_statfs_s='$d_statfs_s'
16397 d_statvfs='$d_statvfs'
16398 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16399 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16400 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16401 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16402 d_stdio_stream_array='$d_stdio_stream_array'
16403 d_stdiobase='$d_stdiobase'
16404 d_stdstdio='$d_stdstdio'
16405 d_strchr='$d_strchr'
16406 d_strcoll='$d_strcoll'
16407 d_strctcpy='$d_strctcpy'
16408 d_strerrm='$d_strerrm'
16409 d_strerror='$d_strerror'
16410 d_strtod='$d_strtod'
16411 d_strtol='$d_strtol'
16412 d_strtold='$d_strtold'
16413 d_strtoll='$d_strtoll'
16414 d_strtoq='$d_strtoq'
16415 d_strtoul='$d_strtoul'
16416 d_strtoull='$d_strtoull'
16417 d_strtouq='$d_strtouq'
16418 d_strxfrm='$d_strxfrm'
16419 d_suidsafe='$d_suidsafe'
16420 d_symlink='$d_symlink'
16421 d_syscall='$d_syscall'
16422 d_sysconf='$d_sysconf'
16423 d_sysernlst='$d_sysernlst'
16424 d_syserrlst='$d_syserrlst'
16425 d_system='$d_system'
16426 d_tcgetpgrp='$d_tcgetpgrp'
16427 d_tcsetpgrp='$d_tcsetpgrp'
16428 d_telldir='$d_telldir'
16429 d_telldirproto='$d_telldirproto'
16430 d_time='$d_time'
16431 d_times='$d_times'
16432 d_truncate='$d_truncate'
16433 d_tzname='$d_tzname'
16434 d_u32align='$d_u32align'
16435 d_ualarm='$d_ualarm'
16436 d_umask='$d_umask'
16437 d_uname='$d_uname'
16438 d_union_semun='$d_union_semun'
16439 d_usleep='$d_usleep'
16440 d_ustat='$d_ustat'
16441 d_vendorarch='$d_vendorarch'
16442 d_vendorbin='$d_vendorbin'
16443 d_vendorlib='$d_vendorlib'
16444 d_vfork='$d_vfork'
16445 d_void_closedir='$d_void_closedir'
16446 d_voidsig='$d_voidsig'
16447 d_voidtty='$d_voidtty'
16448 d_volatile='$d_volatile'
16449 d_vprintf='$d_vprintf'
16450 d_wait4='$d_wait4'
16451 d_waitpid='$d_waitpid'
16452 d_wcstombs='$d_wcstombs'
16453 d_wctomb='$d_wctomb'
16454 d_writev='$d_writev'
16455 d_xenix='$d_xenix'
16456 date='$date'
16457 db_hashtype='$db_hashtype'
16458 db_prefixtype='$db_prefixtype'
16459 defvoidused='$defvoidused'
16460 direntrytype='$direntrytype'
16461 dlext='$dlext'
16462 dlsrc='$dlsrc'
16463 doublesize='$doublesize'
16464 drand01='$drand01'
16465 dynamic_ext='$dynamic_ext'
16466 eagain='$eagain'
16467 ebcdic='$ebcdic'
16468 echo='$echo'
16469 egrep='$egrep'
16470 emacs='$emacs'
16471 eunicefix='$eunicefix'
16472 exe_ext='$exe_ext'
16473 expr='$expr'
16474 extensions='$extensions'
16475 fflushNULL='$fflushNULL'
16476 fflushall='$fflushall'
16477 find='$find'
16478 firstmakefile='$firstmakefile'
16479 flex='$flex'
16480 fpossize='$fpossize'
16481 fpostype='$fpostype'
16482 freetype='$freetype'
16483 full_ar='$full_ar'
16484 full_csh='$full_csh'
16485 full_sed='$full_sed'
16486 gccosandvers='$gccosandvers'
16487 gccversion='$gccversion'
16488 gidformat='$gidformat'
16489 gidsign='$gidsign'
16490 gidsize='$gidsize'
16491 gidtype='$gidtype'
16492 glibpth='$glibpth'
16493 grep='$grep'
16494 groupcat='$groupcat'
16495 groupstype='$groupstype'
16496 gzip='$gzip'
16497 h_fcntl='$h_fcntl'
16498 h_sysfile='$h_sysfile'
16499 hint='$hint'
16500 hostcat='$hostcat'
16501 i16size='$i16size'
16502 i16type='$i16type'
16503 i32size='$i32size'
16504 i32type='$i32type'
16505 i64size='$i64size'
16506 i64type='$i64type'
16507 i8size='$i8size'
16508 i8type='$i8type'
16509 i_arpainet='$i_arpainet'
16510 i_bsdioctl='$i_bsdioctl'
16511 i_db='$i_db'
16512 i_dbm='$i_dbm'
16513 i_dirent='$i_dirent'
16514 i_dld='$i_dld'
16515 i_dlfcn='$i_dlfcn'
16516 i_fcntl='$i_fcntl'
16517 i_float='$i_float'
16518 i_gdbm='$i_gdbm'
16519 i_grp='$i_grp'
16520 i_iconv='$i_iconv'
16521 i_ieeefp='$i_ieeefp'
16522 i_inttypes='$i_inttypes'
16523 i_libutil='$i_libutil'
16524 i_limits='$i_limits'
16525 i_locale='$i_locale'
16526 i_machcthr='$i_machcthr'
16527 i_malloc='$i_malloc'
16528 i_math='$i_math'
16529 i_memory='$i_memory'
16530 i_mntent='$i_mntent'
16531 i_ndbm='$i_ndbm'
16532 i_netdb='$i_netdb'
16533 i_neterrno='$i_neterrno'
16534 i_netinettcp='$i_netinettcp'
16535 i_niin='$i_niin'
16536 i_poll='$i_poll'
16537 i_prot='$i_prot'
16538 i_pthread='$i_pthread'
16539 i_pwd='$i_pwd'
16540 i_rpcsvcdbm='$i_rpcsvcdbm'
16541 i_sfio='$i_sfio'
16542 i_sgtty='$i_sgtty'
16543 i_shadow='$i_shadow'
16544 i_socks='$i_socks'
16545 i_stdarg='$i_stdarg'
16546 i_stddef='$i_stddef'
16547 i_stdlib='$i_stdlib'
16548 i_string='$i_string'
16549 i_sunmath='$i_sunmath'
16550 i_sysaccess='$i_sysaccess'
16551 i_sysdir='$i_sysdir'
16552 i_sysfile='$i_sysfile'
16553 i_sysfilio='$i_sysfilio'
16554 i_sysin='$i_sysin'
16555 i_sysioctl='$i_sysioctl'
16556 i_syslog='$i_syslog'
16557 i_sysmman='$i_sysmman'
16558 i_sysmode='$i_sysmode'
16559 i_sysmount='$i_sysmount'
16560 i_sysndir='$i_sysndir'
16561 i_sysparam='$i_sysparam'
16562 i_sysresrc='$i_sysresrc'
16563 i_syssecrt='$i_syssecrt'
16564 i_sysselct='$i_sysselct'
16565 i_syssockio='$i_syssockio'
16566 i_sysstat='$i_sysstat'
16567 i_sysstatfs='$i_sysstatfs'
16568 i_sysstatvfs='$i_sysstatvfs'
16569 i_systime='$i_systime'
16570 i_systimek='$i_systimek'
16571 i_systimes='$i_systimes'
16572 i_systypes='$i_systypes'
16573 i_sysuio='$i_sysuio'
16574 i_sysun='$i_sysun'
16575 i_sysutsname='$i_sysutsname'
16576 i_sysvfs='$i_sysvfs'
16577 i_syswait='$i_syswait'
16578 i_termio='$i_termio'
16579 i_termios='$i_termios'
16580 i_time='$i_time'
16581 i_unistd='$i_unistd'
16582 i_ustat='$i_ustat'
16583 i_utime='$i_utime'
16584 i_values='$i_values'
16585 i_varargs='$i_varargs'
16586 i_varhdr='$i_varhdr'
16587 i_vfork='$i_vfork'
16588 ignore_versioned_solibs='$ignore_versioned_solibs'
16589 inc_version_list='$inc_version_list'
16590 inc_version_list_init='$inc_version_list_init'
16591 incpath='$incpath'
16592 inews='$inews'
16593 installarchlib='$installarchlib'
16594 installbin='$installbin'
16595 installman1dir='$installman1dir'
16596 installman3dir='$installman3dir'
16597 installprefix='$installprefix'
16598 installprefixexp='$installprefixexp'
16599 installprivlib='$installprivlib'
16600 installscript='$installscript'
16601 installsitearch='$installsitearch'
16602 installsitebin='$installsitebin'
16603 installsitelib='$installsitelib'
16604 installstyle='$installstyle'
16605 installusrbinperl='$installusrbinperl'
16606 installvendorarch='$installvendorarch'
16607 installvendorbin='$installvendorbin'
16608 installvendorlib='$installvendorlib'
16609 intsize='$intsize'
16610 issymlink='$issymlink'
16611 ivdformat='$ivdformat'
16612 ivsize='$ivsize'
16613 ivtype='$ivtype'
16614 known_extensions='$known_extensions'
16615 ksh='$ksh'
16616 ld='$ld'
16617 lddlflags='$lddlflags'
16618 ldflags='$ldflags'
16619 ldflags_uselargefiles='$ldflags_uselargefiles'
16620 ldlibpthname='$ldlibpthname'
16621 less='$less'
16622 lib_ext='$lib_ext'
16623 libc='$libc'
16624 libperl='$libperl'
16625 libpth='$libpth'
16626 libs='$libs'
16627 libsdirs='$libsdirs'
16628 libsfiles='$libsfiles'
16629 libsfound='$libsfound'
16630 libspath='$libspath'
16631 libswanted='$libswanted'
16632 libswanted_uselargefiles='$libswanted_uselargefiles'
16633 line='$line'
16634 lint='$lint'
16635 lkflags='$lkflags'
16636 ln='$ln'
16637 lns='$lns'
16638 locincpth='$locincpth'
16639 loclibpth='$loclibpth'
16640 longdblsize='$longdblsize'
16641 longlongsize='$longlongsize'
16642 longsize='$longsize'
16643 lp='$lp'
16644 lpr='$lpr'
16645 ls='$ls'
16646 lseeksize='$lseeksize'
16647 lseektype='$lseektype'
16648 mail='$mail'
16649 mailx='$mailx'
16650 make='$make'
16651 make_set_make='$make_set_make'
16652 mallocobj='$mallocobj'
16653 mallocsrc='$mallocsrc'
16654 malloctype='$malloctype'
16655 man1dir='$man1dir'
16656 man1direxp='$man1direxp'
16657 man1ext='$man1ext'
16658 man3dir='$man3dir'
16659 man3direxp='$man3direxp'
16660 man3ext='$man3ext'
16661 mips_type='$mips_type'
16662 mkdir='$mkdir'
16663 mmaptype='$mmaptype'
16664 modetype='$modetype'
16665 more='$more'
16666 multiarch='$multiarch'
16667 mv='$mv'
16668 myarchname='$myarchname'
16669 mydomain='$mydomain'
16670 myhostname='$myhostname'
16671 myuname='$myuname'
16672 n='$n'
16673 need_va_copy='$need_va_copy'
16674 netdb_hlen_type='$netdb_hlen_type'
16675 netdb_host_type='$netdb_host_type'
16676 netdb_name_type='$netdb_name_type'
16677 netdb_net_type='$netdb_net_type'
16678 nm='$nm'
16679 nm_opt='$nm_opt'
16680 nm_so_opt='$nm_so_opt'
16681 nonxs_ext='$nonxs_ext'
16682 nroff='$nroff'
16683 nvEUformat='$nvEUformat'
16684 nvFUformat='$nvFUformat'
16685 nvGUformat='$nvGUformat'
16686 nveformat='$nveformat'
16687 nvfformat='$nvfformat'
16688 nvgformat='$nvgformat'
16689 nvsize='$nvsize'
16690 nvtype='$nvtype'
16691 o_nonblock='$o_nonblock'
16692 obj_ext='$obj_ext'
16693 old_pthread_create_joinable='$old_pthread_create_joinable'
16694 optimize='$optimize'
16695 orderlib='$orderlib'
16696 osname='$osname'
16697 osvers='$osvers'
16698 otherlibdirs='$otherlibdirs'
16699 package='$package'
16700 pager='$pager'
16701 passcat='$passcat'
16702 patchlevel='$patchlevel'
16703 path_sep='$path_sep'
16704 perl5='$perl5'
16705 perl='$perl'
16706 perladmin='$perladmin'
16707 perllibs='$perllibs'
16708 perlpath='$perlpath'
16709 pg='$pg'
16710 phostname='$phostname'
16711 pidtype='$pidtype'
16712 plibpth='$plibpth'
16713 pm_apiversion='$pm_apiversion'
16714 pmake='$pmake'
16715 pr='$pr'
16716 prefix='$prefix'
16717 prefixexp='$prefixexp'
16718 privlib='$privlib'
16719 privlibexp='$privlibexp'
16720 prototype='$prototype'
16721 ptrsize='$ptrsize'
16722 quadkind='$quadkind'
16723 quadtype='$quadtype'
16724 randbits='$randbits'
16725 randfunc='$randfunc'
16726 randseedtype='$randseedtype'
16727 ranlib='$ranlib'
16728 rd_nodata='$rd_nodata'
16729 revision='$revision'
16730 rm='$rm'
16731 rmail='$rmail'
16732 runnm='$runnm'
16733 sPRIEUldbl='$sPRIEUldbl'
16734 sPRIFUldbl='$sPRIFUldbl'
16735 sPRIGUldbl='$sPRIGUldbl'
16736 sPRIXU64='$sPRIXU64'
16737 sPRId64='$sPRId64'
16738 sPRIeldbl='$sPRIeldbl'
16739 sPRIfldbl='$sPRIfldbl'
16740 sPRIgldbl='$sPRIgldbl'
16741 sPRIi64='$sPRIi64'
16742 sPRIo64='$sPRIo64'
16743 sPRIu64='$sPRIu64'
16744 sPRIx64='$sPRIx64'
16745 sSCNfldbl='$sSCNfldbl'
16746 sched_yield='$sched_yield'
16747 scriptdir='$scriptdir'
16748 scriptdirexp='$scriptdirexp'
16749 sed='$sed'
16750 seedfunc='$seedfunc'
16751 selectminbits='$selectminbits'
16752 selecttype='$selecttype'
16753 sendmail='$sendmail'
16754 sh='$sh'
16755 shar='$shar'
16756 sharpbang='$sharpbang'
16757 shmattype='$shmattype'
16758 shortsize='$shortsize'
16759 shrpenv='$shrpenv'
16760 shsharp='$shsharp'
16761 sig_count='$sig_count'
16762 sig_name='$sig_name'
16763 sig_name_init='$sig_name_init'
16764 sig_num='$sig_num'
16765 sig_num_init='$sig_num_init'
16766 sig_size='$sig_size'
16767 signal_t='$signal_t'
16768 sitearch='$sitearch'
16769 sitearchexp='$sitearchexp'
16770 sitebin='$sitebin'
16771 sitebinexp='$sitebinexp'
16772 sitelib='$sitelib'
16773 sitelib_stem='$sitelib_stem'
16774 sitelibexp='$sitelibexp'
16775 siteprefix='$siteprefix'
16776 siteprefixexp='$siteprefixexp'
16777 sizesize='$sizesize'
16778 sizetype='$sizetype'
16779 sleep='$sleep'
16780 smail='$smail'
16781 so='$so'
16782 sockethdr='$sockethdr'
16783 socketlib='$socketlib'
16784 socksizetype='$socksizetype'
16785 sort='$sort'
16786 spackage='$spackage'
16787 spitshell='$spitshell'
16788 src='$src'
16789 ssizetype='$ssizetype'
16790 startperl='$startperl'
16791 startsh='$startsh'
16792 static_ext='$static_ext'
16793 stdchar='$stdchar'
16794 stdio_base='$stdio_base'
16795 stdio_bufsiz='$stdio_bufsiz'
16796 stdio_cnt='$stdio_cnt'
16797 stdio_filbuf='$stdio_filbuf'
16798 stdio_ptr='$stdio_ptr'
16799 stdio_stream_array='$stdio_stream_array'
16800 strings='$strings'
16801 submit='$submit'
16802 subversion='$subversion'
16803 sysman='$sysman'
16804 tail='$tail'
16805 tar='$tar'
16806 tbl='$tbl'
16807 tee='$tee'
16808 test='$test'
16809 timeincl='$timeincl'
16810 timetype='$timetype'
16811 touch='$touch'
16812 tr='$tr'
16813 trnl='$trnl'
16814 troff='$troff'
16815 u16size='$u16size'
16816 u16type='$u16type'
16817 u32size='$u32size'
16818 u32type='$u32type'
16819 u64size='$u64size'
16820 u64type='$u64type'
16821 u8size='$u8size'
16822 u8type='$u8type'
16823 uidformat='$uidformat'
16824 uidsign='$uidsign'
16825 uidsize='$uidsize'
16826 uidtype='$uidtype'
16827 uname='$uname'
16828 uniq='$uniq'
16829 uquadtype='$uquadtype'
16830 use5005threads='$use5005threads'
16831 use64bitall='$use64bitall'
16832 use64bitint='$use64bitint'
16833 usedl='$usedl'
16834 useithreads='$useithreads'
16835 uselargefiles='$uselargefiles'
16836 uselongdouble='$uselongdouble'
16837 usemorebits='$usemorebits'
16838 usemultiplicity='$usemultiplicity'
16839 usemymalloc='$usemymalloc'
16840 usenm='$usenm'
16841 useopcode='$useopcode'
16842 useperlio='$useperlio'
16843 useposix='$useposix'
16844 usesfio='$usesfio'
16845 useshrplib='$useshrplib'
16846 usesocks='$usesocks'
16847 usethreads='$usethreads'
16848 usevendorprefix='$usevendorprefix'
16849 usevfork='$usevfork'
16850 usrinc='$usrinc'
16851 uuname='$uuname'
16852 uvXUformat='$uvXUformat'
16853 uvoformat='$uvoformat'
16854 uvsize='$uvsize'
16855 uvtype='$uvtype'
16856 uvuformat='$uvuformat'
16857 uvxformat='$uvxformat'
16858 vendorarch='$vendorarch'
16859 vendorarchexp='$vendorarchexp'
16860 vendorbin='$vendorbin'
16861 vendorbinexp='$vendorbinexp'
16862 vendorlib='$vendorlib'
16863 vendorlib_stem='$vendorlib_stem'
16864 vendorlibexp='$vendorlibexp'
16865 vendorprefix='$vendorprefix'
16866 vendorprefixexp='$vendorprefixexp'
16867 version='$version'
16868 versiononly='$versiononly'
16869 vi='$vi'
16870 voidflags='$voidflags'
16871 xlibpth='$xlibpth'
16872 xs_apiversion='$xs_apiversion'
16873 yacc='$yacc'
16874 yaccflags='$yaccflags'
16875 zcat='$zcat'
16876 zip='$zip'
16877 EOT
16878
16879 : Add in command line options if available
16880 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16881
16882 : add special variables
16883 $test -f $src/patchlevel.h && \
16884 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16885 echo "CONFIGDOTSH=true" >>config.sh
16886
16887 : propagate old symbols
16888 if $test -f UU/config.sh; then
16889         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16890         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16891         $sort | $uniq -u >UU/oldsyms
16892         set X `cat UU/oldsyms`
16893         shift
16894         case $# in
16895         0) ;;
16896         *)
16897                 cat <<EOM
16898 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16899 EOM
16900                 echo "# Variables propagated from previous config.sh file." >>config.sh
16901                 for sym in `cat UU/oldsyms`; do
16902                         echo "    Propagating $hint variable "'$'"$sym..."
16903                         eval 'tmp="$'"${sym}"'"'
16904                         echo "$tmp" | \
16905                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16906                 done
16907                 ;;
16908         esac
16909 fi
16910
16911 : Finish up by extracting the .SH files
16912 case "$alldone" in
16913 exit)
16914         $rm -rf UU
16915         echo "Done."
16916         exit 0
16917         ;;
16918 cont)
16919         ;;
16920 '')
16921         dflt=''
16922         nostick=true
16923         $cat <<EOM
16924
16925 If you'd like to make any changes to the config.sh file before I begin
16926 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16927
16928 EOM
16929         rp="Press return or use a shell escape to edit config.sh:"
16930         . UU/myread
16931         nostick=''
16932         case "$ans" in
16933         '') ;;
16934         *) : in case they cannot read
16935                 sh 1>&4 -c "$ans";;
16936         esac
16937         ;;
16938 esac
16939
16940 : if this fails, just run all the .SH files by hand
16941 . ./config.sh
16942
16943 echo " "
16944 exec 1>&4
16945 . ./UU/extract
16946
16947 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16948         dflt=y
16949         case "$silent" in
16950         true) ;;
16951         *)
16952                 $cat <<EOM
16953
16954 Now you need to generate make dependencies by running "$make depend".
16955 You might prefer to run it in background: "$make depend > makedepend.out &"
16956 It can take a while, so you might not want to run it right now.
16957
16958 EOM
16959                 ;;
16960         esac
16961         rp="Run $make depend now?"
16962         . UU/myread
16963         case "$ans" in
16964         y*)
16965                 $make depend && echo "Now you must run '$make'."
16966                 ;;
16967         *)
16968                 echo "You must run '$make depend' then '$make'."
16969                 ;;
16970         esac
16971 elif test -f [Mm]akefile; then
16972         echo " "
16973         echo "Now you must run a $make."
16974 else
16975         echo "Done."
16976 fi
16977
16978 if $test -f Policy.sh; then
16979     $cat <<EOM
16980
16981 If you compile $package on a different machine or from a different object
16982 directory, copy the Policy.sh file from this object directory to the
16983 new one before you run Configure -- this will help you with most of
16984 the policy defaults.
16985
16986 EOM
16987 fi
16988 if $test -f config.msg; then
16989     echo "Hmm.  I also noted the following information while running:"
16990     echo " "
16991     $cat config.msg >&4
16992     $rm -f config.msg
16993 fi
16994 $rm -f kit*isdone ark*isdone
16995 $rm -rf UU
16996
16997 : End of Configure
16998