Fix for 20010219.013, "perlio perl -we tell goes SEGV".
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Apr 19 03:28:20 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_cmsghdr_s=''
328 d_const=''
329 cryptlib=''
330 d_crypt=''
331 d_csh=''
332 full_csh=''
333 d_cuserid=''
334 d_dbl_dig=''
335 d_difftime=''
336 d_dlerror=''
337 d_dlopen=''
338 d_dlsymun=''
339 d_dosuid=''
340 d_suidsafe=''
341 d_drand48proto=''
342 d_dup2=''
343 d_eaccess=''
344 d_endgrent=''
345 d_endhent=''
346 d_endnent=''
347 d_endpent=''
348 d_endpwent=''
349 d_endsent=''
350 d_fchmod=''
351 d_fchown=''
352 d_fcntl=''
353 d_fcntl_can_lock=''
354 d_fd_macros=''
355 d_fd_set=''
356 d_fds_bits=''
357 d_fgetpos=''
358 d_flexfnam=''
359 d_flock=''
360 d_fork=''
361 d_fpos64_t=''
362 d_frexpl=''
363 d_fs_data_s=''
364 d_fseeko=''
365 d_fsetpos=''
366 d_fstatfs=''
367 d_fsync=''
368 d_ftello=''
369 d_ftime=''
370 d_gettimeod=''
371 d_Gconvert=''
372 d_getcwd=''
373 d_getespwnam=''
374 d_getfsstat=''
375 d_getgrent=''
376 d_getgrps=''
377 d_gethbyaddr=''
378 d_gethbyname=''
379 d_gethent=''
380 aphostname=''
381 d_gethname=''
382 d_phostname=''
383 d_uname=''
384 d_gethostprotos=''
385 d_getitimer=''
386 d_getlogin=''
387 d_getmnt=''
388 d_getmntent=''
389 d_getnbyaddr=''
390 d_getnbyname=''
391 d_getnent=''
392 d_getnetprotos=''
393 d_getpagsz=''
394 d_getpent=''
395 d_getpgid=''
396 d_getpgrp2=''
397 d_bsdgetpgrp=''
398 d_getpgrp=''
399 d_getppid=''
400 d_getprior=''
401 d_getpbyname=''
402 d_getpbynumber=''
403 d_getprotoprotos=''
404 d_getprpwnam=''
405 d_getpwent=''
406 d_getsent=''
407 d_getservprotos=''
408 d_getspnam=''
409 d_getsbyname=''
410 d_getsbyport=''
411 d_gnulibc=''
412 d_hasmntopt=''
413 d_htonl=''
414 d_iconv=''
415 d_inetaton=''
416 d_int64_t=''
417 d_isascii=''
418 d_isnan=''
419 d_isnanl=''
420 d_killpg=''
421 d_lchown=''
422 d_ldbl_dig=''
423 d_link=''
424 d_locconv=''
425 d_lockf=''
426 d_longdbl=''
427 longdblsize=''
428 d_longlong=''
429 longlongsize=''
430 d_lseekproto=''
431 d_lstat=''
432 d_madvise=''
433 d_mblen=''
434 d_mbstowcs=''
435 d_mbtowc=''
436 d_memchr=''
437 d_memcmp=''
438 d_memcpy=''
439 d_memmove=''
440 d_memset=''
441 d_mkdir=''
442 d_mkdtemp=''
443 d_mkfifo=''
444 d_mkstemp=''
445 d_mkstemps=''
446 d_mktime=''
447 d_mmap=''
448 mmaptype=''
449 d_modfl=''
450 d_mprotect=''
451 d_msg=''
452 d_msgctl=''
453 d_msgget=''
454 d_msghdr_s=''
455 d_msgrcv=''
456 d_msgsnd=''
457 d_msync=''
458 d_munmap=''
459 d_nice=''
460 d_off64_t=''
461 d_open3=''
462 d_fpathconf=''
463 d_pathconf=''
464 d_pause=''
465 d_pipe=''
466 d_poll=''
467 d_portable=''
468 d_old_pthread_create_joinable=''
469 old_pthread_create_joinable=''
470 d_pthread_yield=''
471 d_sched_yield=''
472 sched_yield=''
473 d_qgcvt=''
474 d_readdir=''
475 d_rewinddir=''
476 d_seekdir=''
477 d_telldir=''
478 d_readlink=''
479 d_readv=''
480 d_recvmsg=''
481 d_rename=''
482 d_rmdir=''
483 d_safebcpy=''
484 d_safemcpy=''
485 d_sanemcmp=''
486 d_sbrkproto=''
487 d_select=''
488 d_sem=''
489 d_semctl=''
490 d_semget=''
491 d_semop=''
492 d_sendmsg=''
493 d_setegid=''
494 d_seteuid=''
495 d_setgrent=''
496 d_setgrps=''
497 d_sethent=''
498 d_setitimer=''
499 d_setlinebuf=''
500 d_setlocale=''
501 d_setnent=''
502 d_setpent=''
503 d_setpgid=''
504 d_setpgrp2=''
505 d_bsdsetpgrp=''
506 d_setpgrp=''
507 d_setprior=''
508 d_setproctitle=''
509 d_setpwent=''
510 d_setregid=''
511 d_setresgid=''
512 d_setresuid=''
513 d_setreuid=''
514 d_setrgid=''
515 d_setruid=''
516 d_setsent=''
517 d_setsid=''
518 d_setvbuf=''
519 d_sfio=''
520 usesfio=''
521 d_shm=''
522 d_shmat=''
523 d_shmatprototype=''
524 shmattype=''
525 d_shmctl=''
526 d_shmdt=''
527 d_shmget=''
528 d_sigaction=''
529 d_sigprocmask=''
530 d_sigsetjmp=''
531 d_sockatmark=''
532 d_msg_ctrunc=''
533 d_msg_dontroute=''
534 d_msg_oob=''
535 d_msg_peek=''
536 d_msg_proxy=''
537 d_oldsock=''
538 d_scm_rights=''
539 d_socket=''
540 d_sockpair=''
541 sockethdr=''
542 socketlib=''
543 d_socklen_t=''
544 d_socks5_init=''
545 d_sqrtl=''
546 d_statblks=''
547 d_statfs_f_flags=''
548 d_statfs_s=''
549 d_fstatvfs=''
550 d_statvfs=''
551 d_stdio_cnt_lval=''
552 d_stdio_ptr_lval=''
553 d_stdio_ptr_lval_nochange_cnt=''
554 d_stdio_ptr_lval_sets_cnt=''
555 d_stdiobase=''
556 d_stdstdio=''
557 stdio_base=''
558 stdio_bufsiz=''
559 stdio_cnt=''
560 stdio_filbuf=''
561 stdio_ptr=''
562 d_index=''
563 d_strchr=''
564 d_strcoll=''
565 d_strctcpy=''
566 d_strerrm=''
567 d_strerror=''
568 d_sysernlst=''
569 d_syserrlst=''
570 d_strftime=''
571 d_strtod=''
572 d_strtol=''
573 d_strtold=''
574 d_strtoll=''
575 d_strtoq=''
576 d_strtoul=''
577 d_strtoull=''
578 d_strtouq=''
579 d_strxfrm=''
580 d_symlink=''
581 d_syscall=''
582 d_sysconf=''
583 d_system=''
584 d_tcgetpgrp=''
585 d_tcsetpgrp=''
586 d_telldirproto=''
587 d_time=''
588 timetype=''
589 clocktype=''
590 d_times=''
591 d_truncate=''
592 d_tzname=''
593 d_u32align=''
594 d_ualarm=''
595 d_umask=''
596 d_semctl_semid_ds=''
597 d_semctl_semun=''
598 d_union_semun=''
599 d_usleep=''
600 d_ustat=''
601 d_vfork=''
602 usevfork=''
603 d_voidsig=''
604 signal_t=''
605 d_volatile=''
606 d_charvspr=''
607 d_vprintf=''
608 d_wait4=''
609 d_waitpid=''
610 d_wcstombs=''
611 d_wctomb=''
612 d_writev=''
613 dlext=''
614 cccdlflags=''
615 ccdlflags=''
616 dlsrc=''
617 ld=''
618 lddlflags=''
619 usedl=''
620 doublesize=''
621 ebcdic=''
622 fflushNULL=''
623 fflushall=''
624 fpossize=''
625 fpostype=''
626 gccosandvers=''
627 gccversion=''
628 gidformat=''
629 gidsign=''
630 gidsize=''
631 gidtype=''
632 groupstype=''
633 h_fcntl=''
634 h_sysfile=''
635 i_arpainet=''
636 db_hashtype=''
637 db_prefixtype=''
638 i_db=''
639 i_dbm=''
640 i_rpcsvcdbm=''
641 d_dirnamlen=''
642 direntrytype=''
643 i_dirent=''
644 i_dld=''
645 i_dlfcn=''
646 i_fcntl=''
647 i_float=''
648 i_gdbm=''
649 d_grpasswd=''
650 i_grp=''
651 i_iconv=''
652 i_ieeefp=''
653 i_inttypes=''
654 i_libutil=''
655 i_limits=''
656 i_locale=''
657 i_machcthr=''
658 i_malloc=''
659 i_math=''
660 i_memory=''
661 i_mntent=''
662 i_ndbm=''
663 i_netdb=''
664 i_neterrno=''
665 i_netinettcp=''
666 i_niin=''
667 i_sysin=''
668 i_poll=''
669 i_prot=''
670 i_pthread=''
671 d_pwage=''
672 d_pwchange=''
673 d_pwclass=''
674 d_pwcomment=''
675 d_pwexpire=''
676 d_pwgecos=''
677 d_pwpasswd=''
678 d_pwquota=''
679 i_pwd=''
680 i_sfio=''
681 i_shadow=''
682 i_socks=''
683 i_stddef=''
684 i_stdlib=''
685 i_string=''
686 strings=''
687 i_sunmath=''
688 i_sysaccess=''
689 i_sysdir=''
690 i_sysfile=''
691 d_voidtty=''
692 i_bsdioctl=''
693 i_sysfilio=''
694 i_sysioctl=''
695 i_syssockio=''
696 i_syslog=''
697 i_sysmman=''
698 i_sysmode=''
699 i_sysmount=''
700 i_sysndir=''
701 i_sysparam=''
702 i_sysresrc=''
703 i_syssecrt=''
704 i_sysselct=''
705 i_sysstat=''
706 i_sysstatfs=''
707 i_sysstatvfs=''
708 i_systimes=''
709 i_systypes=''
710 i_sysuio=''
711 i_sysun=''
712 i_sysutsname=''
713 i_sysvfs=''
714 i_syswait=''
715 i_sgtty=''
716 i_termio=''
717 i_termios=''
718 i_systime=''
719 i_systimek=''
720 i_time=''
721 timeincl=''
722 i_unistd=''
723 i_ustat=''
724 i_utime=''
725 i_values=''
726 i_stdarg=''
727 i_varargs=''
728 i_varhdr=''
729 i_vfork=''
730 inc_version_list=''
731 inc_version_list_init=''
732 installprefix=''
733 installprefixexp=''
734 installstyle=''
735 installusrbinperl=''
736 intsize=''
737 longsize=''
738 shortsize=''
739 issymlink=''
740 libc=''
741 ldlibpthname=''
742 libperl=''
743 shrpenv=''
744 useshrplib=''
745 glibpth=''
746 libpth=''
747 loclibpth=''
748 plibpth=''
749 xlibpth=''
750 ignore_versioned_solibs=''
751 libs=''
752 libsdirs=''
753 libsfiles=''
754 libsfound=''
755 libspath=''
756 lns=''
757 d_PRIEUldbl=''
758 d_PRIFUldbl=''
759 d_PRIGUldbl=''
760 d_PRIeldbl=''
761 d_PRIfldbl=''
762 d_PRIgldbl=''
763 d_SCNfldbl=''
764 sPRIEUldbl=''
765 sPRIFUldbl=''
766 sPRIGUldbl=''
767 sPRIeldbl=''
768 sPRIfldbl=''
769 sPRIgldbl=''
770 sSCNfldbl=''
771 lseeksize=''
772 lseektype=''
773 make_set_make=''
774 d_mymalloc=''
775 freetype=''
776 mallocobj=''
777 mallocsrc=''
778 malloctype=''
779 usemymalloc=''
780 installman1dir=''
781 man1dir=''
782 man1direxp=''
783 man1ext=''
784 installman3dir=''
785 man3dir=''
786 man3direxp=''
787 man3ext=''
788 modetype=''
789 multiarch=''
790 mydomain=''
791 myhostname=''
792 phostname=''
793 c=''
794 n=''
795 d_eofnblk=''
796 eagain=''
797 o_nonblock=''
798 rd_nodata=''
799 need_va_copy=''
800 netdb_hlen_type=''
801 netdb_host_type=''
802 netdb_name_type=''
803 netdb_net_type=''
804 groupcat=''
805 hostcat=''
806 passcat=''
807 orderlib=''
808 ranlib=''
809 d_perl_otherlibdirs=''
810 otherlibdirs=''
811 package=''
812 spackage=''
813 pager=''
814 api_revision=''
815 api_subversion=''
816 api_version=''
817 api_versionstring=''
818 patchlevel=''
819 revision=''
820 subversion=''
821 version=''
822 perl5=''
823 perladmin=''
824 perlpath=''
825 d_nv_preserves_uv=''
826 d_nv_preserves_uv_bits=''
827 i16size=''
828 i16type=''
829 i32size=''
830 i32type=''
831 i64size=''
832 i64type=''
833 i8size=''
834 i8type=''
835 ivsize=''
836 ivtype=''
837 nvsize=''
838 nvtype=''
839 u16size=''
840 u16type=''
841 u32size=''
842 u32type=''
843 u64size=''
844 u64type=''
845 u8size=''
846 u8type=''
847 uvsize=''
848 uvtype=''
849 ivdformat=''
850 nvEUformat=''
851 nvFUformat=''
852 nvGUformat=''
853 nveformat=''
854 nvfformat=''
855 nvgformat=''
856 uvXUformat=''
857 uvoformat=''
858 uvuformat=''
859 uvxformat=''
860 pidtype=''
861 prefix=''
862 prefixexp=''
863 installprivlib=''
864 privlib=''
865 privlibexp=''
866 prototype=''
867 ptrsize=''
868 d_PRIXU64=''
869 d_PRId64=''
870 d_PRIi64=''
871 d_PRIo64=''
872 d_PRIu64=''
873 d_PRIx64=''
874 sPRIXU64=''
875 sPRId64=''
876 sPRIi64=''
877 sPRIo64=''
878 sPRIu64=''
879 sPRIx64=''
880 d_quad=''
881 quadkind=''
882 quadtype=''
883 uquadtype=''
884 drand01=''
885 randbits=''
886 randfunc=''
887 randseedtype=''
888 seedfunc=''
889 installscript=''
890 scriptdir=''
891 scriptdirexp=''
892 selectminbits=''
893 selecttype=''
894 sh=''
895 sig_count=''
896 sig_name=''
897 sig_name_init=''
898 sig_num=''
899 sig_num_init=''
900 sig_size=''
901 installsitearch=''
902 sitearch=''
903 sitearchexp=''
904 installsitebin=''
905 sitebin=''
906 sitebinexp=''
907 installsitelib=''
908 sitelib=''
909 sitelib_stem=''
910 sitelibexp=''
911 siteprefix=''
912 siteprefixexp=''
913 sizesize=''
914 sizetype=''
915 so=''
916 socksizetype=''
917 sharpbang=''
918 shsharp=''
919 spitshell=''
920 src=''
921 ssizetype=''
922 startperl=''
923 startsh=''
924 stdchar=''
925 d_stdio_stream_array=''
926 stdio_stream_array=''
927 sysman=''
928 trnl=''
929 uidformat=''
930 uidsign=''
931 uidsize=''
932 uidtype=''
933 archname64=''
934 use64bitall=''
935 use64bitint=''
936 ccflags_uselargefiles=''
937 ldflags_uselargefiles=''
938 libswanted_uselargefiles=''
939 uselargefiles=''
940 uselongdouble=''
941 usemorebits=''
942 usemultiplicity=''
943 nm_opt=''
944 nm_so_opt=''
945 runnm=''
946 usenm=''
947 useperlio=''
948 usesocks=''
949 d_oldpthreads=''
950 use5005threads=''
951 useithreads=''
952 usethreads=''
953 incpath=''
954 mips_type=''
955 usrinc=''
956 d_vendorarch=''
957 installvendorarch=''
958 vendorarch=''
959 vendorarchexp=''
960 d_vendorbin=''
961 installvendorbin=''
962 vendorbin=''
963 vendorbinexp=''
964 d_vendorlib=''
965 installvendorlib=''
966 vendorlib=''
967 vendorlib_stem=''
968 vendorlibexp=''
969 usevendorprefix=''
970 vendorprefix=''
971 vendorprefixexp=''
972 versiononly=''
973 defvoidused=''
974 voidflags=''
975 pm_apiversion=''
976 xs_apiversion=''
977 yacc=''
978 yaccflags=''
979 CONFIG=''
980
981 define='define'
982 undef='undef'
983 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
984 rmlist=''
985
986 : We must find out about Eunice early
987 eunicefix=':'
988 if test -f /etc/unixtovms; then
989         eunicefix=/etc/unixtovms
990 fi
991 if test -f /etc/unixtovms.exe; then
992         eunicefix=/etc/unixtovms.exe
993 fi
994
995 i_whoami=''
996 ccname=''
997 ccversion=''
998 perllibs=''
999 : set useposix=false in your hint file to disable the POSIX extension.
1000 useposix=true
1001 : set useopcode=false in your hint file to disable the Opcode extension.
1002 useopcode=true
1003 : Trailing extension.  Override this in a hint file, if needed.
1004 _exe=''
1005 : Extra object files, if any, needed on this platform.
1006 archobjs=''
1007 archname=''
1008 : Possible local include directories to search.
1009 : Set locincpth to "" in a hint file to defeat local include searches.
1010 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1011 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1012 :
1013 : no include file wanted by default
1014 inclwanted=''
1015
1016 groupstype=''
1017 : change the next line if compiling for Xenix/286 on Xenix/386
1018 xlibpth='/usr/lib/386 /lib/386'
1019 : Possible local library directories to search.
1020 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1021 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1022
1023 : general looking path for locating libraries
1024 glibpth="/lib /usr/lib $xlibpth"
1025 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1026 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1027 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1028
1029 : Private path used by Configure to find libraries.  Its value
1030 : is prepended to libpth. This variable takes care of special
1031 : machines, like the mips.  Usually, it should be empty.
1032 plibpth=''
1033
1034 : default library list
1035 libswanted=''
1036 : some systems want to use only the non-versioned libso:s
1037 ignore_versioned_solibs=''
1038 archname64=''
1039 ccflags_uselargefiles=''
1040 ldflags_uselargefiles=''
1041 libswanted_uselargefiles=''
1042 : set usemultiplicity on the Configure command line to enable multiplicity.
1043 : set usesocks on the Configure command line to enable socks.
1044 : set usethreads on the Configure command line to enable threads.
1045 : full support for void wanted by default
1046 defvoidused=15
1047
1048 : List of libraries we want.
1049 : If anyone needs -lnet, put it in a hint file.
1050 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1051 libswanted="$libswanted dld ld sun m c cposix posix"
1052 libswanted="$libswanted ndir dir crypt sec"
1053 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1054 : We probably want to search /usr/shlib before most other libraries.
1055 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1056 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1057 glibpth="/usr/shlib $glibpth"
1058 : Do not use vfork unless overridden by a hint file.
1059 usevfork=false
1060
1061 : Find the basic shell for Bourne shell scripts
1062 case "$sh" in
1063 '')
1064         case "$SYSTYPE" in
1065         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1066         *) xxx='/bin/sh';;
1067         esac
1068         if test -f "$xxx"; then
1069                 sh="$xxx"
1070         else
1071                 : Build up a list and do a single loop so we can 'break' out.
1072                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1073                 for xxx in sh bash ksh pdksh ash; do
1074                         for p in $pth; do
1075                                 try="$try ${p}/${xxx}"
1076                         done
1077                 done
1078                 for xxx in $try; do
1079                         if test -f "$xxx"; then
1080                                 sh="$xxx";
1081                                 break
1082                         elif test -f "$xxx.exe"; then
1083                                 sh="$xxx";
1084                                 break
1085                         fi
1086                 done
1087         fi
1088         ;;
1089 esac
1090
1091 case "$sh" in
1092 '')     cat <<EOM >&2
1093 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1094
1095 Usually it's in /bin/sh.  How did you even get this far?
1096 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1097 we'll try to straighten this all out.
1098 EOM
1099         exit 1
1100         ;;
1101 esac
1102
1103 : see if sh knows # comments
1104 if `$sh -c '#' >/dev/null 2>&1`; then
1105         shsharp=true
1106         spitshell=cat
1107         xcat=/bin/cat
1108         test -f $xcat || xcat=/usr/bin/cat
1109         echo "#!$xcat" >try
1110         $eunicefix try
1111         chmod +x try
1112         ./try > today
1113         if test -s today; then
1114                 sharpbang='#!'
1115         else
1116                 echo "#! $xcat" > try
1117                 $eunicefix try
1118                 chmod +x try
1119                 ./try > today
1120                 if test -s today; then
1121                         sharpbang='#! '
1122                 else
1123                         sharpbang=': use '
1124                 fi
1125         fi
1126 else
1127         echo " "
1128         echo "Your $sh doesn't grok # comments--I will strip them later on."
1129         shsharp=false
1130         cd ..
1131         echo "exec grep -v '^[  ]*#'" >spitshell
1132         chmod +x spitshell
1133         $eunicefix spitshell
1134         spitshell=`pwd`/spitshell
1135         cd UU
1136         echo "I presume that if # doesn't work, #! won't work either!"
1137         sharpbang=': use '
1138 fi
1139 rm -f try today
1140
1141 : figure out how to guarantee sh startup
1142 case "$startsh" in
1143 '') startsh=${sharpbang}${sh} ;;
1144 *)
1145 esac
1146 cat >try <<EOSS
1147 $startsh
1148 set abc
1149 test "$?abc" != 1
1150 EOSS
1151
1152 chmod +x try
1153 $eunicefix try
1154 if ./try; then
1155         : echo "Yup, it does."
1156 else
1157         echo "Hmm... '$startsh' does not guarantee sh startup..."
1158         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1159 fi
1160 rm -f try
1161
1162
1163 : Save command line options in file UU/cmdline.opt for later use in
1164 : generating config.sh.
1165 cat > cmdline.opt <<EOSH
1166 # Configure command line arguments.
1167 config_arg0='$0'
1168 config_args='$*'
1169 config_argc=$#
1170 EOSH
1171 argn=1
1172 for arg in "$@"; do
1173         cat >>cmdline.opt <<EOSH
1174 config_arg$argn='$arg'
1175 EOSH
1176         argn=`expr $argn + 1`
1177 done
1178
1179 : produce awk script to parse command line options
1180 cat >options.awk <<'EOF'
1181 BEGIN {
1182         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1183
1184         len = length(optstr);
1185         for (i = 1; i <= len; i++) {
1186                 c = substr(optstr, i, 1);
1187                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1188                 if (a == ":") {
1189                         arg[c] = 1;
1190                         i++;
1191                 }
1192                 opt[c] = 1;
1193         }
1194 }
1195 {
1196         expect = 0;
1197         str = $0;
1198         if (substr(str, 1, 1) != "-") {
1199                 printf("'%s'\n", str);
1200                 next;
1201         }
1202         len = length($0);
1203         for (i = 2; i <= len; i++) {
1204                 c = substr(str, i, 1);
1205                 if (!opt[c]) {
1206                         printf("-%s\n", substr(str, i));
1207                         next;
1208                 }
1209                 printf("-%s\n", c);
1210                 if (arg[c]) {
1211                         if (i < len)
1212                                 printf("'%s'\n", substr(str, i + 1));
1213                         else
1214                                 expect = 1;
1215                         next;
1216                 }
1217         }
1218 }
1219 END {
1220         if (expect)
1221                 print "?";
1222 }
1223 EOF
1224
1225 : process the command line options
1226 set X `for arg in "$@"; do echo "X$arg"; done |
1227         sed -e s/X// | awk -f options.awk`
1228 eval "set $*"
1229 shift
1230 rm -f options.awk
1231
1232 : set up default values
1233 fastread=''
1234 reuseval=false
1235 config_sh=''
1236 alldone=''
1237 error=''
1238 silent=''
1239 extractsh=''
1240 override=''
1241 knowitall=''
1242 rm -f optdef.sh posthint.sh
1243 cat >optdef.sh <<EOS
1244 $startsh
1245 EOS
1246
1247
1248 : option parsing
1249 while test $# -gt 0; do
1250         case "$1" in
1251         -d) shift; fastread=yes;;
1252         -e) shift; alldone=cont;;
1253         -f)
1254                 shift
1255                 cd ..
1256                 if test -r "$1"; then
1257                         config_sh="$1"
1258                 else
1259                         echo "$me: cannot read config file $1." >&2
1260                         error=true
1261                 fi
1262                 cd UU
1263                 shift;;
1264         -h) shift; error=true;;
1265         -r) shift; reuseval=true;;
1266         -s) shift; silent=true; realsilent=true;;
1267         -E) shift; alldone=exit;;
1268         -K) shift; knowitall=true;;
1269         -O) shift; override=true;;
1270         -S) shift; silent=true; extractsh=true;;
1271         -D)
1272                 shift
1273                 case "$1" in
1274                 *=)
1275                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1276                         echo "$me: ignoring -D $1" >&2
1277                         ;;
1278                 *=*) echo "$1" | \
1279                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1280                 *) echo "$1='define'" >> optdef.sh;;
1281                 esac
1282                 shift
1283                 ;;
1284         -U)
1285                 shift
1286                 case "$1" in
1287                 *=) echo "$1" >> optdef.sh;;
1288                 *=*)
1289                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1290                         echo "$me: ignoring -U $1" >&2
1291                         ;;
1292                 *) echo "$1='undef'" >> optdef.sh;;
1293                 esac
1294                 shift
1295                 ;;
1296         -A)
1297             shift
1298             xxx=''
1299             yyy="$1"
1300             zzz=''
1301             uuu=undef
1302             case "$yyy" in
1303             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1304                  case "$zzz" in
1305                  *:*) zzz='' ;;
1306                  *)   xxx=append
1307                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1308                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1309                  esac
1310                  ;;
1311             esac
1312             case "$xxx" in
1313             '')  case "$yyy" in
1314                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1315                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1316                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1317                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1318                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1319                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1320                  esac
1321                  ;;       
1322             esac
1323             case "$xxx" in
1324             append)
1325                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1326             clear)
1327                 echo "$yyy=''"                  >> posthint.sh ;;
1328             define)
1329                 case "$zzz" in
1330                 '') zzz=define ;;
1331                 esac
1332                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1333             eval)
1334                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1335             prepend)
1336                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1337             undef)
1338                 case "$zzz" in
1339                 '') zzz="$uuu" ;;
1340                 esac
1341                 echo "$yyy=$zzz"                >> posthint.sh ;;
1342             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1343             esac
1344             shift
1345             ;;
1346         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1347             exit 0;;
1348         --) break;;
1349         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1350         *) break;;
1351         esac
1352 done
1353
1354 case "$error" in
1355 true)
1356         cat >&2 <<EOM
1357 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1358                  [-U symbol] [-U symbol=] [-A command:symbol...]
1359   -d : use defaults for all answers.
1360   -e : go on without questioning past the production of config.sh.
1361   -f : specify an alternate default configuration file.
1362   -h : print this help message and exit (with an error status).
1363   -r : reuse C symbols value if possible (skips costly nm extraction).
1364   -s : silent mode, only echoes questions and essential information.
1365   -D : define symbol to have some value:
1366          -D symbol         symbol gets the value 'define'
1367          -D symbol=value   symbol gets the value 'value'
1368   -E : stop at the end of questions, after having produced config.sh.
1369   -K : do not use unless you know what you are doing.
1370   -O : let -D and -U override definitions from loaded configuration file.
1371   -S : perform variable substitutions on all .SH files (can mix with -f)
1372   -U : undefine symbol:
1373          -U symbol    symbol gets the value 'undef'
1374          -U symbol=   symbol gets completely empty
1375   -A : manipulate symbol after the platform specific hints have been applied:
1376          -A symbol=value                append " "value to symbol
1377          -A append:symbol=value         append value to symbol
1378          -A define:symbol=value         define symbol to have value
1379          -A clear:symbol                define symbol to be ''
1380          -A define:symbol               define symbol to be 'define'
1381          -A eval:symbol=value           define symbol to be eval of value
1382          -A prepend:symbol=value        prepend value to symbol
1383          -A undef:symbol                define symbol to be 'undef'
1384          -A undef:symbol=               define symbol to be ''
1385   -V : print version number and exit (with a zero status).
1386 EOM
1387         exit 1
1388         ;;
1389 esac
1390
1391 : Sanity checks
1392 case "$fastread$alldone" in
1393 yescont|yesexit) ;;
1394 *)
1395         case "$extractsh" in
1396         true) ;;
1397         *)
1398                 if test ! -t 0; then
1399                         echo "Say 'sh Configure', not 'sh <Configure'"
1400                         exit 1
1401                 fi
1402                 ;;
1403         esac
1404         ;;
1405 esac
1406
1407 exec 4>&1
1408 case "$silent" in
1409 true) exec 1>/dev/null;;
1410 esac
1411
1412 : run the defines and the undefines, if any, but leave the file out there...
1413 touch optdef.sh
1414 . ./optdef.sh
1415 : create the posthint manipulation script and leave the file out there...
1416 touch posthint.sh
1417
1418 : set package name
1419 package=perl5
1420 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1421 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1422 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1423 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1424 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1425 esac
1426
1427 : Some greps do not return status, grrr.
1428 echo "grimblepritz" >grimble
1429 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1430         contains=contains
1431 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1432         contains=grep
1433 else
1434         contains=contains
1435 fi
1436 rm -f grimble
1437 : the following should work in any shell
1438 case "$contains" in
1439 contains*)
1440         echo " "
1441         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1442         cat >contains <<'EOSS'
1443 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1444 EOSS
1445 chmod +x contains
1446 esac
1447
1448 : Find the path to the source tree
1449 case "$src" in
1450 '') case "$0" in
1451     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1452          case "$src" in
1453          /*)    ;;
1454          .)     ;;
1455          *)     src=`cd ../$src && pwd` ;;
1456          esac
1457          ;;
1458     *)   src='.';;
1459     esac;;
1460 esac
1461 case "$src" in
1462 '')     src=/
1463         rsrc=/
1464         ;;
1465 /*) rsrc="$src";;
1466 *) rsrc="../$src";;
1467 esac
1468 if test -f $rsrc/Configure && \
1469         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1470 then
1471    : found it, so we are ok.
1472 else
1473         rsrc=''
1474         for src in . .. ../.. ../../.. ../../../..; do
1475                 if test -f ../$src/Configure && \
1476                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1477                 then
1478                         rsrc=../$src
1479                         break
1480                 fi
1481         done
1482 fi
1483 case "$rsrc" in
1484 '')
1485         cat <<EOM >&4
1486
1487 Sorry, I can't seem to locate the source dir for $package.  Please start
1488 Configure with an explicit path -- i.e. /some/path/Configure.
1489
1490 EOM
1491         exit 1
1492         ;;
1493 ../.)   rsrc='..';;
1494 *)
1495         echo " "
1496         echo "Sources for $package found in \"$src\"." >&4
1497         ;;
1498 esac
1499
1500 : script used to extract .SH files with variable substitutions
1501 cat >extract <<'EOS'
1502 CONFIGDOTSH=true
1503 echo "Doing variable substitutions on .SH files..."
1504 if test -f $src/MANIFEST; then
1505         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1506 else
1507         echo "(Looking for .SH files under the source directory.)"
1508         set x `(cd $src; find . -name "*.SH" -print)`
1509 fi
1510 shift
1511 case $# in
1512 0) set x `(cd $src; echo *.SH)`; shift;;
1513 esac
1514 if test ! -f $src/$1; then
1515         shift
1516 fi
1517 mkdir_p='
1518 name=$1;
1519 create="";
1520 while test $name; do
1521         if test ! -d "$name"; then
1522                 create="$name $create";
1523                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1524                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1525         else
1526                 name="";
1527         fi;
1528 done;
1529 for file in $create; do
1530         mkdir $file;
1531 done
1532 '
1533 for file in $*; do
1534         case "$src" in
1535         ".")
1536                 case "$file" in
1537                 */*)
1538                         dir=`expr X$file : 'X\(.*\)/'`
1539                         file=`expr X$file : 'X.*/\(.*\)'`
1540                         (cd $dir && . ./$file)
1541                         ;;
1542                 *)
1543                         . ./$file
1544                         ;;
1545                 esac
1546                 ;;
1547         *)
1548                 case "$file" in
1549                 */*)
1550                         dir=`expr X$file : 'X\(.*\)/'`
1551                         file=`expr X$file : 'X.*/\(.*\)'`
1552                         (set x $dir; shift; eval $mkdir_p)
1553                         sh <$src/$dir/$file
1554                         ;;
1555                 *)
1556                         sh <$src/$file
1557                         ;;
1558                 esac
1559                 ;;
1560         esac
1561 done
1562 if test -f $src/config_h.SH; then
1563         if test ! -f config.h; then
1564         : oops, they left it out of MANIFEST, probably, so do it anyway.
1565         . $src/config_h.SH
1566         fi
1567 fi
1568 EOS
1569
1570 : extract files and exit if asked to do so
1571 case "$extractsh" in
1572 true)
1573         case "$realsilent" in
1574         true) ;;
1575         *) exec 1>&4;;
1576         esac
1577         case "$config_sh" in
1578         '') config_sh='config.sh';;
1579         esac
1580         echo " "
1581         echo "Fetching answers from $config_sh..."
1582         cd ..
1583         . $config_sh
1584         test "$override" && . ./optdef.sh
1585         echo " "
1586         . UU/extract
1587         rm -rf UU
1588         echo "Done."
1589         exit 0
1590         ;;
1591 esac
1592
1593 : Eunice requires " " instead of "", can you believe it
1594 echo " "
1595 : Here we go...
1596 echo "Beginning of configuration questions for $package."
1597
1598 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1599
1600 : first determine how to suppress newline on echo command
1601 echo " "
1602 echo "Checking echo to see how to suppress newlines..."
1603 (echo "hi there\c" ; echo " ") >.echotmp
1604 if $contains c .echotmp >/dev/null 2>&1 ; then
1605         echo "...using -n."
1606         n='-n'
1607         c=''
1608 else
1609         cat <<'EOM'
1610 ...using \c
1611 EOM
1612         n=''
1613         c='\c'
1614 fi
1615 echo $n "The star should be here-->$c"
1616 echo '*'
1617 rm -f .echotmp
1618
1619 : Now test for existence of everything in MANIFEST
1620 echo " "
1621 if test -f $rsrc/MANIFEST; then
1622         echo "First let's make sure your kit is complete.  Checking..." >&4
1623         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1624         rm -f missing
1625         tmppwd=`pwd`
1626         for filelist in x??; do
1627                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1628         done
1629         if test -s missing; then
1630                 cat missing >&4
1631                 cat >&4 <<'EOM'
1632
1633 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1634
1635 You have the option of continuing the configuration process, despite the
1636 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1637 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1638 and contact the author (perlbug@perl.org).
1639
1640 EOM
1641                 echo $n "Continue? [n] $c" >&4
1642                 read ans
1643                 case "$ans" in
1644                 y*)
1645                         echo "Continuing..." >&4
1646                         rm -f missing
1647                         ;;
1648                 *)
1649                         echo "ABORTING..." >&4
1650                         kill $$
1651                         ;;
1652                 esac
1653         else
1654                 echo "Looks good..."
1655         fi
1656 else
1657         echo "There is no MANIFEST file.  I hope your kit is complete !"
1658 fi
1659 rm -f missing x??
1660
1661 echo " "
1662 : Find the appropriate value for a newline for tr
1663 if test -n "$DJGPP"; then
1664        trnl='\012'
1665 fi
1666 if test X"$trnl" = X; then
1667         case "`echo foo|tr '\n' x 2>/dev/null`" in
1668         foox) trnl='\n' ;;
1669         esac
1670 fi
1671 if test X"$trnl" = X; then
1672         case "`echo foo|tr '\012' x 2>/dev/null`" in
1673         foox) trnl='\012' ;;
1674         esac
1675 fi
1676 if test X"$trnl" = X; then
1677         cat <<EOM >&2
1678
1679 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1680
1681 EOM
1682         exit 1
1683 fi
1684
1685 : compute the number of columns on the terminal for proper question formatting
1686 case "$COLUMNS" in
1687 '') COLUMNS='80';;
1688 esac
1689
1690 : set up the echo used in my read
1691 myecho="case \"\$xxxm\" in
1692 '') echo $n \"\$rp $c\" >&4;;
1693 *) case \"\$rp\" in
1694         '') echo $n \"[\$xxxm] $c\";;
1695         *)
1696                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1697                         echo \"\$rp\" >&4
1698                         echo $n \"[\$xxxm] $c\" >&4
1699                 else
1700                         echo $n \"\$rp [\$xxxm] $c\" >&4
1701                 fi
1702                 ;;
1703         esac;;
1704 esac"
1705
1706 : now set up to do reads with possible shell escape and default assignment
1707 cat <<EOSC >myread
1708 $startsh
1709 xxxm=\$dflt
1710 $myecho
1711 ans='!'
1712 case "\$fastread" in
1713 yes) case "\$dflt" in
1714         '') ;;
1715         *) ans='';
1716                 case "\$silent-\$rp" in
1717                 true-) ;;
1718                 *) echo " " >&4;;
1719                 esac;;
1720         esac;;
1721 *) case "\$silent" in
1722         true) case "\$rp" in
1723                 '') ans='';;
1724                 esac;;
1725         esac;;
1726 esac
1727 while expr "X\$ans" : "X!" >/dev/null; do
1728         read answ
1729         set x \$xxxm
1730         shift
1731         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1732         case  "\$answ" in
1733         "!")
1734                 sh 1>&4
1735                 echo " "
1736                 $myecho
1737                 ;;
1738         !*)
1739                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1740                 shift
1741                 sh 1>&4 -c "\$*"
1742                 echo " "
1743                 $myecho
1744                 ;;
1745         "\$ans")
1746                 case "\$ans" in
1747                 \\&*)
1748                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1749                         shift
1750                         case "\$1" in
1751                         -d)
1752                                 fastread=yes
1753                                 echo "(OK, I'll run with -d after this question.)" >&4
1754                                 ;;
1755                         -*)
1756                                 echo "*** Sorry, \$1 not supported yet." >&4
1757                                 ;;
1758                         esac
1759                         $myecho
1760                         ans=!
1761                         ;;
1762                 esac;;
1763         *)
1764                 case "\$aok" in
1765                 y)
1766                         echo "*** Substitution done -- please confirm."
1767                         xxxm="\$ans"
1768                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1769                         xxxm="\$ans"
1770                         ans=!
1771                         ;;
1772                 *)
1773                         echo "*** Error -- try again."
1774                         ans=!
1775                         ;;
1776                 esac
1777                 $myecho
1778                 ;;
1779         esac
1780         case "\$ans\$xxxm\$nostick" in
1781         '')
1782                 ans=!
1783                 $myecho
1784                 ;;
1785         esac
1786 done
1787 case "\$ans" in
1788 '') ans="\$xxxm";;
1789 esac
1790 EOSC
1791
1792 : create .config dir to save info across Configure sessions
1793 test -d ../.config || mkdir ../.config
1794 cat >../.config/README <<EOF
1795 This directory created by Configure to save information that should
1796 persist across sessions for $package.
1797
1798 You may safely delete it if you wish.
1799 EOF
1800
1801 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1802 case "$usedevel" in
1803 $define|true|[yY]*) ;;
1804 *) case "$xversion" in
1805    *[13579])
1806         cat >&4 <<EOH
1807 *** WHOA THERE!!! ***
1808
1809     This is an UNSTABLE DEVELOPMENT release.
1810     The version of this $package distribution is $xversion, that is, odd,
1811     (as opposed to even) and that signifies a development release.
1812     If you want a maintenance release, you want an even-numbered version.
1813
1814     Do ***NOT*** install this into production use.
1815     Data corruption and crashes are possible.
1816
1817     It is most seriously suggested that you do not continue any further
1818     unless you want to help in developing and debugging Perl.
1819
1820     If you *still* want to build perl, you can answer 'y' now,
1821     or pass -Dusedevel to Configure.
1822
1823 EOH
1824         rp='Do you really want to continue?'
1825         dflt='n'
1826         . ./myread
1827         case "$ans" in
1828         [yY]) echo >&4 "Okay, continuing."
1829               usedevel="$define" ;;
1830         *) echo >&4 "Okay, bye."
1831            exit 1
1832            ;;
1833         esac
1834         ;;
1835     esac
1836     ;;
1837 esac
1838 case "$usedevel" in
1839 $define|true|[yY]*)
1840         case "$versiononly" in
1841         '') versiononly="$define" ;;
1842         esac
1843         case "$installusrbinperl" in
1844         '') installusrbinperl="$undef" ;;
1845         esac
1846         ;;
1847 esac
1848
1849 : general instructions
1850 needman=true
1851 firsttime=true
1852 user=`(logname) 2>/dev/null`
1853 case "$user" in
1854 '') user=`whoami 2>&1`;;
1855 esac
1856 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1857         firsttime=false
1858         echo " "
1859         rp='Would you like to see the instructions?'
1860         dflt=n
1861         . ./myread
1862         case "$ans" in
1863         [yY]*) ;;
1864         *) needman=false;;
1865         esac
1866 fi
1867 if $needman; then
1868         cat <<EOH
1869
1870 This installation shell script will examine your system and ask you questions
1871 to determine how the perl5 package should be installed. If you get
1872 stuck on a question, you may use a ! shell escape to start a subshell or
1873 execute a command.  Many of the questions will have default answers in square
1874 brackets; typing carriage return will give you the default.
1875
1876 On some of the questions which ask for file or directory names you are allowed
1877 to use the ~name construct to specify the login directory belonging to "name",
1878 even if you don't have a shell which knows about that.  Questions where this is
1879 allowed will be marked "(~name ok)".
1880
1881 EOH
1882         rp=''
1883         dflt='Type carriage return to continue'
1884         . ./myread
1885         cat <<'EOH'
1886
1887 The prompter used in this script allows you to use shell variables and
1888 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1889 in the default answer, as if the default line was a set of arguments given to a
1890 script shell.  This means you may also use $* to repeat the whole default line,
1891 so you do not have to re-type everything to add something to the default.
1892
1893 Everytime there is a substitution, you will have to confirm.  If there is an
1894 error (e.g. an unmatched backtick), the default answer will remain unchanged
1895 and you will be prompted again.
1896
1897 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1898 the questions and use the computed defaults (or the previous answers if there
1899 was already a config.sh file). Type 'Configure -h' for a list of options.
1900 You may also start interactively and then answer '& -d' at any prompt to turn
1901 on the non-interactive behaviour for the remainder of the execution.
1902
1903 EOH
1904         . ./myread
1905         cat <<EOH
1906
1907 Much effort has been expended to ensure that this shell script will run on any
1908 Unix system.  If despite that it blows up on yours, your best bet is to edit
1909 Configure and run it again.  If you can't run Configure for some reason,
1910 you'll have to generate a config.sh file by hand.  Whatever problems you
1911 have, let me (perlbug@perl.org) know how I blew it.
1912
1913 This installation script affects things in two ways:
1914
1915 1) it may do direct variable substitutions on some of the files included
1916    in this kit.
1917 2) it builds a config.h file for inclusion in C programs.  You may edit
1918    any of these files as the need arises after running this script.
1919
1920 If you make a mistake on a question, there is no easy way to back up to it
1921 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1922 files.  Configure will offer to let you do this before it runs the SH files.
1923
1924 EOH
1925         dflt='Type carriage return to continue'
1926         . ./myread
1927         case "$firsttime" in
1928         true) echo $user >>../.config/instruct;;
1929         esac
1930 fi
1931
1932 : find out where common programs are
1933 echo " "
1934 echo "Locating common programs..." >&4
1935 cat <<EOSC >loc
1936 $startsh
1937 case \$# in
1938 0) exit 1;;
1939 esac
1940 thing=\$1
1941 shift
1942 dflt=\$1
1943 shift
1944 for dir in \$*; do
1945         case "\$thing" in
1946         .)
1947         if test -d \$dir/\$thing; then
1948                 echo \$dir
1949                 exit 0
1950         fi
1951         ;;
1952         *)
1953         for thisthing in \$dir/\$thing; do
1954                 : just loop through to pick last item
1955         done
1956         if test -f \$thisthing; then
1957                 echo \$thisthing
1958                 exit 0
1959         elif test -f \$dir/\$thing.exe; then
1960                 if test -n "$DJGPP"; then
1961                         echo \$dir/\$thing.exe
1962                 else
1963                         : on Eunice apparently
1964                         echo \$dir/\$thing
1965                 fi
1966                 exit 0
1967         fi
1968         ;;
1969         esac
1970 done
1971 echo \$dflt
1972 exit 1
1973 EOSC
1974 chmod +x loc
1975 $eunicefix loc
1976 loclist="
1977 awk
1978 cat
1979 comm
1980 cp
1981 echo
1982 expr
1983 grep
1984 ls
1985 make
1986 mkdir
1987 rm
1988 sed
1989 sort
1990 touch
1991 tr
1992 uniq
1993 "
1994 trylist="
1995 Mcc
1996 ar
1997 bison
1998 byacc
1999 cpp
2000 csh
2001 date
2002 egrep
2003 gzip
2004 less
2005 ln
2006 more
2007 nm
2008 nroff
2009 pg
2010 test
2011 uname
2012 zip
2013 "
2014 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2015 pth="$pth /lib /usr/lib"
2016 for file in $loclist; do
2017         eval xxx=\$$file
2018         case "$xxx" in
2019         /*|?:[\\/]*)
2020                 if test -f "$xxx"; then
2021                         : ok
2022                 else
2023                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2024                         xxx=`./loc $file $file $pth`
2025                 fi
2026                 ;;
2027         '') xxx=`./loc $file $file $pth`;;
2028         *) xxx=`./loc $xxx $xxx $pth`;;
2029         esac
2030         eval $file=$xxx
2031         eval _$file=$xxx
2032         case "$xxx" in
2033         /*)
2034                 echo $file is in $xxx.
2035                 ;;
2036         ?:[\\/]*)
2037                 echo $file is in $xxx.
2038                 ;;
2039         *)
2040                 echo "I don't know where '$file' is, and my life depends on it." >&4
2041                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2042                 exit 1
2043                 ;;
2044         esac
2045 done
2046 echo " "
2047 echo "Don't worry if any of the following aren't found..."
2048 say=offhand
2049 for file in $trylist; do
2050         eval xxx=\$$file
2051         case "$xxx" in
2052         /*|?:[\\/]*)
2053                 if test -f "$xxx"; then
2054                         : ok
2055                 else
2056                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2057                         xxx=`./loc $file $file $pth`
2058                 fi
2059                 ;;
2060         '') xxx=`./loc $file $file $pth`;;
2061         *) xxx=`./loc $xxx $xxx $pth`;;
2062         esac
2063         eval $file=$xxx
2064         eval _$file=$xxx
2065         case "$xxx" in
2066         /*)
2067                 echo $file is in $xxx.
2068                 ;;
2069         ?:[\\/]*)
2070                 echo $file is in $xxx.
2071                 ;;
2072         *)
2073                 echo "I don't see $file out there, $say."
2074                 say=either
2075                 ;;
2076         esac
2077 done
2078 case "$egrep" in
2079 egrep)
2080         echo "Substituting grep for egrep."
2081         egrep=$grep
2082         ;;
2083 esac
2084 case "$ln" in
2085 ln)
2086         echo "Substituting cp for ln."
2087         ln=$cp
2088         ;;
2089 esac
2090 case "$test" in
2091 test)
2092         echo "Hopefully test is built into your sh."
2093         ;;
2094 *)
2095         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2096                 echo "Using the test built into your sh."
2097                 test=test
2098                 _test=test
2099         fi
2100         ;;
2101 esac
2102 case "$echo" in
2103 echo)
2104         echo "Hopefully echo is built into your sh."
2105         ;;
2106 '') ;;
2107 *)
2108         echo " "
2109 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2110         $echo $n "hi there$c" >foo1
2111         echo $n "hi there$c" >foo2
2112         if cmp foo1 foo2 >/dev/null 2>&1; then
2113                 echo "They are compatible.  In fact, they may be identical."
2114         else
2115                 case "$n" in
2116                 '-n') n='' c='\c';;
2117                 *) n='-n' c='';;
2118                 esac
2119                 cat <<FOO
2120 They are not compatible!  You are probably running ksh on a non-USG system.
2121 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2122 have echo built in and we may have to run some Bourne shell scripts.  That
2123 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2124
2125 FOO
2126                 $echo $n "The star should be here-->$c"
2127                 $echo "*"
2128         fi
2129         $rm -f foo1 foo2
2130         ;;
2131 esac
2132
2133 cat <<EOS >checkcc
2134 $startsh
2135 EOS
2136 cat <<'EOSC' >>checkcc
2137 case "$cc" in
2138 '') ;;
2139 *)  $rm -f try try.*
2140     $cat >try.c <<EOM
2141 int main(int argc, char *argv[]) {
2142   return 0;
2143 }
2144 EOM
2145     if $cc -o try $ccflags try.c; then
2146        :
2147     else
2148         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2149         despair=yes
2150         trygcc=yes
2151         case "$cc" in
2152         *gcc*) trygcc=no ;;
2153         esac
2154         case "`$cc -v -c try.c 2>&1`" in
2155         *gcc*) trygcc=no ;;
2156         esac
2157         if $test X"$trygcc" = Xyes; then
2158             if gcc -o try -c try.c; then
2159                 echo " "
2160                 echo "You seem to have a working gcc, though." >&4
2161                 rp="Would you like to use it?"
2162                 dflt=y
2163                 if $test -f myread; then
2164                     . ./myread
2165                 else
2166                     if $test -f UU/myread; then
2167                         . ./UU/myread
2168                     else
2169                         echo "Cannot find myread, sorry.  Aborting." >&2
2170                         exit 1
2171                     fi
2172                 fi  
2173                 case "$ans" in
2174                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2175                 esac
2176             fi
2177         fi
2178         if $test X"$despair" = Xyes; then
2179             $cat >&4 <<EOM
2180 You need to find a working C compiler.
2181 Either (purchase and) install the C compiler supplied by your OS vendor,
2182 or for a free C compiler try http://gcc.gnu.org/
2183 I cannot continue any further, aborting.
2184 EOM
2185             exit 1
2186         fi
2187     fi
2188     $rm -f try try.*
2189     ;;
2190 esac
2191 EOSC
2192
2193 : determine whether symbolic links are supported
2194 echo " "
2195 $touch blurfl
2196 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2197         echo "Symbolic links are supported." >&4
2198         lns="$ln -s"
2199 else
2200         echo "Symbolic links are NOT supported." >&4
2201         lns="$ln"
2202 fi
2203 $rm -f blurfl sym
2204
2205 : determine whether symbolic links are supported
2206 echo " "
2207 case "$lns" in
2208 *"ln -s")
2209         echo "Checking how to test for symbolic links..." >&4
2210         $lns blurfl sym
2211         if $test "X$issymlink" = X; then
2212                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2213                 if test $? = 0; then
2214                         issymlink="test -h"
2215                 fi              
2216         fi
2217         if $test "X$issymlink" = X; then
2218                 if  $test -h >/dev/null 2>&1; then
2219                         issymlink="$test -h"
2220                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2221                 fi              
2222         fi
2223         if $test "X$issymlink" = X; then
2224                 if $test -L sym 2>/dev/null; then
2225                         issymlink="$test -L"
2226                 fi
2227         fi
2228         if $test "X$issymlink" != X; then
2229                 echo "You can test for symbolic links with '$issymlink'." >&4
2230         else
2231                 echo "I do not know how you can test for symbolic links." >&4
2232         fi
2233         $rm -f blurfl sym
2234         ;;
2235 *)      echo "No symbolic links, so not testing for their testing..." >&4
2236         ;;
2237 esac
2238 echo " "
2239
2240
2241 case "$mksymlinks" in
2242 $define|true|[yY]*)
2243         case "$src" in
2244         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2245                 exit 1
2246                 ;;
2247         *)      case "$lns:$issymlink" in
2248                 *"ln -s:"*"test -"?)
2249                         echo "Creating the symbolic links..." >&4
2250                         echo "(First creating the subdirectories...)" >&4
2251                         cd ..
2252                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2253                                 read directory
2254                                 test -z "$directory" && break
2255                                 mkdir -p $directory
2256                         done
2257                         # Sanity check 1.
2258                         if test ! -d t/base; then
2259                                 echo "Failed to create the subdirectories.  Aborting." >&4
2260                                 exit 1
2261                         fi
2262                         echo "(Then creating the symlinks...)" >&4
2263                         awk '{print $1}' $src/MANIFEST | while true; do
2264                                 read filename
2265                                 test -z "$filename" && break
2266                                 if test -f $filename; then
2267                                         if $issymlink $filename; then
2268                                                 rm -f $filename
2269                                         fi
2270                                 fi
2271                                 if test -f $filename; then
2272                                         echo "$filename already exists, not symlinking."
2273                                 else
2274                                         ln -s $src/$filename $filename
2275                                 fi
2276                         done
2277                         # Sanity check 2.
2278                         if test ! -f t/base/commonsense.t; then
2279                                 echo "Failed to create the symlinks.  Aborting." >&4
2280                                 exit 1
2281                         fi
2282                         cd UU
2283                         ;;
2284                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2285                         ;;
2286                 esac
2287                 ;;
2288         esac
2289         ;;
2290 esac
2291
2292 : see whether [:lower:] and [:upper:] are supported character classes
2293 echo " "
2294 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2295 ABYZ)
2296         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2297         up='[:upper:]'
2298         low='[:lower:]'
2299         ;;
2300 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2301         # (0xc9 and 0xd1), therefore that is a nice testing point.
2302         if test "X$up" = X -o "X$low" = X; then
2303             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2304             ij) up='[A-Z]'
2305                 low='[a-z]'
2306                 ;;
2307             esac
2308         fi
2309         if test "X$up" = X -o "X$low" = X; then
2310             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2311             ij) up='A-Z'
2312                 low='a-z'
2313                 ;;
2314             esac
2315         fi
2316         if test "X$up" = X -o "X$low" = X; then
2317             case "`echo IJ | od -x 2>/dev/null`" in
2318             *C9D1*|*c9d1*)
2319                 echo "Hey, this might be EBCDIC." >&4
2320                 if test "X$up" = X -o "X$low" = X; then
2321                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2322                     ij) up='[A-IJ-RS-Z]'
2323                         low='[a-ij-rs-z]'
2324                         ;;
2325                     esac
2326                 fi
2327                 if test "X$up" = X -o "X$low" = X; then
2328                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2329                     ij) up='A-IJ-RS-Z'
2330                         low='a-ij-rs-z'
2331                         ;;
2332                     esac
2333                 fi
2334                 ;;
2335             esac
2336         fi
2337 esac
2338 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2339 ij)
2340     echo "Using $up and $low to convert case." >&4
2341     ;;
2342 *)
2343     echo "I don't know how to translate letters from upper to lower case." >&4
2344     echo "Your tr is not acting any way I know of." >&4
2345     exit 1
2346     ;;
2347 esac
2348 : set up the translation script tr, must be called with ./tr of course
2349 cat >tr <<EOSC
2350 $startsh
2351 case "\$1\$2" in
2352 '[A-Z][a-z]') exec $tr '$up' '$low';;
2353 '[a-z][A-Z]') exec $tr '$low' '$up';;
2354 esac
2355 exec $tr "\$@"
2356 EOSC
2357 chmod +x tr
2358 $eunicefix tr
2359
2360 : Try to determine whether config.sh was made on this system
2361 case "$config_sh" in
2362 '')
2363 myuname=`$uname -a 2>/dev/null`
2364 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2365 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2366 # because the A-Z/a-z are not consecutive.
2367 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2368         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2369 newmyuname="$myuname"
2370 dflt=n
2371 case "$knowitall" in
2372 '')
2373         if test -f ../config.sh; then
2374                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2375                         eval "`grep myuname= ../config.sh`"
2376                 fi
2377                 if test "X$myuname" = "X$newmyuname"; then
2378                         dflt=y
2379                 fi
2380         fi
2381         ;;
2382 *) dflt=y;;
2383 esac
2384
2385 : Get old answers from old config file if Configure was run on the
2386 : same system, otherwise use the hints.
2387 hint=default
2388 cd ..
2389 if test -f config.sh; then
2390         echo " "
2391         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2392         . UU/myread
2393         case "$ans" in
2394         n*|N*) echo "OK, I'll ignore it."
2395                 mv config.sh config.sh.old
2396                 myuname="$newmyuname"
2397                 ;;
2398         *)  echo "Fetching default answers from your old config.sh file..." >&4
2399                 tmp_n="$n"
2400                 tmp_c="$c"
2401                 tmp_sh="$sh"
2402                 . ./config.sh
2403                 cp config.sh UU
2404                 n="$tmp_n"
2405                 c="$tmp_c"
2406                 : Older versions did not always set $sh.  Catch re-use of such
2407                 : an old config.sh.
2408                 case "$sh" in
2409                 '') sh="$tmp_sh" ;;
2410                 esac
2411                 hint=previous
2412                 ;;
2413         esac
2414 fi
2415 . ./UU/checkcc
2416 if test ! -f config.sh; then
2417         $cat <<EOM
2418
2419 First time through, eh?  I have some defaults handy for some systems
2420 that need some extra help getting the Configure answers right:
2421
2422 EOM
2423         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2424         dflt=''
2425         : Half the following guesses are probably wrong... If you have better
2426         : tests or hints, please send them to perlbug@perl.org
2427         : The metaconfig authors would also appreciate a copy...
2428         $test -f /irix && osname=irix
2429         $test -f /xenix && osname=sco_xenix
2430         $test -f /dynix && osname=dynix
2431         $test -f /dnix && osname=dnix
2432         $test -f /lynx.os && osname=lynxos
2433         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2434         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2435         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2436         $test -f /bin/mips && /bin/mips && osname=mips
2437         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2438                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2439         $test -d /usr/apollo/bin && osname=apollo
2440         $test -f /etc/saf/_sactab && osname=svr4
2441         $test -d /usr/include/minix && osname=minix
2442         if $test -d /MachTen -o -d /MachTen_Folder; then
2443                 osname=machten
2444                 if $test -x /sbin/version; then
2445                         osvers=`/sbin/version | $awk '{print $2}' |
2446                         $sed -e 's/[A-Za-z]$//'`
2447                 elif $test -x /usr/etc/version; then
2448                         osvers=`/usr/etc/version | $awk '{print $2}' |
2449                         $sed -e 's/[A-Za-z]$//'`
2450                 else
2451                         osvers="$2.$3"
2452                 fi
2453         fi
2454
2455         $test -f /sys/posix.dll &&
2456                 $test -f /usr/bin/what &&
2457                 set X `/usr/bin/what /sys/posix.dll` &&
2458                 $test "$3" = UWIN &&
2459                 osname=uwin &&
2460                 osvers="$5"
2461
2462         if $test -f $uname; then
2463                 set X $myuname
2464                 shift
2465
2466                 case "$5" in
2467                 fps*) osname=fps ;;
2468                 mips*)
2469                         case "$4" in
2470                         umips) osname=umips ;;
2471                         *) osname=mips ;;
2472                         esac;;
2473                 [23]100) osname=mips ;;
2474                 next*) osname=next ;;
2475                 i386*)
2476                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2477                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2478                                 osname='sco'
2479                                 osvers=$tmp
2480                         elif $test -f /etc/kconfig; then
2481                                 osname=isc
2482                                 if test "$lns" = "$ln -s"; then
2483                                         osvers=4
2484                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2485                                         osvers=3
2486                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2487                                         osvers=2
2488                                 fi
2489                         fi
2490                         tmp=''
2491                         ;;
2492                 pc*)
2493                         if test -n "$DJGPP"; then
2494                                 osname=dos
2495                                 osvers=djgpp
2496                         fi
2497                         ;;
2498                 esac
2499
2500                 case "$1" in
2501                 aix) osname=aix
2502                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2503                         case "$tmp" in
2504                         'not found') osvers="$4"."$3" ;;
2505                         '<3240'|'<>3240') osvers=3.2.0 ;;
2506                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2507                         '=3250'|'>3250') osvers=3.2.5 ;;
2508                         *) osvers=$tmp;;
2509                         esac
2510                         ;;
2511                 bsd386) osname=bsd386
2512                         osvers=`$uname -r`
2513                         ;;
2514                 cygwin*) osname=cygwin
2515                         osvers="$3"
2516                         ;;
2517                 *dc.osx) osname=dcosx
2518                         osvers="$3"
2519                         ;;
2520                 dnix) osname=dnix
2521                         osvers="$3"
2522                         ;;
2523                 domainos) osname=apollo
2524                         osvers="$3"
2525                         ;;
2526                 dgux) osname=dgux 
2527                         osvers="$3"
2528                         ;;
2529                 dynixptx*) osname=dynixptx
2530                         osvers=`echo "$4"|sed 's/^v//'`
2531                         ;;
2532                 freebsd) osname=freebsd 
2533                         osvers="$3" ;;
2534                 genix) osname=genix ;;
2535                 hp*) osname=hpux 
2536                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2537                         ;;
2538                 irix*) osname=irix
2539                         case "$3" in
2540                         4*) osvers=4 ;;
2541                         5*) osvers=5 ;;
2542                         *)      osvers="$3" ;;
2543                         esac
2544                         ;;
2545                 linux) osname=linux
2546                         case "$3" in
2547                         *)      osvers="$3" ;;
2548                         esac
2549                         ;;
2550                 MiNT) osname=mint
2551                         ;;
2552                 netbsd*) osname=netbsd
2553                         osvers="$3"
2554                         ;;
2555                 news-os) osvers="$3"
2556                         case "$3" in
2557                         4*) osname=newsos4 ;;
2558                         *) osname=newsos ;;
2559                         esac
2560                         ;;
2561                 next*) osname=next ;;
2562                 nonstop-ux) osname=nonstopux ;;
2563                 POSIX-BC | posix-bc ) osname=posix-bc
2564                         osvers="$3"
2565                         ;;
2566                 powerux | power_ux | powermax_os | powermaxos | \
2567                 powerunix | power_unix) osname=powerux
2568                         osvers="$3"
2569                         ;;
2570                 qnx) osname=qnx
2571                         osvers="$4"
2572                         ;;
2573                 solaris) osname=solaris
2574                         case "$3" in
2575                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2576                         *)      osvers="$3" ;;
2577                         esac
2578                         ;;
2579                 sunos) osname=sunos
2580                         case "$3" in
2581                         5*) osname=solaris
2582                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2583                         *)      osvers="$3" ;;
2584                         esac
2585                         ;;
2586                 titanos) osname=titanos
2587                         case "$3" in
2588                         1*) osvers=1 ;;
2589                         2*) osvers=2 ;;
2590                         3*) osvers=3 ;;
2591                         4*) osvers=4 ;;
2592                         *)      osvers="$3" ;;
2593                         esac
2594                         ;;
2595                 ultrix) osname=ultrix
2596                         osvers="$3"
2597                         ;;
2598                 osf1|mls+)      case "$5" in
2599                                 alpha)
2600                                         osname=dec_osf
2601                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2602                                         case "$osvers" in
2603                                         [1-9].[0-9]*) ;;
2604                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2605                                         esac
2606                                         ;;
2607                         hp*)    osname=hp_osf1  ;;
2608                         mips)   osname=mips_osf1 ;;
2609                         esac
2610                         ;;
2611                 unixware) osname=svr5
2612                         osvers="$4"
2613                         ;;
2614                 uts) osname=uts
2615                         osvers="$3"
2616                         ;;
2617                 $2) case "$osname" in
2618                         *isc*) ;;
2619                         *freebsd*) ;;
2620                         svr*)
2621                                 : svr4.x or possibly later
2622                                 case "svr$3" in 
2623                                 ${osname}*)
2624                                         osname=svr$3
2625                                         osvers=$4
2626                                         ;;
2627                                 esac
2628                                 case "$osname" in
2629                                 svr4.0)
2630                                         : Check for ESIX
2631                                         if test -f /stand/boot ; then
2632                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2633                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2634                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2635                                                         if test -n "$isesix"; then
2636                                                                 osname=esix4
2637                                                         fi
2638                                                 fi
2639                                         fi
2640                                         ;;
2641                                 esac
2642                                 ;;
2643                         *)      if test -f /etc/systemid; then
2644                                         osname=sco
2645                                         set `echo $3 | $sed 's/\./ /g'` $4
2646                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2647                                                 osvers=$1.$2.$3
2648                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2649                                                 osvers=$1.$2
2650                                         elif $test -f $src/hints/sco_$1.sh; then
2651                                                 osvers=$1
2652                                         fi
2653                                 else
2654                                         case "$osname" in
2655                                         '') : Still unknown.  Probably a generic Sys V.
2656                                                 osname="sysv"
2657                                                 osvers="$3"
2658                                                 ;;
2659                                         esac
2660                                 fi
2661                                 ;;
2662                         esac
2663                         ;;
2664                 *)      case "$osname" in
2665                         '') : Still unknown.  Probably a generic BSD.
2666                                 osname="$1"
2667                                 osvers="$3"
2668                                 ;;
2669                         esac
2670                         ;;
2671                 esac
2672         else
2673                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2674                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2675                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2676                                 osname=news_os
2677                         fi
2678                         $rm -f UU/kernel.what
2679                 elif test -d c:/.; then
2680                         set X $myuname
2681                         osname=os2
2682                         osvers="$5"
2683                 fi
2684         fi
2685         
2686         : Now look for a hint file osname_osvers, unless one has been
2687         : specified already.
2688         case "$hintfile" in
2689         ''|' ')
2690                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2691                 : Also try without trailing minor version numbers.
2692                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2693                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2694                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2695                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2696                 case "$file" in
2697                 '') dflt=none ;;
2698                 *)  case "$osvers" in
2699                         '') dflt=$file
2700                                 ;;
2701                         *)  if $test -f $src/hints/$file.sh ; then
2702                                         dflt=$file
2703                                 elif $test -f $src/hints/$xfile.sh ; then
2704                                         dflt=$xfile
2705                                 elif $test -f $src/hints/$xxfile.sh ; then
2706                                         dflt=$xxfile
2707                                 elif $test -f $src/hints/$xxxfile.sh ; then
2708                                         dflt=$xxxfile
2709                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2710                                         dflt=$xxxxfile
2711                                 elif $test -f "$src/hints/${osname}.sh" ; then
2712                                         dflt="${osname}"
2713                                 else
2714                                         dflt=none
2715                                 fi
2716                                 ;;
2717                         esac
2718                         ;;
2719                 esac
2720                 if $test -f Policy.sh ; then
2721                         case "$dflt" in
2722                         *Policy*) ;;
2723                         none) dflt="Policy" ;;
2724                         *) dflt="Policy $dflt" ;;
2725                         esac
2726                 fi
2727                 ;;
2728         *)
2729                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2730                 ;;
2731         esac
2732
2733         if $test -f Policy.sh ; then
2734                 $cat <<EOM
2735
2736 There's also a Policy hint file available, which should make the
2737 site-specific (policy) questions easier to answer.
2738 EOM
2739
2740         fi
2741
2742         $cat <<EOM
2743
2744 You may give one or more space-separated answers, or "none" if appropriate.
2745 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2746 is a good thing.  DO NOT give a wrong version or a wrong OS.
2747
2748 EOM
2749
2750         rp="Which of these apply, if any?"
2751         . UU/myread
2752         tans=$ans
2753         for file in $tans; do
2754                 if $test X$file = XPolicy -a -f Policy.sh; then
2755                         . Policy.sh
2756                         $cat Policy.sh >> UU/config.sh
2757                 elif $test -f $src/hints/$file.sh; then
2758                         . $src/hints/$file.sh
2759                         $cat $src/hints/$file.sh >> UU/config.sh
2760                 elif $test X$tans = X -o X$tans = Xnone ; then
2761                         : nothing
2762                 else
2763                         : Give one chance to correct a possible typo.
2764                         echo "$file.sh does not exist"
2765                         dflt=$file
2766                         rp="hint to use instead?"
2767                         . UU/myread
2768                         for file in $ans; do
2769                                 if $test -f "$src/hints/$file.sh"; then
2770                                         . $src/hints/$file.sh
2771                                         $cat $src/hints/$file.sh >> UU/config.sh
2772                                 elif $test X$ans = X -o X$ans = Xnone ; then
2773                                         : nothing
2774                                 else
2775                                         echo "$file.sh does not exist -- ignored."
2776                                 fi
2777                         done
2778                 fi
2779         done
2780
2781         hint=recommended
2782         : Remember our hint file for later.
2783         if $test -f "$src/hints/$file.sh" ; then
2784                 hintfile="$file"
2785         else
2786                 hintfile=''
2787         fi
2788 fi
2789 cd UU
2790 ;;
2791 *)
2792         echo " "
2793         echo "Fetching default answers from $config_sh..." >&4
2794         tmp_n="$n"
2795         tmp_c="$c"
2796         cd ..
2797         cp $config_sh config.sh 2>/dev/null
2798         chmod +w config.sh
2799         . ./config.sh
2800         cd UU
2801         cp ../config.sh .
2802         n="$tmp_n"
2803         c="$tmp_c"
2804         hint=previous
2805         ;;
2806 esac
2807 test "$override" && . ./optdef.sh
2808
2809 : Restore computed paths
2810 for file in $loclist $trylist; do
2811         eval $file="\$_$file"
2812 done
2813
2814 cat << EOM
2815
2816 Configure uses the operating system name and version to set some defaults.
2817 The default value is probably right if the name rings a bell. Otherwise,
2818 since spelling matters for me, either accept the default or answer "none"
2819 to leave it blank.
2820
2821 EOM
2822 case "$osname" in
2823         ''|' ')
2824                 case "$hintfile" in
2825                 ''|' '|none) dflt=none ;;
2826                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2827                 esac
2828                 ;;
2829         *) dflt="$osname" ;;
2830 esac
2831 rp="Operating system name?"
2832 . ./myread
2833 case "$ans" in
2834 none)  osname='' ;;
2835 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2836 esac
2837 echo " "
2838 case "$osvers" in
2839         ''|' ')
2840                 case "$hintfile" in
2841                 ''|' '|none) dflt=none ;;
2842                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2843                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2844                         case "$dflt" in
2845                         ''|' ') dflt=none ;;
2846                         esac
2847                         ;;
2848                 esac
2849                 ;;
2850         *) dflt="$osvers" ;;
2851 esac
2852 rp="Operating system version?"
2853 . ./myread
2854 case "$ans" in
2855 none)  osvers='' ;;
2856 *) osvers="$ans" ;;
2857 esac
2858
2859
2860 . ./posthint.sh
2861
2862 : who configured the system
2863 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2864 cf_by=`(logname) 2>/dev/null`
2865 case "$cf_by" in
2866 "")
2867         cf_by=`(whoami) 2>/dev/null`
2868         case "$cf_by" in
2869         "") cf_by=unknown ;;
2870         esac ;;
2871 esac
2872
2873 : set up the script used to warn in case of inconsistency
2874 cat <<EOS >whoa
2875 $startsh
2876 EOS
2877 cat <<'EOSC' >>whoa
2878 dflt=y
2879 echo " "
2880 echo "*** WHOA THERE!!! ***" >&4
2881 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2882 rp="    Keep the $hint value?"
2883 . ./myread
2884 case "$ans" in
2885 y) td=$was; tu=$was;;
2886 esac
2887 EOSC
2888
2889 : function used to set $1 to $val
2890 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2891 case "$val$was" in
2892 $define$undef) . ./whoa; eval "$var=\$td";;
2893 $undef$define) . ./whoa; eval "$var=\$tu";;
2894 *) eval "$var=$val";;
2895 esac'
2896
2897 case "$usethreads" in
2898 $define|true|[yY]*)     dflt='y';;
2899 *) dflt='n';;
2900 esac
2901 cat <<EOM
2902
2903 Perl can be built to take advantage of threads on some systems.
2904 To do so, Configure can be run with -Dusethreads.
2905
2906 Note that threading is a highly experimental feature, and
2907 some known race conditions still remain.  If you choose to try
2908 it, be very sure to not actually deploy it for production
2909 purposes.  README.threads has more details, and is required
2910 reading if you enable threads.
2911
2912 If this doesn't make any sense to you, just accept the default '$dflt'.
2913 EOM
2914 rp='Build a threading Perl?'
2915 . ./myread
2916 case "$ans" in
2917 y|Y)    val="$define" ;;
2918 *)      val="$undef" ;;
2919 esac
2920 set usethreads
2921 eval $setvar
2922
2923 case "$usethreads" in
2924 $define)
2925         $cat <<EOM
2926
2927 As of 5.5.640, Perl has two different internal threading implementations,
2928 the 5.005 version (5005threads) and an interpreter-based version
2929 (ithreads) that has one interpreter per thread.  Both are very 
2930 experimental.  This arrangement exists to help developers work out
2931 which one is better.
2932
2933 If you're a casual user, you probably don't want interpreter-threads
2934 at this time.  There doesn't yet exist a way to create threads from
2935 within Perl in this model, i.e., "use Thread;" will NOT work.
2936 EOM
2937         : Default to ithreads unless overridden on command line or with
2938         : old config.sh
2939         dflt='y'
2940         case "$use5005threads" in
2941                 $define|true|[yY]*) dflt='n';;
2942         esac
2943         case "$useithreads" in
2944                 $undef|false|[nN]*) dflt='n';;
2945         esac
2946         rp='Use interpreter-based ithreads?'
2947         . ./myread
2948         case "$ans" in
2949         y|Y)    val="$define" ;;
2950         *)      val="$undef" ;;
2951         esac
2952         set useithreads
2953         eval $setvar
2954         : Now set use5005threads to the opposite value.
2955         case "$useithreads" in
2956         $define) val="$undef" ;;
2957         *) val="$define" ;;
2958         esac
2959         set use5005threads
2960         eval $setvar
2961         ;;
2962 *)
2963         useithreads="$undef"
2964         use5005threads="$undef"
2965         ;;
2966 esac
2967
2968 case "$useithreads$use5005threads" in
2969 "$define$define")
2970         $cat >&4 <<EOM
2971
2972 You cannot have both the ithreads and the 5.005 threads enabled
2973 at the same time.  Disabling the 5.005 threads since they are
2974 much less stable than the ithreads.
2975
2976 EOM
2977         use5005threads="$undef"
2978         ;;
2979 esac
2980
2981 case "$d_oldpthreads" in
2982 '')     : Configure tests would be welcome here.  For now, assume undef.
2983         val="$undef" ;;
2984 *)      val="$d_oldpthreads" ;;
2985 esac
2986 set d_oldpthreads
2987 eval $setvar
2988
2989
2990 case "$usethreads" in
2991 "$define"|true|[yY]*)
2992 : Look for a hint-file generated 'call-back-unit'.  If the
2993 : user has specified that a threading perl is to be built,
2994 : we may need to set or change some other defaults.
2995         if $test -f usethreads.cbu; then
2996                 echo "Your platform has some specific hints for threaded builds, using them..."
2997                 . ./usethreads.cbu
2998         else
2999                 $cat <<EOM
3000 (Your platform doesn't have any specific hints for threaded builds.
3001  Assuming POSIX threads, then.)
3002 EOM
3003         fi
3004         ;;
3005 esac
3006
3007 cat <<EOM
3008
3009 Perl can be built so that multiple Perl interpreters can coexist
3010 within the same Perl executable.
3011 EOM
3012
3013 case "$useithreads" in
3014 $define)
3015         cat <<EOM
3016 This multiple interpreter support is required for interpreter-based threads.
3017 EOM
3018         val="$define"
3019         ;;
3020 *)      case "$usemultiplicity" in
3021         $define|true|[yY]*)     dflt='y';;
3022         *) dflt='n';;
3023         esac
3024         echo " "
3025         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3026         rp='Build Perl for multiplicity?'
3027         . ./myread
3028         case "$ans" in
3029         y|Y)    val="$define" ;;
3030         *)      val="$undef" ;;
3031         esac
3032         ;;
3033 esac
3034 set usemultiplicity
3035 eval $setvar
3036
3037 : make some quick guesses about what we are up against
3038 echo " "
3039 $echo $n "Hmm...  $c"
3040 echo exit 1 >bsd
3041 echo exit 1 >usg
3042 echo exit 1 >v7
3043 echo exit 1 >osf1
3044 echo exit 1 >eunice
3045 echo exit 1 >xenix
3046 echo exit 1 >venix
3047 echo exit 1 >os2
3048 d_bsd="$undef"
3049 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3050 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3051 then
3052         echo "Looks kind of like an OSF/1 system, but we'll see..."
3053         echo exit 0 >osf1
3054 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3055         xxx=`./loc addbib blurfl $pth`
3056         if $test -f $xxx; then
3057         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3058                 echo exit 0 >bsd
3059                 echo exit 0 >usg
3060         else
3061                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3062                         echo "Looks kind of like an extended USG system, but we'll see..."
3063                 else
3064                         echo "Looks kind of like a USG system, but we'll see..."
3065                 fi
3066                 echo exit 0 >usg
3067         fi
3068 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3069         echo "Looks kind of like a BSD system, but we'll see..."
3070         d_bsd="$define"
3071         echo exit 0 >bsd
3072 else
3073         echo "Looks kind of like a Version 7 system, but we'll see..."
3074         echo exit 0 >v7
3075 fi
3076 case "$eunicefix" in
3077 *unixtovms*)
3078         $cat <<'EOI'
3079 There is, however, a strange, musty smell in the air that reminds me of
3080 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3081 EOI
3082         echo exit 0 >eunice
3083         d_eunice="$define"
3084 : it so happens the Eunice I know will not run shell scripts in Unix format
3085         ;;
3086 *)
3087         echo " "
3088         echo "Congratulations.  You aren't running Eunice."
3089         d_eunice="$undef"
3090         ;;
3091 esac
3092 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3093 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3094 : semicolon as a patch separator
3095 case "$p_" in
3096 :) ;;
3097 *)
3098         $cat <<'EOI'
3099 I have the feeling something is not exactly right, however...don't tell me...
3100 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3101 (Or you may be running DOS with DJGPP.)
3102 EOI
3103         echo exit 0 >os2
3104         ;;
3105 esac
3106 if test -f /xenix; then
3107         echo "Actually, this looks more like a XENIX system..."
3108         echo exit 0 >xenix
3109         d_xenix="$define"
3110 else
3111         echo " "
3112         echo "It's not Xenix..."
3113         d_xenix="$undef"
3114 fi
3115 chmod +x xenix
3116 $eunicefix xenix
3117 if test -f /venix; then
3118         echo "Actually, this looks more like a VENIX system..."
3119         echo exit 0 >venix
3120 else
3121         echo " "
3122         if ./xenix; then
3123                 : null
3124         else
3125                 echo "Nor is it Venix..."
3126         fi
3127 fi
3128 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3129 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3130 $rm -f foo
3131
3132 case "$cc" in
3133 '') dflt=cc;;
3134 *) dflt="$cc";;
3135 esac
3136 rp="Use which C compiler?"
3137 . ./myread
3138 cc="$ans"
3139 : Look for a hint-file generated 'call-back-unit'.  Now that the
3140 : user has specified the compiler, we may need to set or change some
3141 : other defaults.
3142 if $test -f cc.cbu; then
3143     . ./cc.cbu
3144 fi
3145 . ./checkcc
3146
3147 echo " "
3148 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3149 $cat >gccvers.c <<EOM
3150 #include <stdio.h>
3151 int main() {
3152 #ifdef __GNUC__
3153 #ifdef __VERSION__
3154         printf("%s\n", __VERSION__);
3155 #else
3156         printf("%s\n", "1");
3157 #endif
3158 #endif
3159         exit(0);
3160 }
3161 EOM
3162 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3163         gccversion=`./gccvers`
3164         case "$gccversion" in
3165         '') echo "You are not using GNU cc." ;;
3166         *)  echo "You are using GNU cc $gccversion."
3167             ccname=gcc  
3168             ;;
3169         esac
3170 else
3171         echo " "
3172         echo "*** WHOA THERE!!! ***" >&4
3173         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3174         case "$knowitall" in
3175         '')
3176         echo "    You'd better start hunting for one and let me know about it." >&4
3177                 exit 1
3178                 ;;
3179         esac
3180 fi
3181 $rm -f gccvers*
3182 case "$gccversion" in
3183 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3184 esac
3185 case "$gccversion" in
3186 '') gccosandvers='' ;;
3187 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3188    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3189    gccshortvers=''
3190    case "$gccosandvers" in
3191    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3192    $osname$osvers) ;; # looking good
3193    $osname*) cat <<EOM >&4
3194
3195 *** WHOA THERE!!! ***
3196
3197     Your gcc has not been compiled for the exact release of
3198     your operating system ($gccosandvers versus $osname$osvers).
3199
3200     In general it is a good idea to keep gcc synchronized with
3201     the operating system because otherwise serious problems
3202     may ensue when trying to compile software, like Perl.
3203
3204     I'm trying to be optimistic here, though, and will continue.
3205     If later during the configuration and build icky compilation
3206     problems appear (headerfile conflicts being the most common
3207     manifestation), I suggest reinstalling the gcc to match
3208     your operating system release.
3209
3210 EOM
3211       ;;
3212    *) gccosandvers='' ;; # failed to parse, better be silent
3213    esac
3214    ;;
3215 esac
3216 case "$ccname" in
3217 '') ccname="$cc" ;;
3218 esac
3219
3220 : see how we invoke the C preprocessor
3221 echo " "
3222 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3223 cat <<'EOT' >testcpp.c
3224 #define ABC abc
3225 #define XYZ xyz
3226 ABC.XYZ
3227 EOT
3228 cd ..
3229 if test ! -f cppstdin; then
3230         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3231                 # AIX cc -E doesn't show the absolute headerfile
3232                 # locations but we'll cheat by using the -M flag.
3233                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3234         else
3235                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3236         fi
3237 else
3238         echo "Keeping your $hint cppstdin wrapper."
3239 fi
3240 chmod 755 cppstdin
3241 wrapper=`pwd`/cppstdin
3242 ok='false'
3243 cd UU
3244
3245 if $test "X$cppstdin" != "X" && \
3246         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3247         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3248 then
3249         echo "You used to use $cppstdin $cppminus so we'll use that again."
3250         case "$cpprun" in
3251         '') echo "But let's see if we can live without a wrapper..." ;;
3252         *)
3253                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3254                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3255                 then
3256                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3257                         ok='true'
3258                 else
3259                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3260                 fi
3261                 ;;
3262         esac
3263 else
3264         case "$cppstdin" in
3265         '') ;;
3266         *)
3267                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3268                 ;;
3269         esac
3270 fi
3271
3272 if $ok; then
3273         : nothing
3274 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3275         $cc -E <testcpp.c >testcpp.out 2>&1; \
3276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3277         echo "Yup, it does."
3278         x_cpp="$cc -E"
3279         x_minus='';
3280 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3281         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3283         echo "Yup, it does."
3284         x_cpp="$cc -E"
3285         x_minus='-';
3286 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3287         $cc -P <testcpp.c >testcpp.out 2>&1; \
3288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3289         echo "Yipee, that works!"
3290         x_cpp="$cc -P"
3291         x_minus='';
3292 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3293         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3294         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3295         echo "At long last!"
3296         x_cpp="$cc -P"
3297         x_minus='-';
3298 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3299         $cpp <testcpp.c >testcpp.out 2>&1; \
3300         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3301         echo "It works!"
3302         x_cpp="$cpp"
3303         x_minus='';
3304 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3305         $cpp - <testcpp.c >testcpp.out 2>&1; \
3306         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3307         echo "Hooray, it works!  I was beginning to wonder."
3308         x_cpp="$cpp"
3309         x_minus='-';
3310 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3311         $wrapper <testcpp.c >testcpp.out 2>&1; \
3312         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3313         x_cpp="$wrapper"
3314         x_minus=''
3315         echo "Eureka!"
3316 else
3317         dflt=''
3318         rp="No dice.  I can't find a C preprocessor.  Name one:"
3319         . ./myread
3320         x_cpp="$ans"
3321         x_minus=''
3322         $x_cpp <testcpp.c >testcpp.out 2>&1
3323         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324                 echo "OK, that will do." >&4
3325         else
3326 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3327                 exit 1
3328         fi
3329 fi
3330
3331 case "$ok" in
3332 false)
3333         cppstdin="$x_cpp"
3334         cppminus="$x_minus"
3335         cpprun="$x_cpp"
3336         cpplast="$x_minus"
3337         set X $x_cpp
3338         shift
3339         case "$1" in
3340         "$cpp")
3341                 echo "Perhaps can we force $cc -E using a wrapper..."
3342                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3343                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3344                 then
3345                         echo "Yup, we can."
3346                         cppstdin="$wrapper"
3347                         cppminus='';
3348                 else
3349                         echo "Nope, we'll have to live without it..."
3350                 fi
3351                 ;;
3352         esac
3353         case "$cpprun" in
3354         "$wrapper")
3355                 cpprun=''
3356                 cpplast=''
3357                 ;;
3358         esac
3359         ;;
3360 esac
3361
3362 case "$cppstdin" in
3363 "$wrapper"|'cppstdin') ;;
3364 *) $rm -f $wrapper;;
3365 esac
3366 $rm -f testcpp.c testcpp.out
3367
3368 : decide how portable to be.  Allow command line overrides.
3369 case "$d_portable" in
3370 "$undef") ;;
3371 *)      d_portable="$define" ;;
3372 esac
3373
3374 : set up shell script to do ~ expansion
3375 cat >filexp <<EOSS
3376 $startsh
3377 : expand filename
3378 case "\$1" in
3379  ~/*|~)
3380         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3381         ;;
3382  ~*)
3383         if $test -f /bin/csh; then
3384                 /bin/csh -f -c "glob \$1"
3385                 failed=\$?
3386                 echo ""
3387                 exit \$failed
3388         else
3389                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3390                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3391                 if $test ! -d "\$dir"; then
3392                         me=\`basename \$0\`
3393                         echo "\$me: can't locate home directory for: \$name" >&2
3394                         exit 1
3395                 fi
3396                 case "\$1" in
3397                 */*)
3398                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3399                         ;;
3400                 *)
3401                         echo \$dir
3402                         ;;
3403                 esac
3404         fi
3405         ;;
3406 *)
3407         echo \$1
3408         ;;
3409 esac
3410 EOSS
3411 chmod +x filexp
3412 $eunicefix filexp
3413
3414 : now set up to get a file name
3415 cat <<EOS >getfile
3416 $startsh
3417 EOS
3418 cat <<'EOSC' >>getfile
3419 tilde=''
3420 fullpath=''
3421 already=''
3422 skip=''
3423 none_ok=''
3424 exp_file=''
3425 nopath_ok=''
3426 orig_rp="$rp"
3427 orig_dflt="$dflt"
3428 case "$gfpth" in
3429 '') gfpth='.' ;;
3430 esac
3431
3432 case "$fn" in
3433 *\(*)
3434         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3435         fn=`echo $fn | sed 's/(.*)//'`
3436         ;;
3437 esac
3438
3439 case "$fn" in
3440 *:*)
3441         loc_file=`expr $fn : '.*:\(.*\)'`
3442         fn=`expr $fn : '\(.*\):.*'`
3443         ;;
3444 esac
3445
3446 case "$fn" in
3447 *~*) tilde=true;;
3448 esac
3449 case "$fn" in
3450 */*) fullpath=true;;
3451 esac
3452 case "$fn" in
3453 *+*) skip=true;;
3454 esac
3455 case "$fn" in
3456 *n*) none_ok=true;;
3457 esac
3458 case "$fn" in
3459 *e*) exp_file=true;;
3460 esac
3461 case "$fn" in
3462 *p*) nopath_ok=true;;
3463 esac
3464
3465 case "$fn" in
3466 *f*) type='File';;
3467 *d*) type='Directory';;
3468 *l*) type='Locate';;
3469 esac
3470
3471 what="$type"
3472 case "$what" in
3473 Locate) what='File';;
3474 esac
3475
3476 case "$exp_file" in
3477 '')
3478         case "$d_portable" in
3479         "$define") ;;
3480         *) exp_file=true;;
3481         esac
3482         ;;
3483 esac
3484
3485 cd ..
3486 while test "$type"; do
3487         redo=''
3488         rp="$orig_rp"
3489         dflt="$orig_dflt"
3490         case "$tilde" in
3491         true) rp="$rp (~name ok)";;
3492         esac
3493         . UU/myread
3494         if test -f UU/getfile.ok && \
3495                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3496         then
3497                 value="$ans"
3498                 ansexp="$ans"
3499                 break
3500         fi
3501         case "$ans" in
3502         none)
3503                 value=''
3504                 ansexp=''
3505                 case "$none_ok" in
3506                 true) type='';;
3507                 esac
3508                 ;;
3509         *)
3510                 case "$tilde" in
3511                 '') value="$ans"
3512                         ansexp="$ans";;
3513                 *)
3514                         value=`UU/filexp $ans`
3515                         case $? in
3516                         0)
3517                                 if test "$ans" != "$value"; then
3518                                         echo "(That expands to $value on this system.)"
3519                                 fi
3520                                 ;;
3521                         *) value="$ans";;
3522                         esac
3523                         ansexp="$value"
3524                         case "$exp_file" in
3525                         '') value="$ans";;
3526                         esac
3527                         ;;
3528                 esac
3529                 case "$fullpath" in
3530                 true)
3531                         case "$ansexp" in
3532                         /*) value="$ansexp" ;;
3533                         [a-zA-Z]:/*) value="$ansexp" ;;
3534                         *)
3535                                 redo=true
3536                                 case "$already" in
3537                                 true)
3538                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3539                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3540                                         ;;
3541                                 *)
3542                                 echo "Please give a full path name, starting with slash." >&4
3543                                         case "$tilde" in
3544                                         true)
3545                                 echo "Note that using ~name is ok provided it expands well." >&4
3546                                                 already=true
3547                                                 ;;
3548                                         esac
3549                                 esac
3550                                 ;;
3551                         esac
3552                         ;;
3553                 esac
3554                 case "$redo" in
3555                 '')
3556                         case "$type" in
3557                         File)
3558                                 for fp in $gfpth; do
3559                                         if test "X$fp" = X.; then
3560                                             pf="$ansexp"
3561                                         else    
3562                                             pf="$fp/$ansexp"
3563                                         fi
3564                                         if test -f "$pf"; then
3565                                                 type=''
3566                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3567                                         then
3568                                                 echo "($value is not a plain file, but that's ok.)"
3569                                                 type=''
3570                                         fi
3571                                         if test X"$type" = X; then
3572                                             value="$pf"
3573                                             break
3574                                         fi
3575                                 done
3576                                 ;;
3577                         Directory)
3578                                 for fp in $gfpth; do
3579                                         if test "X$fp" = X.; then
3580                                             dir="$ans"
3581                                             direxp="$ansexp"
3582                                         else    
3583                                             dir="$fp/$ansexp"
3584                                             direxp="$fp/$ansexp"
3585                                         fi
3586                                         if test -d "$direxp"; then
3587                                                 type=''
3588                                                 value="$dir"
3589                                                 break
3590                                         fi
3591                                 done
3592                                 ;;
3593                         Locate)
3594                                 if test -d "$ansexp"; then
3595                                         echo "(Looking for $loc_file in directory $value.)"
3596                                         value="$value/$loc_file"
3597                                         ansexp="$ansexp/$loc_file"
3598                                 fi
3599                                 if test -f "$ansexp"; then
3600                                         type=''
3601                                 fi
3602                                 case "$nopath_ok" in
3603                                 true)   case "$value" in
3604                                         */*) ;;
3605                                         *)      echo "Assuming $value will be in people's path."
3606                                                 type=''
3607                                                 ;;
3608                                         esac
3609                                         ;;
3610                                 esac
3611                                 ;;
3612                         esac
3613
3614                         case "$skip" in
3615                         true) type='';
3616                         esac
3617
3618                         case "$type" in
3619                         '') ;;
3620                         *)
3621                                 if test "$fastread" = yes; then
3622                                         dflt=y
3623                                 else
3624                                         dflt=n
3625                                 fi
3626                                 rp="$what $value doesn't exist.  Use that name anyway?"
3627                                 . UU/myread
3628                                 dflt=''
3629                                 case "$ans" in
3630                                 y*) type='';;
3631                                 *) echo " ";;
3632                                 esac
3633                                 ;;
3634                         esac
3635                         ;;
3636                 esac
3637                 ;;
3638         esac
3639 done
3640 cd UU
3641 ans="$value"
3642 rp="$orig_rp"
3643 dflt="$orig_dflt"
3644 rm -f getfile.ok
3645 test "X$gfpthkeep" != Xy && gfpth=""
3646 EOSC
3647
3648 : What should the include directory be ?
3649 echo " "
3650 $echo $n "Hmm...  $c"
3651 dflt='/usr/include'
3652 incpath=''
3653 mips_type=''
3654 if $test -f /bin/mips && /bin/mips; then
3655         echo "Looks like a MIPS system..."
3656         $cat >usr.c <<'EOCP'
3657 #ifdef SYSTYPE_BSD43
3658 /bsd43
3659 #endif
3660 EOCP
3661         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3662                 dflt='/bsd43/usr/include'
3663                 incpath='/bsd43'
3664                 mips_type='BSD 4.3'
3665         else
3666                 mips_type='System V'
3667         fi
3668         $rm -f usr.c usr.out
3669         echo "and you're compiling with the $mips_type compiler and libraries."
3670         xxx_prompt=y
3671         echo "exit 0" >mips
3672 else
3673         echo "Doesn't look like a MIPS system."
3674         xxx_prompt=n
3675         echo "exit 1" >mips
3676 fi
3677 chmod +x mips
3678 $eunicefix mips
3679 case "$usrinc" in
3680 '') ;;
3681 *) dflt="$usrinc";;
3682 esac
3683 case "$xxx_prompt" in
3684 y)      fn=d/
3685         echo " "
3686         rp='Where are the include files you want to use?'
3687         . ./getfile
3688         usrinc="$ans"
3689         ;;
3690 *)      usrinc="$dflt"
3691         ;;
3692 esac
3693
3694 : Set private lib path
3695 case "$plibpth" in
3696 '') if ./mips; then
3697                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3698         fi;;
3699 esac
3700 case "$libpth" in
3701 ' ') dlist='';;
3702 '') dlist="$loclibpth $plibpth $glibpth";;
3703 *) dlist="$libpth";;
3704 esac
3705
3706 : Now check and see which directories actually exist, avoiding duplicates
3707 libpth=''
3708 for xxx in $dlist
3709 do
3710     if $test -d $xxx; then
3711                 case " $libpth " in
3712                 *" $xxx "*) ;;
3713                 *) libpth="$libpth $xxx";;
3714                 esac
3715     fi
3716 done
3717 $cat <<'EOM'
3718
3719 Some systems have incompatible or broken versions of libraries.  Among
3720 the directories listed in the question below, please remove any you
3721 know not to be holding relevant libraries, and add any that are needed.
3722 Say "none" for none.
3723
3724 EOM
3725 case "$libpth" in
3726 '') dflt='none';;
3727 *)
3728         set X $libpth
3729         shift
3730         dflt=${1+"$@"}
3731         ;;
3732 esac
3733 rp="Directories to use for library searches?"
3734 . ./myread
3735 case "$ans" in
3736 none) libpth=' ';;
3737 *) libpth="$ans";;
3738 esac
3739
3740 : compute shared library extension
3741 case "$so" in
3742 '')
3743         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3744                 dflt='sl'
3745         else
3746                 dflt='so'
3747         fi
3748         ;;
3749 *) dflt="$so";;
3750 esac
3751 $cat <<EOM
3752
3753 On some systems, shared libraries may be available.  Answer 'none' if
3754 you want to suppress searching of shared libraries for the remainder
3755 of this configuration.
3756
3757 EOM
3758 rp='What is the file extension used for shared libraries?'
3759 . ./myread
3760 so="$ans"
3761
3762 : Define several unixisms.
3763 : Hints files or command line option can be used to override them.
3764 : The convoluted testing is in case hints files set either the old
3765 : or the new name.
3766 case "$_exe" in
3767 '')     case "$exe_ext" in
3768     '') ;;
3769         *)      _exe="$exe_ext" ;;
3770         esac
3771         ;;
3772 esac
3773 case "$_a" in
3774 '')     case "$lib_ext" in
3775     '') _a='.a';;
3776         *)      _a="$lib_ext" ;;
3777         esac
3778         ;;
3779 esac
3780 case "$_o" in
3781 '') case "$obj_ext" in
3782         '')     _o='.o';;
3783         *)      _o="$obj_ext";;
3784         esac
3785         ;;
3786 esac
3787 case "$p_" in
3788 '') case "$path_sep" in
3789         '')     p_=':';;
3790         *)      p_="$path_sep";;
3791         esac
3792         ;;
3793 esac
3794 exe_ext=$_exe
3795 lib_ext=$_a
3796 obj_ext=$_o
3797 path_sep=$p_
3798
3799 : Which makefile gets called first.  This is used by make depend.
3800 case "$firstmakefile" in
3801 '') firstmakefile='makefile';;
3802 esac
3803
3804 case "$usesocks" in
3805 $define|true|[yY]*)     dflt='y';;
3806 *) dflt='n';;
3807 esac
3808 cat <<EOM
3809
3810 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3811 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3812 to use the PerlIO abstraction layer, this will be implicitly selected.
3813
3814 If this doesn't make any sense to you, just accept the default '$dflt'.
3815 EOM
3816 rp='Build Perl for SOCKS?'
3817 . ./myread
3818 case "$ans" in
3819 y|Y)    val="$define" ;;     
3820 *)      val="$undef" ;;
3821 esac
3822 set usesocks
3823 eval $setvar
3824
3825 case "$usesocks" in
3826 $define|true|[yY]*) useperlio="$define";;
3827 esac
3828
3829 : Looking for optional libraries
3830 echo " "
3831 echo "Checking for optional libraries..." >&4
3832 case "$libs" in
3833 ' '|'') dflt='';;
3834 *) dflt="$libs";;
3835 esac
3836 case "$libswanted" in
3837 '') libswanted='c_s';;
3838 esac
3839 case "$usesocks" in
3840 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3841 esac
3842 libsfound=''
3843 libsfiles=''
3844 libsdirs=''
3845 libspath=''
3846 for thisdir in $libpth $xlibpth; do
3847   test -d $thisdir && libspath="$libspath $thisdir"
3848 done
3849 for thislib in $libswanted; do
3850         for thisdir in $libspath; do
3851             xxx=''
3852             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3853                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3854                 $test -f "$xxx" && eval $libscheck
3855                 $test -f "$xxx" && libstyle=shared
3856             fi
3857             if test ! -f "$xxx"; then
3858                 xxx=$thisdir/lib$thislib.$so
3859                 $test -f "$xxx" && eval $libscheck
3860                 $test -f "$xxx" && libstyle=shared
3861             fi  
3862             if test ! -f "$xxx"; then
3863                 xxx=$thisdir/lib$thislib$_a
3864                 $test -f "$xxx" && eval $libscheck
3865                 $test -f "$xxx" && libstyle=static
3866             fi
3867             if test ! -f "$xxx"; then
3868                 xxx=$thisdir/$thislib$_a
3869                 $test -f "$xxx" && eval $libscheck
3870                 $test -f "$xxx" && libstyle=static
3871             fi
3872             if test ! -f "$xxx"; then
3873                 xxx=$thisdir/lib${thislib}_s$_a
3874                 $test -f "$xxx" && eval $libscheck
3875                 $test -f "$xxx" && libstyle=static
3876                 $test -f "$xxx" && thislib=${thislib}_s
3877             fi
3878             if test ! -f "$xxx"; then
3879                 xxx=$thisdir/Slib$thislib$_a
3880                 $test -f "$xxx" && eval $libscheck
3881                 $test -f "$xxx" && libstyle=static
3882             fi
3883             if $test -f "$xxx"; then
3884                 case "$libstyle" in
3885                 shared) echo "Found -l$thislib (shared)." ;;
3886                 static) echo "Found -l$thislib." ;;
3887                 *)      echo "Found -l$thislib ($libstyle)." ;;
3888                 esac
3889                 case " $dflt " in
3890                 *"-l$thislib "*);;
3891                 *) dflt="$dflt -l$thislib"
3892                    libsfound="$libsfound $xxx"
3893                    yyy=`basename $xxx`
3894                    libsfiles="$libsfiles $yyy"
3895                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3896                    case " $libsdirs " in
3897                    *" $yyy "*) ;;
3898                    *) libsdirs="$libsdirs $yyy" ;;
3899                    esac
3900                    ;;
3901                 esac
3902                 break
3903             fi  
3904         done
3905         if $test ! -f "$xxx"; then
3906             echo "No -l$thislib."
3907         fi
3908 done
3909 set X $dflt
3910 shift
3911 dflt="$*"
3912 case "$libs" in
3913 '') dflt="$dflt";;
3914 *) dflt="$libs";;
3915 esac
3916 case "$dflt" in
3917 ' '|'') dflt='none';;
3918 esac
3919
3920 $cat <<EOM
3921
3922 In order to compile $package on your machine, a number of libraries
3923 are usually needed.  Include any other special libraries here as well.
3924 Say "none" for none.  The default list is almost always right.
3925 EOM
3926
3927 echo " "
3928 rp="What libraries to use?"
3929 . ./myread
3930 case "$ans" in
3931 none) libs=' ';;
3932 *) libs="$ans";;
3933 esac
3934
3935 : determine optimization, if desired, or use for debug flag also
3936 case "$optimize" in
3937 ' '|$undef) dflt='none';;
3938 '') dflt='-O';;
3939 *) dflt="$optimize";;
3940 esac
3941 $cat <<EOH
3942
3943 By default, $package compiles with the -O flag to use the optimizer.
3944 Alternately, you might want to use the symbolic debugger, which uses
3945 the -g flag (on traditional Unix systems).  Either flag can be
3946 specified here.  To use neither flag, specify the word "none".
3947
3948 EOH
3949 rp="What optimizer/debugger flag should be used?"
3950 . ./myread
3951 optimize="$ans"
3952 case "$optimize" in
3953 'none') optimize=" ";;
3954 esac
3955
3956 dflt=''
3957 : We will not override a previous value, but we might want to
3958 : augment a hint file
3959 case "$hint" in
3960 default|recommended)
3961         case "$gccversion" in
3962         1*) dflt='-fpcc-struct-return' ;;
3963         esac
3964         case "$optimize" in
3965         *-g*) dflt="$dflt -DDEBUGGING";;
3966         esac
3967         case "$gccversion" in
3968         2*) if test -d /etc/conf/kconfig.d &&
3969                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3970                 then
3971                         dflt="$dflt -posix"
3972                 fi
3973                 ;;
3974         esac
3975         case "$gccversion" in
3976         1*) ;;
3977         2.[0-8]*) ;;
3978         ?*)     echo " "
3979                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3980                 echo 'int main(void) { return 0; }' > gcctest.c
3981                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3982                         echo "Yes, it does." 2>&1
3983                         case "$ccflags" in
3984                         *strict-aliasing*) 
3985                                 echo "Leaving current flags $ccflags alone." 2>&1
3986                                 ;;
3987                         *) dflt="$dflt -fno-strict-aliasing" ;;
3988                         esac
3989                 else
3990                         echo "Nope, it doesn't, but that's ok." 2>&1
3991                 fi
3992                 ;;
3993         esac
3994         ;;
3995 esac
3996
3997 case "$mips_type" in
3998 *BSD*|'') inclwanted="$locincpth $usrinc";;
3999 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4000 esac
4001 for thisincl in $inclwanted; do
4002         if $test -d $thisincl; then
4003                 if $test x$thisincl != x$usrinc; then
4004                         case "$dflt" in
4005                         *" -I$thisincl "*);;
4006                         *) dflt="$dflt -I$thisincl ";;
4007                         esac
4008                 fi
4009         fi
4010 done
4011
4012 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4013         xxx=true;
4014 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4015         xxx=true;
4016 else
4017         xxx=false;
4018 fi;
4019 if $xxx; then
4020         case "$dflt" in
4021         *$2*);;
4022         *) dflt="$dflt -D$2";;
4023         esac;
4024 fi'
4025
4026 set signal.h LANGUAGE_C; eval $inctest
4027
4028 case "$usesocks" in
4029 $define)
4030         ccflags="$ccflags -DSOCKS"
4031         ;;
4032 esac
4033
4034 case "$hint" in
4035 default|recommended) dflt="$ccflags $dflt" ;;
4036 *) dflt="$ccflags";;
4037 esac
4038
4039 case "$dflt" in
4040 ''|' ') dflt=none;;
4041 esac
4042
4043 $cat <<EOH
4044
4045 Your C compiler may want other flags.  For this question you should include
4046 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4047 but you should NOT include libraries or ld flags like -lwhatever.  If you
4048 want $package to honor its debug switch, you should include -DDEBUGGING here.
4049 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4050
4051 To use no flags, specify the word "none".
4052
4053 EOH
4054 set X $dflt
4055 shift
4056 dflt=${1+"$@"}
4057 rp="Any additional cc flags?"
4058 . ./myread
4059 case "$ans" in
4060 none) ccflags='';;
4061 *) ccflags="$ans";;
4062 esac
4063
4064 : the following weeds options from ccflags that are of no interest to cpp
4065 cppflags="$ccflags"
4066 case "$gccversion" in
4067 1*) cppflags="$cppflags -D__GNUC__"
4068 esac
4069 case "$mips_type" in
4070 '');;
4071 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4072 esac
4073 case "$cppflags" in
4074 '');;
4075 *)
4076         echo " "
4077         echo "Let me guess what the preprocessor flags are..." >&4
4078         set X $cppflags
4079         shift
4080         cppflags=''
4081         $cat >cpp.c <<'EOM'
4082 #define BLURFL foo
4083
4084 BLURFL xx LFRULB
4085 EOM
4086         previous=''
4087         for flag in $*
4088         do
4089                 case "$flag" in
4090                 -*) ftry="$flag";;
4091                 *) ftry="$previous $flag";;
4092                 esac
4093                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4094                         >cpp1.out 2>/dev/null && \
4095                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4096                         >cpp2.out 2>/dev/null && \
4097                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4098                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4099                 then
4100                         cppflags="$cppflags $ftry"
4101                         previous=''
4102                 else
4103                         previous="$flag"
4104                 fi
4105         done
4106         set X $cppflags
4107         shift
4108         cppflags=${1+"$@"}
4109         case "$cppflags" in
4110         *-*)  echo "They appear to be: $cppflags";;
4111         esac
4112         $rm -f cpp.c cpp?.out
4113         ;;
4114 esac
4115
4116 : flags used in final linking phase
4117 case "$ldflags" in
4118 '') if ./venix; then
4119                 dflt='-i -z'
4120         else
4121                 dflt=''
4122         fi
4123         case "$ccflags" in
4124         *-posix*) dflt="$dflt -posix" ;;
4125         esac
4126         ;;
4127 *) dflt="$ldflags";;
4128 esac
4129
4130 : Try to guess additional flags to pick up local libraries.
4131 for thislibdir in $libpth; do
4132         case " $loclibpth " in
4133         *" $thislibdir "*)
4134                 case "$dflt " in 
4135                 *"-L$thislibdir "*) ;;
4136                 *)  dflt="$dflt -L$thislibdir" ;;
4137                 esac
4138                 ;;
4139         esac
4140 done
4141
4142 case "$dflt" in
4143 '') dflt='none' ;;
4144 esac
4145
4146 $cat <<EOH
4147
4148 Your C linker may need flags.  For this question you should
4149 include -L/whatever and any other flags used by the C linker, but you
4150 should NOT include libraries like -lwhatever.
4151
4152 Make sure you include the appropriate -L/path flags if your C linker
4153 does not normally search all of the directories you specified above,
4154 namely
4155         $libpth
4156 To use no flags, specify the word "none".
4157
4158 EOH
4159
4160 rp="Any additional ld flags (NOT including libraries)?"
4161 . ./myread
4162 case "$ans" in
4163 none) ldflags='';;
4164 *) ldflags="$ans";;
4165 esac
4166 rmlist="$rmlist pdp11"
4167
4168 : coherency check
4169 echo " "
4170 echo "Checking your choice of C compiler and flags for coherency..." >&4
4171 $cat > try.c <<'EOF'
4172 #include <stdio.h>
4173 int main() { printf("Ok\n"); exit(0); }
4174 EOF
4175 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4176 shift
4177 $cat >try.msg <<'EOM'
4178 I've tried to compile and run the following simple program:
4179
4180 EOM
4181 $cat try.c >> try.msg
4182
4183 $cat >> try.msg <<EOM
4184
4185 I used the command:
4186
4187         $*
4188         ./try
4189
4190 and I got the following output:
4191
4192 EOM
4193 dflt=y
4194 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4195         if $sh -c './try' >>try.msg 2>&1; then
4196                 xxx=`./try`
4197                 case "$xxx" in
4198                 "Ok") dflt=n ;;
4199                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4200                         case " $libs " in
4201                         *" -lsfio "*)
4202                                 cat >> try.msg <<'EOQS'
4203 If $libs contains -lsfio, and sfio is mis-configured, then it
4204 sometimes (apparently) runs and exits with a 0 status, but with no
4205 output!  It may have to do with sfio's use of _exit vs. exit.
4206
4207 EOQS
4208                                 rp="You have a big problem.  Shall I abort Configure"
4209                                 dflt=y
4210                                 ;;
4211                         esac
4212                         ;;
4213                 esac
4214         else
4215                 echo "The program compiled OK, but exited with status $?." >>try.msg
4216                 rp="You have a problem.  Shall I abort Configure"
4217                 dflt=y
4218         fi
4219 else
4220         echo "I can't compile the test program." >>try.msg
4221         rp="You have a BIG problem.  Shall I abort Configure"
4222         dflt=y
4223 fi
4224 case "$dflt" in
4225 y)
4226         $cat try.msg >&4
4227         case "$knowitall" in
4228         '')
4229                 echo "(The supplied flags or libraries might be incorrect.)"
4230                 ;;
4231         *) dflt=n;;
4232         esac
4233         echo " "
4234         . ./myread
4235         case "$ans" in
4236         n*|N*) ;;
4237         *)      echo "Ok.  Stopping Configure." >&4
4238                 exit 1
4239                 ;;
4240         esac
4241         ;;
4242 n) echo "OK, that should do.";;
4243 esac
4244 $rm -f try try.* core
4245
4246 : define an is-a-typedef? function
4247 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4248 case "$inclist" in
4249 "") inclist="sys/types.h";;
4250 esac;
4251 eval "varval=\$$var";
4252 case "$varval" in
4253 "")
4254         $rm -f temp.c;
4255         for inc in $inclist; do
4256                 echo "#include <$inc>" >>temp.c;
4257         done;
4258         echo "#ifdef $type" >> temp.c;
4259         echo "printf(\"We have $type\");" >> temp.c;
4260         echo "#endif" >> temp.c;
4261         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4262         if $contains $type temp.E >/dev/null 2>&1; then
4263                 eval "$var=\$type";
4264         else
4265                 eval "$var=\$def";
4266         fi;
4267         $rm -f temp.?;;
4268 *) eval "$var=\$varval";;
4269 esac'
4270
4271 : define an is-a-typedef? function that prompts if the type is not available.
4272 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4273 case "$inclist" in
4274 "") inclist="sys/types.h";;
4275 esac;
4276 eval "varval=\$$var";
4277 case "$varval" in
4278 "")
4279         $rm -f temp.c;
4280         for inc in $inclist; do
4281                 echo "#include <$inc>" >>temp.c;
4282         done;
4283         echo "#ifdef $type" >> temp.c;
4284         echo "printf(\"We have $type\");" >> temp.c;
4285         echo "#endif" >> temp.c;
4286         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4287         echo " " ;
4288         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4289         if $contains $type temp.E >/dev/null 2>&1; then
4290                 echo "$type found." >&4;
4291                 eval "$var=\$type";
4292         else
4293                 echo "$type NOT found." >&4;
4294                 dflt="$def";
4295                 . ./myread ;
4296                 eval "$var=\$ans";
4297         fi;
4298         $rm -f temp.?;;
4299 *) eval "$var=\$varval";;
4300 esac'
4301
4302 : define a shorthand compile call
4303 compile='
4304 mc_file=$1;
4305 shift;
4306 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4307 : define a shorthand compile call for compilations that should be ok.
4308 compile_ok='
4309 mc_file=$1;
4310 shift;
4311 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4312
4313 : check for lengths of integral types
4314 echo " "
4315 case "$intsize" in
4316 '')
4317         echo "Checking to see how big your integers are..." >&4
4318         $cat >intsize.c <<'EOCP'
4319 #include <stdio.h>
4320 int main()
4321 {
4322         printf("intsize=%d;\n", (int)sizeof(int));
4323         printf("longsize=%d;\n", (int)sizeof(long));
4324         printf("shortsize=%d;\n", (int)sizeof(short));
4325         exit(0);
4326 }
4327 EOCP
4328         set intsize
4329         if eval $compile_ok && ./intsize > /dev/null; then
4330                 eval `./intsize`
4331                 echo "Your integers are $intsize bytes long."
4332                 echo "Your long integers are $longsize bytes long."
4333                 echo "Your short integers are $shortsize bytes long."
4334         else
4335                 $cat >&4 <<EOM
4336 !
4337 Help! I can't compile and run the intsize test program: please enlighten me!
4338 (This is probably a misconfiguration in your system or libraries, and
4339 you really ought to fix it.  Still, I'll try anyway.)
4340 !
4341 EOM
4342                 dflt=4
4343                 rp="What is the size of an integer (in bytes)?"
4344                 . ./myread
4345                 intsize="$ans"
4346                 dflt=$intsize
4347                 rp="What is the size of a long integer (in bytes)?"
4348                 . ./myread
4349                 longsize="$ans"
4350                 dflt=2
4351                 rp="What is the size of a short integer (in bytes)?"
4352                 . ./myread
4353                 shortsize="$ans"
4354         fi
4355         ;;
4356 esac
4357 $rm -f intsize intsize.*
4358
4359 : see what type lseek is declared as in the kernel
4360 rp="What is the type used for lseek's offset on this system?"
4361 set off_t lseektype long stdio.h sys/types.h
4362 eval $typedef_ask
4363
4364 echo " "
4365 echo "Checking to see how big your file offsets are..." >&4
4366 $cat >try.c <<EOCP
4367 #include <sys/types.h>
4368 #include <stdio.h>
4369 int main()
4370 {
4371     printf("%d\n", (int)sizeof($lseektype));
4372     return(0); 
4373 }
4374 EOCP
4375 set try
4376 if eval $compile_ok; then
4377         lseeksize=`./try`
4378         echo "Your file offsets are $lseeksize bytes long."
4379 else
4380         dflt=$longsize
4381         echo " "
4382         echo "(I can't seem to compile the test program.  Guessing...)"
4383         rp="What is the size of your file offsets (in bytes)?"
4384         . ./myread
4385         lseeksize="$ans"
4386 fi
4387 $rm -f try.c try
4388
4389 : see what type file positions are declared as in the library
4390 rp="What is the type for file position used by fsetpos()?"
4391 set fpos_t fpostype long stdio.h sys/types.h
4392 eval $typedef_ask
4393
4394 echo " "
4395 case "$fpostype" in
4396 *_t) zzz="$fpostype"    ;;
4397 *)   zzz="fpos_t"       ;;
4398 esac
4399 echo "Checking the size of $zzz..." >&4 
4400 cat > try.c <<EOCP
4401 #include <sys/types.h>
4402 #include <stdio.h>
4403 int main() {
4404     printf("%d\n", (int)sizeof($fpostype));
4405     exit(0);
4406 }
4407 EOCP
4408 set try
4409 if eval $compile_ok; then
4410         yyy=`./try`
4411         case "$yyy" in
4412         '')     fpossize=4
4413                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4414                 ;;
4415         *)      fpossize=$yyy
4416                 echo "Your $zzz is $fpossize bytes long."
4417                 ;;
4418         esac
4419 else
4420         dflt="$longsize"
4421         echo " " >&4
4422         echo "(I can't compile the test program.  Guessing...)" >&4
4423         rp="What is the size of your file positions (in bytes)?"
4424         . ./myread
4425         fpossize="$ans"
4426 fi
4427
4428
4429
4430 # Backward compatibility (uselfs is deprecated).
4431 case "$uselfs" in
4432 "$define"|true|[yY]*)
4433         cat <<EOM >&4
4434
4435 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4436 EOM
4437         uselargefiles="$define"
4438         ;;
4439 esac                          
4440
4441 case "$lseeksize:$fpossize" in
4442 8:8) cat <<EOM
4443
4444 You can have files larger than 2 gigabytes.
4445 EOM
4446    val="$define" ;;
4447 *)    case "$uselargefiles" in
4448    "$undef"|false|[nN]*) dflt='n' ;;
4449    *)   dflt='y' ;;
4450    esac
4451    cat <<EOM
4452
4453 Perl can be built to understand large files (files larger than 2 gigabytes)
4454 on some systems.  To do so, Configure can be run with -Duselargefiles.
4455
4456 If this doesn't make any sense to you, just accept the default '$dflt'.
4457 EOM
4458    rp='Try to understand large files, if available?'
4459    . ./myread
4460    case "$ans" in
4461    y|Y)         val="$define" ;;
4462    *)           val="$undef"  ;;
4463    esac
4464    ;;
4465 esac
4466 set uselargefiles
4467 eval $setvar
4468 case "$uselargefiles" in
4469 "$define")
4470 : Look for a hint-file generated 'call-back-unit'.  If the
4471 : user has specified that a large files perl is to be built,
4472 : we may need to set or change some other defaults.
4473         if $test -f uselargefiles.cbu; then
4474                 echo "Your platform has some specific hints for large file builds, using them..."
4475                 . ./uselargefiles.cbu
4476                 echo " "
4477                 echo "Rechecking to see how big your file offsets are..." >&4
4478                 $cat >try.c <<EOCP
4479 #include <sys/types.h>
4480 #include <stdio.h>
4481 int main()
4482 {
4483     printf("%d\n", (int)sizeof($lseektype));
4484     return(0); 
4485 }
4486 EOCP
4487                 set try
4488                 if eval $compile_ok; then
4489                         lseeksize=`./try`
4490                         $echo "Your file offsets are now $lseeksize bytes long."
4491                 else
4492                         dflt="$lseeksize"
4493                         echo " "
4494                         echo "(I can't seem to compile the test program.  Guessing...)"
4495                         rp="What is the size of your file offsets (in bytes)?"
4496                         . ./myread
4497                         lseeksize="$ans"
4498                 fi
4499                 case "$fpostype" in
4500                 *_t) zzz="$fpostype"    ;;
4501                 *)   zzz="fpos_t"       ;;
4502                 esac
4503                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4504                 $cat > try.c <<EOCP
4505 #include <sys/types.h>
4506 #include <stdio.h>
4507 int main() {
4508     printf("%d\n", (int)sizeof($fpostype));
4509     exit(0);
4510 }
4511 EOCP
4512                 set try
4513                 if eval $compile_ok; then
4514                         yyy=`./try`
4515                         dflt="$lseeksize"
4516                         case "$yyy" in
4517                         '')     echo " "
4518                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4519                                 ;;
4520                         *)      fpossize=$yyy
4521                                 echo " $fpossize bytes." >&4
4522                                 ;;
4523                         esac
4524                 else
4525                         dflt="$fpossize"
4526                         echo " "
4527                         echo "(I can't compile the test program.  Guessing...)" >&4
4528                         rp="What is the size of your file positions (in bytes)?"
4529                         . ./myread
4530                         fpossize="$ans"
4531                 fi
4532                 $rm -f try.c try
4533         fi
4534         ;;
4535 esac
4536
4537
4538 case "$usemorebits" in
4539 "$define"|true|[yY]*)
4540         use64bitint="$define"
4541         uselongdouble="$define"
4542         usemorebits="$define"
4543         ;;
4544 *)      usemorebits="$undef"
4545         ;;
4546 esac
4547
4548 : check for void type
4549 echo " "
4550 echo "Checking to see how well your C compiler groks the void type..." >&4
4551 case "$voidflags" in
4552 '')
4553         $cat >try.c <<'EOCP'
4554 #if TRY & 1
4555 void sub() {
4556 #else
4557 sub() {
4558 #endif
4559         extern void moo();      /* function returning void */
4560         void (*goo)();          /* ptr to func returning void */
4561 #if TRY & 8
4562         void *hue;              /* generic ptr */
4563 #endif
4564 #if TRY & 2
4565         void (*foo[10])();
4566 #endif
4567
4568 #if TRY & 4
4569         if(goo == moo) {
4570                 exit(0);
4571         }
4572 #endif
4573         exit(0);
4574 }
4575 int main() { sub(); }
4576 EOCP
4577         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4578                 voidflags=$defvoidused
4579         echo "Good.  It appears to support void to the level $package wants.">&4
4580                 if $contains warning .out >/dev/null 2>&1; then
4581                         echo "However, you might get some warnings that look like this:"
4582                         $cat .out
4583                 fi
4584         else
4585 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4586                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4587                         echo "It supports 1..."
4588                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4589                                 echo "It also supports 2..."
4590                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4591                                         voidflags=7
4592                                         echo "And it supports 4 but not 8 definitely."
4593                                 else
4594                                         echo "It doesn't support 4..."
4595                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4596                                                 voidflags=11
4597                                                 echo "But it supports 8."
4598                                         else
4599                                                 voidflags=3
4600                                                 echo "Neither does it support 8."
4601                                         fi
4602                                 fi
4603                         else
4604                                 echo "It does not support 2..."
4605                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4606                                         voidflags=13
4607                                         echo "But it supports 4 and 8."
4608                                 else
4609                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4610                                                 voidflags=5
4611                                                 echo "And it supports 4 but has not heard about 8."
4612                                         else
4613                                                 echo "However it supports 8 but not 4."
4614                                         fi
4615                                 fi
4616                         fi
4617                 else
4618                         echo "There is no support at all for void."
4619                         voidflags=0
4620                 fi
4621         fi
4622 esac
4623 case "$voidflags" in
4624 "$defvoidused") ;;
4625 *)      $cat >&4 <<'EOM'
4626   Support flag bits are:
4627     1: basic void declarations.
4628     2: arrays of pointers to functions returning void.
4629     4: operations between pointers to and addresses of void functions.
4630     8: generic void pointers.
4631 EOM
4632         dflt="$voidflags";
4633         rp="Your void support flags add up to what?"
4634         . ./myread
4635         voidflags="$ans"
4636         ;;
4637 esac
4638 $rm -f try.* .out
4639
4640 : check for length of pointer
4641 echo " "
4642 case "$ptrsize" in
4643 '')
4644         echo "Checking to see how big your pointers are..." >&4
4645         if test "$voidflags" -gt 7; then
4646                 echo '#define VOID_PTR char *' > try.c
4647         else
4648                 echo '#define VOID_PTR void *' > try.c
4649         fi
4650         $cat >>try.c <<'EOCP'
4651 #include <stdio.h>
4652 int main()
4653 {
4654     printf("%d\n", (int)sizeof(VOID_PTR));
4655     exit(0);
4656 }
4657 EOCP
4658         set try
4659         if eval $compile_ok; then
4660                 ptrsize=`./try`
4661                 echo "Your pointers are $ptrsize bytes long."
4662         else
4663                 dflt='4'
4664                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4665                 rp="What is the size of a pointer (in bytes)?"
4666                 . ./myread
4667                 ptrsize="$ans"
4668         fi
4669         ;;
4670 esac
4671 $rm -f try.c try
4672
4673 : check for long long
4674 echo " "
4675 echo "Checking to see if you have long long..." >&4
4676 echo 'int main() { long long x = 7; return 0; }' > try.c
4677 set try
4678 if eval $compile; then
4679         val="$define"
4680         echo "You have long long."
4681 else
4682         val="$undef"
4683         echo "You do not have long long."
4684 fi
4685 $rm try.*
4686 set d_longlong
4687 eval $setvar
4688
4689 : check for length of long long
4690 case "${d_longlong}${longlongsize}" in
4691 $define)
4692         echo " "
4693         echo "Checking to see how big your long longs are..." >&4
4694         $cat >try.c <<'EOCP'
4695 #include <stdio.h>
4696 int main()
4697 {
4698     printf("%d\n", (int)sizeof(long long));
4699     return(0);
4700 }
4701 EOCP
4702         set try
4703         if eval $compile_ok; then
4704                 longlongsize=`./try$exe_ext`
4705                 echo "Your long longs are $longlongsize bytes long."
4706         else
4707                 dflt='8'
4708                 echo " "
4709                 echo "(I can't seem to compile the test program.  Guessing...)"
4710                 rp="What is the size of a long long (in bytes)?"
4711                 . ./myread
4712                 longlongsize="$ans"
4713         fi
4714         if $test "X$longsize" = "X$longlongsize"; then
4715                 echo "(That isn't any different from an ordinary long.)"
4716         fi      
4717         ;;
4718 esac
4719 $rm -f try.* try
4720
4721 : determine filename position in cpp output
4722 echo " "
4723 echo "Computing filename position in cpp output for #include directives..." >&4
4724 echo '#include <stdio.h>' > foo.c
4725 $cat >fieldn <<EOF
4726 $startsh
4727 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4728 $grep '^[       ]*#.*stdio\.h' | \
4729 while read cline; do
4730         pos=1
4731         set \$cline
4732         while $test \$# -gt 0; do
4733                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4734                         echo "\$pos"
4735                         exit 0
4736                 fi
4737                 shift
4738                 pos=\`expr \$pos + 1\`
4739         done
4740 done
4741 EOF
4742 chmod +x fieldn
4743 fieldn=`./fieldn`
4744 $rm -f foo.c fieldn
4745 case $fieldn in
4746 '') pos='???';;
4747 1) pos=first;;
4748 2) pos=second;;
4749 3) pos=third;;
4750 *) pos="${fieldn}th";;
4751 esac
4752 echo "Your cpp writes the filename in the $pos field of the line."
4753
4754 : locate header file
4755 $cat >findhdr <<EOF
4756 $startsh
4757 wanted=\$1
4758 name=''
4759 for usrincdir in $usrinc
4760 do
4761         if test -f \$usrincdir/\$wanted; then
4762                 echo "\$usrincdir/\$wanted"
4763                 exit 0
4764         fi
4765 done
4766 awkprg='{ print \$$fieldn }'
4767 echo "#include <\$wanted>" > foo\$\$.c
4768 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4769 $grep "^[       ]*#.*\$wanted" | \
4770 while read cline; do
4771         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4772         case "\$name" in
4773         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4774         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4775         *) exit 2;;
4776         esac;
4777 done;
4778 #
4779 # status = 0: grep returned 0 lines, case statement not executed
4780 # status = 1: headerfile found
4781 # status = 2: while loop executed, no headerfile found
4782 #
4783 status=\$?
4784 $rm -f foo\$\$.c;
4785 if test \$status -eq 1; then
4786         exit 0;
4787 fi
4788 exit 1
4789 EOF
4790 chmod +x findhdr
4791
4792 : define an alternate in-header-list? function
4793 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4794 cont=true; xxf="echo \"<\$1> found.\" >&4";
4795 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4796 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4797 esac;
4798 case $# in 4) instead=instead;; *) instead="at last";; esac;
4799 while $test "$cont"; do
4800         xxx=`./findhdr $1`
4801         var=$2; eval "was=\$$2";
4802         if $test "$xxx" && $test -r "$xxx";
4803         then eval $xxf;
4804         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4805                 cont="";
4806         else eval $xxnf;
4807         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4808         set $yyy; shift; shift; yyy=$@;
4809         case $# in 0) cont="";;
4810         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4811                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4812         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4813                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4814         esac;
4815 done;
4816 while $test "$yyy";
4817 do set $yyy; var=$2; eval "was=\$$2";
4818         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4819         set $yyy; shift; shift; yyy=$@;
4820 done'
4821
4822 : see if inttypes.h is available
4823 : we want a real compile instead of Inhdr because some systems
4824 : have an inttypes.h which includes non-existent headers
4825 echo " "
4826 $cat >try.c <<EOCP
4827 #include <inttypes.h>
4828 int main() {
4829         static int32_t foo32 = 0x12345678;
4830 }
4831 EOCP
4832 set try
4833 if eval $compile; then
4834         echo "<inttypes.h> found." >&4
4835         val="$define"
4836 else
4837         echo "<inttypes.h> NOT found." >&4
4838         val="$undef"
4839 fi
4840 $rm -f try.c try
4841 set i_inttypes
4842 eval $setvar
4843
4844 : check for int64_t
4845 echo " "
4846 echo "Checking to see if you have int64_t..." >&4
4847 $cat >try.c <<EOCP
4848 #include <sys/types.h>
4849 #$i_inttypes I_INTTYPES
4850 #ifdef I_INTTYPES
4851 #include <inttypes.h>
4852 #endif
4853 int main() { int64_t x = 7; }
4854 EOCP
4855 set try
4856 if eval $compile; then
4857         val="$define"
4858         echo "You have int64_t."
4859 else
4860         val="$undef"
4861         echo "You do not have int64_t."
4862 fi
4863 $rm -f try try.*
4864 set d_int64_t
4865 eval $setvar
4866
4867
4868 echo " "
4869 echo "Checking which 64-bit integer type we could use..." >&4
4870
4871 case "$intsize" in
4872 8) val=int
4873    set quadtype
4874    eval $setvar
4875    val='"unsigned int"'
4876    set uquadtype
4877    eval $setvar
4878    quadkind=1
4879    ;;
4880 *) case "$longsize" in
4881    8) val=long
4882       set quadtype
4883       eval $setvar
4884       val='"unsigned long"'
4885       set uquadtype
4886       eval $setvar
4887       quadkind=2
4888       ;;
4889    *) case "$d_longlong:$longlongsize" in
4890       define:8)
4891         val='"long long"'
4892         set quadtype
4893         eval $setvar
4894         val='"unsigned long long"'
4895         set uquadtype
4896         eval $setvar
4897         quadkind=3
4898         ;;
4899       *) case "$d_int64_t" in
4900          define)
4901            val=int64_t
4902            set quadtype
4903            eval $setvar
4904            val=uint64_t
4905            set uquadtype
4906            eval $setvar
4907            quadkind=4
4908            ;;
4909          esac
4910          ;;
4911       esac
4912       ;;
4913    esac
4914    ;;
4915 esac
4916
4917 case "$quadtype" in
4918 '')     echo "Alas, no 64-bit integer types in sight." >&4
4919         d_quad="$undef"
4920         ;;
4921 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4922         d_quad="$define"
4923         ;;
4924 esac
4925
4926
4927 case "$uselonglong" in
4928 "$define"|true|[yY]*)
4929         cat <<EOM >&4
4930
4931 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4932 EOM
4933         use64bitint="$define"
4934         ;;
4935 esac                          
4936 case "$use64bits" in
4937 "$define"|true|[yY]*)
4938         cat <<EOM >&4
4939
4940 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4941 EOM
4942         use64bitint="$define"
4943         ;;
4944 esac                          
4945 case "$use64bitints" in
4946 "$define"|true|[yY]*)
4947         cat <<EOM >&4
4948
4949 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4950 EOM
4951         use64bitint="$define"
4952         ;;
4953 esac                          
4954 case "$use64bitsint" in
4955 "$define"|true|[yY]*)
4956         cat <<EOM >&4
4957
4958 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4959 EOM
4960         use64bitint="$define"
4961         ;;
4962 esac                          
4963 case "$uselonglongs" in
4964 "$define"|true|[yY]*)
4965         cat <<EOM >&4
4966
4967 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4968 EOM
4969         use64bitint="$define"
4970         ;;
4971 esac                          
4972 case "$use64bitsall" in
4973 "$define"|true|[yY]*)
4974         cat <<EOM >&4
4975
4976 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4977 EOM
4978         use64bitall="$define"
4979         ;;
4980 esac                          
4981
4982 case "$ccflags" in
4983 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4984 esac
4985 case "$use64bitall" in
4986 "$define"|true|[yY]*) use64bitint="$define" ;;
4987 esac
4988
4989 case "$longsize" in
4990 8) cat <<EOM
4991
4992 You have natively 64-bit long integers.
4993 EOM
4994    val="$define"
4995    ;;
4996 *) case "$use64bitint" in
4997    "$define"|true|[yY]*) dflt='y';;
4998    *) dflt='n';;
4999    esac
5000    case "$d_quad" in
5001    "$define") ;;
5002    *) dflt='n' ;;
5003    esac
5004    cat <<EOM
5005
5006 Perl can be built to take advantage of 64-bit integer types
5007 on some systems.  To do so, Configure can be run with -Duse64bitint.
5008 Choosing this option will most probably introduce binary incompatibilities.
5009
5010 If this doesn't make any sense to you, just accept the default '$dflt'.
5011 (The default has been chosen based on your configuration.)
5012 EOM
5013    rp='Try to use 64-bit integers, if available?'
5014    . ./myread
5015    case "$ans" in
5016    [yY]*) val="$define" ;;
5017    *)     val="$undef"  ;;
5018    esac
5019    ;;
5020 esac
5021 set use64bitint
5022 eval $setvar
5023
5024 case "$use64bitall" in
5025 "$define"|true|[yY]*) dflt='y' ;;
5026 *) case "$longsize" in
5027    8) dflt='y' ;;
5028    *) dflt='n' ;;
5029    esac
5030    ;;
5031 esac    
5032 cat <<EOM
5033
5034 You may also choose to try maximal 64-bitness.  It means using as much
5035 64-bitness as possible on the platform.  This in turn means even more
5036 binary incompatibilities.  On the other hand, your platform may not
5037 have any more 64-bitness available than what you already have chosen.
5038
5039 If this doesn't make any sense to you, just accept the default '$dflt'.
5040 (The default has been chosen based on your configuration.)
5041 EOM
5042 rp='Try to use maximal 64-bit support, if available?'
5043 . ./myread
5044 case "$ans" in
5045 [yY]*) val="$define" ;;
5046 *)     val="$undef"  ;;
5047 esac
5048 set use64bitall
5049 eval $setvar
5050 case "$use64bitall" in
5051 "$define")
5052         case "$use64bitint" in
5053         "$undef")
5054                 cat <<EOM
5055
5056 Since you have chosen a maximally 64-bit build, I'm also turning on
5057 the use of 64-bit integers.
5058 EOM
5059                 use64bitint="$define" ;;
5060         esac
5061         ;;
5062 esac
5063
5064 case "$use64bitall" in
5065 "$define"|true|[yY]*)
5066         case "$ptrsize" in
5067         4)      cat <<EOM >&4
5068
5069 *** You have chosen a maximally 64-bit build, but your pointers
5070 *** are only 4 bytes wide, disabling maximal 64-bitness.
5071
5072 EOM
5073                 use64bitall="$undef"
5074                 case "$use64bitint" in
5075                 "$define"|true|[yY]*) ;;
5076                 *)      cat <<EOM >&4
5077
5078 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5079
5080 EOM
5081                         use64bitint="$define"
5082                         ;;
5083                 esac
5084                 ;;
5085         esac
5086         ;;
5087 esac
5088
5089 case "$use64bitint" in
5090 "$define"|true|[yY]*)
5091 : Look for a hint-file generated 'call-back-unit'.  If the
5092 : user has specified that a 64-bit perl is to be built,
5093 : we may need to set or change some other defaults.
5094         if $test -f use64bitint.cbu; then
5095                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5096                 . ./use64bitint.cbu
5097         fi
5098         case "$longsize" in
5099         4) case "$archname64" in
5100            '') archname64=64int ;;
5101            esac
5102            ;;
5103         esac
5104         ;;
5105 esac
5106
5107 case "$use64bitall" in
5108 "$define"|true|[yY]*)
5109 : Look for a hint-file generated 'call-back-unit'.  If the
5110 : user has specified that a maximally 64-bit perl is to be built,
5111 : we may need to set or change some other defaults.
5112         if $test -f use64bitall.cbu; then
5113                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5114                 . ./use64bitall.cbu
5115         fi
5116         case "$longsize" in
5117         4) case "$archname64" in
5118            ''|64int) archname64=64all ;;
5119            esac
5120            ;;
5121         esac
5122         ;;
5123 esac
5124
5125 echo " "
5126 echo "Checking for GNU C Library..." >&4
5127 cat >gnulibc.c <<EOM
5128 #include <stdio.h>
5129 int main()
5130 {
5131 #ifdef __GLIBC__
5132     exit(0);
5133 #else
5134     exit(1);
5135 #endif
5136 }
5137 EOM
5138 set gnulibc
5139 if eval $compile_ok && ./gnulibc; then
5140         val="$define"
5141         echo "You are using the GNU C Library"
5142 else
5143         val="$undef"
5144         echo "You are not using the GNU C Library"
5145 fi
5146 $rm -f gnulibc*
5147 set d_gnulibc
5148 eval $setvar
5149
5150 : see if nm is to be used to determine whether a symbol is defined or not
5151 case "$usenm" in
5152 '')
5153         dflt=''
5154         case "$d_gnulibc" in
5155         "$define")
5156                 echo " "
5157                 echo "nm probably won't work on the GNU C Library." >&4
5158                 dflt=n
5159                 ;;
5160         esac
5161         case "$dflt" in
5162         '') 
5163                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5164                         echo " "
5165                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5166                         echo "'nm' won't be sufficient on this sytem." >&4
5167                         dflt=n
5168                 fi
5169                 ;;
5170         esac
5171         case "$dflt" in
5172         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5173                 if $test $dflt -gt 20; then
5174                         dflt=y
5175                 else
5176                         dflt=n
5177                 fi
5178                 ;;
5179         esac
5180         ;;
5181 *)
5182         case "$usenm" in
5183         true|$define) dflt=y;;
5184         *) dflt=n;;
5185         esac
5186         ;;
5187 esac
5188 $cat <<EOM
5189
5190 I can use $nm to extract the symbols from your C libraries. This
5191 is a time consuming task which may generate huge output on the disk (up
5192 to 3 megabytes) but that should make the symbols extraction faster. The
5193 alternative is to skip the 'nm' extraction part and to compile a small
5194 test program instead to determine whether each symbol is present. If
5195 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5196 this may be the best solution.
5197
5198 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5199
5200 EOM
5201 rp="Shall I use $nm to extract C symbols from the libraries?"
5202 . ./myread
5203 case "$ans" in
5204 [Nn]*) usenm=false;;
5205 *) usenm=true;;
5206 esac
5207
5208 runnm=$usenm
5209 case "$reuseval" in
5210 true) runnm=false;;
5211 esac
5212
5213 : nm options which may be necessary
5214 case "$nm_opt" in
5215 '') if $test -f /mach_boot; then
5216                 nm_opt=''       # Mach
5217         elif $test -d /usr/ccs/lib; then
5218                 nm_opt='-p'     # Solaris (and SunOS?)
5219         elif $test -f /dgux; then
5220                 nm_opt='-p'     # DG-UX
5221         elif $test -f /lib64/rld; then
5222                 nm_opt='-p'     # 64-bit Irix
5223         else
5224                 nm_opt=''
5225         fi;;
5226 esac
5227
5228 : nm options which may be necessary for shared libraries but illegal
5229 : for archive libraries.  Thank you, Linux.
5230 case "$nm_so_opt" in
5231 '')     case "$myuname" in
5232         *linux*)
5233                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5234                         nm_so_opt='--dynamic'
5235                 fi
5236                 ;;
5237         esac
5238         ;;
5239 esac
5240
5241 case "$runnm" in
5242 true)
5243 : get list of predefined functions in a handy place
5244 echo " "
5245 case "$libc" in
5246 '') libc=unknown
5247         case "$libs" in
5248         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5249         esac
5250         ;;
5251 esac
5252 libnames='';
5253 case "$libs" in
5254 '') ;;
5255 *)  for thislib in $libs; do
5256         case "$thislib" in
5257         -lc|-lc_s)
5258                 : Handle C library specially below.
5259                 ;;
5260         -l*)
5261                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5262                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5263                         :
5264                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5265                         :
5266                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5267                         :
5268                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5269                         :
5270                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5271                         :
5272                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5273                         :
5274                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5275                         :
5276                 else
5277                         try=''
5278                 fi
5279                 libnames="$libnames $try"
5280                 ;;
5281         *) libnames="$libnames $thislib" ;;
5282         esac
5283         done
5284         ;;
5285 esac
5286 xxx=normal
5287 case "$libc" in
5288 unknown)
5289         set /lib/libc.$so
5290         for xxx in $libpth; do
5291                 $test -r $1 || set $xxx/libc.$so
5292                 : The messy sed command sorts on library version numbers.
5293                 $test -r $1 || \
5294                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5295                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5296                                 h
5297                                 s/[0-9][0-9]*/0000&/g
5298                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5299                                 G
5300                                 s/\n/ /' | \
5301                          $sort | $sed -e 's/^.* //'`
5302                 eval set \$$#
5303         done
5304         $test -r $1 || set /usr/ccs/lib/libc.$so
5305         $test -r $1 || set /lib/libsys_s$_a
5306         ;;
5307 *)
5308         set blurfl
5309         ;;
5310 esac
5311 if $test -r "$1"; then
5312         echo "Your (shared) C library seems to be in $1."
5313         libc="$1"
5314 elif $test -r /lib/libc && $test -r /lib/clib; then
5315         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5316         xxx=apollo
5317         libc='/lib/clib /lib/libc'
5318         if $test -r /lib/syslib; then
5319                 echo "(Your math library is in /lib/syslib.)"
5320                 libc="$libc /lib/syslib"
5321         fi
5322 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5323         echo "Your C library seems to be in $libc, as you said before."
5324 elif $test -r $incpath/usr/lib/libc$_a; then
5325         libc=$incpath/usr/lib/libc$_a;
5326         echo "Your C library seems to be in $libc.  That's fine."
5327 elif $test -r /lib/libc$_a; then
5328         libc=/lib/libc$_a;
5329         echo "Your C library seems to be in $libc.  You're normal."
5330 else
5331         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5332                 :
5333         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5334                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5335         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5336                 :
5337         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5338                 :
5339         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5340                 :
5341         else
5342                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5343         fi
5344         if $test -r "$tans"; then
5345                 echo "Your C library seems to be in $tans, of all places."
5346                 libc=$tans
5347         else
5348                 libc='blurfl'
5349         fi
5350 fi
5351 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5352         dflt="$libc"
5353         cat <<EOM
5354
5355 If the guess above is wrong (which it might be if you're using a strange
5356 compiler, or your machine supports multiple models), you can override it here.
5357
5358 EOM
5359 else
5360         dflt=''
5361         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5362         cat >&4 <<EOM
5363 I can't seem to find your C library.  I've looked in the following places:
5364
5365 EOM
5366         $sed 's/^/      /' libpath
5367         cat <<EOM
5368
5369 None of these seems to contain your C library. I need to get its name...
5370
5371 EOM
5372 fi
5373 fn=f
5374 rp='Where is your C library?'
5375 . ./getfile
5376 libc="$ans"
5377
5378 echo " "
5379 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5380 set X `cat libnames`
5381 shift
5382 xxx=files
5383 case $# in 1) xxx=file; esac
5384 echo "Extracting names from the following $xxx for later perusal:" >&4
5385 echo " "
5386 $sed 's/^/      /' libnames >&4
5387 echo " "
5388 $echo $n "This may take a while...$c" >&4
5389
5390 for file in $*; do
5391         case $file in
5392         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5393         *) $nm $nm_opt $file 2>/dev/null;;
5394         esac
5395 done >libc.tmp
5396
5397 $echo $n ".$c"
5398 $grep fprintf libc.tmp > libc.ptf
5399 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5400 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5401 xxx='[ADTSIW]'
5402 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5403         eval $xscan;\
5404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5405                 eval $xrun
5406 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5407         eval $xscan;\
5408         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5409                 eval $xrun
5410 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5411         eval $xscan;\
5412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5413                 eval $xrun
5414 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5415         eval $xscan;\
5416         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5417                 eval $xrun
5418 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5419         eval $xscan;\
5420         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5421                 eval $xrun
5422 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5423         eval $xscan;\
5424         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5425                 eval $xrun
5426 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5427                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5428         eval $xscan;\
5429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5430                 eval $xrun
5431 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5432         eval $xscan;\
5433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5434                 eval $xrun
5435 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5436         eval $xscan;\
5437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5438                 eval $xrun
5439 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5440         eval $xscan;\
5441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5442                 eval $xrun
5443 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5444         eval $xscan;\
5445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5446                 eval $xrun
5447 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5448         eval $xscan;\
5449         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5450                 eval $xrun
5451 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5452         eval $xscan;\
5453         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5454                 eval $xrun
5455 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5456         eval $xscan;\
5457         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5458                 eval $xrun
5459 else
5460         $nm -p $* 2>/dev/null >libc.tmp
5461         $grep fprintf libc.tmp > libc.ptf
5462         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5463                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5464         then
5465                 nm_opt='-p'
5466                 eval $xrun
5467         else
5468                 echo " "
5469                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5470                 com=''
5471                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5472                         for thisname in $libnames $libc; do
5473                                 $ar t $thisname >>libc.tmp
5474                         done
5475                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5476                         echo "Ok." >&4
5477                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5478                         # Repeat libc to extract forwarders to DLL entries too
5479                         for thisname in $libnames $libc; do
5480                                 $ar tv $thisname >>libc.tmp
5481                                 # Revision 50 of EMX has bug in $ar.
5482                                 # it will not extract forwarders to DLL entries
5483                                 # Use emximp which will extract exactly them.
5484                                 emximp -o tmp.imp $thisname \
5485                                     2>/dev/null && \
5486                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5487                                     < tmp.imp >>libc.tmp
5488                                 $rm tmp.imp
5489                         done
5490                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5491                         echo "Ok." >&4
5492                 else
5493                         echo "$ar didn't seem to work right." >&4
5494                         echo "Maybe this is a Cray...trying bld instead..." >&4
5495                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5496                         then
5497                                 for thisname in $libnames; do
5498                                         bld t $libnames | \
5499                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5500                                         $ar t $thisname >>libc.tmp
5501                                 done
5502                                 echo "Ok." >&4
5503                         else
5504                                 echo "That didn't work either.  Giving up." >&4
5505                                 exit 1
5506                         fi
5507                 fi
5508         fi
5509 fi
5510 nm_extract="$com"
5511 if $test -f /lib/syscalls.exp; then
5512         echo " "
5513         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5514         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5515 fi
5516 ;;
5517 esac
5518 $rm -f libnames libpath
5519
5520 : is a C symbol defined?
5521 csym='tlook=$1;
5522 case "$3" in
5523 -v) tf=libc.tmp; tc=""; tdc="";;
5524 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5525 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5526 esac;
5527 tx=yes;
5528 case "$reuseval-$4" in
5529 true-) ;;
5530 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5531 esac;
5532 case "$tx" in
5533 yes)
5534         case "$runnm" in
5535         true)
5536                 if $contains $tlook $tf >/dev/null 2>&1;
5537                 then tval=true;
5538                 else tval=false;
5539                 fi;;
5540         *)
5541                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5542                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5543                 then tval=true;
5544                 else tval=false;
5545                 fi;
5546                 $rm -f t t.c;;
5547         esac;;
5548 *)
5549         case "$tval" in
5550         $define) tval=true;;
5551         *) tval=false;;
5552         esac;;
5553 esac;
5554 eval "$2=$tval"'
5555
5556 : define an is-in-libc? function
5557 inlibc='echo " "; td=$define; tu=$undef;
5558 sym=$1; var=$2; eval "was=\$$2";
5559 tx=yes;
5560 case "$reuseval$was" in
5561 true) ;;
5562 true*) tx=no;;
5563 esac;
5564 case "$tx" in
5565 yes)
5566         set $sym tres -f;
5567         eval $csym;
5568         case "$tres" in
5569         true)
5570                 echo "$sym() found." >&4;
5571                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5572         *)
5573                 echo "$sym() NOT found." >&4;
5574                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5575         esac;;
5576 *)
5577         case "$was" in
5578         $define) echo "$sym() found." >&4;;
5579         *) echo "$sym() NOT found." >&4;;
5580         esac;;
5581 esac'
5582
5583 : see if sqrtl exists
5584 set sqrtl d_sqrtl
5585 eval $inlibc
5586
5587 case "$ccflags" in
5588 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5589 esac
5590
5591 case "$uselongdouble" in
5592 $define|true|[yY]*)     dflt='y';;
5593 *) dflt='n';;
5594 esac
5595 cat <<EOM
5596
5597 Perl can be built to take advantage of long doubles which
5598 (if available) may give more accuracy and range for floating point numbers.
5599
5600 If this doesn't make any sense to you, just accept the default '$dflt'.
5601 EOM
5602 rp='Try to use long doubles if available?'
5603 . ./myread
5604 case "$ans" in
5605 y|Y)    val="$define"   ;;
5606 *)      val="$undef"    ;;
5607 esac
5608 set uselongdouble
5609 eval $setvar
5610
5611 case "$uselongdouble" in
5612 true|[yY]*) uselongdouble="$define" ;;
5613 esac
5614
5615 case "$uselongdouble" in
5616 $define)
5617 : Look for a hint-file generated 'call-back-unit'.  If the
5618 : user has specified that long doubles should be used,
5619 : we may need to set or change some other defaults.
5620         if $test -f uselongdouble.cbu; then
5621                 echo "Your platform has some specific hints for long doubles, using them..."
5622                 . ./uselongdouble.cbu
5623         else
5624                 $cat <<EOM
5625 (Your platform doesn't have any specific hints for long doubles.)
5626 EOM
5627         fi
5628         ;;
5629 esac
5630
5631 case "$uselongdouble:$d_sqrtl" in
5632 $define:$undef)
5633                 $cat <<EOM >&4
5634
5635 *** You requested the use of long doubles but you do not seem to have
5636 *** the mathematic functions for long doubles.  I'm disabling the use
5637 *** of long doubles.
5638
5639 EOM
5640         uselongdouble=$undef
5641         ;;
5642 esac
5643
5644 : check for length of double
5645 echo " "
5646 case "$doublesize" in
5647 '')
5648         echo "Checking to see how big your double precision numbers are..." >&4
5649         $cat >try.c <<'EOCP'
5650 #include <stdio.h>
5651 int main()
5652 {
5653     printf("%d\n", (int)sizeof(double));
5654     exit(0);
5655 }
5656 EOCP
5657         set try
5658         if eval $compile_ok; then
5659                 doublesize=`./try`
5660                 echo "Your double is $doublesize bytes long."
5661         else
5662                 dflt='8'
5663                 echo "(I can't seem to compile the test program.  Guessing...)"
5664                 rp="What is the size of a double precision number (in bytes)?"
5665                 . ./myread
5666                 doublesize="$ans"
5667         fi
5668         ;;
5669 esac
5670 $rm -f try.c try
5671
5672 : check for long doubles
5673 echo " "
5674 echo "Checking to see if you have long double..." >&4
5675 echo 'int main() { long double x = 7.0; }' > try.c
5676 set try
5677 if eval $compile; then
5678         val="$define"
5679         echo "You have long double."
5680 else
5681         val="$undef"
5682         echo "You do not have long double."
5683 fi
5684 $rm try.*
5685 set d_longdbl
5686 eval $setvar
5687
5688 : check for length of long double
5689 case "${d_longdbl}${longdblsize}" in
5690 $define)
5691         echo " "
5692         echo "Checking to see how big your long doubles are..." >&4
5693         $cat >try.c <<'EOCP'
5694 #include <stdio.h>
5695 int main()
5696 {
5697         printf("%d\n", sizeof(long double));
5698 }
5699 EOCP
5700         set try
5701         set try
5702         if eval $compile; then
5703                 longdblsize=`./try$exe_ext`
5704                 echo "Your long doubles are $longdblsize bytes long."
5705         else
5706                 dflt='8'
5707                 echo " "
5708                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5709                 rp="What is the size of a long double (in bytes)?"
5710                 . ./myread
5711                 longdblsize="$ans"
5712         fi
5713         if $test "X$doublesize" = "X$longdblsize"; then
5714                 echo "(That isn't any different from an ordinary double.)"
5715         fi      
5716         ;;
5717 esac
5718 $rm -f try.* try
5719
5720 case "$useperlio" in
5721 $define|true|[yY]*|'')  dflt='y';;
5722 *) dflt='n';;
5723 esac
5724 cat <<EOM
5725
5726 Previous version of $package used the standard IO mechanisms as
5727 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5728 alternate IO mechanisms via the PerlIO abstraction layer, but the
5729 stdio mechanism is still available if needed.  The abstraction layer
5730 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5731 Using PerlIO with sfio may cause problems with some extension modules.
5732
5733 If this doesn't make any sense to you, just accept the default '$dflt'.
5734 EOM
5735 rp='Use the PerlIO abstraction layer?'
5736 . ./myread
5737 case "$ans" in
5738 y|Y) 
5739         val="$define"
5740         ;;
5741 *)      
5742         echo "Ok, doing things the stdio way."
5743         val="$undef"
5744         ;;
5745 esac
5746 set useperlio
5747 eval $setvar 
5748
5749 case "$usesocks" in
5750 $define|true|[yY]*)
5751         case "$useperlio" in
5752         $define|true|[yY]*) ;;
5753         *)      cat >&4 <<EOM
5754
5755 You are using the SOCKS proxy protocol library which means that you
5756 should also use the PerlIO layer.  You may be headed for trouble.
5757
5758 EOM
5759                 ;;
5760         esac
5761         ;;
5762 esac
5763
5764         
5765 : determine the architecture name
5766 echo " "
5767 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5768         tarch=`arch`"-$osname"
5769 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5770         if uname -m > tmparch 2>&1 ; then
5771                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5772                         -e 's/$/'"-$osname/" tmparch`
5773         else
5774                 tarch="$osname"
5775         fi
5776         $rm -f tmparch
5777 else
5778         tarch="$osname"
5779 fi
5780 case "$myarchname" in
5781 ''|"$tarch") ;;
5782 *)
5783         echo "(Your architecture name used to be $myarchname.)"
5784         archname=''
5785         ;;
5786 esac
5787 myarchname="$tarch"
5788 case "$archname" in
5789 '') dflt="$tarch";;
5790 *) dflt="$archname";;
5791 esac
5792 rp='What is your architecture name'
5793 . ./myread
5794 archname="$ans"
5795 case "$usethreads" in
5796 $define)
5797         echo "Threads selected." >&4
5798         case "$archname" in
5799         *-thread*) echo "...and architecture name already has -thread." >&4
5800                 ;;
5801         *)      archname="$archname-thread"
5802                 echo "...setting architecture name to $archname." >&4
5803                 ;;
5804         esac
5805         ;;
5806 esac
5807 case "$usemultiplicity" in
5808 $define)
5809         echo "Multiplicity selected." >&4
5810         case "$archname" in
5811         *-multi*) echo "...and architecture name already has -multi." >&4
5812                 ;;
5813         *)      archname="$archname-multi"
5814                 echo "...setting architecture name to $archname." >&4
5815                 ;;
5816         esac
5817         ;;
5818 esac
5819 case "$use64bitint$use64bitall" in
5820 *"$define"*)
5821         case "$archname64" in
5822         '')
5823                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5824                 ;;
5825         *)
5826                 case "$use64bitint" in
5827                 "$define") echo "64 bit integers selected." >&4 ;;
5828                 esac
5829                 case "$use64bitall" in
5830                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5831                 esac
5832                 case "$archname" in
5833                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5834                         ;;
5835                 *)      archname="$archname-$archname64"
5836                         echo "...setting architecture name to $archname." >&4
5837                         ;;
5838                 esac
5839                 ;;
5840         esac
5841 esac
5842 case "$uselongdouble" in
5843 $define)
5844         echo "Long doubles selected." >&4
5845         case "$longdblsize" in
5846         $doublesize)
5847                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5848                 ;;
5849         *)
5850                 case "$archname" in
5851                 *-ld*) echo "...and architecture name already has -ld." >&4
5852                         ;;
5853                 *)      archname="$archname-ld"
5854                         echo "...setting architecture name to $archname." >&4
5855                         ;;
5856                 esac
5857                 ;;
5858         esac
5859         ;;
5860 esac
5861 case "$useperlio" in
5862 $define)
5863         echo "Perlio selected." >&4
5864         ;;
5865 *)
5866         echo "Perlio not selected, using stdio." >&4
5867         case "$archname" in
5868         *-stdio*) echo "...and architecture name already has -stdio." >&4
5869                 ;;
5870         *)      archname="$archname-stdio"
5871                 echo "...setting architecture name to $archname." >&4
5872                 ;;
5873         esac
5874         ;;
5875 esac
5876
5877 : determine root of directory hierarchy where package will be installed.
5878 case "$prefix" in
5879 '')
5880         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5881         ;;
5882 *)
5883         dflt="$prefix"
5884         ;;
5885 esac
5886 $cat <<EOM
5887
5888 By default, $package will be installed in $dflt/bin, manual pages
5889 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5890 installation directories. Typically this is something like /usr/local.
5891 If you wish to have binaries under /usr/bin but other parts of the
5892 installation under /usr/local, that's ok: you will be prompted
5893 separately for each of the installation directories, the prefix being
5894 only used to set the defaults.
5895
5896 EOM
5897 fn=d~
5898 rp='Installation prefix to use?'
5899 . ./getfile
5900 oldprefix=''
5901 case "$prefix" in
5902 '') ;;
5903 *)
5904         case "$ans" in
5905         "$prefix") ;;
5906         *) oldprefix="$prefix";;
5907         esac
5908         ;;
5909 esac
5910 prefix="$ans"
5911 prefixexp="$ansexp"
5912
5913 : is AFS running?
5914 echo " "
5915 case "$afs" in
5916 $define|true)   afs=true ;;
5917 $undef|false)   afs=false ;;
5918 *)      if test -d /afs; then
5919                 afs=true
5920         else
5921                 afs=false
5922         fi
5923         ;;
5924 esac
5925 if $afs; then
5926         echo "AFS may be running... I'll be extra cautious then..." >&4
5927 else
5928         echo "AFS does not seem to be running..." >&4
5929 fi
5930
5931 : determine installation prefix for where package is to be installed.
5932 if $afs; then 
5933 $cat <<EOM
5934
5935 Since you are running AFS, I need to distinguish the directory in which
5936 files will reside from the directory in which they are installed (and from
5937 which they are presumably copied to the former directory by occult means).
5938
5939 EOM
5940         case "$installprefix" in
5941         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5942         *) dflt="$installprefix";;
5943         esac
5944 else
5945 $cat <<EOM
5946
5947 In some special cases, particularly when building $package for distribution,
5948 it is convenient to distinguish between the directory in which files should 
5949 be installed from the directory ($prefix) in which they 
5950 will eventually reside.  For most users, these two directories are the same.
5951
5952 EOM
5953         case "$installprefix" in
5954         '') dflt=$prefix ;;
5955         *) dflt=$installprefix;;
5956         esac
5957 fi
5958 fn=d~
5959 rp='What installation prefix should I use for installing files?'
5960 . ./getfile
5961 installprefix="$ans"
5962 installprefixexp="$ansexp"
5963
5964 : set the prefixit variable, to compute a suitable default value
5965 prefixit='case "$3" in
5966 ""|none)
5967         case "$oldprefix" in
5968         "") eval "$1=\"\$$2\"";;
5969         *)
5970                 case "$3" in
5971                 "") eval "$1=";;
5972                 none)
5973                         eval "tp=\"\$$2\"";
5974                         case "$tp" in
5975                         ""|" ") eval "$1=\"\$$2\"";;
5976                         *) eval "$1=";;
5977                         esac;;
5978                 esac;;
5979         esac;;
5980 *)
5981         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5982         case "$tp" in
5983         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5984         /*-$oldprefix/*|\~*-$oldprefix/*)
5985                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5986         *) eval "$1=\"\$$2\"";;
5987         esac;;
5988 esac'
5989
5990
5991 : get the patchlevel
5992 echo " "
5993 echo "Getting the current patchlevel..." >&4
5994 if $test -r $rsrc/patchlevel.h;then
5995         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5996         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5997         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5998         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5999         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6000         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6001 else
6002         revision=0
6003         patchlevel=0
6004         subversion=0
6005         api_revision=0
6006         api_version=0
6007         api_subversion=0
6008 fi
6009 $echo "(You have $package version $patchlevel subversion $subversion.)"
6010 case "$osname" in
6011 dos|vms)
6012         : XXX Should be a Configure test for double-dots in filenames.
6013         version=`echo $revision $patchlevel $subversion | \
6014                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6015         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6016                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6017         ;;
6018 *)
6019         version=`echo $revision $patchlevel $subversion | \
6020                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6021         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6022                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6023         ;;
6024 esac
6025 : Special case the 5.005_xx maintenance series, which used 5.005
6026 : without any subversion label as a subdirectory in $sitelib
6027 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6028         api_versionstring='5.005'
6029 fi
6030
6031 : determine installation style
6032 : For now, try to deduce it from prefix unless it is already set.
6033 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6034 case "$installstyle" in
6035 '')     case "$prefix" in
6036                 *perl*) dflt='lib';;
6037                 *) dflt='lib/perl5' ;;
6038         esac
6039         ;;
6040 *)      dflt="$installstyle" ;;
6041 esac
6042 : Probably not worth prompting for this since we prompt for all
6043 : the directories individually, and the prompt would be too long and
6044 : confusing anyway.
6045 installstyle=$dflt
6046
6047 : determine where private library files go
6048 : Usual default is /usr/local/lib/perl5/$version.
6049 : Also allow things like /opt/perl/lib/$version, since 
6050 : /opt/perl/lib/perl5... would be redundant.
6051 : The default "style" setting is made in installstyle.U
6052 case "$installstyle" in
6053 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6054 *)       set dflt privlib lib/$version ;;
6055 esac
6056 eval $prefixit
6057 $cat <<EOM
6058
6059 There are some auxiliary files for $package that need to be put into a
6060 private library directory that is accessible by everyone.
6061
6062 EOM
6063 fn=d~+
6064 rp='Pathname where the private library files will reside?'
6065 . ./getfile
6066 privlib="$ans"
6067 privlibexp="$ansexp"
6068 : Change installation prefix, if necessary.
6069 if $test X"$prefix" != X"$installprefix"; then
6070         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6071 else
6072         installprivlib="$privlibexp"
6073 fi
6074
6075 : set the prefixup variable, to restore leading tilda escape
6076 prefixup='case "$prefixexp" in
6077 "$prefix") ;;
6078 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6079 esac'
6080
6081 : determine where public architecture dependent libraries go
6082 set archlib archlib
6083 eval $prefixit
6084 : privlib default is /usr/local/lib/$package/$version
6085 : archlib default is /usr/local/lib/$package/$version/$archname
6086 : privlib may have an optional trailing /share.
6087 tdflt=`echo $privlib | $sed 's,/share$,,'`
6088 tdflt=$tdflt/$archname
6089 case "$archlib" in
6090 '')     dflt=$tdflt
6091         ;;
6092 *)      dflt="$archlib"
6093     ;;
6094 esac
6095 $cat <<EOM
6096
6097 $spackage contains architecture-dependent library files.  If you are
6098 sharing libraries in a heterogeneous environment, you might store
6099 these files in a separate location.  Otherwise, you can just include
6100 them with the rest of the public library files.
6101
6102 EOM
6103 fn=d+~
6104 rp='Where do you want to put the public architecture-dependent libraries?'
6105 . ./getfile
6106 archlib="$ans"
6107 archlibexp="$ansexp"
6108 if $test X"$archlib" = X"$privlib"; then
6109         d_archlib="$undef"
6110 else
6111         d_archlib="$define"
6112 fi
6113 : Change installation prefix, if necessary.
6114 if $test X"$prefix" != X"$installprefix"; then
6115         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6116 else
6117         installarchlib="$archlibexp"
6118 fi
6119
6120
6121 : Binary compatibility with 5.005 is not possible for builds
6122 : with advanced features
6123 case "$usethreads$usemultiplicity" in
6124 *define*)
6125         bincompat5005="$undef"
6126         d_bincompat5005="$undef"
6127         ;;
6128 *)      $cat <<EOM
6129
6130 This version of Perl can be compiled for binary compatibility with 5.005.
6131 If you decide to do so, you will be able to continue using most of the
6132 extensions that were compiled for Perl 5.005.
6133
6134 EOM
6135         case "$bincompat5005$d_bincompat5005" in
6136         *"$undef"*) dflt=n ;;
6137         *) dflt=y ;;
6138         esac
6139         rp='Binary compatibility with Perl 5.005?'
6140         . ./myread
6141         case "$ans" in
6142         y*) val="$define" ;;
6143         *)  val="$undef" ;;
6144         esac
6145         set d_bincompat5005
6146         eval $setvar
6147         case "$d_bincompat5005" in
6148         "$define")
6149                 bincompat5005="$define"
6150                 ;;
6151         *)      bincompat5005="$undef"
6152                 d_bincompat5005="$undef"
6153                 ;;
6154         esac
6155         ;;
6156 esac
6157
6158
6159 : see if setuid scripts can be secure
6160 $cat <<EOM
6161
6162 Some kernels have a bug that prevents setuid #! scripts from being
6163 secure.  Some sites have disabled setuid #! scripts because of this.
6164
6165 First let's decide if your kernel supports secure setuid #! scripts.
6166 (If setuid #! scripts would be secure but have been disabled anyway,
6167 don't say that they are secure if asked.)
6168
6169 EOM
6170
6171 val="$undef"
6172 if $test -d /dev/fd; then
6173         echo "#!$ls" >reflect
6174         chmod +x,u+s reflect
6175         ./reflect >flect 2>&1
6176         if $contains "/dev/fd" flect >/dev/null; then
6177                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6178                 val="$define"
6179         else
6180                 $cat <<EOM
6181 If you are not sure if they are secure, I can check but I'll need a
6182 username and password different from the one you are using right now.
6183 If you don't have such a username or don't want me to test, simply
6184 enter 'none'.
6185
6186 EOM
6187                 rp='Other username to test security of setuid scripts with?'
6188                 dflt='none'
6189                 . ./myread
6190                 case "$ans" in
6191                 n|none)
6192                         case "$d_suidsafe" in
6193                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6194                                 dflt=n;;
6195                         "$undef")
6196                                 echo "Well, the $hint value is *not* secure." >&4
6197                                 dflt=n;;
6198                         *)      echo "Well, the $hint value *is* secure." >&4
6199                                 dflt=y;;
6200                         esac
6201                         ;;
6202                 *)
6203                         $rm -f reflect flect
6204                         echo "#!$ls" >reflect
6205                         chmod +x,u+s reflect
6206                         echo >flect
6207                         chmod a+w flect
6208                         echo '"su" will (probably) prompt you for '"$ans's password."
6209                         su $ans -c './reflect >flect'
6210                         if $contains "/dev/fd" flect >/dev/null; then
6211                                 echo "Okay, it looks like setuid scripts are secure." >&4
6212                                 dflt=y
6213                         else
6214                                 echo "I don't think setuid scripts are secure." >&4
6215                                 dflt=n
6216                         fi
6217                         ;;
6218                 esac
6219                 rp='Does your kernel have *secure* setuid scripts?'
6220                 . ./myread
6221                 case "$ans" in
6222                 [yY]*)  val="$define";;
6223                 *)      val="$undef";;
6224                 esac
6225         fi
6226 else
6227         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6228         echo "(That's for file descriptors, not floppy disks.)"
6229         val="$undef"
6230 fi
6231 set d_suidsafe
6232 eval $setvar
6233
6234 $rm -f reflect flect
6235
6236 : now see if they want to do setuid emulation
6237 echo " "
6238 val="$undef"
6239 case "$d_suidsafe" in
6240 "$define")
6241         val="$undef"
6242         echo "No need to emulate SUID scripts since they are secure here." >& 4
6243         ;;
6244 *)
6245         $cat <<EOM
6246 Some systems have disabled setuid scripts, especially systems where
6247 setuid scripts cannot be secure.  On systems where setuid scripts have
6248 been disabled, the setuid/setgid bits on scripts are currently
6249 useless.  It is possible for $package to detect those bits and emulate
6250 setuid/setgid in a secure fashion.  This emulation will only work if
6251 setuid scripts have been disabled in your kernel.
6252
6253 EOM
6254         case "$d_dosuid" in
6255         "$define") dflt=y ;;
6256         *) dflt=n ;;
6257         esac
6258         rp="Do you want to do setuid/setgid emulation?"
6259         . ./myread
6260         case "$ans" in
6261         [yY]*)  val="$define";;
6262         *)      val="$undef";;
6263         esac
6264         ;;
6265 esac
6266 set d_dosuid
6267 eval $setvar
6268
6269 : see if this is a malloc.h system
6270 set malloc.h i_malloc
6271 eval $inhdr
6272
6273 : see if stdlib is available
6274 set stdlib.h i_stdlib
6275 eval $inhdr
6276
6277 : determine which malloc to compile in
6278 echo " "
6279 case "$usemymalloc" in
6280 ''|[yY]*|true|$define)  dflt='y' ;;
6281 *)      dflt='n' ;;
6282 esac
6283 case "$ptrsize" in
6284 4) ;;
6285 *) dflt='n' ;;
6286 esac
6287 rp="Do you wish to attempt to use the malloc that comes with $package?"
6288 . ./myread
6289 usemymalloc="$ans"
6290 case "$ans" in
6291 y*|true)
6292         usemymalloc='y'
6293         mallocsrc='malloc.c'
6294         mallocobj="malloc$_o"
6295         d_mymalloc="$define"
6296         case "$libs" in
6297         *-lmalloc*)
6298                 : Remove malloc from list of libraries to use
6299                 echo "Removing unneeded -lmalloc from library list" >&4
6300                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6301                 shift
6302                 libs="$*"
6303                 echo "libs = $libs" >&4
6304                 ;;
6305         esac
6306         ;;
6307 *)
6308         usemymalloc='n'
6309         mallocsrc=''
6310         mallocobj=''
6311         d_mymalloc="$undef"
6312         ;;
6313 esac
6314
6315 : compute the return types of malloc and free
6316 echo " "
6317 $cat >malloc.c <<END
6318 #$i_malloc I_MALLOC
6319 #$i_stdlib I_STDLIB
6320 #include <stdio.h>
6321 #include <sys/types.h>
6322 #ifdef I_MALLOC
6323 #include <malloc.h>
6324 #endif
6325 #ifdef I_STDLIB
6326 #include <stdlib.h>
6327 #endif
6328 #ifdef TRY_MALLOC
6329 void *malloc();
6330 #endif
6331 #ifdef TRY_FREE
6332 void free();
6333 #endif
6334 END
6335 case "$malloctype" in
6336 '')
6337         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6338                 malloctype='void *'
6339         else
6340                 malloctype='char *'
6341         fi
6342         ;;
6343 esac
6344 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6345
6346 case "$freetype" in
6347 '')
6348         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6349                 freetype='void'
6350         else
6351                 freetype='int'
6352         fi
6353         ;;
6354 esac
6355 echo "Your system uses $freetype free(), it would seem." >&4
6356 $rm -f malloc.[co]
6357 $cat <<EOM
6358
6359 After $package is installed, you may wish to install various
6360 add-on modules and utilities.  Typically, these add-ons will
6361 be installed under $prefix with the rest
6362 of this package.  However, you may wish to install such add-ons
6363 elsewhere under a different prefix.
6364
6365 If you do not wish to put everything under a single prefix, that's
6366 ok.  You will be prompted for the individual locations; this siteprefix
6367 is only used to suggest the defaults.
6368
6369 The default should be fine for most people.
6370
6371 EOM
6372 fn=d~+
6373 rp='Installation prefix to use for add-on modules and utilities?'
6374 : XXX Here might be another good place for an installstyle setting.
6375 case "$siteprefix" in
6376 '') dflt=$prefix ;;
6377 *)  dflt=$siteprefix ;;
6378 esac
6379 . ./getfile
6380 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6381 oldsiteprefix=''
6382 case "$siteprefix" in
6383 '') ;;
6384 *)      case "$ans" in
6385         "$prefix") ;;
6386         *) oldsiteprefix="$prefix";;
6387         esac
6388         ;;
6389 esac
6390 siteprefix="$ans"
6391 siteprefixexp="$ansexp"
6392
6393 : determine where site specific libraries go.
6394 : Usual default is /usr/local/lib/perl5/site_perl/$version
6395 : The default "style" setting is made in installstyle.U
6396 : XXX No longer works with Prefixit stuff.
6397 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6398 case "$sitelib" in
6399 '') case "$installstyle" in
6400         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6401         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6402         esac
6403         ;;
6404 *)      dflt="$sitelib"
6405         ;;
6406 esac
6407 $cat <<EOM
6408
6409 The installation process will create a directory for
6410 site-specific extensions and modules.  Most users find it convenient
6411 to place all site-specific files in this directory rather than in the
6412 main distribution directory.
6413
6414 EOM
6415 fn=d~+
6416 rp='Pathname for the site-specific library files?'
6417 . ./getfile
6418 sitelib="$ans"
6419 sitelibexp="$ansexp"
6420 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6421 : Change installation prefix, if necessary.
6422 if $test X"$prefix" != X"$installprefix"; then
6423         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6424 else
6425         installsitelib="$sitelibexp"
6426 fi
6427
6428 : determine where site specific architecture-dependent libraries go.
6429 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6430 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6431 : sitelib may have an optional trailing /share.
6432 case "$sitearch" in
6433 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6434         dflt="$dflt/$archname"
6435         ;;
6436 *)      dflt="$sitearch"
6437         ;;
6438 esac
6439 set sitearch sitearch none
6440 eval $prefixit
6441 $cat <<EOM
6442
6443 The installation process will also create a directory for
6444 architecture-dependent site-specific extensions and modules.
6445
6446 EOM
6447 fn=d~+
6448 rp='Pathname for the site-specific architecture-dependent library files?'
6449 . ./getfile
6450 sitearch="$ans"
6451 sitearchexp="$ansexp"
6452 : Change installation prefix, if necessary.
6453 if $test X"$prefix" != X"$installprefix"; then
6454         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6455 else
6456         installsitearch="$sitearchexp"
6457 fi
6458
6459 $cat <<EOM
6460
6461 The installation process will also create a directory for
6462 vendor-supplied add-ons.  Vendors who supply perl with their system
6463 may find it convenient to place all vendor-supplied files in this
6464 directory rather than in the main distribution directory.  This will
6465 ease upgrades between binary-compatible maintenance versions of perl.
6466
6467 Of course you may also use these directories in whatever way you see
6468 fit.  For example, you might use them to access modules shared over a
6469 company-wide network.
6470
6471 The default answer should be fine for most people.
6472 This causes further questions about vendor add-ons to be skipped
6473 and no vendor-specific directories will be configured for perl.
6474
6475 EOM
6476 rp='Do you want to configure vendor-specific add-on directories?'
6477 case "$usevendorprefix" in
6478 define|true|[yY]*) dflt=y ;;
6479 *)      : User may have set vendorprefix directly on Configure command line.
6480         case "$vendorprefix" in
6481         ''|' ') dflt=n ;;
6482         *)      dflt=y ;;
6483         esac
6484         ;;
6485 esac
6486 . ./myread
6487 case "$ans" in
6488 [yY]*)  fn=d~+
6489         rp='Installation prefix to use for vendor-supplied add-ons?'
6490         case "$vendorprefix" in
6491         '') dflt='' ;;
6492         *)  dflt=$vendorprefix ;;
6493         esac
6494         . ./getfile
6495         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6496         oldvendorprefix=''
6497         case "$vendorprefix" in
6498         '') ;;
6499         *)      case "$ans" in
6500                 "$prefix") ;;
6501                 *) oldvendorprefix="$prefix";;
6502                 esac
6503                 ;;
6504         esac
6505         usevendorprefix="$define"
6506         vendorprefix="$ans"
6507         vendorprefixexp="$ansexp"
6508         ;;
6509 *)      usevendorprefix="$undef"
6510         vendorprefix=''
6511         vendorprefixexp=''
6512         ;;
6513 esac
6514
6515 case "$vendorprefix" in
6516 '')     d_vendorlib="$undef"
6517         vendorlib=''
6518         vendorlibexp=''
6519         ;;
6520 *)      d_vendorlib="$define"
6521         : determine where vendor-supplied modules go.
6522         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6523         case "$vendorlib" in
6524         '')
6525                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6526                 case "$installstyle" in
6527                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6528                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6529                 esac
6530                 ;;
6531         *)      dflt="$vendorlib"
6532                 ;;
6533         esac
6534         fn=d~+
6535         rp='Pathname for the vendor-supplied library files?'
6536         . ./getfile
6537         vendorlib="$ans"
6538         vendorlibexp="$ansexp"
6539         ;;
6540 esac
6541 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6542 : Change installation prefix, if necessary.
6543 if $test X"$prefix" != X"$installprefix"; then
6544         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6545 else
6546         installvendorlib="$vendorlibexp"
6547 fi
6548
6549 case "$vendorprefix" in
6550 '')     d_vendorarch="$undef"
6551         vendorarch=''
6552         vendorarchexp=''
6553         ;;
6554 *)      d_vendorarch="$define"
6555         : determine where vendor-supplied architecture-dependent libraries go.
6556         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6557         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6558         : vendorlib may have an optional trailing /share.
6559         case "$vendorarch" in
6560         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6561                 dflt="$dflt/$archname"
6562                 ;;
6563         *)      dflt="$vendorarch" ;;
6564         esac
6565         fn=d~+
6566         rp='Pathname for vendor-supplied architecture-dependent files?'
6567         . ./getfile
6568         vendorarch="$ans"
6569         vendorarchexp="$ansexp"
6570         ;;
6571 esac
6572 : Change installation prefix, if necessary.
6573 if $test X"$prefix" != X"$installprefix"; then
6574         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6575 else
6576         installvendorarch="$vendorarchexp"
6577 fi
6578
6579 : Final catch-all directories to search
6580 $cat <<EOM
6581
6582 Lastly, you can have perl look in other directories for extensions and
6583 modules in addition to those already specified.
6584 These directories will be searched after 
6585         $sitearch 
6586         $sitelib 
6587 EOM
6588 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6589 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6590 echo ' '
6591 case "$otherlibdirs" in
6592 ''|' ') dflt='none' ;;
6593 *)      dflt="$otherlibdirs" ;;
6594 esac
6595 $cat <<EOM
6596 Enter a colon-separated set of extra paths to include in perl's @INC
6597 search path, or enter 'none' for no extra paths.
6598
6599 EOM
6600
6601 rp='Colon-separated list of additional directories for perl to search?'
6602 . ./myread
6603 case "$ans" in
6604 ' '|''|none)    otherlibdirs=' ' ;;     
6605 *)      otherlibdirs="$ans" ;;
6606 esac
6607 case "$otherlibdirs" in
6608 ' ') val=$undef ;;
6609 *)      val=$define ;;
6610 esac
6611 set d_perl_otherlibdirs
6612 eval $setvar
6613
6614 : Cruising for prototypes
6615 echo " "
6616 echo "Checking out function prototypes..." >&4
6617 $cat >prototype.c <<'EOCP'
6618 int main(int argc, char *argv[]) {
6619         exit(0);}
6620 EOCP
6621 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6622         echo "Your C compiler appears to support function prototypes."
6623         val="$define"
6624 else
6625         echo "Your C compiler doesn't seem to understand function prototypes."
6626         val="$undef"
6627 fi
6628 set prototype
6629 eval $setvar
6630 $rm -f prototype*
6631
6632 case "$prototype" in
6633 "$define") ;;
6634 *)      ansi2knr='ansi2knr'
6635         echo " "
6636         cat <<EOM >&4
6637
6638 $me:  FATAL ERROR:
6639 This version of $package can only be compiled by a compiler that 
6640 understands function prototypes.  Unfortunately, your C compiler 
6641         $cc $ccflags
6642 doesn't seem to understand them.  Sorry about that.
6643
6644 If GNU cc is available for your system, perhaps you could try that instead.  
6645
6646 Eventually, we hope to support building Perl with pre-ANSI compilers.
6647 If you would like to help in that effort, please contact <perlbug@perl.org>.
6648
6649 Aborting Configure now.
6650 EOM
6651         exit 2
6652         ;;
6653 esac
6654
6655 : determine where public executables go
6656 echo " "
6657 set dflt bin bin
6658 eval $prefixit
6659 fn=d~
6660 rp='Pathname where the public executables will reside?'
6661 . ./getfile
6662 if $test "X$ansexp" != "X$binexp"; then
6663         installbin=''
6664 fi
6665 bin="$ans"
6666 binexp="$ansexp"
6667 : Change installation prefix, if necessary.
6668 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6669 if $test X"$prefix" != X"$installprefix"; then
6670         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6671 else
6672         installbin="$binexp"
6673 fi
6674
6675 : Find perl5.005 or later.
6676 echo "Looking for a previously installed perl5.005 or later... "
6677 case "$perl5" in
6678 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6679                 : Check if this perl is recent and can load a simple module
6680                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6681                         perl5=$tdir/perl
6682                         break;
6683                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6684                         perl5=$tdir/perl
6685                         break;
6686                 fi
6687         done
6688         ;;
6689 *)      perl5="$perl5"
6690         ;;
6691 esac
6692 case "$perl5" in
6693 '')     echo "None found.  That's ok.";;
6694 *)      echo "Using $perl5." ;;
6695 esac
6696
6697 : Determine list of previous versions to include in @INC
6698 $cat > getverlist <<EOPL
6699 #!$perl5 -w
6700 use File::Basename;
6701 \$api_versionstring = "$api_versionstring";
6702 \$version = "$version";
6703 \$stem = "$sitelib_stem";
6704 \$archname = "$archname";
6705 EOPL
6706         $cat >> getverlist <<'EOPL'
6707 # Can't have leading @ because metaconfig interprets it as a command!
6708 ;@inc_version_list=();
6709 # XXX Redo to do opendir/readdir? 
6710 if (-d $stem) {
6711     chdir($stem);
6712     ;@candidates = glob("5.*");
6713 }
6714 else {
6715     ;@candidates = ();
6716 }
6717
6718 # XXX ToDo:  These comparisons must be reworked when two-digit
6719 # subversions come along, so that 5.7.10 compares as greater than
6720 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6721 # widespread that we can use the built-in version vectors rather
6722 # than reinventing them here.  For 5.6.0, however, we must
6723 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6724 foreach $d (@candidates) {
6725     if ($d lt $version) {
6726         if ($d ge $api_versionstring) {
6727             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6728         }
6729         elsif ($d ge "5.005") {
6730             unshift(@inc_version_list, grep { -d } $d);
6731         }
6732     }
6733     else {
6734         # Skip newer version.  I.e. don't look in
6735         # 5.7.0 if we're installing 5.6.1.
6736     }
6737 }
6738
6739 if (@inc_version_list) {
6740     print join(' ', @inc_version_list);
6741 }
6742 else {
6743     # Blank space to preserve value for next Configure run.
6744     print " ";
6745 }
6746 EOPL
6747 chmod +x getverlist
6748 case "$inc_version_list" in
6749 '')     if test -x "$perl5"; then
6750                 dflt=`$perl5 getverlist`
6751         else
6752                 dflt='none'
6753         fi
6754         ;;
6755 $undef) dflt='none' ;;
6756 *)  dflt="$inc_version_list" ;;
6757 esac
6758 case "$dflt" in
6759 ''|' ') dflt=none ;;
6760 esac
6761 case "$dflt" in
6762 5.005) case "$bincompat5005" in
6763        $define|true|[yY]*) ;;
6764        *) dflt=none ;;
6765        esac
6766        ;;
6767 esac
6768 $cat <<'EOM'
6769
6770 In order to ease the process of upgrading, this version of perl 
6771 can be configured to use modules built and installed with earlier 
6772 versions of perl that were installed under $prefix.  Specify here
6773 the list of earlier versions that this version of perl should check.
6774 If Configure detected no earlier versions of perl installed under
6775 $prefix, then the list will be empty.  Answer 'none' to tell perl
6776 to not search earlier versions.
6777
6778 The default should almost always be sensible, so if you're not sure,
6779 just accept the default.
6780 EOM
6781
6782 rp='List of earlier versions to include in @INC?'
6783 . ./myread
6784 case "$ans" in
6785 [Nn]one|''|' ') inc_version_list=' ' ;;
6786 *) inc_version_list="$ans" ;;
6787 esac
6788 case "$inc_version_list" in
6789 ''|' ') 
6790         inc_version_list_init='0';;
6791 *)      inc_version_list_init=`echo $inc_version_list |
6792                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6793         ;;
6794 esac
6795 $rm -f getverlist
6796
6797 : determine whether to install perl also as /usr/bin/perl
6798
6799 echo " "
6800 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6801         $cat <<EOM
6802 Many scripts expect perl to be installed as /usr/bin/perl.
6803 I can install the perl you are about to compile also as /usr/bin/perl
6804 (in addition to $installbin/perl).
6805 EOM
6806         case "$installusrbinperl" in
6807         "$undef"|[nN]*) dflt='n';;
6808         *)              dflt='y';;
6809         esac
6810         rp="Do you want to install perl as /usr/bin/perl?"
6811         . ./myread
6812         case "$ans" in
6813         [yY]*)  val="$define";;
6814         *)      val="$undef" ;;
6815         esac
6816 else
6817         val="$undef"
6818 fi
6819 set installusrbinperl
6820 eval $setvar
6821
6822 : see if dld is available
6823 set dld.h i_dld
6824 eval $inhdr
6825
6826 : see if dlopen exists
6827 xxx_runnm="$runnm"
6828 runnm=false
6829 set dlopen d_dlopen
6830 eval $inlibc
6831 runnm="$xxx_runnm"
6832
6833 : determine which dynamic loading, if any, to compile in
6834 echo " "
6835 dldir="ext/DynaLoader"
6836 case "$usedl" in
6837 $define|y|true)
6838         dflt='y'
6839         usedl="$define"
6840         ;;
6841 $undef|n|false)
6842         dflt='n'
6843         usedl="$undef"
6844         ;;
6845 *) 
6846         dflt='n'
6847         case "$d_dlopen" in
6848             $define) dflt='y' ;;
6849         esac
6850         case "$i_dld" in
6851             $define) dflt='y' ;;
6852         esac
6853         : Does a dl_xxx.xs file exist for this operating system
6854         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6855         ;;
6856 esac
6857 rp="Do you wish to use dynamic loading?"
6858 . ./myread
6859 usedl="$ans"
6860 case "$ans" in
6861 y*) usedl="$define"
6862         case "$dlsrc" in
6863         '')
6864                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6865                         dflt="$dldir/dl_${osname}.xs"
6866                 elif $test "$d_dlopen" = "$define" ; then
6867                         dflt="$dldir/dl_dlopen.xs"
6868                 elif $test "$i_dld" = "$define" ; then
6869                         dflt="$dldir/dl_dld.xs"
6870                 else
6871                         dflt=''
6872                 fi
6873                 ;;
6874         *)      dflt="$dldir/$dlsrc"
6875                 ;;
6876         esac
6877     echo "The following dynamic loading files are available:"
6878         : Can not go over to $dldir because getfile has path hard-coded in.
6879         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6880         rp="Source file to use for dynamic loading"
6881         fn="fne"
6882         gfpth="$src"
6883         . ./getfile
6884         usedl="$define"
6885         : emulate basename
6886         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6887
6888         $cat << EOM
6889
6890 Some systems may require passing special flags to $cc -c to
6891 compile modules that will be used to create a shared library.
6892 To use no flags, say "none".
6893
6894 EOM
6895     case "$cccdlflags" in
6896     '') case "$gccversion" in
6897                 '') case "$osname" in
6898                         hpux)   dflt='+z' ;;
6899                         next)   dflt='none' ;;
6900                         irix*)  dflt='-KPIC' ;;
6901                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6902                         sunos)  dflt='-pic' ;;
6903                         *)      dflt='none' ;;
6904                     esac
6905                         ;;
6906                 *)  case "$osname" in
6907                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6908                         *)      dflt='-fpic' ;;
6909                     esac ;;
6910             esac ;;
6911         ' ') dflt='none' ;;
6912     *)  dflt="$cccdlflags" ;;
6913     esac
6914     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6915     . ./myread
6916     case "$ans" in
6917     none) cccdlflags=' ' ;;
6918     *) cccdlflags="$ans" ;;
6919     esac
6920
6921     cat << EOM
6922
6923 Some systems use ld to create libraries that can be dynamically loaded,
6924 while other systems (such as those using ELF) use $cc.
6925
6926 EOM
6927         case "$ld" in
6928         '')     $cat >try.c <<'EOM'
6929 /* Test for whether ELF binaries are produced */
6930 #include <fcntl.h>
6931 #include <stdlib.h>
6932 int main() {
6933         char b[4];
6934         int i = open("a.out",O_RDONLY);
6935         if(i == -1) 
6936                 exit(1); /* fail */
6937         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6938                 exit(0); /* succeed (yes, it's ELF) */
6939         else
6940                 exit(1); /* fail */
6941 }
6942 EOM
6943                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6944                         cat <<EOM
6945 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6946 EOM
6947                         dflt="$cc"
6948                 else
6949                         echo "I'll use ld to build dynamic libraries."
6950                         dflt='ld'
6951                 fi
6952                 rm -f try.c a.out
6953                 ;;
6954         *)      dflt="$ld"
6955                 ;;
6956         esac
6957
6958     rp="What command should be used to create dynamic libraries?"
6959     . ./myread
6960         ld="$ans"
6961
6962     cat << EOM
6963
6964 Some systems may require passing special flags to $ld to create a
6965 library that can be dynamically loaded.  If your ld flags include
6966 -L/other/path options to locate libraries outside your loader's normal
6967 search path, you may need to specify those -L options here as well.  To
6968 use no flags, say "none".
6969
6970 EOM
6971     case "$lddlflags" in
6972     '') case "$osname" in
6973                         beos) dflt='-nostart' ;;
6974                         hpux) dflt='-b';
6975                               case "$gccversion" in
6976                               '') dflt="$dflt +vnocompatwarnings" ;;
6977                               esac
6978                               ;;        
6979                         linux|irix*)    dflt='-shared' ;;
6980                         next)  dflt='none' ;;
6981                         solaris) dflt='-G' ;;
6982                         sunos) dflt='-assert nodefinitions' ;;
6983                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6984                 *)     dflt='none' ;;
6985                         esac
6986                         ;;
6987     *) dflt="$lddlflags" ;;
6988     esac
6989
6990         : Try to guess additional flags to pick up local libraries.
6991         : Be careful not to append to a plain 'none'
6992         case "$dflt" in
6993         none) dflt='' ;;
6994         esac
6995         for thisflag in $ldflags; do
6996                 case "$thisflag" in
6997                 -L*|-R*)
6998                         case " $dflt " in
6999                         *" $thisflag "*) ;;
7000                         *) dflt="$dflt $thisflag" ;;
7001                         esac
7002                         ;;
7003                 esac
7004         done
7005
7006         case "$dflt" in
7007         ''|' ') dflt='none' ;;
7008         esac
7009
7010     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7011     . ./myread
7012     case "$ans" in
7013     none) lddlflags=' ' ;;
7014     *) lddlflags="$ans" ;;
7015     esac
7016
7017         cat <<EOM
7018
7019 Some systems may require passing special flags to $cc to indicate that
7020 the resulting executable will use dynamic linking.  To use no flags,
7021 say "none".
7022
7023 EOM
7024     case "$ccdlflags" in
7025     '') case "$osname" in
7026                 hpux)   dflt='-Wl,-E' ;;
7027                 linux)  dflt='-rdynamic' ;;
7028                 next)   dflt='none' ;;
7029                 sunos)  dflt='none' ;;
7030                 *)      dflt='none' ;;
7031             esac ;;
7032     ' ')  dflt='none' ;;
7033     *)  dflt="$ccdlflags" ;;
7034     esac
7035     rp="Any special flags to pass to $cc to use dynamic linking?"
7036     . ./myread
7037     case "$ans" in
7038     none) ccdlflags=' ' ;;
7039     *) ccdlflags="$ans" ;;
7040     esac
7041     ;;
7042 *)  usedl="$undef"
7043         ld='ld'
7044     dlsrc='dl_none.xs'
7045     lddlflags=''
7046     ccdlflags=''
7047     ;;
7048 esac
7049
7050 also=''
7051 case "$usedl" in
7052 $undef)
7053         # No dynamic loading being used, so don't bother even to prompt.
7054         useshrplib='false'
7055         ;;
7056 *)      case "$useshrplib" in
7057         '')     case "$osname" in
7058                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7059                         dflt=y
7060                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7061                         ;;
7062                 next*)
7063                         case "$osvers" in
7064                         4*)     dflt=y
7065                                 also='Building a shared libperl is needed for MAB support.'
7066                                 ;;
7067                         *)      dflt=n
7068                                 ;;
7069                         esac
7070                         ;;
7071                 *)      dflt=n
7072                         ;;
7073                 esac
7074                 ;;
7075         $define|true|[Yy]*)
7076                 dflt=y
7077                 ;;
7078         *)      dflt=n
7079                 ;;
7080         esac
7081         $cat << EOM
7082
7083 The perl executable is normally obtained by linking perlmain.c with
7084 libperl${_a}, any static extensions (usually just DynaLoader), and
7085 any other libraries needed on this system (such as -lm, etc.).  Since
7086 your system supports dynamic loading, it is probably possible to build
7087 a shared libperl.$so.  If you will have more than one executable linked
7088 to libperl.$so, this will significantly reduce the size of each
7089 executable, but it may have a noticeable affect on performance.  The
7090 default is probably sensible for your system.
7091 $also
7092
7093 EOM
7094         rp="Build a shared libperl.$so (y/n)"
7095         . ./myread
7096         case "$ans" in
7097         true|$define|[Yy]*)
7098                 useshrplib='true'  ;;
7099         *)      useshrplib='false' ;;
7100         esac
7101         ;;
7102 esac
7103
7104 case "$useshrplib" in
7105 true)
7106         case "$libperl" in
7107         '')
7108                 # Figure out a good name for libperl.so.  Since it gets stored in
7109                 # a version-specific architecture-dependent library, the version
7110                 # number isn't really that important, except for making cc/ld happy.
7111                 #
7112                 # A name such as libperl.so.3.1
7113                 majmin="libperl.$so.$patchlevel.$subversion"
7114                 # A name such as libperl.so.301
7115                 majonly=`echo $patchlevel $subversion |
7116                         $awk '{printf "%d%02d", $1, $2}'`
7117                 majonly=libperl.$so.$majonly
7118                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7119                 # rely on figuring it out from the naming of libc.
7120                 case "${osname}${osvers}" in
7121                 next4*)
7122                         dflt=libperl.5.$so
7123                         # XXX How handle the --version stuff for MAB?
7124                         ;;
7125                 linux*)  # ld won't link with a bare -lperl otherwise.
7126                         dflt=libperl.$so
7127                         ;;
7128                 cygwin*) # include version
7129                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7130                         ;;
7131                 *)      # Try to guess based on whether libc has major.minor.
7132                         case "$libc" in
7133                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7134                         *libc.$so.[0-9]*) dflt=$majonly ;;
7135                         *)      dflt=libperl.$so ;;
7136                         esac
7137                         ;;
7138                 esac
7139                 ;;
7140         *)      dflt=$libperl
7141                 ;;
7142         esac
7143         cat << EOM
7144
7145 I need to select a good name for the shared libperl.  If your system uses
7146 library names with major and minor numbers, then you might want something
7147 like $majmin.  Alternatively, if your system uses a single version
7148 number for shared libraries, then you might want to use $majonly.
7149 Or, your system might be quite happy with a simple libperl.$so.
7150
7151 Since the shared libperl will get installed into a version-specific
7152 architecture-dependent directory, the version number of the shared perl
7153 library probably isn't important, so the default should be o.k.
7154
7155 EOM
7156         rp='What name do you want to give to the shared libperl?'
7157         . ./myread
7158         libperl=$ans
7159         echo "Ok, I'll use $libperl"
7160         ;;
7161 *)
7162         libperl="libperl${_a}"
7163         ;;
7164 esac
7165
7166 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7167 case "$shrpdir" in
7168 '') ;;
7169 *)      $cat >&4 <<EOM
7170 WARNING:  Use of the shrpdir variable for the installation location of
7171 the shared $libperl is not supported.  It was never documented and
7172 will not work in this version.  Let me (perlbug@perl.org)
7173 know of any problems this may cause.
7174
7175 EOM
7176         case "$shrpdir" in
7177         "$archlibexp/CORE")
7178                 $cat >&4 <<EOM
7179 But your current setting of $shrpdir is
7180 the default anyway, so it's harmless.
7181 EOM
7182                 ;;
7183         *)
7184                 $cat >&4 <<EOM
7185 Further, your current attempted setting of $shrpdir
7186 conflicts with the value of $archlibexp/CORE
7187 that installperl will use.
7188 EOM
7189                 ;;
7190         esac
7191         ;;
7192 esac
7193
7194 # How will the perl executable find the installed shared $libperl?
7195 # Add $xxx to ccdlflags.
7196 # If we can't figure out a command-line option, use $shrpenv to
7197 # set env LD_RUN_PATH.  The main perl makefile uses this.
7198 shrpdir=$archlibexp/CORE
7199 xxx=''
7200 tmp_shrpenv=''
7201 if "$useshrplib"; then
7202     case "$osname" in 
7203         aix)
7204                 # We'll set it in Makefile.SH...
7205                 ;;
7206         solaris|netbsd)
7207                 xxx="-R $shrpdir"
7208                 ;;
7209         freebsd)
7210                 xxx="-Wl,-R$shrpdir"
7211                 ;;
7212         linux|irix*|dec_osf)
7213                 xxx="-Wl,-rpath,$shrpdir"
7214                 ;;
7215         next)
7216                 # next doesn't like the default...
7217                 ;;
7218         beos)
7219                 # beos doesn't like the default, either.
7220                 ;;
7221         hpux*)
7222                 # hpux doesn't like the default, either.
7223                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7224                 ;;
7225         *)
7226                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7227                 ;;
7228         esac
7229         case "$xxx" in
7230         '') ;;
7231         *)      
7232                 # Only add $xxx if it isn't already in ccdlflags.
7233                 case " $ccdlflags " in
7234                 *" $xxx "*)     ;;
7235                 *)      ccdlflags="$ccdlflags $xxx"
7236                         cat <<EOM >&4
7237
7238 Adding $xxx to the flags
7239 passed to $ld so that the perl executable will find the 
7240 installed shared $libperl.
7241
7242 EOM
7243                         ;;
7244                 esac
7245                 ;;
7246         esac
7247 fi
7248 # Fix ccdlflags in AIX for building external extensions.
7249 # (For building Perl itself bare -bE:perl.exp is needed,
7250 #  Makefile.SH takes care of this.)
7251 case "$osname" in
7252 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7253 esac
7254 # Respect a hint or command-line value.
7255 case "$shrpenv" in
7256 '') shrpenv="$tmp_shrpenv" ;;
7257 esac
7258 case "$ldlibpthname" in
7259 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7260 none)   ldlibpthname='' ;;
7261 esac
7262
7263 : determine where manual pages are on this system
7264 echo " "
7265 case "$sysman" in
7266 '') 
7267         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7268         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7269         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7270         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7271         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7272         sysman=`./loc . /usr/man/man1 $syspath`
7273         ;;
7274 esac
7275 if $test -d "$sysman"; then
7276         echo "System manual is in $sysman." >&4
7277 else
7278         echo "Could not find manual pages in source form." >&4
7279 fi
7280
7281 : determine where manual pages go
7282 set man1dir man1dir none
7283 eval $prefixit
7284 $cat <<EOM
7285
7286 $spackage has manual pages available in source form.
7287 EOM
7288 case "$nroff" in
7289 nroff)
7290         echo "However, you don't have nroff, so they're probably useless to you."
7291         case "$man1dir" in
7292         '') man1dir="none";;
7293         esac;;
7294 esac
7295 echo "If you don't want the manual sources installed, answer 'none'."
7296 case "$man1dir" in
7297 ' ') dflt=none
7298         ;;
7299 '')
7300         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7301         lookpath="$lookpath $prefixexp/man/p_man/man1"
7302         lookpath="$lookpath $prefixexp/man/u_man/man1"
7303         lookpath="$lookpath $prefixexp/man/man.1"
7304         case "$sysman" in
7305         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7306         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7307         esac
7308         set dflt
7309         eval $prefixup
7310         ;;
7311 *)  dflt="$man1dir"
7312         ;;
7313 esac
7314 echo " "
7315 fn=dn+~
7316 rp="Where do the main $spackage manual pages (source) go?"
7317 . ./getfile
7318 if $test "X$man1direxp" != "X$ansexp"; then
7319         installman1dir=''
7320 fi
7321 man1dir="$ans"
7322 man1direxp="$ansexp"
7323 case "$man1dir" in
7324 '')     man1dir=' '
7325         installman1dir='';;
7326 esac
7327
7328 : Change installation prefix, if necessary.
7329 if $test X"$prefix" != X"$installprefix"; then
7330         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7331 else
7332         installman1dir="$man1direxp"
7333 fi
7334
7335 : What suffix to use on installed man pages
7336
7337 case "$man1dir" in
7338 ' ')
7339         man1ext='0'
7340         ;;
7341 *)
7342         rp="What suffix should be used for the main $spackage man pages?"
7343         case "$man1ext" in
7344         '')     case "$man1dir" in
7345                 *1)  dflt=1 ;;
7346                 *1p) dflt=1p ;;
7347                 *1pm) dflt=1pm ;;
7348                 *l) dflt=l;;
7349                 *n) dflt=n;;
7350                 *o) dflt=o;;
7351                 *p) dflt=p;;
7352                 *C) dflt=C;;
7353                 *L) dflt=L;;
7354                 *L1) dflt=L1;;
7355                 *) dflt=1;;
7356                 esac
7357                 ;;
7358         *)      dflt="$man1ext";;
7359         esac
7360         . ./myread
7361         man1ext="$ans"
7362         ;;
7363 esac
7364
7365 : see if we can have long filenames
7366 echo " "
7367 first=123456789abcdef
7368 $rm -f $first
7369 if (echo hi >$first) 2>/dev/null; then
7370         if $test -f 123456789abcde; then
7371                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7372                 val="$undef"
7373         else
7374                 echo 'You can have filenames longer than 14 characters.'>&4
7375                 val="$define"
7376         fi
7377 else
7378         $cat <<'EOM'
7379 You can't have filenames longer than 14 chars.
7380 You can't even think about them!
7381 EOM
7382         val="$undef"
7383 fi 
7384 set d_flexfnam
7385 eval $setvar
7386 $rm -rf 123456789abcde*
7387
7388 : determine where library module manual pages go
7389 set man3dir man3dir none
7390 eval $prefixit
7391 $cat <<EOM
7392
7393 $spackage has manual pages for many of the library modules.
7394 EOM
7395
7396 case "$nroff" in
7397 nroff)
7398         $cat <<'EOM'
7399 However, you don't have nroff, so they're probably useless to you.
7400 EOM
7401         case "$man3dir" in
7402         '') man3dir="none";;
7403         esac;;
7404 esac
7405
7406 case "$d_flexfnam" in
7407 undef)
7408         $cat <<'EOM'
7409 However, your system can't handle the long file names like File::Basename.3. 
7410 EOM
7411         case "$man3dir" in
7412         '') man3dir="none";;
7413         esac;;
7414 esac
7415
7416 echo "If you don't want the manual sources installed, answer 'none'."
7417 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7418 case "$man3dir" in
7419 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7420         if $test -d "$privlib/man/man3"; then
7421                 cat <<EOM >&4
7422
7423 WARNING:  Previous versions of perl installed man3 pages into
7424 $privlib/man/man3.  This version will suggest a 
7425 new default of $dflt.  
7426 EOM
7427                 tdflt=$dflt
7428                 dflt='n'
7429                 rp='Do you wish to preserve the old behavior?(y/n)'
7430                 . ./myread
7431                 case "$ans" in
7432                 y*) dflt="$privlib/man/man3" ;;
7433                 *)  dflt=$tdflt ;;
7434                 esac
7435     fi
7436         ;;
7437 *)      dflt="$man3dir" ;;
7438 esac
7439 case "$dflt" in
7440 ' ') dflt=none ;;
7441 esac
7442 echo " "
7443 fn=dn+~
7444 rp="Where do the $package library man pages (source) go?"
7445 . ./getfile
7446 man3dir="$ans"
7447 man3direxp="$ansexp"
7448 case "$man3dir" in
7449 '')     man3dir=' '
7450         installman3dir='';;
7451 esac
7452
7453 : Change installation prefix, if necessary.
7454 if $test X"$prefix" != X"$installprefix"; then
7455         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7456 else
7457         installman3dir="$man3direxp"
7458 fi
7459
7460 : What suffix to use on installed man pages
7461 case "$man3dir" in
7462 ' ')
7463         man3ext='0'
7464         ;;
7465 *)
7466         rp="What suffix should be used for the $package library man pages?"
7467         case "$man3ext" in
7468         '')     case "$man3dir" in
7469                 *3)  dflt=3 ;;
7470                 *3p) dflt=3p ;;
7471                 *3pm) dflt=3pm ;;
7472                 *l) dflt=l;;
7473                 *n) dflt=n;;
7474                 *o) dflt=o;;
7475                 *p) dflt=p;;
7476                 *C) dflt=C;;
7477                 *L) dflt=L;;
7478                 *L3) dflt=L3;;
7479                 *) dflt=3;;
7480                 esac
7481                 ;;
7482         *)      dflt="$man3ext";;
7483         esac
7484         . ./myread
7485         man3ext="$ans"
7486         ;;
7487 esac
7488
7489 : see if we have to deal with yellow pages, now NIS.
7490 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7491         if $test -f /usr/etc/nibindd; then
7492                 echo " "
7493                 echo "I'm fairly confident you're on a NeXT."
7494                 echo " "
7495                 rp='Do you get the hosts file via NetInfo?'
7496                 dflt=y
7497                 case "$hostcat" in
7498                 nidump*) ;;
7499                 '') ;;
7500                 *) dflt=n;;
7501                 esac
7502                 . ./myread
7503                 case "$ans" in
7504                 y*) hostcat='nidump hosts .';;
7505                 *)      case "$hostcat" in
7506                         nidump*) hostcat='';;
7507                         esac
7508                         ;;
7509                 esac
7510         fi
7511         case "$hostcat" in
7512         nidump*) ;;
7513         *)
7514                 case "$hostcat" in
7515                 *ypcat*) dflt=y;;
7516                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7517                                 dflt=y
7518                         else
7519                                 dflt=n
7520                         fi;;
7521                 *) dflt=n;;
7522                 esac
7523                 echo " "
7524                 rp='Are you getting the hosts file via yellow pages?'
7525                 . ./myread
7526                 case "$ans" in
7527                 y*) hostcat='ypcat hosts';;
7528                 *) hostcat='cat /etc/hosts';;
7529                 esac
7530                 ;;
7531         esac
7532 fi
7533 case "$hostcat" in
7534 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7535 esac
7536 case "$groupcat" in
7537 '') test -f /etc/group && groupcat='cat /etc/group';;
7538 esac
7539 case "$passcat" in
7540 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7541 esac
7542
7543 : now get the host name
7544 echo " "
7545 echo "Figuring out host name..." >&4
7546 case "$myhostname" in
7547 '') cont=true
7548         echo 'Maybe "hostname" will work...'
7549         if tans=`sh -c hostname 2>&1` ; then
7550                 myhostname=$tans
7551                 phostname=hostname
7552                 cont=''
7553         fi
7554         ;;
7555 *) cont='';;
7556 esac
7557 if $test "$cont"; then
7558         if ./xenix; then
7559                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7560                 if tans=`cat /etc/systemid 2>&1` ; then
7561                         myhostname=$tans
7562                         phostname='cat /etc/systemid'
7563                         echo "Whadyaknow.  Xenix always was a bit strange..."
7564                         cont=''
7565                 fi
7566         elif $test -r /etc/systemid; then
7567                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7568         fi
7569 fi
7570 if $test "$cont"; then
7571         echo 'No, maybe "uuname -l" will work...'
7572         if tans=`sh -c 'uuname -l' 2>&1` ; then
7573                 myhostname=$tans
7574                 phostname='uuname -l'
7575         else
7576                 echo 'Strange.  Maybe "uname -n" will work...'
7577                 if tans=`sh -c 'uname -n' 2>&1` ; then
7578                         myhostname=$tans
7579                         phostname='uname -n'
7580                 else
7581                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7582                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7583                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7584                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7585                         else
7586                                 case "$myhostname" in
7587                                 '') echo "Does this machine have an identity crisis or something?"
7588                                         phostname='';;
7589                                 *)
7590                                         echo "Well, you said $myhostname before..."
7591                                         phostname='echo $myhostname';;
7592                                 esac
7593                         fi
7594                 fi
7595         fi
7596 fi
7597 : you do not want to know about this
7598 set $myhostname
7599 myhostname=$1
7600
7601 : verify guess
7602 if $test "$myhostname" ; then
7603         dflt=y
7604         rp='Your host name appears to be "'$myhostname'".'" Right?"
7605         . ./myread
7606         case "$ans" in
7607         y*) ;;
7608         *) myhostname='';;
7609         esac
7610 fi
7611
7612 : bad guess or no guess
7613 while $test "X$myhostname" = X ; do
7614         dflt=''
7615         rp="Please type the (one word) name of your host:"
7616         . ./myread
7617         myhostname="$ans"
7618 done
7619
7620 : translate upper to lower if necessary
7621 case "$myhostname" in
7622 *[A-Z]*)
7623         echo "(Normalizing case in your host name)"
7624         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7625         ;;
7626 esac
7627
7628 case "$myhostname" in
7629 *.*)
7630         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7631         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7632         echo "(Trimming domain name from host name--host name is now $myhostname)"
7633         ;;
7634 *) case "$mydomain" in
7635         '')
7636                 {
7637                         test "X$hostcat" = "Xypcat hosts" &&
7638                         ypmatch "$myhostname" hosts 2>/dev/null |\
7639                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7640                         $test -s hosts
7641                 } || {
7642                         test "X$hostcat" != "X" &&
7643                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7644                                         /[       ]$myhostname[  . ]/p" > hosts
7645                 }
7646                 tmp_re="[       . ]"
7647                 if $test -f hosts; then
7648                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7649                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7650                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7651                                 hosts | $sort | $uniq | \
7652                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7653                         case `$echo X$dflt` in
7654                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7655                                 dflt=.
7656                                 ;;
7657                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7658                                 ;;
7659                         esac
7660                 else
7661                         echo "(I cannot locate a hosts database anywhere)"
7662                         dflt=.
7663                 fi
7664                 case "$dflt" in
7665                 .)
7666                         tans=`./loc resolv.conf X /etc /usr/etc`
7667                         if $test -f "$tans"; then
7668                                 echo "(Attempting domain name extraction from $tans)"
7669                                 dflt=.`$sed -n -e 's/   / /g' \
7670                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7671                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7672                                 case "$dflt" in
7673                                 .) dflt=.`$sed -n -e 's/        / /g' \
7674                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7675                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7676                                         ;;
7677                                 esac
7678                         fi
7679                         ;;
7680                 esac
7681                 case "$dflt" in
7682                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7683                         dflt=.`sh -c domainname 2>/dev/null`
7684                         case "$dflt" in
7685                         '') dflt='.';;
7686                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7687                         esac
7688                         ;;
7689                 esac
7690                 case "$dflt$osname" in
7691                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7692                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7693                         ;;
7694                 esac
7695                 case "$dflt" in
7696                 .) echo "(Lost all hope -- silly guess then)"
7697                         dflt='.uucp'
7698                         ;;
7699                 esac
7700                 $rm -f hosts
7701                 ;;
7702         *) dflt="$mydomain";;
7703         esac;;
7704 esac
7705 echo " "
7706 rp="What is your domain name?"
7707 . ./myread
7708 tans="$ans"
7709 case "$ans" in
7710 '') ;;
7711 .*) ;;
7712 *) tans=".$tans";;
7713 esac
7714 mydomain="$tans"
7715
7716 : translate upper to lower if necessary
7717 case "$mydomain" in
7718 *[A-Z]*)
7719         echo "(Normalizing case in your domain name)"
7720         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7721         ;;
7722 esac
7723
7724 : a little sanity check here
7725 case "$phostname" in
7726 '') ;;
7727 *)
7728         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7729         $myhostname$mydomain|$myhostname) ;;
7730         *)
7731                 case "$phostname" in
7732                 sed*)
7733                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7734                         ;;
7735                 *)
7736                         echo "(That doesn't agree with your $phostname command, by the way.)"
7737                         ;;
7738                 esac
7739         ;;
7740         esac
7741         ;;
7742 esac
7743
7744 $cat <<EOM
7745
7746 I need to get your e-mail address in Internet format if possible, i.e.
7747 something like user@host.domain. Please answer accurately since I have
7748 no easy means to double check it. The default value provided below
7749 is most probably close to reality but may not be valid from outside
7750 your organization...
7751
7752 EOM
7753 cont=x
7754 while test "$cont"; do
7755         case "$cf_email" in
7756         '') dflt="$cf_by@$myhostname$mydomain";;
7757         *) dflt="$cf_email";;
7758         esac
7759         rp='What is your e-mail address?'
7760         . ./myread
7761         cf_email="$ans"
7762         case "$cf_email" in
7763         *@*.*) cont='' ;;
7764         *)
7765                 rp='Address does not look like an Internet one.  Use it anyway?'
7766                 case "$fastread" in
7767                 yes) dflt=y ;;
7768                 *) dflt=n ;;
7769                 esac
7770                 . ./myread
7771                 case "$ans" in
7772                 y*) cont='' ;;
7773                 *) echo " " ;;
7774                 esac
7775                 ;;
7776         esac
7777 done
7778
7779 $cat <<EOM
7780
7781 If you or somebody else will be maintaining perl at your site, please
7782 fill in the correct e-mail address here so that they may be contacted
7783 if necessary. Currently, the "perlbug" program included with perl
7784 will send mail to this address in addition to perlbug@perl.org. You may
7785 enter "none" for no administrator.
7786
7787 EOM
7788 case "$perladmin" in
7789 '') dflt="$cf_email";;
7790 *) dflt="$perladmin";;
7791 esac
7792 rp='Perl administrator e-mail address'
7793 . ./myread
7794 perladmin="$ans"
7795
7796 : determine whether to only install version-specific parts.
7797 echo " "
7798 $cat <<EOM
7799 Do you want to install only the version-specific parts of the perl
7800 distribution?  Usually you do *not* want to do this.
7801 EOM
7802 case "$versiononly" in
7803 "$define"|[Yy]*|true) dflt='y' ;;
7804 *) dflt='n';
7805 esac
7806 rp="Do you want to install only the version-specific parts of perl?"
7807 . ./myread
7808 case "$ans" in
7809 [yY]*)  val="$define";;
7810 *)      val="$undef" ;;
7811 esac
7812 set versiononly
7813 eval $setvar
7814
7815 : figure out how to guarantee perl startup
7816 case "$startperl" in
7817 '')
7818         case "$sharpbang" in
7819         *!)
7820                 $cat <<EOH
7821
7822 I can use the #! construct to start perl on your system. This will
7823 make startup of perl scripts faster, but may cause problems if you
7824 want to share those scripts and perl is not in a standard place
7825 ($binexp/perl) on all your platforms. The alternative is to force
7826 a shell by starting the script with a single ':' character.
7827
7828 EOH
7829                 case "$versiononly" in
7830                 "$define")      dflt="$binexp/perl$version";;  
7831                 *)              dflt="$binexp/perl";;
7832                 esac
7833                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7834                 . ./myread
7835                 case "$ans" in
7836                 none)   startperl=": # use perl";;
7837                 *)      startperl="#!$ans"
7838                         if $test 30 -lt `echo "$ans" | wc -c`; then
7839                                 $cat >&4 <<EOM
7840
7841 WARNING:  Some systems limit the #! command to 32 characters.
7842 If you experience difficulty running Perl scripts with #!, try
7843 installing Perl in a directory with a shorter pathname.
7844
7845 EOM
7846                         fi ;;
7847                 esac
7848                 ;;
7849         *) startperl=": # use perl"
7850                 ;;
7851         esac
7852         ;;
7853 esac
7854 echo "I'll use $startperl to start perl scripts."
7855
7856 : figure best path for perl in scripts
7857 case "$perlpath" in
7858 '')
7859         perlpath="$binexp/perl"
7860         case "$startperl" in
7861         *!*) ;;
7862         *)
7863                 $cat <<EOH
7864
7865 I will use the "eval 'exec'" idiom to start Perl on your system.
7866 I can use the full path of your Perl binary for this purpose, but
7867 doing so may cause problems if you want to share those scripts and
7868 Perl is not always in a standard place ($binexp/perl).
7869
7870 EOH
7871                 dflt="$binexp/perl"
7872                 rp="What path shall I use in \"eval 'exec'\"?"
7873                 . ./myread
7874                 perlpath="$ans"
7875                 ;;
7876         esac
7877         ;;
7878 esac
7879 case "$startperl" in
7880 *!*)    ;;
7881 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7882 esac
7883
7884 : determine where public executable scripts go
7885 set scriptdir scriptdir
7886 eval $prefixit
7887 case "$scriptdir" in
7888 '')
7889         dflt="$bin"
7890         : guess some guesses
7891         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7892         $test -d /usr/share/bin     && dflt=/usr/share/bin
7893         $test -d /usr/local/script  && dflt=/usr/local/script
7894         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7895         $test -d $prefixexp/script  && dflt=$prefixexp/script
7896         set dflt
7897         eval $prefixup
7898         ;;
7899 *)  dflt="$scriptdir"
7900         ;;
7901 esac
7902 $cat <<EOM
7903  
7904 Some installations have a separate directory just for executable scripts so
7905 that they can mount it across multiple architectures but keep the scripts in
7906 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7907 Or you might just lump your scripts in with all your other executables.
7908  
7909 EOM
7910 fn=d~
7911 rp='Where do you keep publicly executable scripts?'
7912 . ./getfile
7913 if $test "X$ansexp" != "X$scriptdirexp"; then
7914         installscript=''
7915 fi
7916 scriptdir="$ans"
7917 scriptdirexp="$ansexp"
7918 : Change installation prefix, if necessary.
7919 if $test X"$prefix" != X"$installprefix"; then
7920         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7921 else
7922         installscript="$scriptdirexp"
7923 fi
7924
7925 : determine where add-on public executables go
7926 case "$sitebin" in
7927 '')     dflt=$siteprefix/bin ;;
7928 *)      dflt=$sitebin ;;
7929 esac
7930 fn=d~
7931 rp='Pathname where the add-on public executables should be installed?'
7932 . ./getfile
7933 sitebin="$ans"
7934 sitebinexp="$ansexp"
7935 : Change installation prefix, if necessary.
7936 if $test X"$prefix" != X"$installprefix"; then
7937         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7938 else
7939         installsitebin="$sitebinexp"
7940 fi
7941
7942 case "$vendorprefix" in
7943 '')     d_vendorbin="$undef"
7944         vendorbin=''
7945         vendorbinexp=''
7946         ;;
7947 *)      d_vendorbin="$define"
7948         : determine where vendor-supplied executables go.
7949         case "$vendorbin" in
7950         '') dflt=$vendorprefix/bin ;;
7951         *)      dflt="$vendorbin" ;;
7952         esac
7953         fn=d~+
7954         rp='Pathname for the vendor-supplied executables directory?'
7955         . ./getfile
7956         vendorbin="$ans"
7957         vendorbinexp="$ansexp"
7958         ;;
7959 esac
7960 : Change installation prefix, if necessary.
7961 if $test X"$prefix" != X"$installprefix"; then
7962         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7963 else
7964         installvendorbin="$vendorbinexp"
7965 fi
7966
7967 : see if qgcvt exists
7968 set qgcvt d_qgcvt
7969 eval $inlibc
7970
7971 echo " "
7972
7973 if $test X"$d_longdbl" = X"$define"; then
7974
7975 echo "Checking how to print long doubles..." >&4
7976
7977 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7978         $cat >try.c <<'EOCP'
7979 #include <sys/types.h>
7980 #include <stdio.h>
7981 int main() {
7982   double d = 123.456;
7983   printf("%.3f\n", d);
7984 }
7985 EOCP
7986         set try
7987         if eval $compile; then
7988                 yyy=`./try$exe_ext`
7989                 case "$yyy" in
7990                 123.456)
7991                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7992                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7993                         echo "We will use %f."
7994                         ;;
7995                 esac
7996         fi
7997 fi
7998
7999 if $test X"$sPRIfldbl" = X; then
8000         $cat >try.c <<'EOCP'
8001 #include <sys/types.h>
8002 #include <stdio.h>
8003 int main() {
8004   long double d = 123.456;
8005   printf("%.3llf\n", d);
8006 }
8007 EOCP
8008         set try
8009         if eval $compile; then
8010                 yyy=`./try$exe_ext`
8011                 case "$yyy" in
8012                 123.456)
8013                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8014                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8015                         echo "We will use %llf."
8016                         ;;
8017                 esac
8018         fi
8019 fi
8020
8021 if $test X"$sPRIfldbl" = X; then
8022         $cat >try.c <<'EOCP'
8023 #include <sys/types.h>
8024 #include <stdio.h>
8025 int main() {
8026   long double d = 123.456;
8027   printf("%.3Lf\n", d);
8028 }
8029 EOCP
8030         set try
8031         if eval $compile; then
8032                 yyy=`./try$exe_ext`
8033                 case "$yyy" in
8034                 123.456)
8035                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8036                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8037                         echo "We will use %Lf."
8038                         ;;
8039                 esac
8040         fi
8041 fi
8042
8043 if $test X"$sPRIfldbl" = X; then
8044         $cat >try.c <<'EOCP'
8045 #include <sys/types.h>
8046 #include <stdio.h>
8047 int main() {
8048   long double d = 123.456;
8049   printf("%.3lf\n", d);
8050 }
8051 EOCP
8052         set try
8053         if eval $compile; then
8054                 yyy=`./try$exe_ext`
8055                 case "$yyy" in
8056                 123.456)
8057                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8058                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8059                         echo "We will use %lf."
8060                         ;;
8061                 esac
8062         fi
8063 fi
8064
8065 if $test X"$sPRIfldbl" = X; then
8066         echo "Cannot figure out how to print long doubles." >&4
8067 else
8068         sSCNfldbl=$sPRIfldbl    # expect consistency
8069 fi
8070
8071 $rm -f try try.*
8072
8073 fi # d_longdbl
8074
8075 case "$sPRIfldbl" in
8076 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8077         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8078         d_SCNfldbl="$undef";
8079         ;;
8080 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8081         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8082         d_SCNfldbl="$define";
8083         ;;
8084 esac
8085
8086 : Check how to convert floats to strings.
8087 echo " "
8088 echo "Checking for an efficient way to convert floats to strings."
8089 echo " " > try.c
8090 case "$uselongdouble" in
8091 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8092 esac
8093 case "$d_longdbl" in
8094 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8095 esac
8096 case "$d_PRIgldbl" in
8097 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8098 esac
8099 $cat >>try.c <<EOP
8100 #ifdef TRY_gconvert
8101 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8102 char *myname = "gconvert";
8103 #endif
8104 #ifdef TRY_gcvt
8105 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8106 char *myname = "gcvt";
8107 #endif
8108 #ifdef TRY_qgcvt
8109 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8110 char *myname = "qgcvt";
8111 #define DOUBLETYPE long double
8112 #endif
8113 #ifdef TRY_sprintf
8114 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8115 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8116 #else
8117 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8118 #endif
8119 char *myname = "sprintf";
8120 #endif
8121
8122 #ifndef DOUBLETYPE
8123 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8124 #define DOUBLETYPE long double
8125 #else
8126 #define DOUBLETYPE double
8127 #endif
8128 #endif
8129
8130 #include <stdio.h>
8131
8132 #define I_STDLIB $i_stdlib
8133 #ifdef I_STDLIB
8134 #include <stdlib.h>
8135 #endif
8136
8137 int
8138 checkit(expect, got)
8139 char *expect;
8140 char *got;
8141 {
8142     if (strcmp(expect, got)) {
8143                 printf("%s oddity:  Expected %s, got %s\n",
8144                         myname, expect, got);
8145                 exit(1);
8146         }
8147 }
8148
8149 int main()
8150
8151         char buf[64]; 
8152         buf[63] = '\0';
8153
8154         /* This must be 1st test on (which?) platform */
8155         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8156         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8157         checkit("0.1", buf);
8158
8159         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8160         checkit("1", buf);
8161
8162         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8163         checkit("1.1", buf);
8164
8165         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8166         checkit("1.01", buf);
8167
8168         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8169         checkit("1.001", buf);
8170
8171         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8172         checkit("1.0001", buf);
8173
8174         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8175         checkit("1.00001", buf);
8176
8177         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8178         checkit("1.000001", buf);
8179
8180         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8181         checkit("0", buf);
8182
8183         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8184         checkit("-1", buf);
8185
8186         /* Some Linux gcvt's give 1.e+5 here. */
8187         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8188         checkit("100000", buf);
8189         
8190         /* Some Linux gcvt's give -1.e+5 here. */
8191         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8192         checkit("-100000", buf);
8193
8194         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8195         checkit("123.456", buf);
8196
8197         exit(0);
8198 }
8199 EOP
8200 case "$d_Gconvert" in
8201 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8202 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8203 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8204 *) xxx_list='gconvert gcvt sprintf' ;;
8205 esac
8206
8207 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8208 "$define$define$define")
8209     # for long doubles prefer first qgcvt, then sprintf
8210     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8211     xxx_list="sprintf $xxx_list"
8212     case "$d_qgcvt" in
8213     "$define") xxx_list="qgcvt $xxx_list" ;;
8214     esac
8215     ;;
8216 esac
8217
8218 for xxx_convert in $xxx_list; do
8219         echo "Trying $xxx_convert..."
8220         $rm -f try try$_o
8221         set try -DTRY_$xxx_convert
8222         if eval $compile; then
8223                 echo "$xxx_convert() found." >&4
8224                 if ./try; then
8225                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8226                         break;
8227                 else
8228                         echo "...But $xxx_convert didn't work as I expected."
8229                 fi
8230         else
8231                 echo "$xxx_convert NOT found." >&4
8232         fi
8233 done
8234         
8235 case "$xxx_convert" in
8236 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8237 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8238 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8239 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8240    "$define$define$define")
8241       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8242    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8243    esac
8244    ;;  
8245 esac
8246
8247 : see if _fwalk exists
8248 set fwalk d__fwalk
8249 eval $inlibc
8250
8251 : Initialize h_fcntl
8252 h_fcntl=false
8253
8254 : Initialize h_sysfile
8255 h_sysfile=false
8256
8257 : access call always available on UNIX
8258 set access d_access
8259 eval $inlibc
8260
8261 : locate the flags for 'access()'
8262 case "$d_access" in
8263 "$define")
8264         echo " "
8265         $cat >access.c <<'EOCP'
8266 #include <sys/types.h>
8267 #ifdef I_FCNTL
8268 #include <fcntl.h>
8269 #endif
8270 #ifdef I_SYS_FILE
8271 #include <sys/file.h>
8272 #endif
8273 #ifdef I_UNISTD
8274 #include <unistd.h>
8275 #endif
8276 int main() {
8277         exit(R_OK);
8278 }
8279 EOCP
8280         : check sys/file.h first, no particular reason here
8281         if $test `./findhdr sys/file.h` && \
8282                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8283                 h_sysfile=true;
8284                 echo "<sys/file.h> defines the *_OK access constants." >&4
8285         elif $test `./findhdr fcntl.h` && \
8286                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8287                 h_fcntl=true;
8288                 echo "<fcntl.h> defines the *_OK access constants." >&4
8289         elif $test `./findhdr unistd.h` && \
8290                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8291                 echo "<unistd.h> defines the *_OK access constants." >&4
8292         else
8293                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8294         fi
8295         ;;
8296 esac
8297 $rm -f access*
8298
8299 : see if accessx exists
8300 set accessx d_accessx
8301 eval $inlibc
8302
8303 : see if alarm exists
8304 set alarm d_alarm
8305 eval $inlibc
8306
8307 : see if atolf exists
8308 set atolf d_atolf
8309 eval $inlibc
8310
8311 : see if atoll exists
8312 set atoll d_atoll
8313 eval $inlibc
8314
8315 : Look for GNU-cc style attribute checking
8316 echo " "
8317 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8318 $cat >attrib.c <<'EOCP'
8319 #include <stdio.h>
8320 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8321 EOCP
8322 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8323         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8324                 echo "Your C compiler doesn't fully support __attribute__."
8325                 val="$undef"
8326         else
8327                 echo "Your C compiler supports __attribute__."
8328                 val="$define"
8329         fi
8330 else
8331         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8332         val="$undef"
8333 fi
8334 set d_attribut
8335 eval $setvar
8336 $rm -f attrib*
8337
8338 : see if bcmp exists
8339 set bcmp d_bcmp
8340 eval $inlibc
8341
8342 : see if bcopy exists
8343 set bcopy d_bcopy
8344 eval $inlibc
8345
8346 : see if this is a unistd.h system
8347 set unistd.h i_unistd
8348 eval $inhdr
8349
8350 : see if getpgrp exists
8351 set getpgrp d_getpgrp
8352 eval $inlibc
8353
8354 case "$d_getpgrp" in
8355 "$define")
8356         echo " "
8357         echo "Checking to see which flavor of getpgrp is in use..."
8358         $cat >set.c <<EOP
8359 #$i_unistd I_UNISTD
8360 #include <sys/types.h>
8361 #ifdef I_UNISTD
8362 #  include <unistd.h>
8363 #endif
8364 int main()
8365 {
8366         if (getuid() == 0) {
8367                 printf("(I see you are running Configure as super-user...)\n");
8368                 setuid(1);
8369         }
8370 #ifdef TRY_BSD_PGRP
8371         if (getpgrp(1) == 0)
8372                 exit(0);
8373 #else
8374         if (getpgrp() > 0)
8375                 exit(0);
8376 #endif
8377         exit(1);
8378 }
8379 EOP
8380         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8381                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8382                 val="$define"
8383         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8384                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8385                 val="$undef"
8386         else
8387                 echo "I can't seem to compile and run the test program."
8388                 if ./usg; then
8389                         xxx="a USG one, i.e. you use getpgrp()."
8390                 else
8391                         # SVR4 systems can appear rather BSD-ish.
8392                         case "$i_unistd" in
8393                         $undef)
8394                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8395                                 val="$define"
8396                                 ;;
8397                         $define)
8398                                 xxx="probably a USG one, i.e. you use getpgrp()."
8399                                 val="$undef"
8400                                 ;;
8401                         esac
8402                 fi
8403                 echo "Assuming your getpgrp is $xxx" >&4
8404         fi
8405         ;;
8406 *) val="$undef";;
8407 esac
8408 set d_bsdgetpgrp
8409 eval $setvar
8410 $rm -f set set.c
8411
8412 : see if setpgrp exists
8413 set setpgrp d_setpgrp
8414 eval $inlibc
8415
8416 case "$d_setpgrp" in
8417 "$define")
8418         echo " "
8419         echo "Checking to see which flavor of setpgrp is in use..."
8420         $cat >set.c <<EOP
8421 #$i_unistd I_UNISTD
8422 #include <sys/types.h>
8423 #ifdef I_UNISTD
8424 #  include <unistd.h>
8425 #endif
8426 int main()
8427 {
8428         if (getuid() == 0) {
8429                 printf("(I see you are running Configure as super-user...)\n");
8430                 setuid(1);
8431         }
8432 #ifdef TRY_BSD_PGRP
8433         if (-1 == setpgrp(1, 1))
8434                 exit(0);
8435 #else
8436         if (setpgrp() != -1)
8437                 exit(0);
8438 #endif
8439         exit(1);
8440 }
8441 EOP
8442         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8443                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8444                 val="$define"
8445         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8446                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8447                 val="$undef"
8448         else
8449                 echo "(I can't seem to compile and run the test program.)"
8450                 if ./usg; then
8451                         xxx="a USG one, i.e. you use setpgrp()."
8452                 else
8453                         # SVR4 systems can appear rather BSD-ish.
8454                         case "$i_unistd" in
8455                         $undef)
8456                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8457                                 val="$define"
8458                                 ;;
8459                         $define)
8460                                 xxx="probably a USG one, i.e. you use setpgrp()."
8461                                 val="$undef"
8462                                 ;;
8463                         esac
8464                 fi
8465                 echo "Assuming your setpgrp is $xxx" >&4
8466         fi
8467         ;;
8468 *) val="$undef";;
8469 esac
8470 set d_bsdsetpgrp
8471 eval $setvar
8472 $rm -f set set.c
8473 : see if bzero exists
8474 set bzero d_bzero
8475 eval $inlibc
8476
8477 : see if signal is declared as pointer to function returning int or void
8478 echo " "
8479 xxx=`./findhdr signal.h`
8480 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8481 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8482         echo "You have int (*signal())() instead of void." >&4
8483         val="$undef"
8484 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8485         echo "You have void (*signal())()." >&4
8486         val="$define"
8487 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8488         echo "You have int (*signal())() instead of void." >&4
8489         val="$undef"
8490 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8491         echo "You have void (*signal())()." >&4
8492         val="$define"
8493 else
8494         case "$d_voidsig" in
8495         '')
8496         echo "I can't determine whether signal handler returns void or int..." >&4
8497                 dflt=void
8498                 rp="What type does your signal handler return?"
8499                 . ./myread
8500                 case "$ans" in
8501                 v*) val="$define";;
8502                 *) val="$undef";;
8503                 esac;;
8504         "$define")
8505                 echo "As you already told me, signal handler returns void." >&4
8506                 val="$define"
8507                 ;;
8508         *)      echo "As you already told me, signal handler returns int." >&4
8509                 val="$undef"
8510                 ;;
8511         esac
8512 fi
8513 set d_voidsig
8514 eval $setvar
8515 case "$d_voidsig" in
8516 "$define") signal_t="void";;
8517 *) signal_t="int";;
8518 esac
8519 $rm -f $$.tmp
8520
8521 : check for ability to cast large floats to 32-bit ints.
8522 echo " "
8523 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8524 if $test "$intsize" -ge 4; then
8525         xxx=int
8526 else
8527         xxx=long
8528 fi
8529 $cat >try.c <<EOCP
8530 #include <stdio.h>
8531 #include <sys/types.h>
8532 #include <signal.h>
8533 $signal_t blech(s) int s; { exit(3); }
8534 int main()
8535 {
8536         $xxx i32;
8537         double f, g;
8538         int result = 0;
8539         char str[16];
8540         signal(SIGFPE, blech);
8541
8542         /* Don't let compiler optimize the test away.  Store the number 
8543            in a writable string for gcc to pass to sscanf under HP/UX.
8544         */
8545         sprintf(str, "2147483647");
8546         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8547         g = 10 * f;
8548         i32  = ($xxx) g;
8549
8550         /* x86 processors will probably give 0x8000 0000, which is a
8551        sign change.  We don't want that.  We want to mimic SPARC
8552            behavior here, which is to preserve the sign and give
8553            back 0x7fff ffff.
8554         */
8555         if (i32 != ($xxx) f)
8556                 result |= 1;
8557         exit(result);
8558 }
8559 EOCP
8560 set try
8561 if eval $compile_ok; then
8562         ./try
8563         yyy=$?
8564 else
8565         echo "(I can't seem to compile the test program--assuming it can't)"
8566         yyy=1
8567 fi
8568 case "$yyy" in
8569 0)      val="$define"
8570         echo "Yup, it can."
8571         ;;
8572 *)      val="$undef"
8573         echo "Nope, it can't."
8574         ;;
8575 esac
8576 set d_casti32
8577 eval $setvar
8578 $rm -f try try.*
8579
8580 : check for ability to cast negative floats to unsigned
8581 echo " "
8582 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8583 $cat >try.c <<EOCP
8584 #include <stdio.h>
8585 #include <sys/types.h>
8586 #include <signal.h>
8587 $signal_t blech(s) int s; { exit(7); }
8588 $signal_t blech_in_list(s) int s; { exit(4); }
8589 unsigned long dummy_long(p) unsigned long p; { return p; }
8590 unsigned int dummy_int(p) unsigned int p; { return p; }
8591 unsigned short dummy_short(p) unsigned short p; { return p; }
8592 int main()
8593 {
8594         double f;
8595         unsigned long along;
8596         unsigned int aint;
8597         unsigned short ashort;
8598         int result = 0;
8599         char str[16];
8600         
8601         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8602            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8603            optimized the whole file away
8604         */
8605         /* Store the number in a writable string for gcc to pass to 
8606            sscanf under HP/UX.
8607         */
8608         sprintf(str, "-123");
8609         sscanf(str, "%lf", &f);  /* f = -123.; */
8610
8611         signal(SIGFPE, blech);
8612         along = (unsigned long)f;
8613         aint = (unsigned int)f;
8614         ashort = (unsigned short)f;
8615         if (along != (unsigned long)-123)
8616                 result |= 1;
8617         if (aint != (unsigned int)-123)
8618                 result |= 1;
8619         if (ashort != (unsigned short)-123)
8620                 result |= 1;
8621         sprintf(str, "1073741824.");
8622         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8623         f = f + f;
8624         along = 0;
8625         along = (unsigned long)f;
8626         if (along != 0x80000000)
8627                 result |= 2;
8628         f -= 1.;
8629         along = 0;
8630         along = (unsigned long)f;
8631         if (along != 0x7fffffff)
8632                 result |= 1;
8633         f += 2.;
8634         along = 0;
8635         along = (unsigned long)f;
8636         if (along != 0x80000001)
8637                 result |= 2;
8638         if (result)
8639                 exit(result);
8640         signal(SIGFPE, blech_in_list);
8641         sprintf(str, "123.");
8642         sscanf(str, "%lf", &f);  /* f = 123.; */
8643         along = dummy_long((unsigned long)f);
8644         aint = dummy_int((unsigned int)f);
8645         ashort = dummy_short((unsigned short)f);
8646         if (along != (unsigned long)123)
8647                 result |= 4;
8648         if (aint != (unsigned int)123)
8649                 result |= 4;
8650         if (ashort != (unsigned short)123)
8651                 result |= 4;
8652         exit(result);
8653
8654 }
8655 EOCP
8656 set try
8657 if eval $compile_ok; then
8658         ./try
8659         castflags=$?
8660 else
8661         echo "(I can't seem to compile the test program--assuming it can't)"
8662         castflags=7
8663 fi
8664 case "$castflags" in
8665 0)      val="$define"
8666         echo "Yup, it can."
8667         ;;
8668 *)      val="$undef"
8669         echo "Nope, it can't."
8670         ;;
8671 esac
8672 set d_castneg
8673 eval $setvar
8674 $rm -f try.*
8675
8676 : see if vprintf exists
8677 echo " "
8678 if set vprintf val -f d_vprintf; eval $csym; $val; then
8679         echo 'vprintf() found.' >&4
8680         val="$define"
8681         $cat >vprintf.c <<'EOF'
8682 #include <varargs.h>
8683
8684 int main() { xxx("foo"); }
8685
8686 xxx(va_alist)
8687 va_dcl
8688 {
8689         va_list args;
8690         char buf[10];
8691
8692         va_start(args);
8693         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8694 }
8695 EOF
8696         set vprintf
8697         if eval $compile && ./vprintf; then
8698                 echo "Your vsprintf() returns (int)." >&4
8699                 val2="$undef"
8700         else
8701                 echo "Your vsprintf() returns (char*)." >&4
8702                 val2="$define"
8703         fi
8704 else
8705         echo 'vprintf() NOT found.' >&4
8706                 val="$undef"
8707                 val2="$undef"
8708 fi
8709 set d_vprintf
8710 eval $setvar
8711 val=$val2
8712 set d_charvspr
8713 eval $setvar
8714
8715 : see if chown exists
8716 set chown d_chown
8717 eval $inlibc
8718
8719 : see if chroot exists
8720 set chroot d_chroot
8721 eval $inlibc
8722
8723 : see if chsize exists
8724 set chsize d_chsize
8725 eval $inlibc
8726
8727 hasstruct='varname=$1; struct=$2; shift; shift;
8728 while $test $# -ge 2; do
8729         case "$1" in
8730         $define) echo "#include <$2>";;
8731         esac ;
8732     shift 2;
8733 done > try.c;
8734 echo "int main () { struct $struct foo; }" >> try.c;
8735 set try;
8736 if eval $compile; then
8737         val="$define";
8738 else
8739         val="$undef";
8740 fi;
8741 set $varname;
8742 eval $setvar;
8743 $rm -f try.c try.o'
8744
8745 : see if sys/types.h has to be included
8746 set sys/types.h i_systypes
8747 eval $inhdr
8748
8749 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8750 while $test $# -ge 2; do
8751         case "$1" in
8752         $define) echo "#include <$2>";;
8753         esac ;
8754     shift 2;
8755 done > try.c;
8756 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8757 set try;
8758 if eval $compile; then
8759         val="$define";
8760 else
8761         val="$undef";
8762 fi;
8763 set $varname;
8764 eval $setvar;
8765 $rm -f try.c try.o'
8766
8767 socketlib=''
8768 sockethdr=''
8769 : see whether socket exists
8770 echo " "
8771 $echo $n "Hmm... $c" >&4
8772 if set socket val -f d_socket; eval $csym; $val; then
8773         echo "Looks like you have Berkeley networking support." >&4
8774         d_socket="$define"
8775         if set setsockopt val -f; eval $csym; $val; then
8776                 d_oldsock="$undef"
8777         else
8778                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8779                 d_oldsock="$define"
8780         fi
8781 else
8782         if $contains socklib libc.list >/dev/null 2>&1; then
8783                 echo "Looks like you have Berkeley networking support." >&4
8784                 d_socket="$define"
8785                 : we will have to assume that it supports the 4.2 BSD interface
8786                 d_oldsock="$undef"
8787         else
8788                 echo "You don't have Berkeley networking in libc$_a..." >&4
8789                 if test "X$d_socket" = "X$define"; then
8790                    echo "...but you seem to believe that you have sockets." >&4
8791                 else
8792                         for net in net socket
8793                         do
8794                                 if test -f /usr/lib/lib$net$_a; then
8795                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8796                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8797                                         if $contains socket libc.list >/dev/null 2>&1; then
8798                                                 d_socket="$define"
8799                                                 socketlib="-l$net"
8800                                                 case "$net" in
8801                                                 net)
8802                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8803                                                         sockethdr="-I/usr/netinclude"
8804                                                         ;;
8805                                                 esac
8806                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8807                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8808                                                         d_oldsock="$undef"
8809                                                 else
8810                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8811                                                         d_oldsock="$define"
8812                                                 fi
8813                                                 break
8814                                         fi
8815                                 fi
8816                         done
8817                         if test "X$d_socket" != "X$define"; then
8818                            echo "or anywhere else I see." >&4
8819                            d_socket="$undef"
8820                            d_oldsock="$undef"
8821                         fi
8822                 fi
8823         fi
8824 fi
8825
8826 : see if socketpair exists
8827 set socketpair d_sockpair
8828 eval $inlibc
8829
8830
8831 echo " "
8832 echo "Checking the availability of certain socket constants..." >& 4
8833 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8834         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8835         $cat >try.c <<EOF
8836 #include <sys/types.h>
8837 #include <sys/socket.h>
8838 int main() {
8839     int i = $ENUM;
8840 }
8841 EOF
8842         val="$undef"
8843         set try; if eval $compile; then
8844                 val="$define"
8845         fi
8846         set d_${enum}; eval $setvar
8847         $rm -f try.c try
8848 done
8849
8850 : see if this is a sys/uio.h system
8851 set sys/uio.h i_sysuio
8852 eval $inhdr
8853
8854
8855 echo " "
8856 echo "Checking to see if your system supports struct cmsghdr..." >&4
8857 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8858 eval $hasstruct
8859 case "$d_cmsghdr_s" in
8860 "$define")      echo "Yes, it does."   ;;
8861 *)              echo "No, it doesn't." ;;
8862 esac
8863
8864
8865 : check for const keyword
8866 echo " "
8867 echo 'Checking to see if your C compiler knows about "const"...' >&4
8868 $cat >const.c <<'EOCP'
8869 typedef struct spug { int drokk; } spug;
8870 int main()
8871 {
8872         const char *foo;
8873         const spug y;
8874 }
8875 EOCP
8876 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8877         val="$define"
8878         echo "Yup, it does."
8879 else
8880         val="$undef"
8881         echo "Nope, it doesn't."
8882 fi
8883 set d_const
8884 eval $setvar
8885
8886 : see if crypt exists
8887 echo " "
8888 if set crypt val -f d_crypt; eval $csym; $val; then
8889         echo 'crypt() found.' >&4
8890         val="$define"
8891         cryptlib=''
8892 else
8893         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8894         if $test -z "$cryptlib"; then
8895                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8896         else
8897                 cryptlib=-lcrypt
8898         fi
8899         if $test -z "$cryptlib"; then
8900                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8901         else
8902                 cryptlib=-lcrypt
8903         fi
8904         if $test -z "$cryptlib"; then
8905                 cryptlib=`./loc libcrypt$_a "" $libpth`
8906         else
8907                 cryptlib=-lcrypt
8908         fi
8909         if $test -z "$cryptlib"; then
8910                 echo 'crypt() NOT found.' >&4
8911                 val="$undef"
8912         else
8913                 val="$define"
8914         fi
8915 fi
8916 set d_crypt
8917 eval $setvar
8918
8919 : get csh whereabouts
8920 case "$csh" in
8921 'csh') val="$undef" ;;
8922 *) val="$define" ;;
8923 esac
8924 set d_csh
8925 eval $setvar
8926 : Respect a hint or command line value for full_csh.
8927 case "$full_csh" in
8928 '') full_csh=$csh ;;
8929 esac
8930
8931 : see if cuserid exists
8932 set cuserid d_cuserid
8933 eval $inlibc
8934
8935 : see if this is a limits.h system
8936 set limits.h i_limits
8937 eval $inhdr
8938
8939 : see if this is a float.h system
8940 set float.h i_float
8941 eval $inhdr
8942
8943 : See if number of significant digits in a double precision number is known
8944 echo " "
8945 $cat >dbl_dig.c <<EOM
8946 #$i_limits I_LIMITS
8947 #$i_float I_FLOAT
8948 #ifdef I_LIMITS
8949 #include <limits.h>
8950 #endif
8951 #ifdef I_FLOAT
8952 #include <float.h>
8953 #endif
8954 #ifdef DBL_DIG
8955 printf("Contains DBL_DIG");
8956 #endif
8957 EOM
8958 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8959 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8960         echo "DBL_DIG found." >&4
8961         val="$define"
8962 else
8963         echo "DBL_DIG NOT found." >&4
8964         val="$undef"
8965 fi
8966 $rm -f dbl_dig.?
8967 set d_dbl_dig
8968 eval $setvar
8969
8970 : see if difftime exists
8971 set difftime d_difftime
8972 eval $inlibc
8973
8974 : see if this is a dirent system
8975 echo " "
8976 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8977         val="$define"
8978         echo "<dirent.h> found." >&4
8979 else
8980         val="$undef"
8981         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8982                 echo "<sys/dir.h> found." >&4
8983                 echo " "
8984         else
8985                 xinc=`./findhdr sys/ndir.h`
8986         fi
8987         echo "<dirent.h> NOT found." >&4
8988 fi
8989 set i_dirent
8990 eval $setvar
8991
8992 : Look for type of directory structure.
8993 echo " "
8994 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8995
8996 case "$direntrytype" in
8997 ''|' ')
8998         case "$i_dirent" in
8999         $define) guess1='struct dirent' ;;
9000         *) guess1='struct direct'  ;;
9001         esac
9002         ;;
9003 *)      guess1="$direntrytype"
9004         ;;
9005 esac
9006
9007 case "$guess1" in
9008 'struct dirent') guess2='struct direct' ;;
9009 *) guess2='struct dirent' ;;
9010 esac
9011                 
9012 if $contains "$guess1" try.c >/dev/null 2>&1; then
9013         direntrytype="$guess1"
9014         echo "Your directory entries are $direntrytype." >&4
9015 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9016         direntrytype="$guess2"
9017         echo "Your directory entries seem to be $direntrytype." >&4
9018 else
9019         echo "I don't recognize your system's directory entries." >&4
9020         rp="What type is used for directory entries on this system?"
9021         dflt="$guess1"
9022         . ./myread
9023         direntrytype="$ans"
9024 fi
9025 $rm -f try.c
9026
9027
9028 : see if the directory entry stores field length
9029 echo " "
9030 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9031 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9032         echo "Good, your directory entry keeps length information in d_namlen." >&4
9033         val="$define"
9034 else
9035         echo "Your directory entry does not know about the d_namlen field." >&4
9036         val="$undef"
9037 fi
9038 set d_dirnamlen
9039 eval $setvar
9040 $rm -f try.c
9041
9042 : see if dlerror exists
9043 xxx_runnm="$runnm"
9044 runnm=false
9045 set dlerror d_dlerror
9046 eval $inlibc
9047 runnm="$xxx_runnm"
9048
9049 : see if dlfcn is available
9050 set dlfcn.h i_dlfcn
9051 eval $inhdr
9052
9053 case "$usedl" in
9054 $define|y|true)
9055         $cat << EOM
9056
9057 On a few systems, the dynamically loaded modules that perl generates and uses
9058 will need a different extension than shared libs. The default will probably
9059 be appropriate.
9060
9061 EOM
9062         case "$dlext" in
9063         '')     dflt="$so" ;;
9064         *)      dflt="$dlext" ;;
9065         esac
9066         rp='What is the extension of dynamically loaded modules'
9067         . ./myread
9068         dlext="$ans"
9069         ;;
9070 *)
9071         dlext="none"
9072         ;;
9073 esac
9074
9075 : Check if dlsym need a leading underscore
9076 echo " "
9077 val="$undef"
9078
9079 case "$dlsrc" in
9080 dl_dlopen.xs)
9081         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9082         $cat >dyna.c <<'EOM'
9083 fred () { }
9084 EOM
9085
9086 $cat >fred.c<<EOM
9087
9088 #include <stdio.h>
9089 #$i_dlfcn I_DLFCN
9090 #ifdef I_DLFCN
9091 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9092 #else
9093 #include <sys/types.h>
9094 #include <nlist.h>
9095 #include <link.h>
9096 #endif
9097
9098 extern int fred() ;
9099
9100 int main()
9101 {
9102     void * handle ;
9103     void * symbol ;
9104 #ifndef RTLD_LAZY
9105     int mode = 1 ;
9106 #else
9107     int mode = RTLD_LAZY ;
9108 #endif
9109     handle = dlopen("./dyna.$dlext", mode) ;
9110     if (handle == NULL) {
9111         printf ("1\n") ;
9112         fflush (stdout) ;
9113         exit(0);
9114     }
9115     symbol = dlsym(handle, "fred") ;
9116     if (symbol == NULL) {
9117         /* try putting a leading underscore */
9118         symbol = dlsym(handle, "_fred") ;
9119         if (symbol == NULL) {
9120             printf ("2\n") ;
9121             fflush (stdout) ;
9122             exit(0);
9123         }
9124         printf ("3\n") ;
9125     }
9126     else
9127         printf ("4\n") ;
9128     fflush (stdout) ;
9129     exit(0);
9130 }
9131 EOM
9132         : Call the object file tmp-dyna.o in case dlext=o.
9133         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9134                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9135                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9136                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9137                 xxx=`./fred`
9138                 case $xxx in
9139                 1)      echo "Test program failed using dlopen." >&4
9140                         echo "Perhaps you should not use dynamic loading." >&4;;
9141                 2)      echo "Test program failed using dlsym." >&4
9142                         echo "Perhaps you should not use dynamic loading." >&4;;
9143                 3)      echo "dlsym needs a leading underscore" >&4
9144                         val="$define" ;;
9145                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9146                 esac
9147         else
9148                 echo "I can't compile and run the test program." >&4
9149                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9150         fi
9151         ;;
9152 esac
9153                 
9154 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9155
9156 set d_dlsymun
9157 eval $setvar
9158
9159 hasproto='varname=$1; func=$2; shift; shift;
9160 while $test $# -ge 2; do
9161         case "$1" in
9162         $define) echo "#include <$2>";;
9163         esac ;
9164     shift 2;
9165 done > try.c;
9166 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9167 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9168         echo "$func() prototype found.";
9169         val="$define";
9170 else
9171         echo "$func() prototype NOT found.";
9172         val="$undef";
9173 fi;
9174 set $varname;
9175 eval $setvar;
9176 $rm -f try.c tryout.c'
9177
9178 : see if prototype for drand48 is available
9179 echo " "
9180 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9181 eval $hasproto
9182
9183 : see if dup2 exists
9184 set dup2 d_dup2
9185 eval $inlibc
9186
9187 : see if eaccess exists
9188 set eaccess d_eaccess
9189 eval $inlibc
9190
9191 : see if endgrent exists
9192 set endgrent d_endgrent
9193 eval $inlibc
9194
9195 : see if endhostent exists
9196 set endhostent d_endhent
9197 eval $inlibc
9198
9199 : see if endnetent exists
9200 set endnetent d_endnent
9201 eval $inlibc
9202
9203 : see if endprotoent exists
9204 set endprotoent d_endpent
9205 eval $inlibc
9206
9207 : see if endpwent exists
9208 set endpwent d_endpwent
9209 eval $inlibc
9210
9211 : see if endservent exists
9212 set endservent d_endsent
9213 eval $inlibc
9214
9215 : Locate the flags for 'open()'
9216 echo " "
9217 $cat >open3.c <<'EOCP'
9218 #include <sys/types.h>
9219 #ifdef I_FCNTL
9220 #include <fcntl.h>
9221 #endif
9222 #ifdef I_SYS_FILE
9223 #include <sys/file.h>
9224 #endif
9225 int main() {
9226         if(O_RDONLY);
9227 #ifdef O_TRUNC
9228         exit(0);
9229 #else
9230         exit(1);
9231 #endif
9232 }
9233 EOCP
9234 : check sys/file.h first to get FREAD on Sun
9235 if $test `./findhdr sys/file.h` && \
9236                 set open3 -DI_SYS_FILE && eval $compile; then
9237         h_sysfile=true;
9238         echo "<sys/file.h> defines the O_* constants..." >&4
9239         if ./open3; then
9240                 echo "and you have the 3 argument form of open()." >&4
9241                 val="$define"
9242         else
9243                 echo "but not the 3 argument form of open().  Oh, well." >&4
9244                 val="$undef"
9245         fi
9246 elif $test `./findhdr fcntl.h` && \
9247                 set open3 -DI_FCNTL && eval $compile; then
9248         h_fcntl=true;
9249         echo "<fcntl.h> defines the O_* constants..." >&4
9250         if ./open3; then
9251                 echo "and you have the 3 argument form of open()." >&4
9252                 val="$define"
9253         else
9254                 echo "but not the 3 argument form of open().  Oh, well." >&4
9255                 val="$undef"
9256         fi
9257 else
9258         val="$undef"
9259         echo "I can't find the O_* constant definitions!  You got problems." >&4
9260 fi
9261 set d_open3
9262 eval $setvar
9263 $rm -f open3*
9264
9265 : see which of string.h or strings.h is needed
9266 echo " "
9267 strings=`./findhdr string.h`
9268 if $test "$strings" && $test -r "$strings"; then
9269         echo "Using <string.h> instead of <strings.h>." >&4
9270         val="$define"
9271 else
9272         val="$undef"
9273         strings=`./findhdr strings.h`
9274         if $test "$strings" && $test -r "$strings"; then
9275                 echo "Using <strings.h> instead of <string.h>." >&4
9276         else
9277                 echo "No string header found -- You'll surely have problems." >&4
9278         fi
9279 fi
9280 set i_string
9281 eval $setvar
9282 case "$i_string" in
9283 "$undef") strings=`./findhdr strings.h`;;
9284 *)        strings=`./findhdr string.h`;;
9285 esac
9286
9287 : check for non-blocking I/O stuff
9288 case "$h_sysfile" in
9289 true) echo "#include <sys/file.h>" > head.c;;
9290 *)
9291        case "$h_fcntl" in
9292        true) echo "#include <fcntl.h>" > head.c;;
9293        *) echo "#include <sys/fcntl.h>" > head.c;;
9294        esac
9295        ;;
9296 esac
9297 echo " "
9298 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9299 case "$o_nonblock" in
9300 '')
9301         $cat head.c > try.c
9302         $cat >>try.c <<'EOCP'
9303 #include <stdio.h>
9304 int main() {
9305 #ifdef O_NONBLOCK
9306         printf("O_NONBLOCK\n");
9307         exit(0);
9308 #endif
9309 #ifdef O_NDELAY
9310         printf("O_NDELAY\n");
9311         exit(0);
9312 #endif
9313 #ifdef FNDELAY
9314         printf("FNDELAY\n");
9315         exit(0);
9316 #endif
9317         exit(0);
9318 }
9319 EOCP
9320         set try
9321         if eval $compile_ok; then
9322                 o_nonblock=`./try`
9323                 case "$o_nonblock" in
9324                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9325                 *) echo "Seems like we can use $o_nonblock.";;
9326                 esac
9327         else
9328                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9329         fi
9330         ;;
9331 *) echo "Using $hint value $o_nonblock.";;
9332 esac
9333 $rm -f try try.* .out core
9334
9335 echo " "
9336 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9337 case "$eagain" in
9338 '')
9339         $cat head.c > try.c
9340         $cat >>try.c <<EOCP
9341 #include <errno.h>
9342 #include <sys/types.h>
9343 #include <signal.h>
9344 #include <stdio.h> 
9345 #define MY_O_NONBLOCK $o_nonblock
9346 #ifndef errno  /* XXX need better Configure test */
9347 extern int errno;
9348 #endif
9349 #$i_unistd I_UNISTD
9350 #ifdef I_UNISTD
9351 #include <unistd.h>
9352 #endif
9353 #$i_string I_STRING
9354 #ifdef I_STRING
9355 #include <string.h>
9356 #else
9357 #include <strings.h>
9358 #endif
9359 $signal_t blech(x) int x; { exit(3); }
9360 EOCP
9361         $cat >> try.c <<'EOCP'
9362 int main()
9363 {
9364         int pd[2];
9365         int pu[2];
9366         char buf[1];
9367         char string[100];
9368
9369         pipe(pd);       /* Down: child -> parent */
9370         pipe(pu);       /* Up: parent -> child */
9371         if (0 != fork()) {
9372                 int ret;
9373                 close(pd[1]);   /* Parent reads from pd[0] */
9374                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9375 #ifdef F_SETFL
9376                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9377                         exit(1);
9378 #else
9379                 exit(4);
9380 #endif
9381                 signal(SIGALRM, blech);
9382                 alarm(5);
9383                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9384                         exit(2);
9385                 sprintf(string, "%d\n", ret);
9386                 write(2, string, strlen(string));
9387                 alarm(0);
9388 #ifdef EAGAIN
9389                 if (errno == EAGAIN) {
9390                         printf("EAGAIN\n");
9391                         goto ok;
9392                 }
9393 #endif
9394 #ifdef EWOULDBLOCK
9395                 if (errno == EWOULDBLOCK)
9396                         printf("EWOULDBLOCK\n");
9397 #endif
9398         ok:
9399                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9400                 sleep(2);                               /* Give it time to close our pipe */
9401                 alarm(5);
9402                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9403                 alarm(0);
9404                 sprintf(string, "%d\n", ret);
9405                 write(3, string, strlen(string));
9406                 exit(0);
9407         }
9408
9409         close(pd[0]);                   /* We write to pd[1] */
9410         close(pu[1]);                   /* We read from pu[0] */
9411         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9412         close(pd[1]);                   /* Pipe pd is now fully closed! */
9413         exit(0);                                /* Bye bye, thank you for playing! */
9414 }
9415 EOCP
9416         set try
9417         if eval $compile_ok; then
9418                 echo "$startsh" >mtry
9419                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9420                 chmod +x mtry
9421                 ./mtry >/dev/null 2>&1
9422                 case $? in
9423                 0) eagain=`$cat try.out`;;
9424                 1) echo "Could not perform non-blocking setting!";;
9425                 2) echo "I did a successful read() for something that was not there!";;
9426                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9427                 4) echo "Could not find F_SETFL!";;
9428                 *) echo "Something terribly wrong happened during testing.";;
9429                 esac
9430                 rd_nodata=`$cat try.ret`
9431                 echo "A read() system call with no data present returns $rd_nodata."
9432                 case "$rd_nodata" in
9433                 0|-1) ;;
9434                 *)
9435                         echo "(That's peculiar, fixing that to be -1.)"
9436                         rd_nodata=-1
9437                         ;;
9438                 esac
9439                 case "$eagain" in
9440                 '')
9441                         echo "Forcing errno EAGAIN on read() with no data available."
9442                         eagain=EAGAIN
9443                         ;;
9444                 *)
9445                         echo "Your read() sets errno to $eagain when no data is available."
9446                         ;;
9447                 esac
9448                 status=`$cat try.err`
9449                 case "$status" in
9450                 0) echo "And it correctly returns 0 to signal EOF.";;
9451                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9452                 *) echo "However, your read() returns '$status' on EOF??";;
9453                 esac
9454                 val="$define"
9455                 if test "$status" = "$rd_nodata"; then
9456                         echo "WARNING: you can't distinguish between EOF and no data!"
9457                         val="$undef"
9458                 fi
9459         else
9460                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9461                 eagain=EAGAIN
9462         fi
9463         set d_eofnblk
9464         eval $setvar
9465         ;;
9466 *)
9467         echo "Using $hint value $eagain."
9468         echo "Your read() returns $rd_nodata when no data is present."
9469         case "$d_eofnblk" in
9470         "$define") echo "And you can see EOF because read() returns 0.";;
9471         "$undef") echo "But you can't see EOF status from read() returned value.";;
9472         *)
9473                 echo "(Assuming you can't see EOF status from read anyway.)"
9474                 d_eofnblk=$undef
9475                 ;;
9476         esac
9477         ;;
9478 esac
9479 $rm -f try try.* .out core head.c mtry
9480
9481 : see if fchmod exists
9482 set fchmod d_fchmod
9483 eval $inlibc
9484
9485 : see if fchown exists
9486 set fchown d_fchown
9487 eval $inlibc
9488
9489 : see if this is an fcntl system
9490 set fcntl d_fcntl
9491 eval $inlibc
9492
9493 echo " "
9494 : See if fcntl-based locking works.
9495 $cat >try.c <<'EOCP'
9496 #include <stdlib.h>
9497 #include <unistd.h>
9498 #include <fcntl.h>
9499 int main() {
9500 #if defined(F_SETLK) && defined(F_SETLKW)
9501      struct flock flock;
9502      int retval, fd;
9503      fd = open("try.c", O_RDONLY);
9504      flock.l_type = F_RDLCK;
9505      flock.l_whence = SEEK_SET;
9506      flock.l_start = flock.l_len = 0;
9507      retval = fcntl(fd, F_SETLK, &flock);
9508      close(fd);
9509      (retval < 0 ? exit(2) : exit(0));
9510 #else
9511      exit(2);
9512 #endif
9513 }
9514 EOCP
9515 echo "Checking if fcntl-based file locking works... "
9516 case "$d_fcntl" in
9517 "$define")
9518         set try
9519         if eval $compile_ok; then
9520                 if ./try; then
9521                         echo "Yes, it seems to work."
9522                         val="$define"
9523                 else
9524                         echo "Nope, it didn't work."
9525                         val="$undef"
9526                 fi
9527         else
9528                 echo "I'm unable to compile the test program, so I'll assume not."
9529                 val="$undef"
9530         fi
9531         ;;
9532 *) val="$undef";
9533         echo "Nope, since you don't even have fcntl()."
9534         ;;
9535 esac
9536 set d_fcntl_can_lock
9537 eval $setvar
9538 $rm -f try*
9539
9540
9541 : see if sys/select.h has to be included
9542 set sys/select.h i_sysselct
9543 eval $inhdr
9544
9545 : see if we should include time.h, sys/time.h, or both
9546 echo " "
9547 if test "X$timeincl" = X; then
9548         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9549         $echo $n "I'm now running the test program...$c"
9550         $cat >try.c <<'EOCP'
9551 #include <sys/types.h>
9552 #ifdef I_TIME
9553 #include <time.h>
9554 #endif
9555 #ifdef I_SYSTIME
9556 #ifdef SYSTIMEKERNEL
9557 #define KERNEL
9558 #endif
9559 #include <sys/time.h>
9560 #endif
9561 #ifdef I_SYSSELECT
9562 #include <sys/select.h>
9563 #endif
9564 int main()
9565 {
9566         struct tm foo;
9567 #ifdef S_TIMEVAL
9568         struct timeval bar;
9569 #endif
9570 #ifdef S_TIMEZONE
9571         struct timezone tzp;
9572 #endif
9573         if (foo.tm_sec == foo.tm_sec)
9574                 exit(0);
9575 #ifdef S_TIMEVAL
9576         if (bar.tv_sec == bar.tv_sec)
9577                 exit(0);
9578 #endif
9579         exit(1);
9580 }
9581 EOCP
9582         flags=''
9583         for s_timezone in '-DS_TIMEZONE' ''; do
9584         sysselect=''
9585         for s_timeval in '-DS_TIMEVAL' ''; do
9586         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9587         for i_time in '' '-DI_TIME'; do
9588         for i_systime in '-DI_SYSTIME' ''; do
9589                 case "$flags" in
9590                 '') $echo $n ".$c"
9591                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9592                         if eval $compile; then
9593                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9594                                 shift
9595                                 flags="$*"
9596                                 echo " "
9597                                 $echo $n "Succeeded with $flags$c"
9598                         fi
9599                         ;;
9600                 esac
9601         done
9602         done
9603         done
9604         done
9605         done
9606         timeincl=''
9607         echo " "
9608         case "$flags" in
9609         *SYSTIMEKERNEL*) i_systimek="$define"
9610                 timeincl=`./findhdr sys/time.h`
9611                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9612         *) i_systimek="$undef";;
9613         esac
9614         case "$flags" in
9615         *I_TIME*) i_time="$define"
9616                 timeincl=`./findhdr time.h`" $timeincl"
9617                 echo "We'll include <time.h>." >&4;;
9618         *) i_time="$undef";;
9619         esac
9620         case "$flags" in
9621         *I_SYSTIME*) i_systime="$define"
9622                 timeincl=`./findhdr sys/time.h`" $timeincl"
9623                 echo "We'll include <sys/time.h>." >&4;;
9624         *) i_systime="$undef";;
9625         esac
9626         $rm -f try.c try
9627 fi
9628
9629 : check for fd_set items
9630 $cat <<EOM
9631
9632 Checking to see how well your C compiler handles fd_set and friends ...
9633 EOM
9634 $cat >fd_set.c <<EOCP
9635 #$i_systime I_SYS_TIME
9636 #$i_sysselct I_SYS_SELECT
9637 #$d_socket HAS_SOCKET
9638 #include <sys/types.h>
9639 #ifdef HAS_SOCKET
9640 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9641 #endif
9642 #ifdef I_SYS_TIME
9643 #include <sys/time.h>
9644 #endif
9645 #ifdef I_SYS_SELECT
9646 #include <sys/select.h>
9647 #endif
9648 int main() {
9649         fd_set fds;
9650
9651 #ifdef TRYBITS
9652         if(fds.fds_bits);
9653 #endif
9654
9655 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9656         exit(0);
9657 #else
9658         exit(1);
9659 #endif
9660 }
9661 EOCP
9662 set fd_set -DTRYBITS
9663 if eval $compile; then
9664         d_fds_bits="$define"
9665         d_fd_set="$define"
9666         echo "Well, your system knows about the normal fd_set typedef..." >&4
9667         if ./fd_set; then
9668                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9669                 d_fd_macros="$define"
9670         else
9671                 $cat >&4 <<'EOM'
9672 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9673 EOM
9674                 d_fd_macros="$undef"
9675         fi
9676 else
9677         $cat <<'EOM'
9678 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9679 EOM
9680         set fd_set
9681         if eval $compile; then
9682                 d_fds_bits="$undef"
9683                 d_fd_set="$define"
9684                 echo "Well, your system has some sort of fd_set available..." >&4
9685                 if ./fd_set; then
9686                         echo "and you have the normal fd_set macros." >&4
9687                         d_fd_macros="$define"
9688                 else
9689                         $cat <<'EOM'
9690 but not the normal fd_set macros!  Gross!  More work for me...
9691 EOM
9692                         d_fd_macros="$undef"
9693                 fi
9694         else
9695         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9696                 d_fd_set="$undef"
9697                 d_fds_bits="$undef"
9698                 d_fd_macros="$undef"
9699         fi
9700 fi
9701 $rm -f fd_set*
9702
9703 : see if fgetpos exists
9704 set fgetpos d_fgetpos
9705 eval $inlibc
9706
9707 : see if flock exists
9708 set flock d_flock
9709 eval $inlibc
9710
9711 : see if fork exists
9712 set fork d_fork
9713 eval $inlibc
9714
9715 : see if pathconf exists
9716 set pathconf d_pathconf
9717 eval $inlibc
9718
9719 : see if fpathconf exists
9720 set fpathconf d_fpathconf
9721 eval $inlibc
9722
9723
9724 : check for fpos64_t
9725 echo " "
9726 echo "Checking to see if you have fpos64_t..." >&4
9727 $cat >try.c <<EOCP
9728 #include <stdio.h>
9729 int main() { fpos64_t x = 7; }
9730 EOCP
9731 set try
9732 if eval $compile; then
9733         val="$define"
9734         echo "You have fpos64_t."
9735 else
9736         val="$undef"
9737         echo "You do not have fpos64_t."
9738         case "$fpossize" in
9739         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9740         esac
9741 fi
9742 $rm -f try.* try
9743 set d_fpos64_t
9744 eval $setvar
9745
9746 : see if frexpl exists
9747 set frexpl d_frexpl
9748 eval $inlibc
9749
9750 : see if this is a sys/param system
9751 set sys/param.h i_sysparam
9752 eval $inhdr
9753
9754 : see if this is a sys/mount.h system
9755 set sys/mount.h i_sysmount
9756 eval $inhdr
9757
9758
9759 echo " "
9760 echo "Checking to see if your system supports struct fs_data..." >&4
9761 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9762 eval $hasstruct
9763 case "$d_fs_data_s" in
9764 "$define")      echo "Yes, it does."   ;;
9765 *)              echo "No, it doesn't." ;;
9766 esac
9767
9768 : see if fseeko exists
9769 set fseeko d_fseeko
9770 eval $inlibc
9771 case "$longsize" in
9772 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9773 esac
9774
9775 : see if fsetpos exists
9776 set fsetpos d_fsetpos
9777 eval $inlibc
9778
9779
9780 : see if fstatfs exists
9781 set fstatfs d_fstatfs
9782 eval $inlibc
9783
9784
9785 : see if statvfs exists
9786 set statvfs d_statvfs
9787 eval $inlibc
9788
9789 : see if fstatvfs exists
9790 set fstatvfs d_fstatvfs
9791 eval $inlibc
9792
9793
9794 : see if fsync exists
9795 set fsync d_fsync
9796 eval $inlibc
9797
9798 : see if ftello exists
9799 set ftello d_ftello
9800 eval $inlibc
9801 case "$longsize" in
9802 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9803 esac
9804
9805 : see if getcwd exists
9806 set getcwd d_getcwd
9807 eval $inlibc
9808
9809 : see if getespwnam exists
9810 set getespwnam d_getespwnam
9811 eval $inlibc
9812
9813
9814 : see if getfsstat exists
9815 set getfsstat d_getfsstat
9816 eval $inlibc
9817
9818 : see if getgrent exists
9819 set getgrent d_getgrent
9820 eval $inlibc
9821
9822 : see if gethostbyaddr exists
9823 set gethostbyaddr d_gethbyaddr
9824 eval $inlibc
9825
9826 : see if gethostbyname exists
9827 set gethostbyname d_gethbyname
9828 eval $inlibc
9829
9830 : see if gethostent exists
9831 set gethostent d_gethent
9832 eval $inlibc
9833
9834 : see how we will look up host name
9835 echo " "
9836 call=''
9837 if set gethostname val -f d_gethname; eval $csym; $val; then
9838         echo 'gethostname() found.' >&4
9839         d_gethname="$define"
9840         call=gethostname
9841 fi
9842 if set uname val -f d_uname; eval $csym; $val; then
9843         if ./xenix; then
9844                 $cat <<'EOM'
9845 uname() was found, but you're running xenix, and older versions of xenix
9846 have a broken uname(). If you don't really know whether your xenix is old
9847 enough to have a broken system call, use the default answer.
9848
9849 EOM
9850                 dflt=y
9851                 case "$d_uname" in
9852                 "$define") dflt=n;;
9853                 esac
9854                 rp='Is your uname() broken?'
9855                 . ./myread
9856                 case "$ans" in
9857                 n*) d_uname="$define"; call=uname;;
9858                 esac
9859         else
9860                 echo 'uname() found.' >&4
9861                 d_uname="$define"
9862                 case "$call" in
9863                 '') call=uname ;;
9864                 esac
9865         fi
9866 fi
9867 case "$d_gethname" in
9868 '') d_gethname="$undef";;
9869 esac
9870 case "$d_uname" in
9871 '') d_uname="$undef";;
9872 esac
9873 case "$d_uname$d_gethname" in
9874 *define*)
9875         dflt=n
9876         cat <<EOM
9877  
9878 Every now and then someone has a $call() that lies about the hostname
9879 but can't be fixed for political or economic reasons.  If you wish, I can
9880 pretend $call() isn't there and maybe compute hostname at run-time
9881 thanks to the '$phostname' command.
9882
9883 EOM
9884         rp="Shall I ignore $call() from now on?"
9885         . ./myread
9886         case "$ans" in
9887         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9888         esac;;
9889 esac
9890 case "$phostname" in
9891 '') aphostname='';;
9892 *) case "$aphostname" in
9893         /*) ;;
9894         *) set X $phostname
9895                 shift
9896                 file=$1
9897                 shift
9898                 file=`./loc $file $file $pth`
9899                 aphostname=`echo $file $*`
9900                 ;;
9901         esac
9902         ;;
9903 esac
9904 case "$d_uname$d_gethname" in
9905 *define*) ;;
9906 *)
9907         case "$phostname" in
9908         '')
9909                 echo "There will be no way for $package to get your hostname." >&4;;
9910         *)
9911         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9912                 ;;
9913         esac;;
9914 esac
9915 case "$d_phostname" in
9916 '') d_phostname="$undef";;
9917 esac
9918
9919 : see if this is a netdb.h system
9920 set netdb.h i_netdb
9921 eval $inhdr
9922
9923 : see if prototypes for various gethostxxx netdb.h functions are available
9924 echo " "
9925 set d_gethostprotos gethostent $i_netdb netdb.h
9926 eval $hasproto
9927
9928 : see if getitimer exists
9929 set getitimer d_getitimer
9930 eval $inlibc
9931
9932 : see if getlogin exists
9933 set getlogin d_getlogin
9934 eval $inlibc
9935
9936 : see if getmnt exists
9937 set getmnt d_getmnt
9938 eval $inlibc
9939
9940 : see if getmntent exists
9941 set getmntent d_getmntent
9942 eval $inlibc
9943
9944 : see if getnetbyaddr exists
9945 set getnetbyaddr d_getnbyaddr
9946 eval $inlibc
9947
9948 : see if getnetbyname exists
9949 set getnetbyname d_getnbyname
9950 eval $inlibc
9951
9952 : see if getnetent exists
9953 set getnetent d_getnent
9954 eval $inlibc
9955
9956 : see if prototypes for various getnetxxx netdb.h functions are available
9957 echo " "
9958 set d_getnetprotos getnetent $i_netdb netdb.h
9959 eval $hasproto
9960
9961 : see if getpagesize exists
9962 set getpagesize d_getpagsz
9963 eval $inlibc
9964
9965
9966 : see if getprotobyname exists
9967 set getprotobyname d_getpbyname
9968 eval $inlibc
9969
9970 : see if getprotobynumber exists
9971 set getprotobynumber d_getpbynumber
9972 eval $inlibc
9973
9974 : see if getprotoent exists
9975 set getprotoent d_getpent
9976 eval $inlibc
9977
9978 : see if getpgid exists
9979 set getpgid d_getpgid
9980 eval $inlibc
9981
9982 : see if getpgrp2 exists
9983 set getpgrp2 d_getpgrp2
9984 eval $inlibc
9985
9986 : see if getppid exists
9987 set getppid d_getppid
9988 eval $inlibc
9989
9990 : see if getpriority exists
9991 set getpriority d_getprior
9992 eval $inlibc
9993
9994 : see if prototypes for various getprotoxxx netdb.h functions are available
9995 echo " "
9996 set d_getprotoprotos getprotoent $i_netdb netdb.h
9997 eval $hasproto
9998
9999 : see if getprpwnam exists
10000 set getprpwnam d_getprpwnam
10001 eval $inlibc
10002
10003 : see if getpwent exists
10004 set getpwent d_getpwent
10005 eval $inlibc
10006
10007
10008 : see if getservbyname exists
10009 set getservbyname d_getsbyname
10010 eval $inlibc
10011
10012 : see if getservbyport exists
10013 set getservbyport d_getsbyport
10014 eval $inlibc
10015
10016 : see if getservent exists
10017 set getservent d_getsent
10018 eval $inlibc
10019
10020 : see if prototypes for various getservxxx netdb.h functions are available
10021 echo " "
10022 set d_getservprotos getservent $i_netdb netdb.h
10023 eval $hasproto
10024
10025 : see if getspnam exists
10026 set getspnam d_getspnam
10027 eval $inlibc
10028
10029 : see if gettimeofday or ftime exists
10030 set gettimeofday d_gettimeod
10031 eval $inlibc
10032 case "$d_gettimeod" in
10033 "$undef")
10034         set ftime d_ftime 
10035         eval $inlibc
10036         ;;
10037 *)
10038         val="$undef"; set d_ftime; eval $setvar
10039         ;;
10040 esac
10041 case "$d_gettimeod$d_ftime" in
10042 "$undef$undef")
10043         echo " "
10044         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10045         ;;
10046 esac
10047
10048 : see if this is an grp system
10049 set grp.h i_grp
10050 eval $inhdr
10051
10052 case "$i_grp" in
10053 $define)
10054         xxx=`./findhdr grp.h`
10055         $cppstdin $cppflags $cppminus < $xxx >$$.h
10056
10057         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10058                 val="$define"
10059         else
10060                 val="$undef"
10061         fi
10062         set d_grpasswd
10063         eval $setvar
10064
10065         $rm -f $$.h
10066         ;;
10067 *)
10068         val="$undef";
10069         set d_grpasswd; eval $setvar
10070         ;;
10071 esac
10072
10073 : see if hasmntopt exists
10074 set hasmntopt d_hasmntopt
10075 eval $inlibc
10076
10077 : see if this is a netinet/in.h or sys/in.h system
10078 set netinet/in.h i_niin sys/in.h i_sysin
10079 eval $inhdr
10080
10081 : see if arpa/inet.h has to be included
10082 set arpa/inet.h i_arpainet
10083 eval $inhdr
10084
10085 : see if htonl --and friends-- exists
10086 val=''
10087 set htonl val
10088 eval $inlibc
10089
10090 : Maybe they are macros.
10091 case "$val" in
10092 $undef)
10093         $cat >htonl.c <<EOM
10094 #include <stdio.h>
10095 #include <sys/types.h>
10096 #$i_niin I_NETINET_IN
10097 #$i_sysin I_SYS_IN
10098 #$i_arpainet I_ARPA_INET
10099 #ifdef I_NETINET_IN
10100 #include <netinet/in.h>
10101 #endif
10102 #ifdef I_SYS_IN
10103 #include <sys/in.h>
10104 #endif
10105 #ifdef I_ARPA_INET
10106 #include <arpa/inet.h>
10107 #endif
10108 #ifdef htonl
10109 printf("Defined as a macro.");
10110 #endif
10111 EOM
10112         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10113         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10114                 val="$define"
10115                 echo "But it seems to be defined as a macro." >&4
10116         fi
10117         $rm -f htonl.?
10118         ;;
10119 esac
10120 set d_htonl
10121 eval $setvar
10122
10123 : see if iconv exists
10124 set iconv d_iconv
10125 eval $inlibc
10126
10127 : index or strchr
10128 echo " "
10129 if set index val -f; eval $csym; $val; then
10130         if set strchr val -f d_strchr; eval $csym; $val; then
10131                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10132                         val="$define"
10133                         vali="$undef"
10134                         echo "strchr() found." >&4
10135                 else
10136                         val="$undef"
10137                         vali="$define"
10138                         echo "index() found." >&4
10139                 fi
10140         else
10141                 val="$undef"
10142                 vali="$define"
10143                 echo "index() found." >&4
10144         fi
10145 else
10146         if set strchr val -f d_strchr; eval $csym; $val; then
10147                 val="$define"
10148                 vali="$undef"
10149                 echo "strchr() found." >&4
10150         else
10151                 echo "No index() or strchr() found!" >&4
10152                 val="$undef"
10153                 vali="$undef"
10154         fi
10155 fi
10156 set d_strchr; eval $setvar
10157 val="$vali"
10158 set d_index; eval $setvar
10159
10160 : check whether inet_aton exists
10161 set inet_aton d_inetaton
10162 eval $inlibc
10163
10164 : Look for isascii
10165 echo " "
10166 $cat >isascii.c <<'EOCP'
10167 #include <stdio.h>
10168 #include <ctype.h>
10169 int main() {
10170         int c = 'A';
10171         if (isascii(c))
10172                 exit(0);
10173         else
10174                 exit(1);
10175 }
10176 EOCP
10177 set isascii
10178 if eval $compile; then
10179         echo "isascii() found." >&4
10180         val="$define"
10181 else
10182         echo "isascii() NOT found." >&4
10183         val="$undef"
10184 fi
10185 set d_isascii
10186 eval $setvar
10187 $rm -f isascii*
10188
10189 : see if isnan exists
10190 set isnan d_isnan
10191 eval $inlibc
10192
10193 : see if isnanl exists
10194 set isnanl d_isnanl
10195 eval $inlibc
10196
10197 : see if killpg exists
10198 set killpg d_killpg
10199 eval $inlibc
10200
10201 : see if lchown exists
10202 echo " "
10203 $cat > try.c <<'EOCP'
10204 /* System header to define __stub macros and hopefully few prototypes,
10205     which can conflict with char lchown(); below.  */
10206 #include <assert.h>
10207 /* Override any gcc2 internal prototype to avoid an error.  */
10208 /* We use char because int might match the return type of a gcc2
10209    builtin and then its argument prototype would still apply.  */
10210 char lchown();
10211 int main() {
10212     /*  The GNU C library defines this for functions which it implements
10213         to always fail with ENOSYS.  Some functions are actually named
10214         something starting with __ and the normal name is an alias.  */
10215 #if defined (__stub_lchown) || defined (__stub___lchown)
10216 choke me
10217 #else
10218 lchown();
10219 #endif
10220 ; return 0; }
10221 EOCP
10222 set try
10223 if eval $compile; then
10224     $echo "lchown() found." >&4
10225     val="$define"
10226 else
10227     $echo "lchown() NOT found." >&4
10228     val="$undef"
10229 fi
10230 set d_lchown
10231 eval $setvar
10232
10233 : See if number of significant digits in a double precision number is known
10234 echo " "
10235 $cat >ldbl_dig.c <<EOM
10236 #$i_limits I_LIMITS
10237 #$i_float I_FLOAT
10238 #ifdef I_LIMITS
10239 #include <limits.h>
10240 #endif
10241 #ifdef I_FLOAT
10242 #include <float.h>
10243 #endif
10244 #ifdef LDBL_DIG
10245 printf("Contains LDBL_DIG");
10246 #endif
10247 EOM
10248 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10249 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10250         echo "LDBL_DIG found." >&4
10251         val="$define"
10252 else
10253         echo "LDBL_DIG NOT found." >&4
10254         val="$undef"
10255 fi
10256 $rm -f ldbl_dig.?
10257 set d_ldbl_dig
10258 eval $setvar
10259
10260 : see if link exists
10261 set link d_link
10262 eval $inlibc
10263
10264 : see if localeconv exists
10265 set localeconv d_locconv
10266 eval $inlibc
10267
10268 : see if lockf exists
10269 set lockf d_lockf
10270 eval $inlibc
10271
10272 : see if prototype for lseek is available
10273 echo " "
10274 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10275 eval $hasproto
10276
10277 : see if lstat exists
10278 set lstat d_lstat
10279 eval $inlibc
10280
10281 : see if madvise exists
10282 set madvise d_madvise
10283 eval $inlibc
10284
10285 : see if mblen exists
10286 set mblen d_mblen
10287 eval $inlibc
10288
10289 : see if mbstowcs exists
10290 set mbstowcs d_mbstowcs
10291 eval $inlibc
10292
10293 : see if mbtowc exists
10294 set mbtowc d_mbtowc
10295 eval $inlibc
10296
10297 : see if memchr exists
10298 set memchr d_memchr
10299 eval $inlibc
10300
10301 : see if memcmp exists
10302 set memcmp d_memcmp
10303 eval $inlibc
10304
10305 : see if memcpy exists
10306 set memcpy d_memcpy
10307 eval $inlibc
10308
10309 : see if memmove exists
10310 set memmove d_memmove
10311 eval $inlibc
10312
10313 : see if memset exists
10314 set memset d_memset
10315 eval $inlibc
10316
10317 : see if mkdir exists
10318 set mkdir d_mkdir
10319 eval $inlibc
10320
10321 : see if mkdtemp exists
10322 set mkdtemp d_mkdtemp
10323 eval $inlibc
10324
10325 : see if mkfifo exists
10326 set mkfifo d_mkfifo
10327 eval $inlibc
10328
10329 : see if mkstemp exists
10330 set mkstemp d_mkstemp
10331 eval $inlibc
10332
10333 : see if mkstemps exists
10334 set mkstemps d_mkstemps
10335 eval $inlibc
10336
10337 : see if mktime exists
10338 set mktime d_mktime
10339 eval $inlibc
10340
10341 : see if this is a sys/mman.h system
10342 set sys/mman.h i_sysmman
10343 eval $inhdr
10344
10345 : see if mmap exists
10346 set mmap d_mmap
10347 eval $inlibc
10348 : see what shmat returns
10349 : default to something harmless
10350 mmaptype='void *'
10351 case "$i_sysmman$d_mmap" in
10352 "$define$define")
10353         $cat >mmap.c <<'END'
10354 #include <sys/mman.h>
10355 void *mmap();
10356 END
10357         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10358                 mmaptype='void *'
10359         else
10360                 mmaptype='caddr_t'
10361         fi
10362         echo "and it returns ($mmaptype)." >&4
10363         ;;
10364 esac
10365
10366
10367
10368 : see if modfl exists
10369 set modfl d_modfl
10370 eval $inlibc
10371
10372 : see if mprotect exists
10373 set mprotect d_mprotect
10374 eval $inlibc
10375
10376 : see if msgctl exists
10377 set msgctl d_msgctl
10378 eval $inlibc
10379
10380 : see if msgget exists
10381 set msgget d_msgget
10382 eval $inlibc
10383
10384 : see if msgsnd exists
10385 set msgsnd d_msgsnd
10386 eval $inlibc
10387
10388 : see if msgrcv exists
10389 set msgrcv d_msgrcv
10390 eval $inlibc
10391
10392 : see how much of the 'msg*(2)' library is present.
10393 h_msg=true
10394 echo " "
10395 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10396 *"$undef"*) h_msg=false;;
10397 esac
10398 case "$osname" in
10399 freebsd)
10400     case "`ipcs 2>&1`" in
10401     "SVID messages"*"not configured"*)
10402         echo "Your $osname does not have the msg*(2) configured." >&4
10403         h_msg=false
10404         val="$undef"
10405         set msgctl d_msgctl
10406         eval $setvar
10407         set msgget d_msgget
10408         eval $setvar
10409         set msgsnd d_msgsnd
10410         eval $setvar
10411         set msgrcv d_msgrcv
10412         eval $setvar
10413         ;;
10414     esac
10415     ;;
10416 esac
10417 : we could also check for sys/ipc.h ...
10418 if $h_msg && $test `./findhdr sys/msg.h`; then
10419         echo "You have the full msg*(2) library." >&4
10420         val="$define"
10421 else
10422         echo "You don't have the full msg*(2) library." >&4
10423         val="$undef"
10424 fi
10425 set d_msg
10426 eval $setvar
10427
10428
10429 echo " "
10430 echo "Checking to see if your system supports struct msghdr..." >&4
10431 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10432 eval $hasstruct
10433 case "$d_msghdr_s" in
10434 "$define")      echo "Yes, it does."   ;;
10435 *)              echo "No, it doesn't." ;;
10436 esac
10437
10438
10439 : see if msync exists
10440 set msync d_msync
10441 eval $inlibc
10442
10443 : see if munmap exists
10444 set munmap d_munmap
10445 eval $inlibc
10446
10447 : see if nice exists
10448 set nice d_nice
10449 eval $inlibc
10450
10451 : check for length of character
10452 echo " "
10453 case "$charsize" in
10454 '')
10455         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10456         $cat >try.c <<'EOCP'
10457 #include <stdio.h>
10458 int main()
10459 {
10460     printf("%d\n", (int)sizeof(char));
10461     exit(0);
10462 }
10463 EOCP
10464         set try
10465         if eval $compile_ok; then
10466                 dflt=`./try`
10467         else
10468                 dflt='1'
10469                 echo "(I can't seem to compile the test program.  Guessing...)"
10470         fi
10471         ;;
10472 *)
10473         dflt="$charsize"
10474         ;;
10475 esac
10476 rp="What is the size of a character (in bytes)?"
10477 . ./myread
10478 charsize="$ans"
10479 $rm -f try.c try
10480
10481 : check for volatile keyword
10482 echo " "
10483 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10484 $cat >try.c <<'EOCP'
10485 int main()
10486 {
10487         typedef struct _goo_struct goo_struct;
10488         goo_struct * volatile goo = ((goo_struct *)0);
10489         struct _goo_struct {
10490                 long long_int;
10491                 int reg_int;
10492                 char char_var;
10493         };
10494         typedef unsigned short foo_t;
10495         char *volatile foo;
10496         volatile int bar;
10497         volatile foo_t blech;
10498         foo = foo;
10499 }
10500 EOCP
10501 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10502         val="$define"
10503         echo "Yup, it does."
10504 else
10505         val="$undef"
10506         echo "Nope, it doesn't."
10507 fi
10508 set d_volatile
10509 eval $setvar
10510 $rm -f try.*
10511
10512
10513 echo " "
10514 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10515
10516 case "$use64bitint:$d_quad:$quadtype" in
10517 define:define:?*)
10518         ivtype="$quadtype"
10519         uvtype="$uquadtype"
10520         ivsize=8
10521         uvsize=8
10522         ;;
10523 *)      ivtype="long"
10524         uvtype="unsigned long"
10525         ivsize=$longsize
10526         uvsize=$longsize
10527         ;;
10528 esac
10529
10530 case "$uselongdouble:$d_longdbl" in
10531 define:define)
10532         nvtype="long double"
10533         nvsize=$longdblsize
10534         ;;
10535 *)      nvtype=double
10536         nvsize=$doublesize
10537         ;;
10538 esac
10539
10540 $echo "(IV will be "$ivtype", $ivsize bytes)"
10541 $echo "(UV will be "$uvtype", $uvsize bytes)"
10542 $echo "(NV will be "$nvtype", $nvsize bytes)"
10543
10544 $cat >try.c <<EOCP
10545 #$i_inttypes I_INTTYPES
10546 #ifdef I_INTTYPES
10547 #include <inttypes.h>
10548 #endif
10549 #include <stdio.h>
10550 int main() {
10551 #ifdef INT8
10552    int8_t i =  INT8_MAX;
10553   uint8_t u = UINT8_MAX;
10554   printf("int8_t\n");
10555 #endif
10556 #ifdef INT16
10557    int16_t i =  INT16_MAX;
10558   uint16_t i = UINT16_MAX;
10559   printf("int16_t\n");
10560 #endif
10561 #ifdef INT32
10562    int32_t i =  INT32_MAX;
10563   uint32_t u = UINT32_MAX;
10564   printf("int32_t\n");
10565 #endif
10566 }
10567 EOCP
10568
10569 case "$i8type" in
10570 '')     case "$charsize" in
10571         1)      i8type=char
10572                 u8type="unsigned char"
10573                 i8size=$charsize
10574                 u8size=$charsize
10575                 ;;
10576         esac
10577         ;;
10578 esac
10579 case "$i8type" in
10580 '')     set try -DINT8
10581         if eval $compile; then
10582                 case "`./try$exe_ext`" in
10583                 int8_t) i8type=int8_t
10584                         u8type=uint8_t
10585                         i8size=1
10586                         u8size=1
10587                         ;;
10588                 esac
10589         fi
10590         ;;
10591 esac
10592 case "$i8type" in
10593 '')     if $test $charsize -ge 1; then
10594                 i8type=char
10595                 u8type="unsigned char"
10596                 i8size=$charsize
10597                 u8size=$charsize
10598         fi
10599         ;;
10600 esac
10601
10602 case "$i16type" in
10603 '')     case "$shortsize" in
10604         2)      i16type=short
10605                 u16type="unsigned short"
10606                 i16size=$shortsize
10607                 u16size=$shortsize
10608                 ;;
10609         esac
10610         ;;
10611 esac
10612 case "$i16type" in
10613 '')     set try -DINT16
10614         if eval $compile; then
10615                 case "`./try$exe_ext`" in
10616                 int16_t)
10617                         i16type=int16_t
10618                         u16type=uint16_t
10619                         i16size=2
10620                         u16size=2
10621                         ;;
10622                 esac
10623         fi
10624         ;;
10625 esac
10626 case "$i16type" in
10627 '')     if $test $shortsize -ge 2; then
10628                 i16type=short
10629                 u16type="unsigned short"
10630                 i16size=$shortsize
10631                 u16size=$shortsize
10632         fi
10633         ;;
10634 esac
10635
10636 case "$i32type" in
10637 '')     case "$longsize" in
10638         4)      i32type=long
10639                 u32type="unsigned long"
10640                 i32size=$longsize
10641                 u32size=$longsize
10642                 ;;
10643         *)      case "$intsize" in
10644                 4)      i32type=int
10645                         u32type="unsigned int"
10646                         i32size=$intsize
10647                         u32size=$intsize
10648                         ;;
10649                 esac
10650                 ;;
10651         esac
10652         ;;
10653 esac
10654 case "$i32type" in
10655 '')     set try -DINT32
10656         if eval $compile; then
10657                 case "`./try$exe_ext`" in
10658                 int32_t)
10659                         i32type=int32_t
10660                         u32type=uint32_t
10661                         i32size=4
10662                         u32size=4
10663                         ;;
10664                 esac
10665         fi
10666         ;;
10667 esac
10668 case "$i32type" in
10669 '')     if $test $intsize -ge 4; then
10670                 i32type=int
10671                 u32type="unsigned int"
10672                 i32size=$intsize
10673                 u32size=$intsize
10674         fi
10675         ;;
10676 esac
10677
10678 case "$i64type" in
10679 '')     case "$d_quad:$quadtype" in
10680         define:?*)
10681                 i64type="$quadtype"
10682                 u64type="$uquadtype"
10683                 i64size=8
10684                 u64size=8
10685                 ;;
10686         esac
10687         ;;
10688 esac
10689
10690 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10691 : volatile so that the compiler has to store it out to memory.
10692 if test X"$d_volatile" = X"$define"; then
10693         volatile=volatile
10694 fi
10695 $cat <<EOP >try.c
10696 #include <stdio.h>
10697 #include <sys/types.h>
10698 #include <signal.h>
10699 #ifdef SIGFPE
10700 $volatile int bletched = 0;
10701 $signal_t blech(s) int s; { bletched = 1; }
10702 #endif
10703 int main() {
10704     $uvtype u = 0;
10705     $nvtype d;
10706     int     n = 8 * $uvsize;
10707     int     i;
10708 #ifdef SIGFPE
10709     signal(SIGFPE, blech);
10710 #endif
10711
10712     for (i = 0; i < n; i++) {
10713       u = u << 1 | ($uvtype)1;
10714       d = ($nvtype)u;
10715       if (($uvtype)d != u)
10716         break;
10717       if (d <= 0)
10718         break;
10719       d = ($nvtype)(u - 1);
10720       if (($uvtype)d != (u - 1))
10721         break;
10722 #ifdef SIGFPE
10723       if (bletched) {
10724         break;
10725 #endif
10726       } 
10727     }
10728     printf("%d\n", ((i == n) ? -n : i));
10729     exit(0);
10730 }
10731 EOP
10732 set try
10733
10734 d_nv_preserves_uv="$undef"
10735 if eval $compile; then
10736         d_nv_preserves_uv_bits="`./try$exe_ext`"
10737 fi
10738 case "$d_nv_preserves_uv_bits" in
10739 \-[1-9]*)       
10740         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10741         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10742         d_nv_preserves_uv="$define"
10743         ;;
10744 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10745         d_nv_preserves_uv="$undef" ;;
10746 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10747         d_nv_preserves_uv_bits="$undef" ;;
10748 esac
10749
10750 $rm -f try.* try
10751
10752
10753 : check for off64_t
10754 echo " "
10755 echo "Checking to see if you have off64_t..." >&4
10756 $cat >try.c <<EOCP
10757 #include <sys/types.h>
10758 #include <unistd.h>
10759 int main() { off64_t x = 7; }
10760 EOCP
10761 set try
10762 if eval $compile; then
10763         val="$define"
10764         echo "You have off64_t."
10765 else
10766         val="$undef"
10767         echo "You do not have off64_t."
10768         case "$lseeksize" in
10769         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10770         esac
10771 fi
10772 $rm -f try.* try
10773 set d_off64_t
10774 eval $setvar
10775
10776 : see if POSIX threads are available
10777 set pthread.h i_pthread
10778 eval $inhdr
10779
10780
10781
10782
10783 : how to create joinable pthreads
10784 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10785         echo " "
10786         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10787         $cat >try.c <<'EOCP'
10788 #include <pthread.h>
10789 int main() {
10790     int detachstate = JOINABLE;
10791 }
10792 EOCP
10793         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10794         if eval $compile; then
10795                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10796                 val="$undef" # Yes, undef.
10797                 set d_old_pthread_create_joinable
10798                 eval $setvar
10799                 val=""
10800                 set old_pthread_create_joinable
10801                 eval $setvar
10802         else
10803                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10804                 if eval $compile; then
10805                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10806                         val="$define"
10807                         set d_old_pthread_create_joinable
10808                         eval $setvar
10809                         val=PTHREAD_CREATE_UNDETACHED
10810                         set old_pthread_create_joinable
10811                         eval $setvar
10812                 else            
10813                         set try -DJOINABLE=__UNDETACHED
10814                         if eval $compile; then
10815                                 echo "You seem to use __UNDETACHED." >&4
10816                                 val="$define"
10817                                 set d_old_pthread_create_joinable
10818                                 eval $setvar
10819                                 val=__UNDETACHED
10820                                 set old_pthread_create_joinable
10821                                 eval $setvar
10822                         else
10823                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10824                                 val="$define"
10825                                 set d_old_pthread_create_joinable
10826                                 eval $setvar
10827                                 val=0
10828                                 set old_pthread_create_joinable
10829                                 eval $setvar
10830                         fi
10831                 fi
10832         fi
10833         $rm -f try try.*
10834 else
10835     d_old_pthread_create_joinable="$undef"
10836     old_pthread_create_joinable=""
10837 fi
10838
10839 : see if pause exists
10840 set pause d_pause
10841 eval $inlibc
10842
10843 : see if pipe exists
10844 set pipe d_pipe
10845 eval $inlibc
10846
10847 : see if poll exists
10848 set poll d_poll
10849 eval $inlibc
10850
10851
10852 : see whether the various POSIXish _yields exist
10853 $cat >try.c <<EOP
10854 #include <pthread.h>
10855 #include <stdio.h>
10856 int main() {
10857 #ifdef SCHED_YIELD
10858         sched_yield();
10859 #else
10860 #ifdef PTHREAD_YIELD
10861         pthread_yield();
10862 #else
10863 #ifdef PTHREAD_YIELD_NULL
10864         pthread_yield(NULL);
10865 #endif
10866 #endif
10867 #endif
10868 }
10869 EOP
10870 : see if sched_yield exists
10871 set try -DSCHED_YIELD
10872 if eval $compile; then
10873     val="$define"
10874     sched_yield='sched_yield()'
10875 else
10876     val="$undef"
10877 fi
10878 case "$usethreads" in
10879 $define)
10880         case "$val" in
10881         $define) echo 'sched_yield() found.' >&4        ;;
10882         *)       echo 'sched_yield() NOT found.' >&4    ;;
10883         esac
10884 esac
10885 set d_sched_yield
10886 eval $setvar
10887
10888 : see if pthread_yield exists
10889 set try -DPTHREAD_YIELD
10890 if eval $compile; then
10891     val="$define"
10892     case "$sched_yield" in
10893     '') sched_yield='pthread_yield()' ;;
10894     esac
10895 else
10896     set try -DPTHREAD_YIELD_NULL
10897     if eval $compile; then
10898         val="$define"
10899         case "$sched_yield" in
10900         '') sched_yield='pthread_yield(NULL)' ;;
10901         esac
10902     else
10903         val="$undef"
10904     fi
10905 fi
10906 case "$usethreads" in
10907 $define)
10908         case "$val" in
10909         $define) echo 'pthread_yield() found.' >&4      ;;
10910         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10911         esac
10912         ;;
10913 esac
10914 set d_pthread_yield
10915 eval $setvar
10916
10917 case "$sched_yield" in
10918 '') sched_yield=undef ;;
10919 esac
10920
10921 $rm -f try try.*
10922
10923 : see if this is a pwd.h system
10924 set pwd.h i_pwd
10925 eval $inhdr
10926
10927 case "$i_pwd" in
10928 $define)
10929         xxx=`./findhdr pwd.h`
10930         $cppstdin $cppflags $cppminus < $xxx >$$.h
10931
10932         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10933                 val="$define"
10934         else
10935                 val="$undef"
10936         fi
10937         set d_pwquota
10938         eval $setvar
10939
10940         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10941                 val="$define"
10942         else
10943                 val="$undef"
10944         fi
10945         set d_pwage
10946         eval $setvar
10947
10948         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10949                 val="$define"
10950         else
10951                 val="$undef"
10952         fi
10953         set d_pwchange
10954         eval $setvar
10955
10956         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10957                 val="$define"
10958         else
10959                 val="$undef"
10960         fi
10961         set d_pwclass
10962         eval $setvar
10963
10964         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10965                 val="$define"
10966         else
10967                 val="$undef"
10968         fi
10969         set d_pwexpire
10970         eval $setvar
10971
10972         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10973                 val="$define"
10974         else
10975                 val="$undef"
10976         fi
10977         set d_pwcomment
10978         eval $setvar
10979
10980         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10981                 val="$define"
10982         else
10983                 val="$undef"
10984         fi
10985         set d_pwgecos
10986         eval $setvar
10987
10988         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10989                 val="$define"
10990         else
10991                 val="$undef"
10992         fi
10993         set d_pwpasswd
10994         eval $setvar
10995
10996         $rm -f $$.h
10997         ;;
10998 *)
10999         val="$undef"; 
11000         set d_pwquota; eval $setvar
11001         set d_pwage; eval $setvar
11002         set d_pwchange; eval $setvar
11003         set d_pwclass; eval $setvar
11004         set d_pwexpire; eval $setvar
11005         set d_pwcomment; eval $setvar
11006         set d_pwgecos; eval $setvar
11007         set d_pwpasswd; eval $setvar
11008         ;;
11009 esac
11010
11011 : see if readdir and friends exist
11012 set readdir d_readdir
11013 eval $inlibc
11014 set seekdir d_seekdir
11015 eval $inlibc
11016 set telldir d_telldir
11017 eval $inlibc
11018 set rewinddir d_rewinddir
11019 eval $inlibc
11020
11021 : see if readlink exists
11022 set readlink d_readlink
11023 eval $inlibc
11024
11025 : see if readv exists
11026 set readv d_readv
11027 eval $inlibc
11028
11029 : see if recvmsg exists
11030 set recvmsg d_recvmsg
11031 eval $inlibc
11032
11033 : see if rename exists
11034 set rename d_rename
11035 eval $inlibc
11036
11037 : see if rmdir exists
11038 set rmdir d_rmdir
11039 eval $inlibc
11040
11041 : see if memory.h is available.
11042 val=''
11043 set memory.h val
11044 eval $inhdr
11045
11046 : See if it conflicts with string.h
11047 case "$val" in
11048 $define)
11049         case "$strings" in
11050         '') ;;
11051         *)
11052                 $cppstdin $cppflags $cppminus < $strings > mem.h
11053                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11054                         echo " "
11055                         echo "We won't be including <memory.h>."
11056                         val="$undef"
11057                 fi
11058                 $rm -f mem.h
11059                 ;;
11060         esac
11061 esac
11062 set i_memory
11063 eval $setvar
11064
11065 : can bcopy handle overlapping blocks?
11066 val="$undef"
11067 case "$d_bcopy" in
11068 "$define")
11069         echo " "
11070         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11071         $cat >try.c <<EOCP
11072 #$i_memory I_MEMORY
11073 #$i_stdlib I_STDLIB
11074 #$i_string I_STRING
11075 #$i_unistd I_UNISTD
11076 EOCP
11077         $cat >>try.c <<'EOCP'
11078 #include <stdio.h>
11079 #ifdef I_MEMORY
11080 #  include <memory.h>
11081 #endif
11082 #ifdef I_STDLIB
11083 #  include <stdlib.h>
11084 #endif
11085 #ifdef I_STRING
11086 #  include <string.h>
11087 #else
11088 #  include <strings.h>
11089 #endif
11090 #ifdef I_UNISTD
11091 #  include <unistd.h>  /* Needed for NetBSD */
11092 #endif
11093 int main()
11094 {
11095 char buf[128], abc[128];
11096 char *b;
11097 int len;
11098 int off;
11099 int align;
11100
11101 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11102
11103 for (align = 7; align >= 0; align--) {
11104         for (len = 36; len; len--) {
11105                 b = buf+align;
11106                 bcopy(abc, b, len);
11107                 for (off = 1; off <= len; off++) {
11108                         bcopy(b, b+off, len);
11109                         bcopy(b+off, b, len);
11110                         if (bcmp(b, abc, len))
11111                                 exit(1);
11112                 }
11113         }
11114 }
11115 exit(0);
11116 }
11117 EOCP
11118         set try
11119         if eval $compile_ok; then
11120                 if ./try 2>/dev/null; then
11121                         echo "Yes, it can."
11122                         val="$define"
11123                 else
11124                         echo "It can't, sorry."
11125                         case "$d_memmove" in
11126                         "$define") echo "But that's Ok since you have memmove()." ;;
11127                         esac
11128                 fi
11129         else
11130                 echo "(I can't compile the test program, so we'll assume not...)"
11131                 case "$d_memmove" in
11132                 "$define") echo "But that's Ok since you have memmove()." ;;
11133                 esac
11134         fi
11135         ;;
11136 esac
11137 $rm -f try.* try core
11138 set d_safebcpy
11139 eval $setvar
11140
11141 : can memcpy handle overlapping blocks?
11142 val="$undef"
11143 case "$d_memcpy" in
11144 "$define")
11145         echo " "
11146         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11147         $cat >try.c <<EOCP
11148 #$i_memory I_MEMORY
11149 #$i_stdlib I_STDLIB
11150 #$i_string I_STRING
11151 #$i_unistd I_UNISTD
11152 EOCP
11153         $cat >>try.c <<'EOCP'
11154 #include <stdio.h>
11155 #ifdef I_MEMORY
11156 #  include <memory.h>
11157 #endif
11158 #ifdef I_STDLIB
11159 #  include <stdlib.h>
11160 #endif
11161 #ifdef I_STRING
11162 #  include <string.h>
11163 #else
11164 #  include <strings.h>
11165 #endif
11166 #ifdef I_UNISTD
11167 #  include <unistd.h>  /* Needed for NetBSD */
11168 #endif
11169 int main()
11170 {
11171 char buf[128], abc[128];
11172 char *b;
11173 int len;
11174 int off;
11175 int align;
11176
11177 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11178    try to store the string in read-only memory. */
11179 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11180
11181 for (align = 7; align >= 0; align--) {
11182         for (len = 36; len; len--) {
11183                 b = buf+align;
11184                 memcpy(b, abc, len);
11185                 for (off = 1; off <= len; off++) {
11186                         memcpy(b+off, b, len);
11187                         memcpy(b, b+off, len);
11188                         if (memcmp(b, abc, len))
11189                                 exit(1);
11190                 }
11191         }
11192 }
11193 exit(0);
11194 }
11195 EOCP
11196         set try
11197         if eval $compile_ok; then
11198                 if ./try 2>/dev/null; then
11199                         echo "Yes, it can."
11200                         val="$define"
11201                 else
11202                         echo "It can't, sorry."
11203                         case "$d_memmove" in
11204                         "$define") echo "But that's Ok since you have memmove()." ;;
11205                         esac
11206                 fi
11207         else
11208                 echo "(I can't compile the test program, so we'll assume not...)"
11209                 case "$d_memmove" in
11210                 "$define") echo "But that's Ok since you have memmove()." ;;
11211                 esac
11212         fi
11213         ;;
11214 esac
11215 $rm -f try.* try core
11216 set d_safemcpy
11217 eval $setvar
11218
11219 : can memcmp be trusted to compare relative magnitude?
11220 val="$undef"
11221 case "$d_memcmp" in
11222 "$define")
11223         echo " "
11224         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11225         $cat >try.c <<EOCP
11226 #$i_memory I_MEMORY
11227 #$i_stdlib I_STDLIB
11228 #$i_string I_STRING
11229 #$i_unistd I_UNISTD
11230 EOCP
11231         $cat >>try.c <<'EOCP'
11232 #include <stdio.h>
11233 #ifdef I_MEMORY
11234 #  include <memory.h>
11235 #endif
11236 #ifdef I_STDLIB
11237 #  include <stdlib.h>
11238 #endif
11239 #ifdef I_STRING
11240 #  include <string.h>
11241 #else
11242 #  include <strings.h>
11243 #endif
11244 #ifdef I_UNISTD
11245 #  include <unistd.h>  /* Needed for NetBSD */
11246 #endif
11247 int main()
11248 {
11249 char a = -1;
11250 char b = 0;
11251 if ((a < b) && memcmp(&a, &b, 1) < 0)
11252         exit(1);
11253 exit(0);
11254 }
11255 EOCP
11256         set try
11257         if eval $compile_ok; then
11258                 if ./try 2>/dev/null; then
11259                         echo "Yes, it can."
11260                         val="$define"
11261                 else
11262                         echo "No, it can't (it uses signed chars)."
11263                 fi
11264         else
11265                 echo "(I can't compile the test program, so we'll assume not...)"
11266         fi
11267         ;;
11268 esac
11269 $rm -f try.* try core
11270 set d_sanemcmp
11271 eval $setvar
11272
11273 : see if prototype for sbrk is available
11274 echo " "
11275 set d_sbrkproto sbrk $i_unistd unistd.h
11276 eval $hasproto
11277
11278 : see if select exists
11279 set select d_select
11280 eval $inlibc
11281
11282 : see if semctl exists
11283 set semctl d_semctl
11284 eval $inlibc
11285
11286 : see if semget exists
11287 set semget d_semget
11288 eval $inlibc
11289
11290 : see if semop exists
11291 set semop d_semop
11292 eval $inlibc
11293
11294 : see how much of the 'sem*(2)' library is present.
11295 h_sem=true
11296 echo " "
11297 case "$d_semctl$d_semget$d_semop" in
11298 *"$undef"*) h_sem=false;;
11299 esac
11300 case "$osname" in
11301 freebsd)
11302     case "`ipcs 2>&1`" in
11303     "SVID messages"*"not configured"*)
11304         echo "Your $osname does not have the sem*(2) configured." >&4
11305         h_sem=false
11306         val="$undef"
11307         set semctl d_semctl
11308         eval $setvar
11309         set semget d_semget
11310         eval $setvar
11311         set semop d_semop
11312         eval $setvar
11313         ;;
11314     esac
11315     ;;
11316 esac
11317 : we could also check for sys/ipc.h ...
11318 if $h_sem && $test `./findhdr sys/sem.h`; then
11319         echo "You have the full sem*(2) library." >&4
11320         val="$define"
11321 else
11322         echo "You don't have the full sem*(2) library." >&4
11323         val="$undef"
11324 fi
11325 set d_sem
11326 eval $setvar
11327
11328 : see whether sys/sem.h defines union semun
11329 echo " "
11330 $cat > try.c <<'END'
11331 #include <sys/types.h>
11332 #include <sys/ipc.h>
11333 #include <sys/sem.h>
11334 int main () { union semun semun; semun.buf = 0; }
11335 END
11336 set try
11337 if eval $compile; then
11338     echo "You have union semun in <sys/sem.h>." >&4
11339     val="$define"
11340 else
11341     echo "You do not have union semun in <sys/sem.h>." >&4
11342     val="$undef"
11343 fi
11344 $rm -f try try.c try.h
11345 set d_union_semun
11346 eval $setvar
11347
11348 : see how to do semctl IPC_STAT
11349 case "$d_sem" in
11350 $define)
11351     : see whether semctl IPC_STAT can use union semun
11352     echo " "
11353     $cat > try.h <<END
11354 #ifndef S_IRUSR
11355 #   ifdef S_IREAD
11356 #       define S_IRUSR S_IREAD
11357 #       define S_IWUSR S_IWRITE
11358 #       define S_IXUSR S_IEXEC
11359 #   else
11360 #       define S_IRUSR 0400
11361 #       define S_IWUSR 0200
11362 #       define S_IXUSR 0100
11363 #   endif
11364 #   define S_IRGRP (S_IRUSR>>3)
11365 #   define S_IWGRP (S_IWUSR>>3)
11366 #   define S_IXGRP (S_IXUSR>>3)
11367 #   define S_IROTH (S_IRUSR>>6)
11368 #   define S_IWOTH (S_IWUSR>>6)
11369 #   define S_IXOTH (S_IXUSR>>6)
11370 #endif
11371 #ifndef S_IRWXU
11372 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11373 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11374 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11375 #endif
11376 END
11377
11378     $cat > try.c <<END
11379 #include <sys/types.h>
11380 #include <sys/ipc.h>
11381 #include <sys/sem.h>
11382 #include <sys/stat.h>
11383 #include <stdio.h>
11384 #include <errno.h>
11385 #include "try.h"
11386 #ifndef errno
11387 extern int errno;
11388 #endif
11389 #$d_union_semun HAS_UNION_SEMUN
11390 int main() {
11391     union semun
11392 #ifndef HAS_UNION_SEMUN
11393     {
11394         int val;
11395         struct semid_ds *buf;
11396         unsigned short *array;
11397     }
11398 #endif
11399     arg;
11400     int sem, st;
11401
11402 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11403     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11404     if (sem > -1) {
11405         struct semid_ds argbuf;
11406         arg.buf = &argbuf;
11407 #       ifdef IPC_STAT
11408         st = semctl(sem, 0, IPC_STAT, arg);
11409         if (st == 0)
11410             printf("semun\n");
11411         else
11412 #       endif /* IPC_STAT */
11413             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11414 #       ifdef IPC_RMID
11415         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11416 #       endif /* IPC_RMID */
11417             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11418     } else
11419 #endif /* IPC_PRIVATE && ... */
11420         printf("semget failed: errno = %d\n", errno);
11421   return 0;
11422 }
11423 END
11424     val="$undef"
11425     set try
11426     if eval $compile; then
11427         xxx=`./try`
11428         case "$xxx" in
11429         semun) val="$define" ;;
11430         esac
11431     fi
11432     $rm -f try try.c
11433     set d_semctl_semun
11434     eval $setvar
11435     case "$d_semctl_semun" in
11436     $define)
11437         echo "You can use union semun for semctl IPC_STAT." >&4
11438         also='also'
11439         ;;
11440     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11441         also=''
11442         ;;
11443     esac
11444
11445     : see whether semctl IPC_STAT can use struct semid_ds pointer
11446     $cat > try.c <<'END'
11447 #include <sys/types.h>
11448 #include <sys/ipc.h>
11449 #include <sys/sem.h>
11450 #include <sys/stat.h>
11451 #include "try.h"
11452 #include <stdio.h>
11453 #include <errno.h>
11454 #ifndef errno
11455 extern int errno;
11456 #endif
11457 int main() {
11458     struct semid_ds arg;
11459     int sem, st;
11460
11461 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11462     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11463     if (sem > -1) {
11464 #       ifdef IPC_STAT
11465         st = semctl(sem, 0, IPC_STAT, &arg);
11466         if (st == 0)
11467             printf("semid_ds\n");
11468         else
11469 #       endif /* IPC_STAT */
11470             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11471 #       ifdef IPC_RMID
11472         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11473 #       endif /* IPC_RMID */
11474             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11475     } else
11476 #endif /* IPC_PRIVATE && ... */
11477         printf("semget failed: errno = %d\n", errno);
11478
11479     return 0;
11480 }
11481 END
11482     val="$undef"
11483     set try
11484     if eval $compile; then
11485         xxx=`./try`
11486         case "$xxx" in
11487         semid_ds) val="$define" ;;
11488         esac
11489     fi
11490     $rm -f try try.c
11491     set d_semctl_semid_ds
11492     eval $setvar
11493     case "$d_semctl_semid_ds" in
11494     $define)
11495         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11496         ;;
11497     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11498         ;;
11499     esac
11500     $rm -f try.h
11501     ;;
11502 *)  val="$undef"
11503
11504     # We do not have the full sem*(2) library, so assume we can not
11505     # use either.
11506
11507     set d_semctl_semun
11508     eval $setvar
11509
11510     set d_semctl_semid_ds
11511     eval $setvar
11512     ;;
11513 esac
11514
11515 : see if sendmsg exists
11516 set sendmsg d_sendmsg
11517 eval $inlibc
11518
11519 : see if setegid exists
11520 set setegid d_setegid
11521 eval $inlibc
11522
11523 : see if seteuid exists
11524 set seteuid d_seteuid
11525 eval $inlibc
11526
11527 : see if setgrent exists
11528 set setgrent d_setgrent
11529 eval $inlibc
11530
11531 : see if sethostent exists
11532 set sethostent d_sethent
11533 eval $inlibc
11534
11535 : see if setitimer exists
11536 set setitimer d_setitimer
11537 eval $inlibc
11538
11539 : see if setlinebuf exists
11540 set setlinebuf d_setlinebuf
11541 eval $inlibc
11542
11543 : see if setlocale exists
11544 set setlocale d_setlocale
11545 eval $inlibc
11546
11547 : see if setnetent exists
11548 set setnetent d_setnent
11549 eval $inlibc
11550
11551 : see if setprotoent exists
11552 set setprotoent d_setpent
11553 eval $inlibc
11554
11555 : see if setpgid exists
11556 set setpgid d_setpgid
11557 eval $inlibc
11558
11559 : see if setpgrp2 exists
11560 set setpgrp2 d_setpgrp2
11561 eval $inlibc
11562
11563 : see if setpriority exists
11564 set setpriority d_setprior
11565 eval $inlibc
11566
11567 : see if setproctitle exists
11568 set setproctitle d_setproctitle
11569 eval $inlibc
11570
11571 : see if setpwent exists
11572 set setpwent d_setpwent
11573 eval $inlibc
11574
11575 : see if setregid exists
11576 set setregid d_setregid
11577 eval $inlibc
11578 set setresgid d_setresgid
11579 eval $inlibc
11580
11581 : see if setreuid exists
11582 set setreuid d_setreuid
11583 eval $inlibc
11584 set setresuid d_setresuid
11585 eval $inlibc
11586
11587 : see if setrgid exists
11588 set setrgid d_setrgid
11589 eval $inlibc
11590
11591 : see if setruid exists
11592 set setruid d_setruid
11593 eval $inlibc
11594
11595 : see if setservent exists
11596 set setservent d_setsent
11597 eval $inlibc
11598
11599 : see if setsid exists
11600 set setsid d_setsid
11601 eval $inlibc
11602
11603 : see if setvbuf exists
11604 set setvbuf d_setvbuf
11605 eval $inlibc
11606
11607 : see if sfio.h is available
11608 set sfio.h i_sfio
11609 eval $inhdr
11610
11611
11612 : see if sfio library is available
11613 case "$i_sfio" in
11614 $define)
11615         val=''
11616         set sfreserve val
11617         eval $inlibc
11618         ;;
11619 *)
11620         val="$undef"
11621         ;;
11622 esac
11623 : Ok, but do we want to use it.
11624 case "$val" in
11625 $define)
11626         case "$usesfio" in
11627         true|$define|[yY]*) dflt='y';;
11628         *) dflt='n';;
11629         esac
11630         echo "$package can use the sfio library, but it is experimental."
11631         case "$useperlio" in
11632         "$undef")
11633             echo "For sfio also the PerlIO abstraction layer is needed."
11634             echo "Earlier you said you wouldn't want that."
11635             ;;
11636         esac
11637         rp="You seem to have sfio available, do you want to try using it?"
11638         . ./myread
11639         case "$ans" in
11640         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11641                 useperlio="$define"
11642                 val="$define"
11643                 ;;
11644         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11645                 val="$undef"
11646                 ;;
11647         esac
11648         ;;
11649 *)      case "$usesfio" in
11650         true|$define|[yY]*)
11651                 echo "Sorry, cannot find sfio on this machine." >&4
11652                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11653                 val="$undef"
11654                 ;;
11655         esac
11656         ;;
11657 esac
11658 set d_sfio
11659 eval $setvar
11660 case "$d_sfio" in
11661 $define) usesfio='true';;
11662 *) usesfio='false';;
11663 esac
11664 case "$d_sfio" in
11665 $define) ;;
11666 *)      : Remove sfio from list of libraries to use
11667         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11668         shift
11669         libs="$*"
11670         echo "libs = $libs" >&4
11671 ;;
11672 esac
11673
11674
11675 : see if shmctl exists
11676 set shmctl d_shmctl
11677 eval $inlibc
11678
11679 : see if shmget exists
11680 set shmget d_shmget
11681 eval $inlibc
11682
11683 : see if shmat exists
11684 set shmat d_shmat
11685 eval $inlibc
11686 : see what shmat returns
11687 case "$d_shmat" in
11688 "$define")
11689         $cat >shmat.c <<'END'
11690 #include <sys/shm.h>
11691 void *shmat();
11692 END
11693         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11694                 shmattype='void *'
11695         else
11696                 shmattype='char *'
11697         fi
11698         echo "and it returns ($shmattype)." >&4
11699         : see if a prototype for shmat is available
11700         xxx=`./findhdr sys/shm.h`
11701         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11702         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11703                 val="$define"
11704         else
11705                 val="$undef"
11706         fi
11707         $rm -f shmat.[co]
11708         ;;
11709 *)
11710         val="$undef"
11711         ;;
11712 esac
11713 set d_shmatprototype
11714 eval $setvar
11715
11716 : see if shmdt exists
11717 set shmdt d_shmdt
11718 eval $inlibc
11719
11720 : see how much of the 'shm*(2)' library is present.
11721 h_shm=true
11722 echo " "
11723 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11724 *"$undef"*) h_shm=false;;
11725 esac
11726 case "$osname" in
11727 freebsd)
11728     case "`ipcs 2>&1`" in
11729     "SVID shared memory"*"not configured"*)
11730         echo "Your $osname does not have the shm*(2) configured." >&4
11731         h_shm=false
11732         val="$undef"
11733         set shmctl d_shmctl
11734         evat $setvar
11735         set shmget d_shmget
11736         evat $setvar
11737         set shmat d_shmat
11738         evat $setvar
11739         set shmdt d_shmdt
11740         evat $setvar
11741         ;;
11742     esac
11743     ;;
11744 esac
11745 : we could also check for sys/ipc.h ...
11746 if $h_shm && $test `./findhdr sys/shm.h`; then
11747         echo "You have the full shm*(2) library." >&4
11748         val="$define"
11749 else
11750         echo "You don't have the full shm*(2) library." >&4
11751         val="$undef"
11752 fi
11753 set d_shm
11754 eval $setvar
11755
11756 echo " "
11757 : see if we have sigaction
11758 if set sigaction val -f d_sigaction; eval $csym; $val; then
11759         echo 'sigaction() found.' >&4
11760         $cat > try.c <<'EOP'
11761 #include <stdio.h>
11762 #include <sys/types.h>
11763 #include <signal.h>
11764 int main()
11765 {
11766     struct sigaction act, oact;
11767     act.sa_flags = 0;
11768     oact.sa_handler = 0;
11769     /* so that act and oact are used */
11770     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11771 }
11772 EOP
11773         set try
11774         if eval $compile_ok; then
11775                 val="$define"
11776         else
11777                 echo "But you don't seem to have a useable struct sigaction." >&4
11778                 val="$undef"
11779         fi
11780 else
11781         echo 'sigaction NOT found.' >&4
11782         val="$undef"
11783 fi
11784 set d_sigaction; eval $setvar
11785 $rm -f try try$_o try.c
11786
11787 : see if sigprocmask exists
11788 set sigprocmask d_sigprocmask
11789 eval $inlibc
11790
11791 : see if sigsetjmp exists
11792 echo " "
11793 case "$d_sigsetjmp" in
11794 '')
11795         $cat >try.c <<'EOP'
11796 #include <setjmp.h>
11797 sigjmp_buf env;
11798 int set = 1;
11799 int main()
11800 {
11801         if (sigsetjmp(env,1))
11802                 exit(set);
11803         set = 0;
11804         siglongjmp(env, 1);
11805         exit(1);
11806 }
11807 EOP
11808         set try
11809         if eval $compile; then
11810                 if ./try >/dev/null 2>&1; then
11811                         echo "POSIX sigsetjmp found." >&4
11812                         val="$define"
11813                 else
11814                         $cat >&4 <<EOM
11815 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11816 I'll ignore them.
11817 EOM
11818                         val="$undef"
11819                 fi
11820         else
11821                 echo "sigsetjmp not found." >&4
11822                 val="$undef"
11823         fi
11824         ;;
11825 *) val="$d_sigsetjmp"
11826         case "$d_sigsetjmp" in
11827         $define) echo "POSIX sigsetjmp found." >&4;;
11828         $undef) echo "sigsetjmp not found." >&4;;
11829         esac
11830         ;;
11831 esac
11832 set d_sigsetjmp
11833 eval $setvar
11834 $rm -f try.c try
11835
11836 : see if sockatmark exists
11837 set sockatmark d_sockatmark
11838 eval $inlibc
11839
11840 : see if socks5_init exists
11841 set socks5_init d_socks5_init
11842 eval $inlibc
11843
11844 : see if sys/stat.h is available
11845 set sys/stat.h i_sysstat
11846 eval $inhdr
11847
11848
11849 : see if stat knows about block sizes
11850 echo " "
11851 echo "Checking to see if your struct stat has st_blocks field..." >&4
11852 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11853 eval $hasfield
11854
11855
11856 : see if this is a sys/vfs.h system
11857 set sys/vfs.h i_sysvfs
11858 eval $inhdr
11859
11860
11861 : see if this is a sys/statfs.h system
11862 set sys/statfs.h i_sysstatfs
11863 eval $inhdr
11864
11865
11866 echo " "
11867 echo "Checking to see if your system supports struct statfs..." >&4
11868 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
11869 eval $hasstruct
11870 case "$d_statfs_s" in
11871 "$define")      echo "Yes, it does."   ;;
11872 *)              echo "No, it doesn't." ;;
11873 esac
11874
11875
11876
11877 : see if struct statfs knows about f_flags
11878 case "$d_statfs_s" in
11879 define) 
11880         echo " "
11881         echo "Checking to see if your struct statfs has f_flags field..." >&4
11882         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
11883         eval $hasfield
11884         ;;
11885 *)      val="$undef"
11886         set d_statfs_f_flags
11887         eval $setvar
11888         ;;
11889 esac
11890 case "$d_statfs_f_flags" in
11891 "$define")      echo "Yes, it does."   ;;
11892 *)              echo "No, it doesn't." ;;
11893 esac
11894
11895 : see if _ptr and _cnt from stdio act std
11896 echo " "
11897
11898 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11899         echo "(Looks like you have stdio.h from BSD.)"
11900         case "$stdio_ptr" in
11901         '') stdio_ptr='((fp)->_p)'
11902                 ptr_lval=$define
11903                 ;;
11904         *)      ptr_lval=$d_stdio_ptr_lval;;
11905         esac
11906         case "$stdio_cnt" in
11907         '') stdio_cnt='((fp)->_r)'
11908                 cnt_lval=$define
11909                 ;;
11910         *)      cnt_lval=$d_stdio_cnt_lval;;
11911         esac
11912         case "$stdio_base" in
11913         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11914         esac
11915         case "$stdio_bufsiz" in
11916         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11917         esac
11918 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11919         echo "(Looks like you have stdio.h from Linux.)"
11920         case "$stdio_ptr" in
11921         '') stdio_ptr='((fp)->_IO_read_ptr)'
11922                 ptr_lval=$define
11923                 ;;
11924         *)      ptr_lval=$d_stdio_ptr_lval;;
11925         esac
11926         case "$stdio_cnt" in
11927         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11928                 cnt_lval=$undef
11929                 ;;
11930         *)      cnt_lval=$d_stdio_cnt_lval;;
11931         esac
11932         case "$stdio_base" in
11933         '') stdio_base='((fp)->_IO_read_base)';;
11934         esac
11935         case "$stdio_bufsiz" in
11936         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11937         esac
11938 else
11939         case "$stdio_ptr" in
11940         '') stdio_ptr='((fp)->_ptr)'
11941                 ptr_lval=$define
11942                 ;;
11943         *)      ptr_lval=$d_stdio_ptr_lval;;
11944         esac
11945         case "$stdio_cnt" in
11946         '') stdio_cnt='((fp)->_cnt)'
11947                 cnt_lval=$define
11948                 ;;
11949         *)      cnt_lval=$d_stdio_cnt_lval;;
11950         esac
11951         case "$stdio_base" in
11952         '') stdio_base='((fp)->_base)';;
11953         esac
11954         case "$stdio_bufsiz" in
11955         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11956         esac
11957 fi
11958
11959 : test whether _ptr and _cnt really work
11960 echo "Checking how std your stdio is..." >&4
11961 $cat >try.c <<EOP
11962 #include <stdio.h>
11963 #define FILE_ptr(fp)    $stdio_ptr
11964 #define FILE_cnt(fp)    $stdio_cnt
11965 int main() {
11966         FILE *fp = fopen("try.c", "r");
11967         char c = getc(fp);
11968         if (
11969                 18 <= FILE_cnt(fp) &&
11970                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11971         )
11972                 exit(0);
11973         exit(1);
11974 }
11975 EOP
11976 val="$undef"
11977 set try
11978 if eval $compile; then
11979         if ./try; then
11980                 echo "Your stdio acts pretty std."
11981                 val="$define"
11982         else
11983                 echo "Your stdio isn't very std."
11984         fi
11985 else
11986         echo "Your stdio doesn't appear very std."
11987 fi
11988 $rm -f try.c try
11989 set d_stdstdio
11990 eval $setvar
11991
11992 : Can _ptr be used as an lvalue?
11993 case "$d_stdstdio$ptr_lval" in
11994 $define$define) val=$define ;;
11995 *) val=$undef ;;
11996 esac
11997 set d_stdio_ptr_lval
11998 eval $setvar
11999
12000 : Can _cnt be used as an lvalue?
12001 case "$d_stdstdio$cnt_lval" in
12002 $define$define) val=$define ;;
12003 *) val=$undef ;;
12004 esac
12005 set d_stdio_cnt_lval
12006 eval $setvar
12007
12008
12009 : test whether setting _ptr sets _cnt as a side effect
12010 d_stdio_ptr_lval_sets_cnt="$undef"
12011 d_stdio_ptr_lval_nochange_cnt="$undef"
12012 case "$d_stdio_ptr_lval$d_stdstdio" in
12013 $define$define)
12014         echo "Checking to see what happens if we set the stdio ptr..." >&4
12015 $cat >try.c <<EOP
12016 #include <stdio.h>
12017 /* Can we scream? */
12018 /* Eat dust sed :-) */
12019 /* In the buffer space, no one can hear you scream. */
12020 #define FILE_ptr(fp)    $stdio_ptr
12021 #define FILE_cnt(fp)    $stdio_cnt
12022 #include <sys/types.h>
12023 int main() {
12024         FILE *fp = fopen("try.c", "r");
12025         int c;
12026         char *ptr;
12027         size_t cnt;
12028         if (!fp) {
12029             puts("Fail even to read");
12030             exit(1);
12031         }
12032         c = getc(fp); /* Read away the first # */
12033         if (c == EOF) {
12034             puts("Fail even to read");
12035             exit(1);
12036         }
12037         if (!(
12038                 18 <= FILE_cnt(fp) &&
12039                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12040         )) {
12041                 puts("Fail even to read");
12042                 exit (1);
12043         }
12044         ptr = (char*) FILE_ptr(fp);
12045         cnt = (size_t)FILE_cnt(fp);
12046
12047         FILE_ptr(fp) += 42;
12048
12049         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12050                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12051                 exit (1);
12052         }
12053         if (FILE_cnt(fp) <= 20) {
12054                 printf ("Fail (<20 chars to test)");
12055                 exit (1);
12056         }
12057         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12058                 puts("Fail compare");
12059                 exit (1);
12060         }
12061         if (cnt == FILE_cnt(fp)) {
12062                 puts("Pass_unchanged");
12063                 exit (0);
12064         }       
12065         if (FILE_cnt(fp) == (cnt - 42)) {
12066                 puts("Pass_changed");
12067                 exit (0);
12068         }
12069         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12070         return 1;
12071
12072 }
12073 EOP
12074         set try
12075         if eval $compile; then
12076                 case `./try$exe_ext` in
12077                 Pass_changed)
12078                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12079                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12080                 Pass_unchanged)
12081                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12082                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12083                 Fail*)
12084                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12085                 *)
12086                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12087         esac
12088         else
12089                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12090         fi
12091         $rm -f try.c try
12092         ;;
12093 esac
12094
12095 : see if _base is also standard
12096 val="$undef"
12097 case "$d_stdstdio" in
12098 $define)
12099         $cat >try.c <<EOP
12100 #include <stdio.h>
12101 #define FILE_base(fp)   $stdio_base
12102 #define FILE_bufsiz(fp) $stdio_bufsiz
12103 int main() {
12104         FILE *fp = fopen("try.c", "r");
12105         char c = getc(fp);
12106         if (
12107                 19 <= FILE_bufsiz(fp) &&
12108                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12109         )
12110                 exit(0);
12111         exit(1);
12112 }
12113 EOP
12114         set try
12115         if eval $compile; then
12116                 if ./try; then
12117                         echo "And its _base field acts std."
12118                         val="$define"
12119                 else
12120                         echo "But its _base field isn't std."
12121                 fi
12122         else
12123                 echo "However, it seems to be lacking the _base field."
12124         fi
12125         $rm -f try.c try
12126         ;;
12127 esac
12128 set d_stdiobase
12129 eval $setvar
12130
12131 $cat >&4 <<EOM
12132 Checking how to access stdio streams by file descriptor number...
12133 EOM
12134 case "$stdio_stream_array" in
12135 '')     $cat >try.c <<EOCP
12136 #include <stdio.h>
12137 int main() {
12138   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12139     printf("yes\n");
12140 }
12141 EOCP
12142         for s in _iob __iob __sF
12143         do
12144                 set try -DSTDIO_STREAM_ARRAY=$s
12145                 if eval $compile; then
12146                         case "`./try$exe_ext`" in
12147                         yes)    stdio_stream_array=$s; break ;;
12148                         esac
12149                 fi
12150         done
12151         $rm -f try.* try$exe_ext
12152 esac
12153 case "$stdio_stream_array" in
12154 '')     $cat >&4 <<EOM
12155 I can't figure out how to access stdio streams by file descriptor number.
12156 EOM
12157         d_stdio_stream_array="$undef"
12158         ;;
12159 *)      $cat >&4 <<EOM
12160 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12161 EOM
12162         d_stdio_stream_array="$define"
12163         ;;
12164 esac
12165
12166 : see if strcoll exists
12167 set strcoll d_strcoll
12168 eval $inlibc
12169
12170 : check for structure copying
12171 echo " "
12172 echo "Checking to see if your C compiler can copy structs..." >&4
12173 $cat >try.c <<'EOCP'
12174 int main()
12175 {
12176         struct blurfl {
12177                 int dyick;
12178         } foo, bar;
12179
12180         foo = bar;
12181 }
12182 EOCP
12183 if $cc -c try.c >/dev/null 2>&1 ; then
12184         val="$define"
12185         echo "Yup, it can."
12186 else
12187         val="$undef"
12188         echo "Nope, it can't."
12189 fi
12190 set d_strctcpy
12191 eval $setvar
12192 $rm -f try.*
12193
12194 : see if strerror and/or sys_errlist[] exist
12195 echo " "
12196 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12197     if set strerror val -f d_strerror; eval $csym; $val; then
12198                 echo 'strerror() found.' >&4
12199                 d_strerror="$define"
12200                 d_strerrm='strerror(e)'
12201                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12202                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12203                         d_syserrlst="$define"
12204                 else
12205                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12206                         d_syserrlst="$undef"
12207                 fi
12208     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12209                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12210                 echo 'strerror() found in string header.' >&4
12211                 d_strerror="$define"
12212                 d_strerrm='strerror(e)'
12213                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12214                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12215                                 d_syserrlst="$define"
12216                 else
12217                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12218                         d_syserrlst="$undef"
12219                 fi
12220     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12221                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12222                 d_strerror="$undef"
12223                 d_syserrlst="$define"
12224                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12225     else
12226                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12227                 d_strerror="$undef"
12228                 d_syserrlst="$undef"
12229                 d_strerrm='"unknown"'
12230     fi
12231 fi
12232
12233 : see if strftime exists
12234 set strftime d_strftime
12235 eval $inlibc
12236
12237 : see if strtod exists
12238 set strtod d_strtod
12239 eval $inlibc
12240
12241 : see if strtol exists
12242 set strtol d_strtol
12243 eval $inlibc
12244
12245 : see if strtold exists
12246 set strtold d_strtold
12247 eval $inlibc
12248
12249 : see if strtoll exists
12250 set strtoll d_strtoll
12251 eval $inlibc
12252
12253 case "$d_longlong-$d_strtoll" in
12254 "$define-$define")
12255         $cat <<EOM
12256 Checking whether your strtoll() works okay...
12257 EOM
12258         $cat >try.c <<'EOCP'
12259 #include <errno.h>
12260 #ifdef __hpux
12261 #define strtoll __strtoll
12262 #endif
12263 #ifdef __EMX__
12264 #define strtoll _strtoll
12265 #endif
12266 #include <stdio.h>
12267 extern long long int strtoll(char *s, char **, int); 
12268 static int bad = 0;
12269 int check(char *s, long long ell, int een) {
12270         long long gll;
12271         errno = 0;
12272         gll = strtoll(s, 0, 10);
12273         if (!((gll == ell) && (errno == een)))
12274                 bad++;
12275 }
12276 int main() {
12277         check(" 1",                                      1LL, 0);
12278         check(" 0",                                      0LL, 0);
12279         check("-1",                                     -1LL, 0);
12280         check("-9223372036854775808", -9223372036854775808LL, 0);
12281         check("-9223372036854775808", -9223372036854775808LL, 0);
12282         check(" 9223372036854775807",  9223372036854775807LL, 0);
12283         check("-9223372036854775808", -9223372036854775808LL, 0);
12284         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12285         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12286         if (!bad)
12287                 printf("ok\n");
12288 }
12289 EOCP
12290         set try
12291         if eval $compile; then
12292                 yyy=`./try`
12293                 case "$yyy" in
12294                 ok) echo "Your strtoll() seems to be working okay." ;;
12295                 *) cat <<EOM >&4
12296 Your strtoll() doesn't seem to be working okay.
12297 EOM
12298                    d_strtoll="$undef"
12299                    ;;
12300                 esac
12301         else
12302                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12303                 d_strtoll="$undef"
12304         fi
12305         ;;
12306 esac
12307
12308 : see if strtoq exists
12309 set strtoq d_strtoq
12310 eval $inlibc
12311
12312 : see if strtoul exists
12313 set strtoul d_strtoul
12314 eval $inlibc
12315
12316 case "$d_strtoul" in
12317 "$define")
12318         $cat <<EOM
12319 Checking whether your strtoul() works okay...
12320 EOM
12321         $cat >try.c <<'EOCP'
12322 #include <errno.h>
12323 #include <stdio.h>
12324 extern unsigned long int strtoul(char *s, char **, int); 
12325 static int bad = 0;
12326 void check(char *s, unsigned long eul, int een) {
12327         unsigned long gul;
12328         errno = 0;
12329         gul = strtoul(s, 0, 10);
12330         if (!((gul == eul) && (errno == een)))
12331                 bad++;
12332 }
12333 int main() {
12334         check(" 1", 1L, 0);
12335         check(" 0", 0L, 0);
12336 EOCP
12337         case "$longsize" in
12338         8)
12339             $cat >>try.c <<'EOCP'
12340         check("18446744073709551615", 18446744073709551615UL, 0);
12341         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12342 #if 0 /* strtoul() for /^-/ strings is undefined. */
12343         check("-1", 18446744073709551615UL, 0);
12344         check("-18446744073709551614", 2, 0);
12345         check("-18446744073709551615", 1, 0);
12346         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12347         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12348 #endif
12349 EOCP
12350                 ;;
12351         4)
12352                     $cat >>try.c <<'EOCP'
12353         check("4294967295", 4294967295UL, 0);
12354         check("4294967296", 4294967295UL, ERANGE);
12355 #if 0 /* strtoul() for /^-/ strings is undefined. */
12356         check("-1", 4294967295UL, 0);
12357         check("-4294967294", 2, 0);
12358         check("-4294967295", 1, 0);
12359         check("-4294967296", 4294967295UL, ERANGE);
12360         check("-4294967297", 4294967295UL, ERANGE);
12361 #endif
12362 EOCP
12363                 ;;
12364         *)
12365 : Should we write these tests to be more portable by sprintf-ing
12366 : ~0 and then manipulating that char string as input for strtol?
12367                 ;;
12368         esac
12369         $cat >>try.c <<'EOCP'
12370         if (!bad)
12371                 printf("ok\n");
12372         return 0;
12373 }
12374 EOCP
12375         set try
12376         if eval $compile; then
12377                 case "`./try`" in
12378                 ok) echo "Your strtoul() seems to be working okay." ;;
12379                 *) cat <<EOM >&4
12380 Your strtoul() doesn't seem to be working okay.
12381 EOM
12382                    d_strtoul="$undef"
12383                    ;;
12384                 esac
12385         fi
12386         ;;
12387 esac
12388
12389 : see if strtoull exists
12390 set strtoull d_strtoull
12391 eval $inlibc
12392
12393 case "$d_longlong-$d_strtoull" in
12394 "$define-$define")
12395         $cat <<EOM
12396 Checking whether your strtoull() works okay...
12397 EOM
12398         $cat >try.c <<'EOCP'
12399 #include <errno.h>
12400 #ifdef __hpux
12401 #define strtoull __strtoull
12402 #endif
12403 #include <stdio.h>
12404 extern unsigned long long int strtoull(char *s, char **, int); 
12405 static int bad = 0;
12406 int check(char *s, long long eull, int een) {
12407         long long gull;
12408         errno = 0;
12409         gull = strtoull(s, 0, 10);
12410         if (!((gull == eull) && (errno == een)))
12411                 bad++;
12412 }
12413 int main() {
12414         check(" 1",                                        1LL, 0);
12415         check(" 0",                                        0LL, 0);
12416         check("18446744073709551615",  18446744073709551615ULL, 0);
12417         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12418 #if 0 /* strtoull() for /^-/ strings is undefined. */
12419         check("-1",                    18446744073709551615ULL, 0);
12420         check("-18446744073709551614",                     2LL, 0);
12421         check("-18446744073709551615",                     1LL, 0);
12422         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12423         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12424 #endif
12425         if (!bad)
12426                 printf("ok\n");
12427 }
12428 EOCP
12429         set try
12430         if eval $compile; then
12431                 case "`./try`" in
12432                 ok) echo "Your strtoull() seems to be working okay." ;;
12433                 *) cat <<EOM >&4
12434 Your strtoull() doesn't seem to be working okay.
12435 EOM
12436                    d_strtoull="$undef"
12437                    ;;
12438                 esac
12439         fi
12440         ;;
12441 esac
12442
12443 : see if strtouq exists
12444 set strtouq d_strtouq
12445 eval $inlibc
12446
12447 case "$d_strtouq" in
12448 "$define")
12449         $cat <<EOM
12450 Checking whether your strtouq() works okay...
12451 EOM
12452         $cat >try.c <<'EOCP'
12453 #include <errno.h>
12454 #include <stdio.h>
12455 extern unsigned long long int strtouq(char *s, char **, int); 
12456 static int bad = 0;
12457 void check(char *s, unsigned long long eull, int een) {
12458         unsigned long long gull;
12459         errno = 0;
12460         gull = strtouq(s, 0, 10);
12461         if (!((gull == eull) && (errno == een)))
12462                 bad++;
12463 }
12464 int main() {
12465         check(" 1",                                        1LL, 0);
12466         check(" 0",                                        0LL, 0);
12467         check("18446744073709551615",  18446744073709551615ULL, 0);
12468         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12469 #if 0 /* strtouq() for /^-/ strings is undefined. */
12470         check("-1",                    18446744073709551615ULL, 0);
12471         check("-18446744073709551614",                     2LL, 0);
12472         check("-18446744073709551615",                     1LL, 0);
12473         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12474         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12475 #endif
12476         if (!bad)
12477                 printf("ok\n");
12478         return 0;
12479 }
12480 EOCP
12481         set try
12482         if eval $compile; then
12483                 case "`./try`" in
12484                 ok) echo "Your strtouq() seems to be working okay." ;;
12485                 *) cat <<EOM >&4
12486 Your strtouq() doesn't seem to be working okay.
12487 EOM
12488                    d_strtouq="$undef"
12489                    ;;
12490                 esac
12491         fi
12492         ;;
12493 esac
12494
12495 : see if strxfrm exists
12496 set strxfrm d_strxfrm
12497 eval $inlibc
12498
12499 : see if symlink exists
12500 set symlink d_symlink
12501 eval $inlibc
12502
12503 : see if syscall exists
12504 set syscall d_syscall
12505 eval $inlibc
12506
12507 : see if sysconf exists
12508 set sysconf d_sysconf
12509 eval $inlibc
12510
12511 : see if system exists
12512 set system d_system
12513 eval $inlibc
12514
12515 : see if tcgetpgrp exists
12516 set tcgetpgrp d_tcgetpgrp
12517 eval $inlibc
12518
12519 : see if tcsetpgrp exists
12520 set tcsetpgrp d_tcsetpgrp
12521 eval $inlibc
12522
12523 : see if prototype for telldir is available
12524 echo " "
12525 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12526 eval $hasproto
12527
12528 : see if this is a sys/times.h system
12529 set sys/times.h i_systimes
12530 eval $inhdr
12531
12532 : see if times exists
12533 echo " "
12534 if set times val -f d_times; eval $csym; $val; then
12535         echo 'times() found.' >&4
12536         d_times="$define"
12537         inc=''
12538         case "$i_systimes" in
12539         "$define") inc='sys/times.h';;
12540         esac
12541         rp="What is the type returned by times() on this system?"
12542         set clock_t clocktype long stdio.h sys/types.h $inc
12543         eval $typedef_ask
12544 else
12545         echo 'times() NOT found, hope that will do.' >&4
12546         d_times="$undef"
12547         clocktype='int'
12548 fi
12549
12550 : see if truncate exists
12551 set truncate d_truncate
12552 eval $inlibc
12553
12554 : see if tzname[] exists
12555 echo " "
12556 if set tzname val -a d_tzname; eval $csym; $val; then
12557         val="$define"
12558         echo 'tzname[] found.' >&4
12559 else
12560         val="$undef"
12561         echo 'tzname[] NOT found.' >&4
12562 fi
12563 set d_tzname
12564 eval $setvar
12565
12566 case "$crosscompile" in
12567 ''|[nN]*) crosscompile="$undef" ;;
12568 esac
12569
12570 case "$osname" in
12571 next|rhapsody|darwin) multiarch="$define" ;;
12572 esac
12573 case "$multiarch" in
12574 ''|[nN]*) multiarch="$undef" ;;
12575 esac
12576
12577 : check for ordering of bytes in a long
12578 echo " "
12579 case "$crosscompile$multiarch" in
12580 *$define*)
12581         $cat <<EOM
12582 You seem to be either cross-compiling or doing a multiarchitecture build,
12583 skipping the byteorder check.
12584
12585 EOM
12586         byteorder='0xffff'
12587         ;;
12588 *)
12589         case "$byteorder" in
12590         '')
12591                 $cat <<'EOM'
12592 In the following, larger digits indicate more significance.  A big-endian
12593 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12594 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12595 machines may have weird orders like 3412.  A Cray will report 87654321,
12596 an Alpha will report 12345678. If the test program works the default is
12597 probably right.
12598 I'm now running the test program...
12599 EOM
12600                 $cat >try.c <<'EOCP'
12601 #include <stdio.h>
12602 int main()
12603 {
12604         int i;
12605         union {
12606                 unsigned long l;
12607                 char c[sizeof(long)];
12608         } u;
12609
12610         if (sizeof(long) > 4)
12611                 u.l = (0x08070605L << 32) | 0x04030201L;
12612         else
12613                 u.l = 0x04030201L;
12614         for (i = 0; i < sizeof(long); i++)
12615                 printf("%c", u.c[i]+'0');
12616         printf("\n");
12617         exit(0);
12618 }
12619 EOCP
12620                 xxx_prompt=y
12621                 set try
12622                 if eval $compile && ./try > /dev/null; then
12623                         dflt=`./try`
12624                         case "$dflt" in
12625                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12626                                 echo "(The test program ran ok.)"
12627                                 echo "byteorder=$dflt"
12628                                 xxx_prompt=n
12629                         ;;
12630                         ????|????????) echo "(The test program ran ok.)" ;;
12631                         *) echo "(The test program didn't run right for some reason.)" ;;
12632                         esac
12633                 else
12634                         dflt='4321'
12635                         cat <<'EOM'
12636 (I can't seem to compile the test program.  Guessing big-endian...)
12637 EOM
12638                 fi
12639                 case "$xxx_prompt" in
12640                 y)
12641                         rp="What is the order of bytes in a long?"
12642                         . ./myread
12643                         byteorder="$ans"
12644                         ;;
12645                 *)      byteorder=$dflt
12646                         ;;
12647                 esac
12648                 ;;
12649         esac
12650         $rm -f try.c try
12651         ;;
12652 esac
12653
12654
12655 $cat <<EOM
12656
12657 Checking to see whether you can access character data unalignedly...
12658 EOM
12659 $cat >try.c <<EOCP
12660 #include <stdio.h>
12661 #define U32 $u32type
12662 #define BYTEORDER $byteorder
12663 int main() {
12664 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12665     U8 buf[] = "\0\0\0\1\0\0\0\0";
12666     U32 *up;
12667     int i;
12668
12669     if (sizeof(U32) != 4) {
12670         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12671         exit(1);
12672     }
12673
12674     fflush(stdout);
12675
12676     for (i = 0; i < 4; i++) {
12677         up = (U32*)(buf + i);
12678         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12679                (*up == 1 << (8*(3-i)))  /* little-endian */
12680               )
12681            )
12682         {
12683             printf("read failed (%x)\n", *up);
12684             exit(2);
12685         }
12686     }
12687
12688     /* write test */
12689     for (i = 0; i < 4; i++) {
12690         up = (U32*)(buf + i);
12691         *up = 0xBeef;
12692         if (*up != 0xBeef) {
12693             printf("write failed (%x)\n", *up);
12694             exit(3);
12695         }
12696     }
12697
12698     exit(0);
12699 #else
12700     printf("1\n");
12701     exit(1);
12702 #endif
12703     return 0;
12704 }
12705 EOCP
12706 set try
12707 if eval $compile_ok; then
12708         echo "(This test may dump core.)" >&4
12709         ./try >&2 >/dev/null
12710         case "$?" in
12711         0)      cat >&4 <<EOM
12712 You can access character data pretty unalignedly.
12713 EOM
12714                 d_u32align="$undef"
12715                 ;;
12716         *)      cat >&4 <<EOM
12717 It seems that you must access character data in an aligned manner.
12718 EOM
12719                 d_u32align="$define"
12720                 ;;
12721         esac
12722         $rm -f core core.try.* try.core
12723 else
12724         rp='Can you access character data at unaligned addresses?'
12725         dflt='n'
12726         . ./myread
12727         case "$ans" in
12728         [yY]*)  d_u32align="$undef"  ;;
12729         *)      d_u32align="$define" ;;
12730         esac
12731 fi
12732
12733 : see if ualarm exists
12734 set ualarm d_ualarm
12735 eval $inlibc
12736
12737 : see if umask exists
12738 set umask d_umask
12739 eval $inlibc
12740
12741 : see if usleep exists
12742 set usleep d_usleep
12743 eval $inlibc
12744
12745 : see if ustat exists
12746 set ustat d_ustat
12747 eval $inlibc
12748
12749 : backward compatibility for d_hvfork
12750 if test X$d_hvfork != X; then
12751         d_vfork="$d_hvfork"
12752         d_hvfork=''
12753 fi
12754 : see if there is a vfork
12755 val=''
12756 set vfork val
12757 eval $inlibc
12758
12759 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12760 : perl on Solaris 2.x, and probably elsewhere.
12761 case "$val" in
12762 $define)
12763         echo " "
12764         case "$usevfork" in
12765         false) dflt='n';;
12766         *) dflt='y';;
12767         esac
12768         cat <<'EOM'
12769  
12770 Perl can only use a vfork() that doesn't suffer from strict
12771 restrictions on calling functions or modifying global data in
12772 the child.  For example, glibc-2.1 contains such a vfork()
12773 that is unsuitable.  If your system provides a proper fork()
12774 call, chances are that you do NOT want perl to use vfork().
12775
12776 EOM
12777         rp="Do you still want to use vfork()?"
12778         . ./myread
12779         case "$ans" in
12780         y|Y) ;;
12781         *)
12782                 echo "Ok, we won't use vfork()."
12783                 val="$undef"
12784                 ;;
12785         esac
12786         ;;
12787 esac
12788 set d_vfork
12789 eval $setvar
12790 case "$d_vfork" in
12791 $define) usevfork='true';;
12792 *) usevfork='false';;
12793 esac
12794
12795 : see if this is an sysdir system
12796 set sys/dir.h i_sysdir
12797 eval $inhdr
12798
12799 : see if this is an sysndir system
12800 set sys/ndir.h i_sysndir
12801 eval $inhdr
12802
12803 : see if closedir exists
12804 set closedir d_closedir
12805 eval $inlibc
12806
12807 case "$d_closedir" in
12808 "$define")
12809         echo " "
12810         echo "Checking whether closedir() returns a status..." >&4
12811         cat > closedir.c <<EOM
12812 #$i_dirent I_DIRENT             /**/
12813 #$i_sysdir I_SYS_DIR            /**/
12814 #$i_sysndir I_SYS_NDIR          /**/
12815 #$i_systypes I_SYS_TYPES        /**/
12816
12817 #if defined(I_SYS_TYPES)
12818 #include <sys/types.h>
12819 #endif
12820 #if defined(I_DIRENT)
12821 #include <dirent.h>
12822 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12823 #include <sys/dir.h>
12824 #endif
12825 #else
12826 #ifdef I_SYS_NDIR
12827 #include <sys/ndir.h>
12828 #else
12829 #ifdef I_SYS_DIR
12830 #ifdef hp9000s500
12831 #include <ndir.h>       /* may be wrong in the future */
12832 #else
12833 #include <sys/dir.h>
12834 #endif
12835 #endif
12836 #endif
12837 #endif 
12838 int main() { return closedir(opendir(".")); }
12839 EOM
12840         set closedir
12841         if eval $compile_ok; then
12842                 if ./closedir > /dev/null 2>&1 ; then
12843                         echo "Yes, it does."
12844                         val="$undef"
12845                 else
12846                         echo "No, it doesn't."
12847                         val="$define"
12848                 fi
12849         else
12850                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12851                 val="$define"
12852         fi
12853         ;;
12854 *)
12855         val="$undef";
12856         ;;
12857 esac
12858 set d_void_closedir
12859 eval $setvar
12860 $rm -f closedir*
12861 : see if there is a wait4
12862 set wait4 d_wait4
12863 eval $inlibc
12864
12865 : see if waitpid exists
12866 set waitpid d_waitpid
12867 eval $inlibc
12868
12869 : see if wcstombs exists
12870 set wcstombs d_wcstombs
12871 eval $inlibc
12872
12873 : see if wctomb exists
12874 set wctomb d_wctomb
12875 eval $inlibc
12876
12877 : see if writev exists
12878 set writev d_writev
12879 eval $inlibc
12880
12881 : preserve RCS keywords in files with variable substitution, grrr
12882 Date='$Date'
12883 Id='$Id'
12884 Log='$Log'
12885 RCSfile='$RCSfile'
12886 Revision='$Revision'
12887
12888 : check for alignment requirements
12889 echo " "
12890 case "$crosscompile$multiarch" in
12891 *$define*)
12892         $cat <<EOM
12893 You seem to be either cross-compiling or doing a multiarchitecture build,
12894 skipping the memory alignment check.
12895
12896 EOM
12897         case "$alignbytes" in
12898         '') alignbytes=8 ;;
12899         esac
12900         ;;
12901 *)
12902         case "$alignbytes" in
12903         '') echo "Checking alignment constraints..." >&4
12904                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12905                         $cat >try.c <<'EOCP'
12906 typedef long double NV;
12907 EOCP
12908                 else
12909                         $cat >try.c <<'EOCP'
12910 typedef double NV;
12911 EOCP
12912                 fi
12913                 $cat >>try.c <<'EOCP'
12914 #include <stdio.h>
12915 struct foobar {
12916         char foo;
12917         NV bar;
12918 } try_algn;
12919 int main()
12920 {
12921     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12922     return(0);
12923 }
12924 EOCP
12925                 set try
12926                 if eval $compile_ok; then
12927                         dflt=`./try`
12928                 else
12929                         dflt='8'
12930                         echo "(I can't seem to compile the test program...)"
12931                 fi
12932                 ;;
12933         *) dflt="$alignbytes"
12934                 ;;
12935         esac
12936         rp="Doubles must be aligned on a how-many-byte boundary?"
12937         . ./myread
12938         alignbytes="$ans"
12939         $rm -f try.c try
12940         ;;
12941 esac
12942
12943
12944 : set the base revision
12945 baserev=5.0
12946
12947 : how do we catenate cpp tokens here?
12948 echo " "
12949 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12950 $cat >cpp_stuff.c <<'EOCP'
12951 #define RCAT(a,b)a/**/b
12952 #define ACAT(a,b)a ## b
12953 RCAT(Rei,ser)
12954 ACAT(Cir,cus)
12955 EOCP
12956 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12957 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12958         echo "Oh!  Smells like ANSI's been here." >&4
12959         echo "We can catify or stringify, separately or together!"
12960         cpp_stuff=42
12961 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12962         echo "Ah, yes!  The good old days!" >&4
12963         echo "However, in the good old days we don't know how to stringify and"
12964         echo "catify at the same time."
12965         cpp_stuff=1
12966 else
12967         $cat >&4 <<EOM
12968 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12969 to have to edit the values of CAT[2-5] in config.h...
12970 EOM
12971         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12972 fi
12973 $rm -f cpp_stuff.*
12974
12975 : see if this is a db.h system
12976 set db.h i_db
12977 eval $inhdr
12978
12979 case "$i_db" in
12980 $define)
12981         : Check db version.
12982         echo " "
12983         echo "Checking Berkeley DB version ..." >&4
12984         $cat >try.c <<EOCP
12985 #$d_const HASCONST
12986 #ifndef HASCONST
12987 #define const
12988 #endif
12989 #include <sys/types.h>
12990 #include <stdio.h>
12991 #include <db.h>
12992 int main()
12993 {
12994 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12995     int Major, Minor, Patch ;
12996     unsigned long Version ;
12997     (void)db_version(&Major, &Minor, &Patch) ;
12998     printf("You have Berkeley DB Version 2 or greater\n");
12999
13000     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13001                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13002     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13003                 Major, Minor, Patch) ;
13004
13005     /* check that db.h & libdb are compatible */
13006     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13007         printf("db.h and libdb are incompatible\n") ;
13008         exit(3);        
13009     }
13010
13011     printf("db.h and libdb are compatible\n") ;
13012
13013     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13014                 + DB_VERSION_PATCH ;
13015
13016     /* needs to be >= 2.3.4 */
13017     if (Version < 2003004) {
13018     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13019         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
13020         exit(2);        
13021     }
13022
13023     exit(0);
13024 #else
13025 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13026     printf("You have Berkeley DB Version 1\n");
13027     exit(0);    /* DB version < 2: the coast is clear. */
13028 #else
13029     exit(1);    /* <db.h> not Berkeley DB? */
13030 #endif
13031 #endif
13032 }
13033 EOCP
13034         set try
13035         if eval $compile_ok && ./try; then
13036                 echo 'Looks OK.' >&4
13037         else
13038                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13039                 i_db=$undef
13040                 case " $libs " in
13041                 *"-ldb "*)
13042                         : Remove db from list of libraries to use
13043                         echo "Removing unusable -ldb from library list" >&4
13044                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13045                         shift
13046                         libs="$*"
13047                         echo "libs = $libs" >&4
13048                         ;;
13049                 esac
13050         fi
13051         $rm -f try.*
13052         ;;
13053 esac
13054
13055 case "$i_db" in
13056 define)
13057         : Check the return type needed for hash 
13058         echo " "
13059         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13060         $cat >try.c <<EOCP
13061 #$d_const HASCONST
13062 #ifndef HASCONST
13063 #define const
13064 #endif
13065 #include <sys/types.h>
13066 #include <db.h>
13067
13068 #ifndef DB_VERSION_MAJOR
13069 u_int32_t hash_cb (ptr, size)
13070 const void *ptr;
13071 size_t size;
13072 {
13073 }
13074 HASHINFO info;
13075 int main()
13076 {
13077         info.hash = hash_cb;
13078 }
13079 #endif
13080 EOCP
13081         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13082                 if $contains warning try.out >>/dev/null 2>&1 ; then
13083                         db_hashtype='int'
13084                 else
13085                         db_hashtype='u_int32_t'
13086                 fi
13087         else
13088                 : XXX Maybe we should just give up here.
13089                 db_hashtype=u_int32_t
13090                 $cat try.out >&4
13091                 echo "Help:  I can't seem to compile the db test program." >&4
13092                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13093         fi
13094         $rm -f try.*
13095         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13096         ;;
13097 *)      db_hashtype=u_int32_t
13098         ;;
13099 esac
13100 case "$i_db" in
13101 define)
13102         : Check the return type needed for prefix 
13103         echo " "
13104         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13105         cat >try.c <<EOCP
13106 #$d_const HASCONST
13107 #ifndef HASCONST
13108 #define const
13109 #endif
13110 #include <sys/types.h>
13111 #include <db.h>
13112
13113 #ifndef DB_VERSION_MAJOR
13114 size_t prefix_cb (key1, key2)
13115 const DBT *key1;
13116 const DBT *key2;
13117 {
13118 }
13119 BTREEINFO info;
13120 int main()
13121 {
13122         info.prefix = prefix_cb;
13123 }
13124 #endif
13125 EOCP
13126         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13127                 if $contains warning try.out >>/dev/null 2>&1 ; then
13128                         db_prefixtype='int'
13129                 else
13130                         db_prefixtype='size_t'
13131                 fi
13132         else
13133                 db_prefixtype='size_t'
13134                 : XXX Maybe we should just give up here.
13135                 $cat try.out >&4
13136                 echo "Help:  I can't seem to compile the db test program." >&4
13137                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13138         fi
13139         $rm -f try.*
13140         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13141         ;;
13142 *)      db_prefixtype='size_t'
13143         ;;
13144 esac
13145
13146
13147 : How can we generate normalized random numbers ?
13148 echo " "
13149 echo "Looking for a random number function..." >&4
13150 case "$randfunc" in
13151 '')
13152         if set drand48 val -f; eval $csym; $val; then
13153                 dflt="drand48"
13154                 echo "Good, found drand48()." >&4
13155         elif set random val -f; eval $csym; $val; then
13156                 dflt="random"
13157                 echo "OK, found random()." >&4
13158         else
13159                 dflt="rand"
13160                 echo "Yick, looks like I have to use rand()." >&4
13161         fi
13162         echo " "
13163         ;;
13164 *)
13165         dflt="$randfunc"
13166         ;;
13167 esac
13168 cont=true
13169
13170 case "$ccflags" in
13171 *-Dmy_rand=*|*-Dmy_srand=*)
13172         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13173         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13174         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13175         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13176         ;;
13177 esac
13178
13179 while $test "$cont"; do
13180         rp="Use which function to generate random numbers?"
13181         . ./myread
13182         if $test "$ans" = "$dflt"; then
13183                 : null
13184         else
13185                 randbits=''
13186         fi
13187         randfunc="$ans"
13188         if set $ans val -f; eval $csym; $val; then
13189                 cont=''
13190         else
13191                 dflt=y
13192                 rp="I cannot find function $ans. Use that name anyway?"
13193                 . ./myread
13194                 dflt=rand
13195                 case "$ans" in
13196                         [yY]*) cont='';;
13197                 esac
13198         fi
13199         case "$cont" in
13200         '')
13201                 case "$randfunc" in
13202                 drand48)
13203                         drand01="drand48()"
13204                         seedfunc="srand48"
13205                         randbits=48
13206                         randseedtype=long
13207                         ;;
13208                 rand|random)
13209                         case "$randbits" in
13210                         '')
13211 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13212                                 $cat >try.c <<EOCP
13213 #$i_unistd I_UNISTD
13214 #$i_stdlib I_STDLIB
13215 #include <stdio.h>
13216 #ifdef I_UNISTD
13217 #  include <unistd.h>
13218 #endif
13219 #ifdef I_STDLIB
13220 #  include <stdlib.h>
13221 #endif
13222 int main()
13223 {
13224         register int i;
13225         register unsigned long tmp;
13226         register unsigned long max = 0L;
13227
13228         for (i = 1000; i; i--) {
13229                 tmp = (unsigned long) $randfunc();
13230                 if (tmp > max) max = tmp;
13231         }
13232         for (i = 0; max; i++)
13233                 max /= 2;
13234         printf("%d\n",i);
13235 }
13236 EOCP
13237                                 set try
13238                                 if eval $compile_ok; then
13239                                         dflt=`try`
13240                                 else
13241                                         dflt='?'
13242                                         echo "(I can't seem to compile the test program...)"
13243                                 fi
13244                                 ;;
13245                         *)
13246                                 dflt="$randbits"
13247                                 ;;
13248                         esac
13249                         rp="How many bits does your $randfunc() function produce?"
13250                         . ./myread
13251                         randbits="$ans"
13252                         $rm -f try.c try
13253                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13254                         seedfunc="s$randfunc"
13255                         randseedtype=unsigned
13256                         ;;
13257                 *)
13258                         dflt="31"
13259                         rp="How many bits does your $randfunc() function produce?"
13260                         . ./myread
13261                         randbits="$ans"
13262                         seedfunc="s$randfunc"
13263                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13264                         if set $seedfunc val -f; eval $csym; $val; then
13265                                 echo "(Using $seedfunc() to seed random generator)"
13266                         else
13267                                 echo "(Warning: no $seedfunc() to seed random generator)"
13268                                 seedfunc=rand
13269                         fi
13270                         randseedtype=unsigned
13271                         ;;
13272                 esac
13273                 ;;
13274         esac
13275 done
13276
13277 echo " "
13278 echo "Determining whether or not we are on an EBCDIC system..." >&4
13279 $cat >tebcdic.c <<'EOM'
13280 int main()
13281 {
13282   if ('M'==0xd4) return 0;
13283   return 1;
13284 }
13285 EOM
13286
13287 val=$undef
13288 set tebcdic
13289 if eval $compile_ok; then
13290         if ./tebcdic; then
13291                 echo "You seem to speak EBCDIC." >&4
13292                 val="$define"
13293         else
13294                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13295         fi
13296 else
13297         echo "I'm unable to compile the test program." >&4
13298         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13299 fi
13300 $rm -f tebcdic.c tebcdic
13301 set ebcdic
13302 eval $setvar
13303
13304 echo " "
13305 $cat >&4 <<EOM
13306 Checking how to flush all pending stdio output...
13307 EOM
13308 # I only know how to find the first 32 possibly open files on SunOS.
13309 # See also hints/sunos_4_1.sh and util.c  --AD
13310 case "$osname" in
13311 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13312 esac
13313 $cat >>try.c <<EOCP
13314 #include <stdio.h>
13315 #$i_unistd I_UNISTD
13316 #ifdef I_UNISTD
13317 # include <unistd.h>
13318 #endif
13319 #$d_sysconf HAS_SYSCONF
13320 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13321 #ifdef HAS_STDIO_STREAM_ARRAY
13322 # define STDIO_STREAM_ARRAY $stdio_stream_array
13323 #endif
13324 int main() {
13325   FILE* p = fopen("try.out", "w");
13326 #ifdef TRY_FPUTC
13327   fputc('x', p);
13328 #else
13329 # ifdef TRY_FPRINTF
13330   fprintf(p, "x");
13331 # endif
13332 #endif
13333 #ifdef TRY_FFLUSH_NULL
13334   fflush(NULL);
13335 #endif
13336 #ifdef TRY_FFLUSH_ALL
13337   {
13338     long open_max = -1;
13339 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13340     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13341 # else
13342 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13343     open_max = sysconf(_SC_OPEN_MAX);
13344 #  else
13345 #   ifdef FOPEN_MAX
13346     open_max = FOPEN_MAX;
13347 #   else
13348 #    ifdef OPEN_MAX
13349     open_max = OPEN_MAX;
13350 #    else
13351 #     ifdef _NFILE
13352     open_max = _NFILE;
13353 #     endif
13354 #    endif
13355 #   endif
13356 #  endif
13357 # endif 
13358 # ifdef HAS_STDIO_STREAM_ARRAY
13359     if (open_max > 0) {
13360       long i;
13361       for (i = 0; i < open_max; i++)
13362             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13363                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13364                 STDIO_STREAM_ARRAY[i]._flag)
13365                 fflush(&STDIO_STREAM_ARRAY[i]);
13366     }   
13367   }
13368 # endif
13369 #endif
13370   _exit(42);
13371 }
13372 EOCP
13373 : first we have to find out how _not_ to flush
13374 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13375     output=''
13376     set try -DTRY_FPUTC
13377     if eval $compile; then
13378             $rm -f try.out
13379             ./try$exe_ext 2>/dev/null
13380             if $test ! -s try.out -a "X$?" = X42; then
13381                 output=-DTRY_FPUTC
13382             fi
13383     fi
13384     case "$output" in
13385     '')
13386             set try -DTRY_FPRINTF
13387             $rm -f try.out
13388             if eval $compile; then
13389                     $rm -f try.out
13390                     ./try$exe_ext 2>/dev/null
13391                     if $test ! -s try.out -a "X$?" = X42; then
13392                         output=-DTRY_FPRINTF
13393                     fi
13394             fi
13395         ;;
13396     esac
13397 fi
13398 : check for fflush NULL behaviour
13399 case "$fflushNULL" in
13400 '')     set try -DTRY_FFLUSH_NULL $output
13401         if eval $compile; then
13402                 $rm -f try.out
13403                 ./try$exe_ext 2>/dev/null
13404                 code="$?"
13405                 if $test -s try.out -a "X$code" = X42; then
13406                         fflushNULL="`$cat try.out`"
13407                 else
13408                         if $test "X$code" != X42; then
13409                                 $cat >&4 <<EOM
13410 (If this test failed, don't worry, we'll try another method shortly.)
13411 EOM
13412                         fi
13413                 fi
13414         fi
13415         $rm -f core try.core core.try.*
13416         case "$fflushNULL" in
13417         x)      $cat >&4 <<EOM
13418 Your fflush(NULL) works okay for output streams.
13419 Let's see if it clobbers input pipes...
13420 EOM
13421 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13422 # bug that improperly flushes the input end of pipes.  So we avoid the
13423 # autoflush on fork/system/exec support for now. :-(
13424 $cat >tryp.c <<EOCP
13425 #include <stdio.h>
13426 int
13427 main(int argc, char **argv)
13428 {
13429     char buf[1024];
13430     int i;
13431     char *bp = buf;
13432     while (1) {
13433         while ((i = getc(stdin)) != -1
13434                && (*bp++ = i) != '\n'
13435                && bp < &buf[1024])
13436         /* DO NOTHING */ ;
13437         *bp = '\0';
13438         fprintf(stdout, "%s", buf);
13439         fflush(NULL);
13440         if (i == -1)
13441             return 0;
13442         bp = buf;
13443     }
13444 }
13445 EOCP
13446                 fflushNULL="$define"
13447                 set tryp
13448                 if eval $compile; then
13449                     $rm -f tryp.out
13450                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13451                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13452                        $cat >&4 <<EOM
13453 fflush(NULL) seems to behave okay with input streams.
13454 EOM
13455                         fflushNULL="$define"
13456                     else
13457                         $cat >&4 <<EOM
13458 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13459 EOM
13460                         fflushNULL="$undef"
13461                     fi
13462                 fi
13463                 $rm -f core tryp.c tryp.core core.tryp.*
13464                 ;;
13465         '')     $cat >&4 <<EOM
13466 Your fflush(NULL) isn't working (contrary to ANSI C).
13467 EOM
13468                 fflushNULL="$undef"
13469                 ;;
13470         *)      $cat >&4 <<EOM
13471 Cannot figure out whether your fflush(NULL) works or not.
13472 I'm assuming it doesn't (contrary to ANSI C).
13473 EOM
13474                 fflushNULL="$undef"
13475                 ;;
13476         esac
13477         ;;
13478 $define|true|[yY]*)
13479         fflushNULL="$define"
13480         ;;
13481 *)
13482         fflushNULL="$undef"
13483         ;;
13484 esac
13485 : check explicit looping only if NULL did not work, and if the pipe
13486 : bug does not show up on an explicit flush too
13487 case "$fflushNULL" in
13488 "$undef")
13489         $cat >tryp.c <<EOCP
13490 #include <stdio.h>
13491 int
13492 main(int argc, char **argv)
13493 {
13494     char buf[1024];
13495     int i;
13496     char *bp = buf;
13497     while (1) {
13498         while ((i = getc(stdin)) != -1
13499                && (*bp++ = i) != '\n'
13500                && bp < &buf[1024])
13501         /* DO NOTHING */ ;
13502         *bp = '\0';
13503         fprintf(stdout, "%s", buf);
13504         fflush(stdin);
13505         if (i == -1)
13506             return 0;
13507         bp = buf;
13508     }
13509 }
13510 EOCP
13511         set tryp
13512         if eval $compile; then
13513             $rm -f tryp.out
13514             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13515             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13516                $cat >&4 <<EOM
13517 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13518 EOM
13519                 : now check for fflushall behaviour
13520                 case "$fflushall" in
13521                 '')     set try -DTRY_FFLUSH_ALL $output
13522                         if eval $compile; then
13523                                 $cat >&4 <<EOM
13524 (Now testing the other method--but note that this also may fail.)
13525 EOM
13526                                 $rm -f try.out
13527                                 ./try$exe_ext 2>/dev/null
13528                                 if $test -s try.out -a "X$?" = X42; then
13529                                         fflushall="`$cat try.out`"
13530                                 fi
13531                         fi
13532                         $rm -f core try.core core.try.*
13533                         case "$fflushall" in
13534                         x)      $cat >&4 <<EOM
13535 Whew. Flushing explicitly all the stdio streams works.
13536 EOM
13537                                 fflushall="$define"
13538                                 ;;
13539                         '')     $cat >&4 <<EOM
13540 Sigh. Flushing explicitly all the stdio streams doesn't work.
13541 EOM
13542                                 fflushall="$undef"
13543                                 ;;
13544                         *)      $cat >&4 <<EOM
13545 Cannot figure out whether flushing stdio streams explicitly works or not.
13546 I'm assuming it doesn't.
13547 EOM
13548                                 fflushall="$undef"
13549                                 ;;
13550                         esac
13551                         ;;
13552                 "$define"|true|[yY]*)
13553                         fflushall="$define"
13554                         ;;
13555                 *)
13556                         fflushall="$undef"
13557                         ;;
13558                 esac
13559             else
13560                 $cat >&4 <<EOM
13561 All is futile.  Even fflush(stdin) clobbers input pipes!
13562 EOM
13563                 fflushall="$undef"
13564             fi
13565         else
13566             fflushall="$undef"
13567         fi
13568         $rm -f core tryp.c tryp.core core.tryp.*
13569         ;;
13570 *)      fflushall="$undef"
13571         ;;
13572 esac
13573
13574 case "$fflushNULL$fflushall" in
13575 undefundef)
13576         $cat <<EOM
13577 OK, I give up.  I cannot figure out how to flush pending stdio output.
13578 We won't be flushing handles at all before fork/exec/popen.
13579 EOM
13580         ;;
13581 esac
13582 $rm -f try.* try$exe_ext
13583
13584 : Store the full pathname to the ar program for use in the C program
13585 : Respect a hint or command line value for full_ar.
13586 case "$full_ar" in
13587 '') full_ar=$ar ;;
13588 esac
13589
13590 : Store the full pathname to the sed program for use in the C program
13591 full_sed=$sed
13592
13593 : see what type gids are declared as in the kernel
13594 echo " "
13595 echo "Looking for the type for group ids returned by getgid()."
13596 set gid_t gidtype xxx stdio.h sys/types.h
13597 eval $typedef
13598 case "$gidtype" in
13599 xxx)
13600         xxx=`./findhdr sys/user.h`
13601         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13602         case $1 in
13603         unsigned) dflt="$1 $2" ;;
13604         *) dflt="$1" ;;
13605         esac
13606         ;;
13607 *) dflt="$gidtype";;
13608 esac
13609 case "$gidtype" in
13610 gid_t) echo "gid_t found." ;;
13611 *)      rp="What is the type for group ids returned by getgid()?"
13612         . ./myread
13613         gidtype="$ans"
13614         ;;
13615 esac
13616
13617 echo " "
13618 case "$gidtype" in
13619 *_t) zzz="$gidtype"     ;;
13620 *)   zzz="gid"          ;;
13621 esac
13622 echo "Checking the size of $zzz..." >&4 
13623 cat > try.c <<EOCP
13624 #include <sys/types.h>
13625 #include <stdio.h>
13626 int main() {
13627     printf("%d\n", (int)sizeof($gidtype));
13628     exit(0);
13629 }
13630 EOCP
13631 set try
13632 if eval $compile_ok; then
13633         yyy=`./try`
13634         case "$yyy" in
13635         '')     gidsize=4
13636                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13637                 ;;
13638         *)      gidsize=$yyy
13639                 echo "Your $zzz is $gidsize bytes long."
13640                 ;;
13641         esac
13642 else
13643         gidsize=4
13644         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13645 fi
13646
13647
13648 echo " "
13649 case "$gidtype" in
13650 *_t) zzz="$gidtype"     ;;
13651 *)   zzz="gid"          ;;
13652 esac
13653 echo "Checking the sign of $zzz..." >&4 
13654 cat > try.c <<EOCP
13655 #include <sys/types.h>
13656 #include <stdio.h>
13657 int main() {
13658         $gidtype foo = -1;
13659         if (foo < 0)
13660                 printf("-1\n");
13661         else
13662                 printf("1\n");
13663 }
13664 EOCP
13665 set try
13666 if eval $compile; then
13667         yyy=`./try`
13668         case "$yyy" in
13669         '')     gidsign=1
13670                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13671                 ;;
13672         *)      gidsign=$yyy
13673                 case "$gidsign" in
13674                  1) echo "Your $zzz is unsigned." ;;
13675                 -1) echo "Your $zzz is signed."   ;;
13676                 esac
13677                 ;;
13678         esac
13679 else
13680         gidsign=1
13681         echo "(I can't compile the test program--guessing unsigned.)" >&4
13682 fi
13683
13684
13685 echo " "
13686
13687 if $test X"$quadtype" != X; then
13688
13689 echo "Checking how to print 64-bit integers..." >&4
13690
13691 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13692         $cat >try.c <<'EOCP'
13693 #include <sys/types.h>
13694 #include <stdio.h>
13695 int main() {
13696   int q = 12345678901;
13697   printf("%ld\n", q);
13698 }
13699 EOCP
13700         set try
13701         if eval $compile; then
13702                 yyy=`./try$exe_ext`
13703                 case "$yyy" in
13704                 12345678901)
13705                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13706                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13707                         echo "We will use %d."
13708                         ;;
13709                 esac
13710         fi
13711 fi
13712
13713 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13714         $cat >try.c <<'EOCP'
13715 #include <sys/types.h>
13716 #include <stdio.h>
13717 int main() {
13718   long q = 12345678901;
13719   printf("%ld\n", q);
13720 }
13721 EOCP
13722         set try
13723         if eval $compile; then
13724                 yyy=`./try$exe_ext`
13725                 case "$yyy" in
13726                 12345678901)
13727                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13728                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13729                         echo "We will use %ld."
13730                         ;;
13731                 esac
13732         fi
13733 fi
13734
13735 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13736         $cat >try.c <<'EOCP'
13737 #include <sys/types.h>
13738 #include <inttypes.h>
13739 #include <stdio.h>
13740 int main() {
13741   int64_t q = 12345678901;
13742   printf("%" PRId64 "\n", q);
13743 }
13744 EOCP
13745         set try
13746         if eval $compile; then
13747                 yyy=`./try$exe_ext`
13748                 case "$yyy" in
13749                 12345678901)
13750                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13751                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13752                         echo "We will use the C9X style."
13753                         ;;
13754                 esac
13755         fi
13756 fi
13757
13758 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13759         $cat >try.c <<'EOCP'
13760 #include <sys/types.h>
13761 #include <stdio.h>
13762 int main() {
13763   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13764   printf("%lld\n", q);
13765 }
13766 EOCP
13767         set try
13768         if eval $compile; then
13769                 yyy=`./try$exe_ext`
13770                 case "$yyy" in
13771                 12345678901)
13772                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13773                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13774                         echo "We will use the %lld style."
13775                         ;;
13776                 esac
13777         fi
13778 fi
13779
13780 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13781         $cat >try.c <<EOCP
13782 #include <sys/types.h>
13783 #include <stdio.h>
13784 int main() {
13785   $quadtype q = 12345678901;
13786   printf("%Ld\n", q);
13787 }
13788 EOCP
13789         set try
13790         if eval $compile; then
13791                 yyy=`./try$exe_ext`
13792                 case "$yyy" in
13793                 12345678901)
13794                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13795                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13796                         echo "We will use %Ld."
13797                         ;;
13798                 esac
13799         fi
13800 fi
13801
13802 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13803         $cat >try.c <<EOCP
13804 #include <sys/types.h>
13805 #include <stdio.h>
13806 int main() {
13807   $quadtype q = 12345678901;
13808   printf("%qd\n", q);
13809 }
13810 EOCP
13811         set try
13812         if eval $compile; then
13813                 yyy=`./try$exe_ext`
13814                 case "$yyy" in
13815                 12345678901)
13816                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13817                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13818                         echo "We will use %qd."
13819                         ;;
13820                 esac
13821         fi
13822 fi
13823
13824 if $test X"$sPRId64" = X; then
13825         echo "Cannot figure out how to print 64-bit integers." >&4
13826 fi
13827
13828 $rm -f try try.*
13829
13830 fi
13831
13832 case "$sPRId64" in
13833 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13834         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13835         ;;
13836 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13837         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13838         ;;
13839 esac
13840
13841
13842 echo " "
13843 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13844
13845 if $test X"$ivsize" = X8; then
13846         ivdformat="$sPRId64"
13847         uvuformat="$sPRIu64"
13848         uvoformat="$sPRIo64"
13849         uvxformat="$sPRIx64"
13850         uvXUformat="$sPRIXU64"
13851 else
13852         if $test X"$ivsize" = X"$longsize"; then
13853                 ivdformat='"ld"'
13854                 uvuformat='"lu"'
13855                 uvoformat='"lo"'
13856                 uvxformat='"lx"'
13857                 uvXUformat='"lX"'
13858         else
13859                 if $test X"$ivsize" = X"$intsize"; then
13860                         ivdformat='"d"'
13861                         uvuformat='"u"'
13862                         uvoformat='"o"'
13863                         uvxformat='"x"'
13864                         uvXUformat='"X"'
13865                 else
13866                         : far out
13867                         if $test X"$ivsize" = X"$shortsize"; then
13868                                 ivdformat='"hd"'
13869                                 uvuformat='"hu"'
13870                                 uvoformat='"ho"'
13871                                 uvxformat='"hx"'
13872                                 uvXUformat='"hX"'
13873                         fi
13874                 fi
13875         fi
13876 fi
13877
13878 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13879         nveformat="$sPRIeldbl"
13880         nvfformat="$sPRIfldbl"
13881         nvgformat="$sPRIgldbl"
13882         nvEUformat="$sPRIEUldbl"
13883         nvFUformat="$sPRIFUldbl"
13884         nvGUformat="$sPRIGUldbl"
13885 else
13886         nveformat='"e"'
13887         nvfformat='"f"'
13888         nvgformat='"g"'
13889         nvEUformat='"E"'
13890         nvFUformat='"F"'
13891         nvGUformat='"G"'
13892 fi
13893
13894 case "$ivdformat" in
13895 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13896     exit 1
13897     ;;
13898 esac
13899
13900
13901 echo " "
13902 $echo "Checking the format string to be used for gids..." >&4
13903
13904 case "$gidsign" in
13905 -1)     if $test X"$gidsize" = X"$ivsize"; then
13906                 gidformat="$ivdformat"
13907         else
13908                 if $test X"$gidsize" = X"$longsize"; then
13909                         gidformat='"ld"'
13910                 else
13911                         if $test X"$gidsize" = X"$intsize"; then
13912                                 gidformat='"d"'
13913                         else
13914                                 if $test X"$gidsize" = X"$shortsize"; then
13915                                         gidformat='"hd"'
13916                                 fi
13917                         fi
13918                 fi
13919         fi
13920         ;;
13921 *)      if $test X"$gidsize" = X"$uvsize"; then
13922                 gidformat="$uvuformat"
13923         else
13924                 if $test X"$gidsize" = X"$longsize"; then
13925                         gidformat='"lu"'
13926                 else
13927                         if $test X"$gidsize" = X"$intsize"; then
13928                                 gidformat='"u"'
13929                         else
13930                                 if $test X"$gidsize" = X"$shortsize"; then
13931                                         gidformat='"hu"'
13932                                 fi
13933                         fi
13934                 fi
13935         fi
13936         ;;
13937 esac
13938
13939 : see if getgroups exists
13940 set getgroups d_getgrps
13941 eval $inlibc
13942
13943 : see if setgroups exists
13944 set setgroups d_setgrps
13945 eval $inlibc
13946
13947
13948 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13949 echo " "
13950 case "$d_getgrps$d_setgrps" in
13951 *define*)
13952         case "$groupstype" in
13953         '') dflt="$gidtype" ;;
13954         *)  dflt="$groupstype" ;;
13955         esac
13956         $cat <<EOM
13957 What type of pointer is the second argument to getgroups() and setgroups()?
13958 Usually this is the same as group ids, $gidtype, but not always.
13959
13960 EOM
13961         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13962         . ./myread
13963         groupstype="$ans"
13964         ;;
13965 *)  groupstype="$gidtype";;
13966 esac
13967
13968 echo " "
13969 echo "Checking if your $make program sets \$(MAKE)..." >&4
13970 case "$make_set_make" in
13971 '')
13972         $sed 's/^X //' > testmake.mak << 'EOF'
13973 Xall:
13974 X       @echo 'maketemp="$(MAKE)"'
13975 EOF
13976         case "`$make -f testmake.mak 2>/dev/null`" in
13977         *maketemp=*) make_set_make='#' ;;
13978         *)      make_set_make="MAKE=$make" ;;
13979         esac
13980         $rm -f testmake.mak
13981         ;;
13982 esac
13983 case "$make_set_make" in
13984 '#') echo "Yup, it does.";;
13985 *) echo "Nope, it doesn't.";;
13986 esac
13987
13988 : see what type is used for mode_t
13989 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13990 set mode_t modetype int stdio.h sys/types.h
13991 eval $typedef_ask
13992
13993 : see if stdarg is available
13994 echo " "
13995 if $test `./findhdr stdarg.h`; then
13996         echo "<stdarg.h> found." >&4
13997         valstd="$define"
13998 else
13999         echo "<stdarg.h> NOT found." >&4
14000         valstd="$undef"
14001 fi
14002
14003 : see if varags is available
14004 echo " "
14005 if $test `./findhdr varargs.h`; then
14006         echo "<varargs.h> found." >&4
14007 else
14008         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14009 fi
14010
14011 : set up the varargs testing programs
14012 $cat > varargs.c <<EOP
14013 #ifdef I_STDARG
14014 #include <stdarg.h>
14015 #endif
14016 #ifdef I_VARARGS
14017 #include <varargs.h>
14018 #endif
14019
14020 #ifdef I_STDARG
14021 int f(char *p, ...)
14022 #else
14023 int f(va_alist)
14024 va_dcl
14025 #endif
14026 {
14027         va_list ap;
14028 #ifndef I_STDARG
14029         char *p;
14030 #endif
14031 #ifdef I_STDARG
14032         va_start(ap,p);
14033 #else
14034         va_start(ap);
14035         p = va_arg(ap, char *);
14036 #endif
14037         va_end(ap);
14038 }
14039 EOP
14040 $cat > varargs <<EOP
14041 $startsh
14042 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14043         echo "true"
14044 else
14045         echo "false"
14046 fi
14047 $rm -f varargs$_o
14048 EOP
14049 chmod +x varargs
14050
14051 : now check which varargs header should be included
14052 echo " "
14053 i_varhdr=''
14054 case "$valstd" in
14055 "$define")
14056         if `./varargs I_STDARG`; then
14057                 val='stdarg.h'
14058         elif `./varargs I_VARARGS`; then
14059                 val='varargs.h'
14060         fi
14061         ;;
14062 *)
14063         if `./varargs I_VARARGS`; then
14064                 val='varargs.h'
14065         fi
14066         ;;
14067 esac
14068 case "$val" in
14069 '')
14070 echo "I could not find the definition for va_dcl... You have problems..." >&4
14071         val="$undef"; set i_stdarg; eval $setvar
14072         val="$undef"; set i_varargs; eval $setvar
14073         ;;
14074 *) 
14075         set i_varhdr
14076         eval $setvar
14077         case "$i_varhdr" in
14078         stdarg.h)
14079                 val="$define"; set i_stdarg; eval $setvar
14080                 val="$undef"; set i_varargs; eval $setvar
14081                 ;;
14082         varargs.h)
14083                 val="$undef"; set i_stdarg; eval $setvar
14084                 val="$define"; set i_varargs; eval $setvar
14085                 ;;
14086         esac
14087         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14088 esac
14089 $rm -f varargs*
14090
14091 : see if we need va_copy
14092 echo " "
14093 case "$i_stdarg" in
14094 "$define")
14095         $cat >try.c <<EOCP
14096 #include <stdarg.h>
14097 #include <stdio.h>
14098 #$i_stdlib I_STDLIB
14099 #ifdef I_STDLIB
14100 #include <stdlib.h>
14101 #endif
14102 #include <signal.h>
14103
14104 int
14105 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14106 {
14107   return vfprintf(f, fmt, *valp);
14108 }
14109  
14110 int    
14111 myvfprintf(FILE *f, const  char *fmt, va_list val)
14112 {
14113   return ivfprintf(f, fmt, &val);
14114 }
14115       
14116 int
14117 myprintf(char *fmt, ...) 
14118 {
14119   va_list val;
14120   va_start(val, fmt);
14121   return myvfprintf(stdout, fmt, val); 
14122 }         
14123
14124 int
14125 main(int ac, char **av)
14126 {
14127   signal(SIGSEGV, exit);
14128
14129   myprintf("%s%cs all right, then\n", "that", '\'');                            
14130   exit(0);      
14131 }
14132 EOCP
14133         set try
14134         if eval $compile && ./try 2>&1 >/dev/null; then
14135                 case "`./try`" in
14136                 "that's all right, then")
14137                         okay=yes
14138                         ;;
14139                 esac
14140         fi
14141         case "$okay" in
14142         yes)    echo "It seems that you don't need va_copy()." >&4
14143                 need_va_copy="$undef"
14144                 ;;
14145         *)      echo "It seems that va_copy() or similar will be needed." >&4
14146                 need_va_copy="$define"
14147                 ;;
14148         esac
14149         $rm -f try.* core core.* *.core *.core.*
14150         ;;
14151 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14152         ;;
14153 esac
14154
14155 : define a fucntion to check prototypes
14156 $cat > protochk <<EOSH
14157 $startsh
14158 cc="$cc"
14159 optimize="$optimize"
14160 ccflags="$ccflags"
14161 prototype="$prototype"
14162 define="$define"
14163 rm=$rm
14164 EOSH
14165
14166 $cat >> protochk <<'EOSH'
14167
14168 $rm -f try.c
14169 foo="$1"
14170 shift
14171 while test $# -ge 2; do
14172         case "$1" in
14173                 $define) echo "#include <$2>" >> try.c ;;
14174                 literal) echo "$2" >> try.c ;;
14175         esac
14176     shift 2
14177 done
14178 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14179 cat >> try.c <<'EOCP'
14180 #ifdef CAN_PROTOTYPE
14181 #define _(args) args
14182 #else
14183 #define _(args) ()
14184 #endif
14185 EOCP
14186 echo "$foo" >> try.c
14187 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14188 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14189 status=$?
14190 $rm -f try.[co]
14191 exit $status
14192 EOSH
14193 chmod +x protochk
14194 $eunicefix protochk
14195
14196 : see what type is used for size_t
14197 rp="What is the type used for the length parameter for string functions?"
14198 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14199 eval $typedef_ask
14200
14201 : check for type of arguments to gethostbyaddr. 
14202 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14203         case "$d_gethbyaddr" in
14204         $define)
14205                 $cat <<EOM
14206
14207 Checking to see what type of arguments are accepted by gethostbyaddr().
14208 EOM
14209                 hdrs="$define sys/types.h
14210                         $d_socket sys/socket.h 
14211                         $i_niin netinet/in.h 
14212                         $i_netdb netdb.h
14213                         $i_unistd unistd.h"
14214                 : The first arg can 'char *' or 'void *'
14215                 : The second arg is some of integral type
14216                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14217                         for yyy in size_t long int; do
14218                                 case "$netdb_host_type" in
14219                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14220                                         if ./protochk "$try" $hdrs; then
14221                                                 echo "Your system accepts $xxx for the first arg."
14222                                                 echo "...and $yyy for the second arg."
14223                                                 netdb_host_type="$xxx"
14224                                                 netdb_hlen_type="$yyy"
14225                                         fi
14226                                         ;;
14227                                 esac
14228                         done
14229                 done
14230                 : In case none of those worked, prompt the user.
14231                 case "$netdb_host_type" in
14232                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14233                         dflt='char *'
14234                         . ./myread
14235                         netdb_host_type=$ans
14236                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14237                         dflt="$sizetype"
14238                         . ./myread
14239                         netdb_hlen_type=$ans
14240                         ;;
14241                 esac
14242                 ;;
14243         *)      : no gethostbyaddr, so pick harmless defaults
14244                 netdb_host_type='char *'
14245                 netdb_hlen_type="$sizetype"
14246                 ;;
14247         esac
14248         # Remove the "const" if needed. -- but then we'll have a 
14249         # prototype clash!
14250         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14251 fi
14252
14253 : check for type of argument to gethostbyname. 
14254 if test "X$netdb_name_type" = X ; then
14255         case "$d_gethbyname" in
14256         $define)
14257                 $cat <<EOM
14258
14259 Checking to see what type of argument is accepted by gethostbyname().
14260 EOM
14261                 hdrs="$define sys/types.h
14262                         $d_socket sys/socket.h 
14263                         $i_niin netinet/in.h 
14264                         $i_netdb netdb.h
14265                         $i_unistd unistd.h"
14266                 for xxx in "const char *" "char *"; do
14267                         case "$netdb_name_type" in
14268                         '')     try="extern struct hostent *gethostbyname($xxx);"
14269                                 if ./protochk "$try" $hdrs; then
14270                                         echo "Your system accepts $xxx."
14271                                         netdb_name_type="$xxx"
14272                                 fi
14273                                 ;;
14274                         esac
14275                 done
14276                 : In case none of those worked, prompt the user.
14277                 case "$netdb_name_type" in
14278                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14279                         dflt='char *'
14280                         . ./myread
14281                         netdb_name_type=$ans
14282                         ;;
14283                 esac
14284                 ;;
14285         *)      : no gethostbyname, so pick harmless default
14286                 netdb_name_type='char *'
14287                 ;;
14288         esac
14289 fi
14290
14291 : check for type of 1st argument to getnetbyaddr. 
14292 if test "X$netdb_net_type" = X ; then
14293         case "$d_getnbyaddr" in
14294         $define)
14295                 $cat <<EOM
14296
14297 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14298 EOM
14299                 hdrs="$define sys/types.h
14300                         $d_socket sys/socket.h 
14301                         $i_niin netinet/in.h 
14302                         $i_netdb netdb.h
14303                         $i_unistd unistd.h"
14304                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14305                         case "$netdb_net_type" in
14306                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14307                                 if ./protochk "$try" $hdrs; then
14308                                         echo "Your system accepts $xxx."
14309                                         netdb_net_type="$xxx"
14310                                 fi
14311                                 ;;
14312                         esac
14313                 done
14314                 : In case none of those worked, prompt the user.
14315                 case "$netdb_net_type" in
14316                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14317                         dflt='long'
14318                         . ./myread
14319                         netdb_net_type=$ans
14320                         ;;
14321                 esac
14322                 ;;
14323         *)      : no getnetbyaddr, so pick harmless default
14324                 netdb_net_type='long'
14325                 ;;
14326         esac
14327 fi
14328 : locate the preferred pager for this system
14329 case "$pager" in
14330 '')
14331         dflt=''
14332         case "$pg" in
14333         /*) dflt=$pg;;
14334         [a-zA-Z]:/*) dflt=$pg;;
14335         esac
14336         case "$more" in
14337         /*) dflt=$more;;
14338         [a-zA-Z]:/*) dflt=$more;;
14339         esac
14340         case "$less" in
14341         /*) dflt=$less;;
14342         [a-zA-Z]:/*) dflt=$less;;
14343         esac
14344         case "$dflt" in
14345         '') dflt=/usr/ucb/more;;
14346         esac
14347         ;;
14348 *) dflt="$pager";;
14349 esac
14350 echo " "
14351 fn=f/
14352 rp='What pager is used on your system?'
14353 . ./getfile
14354 pager="$ans"
14355
14356 : see what type pids are declared as in the kernel
14357 rp="What is the type of process ids on this system?"
14358 set pid_t pidtype int stdio.h sys/types.h
14359 eval $typedef_ask
14360
14361 : Find earliest binary compatible site_perl subdirectory perl can use.
14362 case "$bincompat5005" in
14363 "$define") xs_apiversion='5.005' ;;
14364 *) xs_apiversion=$version ;;   # The current site_perl version.
14365 esac
14366 : Find earliest pure perl site_perl subdirectory perl can use.
14367 : The versioned directories started at 5.005.
14368 pm_apiversion='5.005'
14369
14370 : see if ar generates random libraries by itself
14371 echo " "
14372 echo "Checking how to generate random libraries on your machine..." >&4
14373 echo 'int bar1() { return bar2(); }' > bar1.c
14374 echo 'int bar2() { return 2; }' > bar2.c
14375 $cat > foo.c <<'EOP'
14376 int main() { printf("%d\n", bar1()); exit(0); }
14377 EOP
14378 $cc $ccflags -c bar1.c >/dev/null 2>&1
14379 $cc $ccflags -c bar2.c >/dev/null 2>&1
14380 $cc $ccflags -c foo.c >/dev/null 2>&1
14381 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14382 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14383         ./foobar >/dev/null 2>&1; then
14384         echo "$ar appears to generate random libraries itself."
14385         orderlib=false
14386         ranlib=":"
14387 elif $ar ts bar$_a >/dev/null 2>&1 &&
14388         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14389         ./foobar >/dev/null 2>&1; then
14390                 echo "a table of contents needs to be added with '$ar ts'."
14391                 orderlib=false
14392                 ranlib="$ar ts"
14393 else
14394         case "$ranlib" in
14395         :) ranlib='';;
14396         '')
14397                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14398                 $test -f $ranlib || ranlib=''
14399                 ;;
14400         esac
14401         if $test -n "$ranlib"; then
14402                 echo "your system has '$ranlib'; we'll use that."
14403                 orderlib=false
14404         else
14405                 echo "your system doesn't seem to support random libraries"
14406                 echo "so we'll use lorder and tsort to order the libraries."
14407                 orderlib=true
14408                 ranlib=":"
14409         fi
14410 fi
14411 $rm -f foo* bar* 
14412
14413 : check for type of arguments to select. 
14414 case "$selecttype" in
14415 '') case "$d_select" in
14416         $define)
14417                 echo " "
14418                 $cat <<EOM
14419 Checking to see what type of arguments are accepted by select().
14420 EOM
14421                 hdrs="$define sys/types.h
14422                         $i_systime sys/time.h 
14423                         $i_sysselct sys/select.h
14424                         $d_socket sys/socket.h"
14425                 : The first arg can be int, unsigned, or size_t
14426                 : The last arg may or may not be 'const'
14427                 val=''
14428                 : void pointer has been seen but using that
14429                 : breaks the selectminbits test
14430                 for xxx in 'fd_set *' 'int *'; do
14431                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14432                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14433                                         case "$val" in
14434                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14435                                                 if ./protochk "$try" $hdrs; then
14436                                                         echo "Your system accepts $xxx."
14437                                                         val="$xxx"
14438                                                 fi
14439                                                 ;;
14440                                         esac
14441                                 done
14442                         done
14443                 done
14444                 case "$val" in
14445                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14446                         case "$d_fd_set" in
14447                                 $define) dflt="fd_set *" ;;
14448                                 *)              dflt="int *" ;;
14449                         esac
14450                         . ./myread
14451                         val=$ans
14452                         ;;
14453                 esac
14454                 selecttype="$val"
14455                 ;;
14456         *)      : no select, so pick a harmless default
14457                 selecttype='int *'
14458                 ;;
14459         esac
14460         ;;
14461 esac
14462
14463 : check for the select 'width'
14464 case "$selectminbits" in
14465 '') case "$d_select" in
14466         $define)
14467                 $cat <<EOM
14468
14469 Checking to see on how many bits at a time your select() operates...
14470 EOM
14471                 $cat >try.c <<EOCP
14472 #include <sys/types.h>
14473 #$i_time I_TIME
14474 #$i_systime I_SYS_TIME
14475 #$i_systimek I_SYS_TIME_KERNEL
14476 #ifdef I_TIME
14477 #   include <time.h>
14478 #endif
14479 #ifdef I_SYS_TIME
14480 #   ifdef I_SYS_TIME_KERNEL
14481 #       define KERNEL
14482 #   endif
14483 #   include <sys/time.h>
14484 #   ifdef I_SYS_TIME_KERNEL
14485 #       undef KERNEL
14486 #   endif
14487 #endif
14488 #$i_sysselct I_SYS_SELECT
14489 #ifdef I_SYS_SELECT
14490 #include <sys/select.h>
14491 #endif
14492 #$d_socket HAS_SOCKET
14493 #ifdef HAS_SOCKET
14494 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14495 #endif
14496 #include <stdio.h>
14497 $selecttype b;
14498 #define S sizeof(*(b))
14499 #define MINBITS 64
14500 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14501 #define NBITS  (NBYTES * 8)
14502 int main() {
14503     char s[NBYTES];
14504     struct timeval t;
14505     int i;
14506     FILE* fp;
14507     int fd;
14508
14509     fclose(stdin);
14510     fp = fopen("try.c", "r");
14511     if (fp == 0)
14512       exit(1);
14513     fd = fileno(fp);
14514     if (fd < 0)
14515       exit(2);
14516     b = ($selecttype)s;
14517     for (i = 0; i < NBITS; i++)
14518         FD_SET(i, b);
14519     t.tv_sec  = 0;
14520     t.tv_usec = 0;
14521     select(fd + 1, b, 0, 0, &t);
14522     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14523     printf("%d\n", i + 1);
14524     return 0;
14525 }
14526 EOCP
14527                 set try
14528                 if eval $compile_ok; then
14529                         selectminbits=`./try`
14530                         case "$selectminbits" in
14531                         '')     cat >&4 <<EOM
14532 Cannot figure out on how many bits at a time your select() operates.
14533 I'll play safe and guess it is 32 bits.
14534 EOM
14535                                 selectminbits=32
14536                                 bits="32 bits"
14537                                 ;;
14538                         1)      bits="1 bit" ;;
14539                         *)      bits="$selectminbits bits" ;;
14540                         esac
14541                         echo "Your select() operates on $bits at a time." >&4
14542                 else
14543                         rp='What is the minimum number of bits your select() operates on?'
14544                         case "$byteorder" in
14545                         1234|12345678)  dflt=32 ;;
14546                         *)              dflt=1  ;;
14547                         esac
14548                         . ./myread
14549                         val=$ans
14550                         selectminbits="$val"
14551                 fi
14552                 $rm -f try.* try
14553                 ;;
14554         *)      : no select, so pick a harmless default
14555                 selectminbits='32'
14556                 ;;
14557         esac
14558         ;;
14559 esac
14560
14561 : Trace out the files included by signal.h, then look for SIGxxx names.
14562 : Remove SIGARRAYSIZE used by HPUX.
14563 : Remove SIGSTKSIZE used by Linux.
14564 : Remove SIGSTKSZ used by Posix.
14565 : Remove SIGTYP void lines used by OS2.
14566 : Some cpps, like os390, dont give the file name anywhere
14567 if [ "X$fieldn" = X ]; then
14568         : Just make some guesses.  We check them later.
14569         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14570 else
14571         xxx=`echo '#include <signal.h>' |
14572         $cppstdin $cppminus $cppflags 2>/dev/null |
14573         $grep '^[       ]*#.*include' | 
14574         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14575 fi
14576 : Check this list of files to be sure we have parsed the cpp output ok.
14577 : This will also avoid potentially non-existent files, such 
14578 : as ../foo/bar.h
14579 xxxfiles=''
14580 for xx in $xxx /dev/null ; do
14581         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14582 done
14583 : If we have found no files, at least try signal.h
14584 case "$xxxfiles" in
14585 '')     xxxfiles=`./findhdr signal.h` ;;
14586 esac
14587 xxx=`awk '
14588 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14589         print substr($2, 4, 20)
14590 }
14591 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14592         print substr($3, 4, 20)
14593 }' $xxxfiles`
14594 : Append some common names just in case the awk scan failed.
14595 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14596 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14597 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14598 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14599 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14600
14601 : generate a few handy files for later
14602 $cat > signal.c <<'EOCP'
14603 #include <sys/types.h>
14604 #include <signal.h>
14605 #include <stdio.h>
14606 int main() {
14607
14608 /* Strange style to avoid deeply-nested #if/#else/#endif */
14609 #ifndef NSIG
14610 #  ifdef _NSIG
14611 #    define NSIG (_NSIG)
14612 #  endif
14613 #endif
14614
14615 #ifndef NSIG
14616 #  ifdef SIGMAX
14617 #    define NSIG (SIGMAX+1)
14618 #  endif
14619 #endif
14620
14621 #ifndef NSIG
14622 #  ifdef SIG_MAX
14623 #    define NSIG (SIG_MAX+1)
14624 #  endif
14625 #endif
14626
14627 #ifndef NSIG
14628 #  ifdef MAXSIG
14629 #    define NSIG (MAXSIG+1)
14630 #  endif
14631 #endif
14632
14633 #ifndef NSIG
14634 #  ifdef MAX_SIG
14635 #    define NSIG (MAX_SIG+1)
14636 #  endif
14637 #endif
14638
14639 #ifndef NSIG
14640 #  ifdef SIGARRAYSIZE
14641 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14642 #  endif
14643 #endif
14644
14645 #ifndef NSIG
14646 #  ifdef _sys_nsig
14647 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14648 #  endif
14649 #endif
14650
14651 /* Default to some arbitrary number that's big enough to get most
14652    of the common signals.
14653 */
14654 #ifndef NSIG
14655 #    define NSIG 50
14656 #endif
14657
14658 printf("NSIG %d\n", NSIG);
14659
14660 #ifndef JUST_NSIG
14661
14662 EOCP
14663
14664 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14665 {
14666         printf "#ifdef SIG"; printf $1; printf "\n"
14667         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14668         printf $1; printf ");\n"
14669         printf "#endif\n"
14670 }
14671 END {
14672         printf "#endif /* JUST_NSIG */\n";
14673         printf "exit(0);\n}\n";
14674 }
14675 ' >>signal.c
14676 $cat >signal.awk <<'EOP'
14677 BEGIN { ndups = 0 }
14678 $1 ~ /^NSIG$/ { nsig = $2 }
14679 ($1 !~ /^NSIG$/) && (NF == 2) {
14680     if ($2 > maxsig) { maxsig = $2 }
14681     if (sig_name[$2]) {
14682         dup_name[ndups] = $1
14683         dup_num[ndups] = $2
14684         ndups++ 
14685     }
14686     else {
14687         sig_name[$2] = $1
14688         sig_num[$2] = $2
14689     }
14690 }
14691 END { 
14692     if (nsig == 0) {
14693         nsig = maxsig + 1
14694     }
14695     printf("NSIG %d\n", nsig);
14696     for (n = 1; n < nsig; n++) {
14697         if (sig_name[n]) {
14698             printf("%s %d\n", sig_name[n], sig_num[n])
14699         }
14700         else {
14701             printf("NUM%d %d\n", n, n) 
14702         }
14703     }
14704     for (n = 0; n < ndups; n++) {
14705         printf("%s %d\n", dup_name[n], dup_num[n])
14706     }
14707 }
14708 EOP
14709 $cat >signal_cmd <<EOS
14710 $startsh
14711 if $test -s signal.lst; then
14712     echo "Using your existing signal.lst file"
14713         exit 0
14714 fi
14715 xxx="$xxx"
14716 EOS
14717 $cat >>signal_cmd <<'EOS'
14718
14719 set signal
14720 if eval $compile_ok; then
14721         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14722 else
14723         echo "(I can't seem be able to compile the whole test program)" >&4
14724         echo "(I'll try it in little pieces.)" >&4
14725         set signal -DJUST_NSIG
14726         if eval $compile_ok; then
14727                 ./signal$_exe > signal.nsg
14728                 $cat signal.nsg
14729         else
14730                 echo "I can't seem to figure out how many signals you have." >&4
14731                 echo "Guessing 50." >&4
14732                 echo 'NSIG 50' > signal.nsg
14733         fi
14734         : Now look at all the signal names, one at a time.
14735         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14736                 $cat > signal.c <<EOCP
14737 #include <sys/types.h>
14738 #include <signal.h>
14739 #include <stdio.h>
14740 int main() {
14741 printf("$xx %d\n", SIG${xx});
14742 return 0;
14743 }
14744 EOCP
14745                 set signal
14746                 if eval $compile; then
14747                         echo "SIG${xx} found."
14748                         ./signal$_exe  >> signal.ls1
14749                 else
14750                         echo "SIG${xx} NOT found."
14751                 fi
14752         done
14753         if $test -s signal.ls1; then
14754                 $cat signal.nsg signal.ls1 |
14755                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14756         fi
14757
14758 fi
14759 if $test -s signal.lst; then
14760         :
14761 else
14762         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14763         echo 'kill -l' >signal
14764         set X `csh -f <signal`
14765         $rm -f signal
14766         shift
14767         case $# in
14768         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14769         esac
14770         echo $@ | $tr ' ' $trnl | \
14771             $awk '{ printf "%s %d\n", $1, ++s; }
14772                   END { printf "NSIG %d\n", ++s }' >signal.lst
14773 fi
14774 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14775 EOS
14776 chmod a+x signal_cmd
14777 $eunicefix signal_cmd
14778
14779 : generate list of signal names
14780 echo " "
14781 case "$sig_name_init" in
14782 '') doinit=yes ;;
14783 *)  case "$sig_num_init" in
14784     ''|*,*) doinit=yes ;;
14785     esac ;;
14786 esac
14787 case "$doinit" in
14788 yes)
14789         echo "Generating a list of signal names and numbers..." >&4
14790         . ./signal_cmd
14791         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14792         sig_name=`$awk 'BEGIN { printf "ZERO " }
14793                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14794         sig_num=`$awk  'BEGIN { printf "0 " }
14795                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14796         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14797                              !/^NSIG/   { printf "\"%s\", ", $1 }
14798                              END        { printf "0\n" }' signal.lst`
14799         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14800                              !/^NSIG/   { printf "%d, ", $2}
14801                              END        { printf "0\n"}' signal.lst`
14802         ;;
14803 esac
14804 echo "The following $sig_count signals are available:"
14805 echo " "
14806 echo $sig_name | $awk \
14807 'BEGIN { linelen = 0 }
14808 {
14809         for (i = 1; i <= NF; i++) {
14810                 name = "SIG" $i " "
14811                 linelen = linelen + length(name)
14812                 if (linelen > 70) {
14813                         printf "\n"
14814                         linelen = length(name)
14815                 }
14816                 printf "%s", name
14817         }
14818         printf "\n"
14819 }'
14820 sig_size=`echo $sig_name | awk '{print NF}'`
14821 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14822
14823 echo " "
14824 case "$sizetype" in
14825 *_t) zzz="$sizetype"    ;;
14826 *)   zzz="filesize"     ;;
14827 esac
14828 echo "Checking the size of $zzz..." >&4 
14829 cat > try.c <<EOCP
14830 #include <sys/types.h>
14831 #include <stdio.h>
14832 int main() {
14833     printf("%d\n", (int)sizeof($sizetype));
14834     exit(0);
14835 }
14836 EOCP
14837 set try
14838 if eval $compile_ok; then
14839         yyy=`./try`
14840         case "$yyy" in
14841         '')     sizesize=4
14842                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14843                 ;;
14844         *)      sizesize=$yyy
14845                 echo "Your $zzz size is $sizesize bytes."
14846                 ;;
14847         esac
14848 else
14849         sizesize=4
14850         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14851 fi
14852
14853
14854 : check for socklen_t
14855 echo " "
14856 echo "Checking to see if you have socklen_t..." >&4
14857 $cat >try.c <<EOCP
14858 #include <sys/types.h>
14859 #$d_socket HAS_SOCKET
14860 #ifdef HAS_SOCKET
14861 #include <sys/socket.h>
14862 #endif
14863 int main() { socklen_t x = 16; }
14864 EOCP
14865 set try
14866 if eval $compile; then
14867         val="$define"
14868         echo "You have socklen_t."
14869 else
14870         val="$undef"
14871         echo "You do not have socklen_t."
14872         case "$sizetype" in
14873         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14874         esac
14875 fi
14876 $rm -f try try.*
14877 set d_socklen_t
14878 eval $setvar
14879
14880 : see if this is a socks.h system
14881 set socks.h i_socks
14882 eval $inhdr
14883
14884 : check for type of the size argument to socket calls
14885 case "$d_socket" in
14886 "$define")
14887         $cat <<EOM
14888
14889 Checking to see what type is the last argument of accept().
14890 EOM
14891         yyy=''
14892         case "$d_socklen_t" in
14893         "$define") yyy="$yyy socklen_t"
14894         esac
14895         yyy="$yyy $sizetype int long unsigned"
14896         for xxx in $yyy; do
14897                 case "$socksizetype" in
14898                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14899                         case "$usesocks" in
14900                         "$define")
14901                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14902                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14903                                         socksizetype="$xxx"
14904                                 fi
14905                                 ;;
14906                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14907                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14908                                         socksizetype="$xxx"
14909                                 fi
14910                                 ;;
14911                         esac
14912                         ;;
14913                 esac
14914         done
14915 : In case none of those worked, prompt the user.
14916         case "$socksizetype" in
14917         '')     rp='What is the type for socket address structure sizes?'
14918                 dflt='int'
14919                 . ./myread
14920                 socksizetype=$ans
14921                 ;;
14922         esac
14923         ;;
14924 *)      : no sockets, so pick relatively harmless default
14925         socksizetype='int'
14926         ;;
14927 esac
14928
14929 : see what type is used for signed size_t
14930 set ssize_t ssizetype int stdio.h sys/types.h
14931 eval $typedef
14932 dflt="$ssizetype"
14933 $cat > ssize.c <<EOM
14934 #include <stdio.h>
14935 #include <sys/types.h>
14936 #define Size_t $sizetype
14937 #define SSize_t $dflt
14938 int main()
14939 {
14940         if (sizeof(Size_t) == sizeof(SSize_t))
14941                 printf("$dflt\n");
14942         else if (sizeof(Size_t) == sizeof(int))
14943                 printf("int\n");
14944         else 
14945                 printf("long\n");
14946         exit(0);
14947 }
14948 EOM
14949 echo " "
14950 set ssize
14951 if eval $compile_ok && ./ssize > /dev/null; then
14952         ssizetype=`./ssize`
14953         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14954 else
14955         $cat >&4 <<EOM
14956 Help! I can't compile and run the ssize_t test program: please enlighten me!
14957 (This is probably a misconfiguration in your system or libraries, and
14958 you really ought to fix it.  Still, I'll try anyway.)
14959
14960 I need a type that is the same size as $sizetype, but is guaranteed to
14961 be signed.  Common values are ssize_t, int and long.
14962
14963 EOM
14964         rp="What signed type is the same size as $sizetype?"
14965         . ./myread
14966         ssizetype="$ans"
14967 fi
14968 $rm -f ssize ssize.*
14969
14970 : see what type of char stdio uses.
14971 echo " "
14972 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14973 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14974         echo "Your stdio uses unsigned chars." >&4
14975         stdchar="unsigned char"
14976 else
14977         echo "Your stdio uses signed chars." >&4
14978         stdchar="char"
14979 fi
14980 $rm -f stdioh
14981
14982
14983
14984 : see if time exists
14985 echo " "
14986 if test "X$d_time" = X -o X"$timetype" = X; then
14987     if set time val -f d_time; eval $csym; $val; then
14988                 echo 'time() found.' >&4
14989                 val="$define"
14990                 rp="What is the type returned by time() on this system?"
14991                 set time_t timetype long stdio.h sys/types.h
14992                 eval $typedef_ask
14993     else
14994                 echo 'time() not found, hope that will do.' >&4
14995                 val="$undef"
14996                 timetype='int';
14997     fi
14998     set d_time
14999     eval $setvar
15000 fi
15001
15002 : see what type uids are declared as in the kernel
15003 echo " "
15004 echo "Looking for the type for user ids returned by getuid()."
15005 set uid_t uidtype xxx stdio.h sys/types.h
15006 eval $typedef
15007 case "$uidtype" in
15008 xxx)
15009         xxx=`./findhdr sys/user.h`
15010         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15011         case $1 in
15012         unsigned) dflt="$1 $2" ;;
15013         *) dflt="$1" ;;
15014         esac
15015         ;;
15016 *) dflt="$uidtype";;
15017 esac
15018 case "$uidtype" in
15019 uid_t)  echo "uid_t found." ;;
15020 *)      rp="What is the type for user ids returned by getuid()?"
15021         . ./myread
15022         uidtype="$ans"
15023         ;;
15024 esac
15025
15026 echo " "
15027 case "$uidtype" in
15028 *_t) zzz="$uidtype"     ;;
15029 *)   zzz="uid"          ;;
15030 esac
15031 echo "Checking the size of $zzz..." >&4 
15032 cat > try.c <<EOCP
15033 #include <sys/types.h>
15034 #include <stdio.h>
15035 int main() {
15036     printf("%d\n", (int)sizeof($uidtype));
15037     exit(0);
15038 }
15039 EOCP
15040 set try
15041 if eval $compile_ok; then
15042         yyy=`./try`
15043         case "$yyy" in
15044         '')     uidsize=4
15045                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15046                 ;;
15047         *)      uidsize=$yyy
15048                 echo "Your $zzz is $uidsize bytes long."
15049                 ;;
15050         esac
15051 else
15052         uidsize=4
15053         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15054 fi
15055
15056 echo " "
15057 case "$uidtype" in
15058 *_t) zzz="$uidtype"     ;;
15059 *)   zzz="uid"          ;;
15060 esac
15061 echo "Checking the sign of $zzz..." >&4
15062 cat > try.c <<EOCP
15063 #include <sys/types.h>
15064 #include <stdio.h>
15065 int main() {
15066         $uidtype foo = -1;
15067         if (foo < 0)
15068                 printf("-1\n");
15069         else
15070                 printf("1\n");
15071 }
15072 EOCP
15073 set try
15074 if eval $compile; then
15075         yyy=`./try`
15076         case "$yyy" in
15077         '')     uidsign=1
15078                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15079                 ;;
15080         *)      uidsign=$yyy
15081                 case "$uidsign" in
15082                  1) echo "Your $zzz is unsigned." ;;
15083                 -1) echo "Your $zzz is signed."   ;;
15084                 esac
15085                 ;;
15086         esac
15087 else
15088         uidsign=1
15089         echo "(I can't compile the test program--guessing unsigned.)" >&4
15090 fi
15091
15092
15093
15094 echo " "
15095 $echo "Checking the format string to be used for uids..." >&4
15096
15097 case "$uidsign" in
15098 -1)     if $test X"$uidsize" = X"$ivsize"; then
15099                 uidformat="$ivdformat"
15100         else
15101                 if $test X"$uidsize" = X"$longsize"; then
15102                         uidformat='"ld"'
15103                 else
15104                         if $test X"$uidsize" = X"$intsize"; then
15105                                 uidformat='"d"'
15106                         else
15107                                 if $test X"$uidsize" = X"$shortsize"; then
15108                                         uidformat='"hd"'
15109                                 fi
15110                         fi
15111                 fi
15112         fi
15113         ;;
15114 *)      if $test X"$uidsize" = X"$uvsize"; then
15115                 uidformat="$uvuformat"
15116         else
15117                 if $test X"$uidsize" = X"$longsize"; then
15118                         uidformat='"lu"'
15119                 else
15120                         if $test X"$uidsize" = X"$intsize"; then
15121                                 uidformat='"u"'
15122                         else
15123                                 if $test X"$uidsize" = X"$shortsize"; then
15124                                         uidformat='"hu"'
15125                                 fi
15126                         fi
15127                 fi
15128         fi
15129         ;;
15130 esac
15131
15132 : determine compiler compiler
15133 case "$yacc" in
15134 '')
15135         dflt=yacc;;
15136 *)
15137         dflt="$yacc";;
15138 esac
15139 echo " "
15140 comp='yacc'
15141 if $test -f "$byacc"; then
15142         dflt="$byacc"
15143         comp="byacc or $comp"
15144 fi
15145 if $test -f "$bison"; then
15146         comp="$comp or bison -y"
15147 fi
15148 rp="Which compiler compiler ($comp) shall I use?"
15149 . ./myread
15150 yacc="$ans"
15151 case "$yacc" in
15152 *bis*)
15153         case "$yacc" in
15154         *-y*) ;;
15155         *)
15156                 yacc="$yacc -y"
15157                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15158                 ;;
15159         esac
15160         ;;
15161 esac
15162
15163 : see if dbm.h is available
15164 : see if dbmclose exists
15165 set dbmclose d_dbmclose
15166 eval $inlibc
15167
15168 case "$d_dbmclose" in
15169 $define)
15170         set dbm.h i_dbm
15171         eval $inhdr
15172         case "$i_dbm" in
15173         $define)
15174                 val="$undef"
15175                 set i_rpcsvcdbm
15176                 eval $setvar
15177                 ;;
15178         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15179                 eval $inhdr
15180                 ;;
15181         esac
15182         ;;
15183 *)      echo "We won't be including <dbm.h>"
15184         val="$undef"
15185         set i_dbm
15186         eval $setvar
15187         val="$undef"
15188         set i_rpcsvcdbm
15189         eval $setvar
15190         ;;
15191 esac
15192
15193 : see if this is a sys/file.h system
15194 val=''
15195 set sys/file.h val
15196 eval $inhdr
15197
15198 : do we need to include sys/file.h ?
15199 case "$val" in
15200 "$define")
15201         echo " "
15202         if $h_sysfile; then
15203                 val="$define"
15204                 echo "We'll be including <sys/file.h>." >&4
15205         else
15206                 val="$undef"
15207                 echo "We won't be including <sys/file.h>." >&4
15208         fi
15209         ;;
15210 *)
15211         h_sysfile=false
15212         ;;
15213 esac
15214 set i_sysfile
15215 eval $setvar
15216
15217 : see if fcntl.h is there
15218 val=''
15219 set fcntl.h val
15220 eval $inhdr
15221
15222 : see if we can include fcntl.h
15223 case "$val" in
15224 "$define")
15225         echo " "
15226         if $h_fcntl; then
15227                 val="$define"
15228                 echo "We'll be including <fcntl.h>." >&4
15229         else
15230                 val="$undef"
15231                 if $h_sysfile; then
15232         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15233                 else
15234                         echo "We won't be including <fcntl.h>." >&4
15235                 fi
15236         fi
15237         ;;
15238 *)
15239         h_fcntl=false
15240         val="$undef"
15241         ;;
15242 esac
15243 set i_fcntl
15244 eval $setvar
15245
15246 : see if this is a iconv.h system
15247 set iconv.h i_iconv
15248 eval $inhdr
15249
15250 : see if this is a ieeefp.h system
15251 set ieeefp.h i_ieeefp
15252 eval $inhdr
15253
15254 : see if this is a libutil.h system
15255 set libutil.h i_libutil
15256 eval $inhdr
15257
15258 : see if locale.h is available
15259 set locale.h i_locale
15260 eval $inhdr
15261
15262 : see if mach cthreads are available
15263 if test "X$usethreads" = "X$define"; then
15264         set mach/cthreads.h i_machcthr
15265         eval $inhdr
15266 else
15267         i_machcthr="$undef"
15268 fi
15269
15270
15271
15272 : see if this is a math.h system
15273 set math.h i_math
15274 eval $inhdr
15275
15276 : see if this is a mntent.h system
15277 set mntent.h i_mntent
15278 eval $inhdr
15279
15280 : see if ndbm.h is available
15281 set ndbm.h t_ndbm
15282 eval $inhdr
15283 case "$t_ndbm" in
15284 $define)
15285         : see if dbm_open exists
15286         set dbm_open d_dbm_open
15287         eval $inlibc
15288         case "$d_dbm_open" in
15289         $undef)
15290                 t_ndbm="$undef"
15291                 echo "We won't be including <ndbm.h>"
15292                 ;;
15293         esac
15294         ;;
15295 esac
15296 val="$t_ndbm"
15297 set i_ndbm
15298 eval $setvar
15299
15300 : see if net/errno.h is available
15301 val=''
15302 set net/errno.h val
15303 eval $inhdr
15304
15305 : Unfortunately, it causes problems on some systems.  Arrgh.
15306 case "$val" in
15307 $define)
15308         cat > try.c <<'EOM'
15309 #include <stdio.h>
15310 #include <errno.h>
15311 #include <net/errno.h>
15312 int func()
15313 {
15314         return ENOTSOCK;
15315 }
15316 EOM
15317         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15318                 echo "We'll be including <net/errno.h>." >&4
15319         else
15320                 echo "We won't be including <net/errno.h>." >&4
15321                 val="$undef"
15322         fi
15323         $rm -f try.* try
15324         ;;
15325 esac
15326 set i_neterrno
15327 eval $setvar
15328
15329 : see if netinet/tcp.h is available
15330 set netinet/tcp.h i_netinettcp
15331 eval $inhdr
15332
15333 : see if this is a poll.h system
15334 set poll.h i_poll
15335 eval $inhdr
15336
15337 : see if this is a prot.h system
15338 set prot.h i_prot
15339 eval $inhdr
15340
15341 echo " "
15342 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15343 $cat <<'EOSH' > Cppsym.know
15344 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15345 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15346 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15347 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15348 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15349 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15350 bull c cadmus clipper CMU COFF COMPILER_VERSION
15351 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15352 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15353 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15354 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15355 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15356 H3050R H3050RX hbullx20 hcx host_mips
15357 hp200 hp300 hp700 HP700 hp800 hp9000
15358 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15359 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15360 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15361 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15362 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15363 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15364 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15365 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15366 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15367 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15368 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15369 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15370 MATH_HAS_NO_SIDE_EFFECTS
15371 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15372 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15373 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15374 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15375 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15376 NetBSD news1500 news1700 news1800 news1900 news3700
15377 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15378 ns32016 ns32332 ns32k nsc32000
15379 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15380 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15381 pc532 pdp11 PGC PIC plexus PORTAR posix
15382 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15383 POSIX_C_SOURCE POSIX_SOURCE POWER
15384 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15385 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15386 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15387 sony sony_news sonyrisc sparc sparclite spectrum
15388 stardent stdc STDC_EXT stratos sun sun3 sun386
15389 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15390 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15391 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15392 sysV68 sysV88 Tek4132 Tek4300 titan
15393 TM3200 TM5400 TM5600
15394 tower tower32 tower32_200 tower32_600 tower32_700
15395 tower32_800 tower32_850 tss
15396 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15397 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15398 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15399 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15400 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15401 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15402 z8000
15403 EOSH
15404 # Maybe put other stuff here too.
15405 cat <<EOSH >>Cppsym.know
15406 $osname
15407 EOSH
15408 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15409 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15410 $cat Cppsym.know > Cppsym.c
15411 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15412 $rm -f Cppsym.a Cppsym.b Cppsym.c
15413 cat <<EOSH > Cppsym
15414 $startsh
15415 if $test \$# -gt 0; then
15416     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15417     if $test -s Cppsym.got; then
15418         $rm -f Cppsym.got
15419         exit 0
15420     fi
15421     $rm -f Cppsym.got
15422     exit 1
15423 else
15424     $tr " " "$trnl" | ./Cppsym.try
15425     exit 0
15426 fi
15427 EOSH
15428 chmod +x Cppsym
15429 $eunicefix Cppsym
15430 cat <<EOSH > Cppsym.try
15431 $startsh
15432 cat <<'EOCP' > try.c
15433 #include <stdio.h>
15434 int main() {
15435 EOCP
15436 $awk \\
15437 EOSH
15438 cat <<'EOSH' >> Cppsym.try
15439 'length($1) > 0 {
15440     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
15441     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
15442     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
15443     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
15444 }'       >> try.c
15445 echo '}' >> try.c
15446 EOSH
15447 cat <<EOSH >> Cppsym.try
15448 ccflags="$ccflags"
15449 case "$osname-$gccversion" in
15450 irix-) ccflags="\$ccflags -woff 1178" ;;
15451 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15452 esac
15453 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15454 EOSH
15455 chmod +x Cppsym.try
15456 $eunicefix Cppsym.try
15457 ./Cppsym < Cppsym.know > Cppsym.true
15458 : now check the C compiler for additional symbols
15459 postprocess_cc_v=''
15460 case "$osname" in
15461 aix) postprocess_cc_v="|$tr , ' '" ;;
15462 esac
15463 $cat >ccsym <<EOS
15464 $startsh
15465 $cat >tmp.c <<EOF
15466 extern int foo;
15467 EOF
15468 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15469 do
15470         case "\$i" in
15471         -D*) echo "\$i" | $sed 's/^-D//';;
15472         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15473         esac
15474 done
15475 $rm -f try.c
15476 EOS
15477 postprocess_cc_v=''
15478 chmod +x ccsym
15479 $eunicefix ccsym
15480 ./ccsym > ccsym1.raw
15481 if $test -s ccsym1.raw; then
15482        $sort ccsym1.raw | $uniq >ccsym.raw
15483 else
15484        mv ccsym1.raw ccsym.raw
15485 fi
15486
15487 $awk '/\=/ { print $0; next }
15488         { print $0"=1" }' ccsym.raw >ccsym.list
15489 $awk '/\=/ { print $0; next }
15490         { print $0"=1" }' Cppsym.true >ccsym.true
15491 $comm -13 ccsym.true ccsym.list >ccsym.own
15492 $comm -12 ccsym.true ccsym.list >ccsym.com
15493 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15494 also=''
15495 if $test -z ccsym.raw; then
15496         echo "Your C compiler doesn't seem to define any symbols!" >&4
15497         echo " "
15498         echo "However, your C preprocessor defines the following symbols:"
15499         $cat Cppsym.true
15500         ccsymbols=''
15501         cppsymbols=`$cat Cppsym.true`
15502         cppsymbols=`echo $cppsymbols`
15503         cppccsymbols="$cppsymbols"
15504 else
15505         if $test -s ccsym.com; then
15506                 echo "Your C compiler and pre-processor define these symbols:"
15507                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15508                 also='also '
15509                 symbols='ones'
15510                 cppccsymbols=`$cat ccsym.com`
15511                 cppccsymbols=`echo $cppccsymbols`
15512                 $test "$silent" || sleep 1
15513         fi
15514         if $test -s ccsym.cpp; then
15515                 $test "$also" && echo " "
15516                 echo "Your C pre-processor ${also}defines the following symbols:"
15517                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15518                 also='further '
15519                 cppsymbols=`$cat ccsym.cpp`
15520                 cppsymbols=`echo $cppsymbols`
15521                 $test "$silent" || sleep 1
15522         fi
15523         if $test -s ccsym.own; then
15524                 $test "$also" && echo " "
15525                 echo "Your C compiler ${also}defines the following cpp symbols:"
15526                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15527                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15528                 ccsymbols=`$cat ccsym.own`
15529                 ccsymbols=`echo $ccsymbols`
15530                 $test "$silent" || sleep 1
15531         fi
15532 fi
15533 $rm -f ccsym* Cppsym.*
15534
15535 : see if this is a termio system
15536 val="$undef"
15537 val2="$undef"
15538 val3="$undef"
15539 if $test `./findhdr termios.h`; then
15540         set tcsetattr i_termios
15541         eval $inlibc
15542         val3="$i_termios"
15543 fi
15544 echo " "
15545 case "$val3" in
15546 "$define") echo "You have POSIX termios.h... good!" >&4;;
15547 *) if ./Cppsym pyr; then
15548                 case "`/bin/universe`" in
15549                 ucb) if $test `./findhdr sgtty.h`; then
15550                                 val2="$define"
15551                                 echo "<sgtty.h> found." >&4
15552                         else
15553                                 echo "System is pyramid with BSD universe."
15554                                 echo "<sgtty.h> not found--you could have problems." >&4
15555                         fi;;
15556                 *) if $test `./findhdr termio.h`; then
15557                                 val="$define"
15558                                 echo "<termio.h> found." >&4
15559                         else
15560                                 echo "System is pyramid with USG universe."
15561                                 echo "<termio.h> not found--you could have problems." >&4
15562                         fi;;
15563                 esac
15564         elif ./usg; then
15565                 if $test `./findhdr termio.h`; then
15566                         echo "<termio.h> found." >&4
15567                         val="$define"
15568                 elif $test `./findhdr sgtty.h`; then
15569                         echo "<sgtty.h> found." >&4
15570                         val2="$define"
15571                 else
15572 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15573                 fi
15574         else
15575                 if $test `./findhdr sgtty.h`; then
15576                         echo "<sgtty.h> found." >&4
15577                         val2="$define"
15578                 elif $test `./findhdr termio.h`; then
15579                         echo "<termio.h> found." >&4
15580                         val="$define"
15581                 else
15582 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15583                 fi
15584         fi;;
15585 esac
15586 set i_termio; eval $setvar
15587 val=$val2; set i_sgtty; eval $setvar
15588 val=$val3; set i_termios; eval $setvar
15589
15590 : see if this is a shadow.h system
15591 set shadow.h i_shadow
15592 eval $inhdr
15593
15594 : see if stddef is available
15595 set stddef.h i_stddef
15596 eval $inhdr
15597
15598 : see if this is a sunmath.h system
15599 set sunmath.h i_sunmath
15600 eval $inhdr
15601
15602 : see if sys/access.h is available
15603 set sys/access.h i_sysaccess
15604 eval $inhdr
15605
15606 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15607 set sys/filio.h i_sysfilio
15608 eval $inhdr
15609 echo " "
15610 if $test `./findhdr sys/ioctl.h`; then
15611         val="$define"
15612         echo '<sys/ioctl.h> found.' >&4
15613 else
15614         val="$undef"
15615         if $test $i_sysfilio = "$define"; then
15616             echo '<sys/ioctl.h> NOT found.' >&4
15617         else
15618                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15619                 $test $i_termio = "$define" && xxx="termio.h"
15620                 $test $i_termios = "$define" && xxx="termios.h"
15621 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15622         fi
15623 fi
15624 set i_sysioctl
15625 eval $setvar
15626
15627 : see if socket ioctl defs are in sys/sockio.h
15628 echo " "
15629 xxx=`./findhdr sys/sockio.h`
15630 if $test "$xxx"; then
15631         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15632                 val="$define"
15633                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15634         else
15635                 val="$undef"
15636                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15637         fi
15638 else
15639         val="$undef"
15640         $cat <<EOM
15641 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15642 EOM
15643 fi
15644 set i_syssockio
15645 eval $setvar
15646
15647
15648 : see if this is a syslog.h system
15649 set syslog.h i_syslog
15650 eval $inhdr
15651
15652
15653 : see if this is a sys/mode.h system
15654 set sys/mode.h i_sysmode
15655 eval $inhdr
15656
15657 : see if sys/resource.h has to be included
15658 set sys/resource.h i_sysresrc
15659 eval $inhdr
15660
15661 : see if sys/security.h is available
15662 set sys/security.h i_syssecrt
15663 eval $inhdr
15664
15665 : see if this is a sys/statvfs.h system
15666 set sys/statvfs.h i_sysstatvfs
15667 eval $inhdr
15668
15669 : see if this is a sys/un.h system
15670 set sys/un.h i_sysun
15671 eval $inhdr
15672
15673
15674 : see if this is a sys/utsname.h system
15675 set sys/utsname.h i_sysutsname
15676 eval $inhdr
15677
15678 : see if this is a syswait system
15679 set sys/wait.h i_syswait
15680 eval $inhdr
15681
15682 : see if this is a ustat.h system
15683 set ustat.h i_ustat
15684 eval $inhdr
15685
15686 : see if this is an utime system
15687 set utime.h i_utime
15688 eval $inhdr
15689
15690 : see if this is a values.h system
15691 set values.h i_values
15692 eval $inhdr
15693
15694 : see if this is a vfork system
15695 case "$d_vfork" in
15696 "$define")
15697         set vfork.h i_vfork
15698         eval $inhdr
15699         ;;
15700 *)
15701         i_vfork="$undef"
15702         ;;
15703 esac
15704
15705 : see if gdbm.h is available
15706 set gdbm.h t_gdbm
15707 eval $inhdr
15708 case "$t_gdbm" in
15709 $define)
15710         : see if gdbm_open exists
15711         set gdbm_open d_gdbm_open
15712         eval $inlibc
15713         case "$d_gdbm_open" in
15714         $undef)
15715                 t_gdbm="$undef"
15716                 echo "We won't be including <gdbm.h>"
15717                 ;;
15718         esac
15719         ;;
15720 esac
15721 val="$t_gdbm"
15722 set i_gdbm
15723 eval $setvar
15724
15725 echo " "
15726 echo "Looking for extensions..." >&4
15727 : If we are using the old config.sh, known_extensions may contain
15728 : old or inaccurate or duplicate values.
15729 known_extensions=''
15730 nonxs_extensions=''
15731 : We do not use find because it might not be available.
15732 : We do not just use MANIFEST because the user may have dropped
15733 : some additional extensions into the source tree and expect them
15734 : to be built.
15735
15736 : Function to recursively find available extensions, ignoring DynaLoader
15737 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15738 find_extensions='
15739     for xxx in *; do
15740        case "$xxx" in
15741            DynaLoader|dynaload) ;;
15742            *)
15743            if $test -f $xxx/$xxx.xs; then
15744                known_extensions="$known_extensions $1$xxx";
15745            elif $test -f $xxx/Makefile.PL; then
15746                nonxs_extensions="$nonxs_extensions $1$xxx";
15747            else
15748                if $test -d $xxx -a $# -lt 10; then
15749                    set $1$xxx/ $*;
15750                    cd $xxx;
15751                    eval $find_extensions;
15752                    cd ..;
15753                    shift;
15754                fi;
15755            fi
15756            ;;
15757        esac;
15758     done'
15759 tdir=`pwd`
15760 cd $rsrc/ext
15761 set X
15762 shift
15763 eval $find_extensions
15764 set X $nonxs_extensions
15765 shift
15766 nonxs_extensions="$*"
15767 set X $known_extensions
15768 shift
15769 known_extensions="$*"
15770 cd $tdir
15771
15772 : Now see which are supported on this system.
15773 avail_ext=''
15774 for xxx in $known_extensions ; do
15775         case "$xxx" in
15776         DB_File|db_file)
15777                 case "$i_db" in
15778                 $define) avail_ext="$avail_ext $xxx" ;;
15779                 esac
15780                 ;;
15781         GDBM_File|gdbm_fil)
15782                 case "$i_gdbm" in 
15783                 $define) avail_ext="$avail_ext $xxx" ;;
15784                 esac
15785                 ;;
15786         NDBM_File|ndbm_fil)
15787                 case "$i_ndbm" in
15788                 $define)
15789                     case "$osname-$use64bitint" in
15790                     hpux-define)
15791                         case "$libs" in
15792                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15793                         esac
15794                         ;;
15795                     *) avail_ext="$avail_ext $xxx" ;;
15796                     esac
15797                     ;;
15798                 esac
15799                 ;;
15800         ODBM_File|odbm_fil) 
15801                 case "${i_dbm}${i_rpcsvcdbm}" in
15802                 *"${define}"*)
15803                     case "$osname-$use64bitint" in
15804                     hpux-define)
15805                         case "$libs" in
15806                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15807                         esac
15808                         ;;
15809                     *) avail_ext="$avail_ext $xxx" ;;
15810                     esac
15811                     ;;
15812                 esac
15813                 ;;
15814         POSIX|posix)
15815                 case "$useposix" in
15816                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15817                 esac
15818                 ;;
15819         Opcode|opcode)
15820                 case "$useopcode" in
15821                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15822                 esac
15823                 ;;
15824         Socket|socket)
15825                 case "$d_socket" in 
15826                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15827                 esac
15828                 ;;
15829         Sys/Syslog|sys/syslog)
15830                 : XXX syslog requires socket
15831                 case "$d_socket" in 
15832                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15833                 esac
15834                 ;;
15835         Thread|thread)
15836                 case "$usethreads" in 
15837                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15838                 esac
15839                 ;;
15840         IPC/SysV|ipc/sysv)
15841                 : XXX Do we need a useipcsysv variable here
15842                 case "${d_msg}${d_sem}${d_shm}" in 
15843                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15844                 esac
15845                 ;;
15846         *)      avail_ext="$avail_ext $xxx"
15847                 ;;
15848         esac
15849 done
15850
15851 set X $avail_ext
15852 shift
15853 avail_ext="$*"
15854
15855 : Now see which nonxs extensions are supported on this system.
15856 : For now assume all are.
15857 nonxs_ext=''
15858 for xxx in $nonxs_extensions ; do
15859         case "$xxx" in
15860         *)      nonxs_ext="$nonxs_ext $xxx"
15861                 ;;
15862         esac
15863 done
15864
15865 set X $nonxs_ext
15866 shift
15867 nonxs_ext="$*"
15868
15869 case $usedl in
15870 $define)
15871         $cat <<EOM
15872 A number of extensions are supplied with $package.  You may choose to
15873 compile these extensions for dynamic loading (the default), compile
15874 them into the $package executable (static loading), or not include
15875 them at all.  Answer "none" to include no extensions.
15876 Note that DynaLoader is always built and need not be mentioned here.
15877
15878 EOM
15879         case "$dynamic_ext" in
15880         '') dflt="$avail_ext" ;;
15881         *)      dflt="$dynamic_ext"
15882                 # Perhaps we are reusing an old out-of-date config.sh.
15883                 case "$hint" in
15884                 previous)
15885                         if test X"$dynamic_ext" != X"$avail_ext"; then
15886                                 $cat <<EOM
15887 NOTICE:  Your previous config.sh list may be incorrect. 
15888 The extensions now available to you are 
15889         ${avail_ext}
15890 but the default list from your previous config.sh is
15891         ${dynamic_ext} 
15892
15893 EOM
15894                         fi
15895                         ;;
15896                 esac
15897                 ;;
15898         esac
15899         case "$dflt" in
15900         '')     dflt=none;;
15901         esac
15902         rp="What extensions do you wish to load dynamically?"
15903         . ./myread
15904         case "$ans" in
15905         none) dynamic_ext=' ' ;;
15906         *) dynamic_ext="$ans" ;;
15907         esac
15908
15909         case "$static_ext" in
15910         '')
15911                 : Exclude those already listed in dynamic linking
15912                 dflt=''
15913                 for xxx in $avail_ext; do
15914                         case " $dynamic_ext " in
15915                         *" $xxx "*) ;;
15916                         *) dflt="$dflt $xxx" ;;
15917                         esac
15918                 done
15919                 set X $dflt
15920                 shift
15921                 dflt="$*"
15922                 ;;
15923         *)  dflt="$static_ext" 
15924                 ;;
15925         esac
15926
15927         case "$dflt" in
15928         '')     dflt=none;;
15929         esac
15930         rp="What extensions do you wish to load statically?"
15931         . ./myread
15932         case "$ans" in
15933         none) static_ext=' ' ;;
15934         *) static_ext="$ans" ;;
15935         esac
15936         ;;
15937 *)
15938         $cat <<EOM
15939 A number of extensions are supplied with $package.  Answer "none" 
15940 to include no extensions. 
15941 Note that DynaLoader is always built and need not be mentioned here.
15942
15943 EOM
15944         case "$static_ext" in
15945         '') dflt="$avail_ext" ;;
15946         *)      dflt="$static_ext"
15947                 # Perhaps we are reusing an old out-of-date config.sh.
15948                 case "$hint" in
15949                 previous)
15950                         if test X"$static_ext" != X"$avail_ext"; then
15951                                 $cat <<EOM
15952 NOTICE:  Your previous config.sh list may be incorrect. 
15953 The extensions now available to you are 
15954         ${avail_ext}
15955 but the default list from your previous config.sh is
15956         ${static_ext} 
15957
15958 EOM
15959                         fi
15960                         ;;
15961                 esac
15962                 ;;
15963         esac
15964         : Exclude those that are not xs extensions
15965         case "$dflt" in
15966         '')     dflt=none;;
15967         esac
15968         rp="What extensions do you wish to include?"
15969         . ./myread
15970         case "$ans" in
15971         none) static_ext=' ' ;;
15972         *) static_ext="$ans" ;;
15973         esac
15974         ;;
15975 esac
15976
15977 set X $dynamic_ext $static_ext $nonxs_ext
15978 shift
15979 extensions="$*"
15980
15981 : Remove libraries needed only for extensions
15982 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15983 : The exception is SunOS 4.x, which needs them.
15984 case "${osname}X${osvers}" in
15985 sunos*X4*)
15986     perllibs="$libs"
15987     ;;
15988 *) case "$usedl" in
15989     $define|true|[yY]*)
15990             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15991             shift
15992             perllibs="$*"
15993             ;;
15994     *)  perllibs="$libs"
15995             ;;
15996     esac
15997     ;;
15998 esac
15999
16000 : Remove build directory name from cppstdin so it can be used from
16001 : either the present location or the final installed location.
16002 echo " "
16003 : Get out of the UU directory to get correct path name.
16004 cd ..
16005 case "$cppstdin" in
16006 `pwd`/cppstdin)
16007         echo "Stripping down cppstdin path name"
16008         cppstdin=cppstdin
16009         ;;
16010 esac
16011 cd UU
16012
16013 : end of configuration questions
16014 echo " "
16015 echo "End of configuration questions."
16016 echo " "
16017
16018 : back to where it started
16019 if test -d ../UU; then
16020         cd ..
16021 fi
16022
16023 : configuration may be patched via a 'config.over' file
16024 if $test -f config.over; then
16025         echo " "
16026         dflt=y
16027         rp='I see a config.over file.  Do you wish to load it?'
16028         . UU/myread
16029         case "$ans" in
16030         n*) echo "OK, I'll ignore it.";;
16031         *)      . ./config.over
16032                 echo "Configuration override changes have been loaded."
16033                 ;;
16034         esac
16035 fi
16036
16037 : in case they want portability, strip down executable paths
16038 case "$d_portable" in
16039 "$define")
16040         echo " "
16041         echo "Stripping down executable paths..." >&4
16042         for file in $loclist $trylist; do
16043                 eval temp=\$$file
16044                 eval $file=`basename $temp`
16045         done
16046         ;;
16047 esac
16048
16049 : create config.sh file
16050 echo " "
16051 echo "Creating config.sh..." >&4
16052 $spitshell <<EOT >config.sh
16053 $startsh
16054 #
16055 # This file was produced by running the Configure script. It holds all the
16056 # definitions figured out by Configure. Should you modify one of these values,
16057 # do not forget to propagate your changes by running "Configure -der". You may
16058 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16059 #
16060
16061 # Package name      : $package
16062 # Source directory  : $src
16063 # Configuration time: $cf_time
16064 # Configured by     : $cf_by
16065 # Target system     : $myuname
16066
16067 Author='$Author'
16068 Date='$Date'
16069 Header='$Header'
16070 Id='$Id'
16071 Locker='$Locker'
16072 Log='$Log'
16073 Mcc='$Mcc'
16074 RCSfile='$RCSfile'
16075 Revision='$Revision'
16076 Source='$Source'
16077 State='$State'
16078 _a='$_a'
16079 _exe='$_exe'
16080 _o='$_o'
16081 afs='$afs'
16082 alignbytes='$alignbytes'
16083 ansi2knr='$ansi2knr'
16084 aphostname='$aphostname'
16085 api_revision='$api_revision'
16086 api_subversion='$api_subversion'
16087 api_version='$api_version'
16088 api_versionstring='$api_versionstring'
16089 ar='$ar'
16090 archlib='$archlib'
16091 archlibexp='$archlibexp'
16092 archname64='$archname64'
16093 archname='$archname'
16094 archobjs='$archobjs'
16095 awk='$awk'
16096 baserev='$baserev'
16097 bash='$bash'
16098 bin='$bin'
16099 bincompat5005='$bincompat5005'
16100 binexp='$binexp'
16101 bison='$bison'
16102 byacc='$byacc'
16103 byteorder='$byteorder'
16104 c='$c'
16105 castflags='$castflags'
16106 cat='$cat'
16107 cc='$cc'
16108 cccdlflags='$cccdlflags'
16109 ccdlflags='$ccdlflags'
16110 ccflags='$ccflags'
16111 ccflags_uselargefiles='$ccflags_uselargefiles'
16112 ccname='$ccname'
16113 ccsymbols='$ccsymbols'
16114 ccversion='$ccversion'
16115 cf_by='$cf_by'
16116 cf_email='$cf_email'
16117 cf_time='$cf_time'
16118 charsize='$charsize'
16119 chgrp='$chgrp'
16120 chmod='$chmod'
16121 chown='$chown'
16122 clocktype='$clocktype'
16123 comm='$comm'
16124 compress='$compress'
16125 contains='$contains'
16126 cp='$cp'
16127 cpio='$cpio'
16128 cpp='$cpp'
16129 cpp_stuff='$cpp_stuff'
16130 cppccsymbols='$cppccsymbols'
16131 cppflags='$cppflags'
16132 cpplast='$cpplast'
16133 cppminus='$cppminus'
16134 cpprun='$cpprun'
16135 cppstdin='$cppstdin'
16136 cppsymbols='$cppsymbols'
16137 crosscompile='$crosscompile'
16138 cryptlib='$cryptlib'
16139 csh='$csh'
16140 d_Gconvert='$d_Gconvert'
16141 d_PRIEUldbl='$d_PRIEUldbl'
16142 d_PRIFUldbl='$d_PRIFUldbl'
16143 d_PRIGUldbl='$d_PRIGUldbl'
16144 d_PRIXU64='$d_PRIXU64'
16145 d_PRId64='$d_PRId64'
16146 d_PRIeldbl='$d_PRIeldbl'
16147 d_PRIfldbl='$d_PRIfldbl'
16148 d_PRIgldbl='$d_PRIgldbl'
16149 d_PRIi64='$d_PRIi64'
16150 d_PRIo64='$d_PRIo64'
16151 d_PRIu64='$d_PRIu64'
16152 d_PRIx64='$d_PRIx64'
16153 d_SCNfldbl='$d_SCNfldbl'
16154 d__fwalk='$d__fwalk'
16155 d_access='$d_access'
16156 d_accessx='$d_accessx'
16157 d_alarm='$d_alarm'
16158 d_archlib='$d_archlib'
16159 d_atolf='$d_atolf'
16160 d_atoll='$d_atoll'
16161 d_attribut='$d_attribut'
16162 d_bcmp='$d_bcmp'
16163 d_bcopy='$d_bcopy'
16164 d_bincompat5005='$d_bincompat5005'
16165 d_bsd='$d_bsd'
16166 d_bsdgetpgrp='$d_bsdgetpgrp'
16167 d_bsdsetpgrp='$d_bsdsetpgrp'
16168 d_bzero='$d_bzero'
16169 d_casti32='$d_casti32'
16170 d_castneg='$d_castneg'
16171 d_charvspr='$d_charvspr'
16172 d_chown='$d_chown'
16173 d_chroot='$d_chroot'
16174 d_chsize='$d_chsize'
16175 d_closedir='$d_closedir'
16176 d_cmsghdr_s='$d_cmsghdr_s'
16177 d_const='$d_const'
16178 d_crypt='$d_crypt'
16179 d_csh='$d_csh'
16180 d_cuserid='$d_cuserid'
16181 d_dbl_dig='$d_dbl_dig'
16182 d_difftime='$d_difftime'
16183 d_dirnamlen='$d_dirnamlen'
16184 d_dlerror='$d_dlerror'
16185 d_dlopen='$d_dlopen'
16186 d_dlsymun='$d_dlsymun'
16187 d_dosuid='$d_dosuid'
16188 d_drand48proto='$d_drand48proto'
16189 d_dup2='$d_dup2'
16190 d_eaccess='$d_eaccess'
16191 d_endgrent='$d_endgrent'
16192 d_endhent='$d_endhent'
16193 d_endnent='$d_endnent'
16194 d_endpent='$d_endpent'
16195 d_endpwent='$d_endpwent'
16196 d_endsent='$d_endsent'
16197 d_eofnblk='$d_eofnblk'
16198 d_eunice='$d_eunice'
16199 d_fchmod='$d_fchmod'
16200 d_fchown='$d_fchown'
16201 d_fcntl='$d_fcntl'
16202 d_fcntl_can_lock='$d_fcntl_can_lock'
16203 d_fd_macros='$d_fd_macros'
16204 d_fd_set='$d_fd_set'
16205 d_fds_bits='$d_fds_bits'
16206 d_fgetpos='$d_fgetpos'
16207 d_flexfnam='$d_flexfnam'
16208 d_flock='$d_flock'
16209 d_fork='$d_fork'
16210 d_fpathconf='$d_fpathconf'
16211 d_fpos64_t='$d_fpos64_t'
16212 d_frexpl='$d_frexpl'
16213 d_fs_data_s='$d_fs_data_s'
16214 d_fseeko='$d_fseeko'
16215 d_fsetpos='$d_fsetpos'
16216 d_fstatfs='$d_fstatfs'
16217 d_fstatvfs='$d_fstatvfs'
16218 d_fsync='$d_fsync'
16219 d_ftello='$d_ftello'
16220 d_ftime='$d_ftime'
16221 d_getcwd='$d_getcwd'
16222 d_getespwnam='$d_getespwnam'
16223 d_getfsstat='$d_getfsstat'
16224 d_getgrent='$d_getgrent'
16225 d_getgrps='$d_getgrps'
16226 d_gethbyaddr='$d_gethbyaddr'
16227 d_gethbyname='$d_gethbyname'
16228 d_gethent='$d_gethent'
16229 d_gethname='$d_gethname'
16230 d_gethostprotos='$d_gethostprotos'
16231 d_getitimer='$d_getitimer'
16232 d_getlogin='$d_getlogin'
16233 d_getmnt='$d_getmnt'
16234 d_getmntent='$d_getmntent'
16235 d_getnbyaddr='$d_getnbyaddr'
16236 d_getnbyname='$d_getnbyname'
16237 d_getnent='$d_getnent'
16238 d_getnetprotos='$d_getnetprotos'
16239 d_getpagsz='$d_getpagsz'
16240 d_getpbyname='$d_getpbyname'
16241 d_getpbynumber='$d_getpbynumber'
16242 d_getpent='$d_getpent'
16243 d_getpgid='$d_getpgid'
16244 d_getpgrp2='$d_getpgrp2'
16245 d_getpgrp='$d_getpgrp'
16246 d_getppid='$d_getppid'
16247 d_getprior='$d_getprior'
16248 d_getprotoprotos='$d_getprotoprotos'
16249 d_getprpwnam='$d_getprpwnam'
16250 d_getpwent='$d_getpwent'
16251 d_getsbyname='$d_getsbyname'
16252 d_getsbyport='$d_getsbyport'
16253 d_getsent='$d_getsent'
16254 d_getservprotos='$d_getservprotos'
16255 d_getspnam='$d_getspnam'
16256 d_gettimeod='$d_gettimeod'
16257 d_gnulibc='$d_gnulibc'
16258 d_grpasswd='$d_grpasswd'
16259 d_hasmntopt='$d_hasmntopt'
16260 d_htonl='$d_htonl'
16261 d_iconv='$d_iconv'
16262 d_index='$d_index'
16263 d_inetaton='$d_inetaton'
16264 d_int64_t='$d_int64_t'
16265 d_isascii='$d_isascii'
16266 d_isnan='$d_isnan'
16267 d_isnanl='$d_isnanl'
16268 d_killpg='$d_killpg'
16269 d_lchown='$d_lchown'
16270 d_ldbl_dig='$d_ldbl_dig'
16271 d_link='$d_link'
16272 d_locconv='$d_locconv'
16273 d_lockf='$d_lockf'
16274 d_longdbl='$d_longdbl'
16275 d_longlong='$d_longlong'
16276 d_lseekproto='$d_lseekproto'
16277 d_lstat='$d_lstat'
16278 d_madvise='$d_madvise'
16279 d_mblen='$d_mblen'
16280 d_mbstowcs='$d_mbstowcs'
16281 d_mbtowc='$d_mbtowc'
16282 d_memchr='$d_memchr'
16283 d_memcmp='$d_memcmp'
16284 d_memcpy='$d_memcpy'
16285 d_memmove='$d_memmove'
16286 d_memset='$d_memset'
16287 d_mkdir='$d_mkdir'
16288 d_mkdtemp='$d_mkdtemp'
16289 d_mkfifo='$d_mkfifo'
16290 d_mkstemp='$d_mkstemp'
16291 d_mkstemps='$d_mkstemps'
16292 d_mktime='$d_mktime'
16293 d_mmap='$d_mmap'
16294 d_modfl='$d_modfl'
16295 d_mprotect='$d_mprotect'
16296 d_msg='$d_msg'
16297 d_msg_ctrunc='$d_msg_ctrunc'
16298 d_msg_dontroute='$d_msg_dontroute'
16299 d_msg_oob='$d_msg_oob'
16300 d_msg_peek='$d_msg_peek'
16301 d_msg_proxy='$d_msg_proxy'
16302 d_msgctl='$d_msgctl'
16303 d_msgget='$d_msgget'
16304 d_msghdr_s='$d_msghdr_s'
16305 d_msgrcv='$d_msgrcv'
16306 d_msgsnd='$d_msgsnd'
16307 d_msync='$d_msync'
16308 d_munmap='$d_munmap'
16309 d_mymalloc='$d_mymalloc'
16310 d_nice='$d_nice'
16311 d_nv_preserves_uv='$d_nv_preserves_uv'
16312 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16313 d_off64_t='$d_off64_t'
16314 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16315 d_oldpthreads='$d_oldpthreads'
16316 d_oldsock='$d_oldsock'
16317 d_open3='$d_open3'
16318 d_pathconf='$d_pathconf'
16319 d_pause='$d_pause'
16320 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16321 d_phostname='$d_phostname'
16322 d_pipe='$d_pipe'
16323 d_poll='$d_poll'
16324 d_portable='$d_portable'
16325 d_pthread_yield='$d_pthread_yield'
16326 d_pwage='$d_pwage'
16327 d_pwchange='$d_pwchange'
16328 d_pwclass='$d_pwclass'
16329 d_pwcomment='$d_pwcomment'
16330 d_pwexpire='$d_pwexpire'
16331 d_pwgecos='$d_pwgecos'
16332 d_pwpasswd='$d_pwpasswd'
16333 d_pwquota='$d_pwquota'
16334 d_qgcvt='$d_qgcvt'
16335 d_quad='$d_quad'
16336 d_readdir='$d_readdir'
16337 d_readlink='$d_readlink'
16338 d_readv='$d_readv'
16339 d_recvmsg='$d_recvmsg'
16340 d_rename='$d_rename'
16341 d_rewinddir='$d_rewinddir'
16342 d_rmdir='$d_rmdir'
16343 d_safebcpy='$d_safebcpy'
16344 d_safemcpy='$d_safemcpy'
16345 d_sanemcmp='$d_sanemcmp'
16346 d_sbrkproto='$d_sbrkproto'
16347 d_sched_yield='$d_sched_yield'
16348 d_scm_rights='$d_scm_rights'
16349 d_seekdir='$d_seekdir'
16350 d_select='$d_select'
16351 d_sem='$d_sem'
16352 d_semctl='$d_semctl'
16353 d_semctl_semid_ds='$d_semctl_semid_ds'
16354 d_semctl_semun='$d_semctl_semun'
16355 d_semget='$d_semget'
16356 d_semop='$d_semop'
16357 d_sendmsg='$d_sendmsg'
16358 d_setegid='$d_setegid'
16359 d_seteuid='$d_seteuid'
16360 d_setgrent='$d_setgrent'
16361 d_setgrps='$d_setgrps'
16362 d_sethent='$d_sethent'
16363 d_setitimer='$d_setitimer'
16364 d_setlinebuf='$d_setlinebuf'
16365 d_setlocale='$d_setlocale'
16366 d_setnent='$d_setnent'
16367 d_setpent='$d_setpent'
16368 d_setpgid='$d_setpgid'
16369 d_setpgrp2='$d_setpgrp2'
16370 d_setpgrp='$d_setpgrp'
16371 d_setprior='$d_setprior'
16372 d_setproctitle='$d_setproctitle'
16373 d_setpwent='$d_setpwent'
16374 d_setregid='$d_setregid'
16375 d_setresgid='$d_setresgid'
16376 d_setresuid='$d_setresuid'
16377 d_setreuid='$d_setreuid'
16378 d_setrgid='$d_setrgid'
16379 d_setruid='$d_setruid'
16380 d_setsent='$d_setsent'
16381 d_setsid='$d_setsid'
16382 d_setvbuf='$d_setvbuf'
16383 d_sfio='$d_sfio'
16384 d_shm='$d_shm'
16385 d_shmat='$d_shmat'
16386 d_shmatprototype='$d_shmatprototype'
16387 d_shmctl='$d_shmctl'
16388 d_shmdt='$d_shmdt'
16389 d_shmget='$d_shmget'
16390 d_sigaction='$d_sigaction'
16391 d_sigprocmask='$d_sigprocmask'
16392 d_sigsetjmp='$d_sigsetjmp'
16393 d_sockatmark='$d_sockatmark'
16394 d_socket='$d_socket'
16395 d_socklen_t='$d_socklen_t'
16396 d_sockpair='$d_sockpair'
16397 d_socks5_init='$d_socks5_init'
16398 d_sqrtl='$d_sqrtl'
16399 d_statblks='$d_statblks'
16400 d_statfs_f_flags='$d_statfs_f_flags'
16401 d_statfs_s='$d_statfs_s'
16402 d_statvfs='$d_statvfs'
16403 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16404 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16405 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16406 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16407 d_stdio_stream_array='$d_stdio_stream_array'
16408 d_stdiobase='$d_stdiobase'
16409 d_stdstdio='$d_stdstdio'
16410 d_strchr='$d_strchr'
16411 d_strcoll='$d_strcoll'
16412 d_strctcpy='$d_strctcpy'
16413 d_strerrm='$d_strerrm'
16414 d_strerror='$d_strerror'
16415 d_strftime='$d_strftime'
16416 d_strtod='$d_strtod'
16417 d_strtol='$d_strtol'
16418 d_strtold='$d_strtold'
16419 d_strtoll='$d_strtoll'
16420 d_strtoq='$d_strtoq'
16421 d_strtoul='$d_strtoul'
16422 d_strtoull='$d_strtoull'
16423 d_strtouq='$d_strtouq'
16424 d_strxfrm='$d_strxfrm'
16425 d_suidsafe='$d_suidsafe'
16426 d_symlink='$d_symlink'
16427 d_syscall='$d_syscall'
16428 d_sysconf='$d_sysconf'
16429 d_sysernlst='$d_sysernlst'
16430 d_syserrlst='$d_syserrlst'
16431 d_system='$d_system'
16432 d_tcgetpgrp='$d_tcgetpgrp'
16433 d_tcsetpgrp='$d_tcsetpgrp'
16434 d_telldir='$d_telldir'
16435 d_telldirproto='$d_telldirproto'
16436 d_time='$d_time'
16437 d_times='$d_times'
16438 d_truncate='$d_truncate'
16439 d_tzname='$d_tzname'
16440 d_u32align='$d_u32align'
16441 d_ualarm='$d_ualarm'
16442 d_umask='$d_umask'
16443 d_uname='$d_uname'
16444 d_union_semun='$d_union_semun'
16445 d_usleep='$d_usleep'
16446 d_ustat='$d_ustat'
16447 d_vendorarch='$d_vendorarch'
16448 d_vendorbin='$d_vendorbin'
16449 d_vendorlib='$d_vendorlib'
16450 d_vfork='$d_vfork'
16451 d_void_closedir='$d_void_closedir'
16452 d_voidsig='$d_voidsig'
16453 d_voidtty='$d_voidtty'
16454 d_volatile='$d_volatile'
16455 d_vprintf='$d_vprintf'
16456 d_wait4='$d_wait4'
16457 d_waitpid='$d_waitpid'
16458 d_wcstombs='$d_wcstombs'
16459 d_wctomb='$d_wctomb'
16460 d_writev='$d_writev'
16461 d_xenix='$d_xenix'
16462 date='$date'
16463 db_hashtype='$db_hashtype'
16464 db_prefixtype='$db_prefixtype'
16465 defvoidused='$defvoidused'
16466 direntrytype='$direntrytype'
16467 dlext='$dlext'
16468 dlsrc='$dlsrc'
16469 doublesize='$doublesize'
16470 drand01='$drand01'
16471 dynamic_ext='$dynamic_ext'
16472 eagain='$eagain'
16473 ebcdic='$ebcdic'
16474 echo='$echo'
16475 egrep='$egrep'
16476 emacs='$emacs'
16477 eunicefix='$eunicefix'
16478 exe_ext='$exe_ext'
16479 expr='$expr'
16480 extensions='$extensions'
16481 fflushNULL='$fflushNULL'
16482 fflushall='$fflushall'
16483 find='$find'
16484 firstmakefile='$firstmakefile'
16485 flex='$flex'
16486 fpossize='$fpossize'
16487 fpostype='$fpostype'
16488 freetype='$freetype'
16489 full_ar='$full_ar'
16490 full_csh='$full_csh'
16491 full_sed='$full_sed'
16492 gccosandvers='$gccosandvers'
16493 gccversion='$gccversion'
16494 gidformat='$gidformat'
16495 gidsign='$gidsign'
16496 gidsize='$gidsize'
16497 gidtype='$gidtype'
16498 glibpth='$glibpth'
16499 grep='$grep'
16500 groupcat='$groupcat'
16501 groupstype='$groupstype'
16502 gzip='$gzip'
16503 h_fcntl='$h_fcntl'
16504 h_sysfile='$h_sysfile'
16505 hint='$hint'
16506 hostcat='$hostcat'
16507 i16size='$i16size'
16508 i16type='$i16type'
16509 i32size='$i32size'
16510 i32type='$i32type'
16511 i64size='$i64size'
16512 i64type='$i64type'
16513 i8size='$i8size'
16514 i8type='$i8type'
16515 i_arpainet='$i_arpainet'
16516 i_bsdioctl='$i_bsdioctl'
16517 i_db='$i_db'
16518 i_dbm='$i_dbm'
16519 i_dirent='$i_dirent'
16520 i_dld='$i_dld'
16521 i_dlfcn='$i_dlfcn'
16522 i_fcntl='$i_fcntl'
16523 i_float='$i_float'
16524 i_gdbm='$i_gdbm'
16525 i_grp='$i_grp'
16526 i_iconv='$i_iconv'
16527 i_ieeefp='$i_ieeefp'
16528 i_inttypes='$i_inttypes'
16529 i_libutil='$i_libutil'
16530 i_limits='$i_limits'
16531 i_locale='$i_locale'
16532 i_machcthr='$i_machcthr'
16533 i_malloc='$i_malloc'
16534 i_math='$i_math'
16535 i_memory='$i_memory'
16536 i_mntent='$i_mntent'
16537 i_ndbm='$i_ndbm'
16538 i_netdb='$i_netdb'
16539 i_neterrno='$i_neterrno'
16540 i_netinettcp='$i_netinettcp'
16541 i_niin='$i_niin'
16542 i_poll='$i_poll'
16543 i_prot='$i_prot'
16544 i_pthread='$i_pthread'
16545 i_pwd='$i_pwd'
16546 i_rpcsvcdbm='$i_rpcsvcdbm'
16547 i_sfio='$i_sfio'
16548 i_sgtty='$i_sgtty'
16549 i_shadow='$i_shadow'
16550 i_socks='$i_socks'
16551 i_stdarg='$i_stdarg'
16552 i_stddef='$i_stddef'
16553 i_stdlib='$i_stdlib'
16554 i_string='$i_string'
16555 i_sunmath='$i_sunmath'
16556 i_sysaccess='$i_sysaccess'
16557 i_sysdir='$i_sysdir'
16558 i_sysfile='$i_sysfile'
16559 i_sysfilio='$i_sysfilio'
16560 i_sysin='$i_sysin'
16561 i_sysioctl='$i_sysioctl'
16562 i_syslog='$i_syslog'
16563 i_sysmman='$i_sysmman'
16564 i_sysmode='$i_sysmode'
16565 i_sysmount='$i_sysmount'
16566 i_sysndir='$i_sysndir'
16567 i_sysparam='$i_sysparam'
16568 i_sysresrc='$i_sysresrc'
16569 i_syssecrt='$i_syssecrt'
16570 i_sysselct='$i_sysselct'
16571 i_syssockio='$i_syssockio'
16572 i_sysstat='$i_sysstat'
16573 i_sysstatfs='$i_sysstatfs'
16574 i_sysstatvfs='$i_sysstatvfs'
16575 i_systime='$i_systime'
16576 i_systimek='$i_systimek'
16577 i_systimes='$i_systimes'
16578 i_systypes='$i_systypes'
16579 i_sysuio='$i_sysuio'
16580 i_sysun='$i_sysun'
16581 i_sysutsname='$i_sysutsname'
16582 i_sysvfs='$i_sysvfs'
16583 i_syswait='$i_syswait'
16584 i_termio='$i_termio'
16585 i_termios='$i_termios'
16586 i_time='$i_time'
16587 i_unistd='$i_unistd'
16588 i_ustat='$i_ustat'
16589 i_utime='$i_utime'
16590 i_values='$i_values'
16591 i_varargs='$i_varargs'
16592 i_varhdr='$i_varhdr'
16593 i_vfork='$i_vfork'
16594 ignore_versioned_solibs='$ignore_versioned_solibs'
16595 inc_version_list='$inc_version_list'
16596 inc_version_list_init='$inc_version_list_init'
16597 incpath='$incpath'
16598 inews='$inews'
16599 installarchlib='$installarchlib'
16600 installbin='$installbin'
16601 installman1dir='$installman1dir'
16602 installman3dir='$installman3dir'
16603 installprefix='$installprefix'
16604 installprefixexp='$installprefixexp'
16605 installprivlib='$installprivlib'
16606 installscript='$installscript'
16607 installsitearch='$installsitearch'
16608 installsitebin='$installsitebin'
16609 installsitelib='$installsitelib'
16610 installstyle='$installstyle'
16611 installusrbinperl='$installusrbinperl'
16612 installvendorarch='$installvendorarch'
16613 installvendorbin='$installvendorbin'
16614 installvendorlib='$installvendorlib'
16615 intsize='$intsize'
16616 issymlink='$issymlink'
16617 ivdformat='$ivdformat'
16618 ivsize='$ivsize'
16619 ivtype='$ivtype'
16620 known_extensions='$known_extensions'
16621 ksh='$ksh'
16622 ld='$ld'
16623 lddlflags='$lddlflags'
16624 ldflags='$ldflags'
16625 ldflags_uselargefiles='$ldflags_uselargefiles'
16626 ldlibpthname='$ldlibpthname'
16627 less='$less'
16628 lib_ext='$lib_ext'
16629 libc='$libc'
16630 libperl='$libperl'
16631 libpth='$libpth'
16632 libs='$libs'
16633 libsdirs='$libsdirs'
16634 libsfiles='$libsfiles'
16635 libsfound='$libsfound'
16636 libspath='$libspath'
16637 libswanted='$libswanted'
16638 libswanted_uselargefiles='$libswanted_uselargefiles'
16639 line='$line'
16640 lint='$lint'
16641 lkflags='$lkflags'
16642 ln='$ln'
16643 lns='$lns'
16644 locincpth='$locincpth'
16645 loclibpth='$loclibpth'
16646 longdblsize='$longdblsize'
16647 longlongsize='$longlongsize'
16648 longsize='$longsize'
16649 lp='$lp'
16650 lpr='$lpr'
16651 ls='$ls'
16652 lseeksize='$lseeksize'
16653 lseektype='$lseektype'
16654 mail='$mail'
16655 mailx='$mailx'
16656 make='$make'
16657 make_set_make='$make_set_make'
16658 mallocobj='$mallocobj'
16659 mallocsrc='$mallocsrc'
16660 malloctype='$malloctype'
16661 man1dir='$man1dir'
16662 man1direxp='$man1direxp'
16663 man1ext='$man1ext'
16664 man3dir='$man3dir'
16665 man3direxp='$man3direxp'
16666 man3ext='$man3ext'
16667 mips_type='$mips_type'
16668 mkdir='$mkdir'
16669 mmaptype='$mmaptype'
16670 modetype='$modetype'
16671 more='$more'
16672 multiarch='$multiarch'
16673 mv='$mv'
16674 myarchname='$myarchname'
16675 mydomain='$mydomain'
16676 myhostname='$myhostname'
16677 myuname='$myuname'
16678 n='$n'
16679 need_va_copy='$need_va_copy'
16680 netdb_hlen_type='$netdb_hlen_type'
16681 netdb_host_type='$netdb_host_type'
16682 netdb_name_type='$netdb_name_type'
16683 netdb_net_type='$netdb_net_type'
16684 nm='$nm'
16685 nm_opt='$nm_opt'
16686 nm_so_opt='$nm_so_opt'
16687 nonxs_ext='$nonxs_ext'
16688 nroff='$nroff'
16689 nvEUformat='$nvEUformat'
16690 nvFUformat='$nvFUformat'
16691 nvGUformat='$nvGUformat'
16692 nveformat='$nveformat'
16693 nvfformat='$nvfformat'
16694 nvgformat='$nvgformat'
16695 nvsize='$nvsize'
16696 nvtype='$nvtype'
16697 o_nonblock='$o_nonblock'
16698 obj_ext='$obj_ext'
16699 old_pthread_create_joinable='$old_pthread_create_joinable'
16700 optimize='$optimize'
16701 orderlib='$orderlib'
16702 osname='$osname'
16703 osvers='$osvers'
16704 otherlibdirs='$otherlibdirs'
16705 package='$package'
16706 pager='$pager'
16707 passcat='$passcat'
16708 patchlevel='$patchlevel'
16709 path_sep='$path_sep'
16710 perl5='$perl5'
16711 perl='$perl'
16712 perladmin='$perladmin'
16713 perllibs='$perllibs'
16714 perlpath='$perlpath'
16715 pg='$pg'
16716 phostname='$phostname'
16717 pidtype='$pidtype'
16718 plibpth='$plibpth'
16719 pm_apiversion='$pm_apiversion'
16720 pmake='$pmake'
16721 pr='$pr'
16722 prefix='$prefix'
16723 prefixexp='$prefixexp'
16724 privlib='$privlib'
16725 privlibexp='$privlibexp'
16726 prototype='$prototype'
16727 ptrsize='$ptrsize'
16728 quadkind='$quadkind'
16729 quadtype='$quadtype'
16730 randbits='$randbits'
16731 randfunc='$randfunc'
16732 randseedtype='$randseedtype'
16733 ranlib='$ranlib'
16734 rd_nodata='$rd_nodata'
16735 revision='$revision'
16736 rm='$rm'
16737 rmail='$rmail'
16738 runnm='$runnm'
16739 sPRIEUldbl='$sPRIEUldbl'
16740 sPRIFUldbl='$sPRIFUldbl'
16741 sPRIGUldbl='$sPRIGUldbl'
16742 sPRIXU64='$sPRIXU64'
16743 sPRId64='$sPRId64'
16744 sPRIeldbl='$sPRIeldbl'
16745 sPRIfldbl='$sPRIfldbl'
16746 sPRIgldbl='$sPRIgldbl'
16747 sPRIi64='$sPRIi64'
16748 sPRIo64='$sPRIo64'
16749 sPRIu64='$sPRIu64'
16750 sPRIx64='$sPRIx64'
16751 sSCNfldbl='$sSCNfldbl'
16752 sched_yield='$sched_yield'
16753 scriptdir='$scriptdir'
16754 scriptdirexp='$scriptdirexp'
16755 sed='$sed'
16756 seedfunc='$seedfunc'
16757 selectminbits='$selectminbits'
16758 selecttype='$selecttype'
16759 sendmail='$sendmail'
16760 sh='$sh'
16761 shar='$shar'
16762 sharpbang='$sharpbang'
16763 shmattype='$shmattype'
16764 shortsize='$shortsize'
16765 shrpenv='$shrpenv'
16766 shsharp='$shsharp'
16767 sig_count='$sig_count'
16768 sig_name='$sig_name'
16769 sig_name_init='$sig_name_init'
16770 sig_num='$sig_num'
16771 sig_num_init='$sig_num_init'
16772 sig_size='$sig_size'
16773 signal_t='$signal_t'
16774 sitearch='$sitearch'
16775 sitearchexp='$sitearchexp'
16776 sitebin='$sitebin'
16777 sitebinexp='$sitebinexp'
16778 sitelib='$sitelib'
16779 sitelib_stem='$sitelib_stem'
16780 sitelibexp='$sitelibexp'
16781 siteprefix='$siteprefix'
16782 siteprefixexp='$siteprefixexp'
16783 sizesize='$sizesize'
16784 sizetype='$sizetype'
16785 sleep='$sleep'
16786 smail='$smail'
16787 so='$so'
16788 sockethdr='$sockethdr'
16789 socketlib='$socketlib'
16790 socksizetype='$socksizetype'
16791 sort='$sort'
16792 spackage='$spackage'
16793 spitshell='$spitshell'
16794 src='$src'
16795 ssizetype='$ssizetype'
16796 startperl='$startperl'
16797 startsh='$startsh'
16798 static_ext='$static_ext'
16799 stdchar='$stdchar'
16800 stdio_base='$stdio_base'
16801 stdio_bufsiz='$stdio_bufsiz'
16802 stdio_cnt='$stdio_cnt'
16803 stdio_filbuf='$stdio_filbuf'
16804 stdio_ptr='$stdio_ptr'
16805 stdio_stream_array='$stdio_stream_array'
16806 strings='$strings'
16807 submit='$submit'
16808 subversion='$subversion'
16809 sysman='$sysman'
16810 tail='$tail'
16811 tar='$tar'
16812 tbl='$tbl'
16813 tee='$tee'
16814 test='$test'
16815 timeincl='$timeincl'
16816 timetype='$timetype'
16817 touch='$touch'
16818 tr='$tr'
16819 trnl='$trnl'
16820 troff='$troff'
16821 u16size='$u16size'
16822 u16type='$u16type'
16823 u32size='$u32size'
16824 u32type='$u32type'
16825 u64size='$u64size'
16826 u64type='$u64type'
16827 u8size='$u8size'
16828 u8type='$u8type'
16829 uidformat='$uidformat'
16830 uidsign='$uidsign'
16831 uidsize='$uidsize'
16832 uidtype='$uidtype'
16833 uname='$uname'
16834 uniq='$uniq'
16835 uquadtype='$uquadtype'
16836 use5005threads='$use5005threads'
16837 use64bitall='$use64bitall'
16838 use64bitint='$use64bitint'
16839 usedl='$usedl'
16840 useithreads='$useithreads'
16841 uselargefiles='$uselargefiles'
16842 uselongdouble='$uselongdouble'
16843 usemorebits='$usemorebits'
16844 usemultiplicity='$usemultiplicity'
16845 usemymalloc='$usemymalloc'
16846 usenm='$usenm'
16847 useopcode='$useopcode'
16848 useperlio='$useperlio'
16849 useposix='$useposix'
16850 usesfio='$usesfio'
16851 useshrplib='$useshrplib'
16852 usesocks='$usesocks'
16853 usethreads='$usethreads'
16854 usevendorprefix='$usevendorprefix'
16855 usevfork='$usevfork'
16856 usrinc='$usrinc'
16857 uuname='$uuname'
16858 uvXUformat='$uvXUformat'
16859 uvoformat='$uvoformat'
16860 uvsize='$uvsize'
16861 uvtype='$uvtype'
16862 uvuformat='$uvuformat'
16863 uvxformat='$uvxformat'
16864 vendorarch='$vendorarch'
16865 vendorarchexp='$vendorarchexp'
16866 vendorbin='$vendorbin'
16867 vendorbinexp='$vendorbinexp'
16868 vendorlib='$vendorlib'
16869 vendorlib_stem='$vendorlib_stem'
16870 vendorlibexp='$vendorlibexp'
16871 vendorprefix='$vendorprefix'
16872 vendorprefixexp='$vendorprefixexp'
16873 version='$version'
16874 versiononly='$versiononly'
16875 vi='$vi'
16876 voidflags='$voidflags'
16877 xlibpth='$xlibpth'
16878 xs_apiversion='$xs_apiversion'
16879 yacc='$yacc'
16880 yaccflags='$yaccflags'
16881 zcat='$zcat'
16882 zip='$zip'
16883 EOT
16884
16885 : Add in command line options if available
16886 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16887
16888 : add special variables
16889 $test -f $src/patchlevel.h && \
16890 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16891 echo "CONFIGDOTSH=true" >>config.sh
16892
16893 : propagate old symbols
16894 if $test -f UU/config.sh; then
16895         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16896         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16897         $sort | $uniq -u >UU/oldsyms
16898         set X `cat UU/oldsyms`
16899         shift
16900         case $# in
16901         0) ;;
16902         *)
16903                 cat <<EOM
16904 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16905 EOM
16906                 echo "# Variables propagated from previous config.sh file." >>config.sh
16907                 for sym in `cat UU/oldsyms`; do
16908                         echo "    Propagating $hint variable "'$'"$sym..."
16909                         eval 'tmp="$'"${sym}"'"'
16910                         echo "$tmp" | \
16911                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16912                 done
16913                 ;;
16914         esac
16915 fi
16916
16917 : Finish up by extracting the .SH files
16918 case "$alldone" in
16919 exit)
16920         $rm -rf UU
16921         echo "Done."
16922         exit 0
16923         ;;
16924 cont)
16925         ;;
16926 '')
16927         dflt=''
16928         nostick=true
16929         $cat <<EOM
16930
16931 If you'd like to make any changes to the config.sh file before I begin
16932 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16933
16934 EOM
16935         rp="Press return or use a shell escape to edit config.sh:"
16936         . UU/myread
16937         nostick=''
16938         case "$ans" in
16939         '') ;;
16940         *) : in case they cannot read
16941                 sh 1>&4 -c "$ans";;
16942         esac
16943         ;;
16944 esac
16945
16946 : if this fails, just run all the .SH files by hand
16947 . ./config.sh
16948
16949 echo " "
16950 exec 1>&4
16951 . ./UU/extract
16952
16953 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16954         dflt=y
16955         case "$silent" in
16956         true) ;;
16957         *)
16958                 $cat <<EOM
16959
16960 Now you need to generate make dependencies by running "$make depend".
16961 You might prefer to run it in background: "$make depend > makedepend.out &"
16962 It can take a while, so you might not want to run it right now.
16963
16964 EOM
16965                 ;;
16966         esac
16967         rp="Run $make depend now?"
16968         . UU/myread
16969         case "$ans" in
16970         y*)
16971                 $make depend && echo "Now you must run '$make'."
16972                 ;;
16973         *)
16974                 echo "You must run '$make depend' then '$make'."
16975                 ;;
16976         esac
16977 elif test -f [Mm]akefile; then
16978         echo " "
16979         echo "Now you must run a $make."
16980 else
16981         echo "Done."
16982 fi
16983
16984 if $test -f Policy.sh; then
16985     $cat <<EOM
16986
16987 If you compile $package on a different machine or from a different object
16988 directory, copy the Policy.sh file from this object directory to the
16989 new one before you run Configure -- this will help you with most of
16990 the policy defaults.
16991
16992 EOM
16993 fi
16994 if $test -f config.msg; then
16995     echo "Hmm.  I also noted the following information while running:"
16996     echo " "
16997     $cat config.msg >&4
16998     $rm -f config.msg
16999 fi
17000 $rm -f kit*isdone ark*isdone
17001 $rm -rf UU
17002
17003 : End of Configure
17004