1341a6e9d00b7997fc76829104a61b83494dd62f
[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 Mon Feb 28 08:07:01 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/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 >/tmp/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 /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/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 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getpwent=''
396 d_getsent=''
397 d_getservprotos=''
398 d_getspent=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_killpg=''
410 d_lchown=''
411 d_ldbl_dig=''
412 d_link=''
413 d_locconv=''
414 d_lockf=''
415 d_longdbl=''
416 longdblsize=''
417 d_longlong=''
418 longlongsize=''
419 d_lseekproto=''
420 d_lstat=''
421 d_mblen=''
422 d_mbstowcs=''
423 d_mbtowc=''
424 d_memchr=''
425 d_memcmp=''
426 d_memcpy=''
427 d_memmove=''
428 d_memset=''
429 d_mkdir=''
430 d_mkdtemp=''
431 d_mkfifo=''
432 d_mkstemp=''
433 d_mkstemps=''
434 d_mktime=''
435 d_mmap=''
436 mmaptype=''
437 d_mprotect=''
438 d_msg=''
439 d_msgctl=''
440 d_msgget=''
441 d_msgrcv=''
442 d_msgsnd=''
443 d_msync=''
444 d_munmap=''
445 d_nice=''
446 d_off64_t=''
447 d_open3=''
448 d_fpathconf=''
449 d_pathconf=''
450 d_pause=''
451 d_pipe=''
452 d_poll=''
453 d_portable=''
454 d_old_pthread_create_joinable=''
455 old_pthread_create_joinable=''
456 d_pthread_yield=''
457 d_sched_yield=''
458 sched_yield=''
459 d_readdir=''
460 d_rewinddir=''
461 d_seekdir=''
462 d_telldir=''
463 d_readlink=''
464 d_rename=''
465 d_rmdir=''
466 d_safebcpy=''
467 d_safemcpy=''
468 d_sanemcmp=''
469 d_select=''
470 d_sem=''
471 d_semctl=''
472 d_semget=''
473 d_semop=''
474 d_setegid=''
475 d_seteuid=''
476 d_setgrent=''
477 d_setgrps=''
478 d_sethent=''
479 d_setlinebuf=''
480 d_setlocale=''
481 d_setnent=''
482 d_setpent=''
483 d_setpgid=''
484 d_setpgrp2=''
485 d_bsdsetpgrp=''
486 d_setpgrp=''
487 d_setprior=''
488 d_setpwent=''
489 d_setregid=''
490 d_setresgid=''
491 d_setresuid=''
492 d_setreuid=''
493 d_setrgid=''
494 d_setruid=''
495 d_setsent=''
496 d_setsid=''
497 d_setspent=''
498 d_setvbuf=''
499 d_sfio=''
500 usesfio=''
501 d_shm=''
502 d_shmat=''
503 d_shmatprototype=''
504 shmattype=''
505 d_shmctl=''
506 d_shmdt=''
507 d_shmget=''
508 d_sigaction=''
509 d_sigsetjmp=''
510 d_msg_ctrunc=''
511 d_msg_dontroute=''
512 d_msg_oob=''
513 d_msg_peek=''
514 d_msg_proxy=''
515 d_oldsock=''
516 d_scm_rights=''
517 d_socket=''
518 d_sockpair=''
519 sockethdr=''
520 socketlib=''
521 d_socklen_t=''
522 d_sqrtl=''
523 d_statblks=''
524 d_statfs_f_flags=''
525 d_statfs_s=''
526 d_fstatvfs=''
527 d_statvfs=''
528 d_stdio_cnt_lval=''
529 d_stdio_ptr_lval=''
530 d_stdiobase=''
531 d_stdstdio=''
532 stdio_base=''
533 stdio_bufsiz=''
534 stdio_cnt=''
535 stdio_filbuf=''
536 stdio_ptr=''
537 d_index=''
538 d_strchr=''
539 d_strcoll=''
540 d_strctcpy=''
541 d_strerrm=''
542 d_strerror=''
543 d_sysernlst=''
544 d_syserrlst=''
545 d_strtod=''
546 d_strtol=''
547 d_strtold=''
548 d_strtoll=''
549 d_strtoul=''
550 d_strtoull=''
551 d_strtouq=''
552 d_strxfrm=''
553 d_symlink=''
554 d_syscall=''
555 d_sysconf=''
556 d_system=''
557 d_tcgetpgrp=''
558 d_tcsetpgrp=''
559 d_telldirproto=''
560 d_time=''
561 timetype=''
562 clocktype=''
563 d_times=''
564 d_truncate=''
565 d_tzname=''
566 d_umask=''
567 d_semctl_semid_ds=''
568 d_semctl_semun=''
569 d_union_semun=''
570 d_ustat=''
571 d_vfork=''
572 usevfork=''
573 d_voidsig=''
574 signal_t=''
575 d_volatile=''
576 d_charvspr=''
577 d_vprintf=''
578 d_wait4=''
579 d_waitpid=''
580 d_wcstombs=''
581 d_wctomb=''
582 dlext=''
583 cccdlflags=''
584 ccdlflags=''
585 dlsrc=''
586 ld=''
587 lddlflags=''
588 usedl=''
589 doublesize=''
590 ebcdic=''
591 fflushNULL=''
592 fflushall=''
593 fpossize=''
594 fpostype=''
595 gidformat=''
596 gidsign=''
597 gidsize=''
598 gidtype=''
599 groupstype=''
600 h_fcntl=''
601 h_sysfile=''
602 i_arpainet=''
603 db_hashtype=''
604 db_prefixtype=''
605 i_db=''
606 i_dbm=''
607 i_rpcsvcdbm=''
608 d_dirnamlen=''
609 direntrytype=''
610 i_dirent=''
611 i_dld=''
612 i_dlfcn=''
613 i_fcntl=''
614 i_float=''
615 i_gdbm=''
616 d_grpasswd=''
617 i_grp=''
618 i_iconv=''
619 i_inttypes=''
620 i_limits=''
621 i_locale=''
622 i_machcthr=''
623 i_malloc=''
624 i_math=''
625 i_memory=''
626 i_mntent=''
627 i_ndbm=''
628 i_netdb=''
629 i_neterrno=''
630 i_netinettcp=''
631 i_niin=''
632 i_sysin=''
633 i_poll=''
634 i_pthread=''
635 d_pwage=''
636 d_pwchange=''
637 d_pwclass=''
638 d_pwcomment=''
639 d_pwexpire=''
640 d_pwgecos=''
641 d_pwpasswd=''
642 d_pwquota=''
643 i_pwd=''
644 i_sfio=''
645 i_shadow=''
646 i_socks=''
647 i_stddef=''
648 i_stdlib=''
649 i_string=''
650 strings=''
651 i_sysaccess=''
652 i_sysdir=''
653 i_sysfile=''
654 d_voidtty=''
655 i_bsdioctl=''
656 i_sysfilio=''
657 i_sysioctl=''
658 i_syssockio=''
659 i_syslog=''
660 i_sysmman=''
661 i_sysmode=''
662 i_sysmount=''
663 i_sysndir=''
664 i_sysparam=''
665 i_sysresrc=''
666 i_syssecrt=''
667 i_sysselct=''
668 i_sysstat=''
669 i_sysstatfs=''
670 i_sysstatvfs=''
671 i_systimes=''
672 i_systypes=''
673 i_sysuio=''
674 i_sysun=''
675 i_sysutsname=''
676 i_sysvfs=''
677 i_syswait=''
678 i_sgtty=''
679 i_termio=''
680 i_termios=''
681 i_systime=''
682 i_systimek=''
683 i_time=''
684 timeincl=''
685 i_unistd=''
686 i_ustat=''
687 i_utime=''
688 i_values=''
689 i_stdarg=''
690 i_varargs=''
691 i_varhdr=''
692 i_vfork=''
693 inc_version_list=''
694 inc_version_list_init=''
695 installprefix=''
696 installprefixexp=''
697 installstyle=''
698 installusrbinperl=''
699 intsize=''
700 longsize=''
701 shortsize=''
702 libc=''
703 ldlibpthname=''
704 libperl=''
705 shrpenv=''
706 useshrplib=''
707 glibpth=''
708 libpth=''
709 loclibpth=''
710 plibpth=''
711 xlibpth=''
712 ignore_versioned_solibs=''
713 libs=''
714 libsdirs=''
715 libsfiles=''
716 libsfound=''
717 libspath=''
718 lns=''
719 d_PRIEldbl=''
720 d_PRIFldbl=''
721 d_PRIGldbl=''
722 d_PRIeldbl=''
723 d_PRIfldbl=''
724 d_PRIgldbl=''
725 sPRIEldbl=''
726 sPRIFldbl=''
727 sPRIGldbl=''
728 sPRIeldbl=''
729 sPRIfldbl=''
730 sPRIgldbl=''
731 lseeksize=''
732 lseektype=''
733 make_set_make=''
734 d_mymalloc=''
735 freetype=''
736 mallocobj=''
737 mallocsrc=''
738 malloctype=''
739 usemymalloc=''
740 installman1dir=''
741 man1dir=''
742 man1direxp=''
743 man1ext=''
744 installman3dir=''
745 man3dir=''
746 man3direxp=''
747 man3ext=''
748 huge=''
749 large=''
750 medium=''
751 models=''
752 small=''
753 split=''
754 modetype=''
755 multiarch=''
756 mydomain=''
757 myhostname=''
758 phostname=''
759 c=''
760 n=''
761 d_eofnblk=''
762 eagain=''
763 o_nonblock=''
764 rd_nodata=''
765 netdb_hlen_type=''
766 netdb_host_type=''
767 netdb_name_type=''
768 netdb_net_type=''
769 groupcat=''
770 hostcat=''
771 passcat=''
772 orderlib=''
773 ranlib=''
774 package=''
775 spackage=''
776 pager=''
777 api_revision=''
778 api_subversion=''
779 api_version=''
780 api_versionstring=''
781 patchlevel=''
782 revision=''
783 subversion=''
784 version=''
785 perl5=''
786 perladmin=''
787 perlpath=''
788 d_nv_preserves_uv=''
789 i16size=''
790 i16type=''
791 i32size=''
792 i32type=''
793 i64size=''
794 i64type=''
795 i8size=''
796 i8type=''
797 ivsize=''
798 ivtype=''
799 nvsize=''
800 nvtype=''
801 u16size=''
802 u16type=''
803 u32size=''
804 u32type=''
805 u64size=''
806 u64type=''
807 u8size=''
808 u8type=''
809 uvsize=''
810 uvtype=''
811 ivdformat=''
812 uvoformat=''
813 uvuformat=''
814 uvxformat=''
815 pidtype=''
816 prefix=''
817 prefixexp=''
818 installprivlib=''
819 privlib=''
820 privlibexp=''
821 prototype=''
822 ptrsize=''
823 d_PRIX64=''
824 d_PRId64=''
825 d_PRIi64=''
826 d_PRIo64=''
827 d_PRIu64=''
828 d_PRIx64=''
829 sPRIX64=''
830 sPRId64=''
831 sPRIi64=''
832 sPRIo64=''
833 sPRIu64=''
834 sPRIx64=''
835 d_quad=''
836 quadkind=''
837 quadtype=''
838 uquadtype=''
839 drand01=''
840 randbits=''
841 randfunc=''
842 randseedtype=''
843 seedfunc=''
844 installscript=''
845 scriptdir=''
846 scriptdirexp=''
847 selectminbits=''
848 selecttype=''
849 sh=''
850 sig_count=''
851 sig_name=''
852 sig_name_init=''
853 sig_num=''
854 sig_num_init=''
855 installsitearch=''
856 sitearch=''
857 sitearchexp=''
858 installsitebin=''
859 sitebin=''
860 sitebinexp=''
861 installsitelib=''
862 sitelib=''
863 sitelibexp=''
864 siteprefix=''
865 siteprefixexp=''
866 sizetype=''
867 so=''
868 socksizetype=''
869 sharpbang=''
870 shsharp=''
871 spitshell=''
872 src=''
873 ssizetype=''
874 startperl=''
875 startsh=''
876 stdchar=''
877 d_stdio_stream_array=''
878 stdio_stream_array=''
879 sysman=''
880 trnl=''
881 uidformat=''
882 uidsign=''
883 uidsize=''
884 uidtype=''
885 archname64=''
886 use64bitall=''
887 use64bitint=''
888 uselargefiles=''
889 uselongdouble=''
890 usemorebits=''
891 usemultiplicity=''
892 nm_opt=''
893 nm_so_opt=''
894 runnm=''
895 usenm=''
896 useperlio=''
897 usesocks=''
898 d_oldpthreads=''
899 use5005threads=''
900 useithreads=''
901 usethreads=''
902 incpath=''
903 mips_type=''
904 usrinc=''
905 d_vendorbin=''
906 installvendorbin=''
907 vendorbin=''
908 vendorbinexp=''
909 d_vendorlib=''
910 installvendorlib=''
911 vendorlib=''
912 vendorlibexp=''
913 usevendorprefix=''
914 vendorprefix=''
915 vendorprefixexp=''
916 defvoidused=''
917 voidflags=''
918 pm_apiversion=''
919 xs_apiversion=''
920 CONFIG=''
921
922 define='define'
923 undef='undef'
924 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
925 rmlist=''
926
927 : We must find out about Eunice early
928 eunicefix=':'
929 if test -f /etc/unixtovms; then
930         eunicefix=/etc/unixtovms
931 fi
932 if test -f /etc/unixtovms.exe; then
933         eunicefix=/etc/unixtovms.exe
934 fi
935
936 i_whoami=''
937 : set useposix=false in your hint file to disable the POSIX extension.
938 useposix=true
939 : set useopcode=false in your hint file to disable the Opcode extension.
940 useopcode=true
941 : Trailing extension.  Override this in a hint file, if needed.
942 _exe=''
943 : Extra object files, if any, needed on this platform.
944 archobjs=''
945 : Possible local include directories to search.
946 : Set locincpth to "" in a hint file to defeat local include searches.
947 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
948 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
949 :
950 : no include file wanted by default
951 inclwanted=''
952
953 groupstype=''
954 : change the next line if compiling for Xenix/286 on Xenix/386
955 xlibpth='/usr/lib/386 /lib/386'
956 : Possible local library directories to search.
957 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
958 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
959
960 : general looking path for locating libraries
961 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
962 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
963 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
964 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
965 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
966
967 : Private path used by Configure to find libraries.  Its value
968 : is prepended to libpth. This variable takes care of special
969 : machines, like the mips.  Usually, it should be empty.
970 plibpth=''
971
972 : default library list
973 libswanted=''
974 : some systems want to use only the non-versioned libso:s
975 ignore_versioned_solibs=''
976 : set usemultiplicity on the Configure command line to enable multiplicity.
977 : set usesocks on the Configure command line to enable socks.
978 : set usethreads on the Configure command line to enable threads.
979 : full support for void wanted by default
980 defvoidused=15
981
982 : List of libraries we want.
983 : If anyone needs -lnet, put it in a hint file.
984 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
985 libswanted="$libswanted dld ld sun m c cposix posix"
986 libswanted="$libswanted ndir dir crypt sec"
987 libswanted="$libswanted ucb bsd BSD PW x"
988 : We probably want to search /usr/shlib before most other libraries.
989 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
990 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
991 glibpth="/usr/shlib $glibpth"
992 : Do not use vfork unless overridden by a hint file.
993 usevfork=false
994
995 : Find the basic shell for Bourne shell scripts
996 case "$sh" in
997 '')
998         case "$SYSTYPE" in
999         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1000         *) xxx='/bin/sh';;
1001         esac
1002         if test -f "$xxx"; then
1003                 sh="$xxx"
1004         else
1005                 : Build up a list and do a single loop so we can 'break' out.
1006                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1007                 for xxx in sh bash ksh pdksh ash; do
1008                         for p in $pth; do
1009                                 try="$try ${p}/${xxx}"
1010                         done
1011                 done
1012                 for xxx in $try; do
1013                         if test -f "$xxx"; then
1014                                 sh="$xxx";
1015                                 break
1016                         elif test -f "$xxx.exe"; then
1017                                 sh="$xxx";
1018                                 break
1019                         fi
1020                 done
1021         fi
1022         ;;
1023 esac
1024
1025 case "$sh" in
1026 '')     cat <<EOM >&2
1027 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1028
1029 Usually it's in /bin/sh.  How did you even get this far?
1030 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1031 we'll try to straighten this all out.
1032 EOM
1033         exit 1
1034         ;;
1035 esac
1036
1037 : see if sh knows # comments
1038 if `$sh -c '#' >/dev/null 2>&1`; then
1039         shsharp=true
1040         spitshell=cat
1041         xcat=/bin/cat
1042         test -f $xcat || xcat=/usr/bin/cat
1043         echo "#!$xcat" >try
1044         $eunicefix try
1045         chmod +x try
1046         ./try > today
1047         if test -s today; then
1048                 sharpbang='#!'
1049         else
1050                 echo "#! $xcat" > try
1051                 $eunicefix try
1052                 chmod +x try
1053                 ./try > today
1054                 if test -s today; then
1055                         sharpbang='#! '
1056                 else
1057                         sharpbang=': use '
1058                 fi
1059         fi
1060 else
1061         echo " "
1062         echo "Your $sh doesn't grok # comments--I will strip them later on."
1063         shsharp=false
1064         cd ..
1065         echo "exec grep -v '^[  ]*#'" >spitshell
1066         chmod +x spitshell
1067         $eunicefix spitshell
1068         spitshell=`pwd`/spitshell
1069         cd UU
1070         echo "I presume that if # doesn't work, #! won't work either!"
1071         sharpbang=': use '
1072 fi
1073 rm -f try today
1074
1075 : figure out how to guarantee sh startup
1076 case "$startsh" in
1077 '') startsh=${sharpbang}${sh} ;;
1078 *)
1079 esac
1080 cat >try <<EOSS
1081 $startsh
1082 set abc
1083 test "$?abc" != 1
1084 EOSS
1085
1086 chmod +x try
1087 $eunicefix try
1088 if ./try; then
1089         : echo "Yup, it does."
1090 else
1091         echo "Hmm... '$startsh' does not guarantee sh startup..."
1092         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1093 fi
1094 rm -f try
1095
1096
1097 : Save command line options in file UU/cmdline.opt for later use in
1098 : generating config.sh.
1099 cat > cmdline.opt <<EOSH
1100 # Configure command line arguments.
1101 config_arg0='$0'
1102 config_args='$*'
1103 config_argc=$#
1104 EOSH
1105 argn=1
1106 for arg in "$@"; do
1107         cat >>cmdline.opt <<EOSH
1108 config_arg$argn='$arg'
1109 EOSH
1110         argn=`expr $argn + 1`
1111 done
1112
1113 : produce awk script to parse command line options
1114 cat >options.awk <<'EOF'
1115 BEGIN {
1116         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1117
1118         len = length(optstr);
1119         for (i = 1; i <= len; i++) {
1120                 c = substr(optstr, i, 1);
1121                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1122                 if (a == ":") {
1123                         arg[c] = 1;
1124                         i++;
1125                 }
1126                 opt[c] = 1;
1127         }
1128 }
1129 {
1130         expect = 0;
1131         str = $0;
1132         if (substr(str, 1, 1) != "-") {
1133                 printf("'%s'\n", str);
1134                 next;
1135         }
1136         len = length($0);
1137         for (i = 2; i <= len; i++) {
1138                 c = substr(str, i, 1);
1139                 if (!opt[c]) {
1140                         printf("-%s\n", substr(str, i));
1141                         next;
1142                 }
1143                 printf("-%s\n", c);
1144                 if (arg[c]) {
1145                         if (i < len)
1146                                 printf("'%s'\n", substr(str, i + 1));
1147                         else
1148                                 expect = 1;
1149                         next;
1150                 }
1151         }
1152 }
1153 END {
1154         if (expect)
1155                 print "?";
1156 }
1157 EOF
1158
1159 : process the command line options
1160 set X `for arg in "$@"; do echo "X$arg"; done |
1161         sed -e s/X// | awk -f options.awk`
1162 eval "set $*"
1163 shift
1164 rm -f options.awk
1165
1166 : set up default values
1167 fastread=''
1168 reuseval=false
1169 config_sh=''
1170 alldone=''
1171 error=''
1172 silent=''
1173 extractsh=''
1174 override=''
1175 knowitall=''
1176 rm -f optdef.sh posthint.sh
1177 cat >optdef.sh <<EOS
1178 $startsh
1179 EOS
1180
1181
1182 : option parsing
1183 while test $# -gt 0; do
1184         case "$1" in
1185         -d) shift; fastread=yes;;
1186         -e) shift; alldone=cont;;
1187         -f)
1188                 shift
1189                 cd ..
1190                 if test -r "$1"; then
1191                         config_sh="$1"
1192                 else
1193                         echo "$me: cannot read config file $1." >&2
1194                         error=true
1195                 fi
1196                 cd UU
1197                 shift;;
1198         -h) shift; error=true;;
1199         -r) shift; reuseval=true;;
1200         -s) shift; silent=true; realsilent=true;;
1201         -E) shift; alldone=exit;;
1202         -K) shift; knowitall=true;;
1203         -O) shift; override=true;;
1204         -S) shift; silent=true; extractsh=true;;
1205         -D)
1206                 shift
1207                 case "$1" in
1208                 *=)
1209                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1210                         echo "$me: ignoring -D $1" >&2
1211                         ;;
1212                 *=*) echo "$1" | \
1213                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1214                 *) echo "$1='define'" >> optdef.sh;;
1215                 esac
1216                 shift
1217                 ;;
1218         -U)
1219                 shift
1220                 case "$1" in
1221                 *=) echo "$1" >> optdef.sh;;
1222                 *=*)
1223                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1224                         echo "$me: ignoring -U $1" >&2
1225                         ;;
1226                 *) echo "$1='undef'" >> optdef.sh;;
1227                 esac
1228                 shift
1229                 ;;
1230         -A)
1231             shift
1232             xxx=''
1233             yyy="$1"
1234             zzz=''
1235             uuu=undef
1236             case "$yyy" in
1237             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1238                  case "$zzz" in
1239                  *:*) zzz='' ;;
1240                  *)   xxx=append
1241                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1242                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1243                  esac
1244                  ;;
1245             esac
1246             case "$xxx" in
1247             '')  case "$yyy" in
1248                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1249                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1250                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1251                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1252                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1253                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1254                  esac
1255                  ;;       
1256             esac
1257             case "$xxx" in
1258             append)
1259                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1260             clear)
1261                 echo "$yyy=''"                  >> posthint.sh ;;
1262             define)
1263                 case "$zzz" in
1264                 '') zzz=define ;;
1265                 esac
1266                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1267             eval)
1268                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1269             prepend)
1270                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1271             undef)
1272                 case "$zzz" in
1273                 '') zzz="$uuu" ;;
1274                 esac
1275                 echo "$yyy=$zzz"                >> posthint.sh ;;
1276             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1277             esac
1278             shift
1279             ;;
1280         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1281             exit 0;;
1282         --) break;;
1283         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1284         *) break;;
1285         esac
1286 done
1287
1288 case "$error" in
1289 true)
1290         cat >&2 <<EOM
1291 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1292                  [-U symbol] [-U symbol=] [-A command:symbol...]
1293   -d : use defaults for all answers.
1294   -e : go on without questioning past the production of config.sh.
1295   -f : specify an alternate default configuration file.
1296   -h : print this help message and exit (with an error status).
1297   -r : reuse C symbols value if possible (skips costly nm extraction).
1298   -s : silent mode, only echoes questions and essential information.
1299   -D : define symbol to have some value:
1300          -D symbol         symbol gets the value 'define'
1301          -D symbol=value   symbol gets the value 'value'
1302   -E : stop at the end of questions, after having produced config.sh.
1303   -K : do not use unless you know what you are doing.
1304   -O : let -D and -U override definitions from loaded configuration file.
1305   -S : perform variable substitutions on all .SH files (can mix with -f)
1306   -U : undefine symbol:
1307          -U symbol    symbol gets the value 'undef'
1308          -U symbol=   symbol gets completely empty
1309   -A : manipulate symbol after the platform specific hints have been applied:
1310          -A symbol=value                append " "value to symbol
1311          -A append:symbol=value         append value to symbol
1312          -A define:symbol=value         define symbol to have value
1313          -A clear:symbol                define symbol to be ''
1314          -A define:symbol               define symbol to be 'define'
1315          -A eval:symbol=value           define symbol to be eval of value
1316          -A prepend:symbol=value        prepend value to symbol
1317          -A undef:symbol                define symbol to be 'undef'
1318          -A undef:symbol=               define symbol to be ''
1319   -V : print version number and exit (with a zero status).
1320 EOM
1321         exit 1
1322         ;;
1323 esac
1324
1325 : Sanity checks
1326 case "$fastread$alldone" in
1327 yescont|yesexit) ;;
1328 *)
1329         if test ! -t 0; then
1330                 echo "Say 'sh Configure', not 'sh <Configure'"
1331                 exit 1
1332         fi
1333         ;;
1334 esac
1335
1336 exec 4>&1
1337 case "$silent" in
1338 true) exec 1>/dev/null;;
1339 esac
1340
1341 : run the defines and the undefines, if any, but leave the file out there...
1342 touch optdef.sh
1343 . ./optdef.sh
1344 : create the posthint manipulation script and leave the file out there...
1345 touch posthint.sh
1346
1347 : set package name
1348 package=perl5
1349 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1350 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1351 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1352 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1353 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1354 esac
1355
1356 : Some greps do not return status, grrr.
1357 echo "grimblepritz" >grimble
1358 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1359         contains=contains
1360 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1361         contains=grep
1362 else
1363         contains=contains
1364 fi
1365 rm -f grimble
1366 : the following should work in any shell
1367 case "$contains" in
1368 contains*)
1369         echo " "
1370         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1371         cat >contains <<'EOSS'
1372 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1373 EOSS
1374 chmod +x contains
1375 esac
1376
1377 : Find the path to the source tree
1378 case "$src" in
1379 '') case "$0" in
1380     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1381          case "$src" in
1382          /*)    ;;
1383          *)     src=`cd ../$src && pwd` ;;
1384          esac
1385          ;;
1386     *)   src='.';;
1387     esac;;
1388 esac
1389 case "$src" in
1390 '')     src=/
1391         rsrc=/
1392         ;;
1393 /*) rsrc="$src";;
1394 *) rsrc="../$src";;
1395 esac
1396 if test -f $rsrc/Configure && \
1397         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1398 then
1399    : found it, so we are ok.
1400 else
1401         rsrc=''
1402         for src in . .. ../.. ../../.. ../../../..; do
1403                 if test -f ../$src/Configure && \
1404                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1405                 then
1406                         rsrc=../$src
1407                         break
1408                 fi
1409         done
1410 fi
1411 case "$rsrc" in
1412 '')
1413         cat <<EOM >&4
1414
1415 Sorry, I can't seem to locate the source dir for $package.  Please start
1416 Configure with an explicit path -- i.e. /some/path/Configure.
1417
1418 EOM
1419         exit 1
1420         ;;
1421 ../.)   rsrc='..';;
1422 *)
1423         echo " "
1424         echo "Sources for $package found in \"$src\"." >&4
1425         ;;
1426 esac
1427
1428 : script used to extract .SH files with variable substitutions
1429 cat >extract <<'EOS'
1430 CONFIGDOTSH=true
1431 echo "Doing variable substitutions on .SH files..."
1432 if test -f $src/MANIFEST; then
1433         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1434 else
1435         echo "(Looking for .SH files under the source directory.)"
1436         set x `(cd $src; find . -name "*.SH" -print)`
1437 fi
1438 shift
1439 case $# in
1440 0) set x `(cd $src; echo *.SH)`; shift;;
1441 esac
1442 if test ! -f $src/$1; then
1443         shift
1444 fi
1445 mkdir_p='
1446 name=$1;
1447 create="";
1448 while test $name; do
1449         if test ! -d "$name"; then
1450                 create="$name $create";
1451                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1452                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1453         else
1454                 name="";
1455         fi;
1456 done;
1457 for file in $create; do
1458         mkdir $file;
1459 done
1460 '
1461 for file in $*; do
1462         case "$src" in
1463         ".")
1464                 case "$file" in
1465                 */*)
1466                         dir=`expr X$file : 'X\(.*\)/'`
1467                         file=`expr X$file : 'X.*/\(.*\)'`
1468                         (cd $dir && . ./$file)
1469                         ;;
1470                 *)
1471                         . ./$file
1472                         ;;
1473                 esac
1474                 ;;
1475         *)
1476                 case "$file" in
1477                 */*)
1478                         dir=`expr X$file : 'X\(.*\)/'`
1479                         file=`expr X$file : 'X.*/\(.*\)'`
1480                         (set x $dir; shift; eval $mkdir_p)
1481                         sh <$src/$dir/$file
1482                         ;;
1483                 *)
1484                         sh <$src/$file
1485                         ;;
1486                 esac
1487                 ;;
1488         esac
1489 done
1490 if test -f $src/config_h.SH; then
1491         if test ! -f config.h; then
1492         : oops, they left it out of MANIFEST, probably, so do it anyway.
1493         . $src/config_h.SH
1494         fi
1495 fi
1496 EOS
1497
1498 : extract files and exit if asked to do so
1499 case "$extractsh" in
1500 true)
1501         case "$realsilent" in
1502         true) ;;
1503         *) exec 1>&4;;
1504         esac
1505         case "$config_sh" in
1506         '') config_sh='config.sh';;
1507         esac
1508         echo " "
1509         echo "Fetching answers from $config_sh..."
1510         cd ..
1511         . $config_sh
1512         test "$override" && . ./optdef.sh
1513         echo " "
1514         . UU/extract
1515         rm -rf UU
1516         echo "Done."
1517         exit 0
1518         ;;
1519 esac
1520
1521 : Eunice requires " " instead of "", can you believe it
1522 echo " "
1523 : Here we go...
1524 echo "Beginning of configuration questions for $package."
1525
1526 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1527
1528 : first determine how to suppress newline on echo command
1529 echo " "
1530 echo "Checking echo to see how to suppress newlines..."
1531 (echo "hi there\c" ; echo " ") >.echotmp
1532 if $contains c .echotmp >/dev/null 2>&1 ; then
1533         echo "...using -n."
1534         n='-n'
1535         c=''
1536 else
1537         cat <<'EOM'
1538 ...using \c
1539 EOM
1540         n=''
1541         c='\c'
1542 fi
1543 echo $n "The star should be here-->$c"
1544 echo '*'
1545 rm -f .echotmp
1546
1547 : Now test for existence of everything in MANIFEST
1548 echo " "
1549 if test -f $rsrc/MANIFEST; then
1550         echo "First let's make sure your kit is complete.  Checking..." >&4
1551         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1552         rm -f missing
1553         tmppwd=`pwd`
1554         for filelist in x??; do
1555                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1556         done
1557         if test -s missing; then
1558                 cat missing >&4
1559                 cat >&4 <<'EOM'
1560
1561 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1562
1563 You have the option of continuing the configuration process, despite the
1564 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1565 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1566 and contact the author (perlbug@perl.com).
1567
1568 EOM
1569                 echo $n "Continue? [n] $c" >&4
1570                 read ans
1571                 case "$ans" in
1572                 y*)
1573                         echo "Continuing..." >&4
1574                         rm -f missing
1575                         ;;
1576                 *)
1577                         echo "ABORTING..." >&4
1578                         kill $$
1579                         ;;
1580                 esac
1581         else
1582                 echo "Looks good..."
1583         fi
1584 else
1585         echo "There is no MANIFEST file.  I hope your kit is complete !"
1586 fi
1587 rm -f missing x??
1588
1589 echo " "
1590 : Find the appropriate value for a newline for tr
1591 if test -n "$DJGPP"; then
1592        trnl='\012'
1593 fi
1594 if test X"$trnl" = X; then
1595         case "`echo foo|tr '\n' x 2>/dev/null`" in
1596         foox) trnl='\n' ;;
1597         esac
1598 fi
1599 if test X"$trnl" = X; then
1600         case "`echo foo|tr '\012' x 2>/dev/null`" in
1601         foox) trnl='\012' ;;
1602         esac
1603 fi
1604 if test X"$trnl" = X; then
1605         cat <<EOM >&2
1606
1607 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1608
1609 EOM
1610         exit 1
1611 fi
1612
1613 : compute the number of columns on the terminal for proper question formatting
1614 case "$COLUMNS" in
1615 '') COLUMNS='80';;
1616 esac
1617
1618 : set up the echo used in my read
1619 myecho="case \"\$xxxm\" in
1620 '') echo $n \"\$rp $c\" >&4;;
1621 *) case \"\$rp\" in
1622         '') echo $n \"[\$xxxm] $c\";;
1623         *)
1624                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1625                         echo \"\$rp\" >&4
1626                         echo $n \"[\$xxxm] $c\" >&4
1627                 else
1628                         echo $n \"\$rp [\$xxxm] $c\" >&4
1629                 fi
1630                 ;;
1631         esac;;
1632 esac"
1633
1634 : now set up to do reads with possible shell escape and default assignment
1635 cat <<EOSC >myread
1636 $startsh
1637 xxxm=\$dflt
1638 $myecho
1639 ans='!'
1640 case "\$fastread" in
1641 yes) case "\$dflt" in
1642         '') ;;
1643         *) ans='';
1644                 case "\$silent-\$rp" in
1645                 true-) ;;
1646                 *) echo " " >&4;;
1647                 esac;;
1648         esac;;
1649 *) case "\$silent" in
1650         true) case "\$rp" in
1651                 '') ans='';;
1652                 esac;;
1653         esac;;
1654 esac
1655 while expr "X\$ans" : "X!" >/dev/null; do
1656         read answ
1657         set x \$xxxm
1658         shift
1659         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1660         case  "\$answ" in
1661         "!")
1662                 sh 1>&4
1663                 echo " "
1664                 $myecho
1665                 ;;
1666         !*)
1667                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1668                 shift
1669                 sh 1>&4 -c "\$*"
1670                 echo " "
1671                 $myecho
1672                 ;;
1673         "\$ans")
1674                 case "\$ans" in
1675                 \\&*)
1676                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1677                         shift
1678                         case "\$1" in
1679                         -d)
1680                                 fastread=yes
1681                                 echo "(OK, I'll run with -d after this question.)" >&4
1682                                 ;;
1683                         -*)
1684                                 echo "*** Sorry, \$1 not supported yet." >&4
1685                                 ;;
1686                         esac
1687                         $myecho
1688                         ans=!
1689                         ;;
1690                 esac;;
1691         *)
1692                 case "\$aok" in
1693                 y)
1694                         echo "*** Substitution done -- please confirm."
1695                         xxxm="\$ans"
1696                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1697                         xxxm="\$ans"
1698                         ans=!
1699                         ;;
1700                 *)
1701                         echo "*** Error -- try again."
1702                         ans=!
1703                         ;;
1704                 esac
1705                 $myecho
1706                 ;;
1707         esac
1708         case "\$ans\$xxxm\$nostick" in
1709         '')
1710                 ans=!
1711                 $myecho
1712                 ;;
1713         esac
1714 done
1715 case "\$ans" in
1716 '') ans="\$xxxm";;
1717 esac
1718 EOSC
1719
1720 : create .config dir to save info across Configure sessions
1721 test -d ../.config || mkdir ../.config
1722 cat >../.config/README <<EOF
1723 This directory created by Configure to save information that should
1724 persist across sessions for $package.
1725
1726 You may safely delete it if you wish.
1727 EOF
1728
1729 : general instructions
1730 needman=true
1731 firsttime=true
1732 user=`(logname) 2>/dev/null`
1733 case "$user" in
1734 '') user=`whoami 2>&1`;;
1735 esac
1736 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1737         firsttime=false
1738         echo " "
1739         rp='Would you like to see the instructions?'
1740         dflt=n
1741         . ./myread
1742         case "$ans" in
1743         [yY]*) ;;
1744         *) needman=false;;
1745         esac
1746 fi
1747 if $needman; then
1748         cat <<EOH
1749
1750 This installation shell script will examine your system and ask you questions
1751 to determine how the perl5 package should be installed. If you get
1752 stuck on a question, you may use a ! shell escape to start a subshell or
1753 execute a command.  Many of the questions will have default answers in square
1754 brackets; typing carriage return will give you the default.
1755
1756 On some of the questions which ask for file or directory names you are allowed
1757 to use the ~name construct to specify the login directory belonging to "name",
1758 even if you don't have a shell which knows about that.  Questions where this is
1759 allowed will be marked "(~name ok)".
1760
1761 EOH
1762         rp=''
1763         dflt='Type carriage return to continue'
1764         . ./myread
1765         cat <<'EOH'
1766
1767 The prompter used in this script allows you to use shell variables and
1768 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1769 in the default answer, as if the default line was a set of arguments given to a
1770 script shell.  This means you may also use $* to repeat the whole default line,
1771 so you do not have to re-type everything to add something to the default.
1772
1773 Everytime there is a substitution, you will have to confirm.  If there is an
1774 error (e.g. an unmatched backtick), the default answer will remain unchanged
1775 and you will be prompted again.
1776
1777 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1778 the questions and use the computed defaults (or the previous answers if there
1779 was already a config.sh file). Type 'Configure -h' for a list of options.
1780 You may also start interactively and then answer '& -d' at any prompt to turn
1781 on the non-interactive behaviour for the remainder of the execution.
1782
1783 EOH
1784         . ./myread
1785         cat <<EOH
1786
1787 Much effort has been expended to ensure that this shell script will run on any
1788 Unix system.  If despite that it blows up on yours, your best bet is to edit
1789 Configure and run it again.  If you can't run Configure for some reason,
1790 you'll have to generate a config.sh file by hand.  Whatever problems you
1791 have, let me (perlbug@perl.com) know how I blew it.
1792
1793 This installation script affects things in two ways:
1794
1795 1) it may do direct variable substitutions on some of the files included
1796    in this kit.
1797 2) it builds a config.h file for inclusion in C programs.  You may edit
1798    any of these files as the need arises after running this script.
1799
1800 If you make a mistake on a question, there is no easy way to back up to it
1801 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1802 files.  Configure will offer to let you do this before it runs the SH files.
1803
1804 EOH
1805         dflt='Type carriage return to continue'
1806         . ./myread
1807         case "$firsttime" in
1808         true) echo $user >>../.config/instruct;;
1809         esac
1810 fi
1811
1812 : find out where common programs are
1813 echo " "
1814 echo "Locating common programs..." >&4
1815 cat <<EOSC >loc
1816 $startsh
1817 case \$# in
1818 0) exit 1;;
1819 esac
1820 thing=\$1
1821 shift
1822 dflt=\$1
1823 shift
1824 for dir in \$*; do
1825         case "\$thing" in
1826         .)
1827         if test -d \$dir/\$thing; then
1828                 echo \$dir
1829                 exit 0
1830         fi
1831         ;;
1832         *)
1833         for thisthing in \$dir/\$thing; do
1834                 : just loop through to pick last item
1835         done
1836         if test -f \$thisthing; then
1837                 echo \$thisthing
1838                 exit 0
1839         elif test -f \$dir/\$thing.exe; then
1840                 if test -n "$DJGPP"; then
1841                         echo \$dir/\$thing.exe
1842                 else
1843                         : on Eunice apparently
1844                         echo \$dir/\$thing
1845                 fi
1846                 exit 0
1847         fi
1848         ;;
1849         esac
1850 done
1851 echo \$dflt
1852 exit 1
1853 EOSC
1854 chmod +x loc
1855 $eunicefix loc
1856 loclist="
1857 awk
1858 cat
1859 comm
1860 cp
1861 echo
1862 expr
1863 grep
1864 ls
1865 make
1866 mkdir
1867 rm
1868 sed
1869 sort
1870 touch
1871 tr
1872 uniq
1873 "
1874 trylist="
1875 Mcc
1876 ar
1877 byacc
1878 cpp
1879 csh
1880 date
1881 egrep
1882 gzip
1883 less
1884 ln
1885 more
1886 nm
1887 nroff
1888 pg
1889 test
1890 uname
1891 zip
1892 "
1893 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1894 pth="$pth /lib /usr/lib"
1895 for file in $loclist; do
1896         eval xxx=\$$file
1897         case "$xxx" in
1898         /*|?:[\\/]*)
1899                 if test -f "$xxx"; then
1900                         : ok
1901                 else
1902                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1903                         xxx=`./loc $file $file $pth`
1904                 fi
1905                 ;;
1906         '') xxx=`./loc $file $file $pth`;;
1907         *) xxx=`./loc $xxx $xxx $pth`;;
1908         esac
1909         eval $file=$xxx
1910         eval _$file=$xxx
1911         case "$xxx" in
1912         /*)
1913                 echo $file is in $xxx.
1914                 ;;
1915         ?:[\\/]*)
1916                 echo $file is in $xxx.
1917                 ;;
1918         *)
1919                 echo "I don't know where '$file' is, and my life depends on it." >&4
1920                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1921                 exit 1
1922                 ;;
1923         esac
1924 done
1925 echo " "
1926 echo "Don't worry if any of the following aren't found..."
1927 say=offhand
1928 for file in $trylist; do
1929         eval xxx=\$$file
1930         case "$xxx" in
1931         /*|?:[\\/]*)
1932                 if test -f "$xxx"; then
1933                         : ok
1934                 else
1935                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1936                         xxx=`./loc $file $file $pth`
1937                 fi
1938                 ;;
1939         '') xxx=`./loc $file $file $pth`;;
1940         *) xxx=`./loc $xxx $xxx $pth`;;
1941         esac
1942         eval $file=$xxx
1943         eval _$file=$xxx
1944         case "$xxx" in
1945         /*)
1946                 echo $file is in $xxx.
1947                 ;;
1948         ?:[\\/]*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         *)
1952                 echo "I don't see $file out there, $say."
1953                 say=either
1954                 ;;
1955         esac
1956 done
1957 case "$egrep" in
1958 egrep)
1959         echo "Substituting grep for egrep."
1960         egrep=$grep
1961         ;;
1962 esac
1963 case "$ln" in
1964 ln)
1965         echo "Substituting cp for ln."
1966         ln=$cp
1967         ;;
1968 esac
1969 case "$test" in
1970 test)
1971         echo "Hopefully test is built into your sh."
1972         ;;
1973 *)
1974         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1975                 echo "Using the test built into your sh."
1976                 test=test
1977                 _test=test
1978         fi
1979         ;;
1980 esac
1981 case "$echo" in
1982 echo)
1983         echo "Hopefully echo is built into your sh."
1984         ;;
1985 '') ;;
1986 *)
1987         echo " "
1988 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1989         $echo $n "hi there$c" >foo1
1990         echo $n "hi there$c" >foo2
1991         if cmp foo1 foo2 >/dev/null 2>&1; then
1992                 echo "They are compatible.  In fact, they may be identical."
1993         else
1994                 case "$n" in
1995                 '-n') n='' c='\c';;
1996                 *) n='-n' c='';;
1997                 esac
1998                 cat <<FOO
1999 They are not compatible!  You are probably running ksh on a non-USG system.
2000 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2001 have echo built in and we may have to run some Bourne shell scripts.  That
2002 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2003
2004 FOO
2005                 $echo $n "The star should be here-->$c"
2006                 $echo "*"
2007         fi
2008         $rm -f foo1 foo2
2009         ;;
2010 esac
2011
2012 : determine whether symbolic links are supported
2013 echo " "
2014 $touch blurfl
2015 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2016         echo "Symbolic links are supported." >&4
2017         lns="$ln -s"
2018 else
2019         echo "Symbolic links are NOT supported." >&4
2020         lns="$ln"
2021 fi
2022 $rm -f blurfl sym
2023
2024 : see whether [:lower:] and [:upper:] are supported character classes
2025 echo " "
2026 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2027 ABYZ)
2028         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2029         up='[:upper:]'
2030         low='[:lower:]'
2031         ;;
2032 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2033         # (0xc9 and 0xd1), therefore that is a nice testing point.
2034         if test "X$up" = X -o "X$low" = X; then
2035             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2036             ij) up='[A-Z]'
2037                 low='[a-z]'
2038                 ;;
2039             esac
2040         fi
2041         if test "X$up" = X -o "X$low" = X; then
2042             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2043             ij) up='A-Z'
2044                 low='a-z'
2045                 ;;
2046             esac
2047         fi
2048         if test "X$up" = X -o "X$low" = X; then
2049             case "`echo IJ | od -x 2>/dev/null`" in
2050             *C9D1*|*c9d1*)
2051                 echo "Hey, this might be EBCDIC." >&4
2052                 if test "X$up" = X -o "X$low" = X; then
2053                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2054                     ij) up='[A-IJ-RS-Z]'
2055                         low='[a-ij-rs-z]'
2056                         ;;
2057                     esac
2058                 fi
2059                 if test "X$up" = X -o "X$low" = X; then
2060                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2061                     ij) up='A-IJ-RS-Z'
2062                         low='a-ij-rs-z'
2063                         ;;
2064                     esac
2065                 fi
2066                 ;;
2067             esac
2068         fi
2069 esac
2070 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2071 ij)
2072     echo "Using $up and $low to convert case." >&4
2073     ;;
2074 *)
2075     echo "I don't know how to translate letters from upper to lower case." >&4
2076     echo "Your tr is not acting any way I know of." >&4
2077     exit 1
2078     ;;
2079 esac
2080 : set up the translation script tr, must be called with ./tr of course
2081 cat >tr <<EOSC
2082 $startsh
2083 case "\$1\$2" in
2084 '[A-Z][a-z]') exec $tr '$up' '$low';;
2085 '[a-z][A-Z]') exec $tr '$low' '$up';;
2086 esac
2087 exec $tr "\$@"
2088 EOSC
2089 chmod +x tr
2090 $eunicefix tr
2091
2092 : Try to determine whether config.sh was made on this system
2093 case "$config_sh" in
2094 '')
2095 myuname=`$uname -a 2>/dev/null`
2096 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2097 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2098 # because the A-Z/a-z are not consecutive.
2099 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2100         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2101 newmyuname="$myuname"
2102 dflt=n
2103 case "$knowitall" in
2104 '')
2105         if test -f ../config.sh; then
2106                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2107                         eval "`grep myuname= ../config.sh`"
2108                 fi
2109                 if test "X$myuname" = "X$newmyuname"; then
2110                         dflt=y
2111                 fi
2112         fi
2113         ;;
2114 *) dflt=y;;
2115 esac
2116
2117 : Get old answers from old config file if Configure was run on the
2118 : same system, otherwise use the hints.
2119 hint=default
2120 cd ..
2121 if test -f config.sh; then
2122         echo " "
2123         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2124         . UU/myread
2125         case "$ans" in
2126         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2127         *)  echo "Fetching default answers from your old config.sh file..." >&4
2128                 tmp_n="$n"
2129                 tmp_c="$c"
2130                 tmp_sh="$sh"
2131                 . ./config.sh
2132                 cp config.sh UU
2133                 n="$tmp_n"
2134                 c="$tmp_c"
2135                 : Older versions did not always set $sh.  Catch re-use of such
2136                 : an old config.sh.
2137                 case "$sh" in
2138                 '') sh="$tmp_sh" ;;
2139                 esac
2140                 hint=previous
2141                 ;;
2142         esac
2143 fi
2144 if test ! -f config.sh; then
2145         $cat <<EOM
2146
2147 First time through, eh?  I have some defaults handy for some systems
2148 that need some extra help getting the Configure answers right:
2149
2150 EOM
2151         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2152         dflt=''
2153         : Half the following guesses are probably wrong... If you have better
2154         : tests or hints, please send them to perlbug@perl.com
2155         : The metaconfig authors would also appreciate a copy...
2156         $test -f /irix && osname=irix
2157         $test -f /xenix && osname=sco_xenix
2158         $test -f /dynix && osname=dynix
2159         $test -f /dnix && osname=dnix
2160         $test -f /lynx.os && osname=lynxos
2161         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2162         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2163         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2164         $test -f /bin/mips && /bin/mips && osname=mips
2165         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2166                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2167         $test -d /usr/apollo/bin && osname=apollo
2168         $test -f /etc/saf/_sactab && osname=svr4
2169         $test -d /usr/include/minix && osname=minix
2170         if $test -d /MachTen -o -d /MachTen_Folder; then
2171                 osname=machten
2172                 if $test -x /sbin/version; then
2173                         osvers=`/sbin/version | $awk '{print $2}' |
2174                         $sed -e 's/[A-Za-z]$//'`
2175                 elif $test -x /usr/etc/version; then
2176                         osvers=`/usr/etc/version | $awk '{print $2}' |
2177                         $sed -e 's/[A-Za-z]$//'`
2178                 else
2179                         osvers="$2.$3"
2180                 fi
2181         fi
2182
2183         $test -f /sys/posix.dll &&
2184                 $test -f /usr/bin/what &&
2185                 set X `/usr/bin/what /sys/posix.dll` &&
2186                 $test "$3" = UWIN &&
2187                 osname=uwin &&
2188                 osvers="$5"
2189
2190         if $test -f $uname; then
2191                 set X $myuname
2192                 shift
2193
2194                 case "$5" in
2195                 fps*) osname=fps ;;
2196                 mips*)
2197                         case "$4" in
2198                         umips) osname=umips ;;
2199                         *) osname=mips ;;
2200                         esac;;
2201                 [23]100) osname=mips ;;
2202                 next*) osname=next ;;
2203                 i386*)
2204                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2205                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2206                                 osname='sco'
2207                                 osvers=$tmp
2208                         elif $test -f /etc/kconfig; then
2209                                 osname=isc
2210                                 if test "$lns" = "$ln -s"; then
2211                                         osvers=4
2212                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2213                                         osvers=3
2214                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2215                                         osvers=2
2216                                 fi
2217                         fi
2218                         tmp=''
2219                         ;;
2220                 pc*)
2221                         if test -n "$DJGPP"; then
2222                                 osname=dos
2223                                 osvers=djgpp
2224                         fi
2225                         ;;
2226                 esac
2227
2228                 case "$1" in
2229                 aix) osname=aix
2230                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2231                         case "$tmp" in
2232                         'not found') osvers="$4"."$3" ;;
2233                         '<3240'|'<>3240') osvers=3.2.0 ;;
2234                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2235                         '=3250'|'>3250') osvers=3.2.5 ;;
2236                         *) osvers=$tmp;;
2237                         esac
2238                         ;;
2239                 bsd386) osname=bsd386
2240                         osvers=`$uname -r`
2241                         ;;
2242                 cygwin*) osname=cygwin
2243                         osvers="$3"
2244                         ;;
2245                 *dc.osx) osname=dcosx
2246                         osvers="$3"
2247                         ;;
2248                 dnix) osname=dnix
2249                         osvers="$3"
2250                         ;;
2251                 domainos) osname=apollo
2252                         osvers="$3"
2253                         ;;
2254                 dgux) osname=dgux 
2255                         osvers="$3"
2256                         ;;
2257                 dynixptx*) osname=dynixptx
2258                         osvers=`echo "$4"|sed 's/^v//'`
2259                         ;;
2260                 freebsd) osname=freebsd 
2261                         osvers="$3" ;;
2262                 genix) osname=genix ;;
2263                 hp*) osname=hpux 
2264                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2265                         ;;
2266                 irix*) osname=irix
2267                         case "$3" in
2268                         4*) osvers=4 ;;
2269                         5*) osvers=5 ;;
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 linux) osname=linux
2274                         case "$3" in
2275                         *)      osvers="$3" ;;
2276                         esac
2277                         ;;
2278                 MiNT) osname=mint
2279                         ;;
2280                 netbsd*) osname=netbsd
2281                         osvers="$3"
2282                         ;;
2283                 news-os) osvers="$3"
2284                         case "$3" in
2285                         4*) osname=newsos4 ;;
2286                         *) osname=newsos ;;
2287                         esac
2288                         ;;
2289                 next*) osname=next ;;
2290                 POSIX-BC | posix-bc ) osname=posix-bc
2291                         osvers="$3"
2292                         ;;
2293                 powerux | power_ux | powermax_os | powermaxos | \
2294                 powerunix | power_unix) osname=powerux
2295                         osvers="$3"
2296                         ;;
2297                 qnx) osname=qnx
2298                         osvers="$4"
2299                         ;;
2300                 solaris) osname=solaris
2301                         case "$3" in
2302                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2303                         *)      osvers="$3" ;;
2304                         esac
2305                         ;;
2306                 sunos) osname=sunos
2307                         case "$3" in
2308                         5*) osname=solaris
2309                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2310                         *)      osvers="$3" ;;
2311                         esac
2312                         ;;
2313                 titanos) osname=titanos
2314                         case "$3" in
2315                         1*) osvers=1 ;;
2316                         2*) osvers=2 ;;
2317                         3*) osvers=3 ;;
2318                         4*) osvers=4 ;;
2319                         *)      osvers="$3" ;;
2320                         esac
2321                         ;;
2322                 ultrix) osname=ultrix
2323                         osvers="$3"
2324                         ;;
2325                 osf1|mls+)      case "$5" in
2326                                 alpha)
2327                                         osname=dec_osf
2328                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2329                                         ;;
2330                         hp*)    osname=hp_osf1  ;;
2331                         mips)   osname=mips_osf1 ;;
2332                         esac
2333                         ;;
2334                 unixware) osname=svr5
2335                         osvers="$4"
2336                         ;;
2337                 uts) osname=uts
2338                         osvers="$3"
2339                         ;;
2340                 $2) case "$osname" in
2341                         *isc*) ;;
2342                         *freebsd*) ;;
2343                         svr*)
2344                                 : svr4.x or possibly later
2345                                 case "svr$3" in 
2346                                 ${osname}*)
2347                                         osname=svr$3
2348                                         osvers=$4
2349                                         ;;
2350                                 esac
2351                                 case "$osname" in
2352                                 svr4.0)
2353                                         : Check for ESIX
2354                                         if test -f /stand/boot ; then
2355                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2356                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2357                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2358                                                         if test -n "$isesix"; then
2359                                                                 osname=esix4
2360                                                         fi
2361                                                 fi
2362                                         fi
2363                                         ;;
2364                                 esac
2365                                 ;;
2366                         *)      if test -f /etc/systemid; then
2367                                         osname=sco
2368                                         set `echo $3 | $sed 's/\./ /g'` $4
2369                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2370                                                 osvers=$1.$2.$3
2371                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2372                                                 osvers=$1.$2
2373                                         elif $test -f $src/hints/sco_$1.sh; then
2374                                                 osvers=$1
2375                                         fi
2376                                 else
2377                                         case "$osname" in
2378                                         '') : Still unknown.  Probably a generic Sys V.
2379                                                 osname="sysv"
2380                                                 osvers="$3"
2381                                                 ;;
2382                                         esac
2383                                 fi
2384                                 ;;
2385                         esac
2386                         ;;
2387                 *)      case "$osname" in
2388                         '') : Still unknown.  Probably a generic BSD.
2389                                 osname="$1"
2390                                 osvers="$3"
2391                                 ;;
2392                         esac
2393                         ;;
2394                 esac
2395         else
2396                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2397                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2398                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2399                                 osname=news_os
2400                         fi
2401                         $rm -f UU/kernel.what
2402                 elif test -d c:/.; then
2403                         set X $myuname
2404                         osname=os2
2405                         osvers="$5"
2406                 fi
2407         fi
2408         
2409         : Now look for a hint file osname_osvers, unless one has been
2410         : specified already.
2411         case "$hintfile" in
2412         ''|' ')
2413                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2414                 : Also try without trailing minor version numbers.
2415                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2416                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2417                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2418                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2419                 case "$file" in
2420                 '') dflt=none ;;
2421                 *)  case "$osvers" in
2422                         '') dflt=$file
2423                                 ;;
2424                         *)  if $test -f $src/hints/$file.sh ; then
2425                                         dflt=$file
2426                                 elif $test -f $src/hints/$xfile.sh ; then
2427                                         dflt=$xfile
2428                                 elif $test -f $src/hints/$xxfile.sh ; then
2429                                         dflt=$xxfile
2430                                 elif $test -f $src/hints/$xxxfile.sh ; then
2431                                         dflt=$xxxfile
2432                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2433                                         dflt=$xxxxfile
2434                                 elif $test -f "$src/hints/${osname}.sh" ; then
2435                                         dflt="${osname}"
2436                                 else
2437                                         dflt=none
2438                                 fi
2439                                 ;;
2440                         esac
2441                         ;;
2442                 esac
2443                 if $test -f Policy.sh ; then
2444                         case "$dflt" in
2445                         *Policy*) ;;
2446                         none) dflt="Policy" ;;
2447                         *) dflt="Policy $dflt" ;;
2448                         esac
2449                 fi
2450                 ;;
2451         *)
2452                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2453                 ;;
2454         esac
2455
2456         if $test -f Policy.sh ; then
2457                 $cat <<EOM
2458
2459 There's also a Policy hint file available, which should make the
2460 site-specific (policy) questions easier to answer.
2461 EOM
2462
2463         fi
2464
2465         $cat <<EOM
2466
2467 You may give one or more space-separated answers, or "none" if appropriate.
2468 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2469 is a good thing.  DO NOT give a wrong version or a wrong OS.
2470
2471 EOM
2472
2473         rp="Which of these apply, if any?"
2474         . UU/myread
2475         tans=$ans
2476         for file in $tans; do
2477                 if $test X$file = XPolicy -a -f Policy.sh; then
2478                         . Policy.sh
2479                         $cat Policy.sh >> UU/config.sh
2480                 elif $test -f $src/hints/$file.sh; then
2481                         . $src/hints/$file.sh
2482                         $cat $src/hints/$file.sh >> UU/config.sh
2483                 elif $test X$tans = X -o X$tans = Xnone ; then
2484                         : nothing
2485                 else
2486                         : Give one chance to correct a possible typo.
2487                         echo "$file.sh does not exist"
2488                         dflt=$file
2489                         rp="hint to use instead?"
2490                         . UU/myread
2491                         for file in $ans; do
2492                                 if $test -f "$src/hints/$file.sh"; then
2493                                         . $src/hints/$file.sh
2494                                         $cat $src/hints/$file.sh >> UU/config.sh
2495                                 elif $test X$ans = X -o X$ans = Xnone ; then
2496                                         : nothing
2497                                 else
2498                                         echo "$file.sh does not exist -- ignored."
2499                                 fi
2500                         done
2501                 fi
2502         done
2503
2504         hint=recommended
2505         : Remember our hint file for later.
2506         if $test -f "$src/hints/$file.sh" ; then
2507                 hintfile="$file"
2508         else
2509                 hintfile=''
2510         fi
2511 fi
2512 cd UU
2513 ;;
2514 *)
2515         echo " "
2516         echo "Fetching default answers from $config_sh..." >&4
2517         tmp_n="$n"
2518         tmp_c="$c"
2519         cd ..
2520         cp $config_sh config.sh 2>/dev/null
2521         chmod +w config.sh
2522         . ./config.sh
2523         cd UU
2524         cp ../config.sh .
2525         n="$tmp_n"
2526         c="$tmp_c"
2527         hint=previous
2528         ;;
2529 esac
2530 test "$override" && . ./optdef.sh
2531 myuname="$newmyuname"
2532
2533 : Restore computed paths
2534 for file in $loclist $trylist; do
2535         eval $file="\$_$file"
2536 done
2537
2538 cat << EOM
2539
2540 Configure uses the operating system name and version to set some defaults.
2541 The default value is probably right if the name rings a bell. Otherwise,
2542 since spelling matters for me, either accept the default or answer "none"
2543 to leave it blank.
2544
2545 EOM
2546 case "$osname" in
2547         ''|' ')
2548                 case "$hintfile" in
2549                 ''|' '|none) dflt=none ;;
2550                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2551                 esac
2552                 ;;
2553         *) dflt="$osname" ;;
2554 esac
2555 rp="Operating system name?"
2556 . ./myread
2557 case "$ans" in
2558 none)  osname='' ;;
2559 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2560 esac
2561 echo " "
2562 case "$osvers" in
2563         ''|' ')
2564                 case "$hintfile" in
2565                 ''|' '|none) dflt=none ;;
2566                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2567                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2568                         case "$dflt" in
2569                         ''|' ') dflt=none ;;
2570                         esac
2571                         ;;
2572                 esac
2573                 ;;
2574         *) dflt="$osvers" ;;
2575 esac
2576 rp="Operating system version?"
2577 . ./myread
2578 case "$ans" in
2579 none)  osvers='' ;;
2580 *) osvers="$ans" ;;
2581 esac
2582
2583
2584 . ./posthint.sh
2585
2586 : who configured the system
2587 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2588 cf_by=`(logname) 2>/dev/null`
2589 case "$cf_by" in
2590 "")
2591         cf_by=`(whoami) 2>/dev/null`
2592         case "$cf_by" in
2593         "") cf_by=unknown ;;
2594         esac ;;
2595 esac
2596
2597 : set up the script used to warn in case of inconsistency
2598 cat <<EOS >whoa
2599 $startsh
2600 EOS
2601 cat <<'EOSC' >>whoa
2602 dflt=y
2603 echo " "
2604 echo "*** WHOA THERE!!! ***" >&4
2605 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2606 rp="    Keep the $hint value?"
2607 . ./myread
2608 case "$ans" in
2609 y) td=$was; tu=$was;;
2610 esac
2611 EOSC
2612
2613 : function used to set $1 to $val
2614 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2615 case "$val$was" in
2616 $define$undef) . ./whoa; eval "$var=\$td";;
2617 $undef$define) . ./whoa; eval "$var=\$tu";;
2618 *) eval "$var=$val";;
2619 esac'
2620
2621 case "$usethreads" in
2622 $define|true|[yY]*)     dflt='y';;
2623 *) dflt='n';;
2624 esac
2625 cat <<EOM
2626
2627 Perl can be built to take advantage of threads on some systems.
2628 To do so, Configure can be run with -Dusethreads.
2629
2630 Note that threading is a highly experimental feature, and
2631 some known race conditions still remain.  If you choose to try
2632 it, be very sure to not actually deploy it for production
2633 purposes.  README.threads has more details, and is required
2634 reading if you enable threads.
2635
2636 If this doesn't make any sense to you, just accept the default '$dflt'.
2637 EOM
2638 rp='Build a threading Perl?'
2639 . ./myread
2640 case "$ans" in
2641 y|Y)    val="$define" ;;
2642 *)      val="$undef" ;;
2643 esac
2644 set usethreads
2645 eval $setvar
2646
2647 case "$usethreads" in
2648 $define)
2649         $cat <<EOM
2650
2651 As of 5.5.640, Perl has two different internal threading implementations,
2652 the 5.005 version (5005threads) and an interpreter-based version
2653 (ithreads) that has one interpreter per thread.  Both are very 
2654 experimental.  This arrangement exists to help developers work out
2655 which one is better.
2656
2657 If you're a casual user, you probably don't want interpreter-threads
2658 at this time.  There doesn't yet exist a way to create threads from
2659 within Perl in this model, i.e., "use Thread;" will NOT work.
2660 EOM
2661         : Default to ithreads unless overridden on command line or with
2662         : old config.sh
2663         dflt='y'
2664         case "$use5005threads" in
2665                 $define|true|[yY]*) dflt='n';;
2666         esac
2667         case "$useithreads" in
2668                 $undef|false|[nN]*) dflt='n';;
2669         esac
2670         rp='Use interpreter-based ithreads?'
2671         . ./myread
2672         case "$ans" in
2673         y|Y)    val="$define" ;;
2674         *)      val="$undef" ;;
2675         esac
2676         set useithreads
2677         eval $setvar
2678         : Now set use5005threads to the opposite value.
2679         case "$useithreads" in
2680         $define) val="$undef" ;;
2681         *) val="$define" ;;
2682         esac
2683         set use5005threads
2684         eval $setvar
2685         ;;
2686 *)
2687         useithreads="$undef"
2688         use5005threads="$undef"
2689         ;;
2690 esac
2691
2692 case "$d_oldpthreads" in
2693 '')     : Configure tests would be welcome here.  For now, assume undef.
2694         val="$undef" ;;
2695 *)      val="$d_oldpthreads" ;;
2696 esac
2697 set d_oldpthreads
2698 eval $setvar
2699
2700
2701 case "$usethreads" in
2702 "$define"|true|[yY]*)
2703 : Look for a hint-file generated 'call-back-unit'.  If the
2704 : user has specified that a threading perl is to be built,
2705 : we may need to set or change some other defaults.
2706         if $test -f usethreads.cbu; then
2707                 echo "Your platform has some specific hints for threaded builds, using them..."
2708                 . ./usethreads.cbu
2709         else
2710                 $cat <<EOM
2711 (Your platform doesn't have any specific hints for threaded builds.
2712  Assuming POSIX threads, then.)
2713 EOM
2714         fi
2715         ;;
2716 esac
2717
2718 cat <<EOM
2719
2720 Perl can be built so that multiple Perl interpreters can coexist
2721 within the same Perl executable.
2722 EOM
2723
2724 case "$useithreads" in
2725 $define)
2726         cat <<EOM
2727 This multiple interpreter support is required for interpreter-based threads.
2728 EOM
2729         val="$define"
2730         ;;
2731 *)      case "$usemultiplicity" in
2732         $define|true|[yY]*)     dflt='y';;
2733         *) dflt='n';;
2734         esac
2735         echo " "
2736         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2737         rp='Build Perl for multiplicity?'
2738         . ./myread
2739         case "$ans" in
2740         y|Y)    val="$define" ;;
2741         *)      val="$undef" ;;
2742         esac
2743         ;;
2744 esac
2745 set usemultiplicity
2746 eval $setvar
2747
2748 : determine where manual pages are on this system
2749 echo " "
2750 case "$sysman" in
2751 '') 
2752         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2753         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2754         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2755         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2756         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2757         sysman=`./loc . /usr/man/man1 $syspath`
2758         ;;
2759 esac
2760 if $test -d "$sysman"; then
2761         echo "System manual is in $sysman." >&4
2762 else
2763         echo "Could not find manual pages in source form." >&4
2764 fi
2765
2766 : see what memory models we can support
2767 case "$models" in
2768 '')
2769         $cat >pdp11.c <<'EOP'
2770 int main() {
2771 #ifdef pdp11
2772         exit(0);
2773 #else
2774         exit(1);
2775 #endif
2776 }
2777 EOP
2778         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2779         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2780                 dflt='unsplit split'
2781         else
2782                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2783                 case "$tans" in
2784                 X) dflt='none';;
2785                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2786                                 dflt='small'
2787                         else
2788                                 dflt=''
2789                         fi
2790                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2791                                 dflt="$dflt medium"
2792                         fi
2793                         if $test -d /lib/large || $test -d /usr/lib/large; then
2794                                 dflt="$dflt large"
2795                         fi
2796                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2797                                 dflt="$dflt huge"
2798                         fi
2799                 esac
2800         fi;;
2801 *) dflt="$models";;
2802 esac
2803 $cat <<EOM
2804  
2805 Some systems have different model sizes.  On most systems they are called
2806 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2807 split.  If your system doesn't support different memory models, say "none".
2808 If you wish to force everything to one memory model, say "none" here and
2809 put the appropriate flags later when it asks you for other cc and ld flags.
2810 Venix systems may wish to put "none" and let the compiler figure things out.
2811 (In the following question multiple model names should be space separated.)
2812
2813 The default for most systems is "none".
2814
2815 EOM
2816 rp="Which memory models are supported?"
2817 . ./myread
2818 models="$ans"
2819
2820 case "$models" in
2821 none)
2822         small=''
2823         medium=''
2824         large=''
2825         huge=''
2826         unsplit=''
2827         split=''
2828         ;;
2829 *split)
2830         case "$split" in
2831         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2832                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2833                         dflt='-i'
2834                 else
2835                         dflt='none'
2836                 fi;;
2837         *) dflt="$split";;
2838         esac
2839         rp="What flag indicates separate I and D space?"
2840         . ./myread
2841         tans="$ans"
2842         case "$tans" in
2843         none) tans='';;
2844         esac
2845         split="$tans"
2846         unsplit='';;
2847 *large*|*small*|*medium*|*huge*)
2848         case "$models" in
2849         *large*)
2850                 case "$large" in
2851                 '') dflt='-Ml';;
2852                 *) dflt="$large";;
2853                 esac
2854         rp="What flag indicates large model?"
2855         . ./myread
2856         tans="$ans"
2857         case "$tans" in
2858         none) tans='';
2859         esac
2860         large="$tans";;
2861         *) large='';;
2862         esac
2863         case "$models" in
2864         *huge*) case "$huge" in
2865                 '') dflt='-Mh';;
2866                 *) dflt="$huge";;
2867                 esac
2868                 rp="What flag indicates huge model?"
2869                 . ./myread
2870                 tans="$ans"
2871                 case "$tans" in
2872                 none) tans='';
2873                 esac
2874                 huge="$tans";;
2875         *) huge="$large";;
2876         esac
2877         case "$models" in
2878         *medium*) case "$medium" in
2879                 '') dflt='-Mm';;
2880                 *) dflt="$medium";;
2881                 esac
2882                 rp="What flag indicates medium model?"
2883                 . ./myread
2884                 tans="$ans"
2885                 case "$tans" in
2886                 none) tans='';
2887                 esac
2888                 medium="$tans";;
2889         *) medium="$large";;
2890         esac
2891         case "$models" in
2892         *small*) case "$small" in
2893                 '') dflt='none';;
2894                 *) dflt="$small";;
2895                 esac
2896                 rp="What flag indicates small model?"
2897                 . ./myread
2898                 tans="$ans"
2899                 case "$tans" in
2900                 none) tans='';
2901                 esac
2902                 small="$tans";;
2903         *) small='';;
2904         esac
2905         ;;
2906 *)
2907         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2908         ;;
2909 esac
2910 $rm -f pdp11.* pdp11
2911
2912 : make some quick guesses about what we are up against
2913 echo " "
2914 $echo $n "Hmm...  $c"
2915 echo exit 1 >bsd
2916 echo exit 1 >usg
2917 echo exit 1 >v7
2918 echo exit 1 >osf1
2919 echo exit 1 >eunice
2920 echo exit 1 >xenix
2921 echo exit 1 >venix
2922 echo exit 1 >os2
2923 d_bsd="$undef"
2924 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2925 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2926 then
2927         echo "Looks kind of like an OSF/1 system, but we'll see..."
2928         echo exit 0 >osf1
2929 elif test `echo abc | tr a-z A-Z` = Abc ; then
2930         xxx=`./loc addbib blurfl $pth`
2931         if $test -f $xxx; then
2932         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2933                 echo exit 0 >bsd
2934                 echo exit 0 >usg
2935         else
2936                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2937                         echo "Looks kind of like an extended USG system, but we'll see..."
2938                 else
2939                         echo "Looks kind of like a USG system, but we'll see..."
2940                 fi
2941                 echo exit 0 >usg
2942         fi
2943 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2944         echo "Looks kind of like a BSD system, but we'll see..."
2945         d_bsd="$define"
2946         echo exit 0 >bsd
2947 else
2948         echo "Looks kind of like a Version 7 system, but we'll see..."
2949         echo exit 0 >v7
2950 fi
2951 case "$eunicefix" in
2952 *unixtovms*)
2953         $cat <<'EOI'
2954 There is, however, a strange, musty smell in the air that reminds me of
2955 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2956 EOI
2957         echo exit 0 >eunice
2958         d_eunice="$define"
2959 : it so happens the Eunice I know will not run shell scripts in Unix format
2960         ;;
2961 *)
2962         echo " "
2963         echo "Congratulations.  You aren't running Eunice."
2964         d_eunice="$undef"
2965         ;;
2966 esac
2967 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2968 case "$p_" in
2969 :) ;;
2970 *)
2971         $cat <<'EOI'
2972 I have the feeling something is not exactly right, however...don't tell me...
2973 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2974 EOI
2975         echo exit 0 >os2
2976         ;;
2977 esac
2978 if test -f /xenix; then
2979         echo "Actually, this looks more like a XENIX system..."
2980         echo exit 0 >xenix
2981         d_xenix="$define"
2982 else
2983         echo " "
2984         echo "It's not Xenix..."
2985         d_xenix="$undef"
2986 fi
2987 chmod +x xenix
2988 $eunicefix xenix
2989 if test -f /venix; then
2990         echo "Actually, this looks more like a VENIX system..."
2991         echo exit 0 >venix
2992 else
2993         echo " "
2994         if ./xenix; then
2995                 : null
2996         else
2997                 echo "Nor is it Venix..."
2998         fi
2999 fi
3000 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3001 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3002 $rm -f foo
3003
3004 : see if we need a special compiler
3005 echo " "
3006 if ./usg; then
3007         case "$cc" in
3008         '') case "$Mcc" in
3009                 /*) dflt='Mcc';;
3010                 *) case "$large" in
3011                         -M*) dflt='cc';;
3012                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3013                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3014                                                 dflt='cc'
3015                                         else
3016                                                 dflt='cc -M'
3017                                         fi
3018                                 else
3019                                         dflt='cc'
3020                                 fi;;
3021                         esac;;
3022                 esac;;
3023         *)  dflt="$cc";;
3024         esac
3025         case "$dflt" in
3026         *M*)    $cat <<'EOM'
3027 On some older systems the default C compiler will not resolve multiple global
3028 references that happen to have the same name.  On some such systems the "Mcc"
3029 command may be used to force these to be resolved.  On other systems a "cc -M"
3030 command is required.  (Note that the -M flag on other systems indicates a
3031 memory model to use!) If you have the Gnu C compiler, you might wish to use
3032 that instead.
3033
3034 EOM
3035         ;;
3036         esac
3037         rp="Use which C compiler?"
3038         . ./myread
3039         cc="$ans"
3040 else
3041         case "$cc" in
3042         '') dflt=cc;;
3043         *) dflt="$cc";;
3044         esac
3045         rp="Use which C compiler?"
3046         . ./myread
3047         cc="$ans"
3048 fi
3049 : Look for a hint-file generated 'call-back-unit'.  Now that the
3050 : user has specified the compiler, we may need to set or change some
3051 : other defaults.
3052 if $test -f cc.cbu; then
3053     . ./cc.cbu
3054 fi
3055 echo " "
3056 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3057 $cat >gccvers.c <<EOM
3058 #include <stdio.h>
3059 int main() {
3060 #ifdef __GNUC__
3061 #ifdef __VERSION__
3062         printf("%s\n", __VERSION__);
3063 #else
3064         printf("%s\n", "1");
3065 #endif
3066 #endif
3067         exit(0);
3068 }
3069 EOM
3070 if $cc $ldflags -o gccvers gccvers.c; then
3071         gccversion=`./gccvers`
3072         case "$gccversion" in
3073         '') echo "You are not using GNU cc." ;;
3074         *)  echo "You are using GNU cc $gccversion."
3075             ;;
3076         esac
3077 else
3078         echo " "
3079         echo "*** WHOA THERE!!! ***" >&4
3080         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3081         case "$knowitall" in
3082         '')
3083         echo "    You'd better start hunting for one and let me know about it." >&4
3084                 exit 1
3085                 ;;
3086         esac
3087 fi
3088 $rm -f gccvers*
3089 case "$gccversion" in
3090 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3091 esac
3092
3093 : decide how portable to be.  Allow command line overrides.
3094 case "$d_portable" in
3095 "$undef") ;;
3096 *)      d_portable="$define" ;;
3097 esac
3098
3099 : set up shell script to do ~ expansion
3100 cat >filexp <<EOSS
3101 $startsh
3102 : expand filename
3103 case "\$1" in
3104  ~/*|~)
3105         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3106         ;;
3107  ~*)
3108         if $test -f /bin/csh; then
3109                 /bin/csh -f -c "glob \$1"
3110                 failed=\$?
3111                 echo ""
3112                 exit \$failed
3113         else
3114                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3115                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3116                 if $test ! -d "\$dir"; then
3117                         me=\`basename \$0\`
3118                         echo "\$me: can't locate home directory for: \$name" >&2
3119                         exit 1
3120                 fi
3121                 case "\$1" in
3122                 */*)
3123                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3124                         ;;
3125                 *)
3126                         echo \$dir
3127                         ;;
3128                 esac
3129         fi
3130         ;;
3131 *)
3132         echo \$1
3133         ;;
3134 esac
3135 EOSS
3136 chmod +x filexp
3137 $eunicefix filexp
3138
3139 : now set up to get a file name
3140 cat <<EOS >getfile
3141 $startsh
3142 EOS
3143 cat <<'EOSC' >>getfile
3144 tilde=''
3145 fullpath=''
3146 already=''
3147 skip=''
3148 none_ok=''
3149 exp_file=''
3150 nopath_ok=''
3151 orig_rp="$rp"
3152 orig_dflt="$dflt"
3153 case "$gfpth" in
3154 '') gfpth='.' ;;
3155 esac
3156
3157 case "$fn" in
3158 *\(*)
3159         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3160         fn=`echo $fn | sed 's/(.*)//'`
3161         ;;
3162 esac
3163
3164 case "$fn" in
3165 *:*)
3166         loc_file=`expr $fn : '.*:\(.*\)'`
3167         fn=`expr $fn : '\(.*\):.*'`
3168         ;;
3169 esac
3170
3171 case "$fn" in
3172 *~*) tilde=true;;
3173 esac
3174 case "$fn" in
3175 */*) fullpath=true;;
3176 esac
3177 case "$fn" in
3178 *+*) skip=true;;
3179 esac
3180 case "$fn" in
3181 *n*) none_ok=true;;
3182 esac
3183 case "$fn" in
3184 *e*) exp_file=true;;
3185 esac
3186 case "$fn" in
3187 *p*) nopath_ok=true;;
3188 esac
3189
3190 case "$fn" in
3191 *f*) type='File';;
3192 *d*) type='Directory';;
3193 *l*) type='Locate';;
3194 esac
3195
3196 what="$type"
3197 case "$what" in
3198 Locate) what='File';;
3199 esac
3200
3201 case "$exp_file" in
3202 '')
3203         case "$d_portable" in
3204         "$define") ;;
3205         *) exp_file=true;;
3206         esac
3207         ;;
3208 esac
3209
3210 cd ..
3211 while test "$type"; do
3212         redo=''
3213         rp="$orig_rp"
3214         dflt="$orig_dflt"
3215         case "$tilde" in
3216         true) rp="$rp (~name ok)";;
3217         esac
3218         . UU/myread
3219         if test -f UU/getfile.ok && \
3220                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3221         then
3222                 value="$ans"
3223                 ansexp="$ans"
3224                 break
3225         fi
3226         case "$ans" in
3227         none)
3228                 value=''
3229                 ansexp=''
3230                 case "$none_ok" in
3231                 true) type='';;
3232                 esac
3233                 ;;
3234         *)
3235                 case "$tilde" in
3236                 '') value="$ans"
3237                         ansexp="$ans";;
3238                 *)
3239                         value=`UU/filexp $ans`
3240                         case $? in
3241                         0)
3242                                 if test "$ans" != "$value"; then
3243                                         echo "(That expands to $value on this system.)"
3244                                 fi
3245                                 ;;
3246                         *) value="$ans";;
3247                         esac
3248                         ansexp="$value"
3249                         case "$exp_file" in
3250                         '') value="$ans";;
3251                         esac
3252                         ;;
3253                 esac
3254                 case "$fullpath" in
3255                 true)
3256                         case "$ansexp" in
3257                         /*) value="$ansexp" ;;
3258                         *)
3259                                 redo=true
3260                                 case "$already" in
3261                                 true)
3262                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3263                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3264                                         ;;
3265                                 *)
3266                                 echo "Please give a full path name, starting with slash." >&4
3267                                         case "$tilde" in
3268                                         true)
3269                                 echo "Note that using ~name is ok provided it expands well." >&4
3270                                                 already=true
3271                                                 ;;
3272                                         esac
3273                                 esac
3274                                 ;;
3275                         esac
3276                         ;;
3277                 esac
3278                 case "$redo" in
3279                 '')
3280                         case "$type" in
3281                         File)
3282                                 for fp in $gfpth; do
3283                                         if test "X$fp" = X.; then
3284                                             pf="$ansexp"
3285                                         else    
3286                                             pf="$fp/$ansexp"
3287                                         fi
3288                                         if test -f "$pf"; then
3289                                                 type=''
3290                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3291                                         then
3292                                                 echo "($value is not a plain file, but that's ok.)"
3293                                                 type=''
3294                                         fi
3295                                         if test X"$type" = X; then
3296                                             value="$pf"
3297                                             break
3298                                         fi
3299                                 done
3300                                 ;;
3301                         Directory)
3302                                 for fp in $gfpth; do
3303                                         if test "X$fp" = X.; then
3304                                             pf="$ansexp"
3305                                         else    
3306                                             pf="$fp/$ansexp"
3307                                         fi
3308                                         if test -d "$pf"; then
3309                                                 type=''
3310                                                 value="$pf"
3311                                                 break
3312                                         fi
3313                                 done
3314                                 ;;
3315                         Locate)
3316                                 if test -d "$ansexp"; then
3317                                         echo "(Looking for $loc_file in directory $value.)"
3318                                         value="$value/$loc_file"
3319                                         ansexp="$ansexp/$loc_file"
3320                                 fi
3321                                 if test -f "$ansexp"; then
3322                                         type=''
3323                                 fi
3324                                 case "$nopath_ok" in
3325                                 true)   case "$value" in
3326                                         */*) ;;
3327                                         *)      echo "Assuming $value will be in people's path."
3328                                                 type=''
3329                                                 ;;
3330                                         esac
3331                                         ;;
3332                                 esac
3333                                 ;;
3334                         esac
3335
3336                         case "$skip" in
3337                         true) type='';
3338                         esac
3339
3340                         case "$type" in
3341                         '') ;;
3342                         *)
3343                                 if test "$fastread" = yes; then
3344                                         dflt=y
3345                                 else
3346                                         dflt=n
3347                                 fi
3348                                 rp="$what $value doesn't exist.  Use that name anyway?"
3349                                 . UU/myread
3350                                 dflt=''
3351                                 case "$ans" in
3352                                 y*) type='';;
3353                                 *) echo " ";;
3354                                 esac
3355                                 ;;
3356                         esac
3357                         ;;
3358                 esac
3359                 ;;
3360         esac
3361 done
3362 cd UU
3363 ans="$value"
3364 rp="$orig_rp"
3365 dflt="$orig_dflt"
3366 rm -f getfile.ok
3367 test "X$gfpthkeep" != Xy && gfpth=""
3368 EOSC
3369
3370 : What should the include directory be ?
3371 echo " "
3372 $echo $n "Hmm...  $c"
3373 dflt='/usr/include'
3374 incpath=''
3375 mips_type=''
3376 if $test -f /bin/mips && /bin/mips; then
3377         echo "Looks like a MIPS system..."
3378         $cat >usr.c <<'EOCP'
3379 #ifdef SYSTYPE_BSD43
3380 /bsd43
3381 #endif
3382 EOCP
3383         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3384                 dflt='/bsd43/usr/include'
3385                 incpath='/bsd43'
3386                 mips_type='BSD 4.3'
3387         else
3388                 mips_type='System V'
3389         fi
3390         $rm -f usr.c usr.out
3391         echo "and you're compiling with the $mips_type compiler and libraries."
3392         xxx_prompt=y
3393         echo "exit 0" >mips
3394 else
3395         echo "Doesn't look like a MIPS system."
3396         xxx_prompt=n
3397         echo "exit 1" >mips
3398 fi
3399 chmod +x mips
3400 $eunicefix mips
3401 case "$usrinc" in
3402 '') ;;
3403 *) dflt="$usrinc";;
3404 esac
3405 case "$xxx_prompt" in
3406 y)      fn=d/
3407         echo " "
3408         rp='Where are the include files you want to use?'
3409         . ./getfile
3410         usrinc="$ans"
3411         ;;
3412 *)      usrinc="$dflt"
3413         ;;
3414 esac
3415
3416 : see how we invoke the C preprocessor
3417 echo " "
3418 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3419 cat <<'EOT' >testcpp.c
3420 #define ABC abc
3421 #define XYZ xyz
3422 ABC.XYZ
3423 EOT
3424 cd ..
3425 if test ! -f cppstdin; then
3426         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3427                 # AIX cc -E doesn't show the absolute headerfile
3428                 # locations but we'll cheat by using the -M flag.
3429                 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
3430         else
3431                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3432         fi
3433 else
3434         echo "Keeping your $hint cppstdin wrapper."
3435 fi
3436 chmod 755 cppstdin
3437 wrapper=`pwd`/cppstdin
3438 ok='false'
3439 cd UU
3440
3441 if $test "X$cppstdin" != "X" && \
3442         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3443         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3444 then
3445         echo "You used to use $cppstdin $cppminus so we'll use that again."
3446         case "$cpprun" in
3447         '') echo "But let's see if we can live without a wrapper..." ;;
3448         *)
3449                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3450                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3451                 then
3452                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3453                         ok='true'
3454                 else
3455                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3456                 fi
3457                 ;;
3458         esac
3459 else
3460         case "$cppstdin" in
3461         '') ;;
3462         *)
3463                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3464                 ;;
3465         esac
3466 fi
3467
3468 if $ok; then
3469         : nothing
3470 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3471         $cc -E <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "Yup, it does."
3474         x_cpp="$cc -E"
3475         x_minus='';
3476 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3477         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Yup, it does."
3480         x_cpp="$cc -E"
3481         x_minus='-';
3482 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3483         $cc -P <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         echo "Yipee, that works!"
3486         x_cpp="$cc -P"
3487         x_minus='';
3488 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3489         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "At long last!"
3492         x_cpp="$cc -P"
3493         x_minus='-';
3494 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3495         $cpp <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         echo "It works!"
3498         x_cpp="$cpp"
3499         x_minus='';
3500 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3501         $cpp - <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Hooray, it works!  I was beginning to wonder."
3504         x_cpp="$cpp"
3505         x_minus='-';
3506 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3507         $wrapper <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         x_cpp="$wrapper"
3510         x_minus=''
3511         echo "Eureka!"
3512 else
3513         dflt=''
3514         rp="No dice.  I can't find a C preprocessor.  Name one:"
3515         . ./myread
3516         x_cpp="$ans"
3517         x_minus=''
3518         $x_cpp <testcpp.c >testcpp.out 2>&1
3519         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3520                 echo "OK, that will do." >&4
3521         else
3522 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3523                 exit 1
3524         fi
3525 fi
3526
3527 case "$ok" in
3528 false)
3529         cppstdin="$x_cpp"
3530         cppminus="$x_minus"
3531         cpprun="$x_cpp"
3532         cpplast="$x_minus"
3533         set X $x_cpp
3534         shift
3535         case "$1" in
3536         "$cpp")
3537                 echo "Perhaps can we force $cc -E using a wrapper..."
3538                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3539                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3540                 then
3541                         echo "Yup, we can."
3542                         cppstdin="$wrapper"
3543                         cppminus='';
3544                 else
3545                         echo "Nope, we'll have to live without it..."
3546                 fi
3547                 ;;
3548         esac
3549         case "$cpprun" in
3550         "$wrapper")
3551                 cpprun=''
3552                 cpplast=''
3553                 ;;
3554         esac
3555         ;;
3556 esac
3557
3558 case "$cppstdin" in
3559 "$wrapper"|'cppstdin') ;;
3560 *) $rm -f $wrapper;;
3561 esac
3562 $rm -f testcpp.c testcpp.out
3563
3564 : Set private lib path
3565 case "$plibpth" in
3566 '') if ./mips; then
3567                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3568         fi;;
3569 esac
3570 case "$libpth" in
3571 ' ') dlist='';;
3572 '') dlist="$loclibpth $plibpth $glibpth";;
3573 *) dlist="$libpth";;
3574 esac
3575
3576 : Now check and see which directories actually exist, avoiding duplicates
3577 libpth=''
3578 for xxx in $dlist
3579 do
3580     if $test -d $xxx; then
3581                 case " $libpth " in
3582                 *" $xxx "*) ;;
3583                 *) libpth="$libpth $xxx";;
3584                 esac
3585     fi
3586 done
3587 $cat <<'EOM'
3588
3589 Some systems have incompatible or broken versions of libraries.  Among
3590 the directories listed in the question below, please remove any you
3591 know not to be holding relevant libraries, and add any that are needed.
3592 Say "none" for none.
3593
3594 EOM
3595 case "$libpth" in
3596 '') dflt='none';;
3597 *)
3598         set X $libpth
3599         shift
3600         dflt=${1+"$@"}
3601         ;;
3602 esac
3603 rp="Directories to use for library searches?"
3604 . ./myread
3605 case "$ans" in
3606 none) libpth=' ';;
3607 *) libpth="$ans";;
3608 esac
3609
3610 : compute shared library extension
3611 case "$so" in
3612 '')
3613         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3614                 dflt='sl'
3615         else
3616                 dflt='so'
3617         fi
3618         ;;
3619 *) dflt="$so";;
3620 esac
3621 $cat <<EOM
3622
3623 On some systems, shared libraries may be available.  Answer 'none' if
3624 you want to suppress searching of shared libraries for the remainder
3625 of this configuration.
3626
3627 EOM
3628 rp='What is the file extension used for shared libraries?'
3629 . ./myread
3630 so="$ans"
3631
3632 : Define several unixisms.
3633 : Hints files or command line option can be used to override them.
3634 : The convoluted testing is in case hints files set either the old
3635 : or the new name.
3636 case "$_exe" in
3637 '')     case "$exe_ext" in
3638     '') ;;
3639         *)      _exe="$exe_ext" ;;
3640         esac
3641         ;;
3642 esac
3643 case "$_a" in
3644 '')     case "$lib_ext" in
3645     '') _a='.a';;
3646         *)      _a="$lib_ext" ;;
3647         esac
3648         ;;
3649 esac
3650 case "$_o" in
3651 '') case "$obj_ext" in
3652         '')     _o='.o';;
3653         *)      _o="$obj_ext";;
3654         esac
3655         ;;
3656 esac
3657 case "$p_" in
3658 '') case "$path_sep" in
3659         '')     p_=':';;
3660         *)      p_="$path_sep";;
3661         esac
3662         ;;
3663 esac
3664 exe_ext=$_exe
3665 lib_ext=$_a
3666 obj_ext=$_o
3667 path_sep=$p_
3668
3669 : Which makefile gets called first.  This is used by make depend.
3670 case "$firstmakefile" in
3671 '') firstmakefile='makefile';;
3672 esac
3673
3674 case "$usesocks" in
3675 $define|true|[yY]*)     dflt='y';;
3676 *) dflt='n';;
3677 esac
3678 cat <<EOM
3679
3680 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3681 Configure must be run with -Dusesocks.
3682
3683 If this doesn't make any sense to you, just accept the default '$dflt'.
3684 EOM
3685 rp='Build Perl for SOCKS?'
3686 . ./myread
3687 case "$ans" in
3688 y|Y)    val="$define" ;;     
3689 *)      val="$undef" ;;
3690 esac
3691 set usesocks
3692 eval $setvar
3693
3694 : Looking for optional libraries
3695 echo " "
3696 echo "Checking for optional libraries..." >&4
3697 case "$libs" in
3698 ' '|'') dflt='';;
3699 *) dflt="$libs";;
3700 esac
3701 case "$libswanted" in
3702 '') libswanted='c_s';;
3703 esac
3704 case "$usesocks" in
3705 $define)
3706         libswanted="$libswanted socks5 socks5_sh"
3707         ;;
3708 esac
3709 libsfound=''
3710 libsfiles=''
3711 libsdirs=''
3712 libspath=''
3713 for thisdir in $libpth $xlibpth; do
3714   test -d $thisdir && libspath="$libspath $thisdir"
3715 done
3716 for thislib in $libswanted; do
3717         for thisdir in $libspath; do
3718             xxx=''
3719             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3720                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3721                 $test -f "$xxx" && eval $libscheck
3722                 $test -f "$xxx" && libstyle=shared
3723             fi
3724             if test ! -f "$xxx"; then
3725                 xxx=$thisdir/lib$thislib.$so
3726                 $test -f "$xxx" && eval $libscheck
3727                 $test -f "$xxx" && libstyle=shared
3728             fi  
3729             if test ! -f "$xxx"; then
3730                 xxx=$thisdir/lib$thislib$_a
3731                 $test -f "$xxx" && eval $libscheck
3732                 $test -f "$xxx" && libstyle=static
3733             fi
3734             if test ! -f "$xxx"; then
3735                 xxx=$thisdir/$thislib$_a
3736                 $test -f "$xxx" && eval $libscheck
3737                 $test -f "$xxx" && libstyle=static
3738             fi
3739             if test ! -f "$xxx"; then
3740                 xxx=$thisdir/lib${thislib}_s$_a
3741                 $test -f "$xxx" && eval $libscheck
3742                 $test -f "$xxx" && libstyle=static
3743             fi
3744             if test ! -f "$xxx"; then
3745                 xxx=$thisdir/Slib$thislib$_a
3746                 $test -f "$xxx" && eval $libscheck
3747                 $test -f "$xxx" && libstyle=static
3748             fi
3749             if $test -f "$xxx"; then
3750                 case "$libstyle" in
3751                 shared) echo "Found -l$thislib (shared)." ;;
3752                 static) echo "Found -l$thislib." ;;
3753                 *)      echo "Found -l$thislib ($libstyle)." ;;
3754                 esac
3755                 case " $dflt " in
3756                 *"-l$thislib "*);;
3757                 *) dflt="$dflt -l$thislib"
3758                    libsfound="$libsfound $xxx"
3759                    yyy=`basename $xxx`
3760                    libsfiles="$libsfiles $yyy"
3761                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3762                    case " $libsdirs " in
3763                    *" $yyy "*) ;;
3764                    *) libsdirs="$libsdirs $yyy" ;;
3765                    esac
3766                    ;;
3767                 esac
3768                 break
3769             fi  
3770         done
3771         if $test ! -f "$xxx"; then
3772             echo "No -l$thislib."
3773         fi
3774 done
3775 set X $dflt
3776 shift
3777 dflt="$*"
3778 case "$libs" in
3779 '') dflt="$dflt";;
3780 *) dflt="$libs";;
3781 esac
3782 case "$dflt" in
3783 ' '|'') dflt='none';;
3784 esac
3785
3786 $cat <<EOM
3787
3788 In order to compile $package on your machine, a number of libraries
3789 are usually needed.  Include any other special libraries here as well.
3790 Say "none" for none.  The default list is almost always right.
3791 EOM
3792
3793 echo " "
3794 rp="What libraries to use?"
3795 . ./myread
3796 case "$ans" in
3797 none) libs=' ';;
3798 *) libs="$ans";;
3799 esac
3800
3801 : determine optimization, if desired, or use for debug flag also
3802 case "$optimize" in
3803 ' '|$undef) dflt='none';;
3804 '') dflt='-O';;
3805 *) dflt="$optimize";;
3806 esac
3807 $cat <<EOH
3808
3809 By default, $package compiles with the -O flag to use the optimizer.
3810 Alternately, you might want to use the symbolic debugger, which uses
3811 the -g flag (on traditional Unix systems).  Either flag can be
3812 specified here.  To use neither flag, specify the word "none".
3813
3814 EOH
3815 rp="What optimizer/debugger flag should be used?"
3816 . ./myread
3817 optimize="$ans"
3818 case "$optimize" in
3819 'none') optimize=" ";;
3820 esac
3821
3822 dflt=''
3823 : We will not override a previous value, but we might want to
3824 : augment a hint file
3825 case "$hint" in
3826 default|recommended)
3827         case "$gccversion" in
3828         1*) dflt='-fpcc-struct-return' ;;
3829         esac
3830         case "$optimize" in
3831         *-g*) dflt="$dflt -DDEBUGGING";;
3832         esac
3833         case "$gccversion" in
3834         2*) if test -d /etc/conf/kconfig.d &&
3835                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3836                 then
3837                         dflt="$dflt -posix"
3838                 fi
3839                 ;;
3840         esac
3841         case "$gccversion" in
3842         1*) ;;
3843         2.[0-8]*) ;;
3844         ?*)     echo " "
3845                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3846                 echo 'int main(void) { return 0; }' > gcctest.c
3847                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3848                         echo "Yes, it does." 2>&1
3849                         case "$ccflags" in
3850                         *strict-aliasing*) 
3851                                 echo "Leaving current flags $ccflags alone." 2>&1
3852                                 ;;
3853                         *) dflt="$dflt -fno-strict-aliasing" ;;
3854                         esac
3855                 else
3856                         echo "Nope, it doesn't, but that's ok." 2>&1
3857                 fi
3858                 ;;
3859         esac
3860         ;;
3861 esac
3862
3863 case "$mips_type" in
3864 *BSD*|'') inclwanted="$locincpth $usrinc";;
3865 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3866 esac
3867 for thisincl in $inclwanted; do
3868         if $test -d $thisincl; then
3869                 if $test x$thisincl != x$usrinc; then
3870                         case "$dflt" in
3871                         *$thisincl*);;
3872                         *) dflt="$dflt -I$thisincl";;
3873                         esac
3874                 fi
3875         fi
3876 done
3877
3878 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3879         xxx=true;
3880 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3881         xxx=true;
3882 else
3883         xxx=false;
3884 fi;
3885 if $xxx; then
3886         case "$dflt" in
3887         *$2*);;
3888         *) dflt="$dflt -D$2";;
3889         esac;
3890 fi'
3891
3892 set signal.h LANGUAGE_C; eval $inctest
3893
3894 case "$usesocks" in
3895 $define)
3896         ccflags="$ccflags -DSOCKS"
3897         ;;
3898 esac
3899
3900 case "$hint" in
3901 default|recommended) dflt="$ccflags $dflt" ;;
3902 *) dflt="$ccflags";;
3903 esac
3904
3905 case "$dflt" in
3906 ''|' ') dflt=none;;
3907 esac
3908 $cat <<EOH
3909
3910 Your C compiler may want other flags.  For this question you should include
3911 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3912 but you should NOT include libraries or ld flags like -lwhatever.  If you
3913 want $package to honor its debug switch, you should include -DDEBUGGING here.
3914 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3915
3916 To use no flags, specify the word "none".
3917
3918 EOH
3919 set X $dflt
3920 shift
3921 dflt=${1+"$@"}
3922 rp="Any additional cc flags?"
3923 . ./myread
3924 case "$ans" in
3925 none) ccflags='';;
3926 *) ccflags="$ans";;
3927 esac
3928
3929 : the following weeds options from ccflags that are of no interest to cpp
3930 cppflags="$ccflags"
3931 case "$gccversion" in
3932 1*) cppflags="$cppflags -D__GNUC__"
3933 esac
3934 case "$mips_type" in
3935 '');;
3936 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3937 esac
3938 case "$cppflags" in
3939 '');;
3940 *)
3941         echo " "
3942         echo "Let me guess what the preprocessor flags are..." >&4
3943         set X $cppflags
3944         shift
3945         cppflags=''
3946         $cat >cpp.c <<'EOM'
3947 #define BLURFL foo
3948
3949 BLURFL xx LFRULB
3950 EOM
3951         previous=''
3952         for flag in $*
3953         do
3954                 case "$flag" in
3955                 -*) ftry="$flag";;
3956                 *) ftry="$previous $flag";;
3957                 esac
3958                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3959                         >cpp1.out 2>/dev/null && \
3960                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3961                         >cpp2.out 2>/dev/null && \
3962                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3963                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3964                 then
3965                         cppflags="$cppflags $ftry"
3966                         previous=''
3967                 else
3968                         previous="$flag"
3969                 fi
3970         done
3971         set X $cppflags
3972         shift
3973         cppflags=${1+"$@"}
3974         case "$cppflags" in
3975         *-*)  echo "They appear to be: $cppflags";;
3976         esac
3977         $rm -f cpp.c cpp?.out
3978         ;;
3979 esac
3980
3981 : flags used in final linking phase
3982 case "$ldflags" in
3983 '') if ./venix; then
3984                 dflt='-i -z'
3985         else
3986                 dflt=''
3987         fi
3988         case "$ccflags" in
3989         *-posix*) dflt="$dflt -posix" ;;
3990         esac
3991         ;;
3992 *) dflt="$ldflags";;
3993 esac
3994
3995 : Try to guess additional flags to pick up local libraries.
3996 for thislibdir in $libpth; do
3997         case " $loclibpth " in
3998         *" $thislibdir "*)
3999                 case "$dflt " in 
4000                 *"-L$thislibdir "*) ;;
4001                 *)  dflt="$dflt -L$thislibdir" ;;
4002                 esac
4003                 ;;
4004         esac
4005 done
4006
4007 case "$dflt" in
4008 '') dflt='none' ;;
4009 esac
4010
4011 $cat <<EOH
4012
4013 Your C linker may need flags.  For this question you should
4014 include -L/whatever and any other flags used by the C linker, but you
4015 should NOT include libraries like -lwhatever.
4016
4017 Make sure you include the appropriate -L/path flags if your C linker
4018 does not normally search all of the directories you specified above,
4019 namely
4020         $libpth
4021 To use no flags, specify the word "none".
4022
4023 EOH
4024
4025 rp="Any additional ld flags (NOT including libraries)?"
4026 . ./myread
4027 case "$ans" in
4028 none) ldflags='';;
4029 *) ldflags="$ans";;
4030 esac
4031 rmlist="$rmlist pdp11"
4032
4033 : coherency check
4034 echo " "
4035 echo "Checking your choice of C compiler and flags for coherency..." >&4
4036 $cat > try.c <<'EOF'
4037 #include <stdio.h>
4038 int main() { printf("Ok\n"); exit(0); }
4039 EOF
4040 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4041 shift
4042 $cat >try.msg <<'EOM'
4043 I've tried to compile and run the following simple program:
4044
4045 EOM
4046 $cat try.c >> try.msg
4047
4048 $cat >> try.msg <<EOM
4049
4050 I used the command:
4051
4052         $*
4053         ./try
4054
4055 and I got the following output:
4056
4057 EOM
4058 dflt=y
4059 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4060         if sh -c './try' >>try.msg 2>&1; then
4061                 xxx=`./try`
4062                 case "$xxx" in
4063                 "Ok") dflt=n ;;
4064                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4065                         case " $libs " in
4066                         *" -lsfio "*)
4067                                 cat >> try.msg <<'EOQS'
4068 If $libs contains -lsfio, and sfio is mis-configured, then it
4069 sometimes (apparently) runs and exits with a 0 status, but with no
4070 output!  It may have to do with sfio's use of _exit vs. exit.
4071
4072 EOQS
4073                                 rp="You have a big problem.  Shall I abort Configure"
4074                                 dflt=y
4075                                 ;;
4076                         esac
4077                         ;;
4078                 esac
4079         else
4080                 echo "The program compiled OK, but exited with status $?." >>try.msg
4081                 rp="You have a problem.  Shall I abort Configure"
4082                 dflt=y
4083         fi
4084 else
4085         echo "I can't compile the test program." >>try.msg
4086         rp="You have a BIG problem.  Shall I abort Configure"
4087         dflt=y
4088 fi
4089 case "$dflt" in
4090 y)
4091         $cat try.msg >&4
4092         case "$knowitall" in
4093         '')
4094                 echo "(The supplied flags or libraries might be incorrect.)"
4095                 ;;
4096         *) dflt=n;;
4097         esac
4098         echo " "
4099         . ./myread
4100         case "$ans" in
4101         n*|N*) ;;
4102         *)      echo "Ok.  Stopping Configure." >&4
4103                 exit 1
4104                 ;;
4105         esac
4106         ;;
4107 n) echo "OK, that should do.";;
4108 esac
4109 $rm -f try try.* core
4110
4111 : define an is-a-typedef? function
4112 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4113 case "$inclist" in
4114 "") inclist="sys/types.h";;
4115 esac;
4116 eval "varval=\$$var";
4117 case "$varval" in
4118 "")
4119         $rm -f temp.c;
4120         for inc in $inclist; do
4121                 echo "#include <$inc>" >>temp.c;
4122         done;
4123         echo "#ifdef $type" >> temp.c;
4124         echo "printf(\"We have $type\");" >> temp.c;
4125         echo "#endif" >> temp.c;
4126         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4127         if $contains $type temp.E >/dev/null 2>&1; then
4128                 eval "$var=\$type";
4129         else
4130                 eval "$var=\$def";
4131         fi;
4132         $rm -f temp.?;;
4133 *) eval "$var=\$varval";;
4134 esac'
4135
4136 : define an is-a-typedef? function that prompts if the type is not available.
4137 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138 case "$inclist" in
4139 "") inclist="sys/types.h";;
4140 esac;
4141 eval "varval=\$$var";
4142 case "$varval" in
4143 "")
4144         $rm -f temp.c;
4145         for inc in $inclist; do
4146                 echo "#include <$inc>" >>temp.c;
4147         done;
4148         echo "#ifdef $type" >> temp.c;
4149         echo "printf(\"We have $type\");" >> temp.c;
4150         echo "#endif" >> temp.c;
4151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152         echo " " ;
4153         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4154         if $contains $type temp.E >/dev/null 2>&1; then
4155                 echo "$type found." >&4;
4156                 eval "$var=\$type";
4157         else
4158                 echo "$type NOT found." >&4;
4159                 dflt="$def";
4160                 . ./myread ;
4161                 eval "$var=\$ans";
4162         fi;
4163         $rm -f temp.?;;
4164 *) eval "$var=\$varval";;
4165 esac'
4166
4167 : define a shorthand compile call
4168 compile='
4169 mc_file=$1;
4170 shift;
4171 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4172 : define a shorthand compile call for compilations that should be ok.
4173 compile_ok='
4174 mc_file=$1;
4175 shift;
4176 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4177
4178 : check for lengths of integral types
4179 echo " "
4180 case "$intsize" in
4181 '')
4182         echo "Checking to see how big your integers are..." >&4
4183         $cat >intsize.c <<'EOCP'
4184 #include <stdio.h>
4185 int main()
4186 {
4187         printf("intsize=%d;\n", (int)sizeof(int));
4188         printf("longsize=%d;\n", (int)sizeof(long));
4189         printf("shortsize=%d;\n", (int)sizeof(short));
4190         exit(0);
4191 }
4192 EOCP
4193         set intsize
4194         if eval $compile_ok && ./intsize > /dev/null; then
4195                 eval `./intsize`
4196                 echo "Your integers are $intsize bytes long."
4197                 echo "Your long integers are $longsize bytes long."
4198                 echo "Your short integers are $shortsize bytes long."
4199         else
4200                 $cat >&4 <<EOM
4201 !
4202 Help! I can't compile and run the intsize test program: please enlighten me!
4203 (This is probably a misconfiguration in your system or libraries, and
4204 you really ought to fix it.  Still, I'll try anyway.)
4205 !
4206 EOM
4207                 dflt=4
4208                 rp="What is the size of an integer (in bytes)?"
4209                 . ./myread
4210                 intsize="$ans"
4211                 dflt=$intsize
4212                 rp="What is the size of a long integer (in bytes)?"
4213                 . ./myread
4214                 longsize="$ans"
4215                 dflt=2
4216                 rp="What is the size of a short integer (in bytes)?"
4217                 . ./myread
4218                 shortsize="$ans"
4219         fi
4220         ;;
4221 esac
4222 $rm -f intsize intsize.*
4223
4224 : see what type lseek is declared as in the kernel
4225 rp="What is the type used for lseek's offset on this system?"
4226 set off_t lseektype long stdio.h sys/types.h
4227 eval $typedef_ask
4228
4229 echo " "
4230 echo "Checking to see how big your file offsets are..." >&4
4231 $cat >try.c <<EOCP
4232 #include <sys/types.h>
4233 #include <stdio.h>
4234 int main()
4235 {
4236     printf("%d\n", (int)sizeof($lseektype));
4237     return(0); 
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         lseeksize=`./try`
4243         echo "Your file offsets are $lseeksize bytes long."
4244 else
4245         dflt=$longsize
4246         echo " "
4247         echo "(I can't seem to compile the test program.  Guessing...)"
4248         rp="What is the size of your file offsets (in bytes)?"
4249         . ./myread
4250         lseeksize="$ans"
4251 fi
4252 $rm -f try.c try
4253
4254 : see what type file positions are declared as in the library
4255 rp="What is the type for file position used by fsetpos()?"
4256 set fpos_t fpostype long stdio.h sys/types.h
4257 eval $typedef_ask
4258
4259 echo " "
4260 case "$fpostype" in
4261 *_t) zzz="$fpostype"    ;;
4262 *)   zzz="fpos_t"       ;;
4263 esac
4264 echo "Checking the size of $zzz..." >&4 
4265 cat > try.c <<EOCP
4266 #include <sys/types.h>
4267 #include <stdio.h>
4268 int main() {
4269     printf("%d\n", (int)sizeof($fpostype));
4270     exit(0);
4271 }
4272 EOCP
4273 set try
4274 if eval $compile_ok; then
4275         yyy=`./try`
4276         case "$yyy" in
4277         '')     fpossize=4
4278                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4279                 ;;
4280         *)      fpossize=$yyy
4281                 echo "Your $zzz is $fpossize bytes long."
4282                 ;;
4283         esac
4284 else
4285         dflt="$longsize"
4286         echo " " >&4
4287         echo "(I can't compile the test program.  Guessing...)" >&4
4288         rp="What is the size of your file positions (in bytes)?"
4289         . ./myread
4290         fpossize="$ans"
4291 fi
4292
4293
4294
4295 # Backward compatibility (uselfs is deprecated).
4296 case "$uselfs" in
4297 "$define"|true|[yY]*)
4298         cat <<EOM >&4
4299
4300 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4301 EOM
4302         uselargefiles="$define"
4303         ;;
4304 esac                          
4305
4306 case "$lseeksize:$fpossize" in
4307 8:8) cat <<EOM
4308
4309 You can have files larger than 2 gigabytes.
4310 EOM
4311    val="$define" ;;
4312 *)    case "$uselargefiles" in
4313    "$undef"|false|[nN]*) dflt='n' ;;
4314    *)   dflt='y' ;;
4315    esac
4316    cat <<EOM
4317
4318 Perl can be built to understand large files (files larger than 2 gigabytes)
4319 on some systems.  To do so, Configure can be run with -Duselargefiles.
4320
4321 If this doesn't make any sense to you, just accept the default '$dflt'.
4322 EOM
4323    rp='Try to understand large files, if available?'
4324    . ./myread
4325    case "$ans" in
4326    y|Y)         val="$define" ;;
4327    *)           val="$undef"  ;;
4328    esac
4329    ;;
4330 esac
4331 set uselargefiles
4332 eval $setvar
4333 case "$uselargefiles" in
4334 "$define")
4335 : Look for a hint-file generated 'call-back-unit'.  If the
4336 : user has specified that a large files perl is to be built,
4337 : we may need to set or change some other defaults.
4338         if $test -f uselfs.cbu; then
4339                 echo "Your platform has some specific hints for large file builds, using them..."
4340                 . ./uselfs.cbu
4341                 echo " "
4342                 echo "Rechecking to see how big your file offsets are..." >&4
4343                 $cat >try.c <<EOCP
4344 #include <sys/types.h>
4345 #include <stdio.h>
4346 int main()
4347 {
4348     printf("%d\n", (int)sizeof($lseektype));
4349     return(0); 
4350 }
4351 EOCP
4352                 set try
4353                 if eval $compile_ok; then
4354                         lseeksize=`./try`
4355                         $echo "Your file offsets are now $lseeksize bytes long."
4356                 else
4357                         dflt="$lseeksize"
4358                         echo " "
4359                         echo "(I can't seem to compile the test program.  Guessing...)"
4360                         rp="What is the size of your file offsets (in bytes)?"
4361                         . ./myread
4362                         lseeksize="$ans"
4363                 fi
4364                 case "$fpostype" in
4365                 *_t) zzz="$fpostype"    ;;
4366                 *)   zzz="fpos_t"       ;;
4367                 esac
4368                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4369                 $cat > try.c <<EOCP
4370 #include <sys/types.h>
4371 #include <stdio.h>
4372 int main() {
4373     printf("%d\n", (int)sizeof($fpostype));
4374     exit(0);
4375 }
4376 EOCP
4377                 set try
4378                 if eval $compile_ok; then
4379                         yyy=`./try`
4380                         dflt="$lseeksize"
4381                         case "$yyy" in
4382                         '')     echo " "
4383                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4384                                 ;;
4385                         *)      fpossize=$yyy
4386                                 echo " $fpossize bytes." >&4
4387                                 ;;
4388                         esac
4389                 else
4390                         dflt="$fpossize"
4391                         echo " "
4392                         echo "(I can't compile the test program.  Guessing...)" >&4
4393                         rp="What is the size of your file positions (in bytes)?"
4394                         . ./myread
4395                         fpossize="$ans"
4396                 fi
4397                 $rm -f try.c try
4398         fi
4399         ;;
4400 esac
4401
4402
4403 case "$usemorebits" in
4404 "$define"|true|[yY]*)
4405         use64bitint="$define"
4406         uselongdouble="$define"
4407         usemorebits="$define"
4408         ;;
4409 *)      usemorebits="$undef"
4410         ;;
4411 esac
4412
4413
4414 # Backward compatibility (uselonglong is deprecated).
4415 case "$uselonglong" in
4416 "$define"|true|[yY]*)
4417         cat <<EOM >&4
4418
4419 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4420 EOM
4421         use64bitint="$define"
4422         ;;
4423 esac                          
4424 # Backward compatibility (use64bits is deprecated).
4425 case "$use64bits" in
4426 "$define"|true|[yY]*)
4427         cat <<EOM >&4
4428
4429 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4430 EOM
4431         use64bitint="$define"
4432         ;;
4433 esac                          
4434 # Thinko compatibility
4435 case "$use64bitints" in
4436 "$define"|true|[yY]*)
4437         cat <<EOM >&4
4438
4439 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4440 EOM
4441         use64bitint="$define"
4442         ;;
4443 esac                          
4444
4445 case "$ccflags" in
4446 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4447 esac
4448 case "$use64bitall" in
4449 "$define"|true|[yY]*) use64bitint="$define" ;;
4450 esac
4451
4452 case "$longsize" in
4453 8) cat <<EOM
4454
4455 You have natively 64-bit long integers.
4456 EOM
4457    val="$define"
4458    ;;
4459 *) case "$use64bitint" in
4460    "$define"|true|[yY]*) dflt='y';;
4461    *) dflt='n';;
4462    esac
4463    cat <<EOM
4464
4465 Perl can be built to take advantage of 64-bit integer types
4466 on some systems.  To do so, Configure can be run with -Duse64bitint.
4467 Choosing this option will most probably introduce binary incompatibilities.
4468
4469 If this doesn't make any sense to you, just accept the default '$dflt'.
4470 EOM
4471    rp='Try to use 64-bit integers, if available?'
4472    . ./myread
4473    case "$ans" in
4474    [yY]*) val="$define" ;;
4475    *)     val="$undef"  ;;
4476    esac
4477    ;;
4478 esac
4479 set use64bitint
4480 eval $setvar
4481
4482 case "$use64bitint" in
4483 "$define")      case "$longsize" in
4484                 8) dflt='y' ;;
4485                 *) dflt='n' ;;
4486                 esac
4487                 ;;
4488 *)      case "$use64bitall" in
4489         "$define"|true|[yY]*) dflt='y' ;;
4490         *) dflt='n' ;;
4491         esac
4492         ;;
4493 esac 
4494 cat <<EOM
4495
4496 You may also choose to try maximal 64-bitness.  It means using as much
4497 64-bitness as possible on the platform.  This in turn means even more
4498 binary incompatibilities.  On the other hand, your platform may not
4499 have any more 64-bitness available than what you already have chosen.
4500
4501 If this doesn't make any sense to you, just accept the default '$dflt'.
4502 EOM
4503 rp='Try to use maximal 64-bit support, if available?'
4504 . ./myread
4505 case "$ans" in
4506 [yY]*) val="$define" ;;
4507 *)     val="$undef"  ;;
4508 esac
4509 set use64bitall
4510 eval $setvar
4511 case "$use64bitall" in
4512 "$define")
4513         case "$use64bitint" in
4514         "$undef")
4515                 cat <<EOM
4516
4517 Since you have chosen a maximally 64-bit build, I'm also turning on
4518 the use of 64-bit integers.
4519 EOM
4520                 use64bitint="$define" ;;
4521         esac
4522         ;;
4523 esac
4524
4525 case "$use64bitint" in
4526 "$define"|true|[yY]*)
4527 : Look for a hint-file generated 'call-back-unit'.  If the
4528 : user has specified that a 64-bit perl is to be built,
4529 : we may need to set or change some other defaults.
4530         if $test -f use64bitint.cbu; then
4531                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4532                 . ./use64bitint.cbu
4533         fi
4534         case "$longsize" in
4535         4) case "$ccflags" in
4536            *-DUSE_64_BIT_INT*) ;;
4537            *) ccflags="$ccflags -DUSE_64_BIT_INT";;
4538            esac
4539            case "$archname64" in
4540            '') archname64=64int ;;
4541            esac
4542            ;;
4543         esac
4544         ;;
4545 esac
4546
4547 case "$use64bitall" in
4548 "$define"|true|[yY]*)
4549 : Look for a hint-file generated 'call-back-unit'.  If the
4550 : user has specified that a maximally 64-bit perl is to be built,
4551 : we may need to set or change some other defaults.
4552         if $test -f use64bitall.cbu; then
4553                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4554                 . ./use64bitall.cbu
4555         fi
4556         case "$longsize" in
4557         4) case "$ccflags" in
4558            *-DUSE_64_BIT_ALL*) ;;
4559            *) ccflags="$ccflags -DUSE_64_BIT_ALL";;
4560            esac
4561            case "$archname64" in
4562            ''|64) archname64=64all ;;
4563            esac
4564            ;;
4565         esac
4566         ;;
4567 esac
4568
4569 : determine the architecture name
4570 echo " "
4571 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4572         tarch=`arch`"-$osname"
4573 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4574         if uname -m > tmparch 2>&1 ; then
4575                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4576                         -e 's/$/'"-$osname/" tmparch`
4577         else
4578                 tarch="$osname"
4579         fi
4580         $rm -f tmparch
4581 else
4582         tarch="$osname"
4583 fi
4584 case "$myarchname" in
4585 ''|"$tarch") ;;
4586 *)
4587         echo "(Your architecture name used to be $myarchname.)"
4588         archname=''
4589         ;;
4590 esac
4591 myarchname="$tarch"
4592 case "$archname" in
4593 '') dflt="$tarch";;
4594 *) dflt="$archname";;
4595 esac
4596 rp='What is your architecture name'
4597 . ./myread
4598 archname="$ans"
4599 case "$usethreads" in
4600 $define)
4601         echo "Threads selected." >&4
4602         case "$archname" in
4603         *-thread*) echo "...and architecture name already has -thread." >&4
4604                 ;;
4605         *)      archname="$archname-thread"
4606                 echo "...setting architecture name to $archname." >&4
4607                 ;;
4608         esac
4609         ;;
4610 esac
4611 case "$usemultiplicity" in
4612 $define)
4613         echo "Multiplicity selected." >&4
4614         case "$archname" in
4615         *-multi*) echo "...and architecture name already has -multi." >&4
4616                 ;;
4617         *)      archname="$archname-multi"
4618                 echo "...setting architecture name to $archname." >&4
4619                 ;;
4620         esac
4621         ;;
4622 esac
4623 case "$use64bitint" in
4624 $define)
4625         case "$archname64" in
4626         '')
4627                 ;;
4628         *)
4629                 case "$archname" in
4630                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4631                         ;;
4632                 *)      archname="$archname-$archname64"
4633                         echo "...setting architecture name to $archname." >&4
4634                         ;;
4635                 esac
4636                 ;;
4637         esac
4638 esac
4639
4640 : determine root of directory hierarchy where package will be installed.
4641 case "$prefix" in
4642 '')
4643         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4644         ;;
4645 *)
4646         dflt="$prefix"
4647         ;;
4648 esac
4649 $cat <<EOM
4650
4651 By default, $package will be installed in $dflt/bin, manual pages
4652 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4653 installation directories. Typically this is something like /usr/local.
4654 If you wish to have binaries under /usr/bin but other parts of the
4655 installation under /usr/local, that's ok: you will be prompted
4656 separately for each of the installation directories, the prefix being
4657 only used to set the defaults.
4658
4659 EOM
4660 fn=d~
4661 rp='Installation prefix to use?'
4662 . ./getfile
4663 oldprefix=''
4664 case "$prefix" in
4665 '') ;;
4666 *)
4667         case "$ans" in
4668         "$prefix") ;;
4669         *) oldprefix="$prefix";;
4670         esac
4671         ;;
4672 esac
4673 prefix="$ans"
4674 prefixexp="$ansexp"
4675
4676 : is AFS running?
4677 echo " "
4678 case "$afs" in
4679 $define|true)   afs=true ;;
4680 $undef|false)   afs=false ;;
4681 *)      if test -d /afs; then
4682                 afs=true
4683         else
4684                 afs=false
4685         fi
4686         ;;
4687 esac
4688 if $afs; then
4689         echo "AFS may be running... I'll be extra cautious then..." >&4
4690 else
4691         echo "AFS does not seem to be running..." >&4
4692 fi
4693
4694 : determine installation prefix for where package is to be installed.
4695 if $afs; then 
4696 $cat <<EOM
4697
4698 Since you are running AFS, I need to distinguish the directory in which
4699 files will reside from the directory in which they are installed (and from
4700 which they are presumably copied to the former directory by occult means).
4701
4702 EOM
4703         case "$installprefix" in
4704         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4705         *) dflt="$installprefix";;
4706         esac
4707 else
4708 $cat <<EOM
4709
4710 In some special cases, particularly when building $package for distribution,
4711 it is convenient to distinguish between the directory in which files should 
4712 be installed from the directory ($prefix) in which they 
4713 will eventually reside.  For most users, these two directories are the same.
4714
4715 EOM
4716         case "$installprefix" in
4717         '') dflt=$prefix ;;
4718         *) dflt=$installprefix;;
4719         esac
4720 fi
4721 fn=d~
4722 rp='What installation prefix should I use for installing files?'
4723 . ./getfile
4724 installprefix="$ans"
4725 installprefixexp="$ansexp"
4726
4727 : set the prefixit variable, to compute a suitable default value
4728 prefixit='case "$3" in
4729 ""|none)
4730         case "$oldprefix" in
4731         "") eval "$1=\"\$$2\"";;
4732         *)
4733                 case "$3" in
4734                 "") eval "$1=";;
4735                 none)
4736                         eval "tp=\"\$$2\"";
4737                         case "$tp" in
4738                         ""|" ") eval "$1=\"\$$2\"";;
4739                         *) eval "$1=";;
4740                         esac;;
4741                 esac;;
4742         esac;;
4743 *)
4744         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4745         case "$tp" in
4746         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4747         /*-$oldprefix/*|\~*-$oldprefix/*)
4748                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4749         *) eval "$1=\"\$$2\"";;
4750         esac;;
4751 esac'
4752
4753
4754 : get the patchlevel
4755 echo " "
4756 echo "Getting the current patchlevel..." >&4
4757 if $test -r $rsrc/patchlevel.h;then
4758         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4759         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4760         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4761         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4762         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4763         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4764 else
4765         revision=0
4766         patchlevel=0
4767         subversion=0
4768         api_revision=0
4769         api_version=0
4770         api_subversion=0
4771 fi
4772 $echo $n "(You have $package revision $revision" $c
4773 $echo $n " patchlevel $patchlevel" $c
4774 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4775 echo ".)"
4776 case "$osname" in
4777 dos|vms)
4778         : XXX Should be a Configure test for double-dots in filenames.
4779         version=`echo $revision $patchlevel $subversion | \
4780                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4781         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4782                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4783         ;;
4784 *)
4785         version=`echo $revision $patchlevel $subversion | \
4786                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4787         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4788                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4789         ;;
4790 esac
4791 : Special case the 5.005_xx maintenance series, which used 5.005
4792 : without any subversion label as a subdirectory in $sitelib
4793 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4794         api_versionstring='5.005'
4795 fi
4796
4797 : determine installation style
4798 : For now, try to deduce it from prefix unless it is already set.
4799 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4800 case "$installstyle" in
4801 '')     case "$prefix" in
4802                 *perl*) dflt='lib';;
4803                 *) dflt='lib/perl5' ;;
4804         esac
4805         ;;
4806 *)      dflt='lib/perl5' ;;
4807 esac
4808 : Probably not worth prompting for this since we prompt for all
4809 : the directories individually, and the prompt would be too long and
4810 : confusing anyway.
4811 installstyle=$dflt
4812
4813 : determine where private library files go
4814 : Usual default is /usr/local/lib/perl5/$version.
4815 : Also allow things like /opt/perl/lib/$version, since 
4816 : /opt/perl/lib/perl5... would be redundant.
4817 : The default "style" setting is made in installstyle.U
4818 case "$installstyle" in
4819 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4820 *)       set dflt privlib lib/$version ;;
4821 esac
4822 eval $prefixit
4823 $cat <<EOM
4824
4825 There are some auxiliary files for $package that need to be put into a
4826 private library directory that is accessible by everyone.
4827
4828 EOM
4829 fn=d~+
4830 rp='Pathname where the private library files will reside?'
4831 . ./getfile
4832 privlib="$ans"
4833 privlibexp="$ansexp"
4834 : Change installation prefix, if necessary.
4835 if $test X"$prefix" != X"$installprefix"; then
4836         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4837 else
4838         installprivlib="$privlibexp"
4839 fi
4840
4841 : set the prefixup variable, to restore leading tilda escape
4842 prefixup='case "$prefixexp" in
4843 "$prefix") ;;
4844 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4845 esac'
4846
4847 : determine where public architecture dependent libraries go
4848 set archlib archlib
4849 eval $prefixit
4850 : privlib default is /usr/local/lib/$package/$version
4851 : archlib default is /usr/local/lib/$package/$version/$archname
4852 : privlib may have an optional trailing /share.
4853 tdflt=`echo $privlib | $sed 's,/share$,,'`
4854 tdflt=$tdflt/$archname
4855 case "$archlib" in
4856 '')     dflt=$tdflt
4857         ;;
4858 *)      dflt="$archlib"
4859     ;;
4860 esac
4861 $cat <<EOM
4862
4863 $spackage contains architecture-dependent library files.  If you are
4864 sharing libraries in a heterogeneous environment, you might store
4865 these files in a separate location.  Otherwise, you can just include
4866 them with the rest of the public library files.
4867
4868 EOM
4869 fn=d+~
4870 rp='Where do you want to put the public architecture-dependent libraries?'
4871 . ./getfile
4872 archlib="$ans"
4873 archlibexp="$ansexp"
4874 if $test X"$archlib" = X"$privlib"; then
4875         d_archlib="$undef"
4876 else
4877         d_archlib="$define"
4878 fi
4879 : Change installation prefix, if necessary.
4880 if $test X"$prefix" != X"$installprefix"; then
4881         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4882 else
4883         installarchlib="$archlibexp"
4884 fi
4885
4886
4887 : Binary compatibility with 5.005 is not possible for builds
4888 : with advanced features
4889 case "$usethreads$usemultiplicity" in
4890 *define*)
4891         bincompat5005="$undef"
4892         d_bincompat5005="$undef"
4893         ;;
4894 *)      $cat <<EOM
4895
4896 Perl 5.006 can be compiled for binary compatibility with 5.005.
4897 If you decide to do so, you will be able to continue using most
4898 of the extensions that were compiled for Perl 5.005.
4899
4900 EOM
4901         case "$bincompat5005$d_bincompat5005" in
4902         *"$undef"*) dflt=n ;;
4903         *) dflt=y ;;
4904         esac
4905         rp='Binary compatibility with Perl 5.005?'
4906         . ./myread
4907         case "$ans" in
4908         y*) val="$define" ;;
4909         *)  val="$undef" ;;
4910         esac
4911         set d_bincompat5005
4912         eval $setvar
4913         case "$d_bincompat5005" in
4914         "$define")
4915                 bincompat5005="$define"
4916                 ;;
4917         *)      bincompat5005="$undef"
4918                 d_bincompat5005="$undef"
4919                 ;;
4920         esac
4921         ;;
4922 esac
4923
4924
4925 : see if setuid scripts can be secure
4926 $cat <<EOM
4927
4928 Some kernels have a bug that prevents setuid #! scripts from being
4929 secure.  Some sites have disabled setuid #! scripts because of this.
4930
4931 First let's decide if your kernel supports secure setuid #! scripts.
4932 (If setuid #! scripts would be secure but have been disabled anyway,
4933 don't say that they are secure if asked.)
4934
4935 EOM
4936
4937 val="$undef"
4938 if $test -d /dev/fd; then
4939         echo "#!$ls" >reflect
4940         chmod +x,u+s reflect
4941         ./reflect >flect 2>&1
4942         if $contains "/dev/fd" flect >/dev/null; then
4943                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4944                 val="$define"
4945         else
4946                 $cat <<EOM
4947 If you are not sure if they are secure, I can check but I'll need a
4948 username and password different from the one you are using right now.
4949 If you don't have such a username or don't want me to test, simply
4950 enter 'none'.
4951
4952 EOM
4953                 rp='Other username to test security of setuid scripts with?'
4954                 dflt='none'
4955                 . ./myread
4956                 case "$ans" in
4957                 n|none)
4958                         case "$d_suidsafe" in
4959                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4960                                 dflt=n;;
4961                         "$undef")
4962                                 echo "Well, the $hint value is *not* secure." >&4
4963                                 dflt=n;;
4964                         *)      echo "Well, the $hint value *is* secure." >&4
4965                                 dflt=y;;
4966                         esac
4967                         ;;
4968                 *)
4969                         $rm -f reflect flect
4970                         echo "#!$ls" >reflect
4971                         chmod +x,u+s reflect
4972                         echo >flect
4973                         chmod a+w flect
4974                         echo '"su" will (probably) prompt you for '"$ans's password."
4975                         su $ans -c './reflect >flect'
4976                         if $contains "/dev/fd" flect >/dev/null; then
4977                                 echo "Okay, it looks like setuid scripts are secure." >&4
4978                                 dflt=y
4979                         else
4980                                 echo "I don't think setuid scripts are secure." >&4
4981                                 dflt=n
4982                         fi
4983                         ;;
4984                 esac
4985                 rp='Does your kernel have *secure* setuid scripts?'
4986                 . ./myread
4987                 case "$ans" in
4988                 [yY]*)  val="$define";;
4989                 *)      val="$undef";;
4990                 esac
4991         fi
4992 else
4993         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4994         echo "(That's for file descriptors, not floppy disks.)"
4995         val="$undef"
4996 fi
4997 set d_suidsafe
4998 eval $setvar
4999
5000 $rm -f reflect flect
5001
5002 : now see if they want to do setuid emulation
5003 echo " "
5004 val="$undef"
5005 case "$d_suidsafe" in
5006 "$define")
5007         val="$undef"
5008         echo "No need to emulate SUID scripts since they are secure here." >& 4
5009         ;;
5010 *)
5011         $cat <<EOM
5012 Some systems have disabled setuid scripts, especially systems where
5013 setuid scripts cannot be secure.  On systems where setuid scripts have
5014 been disabled, the setuid/setgid bits on scripts are currently
5015 useless.  It is possible for $package to detect those bits and emulate
5016 setuid/setgid in a secure fashion.  This emulation will only work if
5017 setuid scripts have been disabled in your kernel.
5018
5019 EOM
5020         case "$d_dosuid" in
5021         "$define") dflt=y ;;
5022         *) dflt=n ;;
5023         esac
5024         rp="Do you want to do setuid/setgid emulation?"
5025         . ./myread
5026         case "$ans" in
5027         [yY]*)  val="$define";;
5028         *)      val="$undef";;
5029         esac
5030         ;;
5031 esac
5032 set d_dosuid
5033 eval $setvar
5034
5035 : determine filename position in cpp output
5036 echo " "
5037 echo "Computing filename position in cpp output for #include directives..." >&4
5038 echo '#include <stdio.h>' > foo.c
5039 $cat >fieldn <<EOF
5040 $startsh
5041 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5042 $grep '^[       ]*#.*stdio\.h' | \
5043 while read cline; do
5044         pos=1
5045         set \$cline
5046         while $test \$# -gt 0; do
5047                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5048                         echo "\$pos"
5049                         exit 0
5050                 fi
5051                 shift
5052                 pos=\`expr \$pos + 1\`
5053         done
5054 done
5055 EOF
5056 chmod +x fieldn
5057 fieldn=`./fieldn`
5058 $rm -f foo.c fieldn
5059 case $fieldn in
5060 '') pos='???';;
5061 1) pos=first;;
5062 2) pos=second;;
5063 3) pos=third;;
5064 *) pos="${fieldn}th";;
5065 esac
5066 echo "Your cpp writes the filename in the $pos field of the line."
5067
5068 : locate header file
5069 $cat >findhdr <<EOF
5070 $startsh
5071 wanted=\$1
5072 name=''
5073 for usrincdir in $usrinc
5074 do
5075         if test -f \$usrincdir/\$wanted; then
5076                 echo "\$usrincdir/\$wanted"
5077                 exit 0
5078         fi
5079 done
5080 awkprg='{ print \$$fieldn }'
5081 echo "#include <\$wanted>" > foo\$\$.c
5082 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5083 $grep "^[       ]*#.*\$wanted" | \
5084 while read cline; do
5085         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5086         case "\$name" in
5087         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5088         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5089         *) exit 2;;
5090         esac;
5091 done;
5092 #
5093 # status = 0: grep returned 0 lines, case statement not executed
5094 # status = 1: headerfile found
5095 # status = 2: while loop executed, no headerfile found
5096 #
5097 status=\$?
5098 $rm -f foo\$\$.c;
5099 if test \$status -eq 1; then
5100         exit 0;
5101 fi
5102 exit 1
5103 EOF
5104 chmod +x findhdr
5105
5106 : define an alternate in-header-list? function
5107 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5108 cont=true; xxf="echo \"<\$1> found.\" >&4";
5109 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5110 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5111 esac;
5112 case $# in 4) instead=instead;; *) instead="at last";; esac;
5113 while $test "$cont"; do
5114         xxx=`./findhdr $1`
5115         var=$2; eval "was=\$$2";
5116         if $test "$xxx" && $test -r "$xxx";
5117         then eval $xxf;
5118         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5119                 cont="";
5120         else eval $xxnf;
5121         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5122         set $yyy; shift; shift; yyy=$@;
5123         case $# in 0) cont="";;
5124         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5125                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5126         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5127                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5128         esac;
5129 done;
5130 while $test "$yyy";
5131 do set $yyy; var=$2; eval "was=\$$2";
5132         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5133         set $yyy; shift; shift; yyy=$@;
5134 done'
5135
5136 : see if this is a malloc.h system
5137 set malloc.h i_malloc
5138 eval $inhdr
5139
5140 : see if stdlib is available
5141 set stdlib.h i_stdlib
5142 eval $inhdr
5143
5144 : determine which malloc to compile in
5145 echo " "
5146 case "$usemymalloc" in
5147 ''|[yY]*|true|$define)  dflt='y' ;;
5148 *)      dflt='n' ;;
5149 esac
5150 rp="Do you wish to attempt to use the malloc that comes with $package?"
5151 . ./myread
5152 usemymalloc="$ans"
5153 case "$ans" in
5154 y*|true)
5155         usemymalloc='y'
5156         mallocsrc='malloc.c'
5157         mallocobj="malloc$_o"
5158         d_mymalloc="$define"
5159         case "$libs" in
5160         *-lmalloc*)
5161                 : Remove malloc from list of libraries to use
5162                 echo "Removing unneeded -lmalloc from library list" >&4
5163                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5164                 shift
5165                 libs="$*"
5166                 echo "libs = $libs" >&4
5167                 ;;
5168         esac
5169         ;;
5170 *)
5171         usemymalloc='n'
5172         mallocsrc=''
5173         mallocobj=''
5174         d_mymalloc="$undef"
5175         ;;
5176 esac
5177
5178 : compute the return types of malloc and free
5179 echo " "
5180 $cat >malloc.c <<END
5181 #$i_malloc I_MALLOC
5182 #$i_stdlib I_STDLIB
5183 #include <stdio.h>
5184 #include <sys/types.h>
5185 #ifdef I_MALLOC
5186 #include <malloc.h>
5187 #endif
5188 #ifdef I_STDLIB
5189 #include <stdlib.h>
5190 #endif
5191 #ifdef TRY_MALLOC
5192 void *malloc();
5193 #endif
5194 #ifdef TRY_FREE
5195 void free();
5196 #endif
5197 END
5198 case "$malloctype" in
5199 '')
5200         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5201                 malloctype='void *'
5202         else
5203                 malloctype='char *'
5204         fi
5205         ;;
5206 esac
5207 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5208
5209 case "$freetype" in
5210 '')
5211         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5212                 freetype='void'
5213         else
5214                 freetype='int'
5215         fi
5216         ;;
5217 esac
5218 echo "Your system uses $freetype free(), it would seem." >&4
5219 $rm -f malloc.[co]
5220 $cat <<EOM
5221
5222 The installation process will also create a directory for
5223 vendor-supplied add-ons.  Vendors who supply perl with their system
5224 may find it convenient to place all vendor-supplied files in this
5225 directory rather than in the main distribution directory.  This will
5226 ease upgrades between binary-compatible maintenance versions of perl.
5227
5228 Of course you may also use these directories in whatever way you see
5229 fit.  For example, you might use them to access modules shared over a
5230 company-wide network.
5231
5232 The default answer should be fine for most people.
5233 This causes further questions about vendor add-ons to be skipped
5234 and no vendor-specific directories will be configured for perl.
5235
5236 EOM
5237 rp='Do you want to configure vendor-specific add-on directories?'
5238 case "$usevendorprefix" in
5239 define|true|[yY]*) dflt=y ;;
5240 *)      : User may have set vendorprefix directly on Configure command line.
5241         case "$vendorprefix" in
5242         ''|' ') dflt=n ;;
5243         *)      dflt=y ;;
5244         esac
5245         ;;
5246 esac
5247 . ./myread
5248 case "$ans" in
5249 [yY]*)  fn=d~+
5250         rp='Installation prefix to use for vendor-supplied add-ons?'
5251         case "$vendorprefix" in
5252         '') dflt='' ;;
5253         *)  dflt=$vendorprefix ;;
5254         esac
5255         . ./getfile
5256         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5257         oldvendorprefix=''
5258         case "$vendorprefix" in
5259         '') ;;
5260         *)      case "$ans" in
5261                 "$prefix") ;;
5262                 *) oldvendorprefix="$prefix";;
5263                 esac
5264                 ;;
5265         esac
5266         usevendorprefix="$define"
5267         vendorprefix="$ans"
5268         vendorprefixexp="$ansexp"
5269         ;;
5270 *)      usevendorprefix="$undef"
5271         vendorprefix=''
5272         vendorprefixexp=''
5273         ;;
5274 esac
5275
5276 case "$vendorprefix" in
5277 '')     d_vendorlib="$undef"
5278         vendorlib=''
5279         vendorlibexp=''
5280         ;;
5281 *)      d_vendorlib="$define"
5282         : determine where vendor-supplied modules go.
5283         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5284         case "$vendorlib" in
5285         '')
5286                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5287                 case "$installstyle" in
5288                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5289                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5290                 esac
5291                 ;;
5292         *)      dflt="$vendorlib"
5293                 ;;
5294         esac
5295         fn=d~+
5296         rp='Pathname for the vendor-supplied library files?'
5297         . ./getfile
5298         vendorlib="$ans"
5299         vendorlibexp="$ansexp"
5300         ;;
5301 esac
5302 : Change installation prefix, if necessary.
5303 if $test X"$prefix" != X"$installprefix"; then
5304         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5305 else
5306         installvendorlib="$vendorlibexp"
5307 fi
5308
5309 : Cruising for prototypes
5310 echo " "
5311 echo "Checking out function prototypes..." >&4
5312 $cat >prototype.c <<'EOCP'
5313 int main(int argc, char *argv[]) {
5314         exit(0);}
5315 EOCP
5316 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5317         echo "Your C compiler appears to support function prototypes."
5318         val="$define"
5319 else
5320         echo "Your C compiler doesn't seem to understand function prototypes."
5321         val="$undef"
5322 fi
5323 set prototype
5324 eval $setvar
5325 $rm -f prototype*
5326
5327 case "$prototype" in
5328 "$define") ;;
5329 *)      ansi2knr='ansi2knr'
5330         echo " "
5331         cat <<EOM >&4
5332
5333 $me:  FATAL ERROR:
5334 This version of $package can only be compiled by a compiler that 
5335 understands function prototypes.  Unfortunately, your C compiler 
5336         $cc $ccflags
5337 doesn't seem to understand them.  Sorry about that.
5338
5339 If GNU cc is available for your system, perhaps you could try that instead.  
5340
5341 Eventually, we hope to support building Perl with pre-ANSI compilers.
5342 If you would like to help in that effort, please contact <perlbug@perl.org>.
5343
5344 Aborting Configure now.
5345 EOM
5346         exit 2
5347         ;;
5348 esac
5349
5350 : determine where public executables go
5351 echo " "
5352 set dflt bin bin
5353 eval $prefixit
5354 fn=d~
5355 rp='Pathname where the public executables will reside?'
5356 . ./getfile
5357 if $test "X$ansexp" != "X$binexp"; then
5358         installbin=''
5359 fi
5360 bin="$ans"
5361 binexp="$ansexp"
5362 : Change installation prefix, if necessary.
5363 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5364 if $test X"$prefix" != X"$installprefix"; then
5365         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5366 else
5367         installbin="$binexp"
5368 fi
5369
5370 : Find perl5.005 or later.
5371 echo "Looking for a previously installed perl5.005 or later... "
5372 case "$perl5" in
5373 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5374                 : Check if this perl is recent and can load a simple module
5375                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5376                         perl5=$tdir/perl
5377                         break;
5378                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5379                         perl5=$tdir/perl
5380                         break;
5381                 fi
5382         done
5383         ;;
5384 *)      perl5="$perl5"
5385         ;;
5386 esac
5387 case "$perl5" in
5388 '')     echo "None found.  That's ok.";;
5389 *)      echo "Using $perl5." ;;
5390 esac
5391
5392 $cat <<EOM
5393
5394 After $package is installed, you may wish to install various
5395 add-on modules and utilities.  Typically, these add-ons will
5396 be installed under $prefix with the rest
5397 of this package.  However, you may wish to install such add-ons
5398 elsewhere under a different prefix.
5399
5400 If you do not wish to put everything under a single prefix, that's
5401 ok.  You will be prompted for the individual locations; this siteprefix
5402 is only used to suggest the defaults.
5403
5404 The default should be fine for most people.
5405
5406 EOM
5407 fn=d~+
5408 rp='Installation prefix to use for add-on modules and utilities?'
5409 : XXX Here might be another good place for an installstyle setting.
5410 case "$siteprefix" in
5411 '') dflt=$prefix ;;
5412 *)  dflt=$siteprefix ;;
5413 esac
5414 . ./getfile
5415 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5416 oldsiteprefix=''
5417 case "$siteprefix" in
5418 '') ;;
5419 *)      case "$ans" in
5420         "$prefix") ;;
5421         *) oldsiteprefix="$prefix";;
5422         esac
5423         ;;
5424 esac
5425 siteprefix="$ans"
5426 siteprefixexp="$ansexp"
5427
5428 : determine where site specific libraries go.
5429 : Usual default is /usr/local/lib/perl5/site_perl/$version
5430 : The default "style" setting is made in installstyle.U
5431 : XXX No longer works with Prefixit stuff.
5432 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5433 case "$sitelib" in
5434 '') case "$installstyle" in
5435         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5436         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5437         esac
5438         ;;
5439 *)      dflt="$sitelib"
5440         ;;
5441 esac
5442 $cat <<EOM
5443
5444 The installation process will create a directory for
5445 site-specific extensions and modules.  Most users find it convenient
5446 to place all site-specific files in this directory rather than in the
5447 main distribution directory.
5448
5449 EOM
5450 fn=d~+
5451 rp='Pathname for the site-specific library files?'
5452 . ./getfile
5453 sitelib="$ans"
5454 sitelibexp="$ansexp"
5455 : Change installation prefix, if necessary.
5456 if $test X"$prefix" != X"$installprefix"; then
5457         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5458 else
5459         installsitelib="$sitelibexp"
5460 fi
5461
5462 : Determine list of previous versions to include in @INC
5463 $cat > getverlist <<EOPL
5464 #!$perl5 -w
5465 use File::Basename;
5466 \$api_versionstring = "$api_versionstring";
5467 \$version = "$version";
5468 \$sitelib = "$sitelib";
5469 \$archname = "$archname";
5470 EOPL
5471         $cat >> getverlist <<'EOPL'
5472 # Can't have leading @ because metaconfig interprets it as a command!
5473 ;@inc_version_list=();
5474 $stem=dirname($sitelib);
5475 # XXX Redo to do opendir/readdir? 
5476 if (-d $stem) {
5477     chdir($stem);
5478     ;@candidates = glob("5.*");
5479 }
5480 else {
5481     ;@candidates = ();
5482 }
5483
5484 # XXX ToDo:  These comparisons must be reworked when two-digit
5485 # subversions come along, so that 5.7.10 compares as greater than
5486 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5487 # widespread that we can use the built-in version vectors rather
5488 # than reinventing them here.  For 5.6.0, however, we must
5489 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5490 foreach $d (@candidates) {
5491     if ($d lt $version) {
5492         if ($d ge $api_versionstring) {
5493             unshift(@inc_version_list, "$d/$archname", $d);
5494         }
5495         elsif ($d ge "5.005") {
5496             unshift(@inc_version_list, $d);
5497         }
5498     }
5499     else {
5500         # Skip newer version.  I.e. don't look in
5501         # 5.7.0 if we're installing 5.6.1.
5502     }
5503 }
5504
5505 if (@inc_version_list) {
5506     print join(' ', @inc_version_list);
5507 }
5508 else {
5509     # Blank space to preserve value for next Configure run.
5510     print " ";
5511 }
5512 EOPL
5513 chmod +x getverlist
5514 case "$inc_version_list" in
5515 '')     if test -x "$perl5"; then
5516                 dflt=`$perl5 getverlist`
5517         else
5518                 dflt='none'
5519         fi
5520         ;;
5521 $undef) dflt='none' ;;
5522 *)  dflt="$inc_version_list" ;;
5523 esac
5524 case "$dflt" in
5525 ''|' ') dflt=none ;;
5526 esac
5527 $cat <<'EOM'
5528
5529 In order to ease the process of upgrading, this version of perl 
5530 can be configured to use modules built and installed with earlier 
5531 versions of perl that were installed under $prefix.  Specify here
5532 the list of earlier versions that this version of perl should check.
5533 If Configure detected no earlier versions of perl installed under
5534 $prefix, then the list will be empty.  Answer 'none' to tell perl
5535 to not search earlier versions.
5536
5537 The default should almost always be sensible, so if you're not sure,
5538 just accept the default.
5539 EOM
5540
5541 rp='List of earlier versions to include in @INC?'
5542 . ./myread
5543 case "$ans" in
5544 [Nn]one|''|' ') inc_version_list=' ' ;;
5545 *) inc_version_list="$ans" ;;
5546 esac
5547 case "$inc_version_list" in
5548 ''|' ') 
5549         inc_version_list_init='0';;
5550 *)      inc_version_list_init=`echo $inc_version_list |
5551                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5552         ;;
5553 esac
5554 $rm -f getverlist
5555
5556 : determine whether to install perl also as /usr/bin/perl
5557
5558 echo " "
5559 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5560         $cat <<EOM
5561 Many scripts expect to perl to be installed as /usr/bin/perl.
5562 I can install the perl you are about to compile also as /usr/bin/perl
5563 (in addition to $installbin/perl).
5564 EOM
5565         case "$installusrbinperl" in
5566         "$undef"|[nN]*) dflt='n';;
5567         *)              dflt='y';;
5568         esac
5569         rp="Do you want to install perl as /usr/bin/perl?"
5570         . ./myread
5571         case "$ans" in
5572         [yY]*)  val="$define";;
5573         *)      val="$undef" ;;
5574         esac
5575 else
5576         val="$undef"
5577 fi
5578 set installusrbinperl
5579 eval $setvar
5580
5581 echo " "
5582 echo "Checking for GNU C Library..." >&4
5583 cat >gnulibc.c <<EOM
5584 #include <stdio.h>
5585 int main()
5586 {
5587 #ifdef __GLIBC__
5588     exit(0);
5589 #else
5590     exit(1);
5591 #endif
5592 }
5593 EOM
5594 set gnulibc
5595 if eval $compile_ok && ./gnulibc; then
5596         val="$define"
5597         echo "You are using the GNU C Library"
5598 else
5599         val="$undef"
5600         echo "You are not using the GNU C Library"
5601 fi
5602 $rm -f gnulibc*
5603 set d_gnulibc
5604 eval $setvar
5605
5606 : see if nm is to be used to determine whether a symbol is defined or not
5607 case "$usenm" in
5608 '')
5609         dflt=''
5610         case "$d_gnulibc" in
5611         "$define")
5612                 echo " "
5613                 echo "nm probably won't work on the GNU C Library." >&4
5614                 dflt=n
5615                 ;;
5616         esac
5617         case "$dflt" in
5618         '') 
5619                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5620                         echo " "
5621                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5622                         echo "'nm' won't be sufficient on this sytem." >&4
5623                         dflt=n
5624                 fi
5625                 ;;
5626         esac
5627         case "$dflt" in
5628         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5629                 if $test $dflt -gt 20; then
5630                         dflt=y
5631                 else
5632                         dflt=n
5633                 fi
5634                 ;;
5635         esac
5636         ;;
5637 *)
5638         case "$usenm" in
5639         true|$define) dflt=y;;
5640         *) dflt=n;;
5641         esac
5642         ;;
5643 esac
5644 $cat <<EOM
5645
5646 I can use $nm to extract the symbols from your C libraries. This
5647 is a time consuming task which may generate huge output on the disk (up
5648 to 3 megabytes) but that should make the symbols extraction faster. The
5649 alternative is to skip the 'nm' extraction part and to compile a small
5650 test program instead to determine whether each symbol is present. If
5651 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5652 this may be the best solution.
5653
5654 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5655
5656 EOM
5657 rp="Shall I use $nm to extract C symbols from the libraries?"
5658 . ./myread
5659 case "$ans" in
5660 [Nn]*) usenm=false;;
5661 *) usenm=true;;
5662 esac
5663
5664 runnm=$usenm
5665 case "$reuseval" in
5666 true) runnm=false;;
5667 esac
5668
5669 : nm options which may be necessary
5670 case "$nm_opt" in
5671 '') if $test -f /mach_boot; then
5672                 nm_opt=''       # Mach
5673         elif $test -d /usr/ccs/lib; then
5674                 nm_opt='-p'     # Solaris (and SunOS?)
5675         elif $test -f /dgux; then
5676                 nm_opt='-p'     # DG-UX
5677         elif $test -f /lib64/rld; then
5678                 nm_opt='-p'     # 64-bit Irix
5679         else
5680                 nm_opt=''
5681         fi;;
5682 esac
5683
5684 : nm options which may be necessary for shared libraries but illegal
5685 : for archive libraries.  Thank you, Linux.
5686 case "$nm_so_opt" in
5687 '')     case "$myuname" in
5688         *linux*)
5689                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5690                         nm_so_opt='--dynamic'
5691                 fi
5692                 ;;
5693         esac
5694         ;;
5695 esac
5696
5697 case "$runnm" in
5698 true)
5699 : get list of predefined functions in a handy place
5700 echo " "
5701 case "$libc" in
5702 '') libc=unknown
5703         case "$libs" in
5704         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5705         esac
5706         ;;
5707 esac
5708 libnames='';
5709 case "$libs" in
5710 '') ;;
5711 *)  for thislib in $libs; do
5712         case "$thislib" in
5713         -lc|-lc_s)
5714                 : Handle C library specially below.
5715                 ;;
5716         -l*)
5717                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5718                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5719                         :
5720                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5721                         :
5722                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5723                         :
5724                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5725                         :
5726                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5727                         :
5728                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5729                         :
5730                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5731                         :
5732                 else
5733                         try=''
5734                 fi
5735                 libnames="$libnames $try"
5736                 ;;
5737         *) libnames="$libnames $thislib" ;;
5738         esac
5739         done
5740         ;;
5741 esac
5742 xxx=normal
5743 case "$libc" in
5744 unknown)
5745         set /lib/libc.$so
5746         for xxx in $libpth; do
5747                 $test -r $1 || set $xxx/libc.$so
5748                 : The messy sed command sorts on library version numbers.
5749                 $test -r $1 || \
5750                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5751                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5752                                 h
5753                                 s/[0-9][0-9]*/0000&/g
5754                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5755                                 G
5756                                 s/\n/ /' | \
5757                          sort | $sed -e 's/^.* //'`
5758                 eval set \$$#
5759         done
5760         $test -r $1 || set /usr/ccs/lib/libc.$so
5761         $test -r $1 || set /lib/libsys_s$_a
5762         ;;
5763 *)
5764         set blurfl
5765         ;;
5766 esac
5767 if $test -r "$1"; then
5768         echo "Your (shared) C library seems to be in $1."
5769         libc="$1"
5770 elif $test -r /lib/libc && $test -r /lib/clib; then
5771         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5772         xxx=apollo
5773         libc='/lib/clib /lib/libc'
5774         if $test -r /lib/syslib; then
5775                 echo "(Your math library is in /lib/syslib.)"
5776                 libc="$libc /lib/syslib"
5777         fi
5778 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5779         echo "Your C library seems to be in $libc, as you said before."
5780 elif $test -r $incpath/usr/lib/libc$_a; then
5781         libc=$incpath/usr/lib/libc$_a;
5782         echo "Your C library seems to be in $libc.  That's fine."
5783 elif $test -r /lib/libc$_a; then
5784         libc=/lib/libc$_a;
5785         echo "Your C library seems to be in $libc.  You're normal."
5786 else
5787         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5788                 :
5789         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5790                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5791         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5792                 :
5793         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5794                 :
5795         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5796                 :
5797         else
5798                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5799         fi
5800         if $test -r "$tans"; then
5801                 echo "Your C library seems to be in $tans, of all places."
5802                 libc=$tans
5803         else
5804                 libc='blurfl'
5805         fi
5806 fi
5807 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5808         dflt="$libc"
5809         cat <<EOM
5810
5811 If the guess above is wrong (which it might be if you're using a strange
5812 compiler, or your machine supports multiple models), you can override it here.
5813
5814 EOM
5815 else
5816         dflt=''
5817         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5818         cat >&4 <<EOM
5819 I can't seem to find your C library.  I've looked in the following places:
5820
5821 EOM
5822         $sed 's/^/      /' libpath
5823         cat <<EOM
5824
5825 None of these seems to contain your C library. I need to get its name...
5826
5827 EOM
5828 fi
5829 fn=f
5830 rp='Where is your C library?'
5831 . ./getfile
5832 libc="$ans"
5833
5834 echo " "
5835 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5836 set X `cat libnames`
5837 shift
5838 xxx=files
5839 case $# in 1) xxx=file; esac
5840 echo "Extracting names from the following $xxx for later perusal:" >&4
5841 echo " "
5842 $sed 's/^/      /' libnames >&4
5843 echo " "
5844 $echo $n "This may take a while...$c" >&4
5845
5846 for file in $*; do
5847         case $file in
5848         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5849         *) $nm $nm_opt $file 2>/dev/null;;
5850         esac
5851 done >libc.tmp
5852
5853 $echo $n ".$c"
5854 $grep fprintf libc.tmp > libc.ptf
5855 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5856 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5857 xxx='[ADTSIW]'
5858 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5859         eval $xscan;\
5860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5861                 eval $xrun
5862 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5863         eval $xscan;\
5864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5865                 eval $xrun
5866 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5867         eval $xscan;\
5868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5869                 eval $xrun
5870 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5871         eval $xscan;\
5872         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5873                 eval $xrun
5874 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5875         eval $xscan;\
5876         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5877                 eval $xrun
5878 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5879         eval $xscan;\
5880         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5881                 eval $xrun
5882 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5883                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5884         eval $xscan;\
5885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5886                 eval $xrun
5887 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5888         eval $xscan;\
5889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5890                 eval $xrun
5891 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5892         eval $xscan;\
5893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5894                 eval $xrun
5895 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5896         eval $xscan;\
5897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5898                 eval $xrun
5899 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5900         eval $xscan;\
5901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5902                 eval $xrun
5903 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5904         eval $xscan;\
5905         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5906                 eval $xrun
5907 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5908         eval $xscan;\
5909         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5910                 eval $xrun
5911 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5912         eval $xscan;\
5913         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5914                 eval $xrun
5915 else
5916         $nm -p $* 2>/dev/null >libc.tmp
5917         $grep fprintf libc.tmp > libc.ptf
5918         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5919                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5920         then
5921                 nm_opt='-p'
5922                 eval $xrun
5923         else
5924                 echo " "
5925                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5926                 com=''
5927                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5928                         for thisname in $libnames $libc; do
5929                                 $ar t $thisname >>libc.tmp
5930                         done
5931                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5932                         echo "Ok." >&4
5933                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5934                         # Repeat libc to extract forwarders to DLL entries too
5935                         for thisname in $libnames $libc; do
5936                                 $ar tv $thisname >>libc.tmp
5937                                 # Revision 50 of EMX has bug in $ar.
5938                                 # it will not extract forwarders to DLL entries
5939                                 # Use emximp which will extract exactly them.
5940                                 emximp -o tmp.imp $thisname \
5941                                     2>/dev/null && \
5942                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5943                                     < tmp.imp >>libc.tmp
5944                                 $rm tmp.imp
5945                         done
5946                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5947                         echo "Ok." >&4
5948                 else
5949                         echo "$ar didn't seem to work right." >&4
5950                         echo "Maybe this is a Cray...trying bld instead..." >&4
5951                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5952                         then
5953                                 for thisname in $libnames; do
5954                                         bld t $libnames | \
5955                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5956                                         $ar t $thisname >>libc.tmp
5957                                 done
5958                                 echo "Ok." >&4
5959                         else
5960                                 echo "That didn't work either.  Giving up." >&4
5961                                 exit 1
5962                         fi
5963                 fi
5964         fi
5965 fi
5966 nm_extract="$com"
5967 if $test -f /lib/syscalls.exp; then
5968         echo " "
5969         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5970         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5971 fi
5972 ;;
5973 esac
5974 $rm -f libnames libpath
5975
5976 : see if dld is available
5977 set dld.h i_dld
5978 eval $inhdr
5979
5980 : is a C symbol defined?
5981 csym='tlook=$1;
5982 case "$3" in
5983 -v) tf=libc.tmp; tc=""; tdc="";;
5984 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5985 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5986 esac;
5987 tx=yes;
5988 case "$reuseval-$4" in
5989 true-) ;;
5990 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5991 esac;
5992 case "$tx" in
5993 yes)
5994         case "$runnm" in
5995         true)
5996                 if $contains $tlook $tf >/dev/null 2>&1;
5997                 then tval=true;
5998                 else tval=false;
5999                 fi;;
6000         *)
6001                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6002                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6003                 then tval=true;
6004                 else tval=false;
6005                 fi;
6006                 $rm -f t t.c;;
6007         esac;;
6008 *)
6009         case "$tval" in
6010         $define) tval=true;;
6011         *) tval=false;;
6012         esac;;
6013 esac;
6014 eval "$2=$tval"'
6015
6016 : define an is-in-libc? function
6017 inlibc='echo " "; td=$define; tu=$undef;
6018 sym=$1; var=$2; eval "was=\$$2";
6019 tx=yes;
6020 case "$reuseval$was" in
6021 true) ;;
6022 true*) tx=no;;
6023 esac;
6024 case "$tx" in
6025 yes)
6026         set $sym tres -f;
6027         eval $csym;
6028         case "$tres" in
6029         true)
6030                 echo "$sym() found." >&4;
6031                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6032         *)
6033                 echo "$sym() NOT found." >&4;
6034                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6035         esac;;
6036 *)
6037         case "$was" in
6038         $define) echo "$sym() found." >&4;;
6039         *) echo "$sym() NOT found." >&4;;
6040         esac;;
6041 esac'
6042
6043 : see if dlopen exists
6044 xxx_runnm="$runnm"
6045 runnm=false
6046 set dlopen d_dlopen
6047 eval $inlibc
6048 runnm="$xxx_runnm"
6049
6050 : determine which dynamic loading, if any, to compile in
6051 echo " "
6052 dldir="ext/DynaLoader"
6053 case "$usedl" in
6054 $define|y|true)
6055         dflt='y'
6056         usedl="$define"
6057         ;;
6058 $undef|n|false)
6059         dflt='n'
6060         usedl="$undef"
6061         ;;
6062 *) 
6063         dflt='n'
6064         case "$d_dlopen" in
6065             $define) dflt='y' ;;
6066         esac
6067         case "$i_dld" in
6068             $define) dflt='y' ;;
6069         esac
6070         : Does a dl_xxx.xs file exist for this operating system
6071         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6072         ;;
6073 esac
6074 rp="Do you wish to use dynamic loading?"
6075 . ./myread
6076 usedl="$ans"
6077 case "$ans" in
6078 y*) usedl="$define"
6079         case "$dlsrc" in
6080         '')
6081                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6082                         dflt="$dldir/dl_${osname}.xs"
6083                 elif $test "$d_dlopen" = "$define" ; then
6084                         dflt="$dldir/dl_dlopen.xs"
6085                 elif $test "$i_dld" = "$define" ; then
6086                         dflt="$dldir/dl_dld.xs"
6087                 else
6088                         dflt=''
6089                 fi
6090                 ;;
6091         *)      dflt="$dldir/$dlsrc"
6092                 ;;
6093         esac
6094     echo "The following dynamic loading files are available:"
6095         : Can not go over to $dldir because getfile has path hard-coded in.
6096         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6097         rp="Source file to use for dynamic loading"
6098         fn="fne"
6099         gfpth="$src"
6100         . ./getfile
6101         usedl="$define"
6102         : emulate basename
6103         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6104
6105         $cat << EOM
6106
6107 Some systems may require passing special flags to $cc -c to
6108 compile modules that will be used to create a shared library.
6109 To use no flags, say "none".
6110
6111 EOM
6112     case "$cccdlflags" in
6113     '') case "$gccversion" in
6114                 '') case "$osname" in
6115                         hpux)   dflt='+z' ;;
6116                         next)   dflt='none' ;;
6117                         irix*)  dflt='-KPIC' ;;
6118                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6119                         sunos)  dflt='-pic' ;;
6120                         *)      dflt='none' ;;
6121                     esac
6122                         ;;
6123                 *)  case "$osname" in
6124                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6125                         *)      dflt='-fpic' ;;
6126                     esac ;;
6127             esac ;;
6128         ' ') dflt='none' ;;
6129     *)  dflt="$cccdlflags" ;;
6130     esac
6131     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6132     . ./myread
6133     case "$ans" in
6134     none) cccdlflags=' ' ;;
6135     *) cccdlflags="$ans" ;;
6136     esac
6137
6138     cat << EOM
6139
6140 Some systems use ld to create libraries that can be dynamically loaded,
6141 while other systems (such as those using ELF) use $cc.
6142
6143 EOM
6144         case "$ld" in
6145         '')     $cat >try.c <<'EOM'
6146 /* Test for whether ELF binaries are produced */
6147 #include <fcntl.h>
6148 #include <stdlib.h>
6149 int main() {
6150         char b[4];
6151         int i = open("a.out",O_RDONLY);
6152         if(i == -1) 
6153                 exit(1); /* fail */
6154         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6155                 exit(0); /* succeed (yes, it's ELF) */
6156         else
6157                 exit(1); /* fail */
6158 }
6159 EOM
6160                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6161                         cat <<EOM
6162 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6163 EOM
6164                         dflt="$cc"
6165                 else
6166                         echo "I'll use ld to build dynamic libraries."
6167                         dflt='ld'
6168                 fi
6169                 rm -f try.c a.out
6170                 ;;
6171         *)      dflt="$ld"
6172                 ;;
6173         esac
6174
6175     rp="What command should be used to create dynamic libraries?"
6176     . ./myread
6177         ld="$ans"
6178
6179     cat << EOM
6180
6181 Some systems may require passing special flags to $ld to create a
6182 library that can be dynamically loaded.  If your ld flags include
6183 -L/other/path options to locate libraries outside your loader's normal
6184 search path, you may need to specify those -L options here as well.  To
6185 use no flags, say "none".
6186
6187 EOM
6188     case "$lddlflags" in
6189     '') case "$osname" in
6190                         beos) dflt='-nostart' ;;
6191                         hpux)  dflt='-b +vnocompatwarnings' ;;
6192                         linux|irix*)    dflt='-shared' ;;
6193                         next)  dflt='none' ;;
6194                         solaris) dflt='-G' ;;
6195                         sunos) dflt='-assert nodefinitions' ;;
6196                         svr4*|esix*) dflt="-G $ldflags" ;;
6197                 *)     dflt='none' ;;
6198                         esac
6199                         ;;
6200     *) dflt="$lddlflags" ;;
6201     esac
6202
6203         : Try to guess additional flags to pick up local libraries.
6204         : Be careful not to append to a plain 'none'
6205         case "$dflt" in
6206         none) dflt='' ;;
6207         esac
6208         for thisflag in $ldflags; do
6209                 case "$thisflag" in
6210                 -L*)
6211                         case " $dflt " in
6212                         *" $thisflag "*) ;;
6213                         *) dflt="$dflt $thisflag" ;;
6214                         esac
6215                         ;;
6216                 esac
6217         done
6218
6219         case "$dflt" in
6220         ''|' ') dflt='none' ;;
6221         esac
6222
6223     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6224     . ./myread
6225     case "$ans" in
6226     none) lddlflags=' ' ;;
6227     *) lddlflags="$ans" ;;
6228     esac
6229
6230         cat <<EOM
6231
6232 Some systems may require passing special flags to $cc to indicate that
6233 the resulting executable will use dynamic linking.  To use no flags,
6234 say "none".
6235
6236 EOM
6237     case "$ccdlflags" in
6238     '') case "$osname" in
6239                 hpux)   dflt='-Wl,-E' ;;
6240                 linux)  dflt='-rdynamic' ;;
6241                 next)   dflt='none' ;;
6242                 sunos)  dflt='none' ;;
6243                 *)      dflt='none' ;;
6244             esac ;;
6245     ' ')  dflt='none' ;;
6246     *)  dflt="$ccdlflags" ;;
6247     esac
6248     rp="Any special flags to pass to $cc to use dynamic linking?"
6249     . ./myread
6250     case "$ans" in
6251     none) ccdlflags=' ' ;;
6252     *) ccdlflags="$ans" ;;
6253     esac
6254     ;;
6255 *)  usedl="$undef"
6256         ld='ld'
6257     dlsrc='dl_none.xs'
6258     lddlflags=''
6259     ccdlflags=''
6260     ;;
6261 esac
6262
6263 also=''
6264 case "$usedl" in
6265 $undef)
6266         # No dynamic loading being used, so don't bother even to prompt.
6267         useshrplib='false'
6268         ;;
6269 *)      case "$useshrplib" in
6270         '')     case "$osname" in
6271                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6272                         dflt=y
6273                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6274                         ;;
6275                 next*)
6276                         case "$osvers" in
6277                         4*)     dflt=y
6278                                 also='Building a shared libperl is needed for MAB support.'
6279                                 ;;
6280                         *)      dflt=n
6281                                 ;;
6282                         esac
6283                         ;;
6284                 *)      dflt=n
6285                         ;;
6286                 esac
6287                 ;;
6288         $define|true|[Yy]*)
6289                 dflt=y
6290                 ;;
6291         *)      dflt=n
6292                 ;;
6293         esac
6294         $cat << EOM
6295
6296 The perl executable is normally obtained by linking perlmain.c with
6297 libperl${_a}, any static extensions (usually just DynaLoader), and
6298 any other libraries needed on this system (such as -lm, etc.).  Since
6299 your system supports dynamic loading, it is probably possible to build
6300 a shared libperl.$so.  If you will have more than one executable linked
6301 to libperl.$so, this will significantly reduce the size of each
6302 executable, but it may have a noticeable affect on performance.  The
6303 default is probably sensible for your system.
6304 $also
6305
6306 EOM
6307         rp="Build a shared libperl.$so (y/n)"
6308         . ./myread
6309         case "$ans" in
6310         true|$define|[Yy]*)
6311                 useshrplib='true'  ;;
6312         *)      useshrplib='false' ;;
6313         esac
6314         ;;
6315 esac
6316
6317 case "$useshrplib" in
6318 true)
6319         case "$libperl" in
6320         '')
6321                 # Figure out a good name for libperl.so.  Since it gets stored in
6322                 # a version-specific architecture-dependent library, the version
6323                 # number isn't really that important, except for making cc/ld happy.
6324                 #
6325                 # A name such as libperl.so.3.1
6326                 majmin="libperl.$so.$patchlevel.$subversion"
6327                 # A name such as libperl.so.301
6328                 majonly=`echo $patchlevel $subversion |
6329                         $awk '{printf "%d%02d", $1, $2}'`
6330                 majonly=libperl.$so.$majonly
6331                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6332                 # rely on figuring it out from the naming of libc.
6333                 case "${osname}${osvers}" in
6334                 next4*)
6335                         dflt=libperl.5.$so
6336                         # XXX How handle the --version stuff for MAB?
6337                         ;;
6338                 linux*)  # ld won't link with a bare -lperl otherwise.
6339                         dflt=libperl.$so
6340                         ;;
6341                 cygwin*) # include version
6342                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6343                         ;;
6344                 *)      # Try to guess based on whether libc has major.minor.
6345                         case "$libc" in
6346                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6347                         *libc.$so.[0-9]*) dflt=$majonly ;;
6348                         *)      dflt=libperl.$so ;;
6349                         esac
6350                         ;;
6351                 esac
6352                 ;;
6353         *)      dflt=$libperl
6354                 ;;
6355         esac
6356         cat << EOM
6357
6358 I need to select a good name for the shared libperl.  If your system uses
6359 library names with major and minor numbers, then you might want something
6360 like $majmin.  Alternatively, if your system uses a single version
6361 number for shared libraries, then you might want to use $majonly.
6362 Or, your system might be quite happy with a simple libperl.$so.
6363
6364 Since the shared libperl will get installed into a version-specific
6365 architecture-dependent directory, the version number of the shared perl
6366 library probably isn't important, so the default should be o.k.
6367
6368 EOM
6369         rp='What name do you want to give to the shared libperl?'
6370         . ./myread
6371         libperl=$ans
6372         echo "Ok, I'll use $libperl"
6373         ;;
6374 *)
6375         libperl="libperl${_a}"
6376         ;;
6377 esac
6378
6379 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6380 case "$shrpdir" in
6381 '') ;;
6382 *)      $cat >&4 <<EOM
6383 WARNING:  Use of the shrpdir variable for the installation location of
6384 the shared $libperl is not supported.  It was never documented and
6385 will not work in this version.  Let me (perlbug@perl.com)
6386 know of any problems this may cause.
6387
6388 EOM
6389         case "$shrpdir" in
6390         "$archlibexp/CORE")
6391                 $cat >&4 <<EOM
6392 But your current setting of $shrpdir is
6393 the default anyway, so it's harmless.
6394 EOM
6395                 ;;
6396         *)
6397                 $cat >&4 <<EOM
6398 Further, your current attempted setting of $shrpdir
6399 conflicts with the value of $archlibexp/CORE
6400 that installperl will use.
6401 EOM
6402                 ;;
6403         esac
6404         ;;
6405 esac
6406
6407 # How will the perl executable find the installed shared $libperl?
6408 # Add $xxx to ccdlflags.
6409 # If we can't figure out a command-line option, use $shrpenv to
6410 # set env LD_RUN_PATH.  The main perl makefile uses this.
6411 shrpdir=$archlibexp/CORE
6412 xxx=''
6413 tmp_shrpenv=''
6414 if "$useshrplib"; then
6415     case "$osname" in 
6416         aix)
6417                 # We'll set it in Makefile.SH...
6418                 ;;
6419         solaris|netbsd)
6420                 xxx="-R $shrpdir"
6421                 ;;
6422         freebsd)
6423                 xxx="-Wl,-R$shrpdir"
6424                 ;;
6425         linux|irix*|dec_osf)
6426                 xxx="-Wl,-rpath,$shrpdir"
6427                 ;;
6428         next)
6429                 # next doesn't like the default...
6430                 ;;
6431         beos)
6432                 # beos doesn't like the default, either.
6433                 ;;
6434         hpux*)
6435                 # hpux doesn't like the default, either.
6436                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6437                 ;;
6438         *)
6439                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6440                 ;;
6441         esac
6442         case "$xxx" in
6443         '') ;;
6444         *)      
6445                 # Only add $xxx if it isn't already in ccdlflags.
6446                 case " $ccdlflags " in
6447                 *" $xxx "*)     ;;
6448                 *)      ccdlflags="$ccdlflags $xxx"
6449                         cat <<EOM >&4
6450
6451 Adding $xxx to the flags
6452 passed to $ld so that the perl executable will find the 
6453 installed shared $libperl.
6454
6455 EOM
6456                         ;;
6457                 esac
6458                 ;;
6459         esac
6460 fi
6461 # Fix ccdlflags in AIX for building external extensions.
6462 # (For building Perl itself bare -bE:perl.exp is needed,
6463 #  Makefile.SH takes care of this.)
6464 case "$osname" in
6465 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6466 esac
6467 # Respect a hint or command-line value.
6468 case "$shrpenv" in
6469 '') shrpenv="$tmp_shrpenv" ;;
6470 esac
6471 case "$ldlibpthname" in
6472 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6473 none)   ldlibpthname='' ;;
6474 esac
6475
6476 : determine where manual pages go
6477 set man1dir man1dir none
6478 eval $prefixit
6479 $cat <<EOM
6480
6481 $spackage has manual pages available in source form.
6482 EOM
6483 case "$nroff" in
6484 nroff)
6485         echo "However, you don't have nroff, so they're probably useless to you."
6486         case "$man1dir" in
6487         '') man1dir="none";;
6488         esac;;
6489 esac
6490 echo "If you don't want the manual sources installed, answer 'none'."
6491 case "$man1dir" in
6492 ' ') dflt=none
6493         ;;
6494 '')
6495         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6496         lookpath="$lookpath $prefixexp/man/p_man/man1"
6497         lookpath="$lookpath $prefixexp/man/u_man/man1"
6498         lookpath="$lookpath $prefixexp/man/man.1"
6499         case "$sysman" in
6500         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6501         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6502         esac
6503         set dflt
6504         eval $prefixup
6505         ;;
6506 *)  dflt="$man1dir"
6507         ;;
6508 esac
6509 echo " "
6510 fn=dn+~
6511 rp="Where do the main $spackage manual pages (source) go?"
6512 . ./getfile
6513 if $test "X$man1direxp" != "X$ansexp"; then
6514         installman1dir=''
6515 fi
6516 man1dir="$ans"
6517 man1direxp="$ansexp"
6518 case "$man1dir" in
6519 '')     man1dir=' '
6520         installman1dir='';;
6521 esac
6522
6523 : Change installation prefix, if necessary.
6524 if $test X"$prefix" != X"$installprefix"; then
6525         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6526 else
6527         installman1dir="$man1direxp"
6528 fi
6529
6530 : What suffix to use on installed man pages
6531
6532 case "$man1dir" in
6533 ' ')
6534         man1ext='0'
6535         ;;
6536 *)
6537         rp="What suffix should be used for the main $spackage man pages?"
6538         case "$man1ext" in
6539         '')     case "$man1dir" in
6540                 *1)  dflt=1 ;;
6541                 *1p) dflt=1p ;;
6542                 *1pm) dflt=1pm ;;
6543                 *l) dflt=l;;
6544                 *n) dflt=n;;
6545                 *o) dflt=o;;
6546                 *p) dflt=p;;
6547                 *C) dflt=C;;
6548                 *L) dflt=L;;
6549                 *L1) dflt=L1;;
6550                 *) dflt=1;;
6551                 esac
6552                 ;;
6553         *)      dflt="$man1ext";;
6554         esac
6555         . ./myread
6556         man1ext="$ans"
6557         ;;
6558 esac
6559
6560 : see if we can have long filenames
6561 echo " "
6562 rmlist="$rmlist /tmp/cf$$"
6563 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6564 first=123456789abcdef
6565 second=/tmp/cf$$/$first
6566 $rm -f $first $second
6567 if (echo hi >$first) 2>/dev/null; then
6568         if $test -f 123456789abcde; then
6569                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6570                 val="$undef"
6571         else
6572                 if (echo hi >$second) 2>/dev/null; then
6573                         if $test -f /tmp/cf$$/123456789abcde; then
6574                                 $cat <<'EOM'
6575 That's peculiar... You can have filenames longer than 14 characters, but only
6576 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6577 I shall consider your system cannot support long filenames at all.
6578 EOM
6579                                 val="$undef"
6580                         else
6581                                 echo 'You can have filenames longer than 14 characters.' >&4
6582                                 val="$define"
6583                         fi
6584                 else
6585                         $cat <<'EOM'
6586 How confusing! Some of your filesystems are sane enough to allow filenames
6587 longer than 14 characters but some others like /tmp can't even think about them.
6588 So, for now on, I shall assume your kernel does not allow them at all.
6589 EOM
6590                         val="$undef"
6591                 fi
6592         fi
6593 else
6594         $cat <<'EOM'
6595 You can't have filenames longer than 14 chars.  You can't even think about them!
6596 EOM
6597         val="$undef"
6598 fi 
6599 set d_flexfnam
6600 eval $setvar
6601 $rm -rf /tmp/cf$$ 123456789abcde*
6602
6603 : determine where library module manual pages go
6604 set man3dir man3dir none
6605 eval $prefixit
6606 $cat <<EOM
6607
6608 $spackage has manual pages for many of the library modules.
6609 EOM
6610
6611 case "$nroff" in
6612 nroff)
6613         $cat <<'EOM'
6614 However, you don't have nroff, so they're probably useless to you.
6615 EOM
6616         case "$man3dir" in
6617         '') man3dir="none";;
6618         esac;;
6619 esac
6620
6621 case "$d_flexfnam" in
6622 undef)
6623         $cat <<'EOM'
6624 However, your system can't handle the long file names like File::Basename.3. 
6625 EOM
6626         case "$man3dir" in
6627         '') man3dir="none";;
6628         esac;;
6629 esac
6630
6631 echo "If you don't want the manual sources installed, answer 'none'."
6632 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6633 case "$man3dir" in
6634 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6635         if $test -d "$privlib/man/man3"; then
6636                 cat <<EOM >&4
6637
6638 WARNING:  Previous versions of perl installed man3 pages into
6639 $privlib/man/man3.  This version will suggest a 
6640 new default of $dflt.  
6641 EOM
6642                 tdflt=$dflt
6643                 dflt='n'
6644                 rp='Do you wish to preserve the old behavior?(y/n)'
6645                 . ./myread
6646                 case "$ans" in
6647                 y*) dflt="$privlib/man/man3" ;;
6648                 *)  dflt=$tdflt ;;
6649                 esac
6650     fi
6651         ;;
6652 ' ') dflt=none;;
6653 *)      dflt="$man3dir" ;;
6654 esac
6655 echo " "
6656 fn=dn+~
6657 rp="Where do the $package library man pages (source) go?"
6658 . ./getfile
6659 man3dir="$ans"
6660 man3direxp="$ansexp"
6661 case "$man1dir" in
6662 '')     man3dir=' '
6663         installman3dir='';;
6664 esac
6665
6666 : Change installation prefix, if necessary.
6667 if $test X"$prefix" != X"$installprefix"; then
6668         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6669 else
6670         installman3dir="$man3direxp"
6671 fi
6672
6673 : What suffix to use on installed man pages
6674 case "$man3dir" in
6675 ' ')
6676         man3ext='0'
6677         ;;
6678 *)
6679         rp="What suffix should be used for the $package library man pages?"
6680         case "$man3ext" in
6681         '')     case "$man3dir" in
6682                 *3)  dflt=3 ;;
6683                 *3p) dflt=3p ;;
6684                 *3pm) dflt=3pm ;;
6685                 *l) dflt=l;;
6686                 *n) dflt=n;;
6687                 *o) dflt=o;;
6688                 *p) dflt=p;;
6689                 *C) dflt=C;;
6690                 *L) dflt=L;;
6691                 *L3) dflt=L3;;
6692                 *) dflt=3;;
6693                 esac
6694                 ;;
6695         *)      dflt="$man3ext";;
6696         esac
6697         . ./myread
6698         man3ext="$ans"
6699         ;;
6700 esac
6701
6702 : see if we have to deal with yellow pages, now NIS.
6703 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6704         if $test -f /usr/etc/nibindd; then
6705                 echo " "
6706                 echo "I'm fairly confident you're on a NeXT."
6707                 echo " "
6708                 rp='Do you get the hosts file via NetInfo?'
6709                 dflt=y
6710                 case "$hostcat" in
6711                 nidump*) ;;
6712                 '') ;;
6713                 *) dflt=n;;
6714                 esac
6715                 . ./myread
6716                 case "$ans" in
6717                 y*) hostcat='nidump hosts .';;
6718                 *)      case "$hostcat" in
6719                         nidump*) hostcat='';;
6720                         esac
6721                         ;;
6722                 esac
6723         fi
6724         case "$hostcat" in
6725         nidump*) ;;
6726         *)
6727                 case "$hostcat" in
6728                 *ypcat*) dflt=y;;
6729                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6730                                 dflt=y
6731                         else
6732                                 dflt=n
6733                         fi;;
6734                 *) dflt=n;;
6735                 esac
6736                 echo " "
6737                 rp='Are you getting the hosts file via yellow pages?'
6738                 . ./myread
6739                 case "$ans" in
6740                 y*) hostcat='ypcat hosts';;
6741                 *) hostcat='cat /etc/hosts';;
6742                 esac
6743                 ;;
6744         esac
6745 fi
6746 case "$hostcat" in
6747 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6748 esac
6749 case "$groupcat" in
6750 '') test -f /etc/group && groupcat='cat /etc/group';;
6751 esac
6752 case "$passcat" in
6753 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6754 esac
6755
6756 : now get the host name
6757 echo " "
6758 echo "Figuring out host name..." >&4
6759 case "$myhostname" in
6760 '') cont=true
6761         echo 'Maybe "hostname" will work...'
6762         if tans=`sh -c hostname 2>&1` ; then
6763                 myhostname=$tans
6764                 phostname=hostname
6765                 cont=''
6766         fi
6767         ;;
6768 *) cont='';;
6769 esac
6770 if $test "$cont"; then
6771         if ./xenix; then
6772                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6773                 if tans=`cat /etc/systemid 2>&1` ; then
6774                         myhostname=$tans
6775                         phostname='cat /etc/systemid'
6776                         echo "Whadyaknow.  Xenix always was a bit strange..."
6777                         cont=''
6778                 fi
6779         elif $test -r /etc/systemid; then
6780                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6781         fi
6782 fi
6783 if $test "$cont"; then
6784         echo 'No, maybe "uuname -l" will work...'
6785         if tans=`sh -c 'uuname -l' 2>&1` ; then
6786                 myhostname=$tans
6787                 phostname='uuname -l'
6788         else
6789                 echo 'Strange.  Maybe "uname -n" will work...'
6790                 if tans=`sh -c 'uname -n' 2>&1` ; then
6791                         myhostname=$tans
6792                         phostname='uname -n'
6793                 else
6794                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6795                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6796                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6797                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6798                         else
6799                                 case "$myhostname" in
6800                                 '') echo "Does this machine have an identity crisis or something?"
6801                                         phostname='';;
6802                                 *)
6803                                         echo "Well, you said $myhostname before..."
6804                                         phostname='echo $myhostname';;
6805                                 esac
6806                         fi
6807                 fi
6808         fi
6809 fi
6810 : you do not want to know about this
6811 set $myhostname
6812 myhostname=$1
6813
6814 : verify guess
6815 if $test "$myhostname" ; then
6816         dflt=y
6817         rp='Your host name appears to be "'$myhostname'".'" Right?"
6818         . ./myread
6819         case "$ans" in
6820         y*) ;;
6821         *) myhostname='';;
6822         esac
6823 fi
6824
6825 : bad guess or no guess
6826 while $test "X$myhostname" = X ; do
6827         dflt=''
6828         rp="Please type the (one word) name of your host:"
6829         . ./myread
6830         myhostname="$ans"
6831 done
6832
6833 : translate upper to lower if necessary
6834 case "$myhostname" in
6835 *[A-Z]*)
6836         echo "(Normalizing case in your host name)"
6837         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6838         ;;
6839 esac
6840
6841 case "$myhostname" in
6842 *.*)
6843         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6844         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6845         echo "(Trimming domain name from host name--host name is now $myhostname)"
6846         ;;
6847 *) case "$mydomain" in
6848         '')
6849                 {
6850                         test "X$hostcat" = "Xypcat hosts" &&
6851                         ypmatch "$myhostname" hosts 2>/dev/null |\
6852                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6853                         $test -s hosts
6854                 } || {
6855                         test "X$hostcat" != "X" &&
6856                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6857                                         /[       ]$myhostname[  . ]/p" > hosts
6858                 }
6859                 tmp_re="[       . ]"
6860                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6861                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6862                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6863                         hosts | $sort | $uniq | \
6864                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6865                 case `$echo X$dflt` in
6866                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6867                         dflt=.
6868                         ;;
6869                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6870                         ;;
6871                 esac
6872                 case "$dflt" in
6873                 .)
6874                         tans=`./loc resolv.conf X /etc /usr/etc`
6875                         if $test -f "$tans"; then
6876                                 echo "(Attempting domain name extraction from $tans)"
6877                                 dflt=.`$sed -n -e 's/   / /g' \
6878                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6879                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6880                                 case "$dflt" in
6881                                 .) dflt=.`$sed -n -e 's/        / /g' \
6882                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6883                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6884                                         ;;
6885                                 esac
6886                         fi
6887                         ;;
6888                 esac
6889                 case "$dflt" in
6890                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6891                         dflt=.`sh -c domainname 2>/dev/null`
6892                         case "$dflt" in
6893                         '') dflt='.';;
6894                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6895                         esac
6896                         ;;
6897                 esac
6898                 case "$dflt" in
6899                 .) echo "(Lost all hope -- silly guess then)"
6900                         dflt='.uucp'
6901                         ;;
6902                 esac
6903                 $rm -f hosts
6904                 ;;
6905         *) dflt="$mydomain";;
6906         esac;;
6907 esac
6908 echo " "
6909 rp="What is your domain name?"
6910 . ./myread
6911 tans="$ans"
6912 case "$ans" in
6913 '') ;;
6914 .*) ;;
6915 *) tans=".$tans";;
6916 esac
6917 mydomain="$tans"
6918
6919 : translate upper to lower if necessary
6920 case "$mydomain" in
6921 *[A-Z]*)
6922         echo "(Normalizing case in your domain name)"
6923         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6924         ;;
6925 esac
6926
6927 : a little sanity check here
6928 case "$phostname" in
6929 '') ;;
6930 *)
6931         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6932         $myhostname$mydomain|$myhostname) ;;
6933         *)
6934                 case "$phostname" in
6935                 sed*)
6936                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6937                         ;;
6938                 *)
6939                         echo "(That doesn't agree with your $phostname command, by the way.)"
6940                         ;;
6941                 esac
6942         ;;
6943         esac
6944         ;;
6945 esac
6946
6947 $cat <<EOM
6948
6949 I need to get your e-mail address in Internet format if possible, i.e.
6950 something like user@host.domain. Please answer accurately since I have
6951 no easy means to double check it. The default value provided below
6952 is most probably close to reality but may not be valid from outside
6953 your organization...
6954
6955 EOM
6956 cont=x
6957 while test "$cont"; do
6958         case "$cf_email" in
6959         '') dflt="$cf_by@$myhostname$mydomain";;
6960         *) dflt="$cf_email";;
6961         esac
6962         rp='What is your e-mail address?'
6963         . ./myread
6964         cf_email="$ans"
6965         case "$cf_email" in
6966         *@*.*) cont='' ;;
6967         *)
6968                 rp='Address does not look like an Internet one.  Use it anyway?'
6969                 case "$fastread" in
6970                 yes) dflt=y ;;
6971                 *) dflt=n ;;
6972                 esac
6973                 . ./myread
6974                 case "$ans" in
6975                 y*) cont='' ;;
6976                 *) echo " " ;;
6977                 esac
6978                 ;;
6979         esac
6980 done
6981
6982 $cat <<EOM
6983
6984 If you or somebody else will be maintaining perl at your site, please
6985 fill in the correct e-mail address here so that they may be contacted
6986 if necessary. Currently, the "perlbug" program included with perl
6987 will send mail to this address in addition to perlbug@perl.com. You may
6988 enter "none" for no administrator.
6989
6990 EOM
6991 case "$perladmin" in
6992 '') dflt="$cf_email";;
6993 *) dflt="$perladmin";;
6994 esac
6995 rp='Perl administrator e-mail address'
6996 . ./myread
6997 perladmin="$ans"
6998
6999 : figure out how to guarantee perl startup
7000 case "$startperl" in
7001 '')
7002         case "$sharpbang" in
7003         *!)
7004                 $cat <<EOH
7005
7006 I can use the #! construct to start perl on your system. This will
7007 make startup of perl scripts faster, but may cause problems if you
7008 want to share those scripts and perl is not in a standard place
7009 ($binexp/perl) on all your platforms. The alternative is to force
7010 a shell by starting the script with a single ':' character.
7011
7012 EOH
7013                 dflt="$binexp/perl"
7014                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7015                 . ./myread
7016                 case "$ans" in
7017                 none)   startperl=": # use perl";;
7018                 *)      startperl="#!$ans"
7019                         if $test 30 -lt `echo "$ans" | wc -c`; then
7020                                 $cat >&4 <<EOM
7021
7022 WARNING:  Some systems limit the #! command to 32 characters.
7023 If you experience difficulty running Perl scripts with #!, try
7024 installing Perl in a directory with a shorter pathname.
7025
7026 EOM
7027                         fi ;;
7028                 esac
7029                 ;;
7030         *) startperl=": # use perl"
7031                 ;;
7032         esac
7033         ;;
7034 esac
7035 echo "I'll use $startperl to start perl scripts."
7036
7037 : figure best path for perl in scripts
7038 case "$perlpath" in
7039 '')
7040         perlpath="$binexp/perl"
7041         case "$startperl" in
7042         *!*) ;;
7043         *)
7044                 $cat <<EOH
7045
7046 I will use the "eval 'exec'" idiom to start Perl on your system.
7047 I can use the full path of your Perl binary for this purpose, but
7048 doing so may cause problems if you want to share those scripts and
7049 Perl is not always in a standard place ($binexp/perl).
7050
7051 EOH
7052                 dflt="$binexp/perl"
7053                 rp="What path shall I use in \"eval 'exec'\"?"
7054                 . ./myread
7055                 perlpath="$ans"
7056                 ;;
7057         esac
7058         ;;
7059 esac
7060 case "$startperl" in
7061 *!*)    ;;
7062 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7063 esac
7064
7065 : determine where public executable scripts go
7066 set scriptdir scriptdir
7067 eval $prefixit
7068 case "$scriptdir" in
7069 '')
7070         dflt="$bin"
7071         : guess some guesses
7072         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7073         $test -d /usr/share/bin     && dflt=/usr/share/bin
7074         $test -d /usr/local/script  && dflt=/usr/local/script
7075         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7076         $test -d $prefixexp/script  && dflt=$prefixexp/script
7077         set dflt
7078         eval $prefixup
7079         ;;
7080 *)  dflt="$scriptdir"
7081         ;;
7082 esac
7083 $cat <<EOM
7084  
7085 Some installations have a separate directory just for executable scripts so
7086 that they can mount it across multiple architectures but keep the scripts in
7087 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7088 Or you might just lump your scripts in with all your other executables.
7089  
7090 EOM
7091 fn=d~
7092 rp='Where do you keep publicly executable scripts?'
7093 . ./getfile
7094 if $test "X$ansexp" != "X$scriptdirexp"; then
7095         installscript=''
7096 fi
7097 scriptdir="$ans"
7098 scriptdirexp="$ansexp"
7099 : Change installation prefix, if necessary.
7100 if $test X"$prefix" != X"$installprefix"; then
7101         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7102 else
7103         installscript="$scriptdirexp"
7104 fi
7105
7106 : determine where site specific architecture-dependent libraries go.
7107 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7108 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7109 : sitelib may have an optional trailing /share.
7110 case "$sitearch" in
7111 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7112         dflt="$dflt/$archname"
7113         ;;
7114 *)      dflt="$sitearch"
7115         ;;
7116 esac
7117 set sitearch sitearch none
7118 eval $prefixit
7119 $cat <<EOM
7120
7121 The installation process will also create a directory for
7122 architecture-dependent site-specific extensions and modules.
7123
7124 EOM
7125 fn=d~+
7126 rp='Pathname for the site-specific architecture-dependent library files?'
7127 . ./getfile
7128 sitearch="$ans"
7129 sitearchexp="$ansexp"
7130 : Change installation prefix, if necessary.
7131 if $test X"$prefix" != X"$installprefix"; then
7132         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7133 else
7134         installsitearch="$sitearchexp"
7135 fi
7136
7137 : determine where add-on public executables go
7138 case "$sitebin" in
7139 '')     dflt=$siteprefix/bin ;;
7140 *)      dflt=$sitebin ;;
7141 esac
7142 fn=d~
7143 rp='Pathname where the add-on public executables should be installed?'
7144 . ./getfile
7145 sitebin="$ans"
7146 sitebinexp="$ansexp"
7147 : Change installation prefix, if necessary.
7148 if $test X"$prefix" != X"$installprefix"; then
7149         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7150 else
7151         installsitebin="$sitebinexp"
7152 fi
7153
7154 : see if sqrtl exists
7155 set sqrtl d_sqrtl
7156 eval $inlibc
7157
7158 case "$ccflags" in
7159 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7160 esac
7161
7162 case "$uselongdouble" in
7163 $define|true|[yY]*)     dflt='y';;
7164 *) dflt='n';;
7165 esac
7166 cat <<EOM
7167
7168 Perl can be built to take advantage of long doubles which
7169 (if available) may give more accuracy and range for floating point numbers.
7170
7171 If this doesn't make any sense to you, just accept the default '$dflt'.
7172 EOM
7173 rp='Try to use long doubles if available?'
7174 . ./myread
7175 case "$ans" in
7176 y|Y)    val="$define"   ;;
7177 *)      val="$undef"    ;;
7178 esac
7179 set uselongdouble
7180 eval $setvar
7181
7182 case "$uselongdouble" in
7183 true|[yY]*) uselongdouble="$define" ;;
7184 esac
7185
7186 case "$uselongdouble" in
7187 $define)
7188 : Look for a hint-file generated 'call-back-unit'.  If the
7189 : user has specified that long doubles should be used,
7190 : we may need to set or change some other defaults.
7191         if $test -f uselongdouble.cbu; then
7192                 echo "Your platform has some specific hints for long doubles, using them..."
7193                 . ./uselongdouble.cbu
7194         else
7195                 $cat <<EOM
7196 (Your platform doesn't have any specific hints for long doubles.)
7197 EOM
7198         fi
7199         ;;
7200 esac
7201
7202 case "$uselongdouble:$d_sqrtl" in
7203 $define:$undef)
7204                 $cat <<EOM >&4
7205
7206 You requested the use of long doubles but you do not seem to have
7207 the mathematic functions for long doubles.  I'm disabling the use
7208 of long doubles.
7209 EOM
7210         uselongdouble=$undef
7211         ;;
7212 esac
7213
7214 case "$useperlio" in
7215 $define|true|[yY]*)     dflt='y';;
7216 *) dflt='n';;
7217 esac
7218 cat <<EOM
7219
7220 Previous version of $package used the standard IO mechanisms as defined
7221 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7222 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7223 the default.  This abstraction layer can use AT&T's sfio (if you already
7224 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7225 problems with some extension modules.  Using PerlIO with stdio is safe,
7226 but it is slower than plain stdio and therefore is not the default.
7227
7228 If this doesn't make any sense to you, just accept the default '$dflt'.
7229 EOM
7230 rp='Use the experimental PerlIO abstraction layer?'
7231 . ./myread
7232 case "$ans" in
7233 y|Y) 
7234         val="$define"
7235         ;;     
7236 *)      
7237         echo "Ok, doing things the stdio way"
7238         val="$undef"
7239         ;;
7240 esac
7241 set useperlio
7242 eval $setvar 
7243
7244 case "$vendorprefix" in
7245 '')     d_vendorbin="$undef"
7246         vendorbin=''
7247         vendorbinexp=''
7248         ;;
7249 *)      d_vendorbin="$define"
7250         : determine where vendor-supplied executables go.
7251         case "$vendorbin" in
7252         '') dflt=$vendorprefix/bin ;;
7253         *)      dflt="$vendorbin" ;;
7254         esac
7255         fn=d~+
7256         rp='Pathname for the vendor-supplied executables directory?'
7257         . ./getfile
7258         vendorbin="$ans"
7259         vendorbinexp="$ansexp"
7260         ;;
7261 esac
7262 : Change installation prefix, if necessary.
7263 if $test X"$prefix" != X"$installprefix"; then
7264         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7265 else
7266         installvendorbin="$vendorbinexp"
7267 fi
7268
7269 : check for length of double
7270 echo " "
7271 case "$doublesize" in
7272 '')
7273         echo "Checking to see how big your double precision numbers are..." >&4
7274         $cat >try.c <<'EOCP'
7275 #include <stdio.h>
7276 int main()
7277 {
7278     printf("%d\n", (int)sizeof(double));
7279     exit(0);
7280 }
7281 EOCP
7282         set try
7283         if eval $compile_ok; then
7284                 doublesize=`./try`
7285                 echo "Your double is $doublesize bytes long."
7286         else
7287                 dflt='8'
7288                 echo "(I can't seem to compile the test program.  Guessing...)"
7289                 rp="What is the size of a double precision number (in bytes)?"
7290                 . ./myread
7291                 doublesize="$ans"
7292         fi
7293         ;;
7294 esac
7295 $rm -f try.c try
7296
7297 : check for long doubles
7298 echo " "
7299 echo "Checking to see if you have long double..." >&4
7300 echo 'int main() { long double x = 7.0; }' > try.c
7301 set try
7302 if eval $compile; then
7303         val="$define"
7304         echo "You have long double."
7305 else
7306         val="$undef"
7307         echo "You do not have long double."
7308 fi
7309 $rm try.*
7310 set d_longdbl
7311 eval $setvar
7312
7313 : check for length of long double
7314 case "${d_longdbl}${longdblsize}" in
7315 $define)
7316         echo " "
7317         echo "Checking to see how big your long doubles are..." >&4
7318         $cat >try.c <<'EOCP'
7319 #include <stdio.h>
7320 int main()
7321 {
7322         printf("%d\n", sizeof(long double));
7323 }
7324 EOCP
7325         set try
7326         set try
7327         if eval $compile; then
7328                 longdblsize=`./try$exe_ext`
7329                 echo "Your long doubles are $longdblsize bytes long."
7330         else
7331                 dflt='8'
7332                 echo " "
7333                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7334                 rp="What is the size of a long double (in bytes)?"
7335                 . ./myread
7336                 longdblsize="$ans"
7337         fi
7338         if $test "X$doublesize" = "X$longdblsize"; then
7339                 echo "(That isn't any different from an ordinary double.)"
7340         fi      
7341         ;;
7342 esac
7343 $rm -f try.* try
7344
7345 : Check how to convert floats to strings.
7346 if test "X$d_Gconvert" = X; then
7347         echo " "
7348         echo "Checking for an efficient way to convert floats to strings."
7349         $cat >try.c <<EOP
7350 #ifdef TRY_gconvert
7351 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7352 char *myname = "gconvert";
7353 #endif
7354 #ifdef TRY_gcvt
7355 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7356 char *myname = "gcvt";
7357 #endif
7358 #ifdef TRY_qgcvt
7359 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7360 char *myname = "qgcvt";
7361 #define DOUBLETYPE long double
7362 #endif
7363 #ifdef TRY_sprintf
7364 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7365 char *myname = "sprintf";
7366 #endif
7367
7368 #ifndef DOUBLETYPE
7369 #define DOUBLETYPE double
7370 #endif
7371
7372 #include <stdio.h>
7373
7374 #define I_STDLIB $i_stdlib
7375 #ifdef I_STDLIB
7376 #include <stdlib.h>
7377 #endif
7378
7379 int
7380 checkit(expect, got)
7381 char *expect;
7382 char *got;
7383 {
7384     if (strcmp(expect, got)) {
7385                 printf("%s oddity:  Expected %s, got %s\n",
7386                         myname, expect, got);
7387                 exit(1);
7388         }
7389 }
7390
7391 int main()
7392
7393         char buf[64]; 
7394         buf[63] = '\0';
7395
7396         /* This must be 1st test on (which?) platform */
7397         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7398         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7399         checkit("0.1", buf);
7400
7401         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7402         checkit("1", buf);
7403
7404         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7405         checkit("0", buf);
7406
7407         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7408         checkit("-1", buf);
7409
7410         /* Some Linux gcvt's give 1.e+5 here. */
7411         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7412         checkit("100000", buf);
7413         
7414         /* Some Linux gcvt's give -1.e+5 here. */
7415         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7416         checkit("-100000", buf);
7417
7418         exit(0);
7419 }
7420 EOP
7421         case "$d_Gconvert" in
7422         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7423         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7424         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7425         *) xxx_list='gconvert gcvt sprintf' ;;
7426         esac
7427
7428         case "$d_longdbl$uselongdouble" in
7429         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7430         esac
7431
7432         for xxx_convert in $xxx_list; do
7433                 echo "Trying $xxx_convert..."
7434                 $rm -f try try$_o
7435                 set try -DTRY_$xxx_convert
7436                 if eval $compile; then
7437                         echo "$xxx_convert() found." >&4
7438                         if ./try; then
7439                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7440                                 break;
7441                         else
7442                                 echo "...But $xxx_convert didn't work as I expected."
7443                         fi
7444                 else
7445                         echo "$xxx_convert NOT found." >&4
7446                 fi
7447         done
7448                 
7449         case "$xxx_convert" in
7450         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7451         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7452         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7453         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7454         esac
7455 fi
7456
7457 echo " "
7458
7459 if $test X"$d_longdbl" = X"$define"; then
7460
7461 echo "Checking how to print long doubles..." >&4
7462
7463 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7464         $cat >try.c <<'EOCP'
7465 #include <sys/types.h>
7466 #include <stdio.h>
7467 int main() {
7468   double d = 123.456;
7469   printf("%.3f\n", d);
7470 }
7471 EOCP
7472         set try
7473         if eval $compile; then
7474                 yyy=`./try$exe_ext`
7475                 case "$yyy" in
7476                 123.456)
7477                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7478                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7479                         echo "We will use %f."
7480                         ;;
7481                 esac
7482         fi
7483 fi
7484
7485 if $test X"$sPRIfldbl" = X; then
7486         $cat >try.c <<'EOCP'
7487 #include <sys/types.h>
7488 #include <stdio.h>
7489 int main() {
7490   long double d = 123.456;
7491   printf("%.3llf\n", d);
7492 }
7493 EOCP
7494         set try
7495         if eval $compile; then
7496                 yyy=`./try$exe_ext`
7497                 case "$yyy" in
7498                 123.456)
7499                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7500                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7501                         echo "We will use %llf."
7502                         ;;
7503                 esac
7504         fi
7505 fi
7506
7507 if $test X"$sPRIfldbl" = X; then
7508         $cat >try.c <<'EOCP'
7509 #include <sys/types.h>
7510 #include <stdio.h>
7511 int main() {
7512   long double d = 123.456;
7513   printf("%.3Lf\n", d);
7514 }
7515 EOCP
7516         set try
7517         if eval $compile; then
7518                 yyy=`./try$exe_ext`
7519                 case "$yyy" in
7520                 123.456)
7521                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7522                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7523                         echo "We will use %Lf."
7524                         ;;
7525                 esac
7526         fi
7527 fi
7528
7529 if $test X"$sPRIfldbl" = X; then
7530         $cat >try.c <<'EOCP'
7531 #include <sys/types.h>
7532 #include <stdio.h>
7533 int main() {
7534   long double d = 123.456;
7535   printf("%.3lf\n", d);
7536 }
7537 EOCP
7538         set try
7539         if eval $compile; then
7540                 yyy=`./try$exe_ext`
7541                 case "$yyy" in
7542                 123.456)
7543                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7544                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7545                         echo "We will use %lf."
7546                         ;;
7547                 esac
7548         fi
7549 fi
7550
7551 if $test X"$sPRIfldbl" = X; then
7552         echo "Cannot figure out how to print long doubles." >&4
7553 fi
7554
7555 $rm -f try try.*
7556
7557 fi # d_longdbl
7558
7559 case "$sPRIfldbl" in
7560 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7561         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7562         ;;
7563 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7564         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7565         ;;
7566 esac
7567
7568 : Initialize h_fcntl
7569 h_fcntl=false
7570
7571 : Initialize h_sysfile
7572 h_sysfile=false
7573
7574 : access call always available on UNIX
7575 set access d_access
7576 eval $inlibc
7577
7578 : locate the flags for 'access()'
7579 case "$d_access" in
7580 "$define")
7581         echo " "
7582         $cat >access.c <<'EOCP'
7583 #include <sys/types.h>
7584 #ifdef I_FCNTL
7585 #include <fcntl.h>
7586 #endif
7587 #ifdef I_SYS_FILE
7588 #include <sys/file.h>
7589 #endif
7590 #ifdef I_UNISTD
7591 #include <unistd.h>
7592 #endif
7593 int main() {
7594         exit(R_OK);
7595 }
7596 EOCP
7597         : check sys/file.h first, no particular reason here
7598         if $test `./findhdr sys/file.h` && \
7599                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7600                 h_sysfile=true;
7601                 echo "<sys/file.h> defines the *_OK access constants." >&4
7602         elif $test `./findhdr fcntl.h` && \
7603                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7604                 h_fcntl=true;
7605                 echo "<fcntl.h> defines the *_OK access constants." >&4
7606         elif $test `./findhdr unistd.h` && \
7607                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7608                 echo "<unistd.h> defines the *_OK access constants." >&4
7609         else
7610                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7611         fi
7612         ;;
7613 esac
7614 $rm -f access*
7615
7616 : see if accessx exists
7617 set accessx d_accessx
7618 eval $inlibc
7619
7620 : see if alarm exists
7621 set alarm d_alarm
7622 eval $inlibc
7623
7624 : see if atolf exists
7625 set atolf d_atolf
7626 eval $inlibc
7627
7628 : see if atoll exists
7629 set atoll d_atoll
7630 eval $inlibc
7631
7632 : Look for GNU-cc style attribute checking
7633 echo " "
7634 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7635 $cat >attrib.c <<'EOCP'
7636 #include <stdio.h>
7637 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7638 EOCP
7639 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7640         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7641                 echo "Your C compiler doesn't fully support __attribute__."
7642                 val="$undef"
7643         else
7644                 echo "Your C compiler supports __attribute__."
7645                 val="$define"
7646         fi
7647 else
7648         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7649         val="$undef"
7650 fi
7651 set d_attribut
7652 eval $setvar
7653 $rm -f attrib*
7654
7655 : see if bcmp exists
7656 set bcmp d_bcmp
7657 eval $inlibc
7658
7659 : see if bcopy exists
7660 set bcopy d_bcopy
7661 eval $inlibc
7662
7663 : see if this is a unistd.h system
7664 set unistd.h i_unistd
7665 eval $inhdr
7666
7667 : see if getpgrp exists
7668 set getpgrp d_getpgrp
7669 eval $inlibc
7670
7671 case "$d_getpgrp" in
7672 "$define")
7673         echo " "
7674         echo "Checking to see which flavor of getpgrp is in use..."
7675         $cat >set.c <<EOP
7676 #$i_unistd I_UNISTD
7677 #include <sys/types.h>
7678 #ifdef I_UNISTD
7679 #  include <unistd.h>
7680 #endif
7681 int main()
7682 {
7683         if (getuid() == 0) {
7684                 printf("(I see you are running Configure as super-user...)\n");
7685                 setuid(1);
7686         }
7687 #ifdef TRY_BSD_PGRP
7688         if (getpgrp(1) == 0)
7689                 exit(0);
7690 #else
7691         if (getpgrp() > 0)
7692                 exit(0);
7693 #endif
7694         exit(1);
7695 }
7696 EOP
7697         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7698                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7699                 val="$define"
7700         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7701                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7702                 val="$undef"
7703         else
7704                 echo "I can't seem to compile and run the test program."
7705                 if ./usg; then
7706                         xxx="a USG one, i.e. you use getpgrp()."
7707                 else
7708                         # SVR4 systems can appear rather BSD-ish.
7709                         case "$i_unistd" in
7710                         $undef)
7711                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7712                                 val="$define"
7713                                 ;;
7714                         $define)
7715                                 xxx="probably a USG one, i.e. you use getpgrp()."
7716                                 val="$undef"
7717                                 ;;
7718                         esac
7719                 fi
7720                 echo "Assuming your getpgrp is $xxx" >&4
7721         fi
7722         ;;
7723 *) val="$undef";;
7724 esac
7725 set d_bsdgetpgrp
7726 eval $setvar
7727 $rm -f set set.c
7728
7729 : see if setpgrp exists
7730 set setpgrp d_setpgrp
7731 eval $inlibc
7732
7733 case "$d_setpgrp" in
7734 "$define")
7735         echo " "
7736         echo "Checking to see which flavor of setpgrp is in use..."
7737         $cat >set.c <<EOP
7738 #$i_unistd I_UNISTD
7739 #include <sys/types.h>
7740 #ifdef I_UNISTD
7741 #  include <unistd.h>
7742 #endif
7743 int main()
7744 {
7745         if (getuid() == 0) {
7746                 printf("(I see you are running Configure as super-user...)\n");
7747                 setuid(1);
7748         }
7749 #ifdef TRY_BSD_PGRP
7750         if (-1 == setpgrp(1, 1))
7751                 exit(0);
7752 #else
7753         if (setpgrp() != -1)
7754                 exit(0);
7755 #endif
7756         exit(1);
7757 }
7758 EOP
7759         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7760                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7761                 val="$define"
7762         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7763                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7764                 val="$undef"
7765         else
7766                 echo "(I can't seem to compile and run the test program.)"
7767                 if ./usg; then
7768                         xxx="a USG one, i.e. you use setpgrp()."
7769                 else
7770                         # SVR4 systems can appear rather BSD-ish.
7771                         case "$i_unistd" in
7772                         $undef)
7773                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7774                                 val="$define"
7775                                 ;;
7776                         $define)
7777                                 xxx="probably a USG one, i.e. you use setpgrp()."
7778                                 val="$undef"
7779                                 ;;
7780                         esac
7781                 fi
7782                 echo "Assuming your setpgrp is $xxx" >&4
7783         fi
7784         ;;
7785 *) val="$undef";;
7786 esac
7787 set d_bsdsetpgrp
7788 eval $setvar
7789 $rm -f set set.c
7790 : see if bzero exists
7791 set bzero d_bzero
7792 eval $inlibc
7793
7794 : see if signal is declared as pointer to function returning int or void
7795 echo " "
7796 xxx=`./findhdr signal.h`
7797 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7798 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7799         echo "You have int (*signal())() instead of void." >&4
7800         val="$undef"
7801 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7802         echo "You have void (*signal())()." >&4
7803         val="$define"
7804 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7805         echo "You have int (*signal())() instead of void." >&4
7806         val="$undef"
7807 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7808         echo "You have void (*signal())()." >&4
7809         val="$define"
7810 else
7811         case "$d_voidsig" in
7812         '')
7813         echo "I can't determine whether signal handler returns void or int..." >&4
7814                 dflt=void
7815                 rp="What type does your signal handler return?"
7816                 . ./myread
7817                 case "$ans" in
7818                 v*) val="$define";;
7819                 *) val="$undef";;
7820                 esac;;
7821         "$define")
7822                 echo "As you already told me, signal handler returns void." >&4
7823                 val="$define"
7824                 ;;
7825         *)      echo "As you already told me, signal handler returns int." >&4
7826                 val="$undef"
7827                 ;;
7828         esac
7829 fi
7830 set d_voidsig
7831 eval $setvar
7832 case "$d_voidsig" in
7833 "$define") signal_t="void";;
7834 *) signal_t="int";;
7835 esac
7836 $rm -f $$.tmp
7837
7838 : check for ability to cast large floats to 32-bit ints.
7839 echo " "
7840 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7841 if $test "$intsize" -ge 4; then
7842         xxx=int
7843 else
7844         xxx=long
7845 fi
7846 $cat >try.c <<EOCP
7847 #include <stdio.h>
7848 #include <sys/types.h>
7849 #include <signal.h>
7850 $signal_t blech(s) int s; { exit(3); }
7851 int main()
7852 {
7853         $xxx i32;
7854         double f, g;
7855         int result = 0;
7856         char str[16];
7857         signal(SIGFPE, blech);
7858
7859         /* Don't let compiler optimize the test away.  Store the number 
7860            in a writable string for gcc to pass to sscanf under HP/UX.
7861         */
7862         sprintf(str, "2147483647");
7863         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7864         g = 10 * f;
7865         i32  = ($xxx) g;
7866
7867         /* x86 processors will probably give 0x8000 0000, which is a
7868        sign change.  We don't want that.  We want to mimic SPARC
7869            behavior here, which is to preserve the sign and give
7870            back 0x7fff ffff.
7871         */
7872         if (i32 != ($xxx) f)
7873                 result |= 1;
7874         exit(result);
7875 }
7876 EOCP
7877 set try
7878 if eval $compile_ok; then
7879         ./try
7880         yyy=$?
7881 else
7882         echo "(I can't seem to compile the test program--assuming it can't)"
7883         yyy=1
7884 fi
7885 case "$yyy" in
7886 0)      val="$define"
7887         echo "Yup, it can."
7888         ;;
7889 *)      val="$undef"
7890         echo "Nope, it can't."
7891         ;;
7892 esac
7893 set d_casti32
7894 eval $setvar
7895 $rm -f try try.*
7896
7897 : check for ability to cast negative floats to unsigned
7898 echo " "
7899 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7900 $cat >try.c <<EOCP
7901 #include <stdio.h>
7902 #include <sys/types.h>
7903 #include <signal.h>
7904 $signal_t blech(s) int s; { exit(7); }
7905 $signal_t blech_in_list(s) int s; { exit(4); }
7906 unsigned long dummy_long(p) unsigned long p; { return p; }
7907 unsigned int dummy_int(p) unsigned int p; { return p; }
7908 unsigned short dummy_short(p) unsigned short p; { return p; }
7909 int main()
7910 {
7911         double f;
7912         unsigned long along;
7913         unsigned int aint;
7914         unsigned short ashort;
7915         int result = 0;
7916         char str[16];
7917         
7918         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7919            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7920            optimized the whole file away
7921         */
7922         /* Store the number in a writable string for gcc to pass to 
7923            sscanf under HP/UX.
7924         */
7925         sprintf(str, "-123");
7926         sscanf(str, "%lf", &f);  /* f = -123.; */
7927
7928         signal(SIGFPE, blech);
7929         along = (unsigned long)f;
7930         aint = (unsigned int)f;
7931         ashort = (unsigned short)f;
7932         if (along != (unsigned long)-123)
7933                 result |= 1;
7934         if (aint != (unsigned int)-123)
7935                 result |= 1;
7936         if (ashort != (unsigned short)-123)
7937                 result |= 1;
7938         sprintf(str, "1073741824.");
7939         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7940         f = f + f;
7941         along = 0;
7942         along = (unsigned long)f;
7943         if (along != 0x80000000)
7944                 result |= 2;
7945         f -= 1.;
7946         along = 0;
7947         along = (unsigned long)f;
7948         if (along != 0x7fffffff)
7949                 result |= 1;
7950         f += 2.;
7951         along = 0;
7952         along = (unsigned long)f;
7953         if (along != 0x80000001)
7954                 result |= 2;
7955         if (result)
7956                 exit(result);
7957         signal(SIGFPE, blech_in_list);
7958         sprintf(str, "123.");
7959         sscanf(str, "%lf", &f);  /* f = 123.; */
7960         along = dummy_long((unsigned long)f);
7961         aint = dummy_int((unsigned int)f);
7962         ashort = dummy_short((unsigned short)f);
7963         if (along != (unsigned long)123)
7964                 result |= 4;
7965         if (aint != (unsigned int)123)
7966                 result |= 4;
7967         if (ashort != (unsigned short)123)
7968                 result |= 4;
7969         exit(result);
7970
7971 }
7972 EOCP
7973 set try
7974 if eval $compile_ok; then
7975         ./try
7976         castflags=$?
7977 else
7978         echo "(I can't seem to compile the test program--assuming it can't)"
7979         castflags=7
7980 fi
7981 case "$castflags" in
7982 0)      val="$define"
7983         echo "Yup, it can."
7984         ;;
7985 *)      val="$undef"
7986         echo "Nope, it can't."
7987         ;;
7988 esac
7989 set d_castneg
7990 eval $setvar
7991 $rm -f try.*
7992
7993 : see if vprintf exists
7994 echo " "
7995 if set vprintf val -f d_vprintf; eval $csym; $val; then
7996         echo 'vprintf() found.' >&4
7997         val="$define"
7998         $cat >vprintf.c <<'EOF'
7999 #include <varargs.h>
8000
8001 int main() { xxx("foo"); }
8002
8003 xxx(va_alist)
8004 va_dcl
8005 {
8006         va_list args;
8007         char buf[10];
8008
8009         va_start(args);
8010         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8011 }
8012 EOF
8013         set vprintf
8014         if eval $compile && ./vprintf; then
8015                 echo "Your vsprintf() returns (int)." >&4
8016                 val2="$undef"
8017         else
8018                 echo "Your vsprintf() returns (char*)." >&4
8019                 val2="$define"
8020         fi
8021 else
8022         echo 'vprintf() NOT found.' >&4
8023                 val="$undef"
8024                 val2="$undef"
8025 fi
8026 set d_vprintf
8027 eval $setvar
8028 val=$val2
8029 set d_charvspr
8030 eval $setvar
8031
8032 : see if chown exists
8033 set chown d_chown
8034 eval $inlibc
8035
8036 : see if chroot exists
8037 set chroot d_chroot
8038 eval $inlibc
8039
8040 : see if chsize exists
8041 set chsize d_chsize
8042 eval $inlibc
8043
8044 : check for const keyword
8045 echo " "
8046 echo 'Checking to see if your C compiler knows about "const"...' >&4
8047 $cat >const.c <<'EOCP'
8048 typedef struct spug { int drokk; } spug;
8049 int main()
8050 {
8051         const char *foo;
8052         const spug y;
8053 }
8054 EOCP
8055 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8056         val="$define"
8057         echo "Yup, it does."
8058 else
8059         val="$undef"
8060         echo "Nope, it doesn't."
8061 fi
8062 set d_const
8063 eval $setvar
8064
8065 : see if crypt exists
8066 echo " "
8067 if set crypt val -f d_crypt; eval $csym; $val; then
8068         echo 'crypt() found.' >&4
8069         val="$define"
8070         cryptlib=''
8071 else
8072         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8073         if $test -z "$cryptlib"; then
8074                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8075         else
8076                 cryptlib=-lcrypt
8077         fi
8078         if $test -z "$cryptlib"; then
8079                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8080         else
8081                 cryptlib=-lcrypt
8082         fi
8083         if $test -z "$cryptlib"; then
8084                 cryptlib=`./loc libcrypt$_a "" $libpth`
8085         else
8086                 cryptlib=-lcrypt
8087         fi
8088         if $test -z "$cryptlib"; then
8089                 echo 'crypt() NOT found.' >&4
8090                 val="$undef"
8091         else
8092                 val="$define"
8093         fi
8094 fi
8095 set d_crypt
8096 eval $setvar
8097
8098 : get csh whereabouts
8099 case "$csh" in
8100 'csh') val="$undef" ;;
8101 *) val="$define" ;;
8102 esac
8103 set d_csh
8104 eval $setvar
8105 : Respect a hint or command line value for full_csh.
8106 case "$full_csh" in
8107 '') full_csh=$csh ;;
8108 esac
8109
8110 : see if cuserid exists
8111 set cuserid d_cuserid
8112 eval $inlibc
8113
8114 : see if this is a limits.h system
8115 set limits.h i_limits
8116 eval $inhdr
8117
8118 : see if this is a float.h system
8119 set float.h i_float
8120 eval $inhdr
8121
8122 : See if number of significant digits in a double precision number is known
8123 echo " "
8124 $cat >dbl_dig.c <<EOM
8125 #$i_limits I_LIMITS
8126 #$i_float I_FLOAT
8127 #ifdef I_LIMITS
8128 #include <limits.h>
8129 #endif
8130 #ifdef I_FLOAT
8131 #include <float.h>
8132 #endif
8133 #ifdef DBL_DIG
8134 printf("Contains DBL_DIG");
8135 #endif
8136 EOM
8137 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8138 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8139         echo "DBL_DIG found." >&4
8140         val="$define"
8141 else
8142         echo "DBL_DIG NOT found." >&4
8143         val="$undef"
8144 fi
8145 $rm -f dbl_dig.?
8146 set d_dbl_dig
8147 eval $setvar
8148
8149 : see if difftime exists
8150 set difftime d_difftime
8151 eval $inlibc
8152
8153 : see if this is a dirent system
8154 echo " "
8155 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8156         val="$define"
8157         echo "<dirent.h> found." >&4
8158 else
8159         val="$undef"
8160         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8161                 echo "<sys/dir.h> found." >&4
8162                 echo " "
8163         else
8164                 xinc=`./findhdr sys/ndir.h`
8165         fi
8166         echo "<dirent.h> NOT found." >&4
8167 fi
8168 set i_dirent
8169 eval $setvar
8170
8171 : Look for type of directory structure.
8172 echo " "
8173 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8174
8175 case "$direntrytype" in
8176 ''|' ')
8177         case "$i_dirent" in
8178         $define) guess1='struct dirent' ;;
8179         *) guess1='struct direct'  ;;
8180         esac
8181         ;;
8182 *)      guess1="$direntrytype"
8183         ;;
8184 esac
8185
8186 case "$guess1" in
8187 'struct dirent') guess2='struct direct' ;;
8188 *) guess2='struct dirent' ;;
8189 esac
8190                 
8191 if $contains "$guess1" try.c >/dev/null 2>&1; then
8192         direntrytype="$guess1"
8193         echo "Your directory entries are $direntrytype." >&4
8194 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8195         direntrytype="$guess2"
8196         echo "Your directory entries seem to be $direntrytype." >&4
8197 else
8198         echo "I don't recognize your system's directory entries." >&4
8199         rp="What type is used for directory entries on this system?"
8200         dflt="$guess1"
8201         . ./myread
8202         direntrytype="$ans"
8203 fi
8204 $rm -f try.c
8205
8206
8207 : see if the directory entry stores field length
8208 echo " "
8209 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8210 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8211         echo "Good, your directory entry keeps length information in d_namlen." >&4
8212         val="$define"
8213 else
8214         echo "Your directory entry does not know about the d_namlen field." >&4
8215         val="$undef"
8216 fi
8217 set d_dirnamlen
8218 eval $setvar
8219 $rm -f try.c
8220
8221 : see if dlerror exists
8222 xxx_runnm="$runnm"
8223 runnm=false
8224 set dlerror d_dlerror
8225 eval $inlibc
8226 runnm="$xxx_runnm"
8227
8228 : see if dlfcn is available
8229 set dlfcn.h i_dlfcn
8230 eval $inhdr
8231
8232 case "$usedl" in
8233 $define|y|true)
8234         $cat << EOM
8235
8236 On a few systems, the dynamically loaded modules that perl generates and uses
8237 will need a different extension than shared libs. The default will probably
8238 be appropriate.
8239
8240 EOM
8241         case "$dlext" in
8242         '')     dflt="$so" ;;
8243         *)      dflt="$dlext" ;;
8244         esac
8245         rp='What is the extension of dynamically loaded modules'
8246         . ./myread
8247         dlext="$ans"
8248         ;;
8249 *)
8250         dlext="none"
8251         ;;
8252 esac
8253
8254 : Check if dlsym need a leading underscore
8255 echo " "
8256 val="$undef"
8257
8258 case "$dlsrc" in
8259 dl_dlopen.xs)
8260         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8261         $cat >dyna.c <<'EOM'
8262 fred () { }
8263 EOM
8264
8265 $cat >fred.c<<EOM
8266
8267 #include <stdio.h>
8268 #$i_dlfcn I_DLFCN
8269 #ifdef I_DLFCN
8270 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8271 #else
8272 #include <sys/types.h>
8273 #include <nlist.h>
8274 #include <link.h>
8275 #endif
8276
8277 extern int fred() ;
8278
8279 int main()
8280 {
8281     void * handle ;
8282     void * symbol ;
8283 #ifndef RTLD_LAZY
8284     int mode = 1 ;
8285 #else
8286     int mode = RTLD_LAZY ;
8287 #endif
8288     handle = dlopen("./dyna.$dlext", mode) ;
8289     if (handle == NULL) {
8290         printf ("1\n") ;
8291         fflush (stdout) ;
8292         exit(0);
8293     }
8294     symbol = dlsym(handle, "fred") ;
8295     if (symbol == NULL) {
8296         /* try putting a leading underscore */
8297         symbol = dlsym(handle, "_fred") ;
8298         if (symbol == NULL) {
8299             printf ("2\n") ;
8300             fflush (stdout) ;
8301             exit(0);
8302         }
8303         printf ("3\n") ;
8304     }
8305     else
8306         printf ("4\n") ;
8307     fflush (stdout) ;
8308     exit(0);
8309 }
8310 EOM
8311         : Call the object file tmp-dyna.o in case dlext=o.
8312         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8313                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8314                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8315                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8316                 xxx=`./fred`
8317                 case $xxx in
8318                 1)      echo "Test program failed using dlopen." >&4
8319                         echo "Perhaps you should not use dynamic loading." >&4;;
8320                 2)      echo "Test program failed using dlsym." >&4
8321                         echo "Perhaps you should not use dynamic loading." >&4;;
8322                 3)      echo "dlsym needs a leading underscore" >&4
8323                         val="$define" ;;
8324                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8325                 esac
8326         else
8327                 echo "I can't compile and run the test program." >&4
8328                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8329         fi
8330         ;;
8331 esac
8332                 
8333 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8334
8335 set d_dlsymun
8336 eval $setvar
8337
8338 hasproto='varname=$1; func=$2; shift; shift;
8339 while $test $# -ge 2; do
8340         case "$1" in
8341         $define) echo "#include <$2>";;
8342         esac ;
8343     shift 2;
8344 done > try.c;
8345 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8346 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8347         echo "$func() prototype found.";
8348         val="$define";
8349 else
8350         echo "$func() prototype NOT found.";
8351         val="$undef";
8352 fi;
8353 set $varname;
8354 eval $setvar;
8355 $rm -f try.c tryout.c'
8356
8357 : see if prototype for drand48 is available
8358 echo " "
8359 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8360 eval $hasproto
8361
8362 : see if dup2 exists
8363 set dup2 d_dup2
8364 eval $inlibc
8365
8366 : see if eaccess exists
8367 set eaccess d_eaccess
8368 eval $inlibc
8369
8370 : see if endgrent exists
8371 set endgrent d_endgrent
8372 eval $inlibc
8373
8374 : see if endhostent exists
8375 set endhostent d_endhent
8376 eval $inlibc
8377
8378 : see if endnetent exists
8379 set endnetent d_endnent
8380 eval $inlibc
8381
8382 : see if endprotoent exists
8383 set endprotoent d_endpent
8384 eval $inlibc
8385
8386 : see if endpwent exists
8387 set endpwent d_endpwent
8388 eval $inlibc
8389
8390 : see if endservent exists
8391 set endservent d_endsent
8392 eval $inlibc
8393
8394 : see if endspent exists
8395 set endspent d_endspent
8396 eval $inlibc
8397
8398 : Locate the flags for 'open()'
8399 echo " "
8400 $cat >open3.c <<'EOCP'
8401 #include <sys/types.h>
8402 #ifdef I_FCNTL
8403 #include <fcntl.h>
8404 #endif
8405 #ifdef I_SYS_FILE
8406 #include <sys/file.h>
8407 #endif
8408 int main() {
8409         if(O_RDONLY);
8410 #ifdef O_TRUNC
8411         exit(0);
8412 #else
8413         exit(1);
8414 #endif
8415 }
8416 EOCP
8417 : check sys/file.h first to get FREAD on Sun
8418 if $test `./findhdr sys/file.h` && \
8419                 set open3 -DI_SYS_FILE && eval $compile; then
8420         h_sysfile=true;
8421         echo "<sys/file.h> defines the O_* constants..." >&4
8422         if ./open3; then
8423                 echo "and you have the 3 argument form of open()." >&4
8424                 val="$define"
8425         else
8426                 echo "but not the 3 argument form of open().  Oh, well." >&4
8427                 val="$undef"
8428         fi
8429 elif $test `./findhdr fcntl.h` && \
8430                 set open3 -DI_FCNTL && eval $compile; then
8431         h_fcntl=true;
8432         echo "<fcntl.h> defines the O_* constants..." >&4
8433         if ./open3; then
8434                 echo "and you have the 3 argument form of open()." >&4
8435                 val="$define"
8436         else
8437                 echo "but not the 3 argument form of open().  Oh, well." >&4
8438                 val="$undef"
8439         fi
8440 else
8441         val="$undef"
8442         echo "I can't find the O_* constant definitions!  You got problems." >&4
8443 fi
8444 set d_open3
8445 eval $setvar
8446 $rm -f open3*
8447
8448 : see which of string.h or strings.h is needed
8449 echo " "
8450 strings=`./findhdr string.h`
8451 if $test "$strings" && $test -r "$strings"; then
8452         echo "Using <string.h> instead of <strings.h>." >&4
8453         val="$define"
8454 else
8455         val="$undef"
8456         strings=`./findhdr strings.h`
8457         if $test "$strings" && $test -r "$strings"; then
8458                 echo "Using <strings.h> instead of <string.h>." >&4
8459         else
8460                 echo "No string header found -- You'll surely have problems." >&4
8461         fi
8462 fi
8463 set i_string
8464 eval $setvar
8465 case "$i_string" in
8466 "$undef") strings=`./findhdr strings.h`;;
8467 *)        strings=`./findhdr string.h`;;
8468 esac
8469
8470 : check for non-blocking I/O stuff
8471 case "$h_sysfile" in
8472 true) echo "#include <sys/file.h>" > head.c;;
8473 *)
8474         case "$h_fcntl" in
8475         true) echo "#include <fcntl.h>" > head.c;;
8476         *) echo "#include <sys/fcntl.h>" > head.c;;
8477         esac
8478         ;;
8479 esac
8480 echo " "
8481 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8482 case "$o_nonblock" in
8483 '')
8484         $cat head.c > try.c
8485         $cat >>try.c <<'EOCP'
8486 #include <stdio.h>
8487 int main() {
8488 #ifdef O_NONBLOCK
8489         printf("O_NONBLOCK\n");
8490         exit(0);
8491 #endif
8492 #ifdef O_NDELAY
8493         printf("O_NDELAY\n");
8494         exit(0);
8495 #endif
8496 #ifdef FNDELAY
8497         printf("FNDELAY\n");
8498         exit(0);
8499 #endif
8500         exit(0);
8501 }
8502 EOCP
8503         set try
8504         if eval $compile_ok; then
8505                 o_nonblock=`./try`
8506                 case "$o_nonblock" in
8507                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8508                 *) echo "Seems like we can use $o_nonblock.";;
8509                 esac
8510         else
8511                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8512         fi
8513         ;;
8514 *) echo "Using $hint value $o_nonblock.";;
8515 esac
8516 $rm -f try try.* .out core
8517
8518 echo " "
8519 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8520 case "$eagain" in
8521 '')
8522         $cat head.c > try.c
8523         $cat >>try.c <<EOCP
8524 #include <errno.h>
8525 #include <sys/types.h>
8526 #include <signal.h>
8527 #include <stdio.h> 
8528 #define MY_O_NONBLOCK $o_nonblock
8529 #ifndef errno  /* XXX need better Configure test */
8530 extern int errno;
8531 #endif
8532 #$i_unistd I_UNISTD
8533 #ifdef I_UNISTD
8534 #include <unistd.h>
8535 #endif
8536 #ifdef $i_string
8537 #include <string.h>
8538 #else
8539 #include <strings.h>
8540 #endif
8541 $signal_t blech(x) int x; { exit(3); }
8542 EOCP
8543         $cat >> try.c <<'EOCP'
8544 int main()
8545 {
8546         int pd[2];
8547         int pu[2];
8548         char buf[1];
8549         char string[100];
8550
8551         pipe(pd);       /* Down: child -> parent */
8552         pipe(pu);       /* Up: parent -> child */
8553         if (0 != fork()) {
8554                 int ret;
8555                 close(pd[1]);   /* Parent reads from pd[0] */
8556                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8557                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8558                         exit(1);
8559                 signal(SIGALRM, blech);
8560                 alarm(5);
8561                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8562                         exit(2);
8563                 sprintf(string, "%d\n", ret);
8564                 write(2, string, strlen(string));
8565                 alarm(0);
8566 #ifdef EAGAIN
8567                 if (errno == EAGAIN) {
8568                         printf("EAGAIN\n");
8569                         goto ok;
8570                 }
8571 #endif
8572 #ifdef EWOULDBLOCK
8573                 if (errno == EWOULDBLOCK)
8574                         printf("EWOULDBLOCK\n");
8575 #endif
8576         ok:
8577                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8578                 sleep(2);                               /* Give it time to close our pipe */
8579                 alarm(5);
8580                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8581                 alarm(0);
8582                 sprintf(string, "%d\n", ret);
8583                 write(3, string, strlen(string));
8584                 exit(0);
8585         }
8586
8587         close(pd[0]);                   /* We write to pd[1] */
8588         close(pu[1]);                   /* We read from pu[0] */
8589         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8590         close(pd[1]);                   /* Pipe pd is now fully closed! */
8591         exit(0);                                /* Bye bye, thank you for playing! */
8592 }
8593 EOCP
8594         set try
8595         if eval $compile_ok; then
8596                 echo "$startsh" >mtry
8597                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8598                 chmod +x mtry
8599                 ./mtry >/dev/null 2>&1
8600                 case $? in
8601                 0) eagain=`$cat try.out`;;
8602                 1) echo "Could not perform non-blocking setting!";;
8603                 2) echo "I did a successful read() for something that was not there!";;
8604                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8605                 *) echo "Something terribly wrong happened during testing.";;
8606                 esac
8607                 rd_nodata=`$cat try.ret`
8608                 echo "A read() system call with no data present returns $rd_nodata."
8609                 case "$rd_nodata" in
8610                 0|-1) ;;
8611                 *)
8612                         echo "(That's peculiar, fixing that to be -1.)"
8613                         rd_nodata=-1
8614                         ;;
8615                 esac
8616                 case "$eagain" in
8617                 '')
8618                         echo "Forcing errno EAGAIN on read() with no data available."
8619                         eagain=EAGAIN
8620                         ;;
8621                 *)
8622                         echo "Your read() sets errno to $eagain when no data is available."
8623                         ;;
8624                 esac
8625                 status=`$cat try.err`
8626                 case "$status" in
8627                 0) echo "And it correctly returns 0 to signal EOF.";;
8628                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8629                 *) echo "However, your read() returns '$status' on EOF??";;
8630                 esac
8631                 val="$define"
8632                 if test "$status" = "$rd_nodata"; then
8633                         echo "WARNING: you can't distinguish between EOF and no data!"
8634                         val="$undef"
8635                 fi
8636         else
8637                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8638                 eagain=EAGAIN
8639         fi
8640         set d_eofnblk
8641         eval $setvar
8642         ;;
8643 *)
8644         echo "Using $hint value $eagain."
8645         echo "Your read() returns $rd_nodata when no data is present."
8646         case "$d_eofnblk" in
8647         "$define") echo "And you can see EOF because read() returns 0.";;
8648         "$undef") echo "But you can't see EOF status from read() returned value.";;
8649         *)
8650                 echo "(Assuming you can't see EOF status from read anyway.)"
8651                 d_eofnblk=$undef
8652                 ;;
8653         esac
8654         ;;
8655 esac
8656 $rm -f try try.* .out core head.c mtry
8657
8658 : see if fchmod exists
8659 set fchmod d_fchmod
8660 eval $inlibc
8661
8662 : see if fchown exists
8663 set fchown d_fchown
8664 eval $inlibc
8665
8666 : see if this is an fcntl system
8667 set fcntl d_fcntl
8668 eval $inlibc
8669
8670 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8671 while $test $# -ge 2; do
8672         case "$1" in
8673         $define) echo "#include <$2>";;
8674         esac ;
8675     shift 2;
8676 done > try.c;
8677 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8678 set try;
8679 if eval $compile; then
8680         val="$define";
8681 else
8682         val="$undef";
8683 fi;
8684 set $varname;
8685 eval $setvar;
8686 $rm -f try.c try.o'
8687
8688 socketlib=''
8689 sockethdr=''
8690 : see whether socket exists
8691 echo " "
8692 $echo $n "Hmm... $c" >&4
8693 if set socket val -f d_socket; eval $csym; $val; then
8694         echo "Looks like you have Berkeley networking support." >&4
8695         d_socket="$define"
8696         if set setsockopt val -f; eval $csym; $val; then
8697                 d_oldsock="$undef"
8698         else
8699                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8700                 d_oldsock="$define"
8701         fi
8702 else
8703         if $contains socklib libc.list >/dev/null 2>&1; then
8704                 echo "Looks like you have Berkeley networking support." >&4
8705                 d_socket="$define"
8706                 : we will have to assume that it supports the 4.2 BSD interface
8707                 d_oldsock="$undef"
8708         else
8709                 echo "You don't have Berkeley networking in libc$_a..." >&4
8710                 if test "X$d_socket" = "X$define"; then
8711                    echo "...but you seem to believe that you have sockets." >&4
8712                 else
8713                         for net in net socket
8714                         do
8715                                 if test -f /usr/lib/lib$net$_a; then
8716                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8717                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8718                                         if $contains socket libc.list >/dev/null 2>&1; then
8719                                                 d_socket="$define"
8720                                                 socketlib="-l$net"
8721                                                 case "$net" in
8722                                                 net)
8723                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8724                                                         sockethdr="-I/usr/netinclude"
8725                                                         ;;
8726                                                 esac
8727                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8728                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8729                                                         d_oldsock="$undef"
8730                                                 else
8731                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8732                                                         d_oldsock="$define"
8733                                                 fi
8734                                                 break
8735                                         fi
8736                                 fi
8737                         done
8738                         if test "X$d_socket" != "X$define"; then
8739                            echo "or anywhere else I see." >&4
8740                            d_socket="$undef"
8741                            d_oldsock="$undef"
8742                         fi
8743                 fi
8744         fi
8745 fi
8746
8747 : see if socketpair exists
8748 set socketpair d_sockpair
8749 eval $inlibc
8750
8751
8752 echo " "
8753 echo "Checking the availability of certain socket constants..." >& 4
8754 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8755         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8756         $cat >try.c <<EOF
8757 #include <sys/types.h>
8758 #include <sys/socket.h>
8759 int main() {
8760     int i = $ENUM;
8761 }
8762 EOF
8763         val="$undef"
8764         set try; if eval $compile; then
8765                 val="$define"
8766         fi
8767         set d_${enum}; eval $setvar
8768         $rm -f try.c try
8769 done
8770
8771 : see if sys/select.h has to be included
8772 set sys/select.h i_sysselct
8773 eval $inhdr
8774
8775 : see if we should include time.h, sys/time.h, or both
8776 echo " "
8777 if test "X$timeincl" = X; then
8778         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8779         $echo $n "I'm now running the test program...$c"
8780         $cat >try.c <<'EOCP'
8781 #include <sys/types.h>
8782 #ifdef I_TIME
8783 #include <time.h>
8784 #endif
8785 #ifdef I_SYSTIME
8786 #ifdef SYSTIMEKERNEL
8787 #define KERNEL
8788 #endif
8789 #include <sys/time.h>
8790 #endif
8791 #ifdef I_SYSSELECT
8792 #include <sys/select.h>
8793 #endif
8794 int main()
8795 {
8796         struct tm foo;
8797 #ifdef S_TIMEVAL
8798         struct timeval bar;
8799 #endif
8800 #ifdef S_TIMEZONE
8801         struct timezone tzp;
8802 #endif
8803         if (foo.tm_sec == foo.tm_sec)
8804                 exit(0);
8805 #ifdef S_TIMEVAL
8806         if (bar.tv_sec == bar.tv_sec)
8807                 exit(0);
8808 #endif
8809         exit(1);
8810 }
8811 EOCP
8812         flags=''
8813         for s_timezone in '-DS_TIMEZONE' ''; do
8814         sysselect=''
8815         for s_timeval in '-DS_TIMEVAL' ''; do
8816         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8817         for i_time in '' '-DI_TIME'; do
8818         for i_systime in '-DI_SYSTIME' ''; do
8819                 case "$flags" in
8820                 '') $echo $n ".$c"
8821                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8822                         if eval $compile; then
8823                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8824                                 shift
8825                                 flags="$*"
8826                                 echo " "
8827                                 $echo $n "Succeeded with $flags$c"
8828                         fi
8829                         ;;
8830                 esac
8831         done
8832         done
8833         done
8834         done
8835         done
8836         timeincl=''
8837         echo " "
8838         case "$flags" in
8839         *SYSTIMEKERNEL*) i_systimek="$define"
8840                 timeincl=`./findhdr sys/time.h`
8841                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8842         *) i_systimek="$undef";;
8843         esac
8844         case "$flags" in
8845         *I_TIME*) i_time="$define"
8846                 timeincl=`./findhdr time.h`" $timeincl"
8847                 echo "We'll include <time.h>." >&4;;
8848         *) i_time="$undef";;
8849         esac
8850         case "$flags" in
8851         *I_SYSTIME*) i_systime="$define"
8852                 timeincl=`./findhdr sys/time.h`" $timeincl"
8853                 echo "We'll include <sys/time.h>." >&4;;
8854         *) i_systime="$undef";;
8855         esac
8856         $rm -f try.c try
8857 fi
8858
8859 : check for fd_set items
8860 $cat <<EOM
8861
8862 Checking to see how well your C compiler handles fd_set and friends ...
8863 EOM
8864 $cat >fd_set.c <<EOCP
8865 #$i_systime I_SYS_TIME
8866 #$i_sysselct I_SYS_SELECT
8867 #$d_socket HAS_SOCKET
8868 #include <sys/types.h>
8869 #ifdef HAS_SOCKET
8870 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8871 #endif
8872 #ifdef I_SYS_TIME
8873 #include <sys/time.h>
8874 #endif
8875 #ifdef I_SYS_SELECT
8876 #include <sys/select.h>
8877 #endif
8878 int main() {
8879         fd_set fds;
8880
8881 #ifdef TRYBITS
8882         if(fds.fds_bits);
8883 #endif
8884
8885 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8886         exit(0);
8887 #else
8888         exit(1);
8889 #endif
8890 }
8891 EOCP
8892 set fd_set -DTRYBITS
8893 if eval $compile; then
8894         d_fds_bits="$define"
8895         d_fd_set="$define"
8896         echo "Well, your system knows about the normal fd_set typedef..." >&4
8897         if ./fd_set; then
8898                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8899                 d_fd_macros="$define"
8900         else
8901                 $cat >&4 <<'EOM'
8902 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8903 EOM
8904                 d_fd_macros="$undef"
8905         fi
8906 else
8907         $cat <<'EOM'
8908 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8909 EOM
8910         set fd_set
8911         if eval $compile; then
8912                 d_fds_bits="$undef"
8913                 d_fd_set="$define"
8914                 echo "Well, your system has some sort of fd_set available..." >&4
8915                 if ./fd_set; then
8916                         echo "and you have the normal fd_set macros." >&4
8917                         d_fd_macros="$define"
8918                 else
8919                         $cat <<'EOM'
8920 but not the normal fd_set macros!  Gross!  More work for me...
8921 EOM
8922                         d_fd_macros="$undef"
8923                 fi
8924         else
8925         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8926                 d_fd_set="$undef"
8927                 d_fds_bits="$undef"
8928                 d_fd_macros="$undef"
8929         fi
8930 fi
8931 $rm -f fd_set*
8932
8933 : see if fgetpos exists
8934 set fgetpos d_fgetpos
8935 eval $inlibc
8936
8937 : see if flock exists
8938 set flock d_flock
8939 eval $inlibc
8940
8941 : see if fork exists
8942 set fork d_fork
8943 eval $inlibc
8944
8945 : see if pathconf exists
8946 set pathconf d_pathconf
8947 eval $inlibc
8948
8949 : see if fpathconf exists
8950 set fpathconf d_fpathconf
8951 eval $inlibc
8952
8953
8954 : check for fpos64_t
8955 echo " "
8956 echo "Checking to see if you have fpos64_t..." >&4
8957 $cat >try.c <<EOCP
8958 #include <stdio.h>
8959 int main() { fpos64_t x = 7; }
8960 EOCP
8961 set try
8962 if eval $compile; then
8963         val="$define"
8964         echo "You have fpos64_t."
8965 else
8966         val="$undef"
8967         echo "You do not have fpos64_t."
8968         case "$fpossize" in
8969         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8970         esac
8971 fi
8972 $rm -f try.* try
8973 set d_fpos64_t
8974 eval $setvar
8975
8976 hasstruct='varname=$1; struct=$2; shift; shift;
8977 while $test $# -ge 2; do
8978         case "$1" in
8979         $define) echo "#include <$2>";;
8980         esac ;
8981     shift 2;
8982 done > try.c;
8983 echo "int main () { struct $struct foo; }" >> try.c;
8984 set try;
8985 if eval $compile; then
8986         val="$define";
8987 else
8988         val="$undef";
8989 fi;
8990 set $varname;
8991 eval $setvar;
8992 $rm -f try.c try.o'
8993
8994 : see if this is a sys/param system
8995 set sys/param.h i_sysparam
8996 eval $inhdr
8997
8998 : see if this is a sys/mount.h system
8999 set sys/mount.h i_sysmount
9000 eval $inhdr
9001
9002 : see if sys/types.h has to be included
9003 set sys/types.h i_systypes
9004 eval $inhdr
9005
9006
9007 echo " "
9008 echo "Checking to see if your system supports struct fs_data..." >&4
9009 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9010 eval $hasstruct
9011 case "$d_fs_data_s" in
9012 "$define")      echo "Yes, it does."   ;;
9013 *)              echo "No, it doesn't." ;;
9014 esac
9015
9016 : see if fseeko exists
9017 set fseeko d_fseeko
9018 eval $inlibc
9019 case "$longsize" in
9020 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9021 esac
9022
9023 : see if fsetpos exists
9024 set fsetpos d_fsetpos
9025 eval $inlibc
9026
9027
9028 : see if fstatfs exists
9029 set fstatfs d_fstatfs
9030 eval $inlibc
9031
9032
9033 : see if statvfs exists
9034 set statvfs d_statvfs
9035 eval $inlibc
9036
9037 : see if fstatvfs exists
9038 set fstatvfs d_fstatvfs
9039 eval $inlibc
9040
9041
9042 : see if ftello exists
9043 set ftello d_ftello
9044 eval $inlibc
9045 case "$longsize" in
9046 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9047 esac
9048
9049 : see if getcwd exists
9050 set getcwd d_getcwd
9051 eval $inlibc
9052
9053
9054 : see if getfsstat exists
9055 set getfsstat d_getfsstat
9056 eval $inlibc
9057
9058 : see if getgrent exists
9059 set getgrent d_getgrent
9060 eval $inlibc
9061
9062 : see if gethostbyaddr exists
9063 set gethostbyaddr d_gethbyaddr
9064 eval $inlibc
9065
9066 : see if gethostbyname exists
9067 set gethostbyname d_gethbyname
9068 eval $inlibc
9069
9070 : see if gethostent exists
9071 set gethostent d_gethent
9072 eval $inlibc
9073
9074 : see how we will look up host name
9075 echo " "
9076 call=''
9077 if set gethostname val -f d_gethname; eval $csym; $val; then
9078         echo 'gethostname() found.' >&4
9079         d_gethname="$define"
9080         call=gethostname
9081 fi
9082 if set uname val -f d_uname; eval $csym; $val; then
9083         if ./xenix; then
9084                 $cat <<'EOM'
9085 uname() was found, but you're running xenix, and older versions of xenix
9086 have a broken uname(). If you don't really know whether your xenix is old
9087 enough to have a broken system call, use the default answer.
9088
9089 EOM
9090                 dflt=y
9091                 case "$d_uname" in
9092                 "$define") dflt=n;;
9093                 esac
9094                 rp='Is your uname() broken?'
9095                 . ./myread
9096                 case "$ans" in
9097                 n*) d_uname="$define"; call=uname;;
9098                 esac
9099         else
9100                 echo 'uname() found.' >&4
9101                 d_uname="$define"
9102                 case "$call" in
9103                 '') call=uname ;;
9104                 esac
9105         fi
9106 fi
9107 case "$d_gethname" in
9108 '') d_gethname="$undef";;
9109 esac
9110 case "$d_uname" in
9111 '') d_uname="$undef";;
9112 esac
9113 case "$d_uname$d_gethname" in
9114 *define*)
9115         dflt=n
9116         cat <<EOM
9117  
9118 Every now and then someone has a $call() that lies about the hostname
9119 but can't be fixed for political or economic reasons.  If you wish, I can
9120 pretend $call() isn't there and maybe compute hostname at run-time
9121 thanks to the '$phostname' command.
9122
9123 EOM
9124         rp="Shall I ignore $call() from now on?"
9125         . ./myread
9126         case "$ans" in
9127         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9128         esac;;
9129 esac
9130 case "$phostname" in
9131 '') aphostname='';;
9132 *) case "$aphostname" in
9133         /*) ;;
9134         *) set X $phostname
9135                 shift
9136                 file=$1
9137                 shift
9138                 file=`./loc $file $file $pth`
9139                 aphostname=`echo $file $*`
9140                 ;;
9141         esac
9142         ;;
9143 esac
9144 case "$d_uname$d_gethname" in
9145 *define*) ;;
9146 *)
9147         case "$phostname" in
9148         '')
9149                 echo "There will be no way for $package to get your hostname." >&4;;
9150         *)
9151         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9152                 ;;
9153         esac;;
9154 esac
9155 case "$d_phostname" in
9156 '') d_phostname="$undef";;
9157 esac
9158
9159 : see if this is a netdb.h system
9160 set netdb.h i_netdb
9161 eval $inhdr
9162
9163 : see if prototypes for various gethostxxx netdb.h functions are available
9164 echo " "
9165 set d_gethostprotos gethostent $i_netdb netdb.h
9166 eval $hasproto
9167
9168 : see if getlogin exists
9169 set getlogin d_getlogin
9170 eval $inlibc
9171
9172 : see if getmnt exists
9173 set getmnt d_getmnt
9174 eval $inlibc
9175
9176 : see if getmntent exists
9177 set getmntent d_getmntent
9178 eval $inlibc
9179
9180 : see if getnetbyaddr exists
9181 set getnetbyaddr d_getnbyaddr
9182 eval $inlibc
9183
9184 : see if getnetbyname exists
9185 set getnetbyname d_getnbyname
9186 eval $inlibc
9187
9188 : see if getnetent exists
9189 set getnetent d_getnent
9190 eval $inlibc
9191
9192 : see if prototypes for various getnetxxx netdb.h functions are available
9193 echo " "
9194 set d_getnetprotos getnetent $i_netdb netdb.h
9195 eval $hasproto
9196
9197
9198 : see if getprotobyname exists
9199 set getprotobyname d_getpbyname
9200 eval $inlibc
9201
9202 : see if getprotobynumber exists
9203 set getprotobynumber d_getpbynumber
9204 eval $inlibc
9205
9206 : see if getprotoent exists
9207 set getprotoent d_getpent
9208 eval $inlibc
9209
9210 : see if getpgid exists
9211 set getpgid d_getpgid
9212 eval $inlibc
9213
9214 : see if getpgrp2 exists
9215 set getpgrp2 d_getpgrp2
9216 eval $inlibc
9217
9218 : see if getppid exists
9219 set getppid d_getppid
9220 eval $inlibc
9221
9222 : see if getpriority exists
9223 set getpriority d_getprior
9224 eval $inlibc
9225
9226 : see if prototypes for various getprotoxxx netdb.h functions are available
9227 echo " "
9228 set d_getprotoprotos getprotoent $i_netdb netdb.h
9229 eval $hasproto
9230
9231 : see if getpwent exists
9232 set getpwent d_getpwent
9233 eval $inlibc
9234
9235
9236 : see if getservbyname exists
9237 set getservbyname d_getsbyname
9238 eval $inlibc
9239
9240 : see if getservbyport exists
9241 set getservbyport d_getsbyport
9242 eval $inlibc
9243
9244 : see if getservent exists
9245 set getservent d_getsent
9246 eval $inlibc
9247
9248 : see if prototypes for various getservxxx netdb.h functions are available
9249 echo " "
9250 set d_getservprotos getservent $i_netdb netdb.h
9251 eval $hasproto
9252
9253 : see if getspent exists
9254 set getspent d_getspent
9255 eval $inlibc
9256
9257 : see if getspnam exists
9258 set getspnam d_getspnam
9259 eval $inlibc
9260
9261 : see if gettimeofday or ftime exists
9262 set gettimeofday d_gettimeod
9263 eval $inlibc
9264 case "$d_gettimeod" in
9265 "$undef")
9266         set ftime d_ftime 
9267         eval $inlibc
9268         ;;
9269 *)
9270         val="$undef"; set d_ftime; eval $setvar
9271         ;;
9272 esac
9273 case "$d_gettimeod$d_ftime" in
9274 "$undef$undef")
9275         echo " "
9276         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9277         ;;
9278 esac
9279
9280 : see if this is an grp system
9281 set grp.h i_grp
9282 eval $inhdr
9283
9284 case "$i_grp" in
9285 $define)
9286         xxx=`./findhdr grp.h`
9287         $cppstdin $cppflags $cppminus < $xxx >$$.h
9288
9289         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9290                 val="$define"
9291         else
9292                 val="$undef"
9293         fi
9294         set d_grpasswd
9295         eval $setvar
9296
9297         $rm -f $$.h
9298         ;;
9299 *)
9300         val="$undef";
9301         set d_grpasswd; eval $setvar
9302         ;;
9303 esac
9304
9305 : see if hasmntopt exists
9306 set hasmntopt d_hasmntopt
9307 eval $inlibc
9308
9309 : see if this is a netinet/in.h or sys/in.h system
9310 set netinet/in.h i_niin sys/in.h i_sysin
9311 eval $inhdr
9312
9313 : see if arpa/inet.h has to be included
9314 set arpa/inet.h i_arpainet
9315 eval $inhdr
9316
9317 : see if htonl --and friends-- exists
9318 val=''
9319 set htonl val
9320 eval $inlibc
9321
9322 : Maybe they are macros.
9323 case "$val" in
9324 $undef)
9325         $cat >htonl.c <<EOM
9326 #include <stdio.h>
9327 #include <sys/types.h>
9328 #$i_niin I_NETINET_IN
9329 #$i_sysin I_SYS_IN
9330 #$i_arpainet I_ARPA_INET
9331 #ifdef I_NETINET_IN
9332 #include <netinet/in.h>
9333 #endif
9334 #ifdef I_SYS_IN
9335 #include <sys/in.h>
9336 #endif
9337 #ifdef I_ARPA_INET
9338 #include <arpa/inet.h>
9339 #endif
9340 #ifdef htonl
9341 printf("Defined as a macro.");
9342 #endif
9343 EOM
9344         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9345         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9346                 val="$define"
9347                 echo "But it seems to be defined as a macro." >&4
9348         fi
9349         $rm -f htonl.?
9350         ;;
9351 esac
9352 set d_htonl
9353 eval $setvar
9354
9355 : see if iconv exists
9356 set iconv d_iconv
9357 eval $inlibc
9358
9359 : index or strchr
9360 echo " "
9361 if set index val -f; eval $csym; $val; then
9362         if set strchr val -f d_strchr; eval $csym; $val; then
9363                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9364                         val="$define"
9365                         vali="$undef"
9366                         echo "strchr() found." >&4
9367                 else
9368                         val="$undef"
9369                         vali="$define"
9370                         echo "index() found." >&4
9371                 fi
9372         else
9373                 val="$undef"
9374                 vali="$define"
9375                 echo "index() found." >&4
9376         fi
9377 else
9378         if set strchr val -f d_strchr; eval $csym; $val; then
9379                 val="$define"
9380                 vali="$undef"
9381                 echo "strchr() found." >&4
9382         else
9383                 echo "No index() or strchr() found!" >&4
9384                 val="$undef"
9385                 vali="$undef"
9386         fi
9387 fi
9388 set d_strchr; eval $setvar
9389 val="$vali"
9390 set d_index; eval $setvar
9391
9392 : check whether inet_aton exists
9393 set inet_aton d_inetaton
9394 eval $inlibc
9395
9396 : see if inttypes.h is available
9397 : we want a real compile instead of Inhdr because some systems
9398 : have an inttypes.h which includes non-existent headers
9399 echo " "
9400 $cat >try.c <<EOCP
9401 #include <inttypes.h>
9402 int main() {
9403         static int32_t foo32 = 0x12345678;
9404 }
9405 EOCP
9406 set try
9407 if eval $compile; then
9408         echo "<inttypes.h> found." >&4
9409         val="$define"
9410 else
9411         echo "<inttypes.h> NOT found." >&4
9412         val="$undef"
9413 fi
9414 $rm -f try.c try
9415 set i_inttypes
9416 eval $setvar
9417
9418 : check for int64_t
9419 echo " "
9420 echo "Checking to see if you have int64_t..." >&4
9421 $cat >try.c <<EOCP
9422 #include <sys/types.h>
9423 #$i_inttypes I_INTTYPES
9424 #ifdef I_INTTYPES
9425 #include <inttypes.h>
9426 #endif
9427 int main() { int64_t x = 7; }
9428 EOCP
9429 set try
9430 if eval $compile; then
9431         val="$define"
9432         echo "You have int64_t."
9433 else
9434         val="$undef"
9435         echo "You do not have int64_t."
9436 fi
9437 $rm -f try try.*
9438 set d_int64_t
9439 eval $setvar
9440
9441 : Look for isascii
9442 echo " "
9443 $cat >isascii.c <<'EOCP'
9444 #include <stdio.h>
9445 #include <ctype.h>
9446 int main() {
9447         int c = 'A';
9448         if (isascii(c))
9449                 exit(0);
9450         else
9451                 exit(1);
9452 }
9453 EOCP
9454 set isascii
9455 if eval $compile; then
9456         echo "isascii() found." >&4
9457         val="$define"
9458 else
9459         echo "isascii() NOT found." >&4
9460         val="$undef"
9461 fi
9462 set d_isascii
9463 eval $setvar
9464 $rm -f isascii*
9465
9466 : see if killpg exists
9467 set killpg d_killpg
9468 eval $inlibc
9469
9470 : see if lchown exists
9471 echo " "
9472 $cat > try.c <<'EOCP'
9473 /* System header to define __stub macros and hopefully few prototypes,
9474     which can conflict with char lchown(); below.  */
9475 #include <assert.h>
9476 /* Override any gcc2 internal prototype to avoid an error.  */
9477 /* We use char because int might match the return type of a gcc2
9478    builtin and then its argument prototype would still apply.  */
9479 char lchown();
9480 int main() {
9481     /*  The GNU C library defines this for functions which it implements
9482         to always fail with ENOSYS.  Some functions are actually named
9483         something starting with __ and the normal name is an alias.  */
9484 #if defined (__stub_lchown) || defined (__stub___lchown)
9485 choke me
9486 #else
9487 lchown();
9488 #endif
9489 ; return 0; }
9490 EOCP
9491 set try
9492 if eval $compile; then
9493     $echo "lchown() found." >&4
9494     val="$define"
9495 else
9496     $echo "lchown() NOT found." >&4
9497     val="$undef"
9498 fi
9499 set d_lchown
9500 eval $setvar
9501
9502 : See if number of significant digits in a double precision number is known
9503 echo " "
9504 $cat >ldbl_dig.c <<EOM
9505 #$i_limits I_LIMITS
9506 #$i_float I_FLOAT
9507 #ifdef I_LIMITS
9508 #include <limits.h>
9509 #endif
9510 #ifdef I_FLOAT
9511 #include <float.h>
9512 #endif
9513 #ifdef LDBL_DIG
9514 printf("Contains LDBL_DIG");
9515 #endif
9516 EOM
9517 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9518 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9519         echo "LDBL_DIG found." >&4
9520         val="$define"
9521 else
9522         echo "LDBL_DIG NOT found." >&4
9523         val="$undef"
9524 fi
9525 $rm -f ldbl_dig.?
9526 set d_ldbl_dig
9527 eval $setvar
9528
9529 : see if link exists
9530 set link d_link
9531 eval $inlibc
9532
9533 : see if localeconv exists
9534 set localeconv d_locconv
9535 eval $inlibc
9536
9537 : see if lockf exists
9538 set lockf d_lockf
9539 eval $inlibc
9540
9541 : check for long long
9542 echo " "
9543 echo "Checking to see if you have long long..." >&4
9544 echo 'int main() { long long x = 7; return 0; }' > try.c
9545 set try
9546 if eval $compile; then
9547         val="$define"
9548         echo "You have have long long."
9549 else
9550         val="$undef"
9551         echo "You do not have long long."
9552 fi
9553 $rm try.*
9554 set d_longlong
9555 eval $setvar
9556
9557 : check for length of long long
9558 case "${d_longlong}${longlongsize}" in
9559 $define)
9560         echo " "
9561         echo "Checking to see how big your long longs are..." >&4
9562         $cat >try.c <<'EOCP'
9563 #include <stdio.h>
9564 int main()
9565 {
9566     printf("%d\n", (int)sizeof(long long));
9567     return(0);
9568 }
9569 EOCP
9570         set try
9571         if eval $compile_ok; then
9572                 longlongsize=`./try$exe_ext`
9573                 echo "Your long longs are $longlongsize bytes long."
9574         else
9575                 dflt='8'
9576                 echo " "
9577                 echo "(I can't seem to compile the test program.  Guessing...)"
9578                 rp="What is the size of a long long (in bytes)?"
9579                 . ./myread
9580                 longlongsize="$ans"
9581         fi
9582         if $test "X$longsize" = "X$longlongsize"; then
9583                 echo "(That isn't any different from an ordinary long.)"
9584         fi      
9585         ;;
9586 esac
9587 $rm -f try.* try
9588
9589 : see if prototype for lseek is available
9590 echo " "
9591 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9592 eval $hasproto
9593
9594 : see if lstat exists
9595 set lstat d_lstat
9596 eval $inlibc
9597
9598 : see if mblen exists
9599 set mblen d_mblen
9600 eval $inlibc
9601
9602 : see if mbstowcs exists
9603 set mbstowcs d_mbstowcs
9604 eval $inlibc
9605
9606 : see if mbtowc exists
9607 set mbtowc d_mbtowc
9608 eval $inlibc
9609
9610 : see if memchr exists
9611 set memchr d_memchr
9612 eval $inlibc
9613
9614 : see if memcmp exists
9615 set memcmp d_memcmp
9616 eval $inlibc
9617
9618 : see if memcpy exists
9619 set memcpy d_memcpy
9620 eval $inlibc
9621
9622 : see if memmove exists
9623 set memmove d_memmove
9624 eval $inlibc
9625
9626 : see if memset exists
9627 set memset d_memset
9628 eval $inlibc
9629
9630 : see if mkdir exists
9631 set mkdir d_mkdir
9632 eval $inlibc
9633
9634 : see if mkdtemp exists
9635 set mkdtemp d_mkdtemp
9636 eval $inlibc
9637
9638 : see if mkfifo exists
9639 set mkfifo d_mkfifo
9640 eval $inlibc
9641
9642 : see if mkstemp exists
9643 set mkstemp d_mkstemp
9644 eval $inlibc
9645
9646 : see if mkstemps exists
9647 set mkstemps d_mkstemps
9648 eval $inlibc
9649
9650 : see if mktime exists
9651 set mktime d_mktime
9652 eval $inlibc
9653
9654 : see if this is a sys/mman.h system
9655 set sys/mman.h i_sysmman
9656 eval $inhdr
9657
9658 : see if mmap exists
9659 set mmap d_mmap
9660 eval $inlibc
9661 : see what shmat returns
9662 : default to something harmless
9663 mmaptype='void *'
9664 case "$i_sysmman$d_mmap" in
9665 "$define$define")
9666         $cat >mmap.c <<'END'
9667 #include <sys/mman.h>
9668 void *mmap();
9669 END
9670         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9671                 mmaptype='void *'
9672         else
9673                 mmaptype='caddr_t'
9674         fi
9675         echo "and it returns ($mmaptype)." >&4
9676         ;;
9677 esac
9678
9679
9680
9681 : see if mprotect exists
9682 set mprotect d_mprotect
9683 eval $inlibc
9684
9685 : see if msgctl exists
9686 set msgctl d_msgctl
9687 eval $inlibc
9688
9689 : see if msgget exists
9690 set msgget d_msgget
9691 eval $inlibc
9692
9693 : see if msgsnd exists
9694 set msgsnd d_msgsnd
9695 eval $inlibc
9696
9697 : see if msgrcv exists
9698 set msgrcv d_msgrcv
9699 eval $inlibc
9700
9701 : see how much of the 'msg*(2)' library is present.
9702 h_msg=true
9703 echo " "
9704 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9705 *"$undef"*) h_msg=false;;
9706 esac
9707 case "$osname" in
9708 freebsd)
9709     case "`ipcs 2>&1`" in
9710     "SVID messages"*"not configured"*)
9711         echo "Your $osname does not have the msg*(2) configured." >&4
9712         h_msg=false
9713         val="$undef"
9714         set msgctl d_msgctl
9715         eval $setvar
9716         set msgget d_msgget
9717         eval $setvar
9718         set msgsnd d_msgsnd
9719         eval $setvar
9720         set msgrcv d_msgrcv
9721         eval $setvar
9722         ;;
9723     esac
9724     ;;
9725 esac
9726 : we could also check for sys/ipc.h ...
9727 if $h_msg && $test `./findhdr sys/msg.h`; then
9728         echo "You have the full msg*(2) library." >&4
9729         val="$define"
9730 else
9731         echo "You don't have the full msg*(2) library." >&4
9732         val="$undef"
9733 fi
9734 set d_msg
9735 eval $setvar
9736
9737 : see if msync exists
9738 set msync d_msync
9739 eval $inlibc
9740
9741 : see if munmap exists
9742 set munmap d_munmap
9743 eval $inlibc
9744
9745 : see if nice exists
9746 set nice d_nice
9747 eval $inlibc
9748
9749
9750 echo " "
9751 echo "Checking which 64-bit integer type we could use..." >&4
9752
9753 case "$intsize" in
9754 8) val=int
9755    set quadtype
9756    eval $setvar
9757    val='"unsigned int"'
9758    set uquadtype
9759    eval $setvar
9760    quadkind=1
9761    ;;
9762 *) case "$longsize" in
9763    8) val=long
9764       set quadtype
9765       eval $setvar
9766       val='"unsigned long"'
9767       set uquadtype
9768       eval $setvar
9769       quadkind=2
9770       ;;
9771    *) case "$d_longlong:$longlongsize" in
9772       define:8)
9773         val='"long long"'
9774         set quadtype
9775         eval $setvar
9776         val='"unsigned long long"'
9777         set uquadtype
9778         eval $setvar
9779         quadkind=3
9780         ;;
9781       *) case "$d_int64_t" in
9782          define)
9783            val=int64_t
9784            set quadtype
9785            eval $setvar
9786            val=uint64_t
9787            set uquadtype
9788            eval $setvar
9789            quadkind=4
9790            ;;
9791          esac
9792          ;;
9793       esac
9794       ;;
9795    esac
9796    ;;
9797 esac
9798
9799 case "$quadtype" in
9800 '')     echo "Alas, no 64-bit integer types in sight." >&4
9801         d_quad="$undef"
9802         ;;
9803 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9804             verb="will"
9805         else
9806             verb="could"
9807         fi
9808         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9809         d_quad="$define"
9810         ;;
9811 esac
9812
9813 : check for length of character
9814 echo " "
9815 case "$charsize" in
9816 '')
9817         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9818         $cat >try.c <<'EOCP'
9819 #include <stdio.h>
9820 int main()
9821 {
9822     printf("%d\n", (int)sizeof(char));
9823     exit(0);
9824 }
9825 EOCP
9826         set try
9827         if eval $compile_ok; then
9828                 dflt=`./try`
9829         else
9830                 dflt='1'
9831                 echo "(I can't seem to compile the test program.  Guessing...)"
9832         fi
9833         ;;
9834 *)
9835         dflt="$charsize"
9836         ;;
9837 esac
9838 rp="What is the size of a character (in bytes)?"
9839 . ./myread
9840 charsize="$ans"
9841 $rm -f try.c try
9842
9843
9844 echo " "
9845 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9846
9847 case "$use64bitint:$d_quad:$quadtype" in
9848 define:define:?*)
9849         ivtype="$quadtype"
9850         uvtype="$uquadtype"
9851         ivsize=8
9852         uvsize=8
9853         ;;
9854 *)      ivtype="long"
9855         uvtype="unsigned long"
9856         ivsize=$longsize
9857         uvsize=$longsize
9858         ;;
9859 esac
9860
9861 case "$uselongdouble:$d_longdbl" in
9862 define:define)
9863         nvtype="long double"
9864         nvsize=$longdblsize
9865         ;;
9866 *)      nvtype=double
9867         nvsize=$doublesize
9868         ;;
9869 esac
9870
9871 $echo "(IV will be "$ivtype", $ivsize bytes)"
9872 $echo "(UV will be "$uvtype", $uvsize bytes)"
9873 $echo "(NV will be "$nvtype", $nvsize bytes)"
9874
9875 $cat >try.c <<EOCP
9876 #$i_inttypes I_INTTYPES
9877 #ifdef I_INTTYPES
9878 #include <inttypes.h>
9879 #endif
9880 #include <stdio.h>
9881 int main() {
9882 #ifdef INT8
9883    int8_t i =  INT8_MAX;
9884   uint8_t u = UINT8_MAX;
9885   printf("int8_t\n");
9886 #endif
9887 #ifdef INT16
9888    int16_t i =  INT16_MAX;
9889   uint16_t i = UINT16_MAX;
9890   printf("int16_t\n");
9891 #endif
9892 #ifdef INT32
9893    int32_t i =  INT32_MAX;
9894   uint32_t u = UINT32_MAX;
9895   printf("int32_t\n");
9896 #endif
9897 }
9898 EOCP
9899
9900 case "$i8type" in
9901 '')     case "$charsize" in
9902         1)      i8type=char
9903                 u8type="unsigned char"
9904                 i8size=$charsize
9905                 u8size=$charsize
9906                 ;;
9907         esac
9908         ;;
9909 esac
9910 case "$i8type" in
9911 '')     set try -DINT8
9912         if eval $compile; then
9913                 case "`./try$exe_ext`" in
9914                 int8_t) i8type=int8_t
9915                         u8type=uint8_t
9916                         i8size=1
9917                         u8size=1
9918                         ;;
9919                 esac
9920         fi
9921         ;;
9922 esac
9923 case "$i8type" in
9924 '')     if $test $charsize -ge 1; then
9925                 i8type=char
9926                 u8type="unsigned char"
9927                 i8size=$charsize
9928                 u8size=$charsize
9929         fi
9930         ;;
9931 esac
9932
9933 case "$i16type" in
9934 '')     case "$shortsize" in
9935         2)      i16type=short
9936                 u16type="unsigned short"
9937                 i16size=$shortsize
9938                 u16size=$shortsize
9939                 ;;
9940         esac
9941         ;;
9942 esac
9943 case "$i16type" in
9944 '')     set try -DINT16
9945         if eval $compile; then
9946                 case "`./try$exe_ext`" in
9947                 int16_t)
9948                         i16type=int16_t
9949                         u16type=uint16_t
9950                         i16size=2
9951                         u16size=2
9952                         ;;
9953                 esac
9954         fi
9955         ;;
9956 esac
9957 case "$i16type" in
9958 '')     if $test $shortsize -ge 2; then
9959                 i16type=short
9960                 u16type="unsigned short"
9961                 i16size=$shortsize
9962                 u16size=$shortsize
9963         fi
9964         ;;
9965 esac
9966
9967 case "$i32type" in
9968 '')     case "$longsize" in
9969         4)      i32type=long
9970                 u32type="unsigned long"
9971                 i32size=$longsize
9972                 u32size=$longsize
9973                 ;;
9974         *)      case "$intsize" in
9975                 4)      i32type=int
9976                         u32type="unsigned int"
9977                         i32size=$intsize
9978                         u32size=$intsize
9979                         ;;
9980                 esac
9981                 ;;
9982         esac
9983         ;;
9984 esac
9985 case "$i32type" in
9986 '')     set try -DINT32
9987         if eval $compile; then
9988                 case "`./try$exe_ext`" in
9989                 int32_t)
9990                         i32type=int32_t
9991                         u32type=uint32_t
9992                         i32size=4
9993                         u32size=4
9994                         ;;
9995                 esac
9996         fi
9997         ;;
9998 esac
9999 case "$i32type" in
10000 '')     if $test $intsize -ge 4; then
10001                 i32type=int
10002                 u32type="unsigned int"
10003                 i32size=$intsize
10004                 u32size=$intsize
10005         fi
10006         ;;
10007 esac
10008
10009 case "$i64type" in
10010 '')     case "$d_quad:$quadtype" in
10011         define:?*)
10012                 i64type="$quadtype"
10013                 u64type="$uquadtype"
10014                 i64size=8
10015                 u64size=8
10016                 ;;
10017         esac
10018         ;;
10019 esac
10020
10021 $echo "Checking whether your NVs can preserve your UVs..." >&4
10022 $cat <<EOP >try.c
10023 #include <stdio.h>
10024 int main() {
10025     $uvtype k = ($uvtype)~0, l;
10026     $nvtype d;
10027     l = k;
10028     d = ($nvtype)l;
10029     l = ($uvtype)d;
10030     if (l == k)
10031        printf("preserve\n");
10032     exit(0);
10033 }
10034 EOP
10035 set try
10036 if eval $compile; then
10037         case "`./try$exe_ext`" in
10038         preserve) d_nv_preserves_uv="$define" ;;
10039         esac
10040 fi      
10041 case "$d_nv_preserves_uv" in
10042 $define) $echo "Yes, they can."  2>&1 ;;
10043 *)       $echo "No, they can't." 2>&1
10044          d_nv_preserves_uv="$undef"
10045          ;;
10046 esac
10047
10048 $rm -f try.* try
10049
10050
10051 : check for off64_t
10052 echo " "
10053 echo "Checking to see if you have off64_t..." >&4
10054 $cat >try.c <<EOCP
10055 #include <sys/types.h>
10056 #include <unistd.h>
10057 int main() { off64_t x = 7; }
10058 EOCP
10059 set try
10060 if eval $compile; then
10061         val="$define"
10062         echo "You have off64_t."
10063 else
10064         val="$undef"
10065         echo "You do not have off64_t."
10066         case "$lseeksize" in
10067         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10068         esac
10069 fi
10070 $rm -f try.* try
10071 set d_off64_t
10072 eval $setvar
10073
10074 : see if POSIX threads are available
10075 set pthread.h i_pthread
10076 eval $inhdr
10077
10078
10079
10080
10081 : how to create joinable pthreads
10082 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10083         echo " "
10084         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10085         $cat >try.c <<'EOCP'
10086 #include <pthread.h>
10087 int main() {
10088     int detachstate = JOINABLE;
10089 }
10090 EOCP
10091         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10092         if eval $compile; then
10093                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10094                 val="$undef" # Yes, undef.
10095                 set d_old_pthread_create_joinable
10096                 eval $setvar
10097                 val=""
10098                 set old_pthread_create_joinable
10099                 eval $setvar
10100         else
10101                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10102                 if eval $compile; then
10103                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10104                         val="$define"
10105                         set d_old_pthread_create_joinable
10106                         eval $setvar
10107                         val=PTHREAD_CREATE_UNDETACHED
10108                         set old_pthread_create_joinable
10109                         eval $setvar
10110                 else            
10111                         set try -DJOINABLE=__UNDETACHED
10112                         if eval $compile; then
10113                                 echo "You seem to use __UNDETACHED." >&4
10114                                 val="$define"
10115                                 set d_old_pthread_create_joinable
10116                                 eval $setvar
10117                                 val=__UNDETACHED
10118                                 set old_pthread_create_joinable
10119                                 eval $setvar
10120                         else
10121                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10122                                 val="$define"
10123                                 set d_old_pthread_create_joinable
10124                                 eval $setvar
10125                                 val=0
10126                                 set old_pthread_create_joinable
10127                                 eval $setvar
10128                         fi
10129                 fi
10130         fi
10131         $rm -f try try.*
10132 else
10133     d_old_pthread_create_joinable="$undef"
10134     old_pthread_create_joinable=""
10135 fi
10136
10137 : see if pause exists
10138 set pause d_pause
10139 eval $inlibc
10140
10141 : see if pipe exists
10142 set pipe d_pipe
10143 eval $inlibc
10144
10145 : see if poll exists
10146 set poll d_poll
10147 eval $inlibc
10148
10149
10150 : see whether the various POSIXish _yields exist
10151 $cat >try.c <<EOP
10152 #include <pthread.h>
10153 #include <stdio.h>
10154 int main() {
10155 #ifdef SCHED_YIELD
10156         sched_yield();
10157 #else
10158 #ifdef PTHREAD_YIELD
10159         pthread_yield();
10160 #else
10161 #ifdef PTHREAD_YIELD_NULL
10162         pthread_yield(NULL);
10163 #endif
10164 #endif
10165 #endif
10166 }
10167 EOP
10168 : see if sched_yield exists
10169 set try -DSCHED_YIELD
10170 if eval $compile; then
10171     val="$define"
10172     sched_yield='sched_yield()'
10173 else
10174     val="$undef"
10175 fi
10176 case "$usethreads" in
10177 $define)
10178         case "$val" in
10179         $define) echo 'sched_yield() found.' >&4        ;;
10180         *)       echo 'sched_yield() NOT found.' >&4    ;;
10181         esac
10182 esac
10183 set d_sched_yield
10184 eval $setvar
10185
10186 : see if pthread_yield exists
10187 set try -DPTHREAD_YIELD
10188 if eval $compile; then
10189     val="$define"
10190     case "$sched_yield" in
10191     '') sched_yield='pthread_yield()' ;;
10192     esac
10193 else
10194     set try -DPTHREAD_YIELD_NULL
10195     if eval $compile; then
10196         val="$define"
10197         case "$sched_yield" in
10198         '') sched_yield='pthread_yield(NULL)' ;;
10199         esac
10200     else
10201         val="$undef"
10202     fi
10203 fi
10204 case "$usethreads" in
10205 $define)
10206         case "$val" in
10207         $define) echo 'pthread_yield() found.' >&4      ;;
10208         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10209         esac
10210         ;;
10211 esac
10212 set d_pthread_yield
10213 eval $setvar
10214
10215 case "$sched_yield" in
10216 '') sched_yield=undef ;;
10217 esac
10218
10219 $rm -f try try.*
10220
10221 : see if this is a pwd.h system
10222 set pwd.h i_pwd
10223 eval $inhdr
10224
10225 case "$i_pwd" in
10226 $define)
10227         xxx=`./findhdr pwd.h`
10228         $cppstdin $cppflags $cppminus < $xxx >$$.h
10229
10230         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10231                 val="$define"
10232         else
10233                 val="$undef"
10234         fi
10235         set d_pwquota
10236         eval $setvar
10237
10238         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10239                 val="$define"
10240         else
10241                 val="$undef"
10242         fi
10243         set d_pwage
10244         eval $setvar
10245
10246         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10247                 val="$define"
10248         else
10249                 val="$undef"
10250         fi
10251         set d_pwchange
10252         eval $setvar
10253
10254         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10255                 val="$define"
10256         else
10257                 val="$undef"
10258         fi
10259         set d_pwclass
10260         eval $setvar
10261
10262         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10263                 val="$define"
10264         else
10265                 val="$undef"
10266         fi
10267         set d_pwexpire
10268         eval $setvar
10269
10270         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10271                 val="$define"
10272         else
10273                 val="$undef"
10274         fi
10275         set d_pwcomment
10276         eval $setvar
10277
10278         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10279                 val="$define"
10280         else
10281                 val="$undef"
10282         fi
10283         set d_pwgecos
10284         eval $setvar
10285
10286         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10287                 val="$define"
10288         else
10289                 val="$undef"
10290         fi
10291         set d_pwpasswd
10292         eval $setvar
10293
10294         $rm -f $$.h
10295         ;;
10296 *)
10297         val="$undef"; 
10298         set d_pwquota; eval $setvar
10299         set d_pwage; eval $setvar
10300         set d_pwchange; eval $setvar
10301         set d_pwclass; eval $setvar
10302         set d_pwexpire; eval $setvar
10303         set d_pwcomment; eval $setvar
10304         set d_pwgecos; eval $setvar
10305         set d_pwpasswd; eval $setvar
10306         ;;
10307 esac
10308
10309 : see if readdir and friends exist
10310 set readdir d_readdir
10311 eval $inlibc
10312 set seekdir d_seekdir
10313 eval $inlibc
10314 set telldir d_telldir
10315 eval $inlibc
10316 set rewinddir d_rewinddir
10317 eval $inlibc
10318
10319 : see if readlink exists
10320 set readlink d_readlink
10321 eval $inlibc
10322
10323 : see if rename exists
10324 set rename d_rename
10325 eval $inlibc
10326
10327 : see if rmdir exists
10328 set rmdir d_rmdir
10329 eval $inlibc
10330
10331 : see if memory.h is available.
10332 val=''
10333 set memory.h val
10334 eval $inhdr
10335
10336 : See if it conflicts with string.h
10337 case "$val" in
10338 $define)
10339         case "$strings" in
10340         '') ;;
10341         *)
10342                 $cppstdin $cppflags $cppminus < $strings > mem.h
10343                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10344                         echo " "
10345                         echo "We won't be including <memory.h>."
10346                         val="$undef"
10347                 fi
10348                 $rm -f mem.h
10349                 ;;
10350         esac
10351 esac
10352 set i_memory
10353 eval $setvar
10354
10355 : can bcopy handle overlapping blocks?
10356 val="$undef"
10357 case "$d_bcopy" in
10358 "$define")
10359         echo " "
10360         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10361         $cat >try.c <<EOCP
10362 #$i_memory I_MEMORY
10363 #$i_stdlib I_STDLIB
10364 #$i_string I_STRING
10365 #$i_unistd I_UNISTD
10366 EOCP
10367         $cat >>try.c <<'EOCP'
10368 #include <stdio.h>
10369 #ifdef I_MEMORY
10370 #  include <memory.h>
10371 #endif
10372 #ifdef I_STDLIB
10373 #  include <stdlib.h>
10374 #endif
10375 #ifdef I_STRING
10376 #  include <string.h>
10377 #else
10378 #  include <strings.h>
10379 #endif
10380 #ifdef I_UNISTD
10381 #  include <unistd.h>  /* Needed for NetBSD */
10382 #endif
10383 int main()
10384 {
10385 char buf[128], abc[128];
10386 char *b;
10387 int len;
10388 int off;
10389 int align;
10390
10391 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10392
10393 for (align = 7; align >= 0; align--) {
10394         for (len = 36; len; len--) {
10395                 b = buf+align;
10396                 bcopy(abc, b, len);
10397                 for (off = 1; off <= len; off++) {
10398                         bcopy(b, b+off, len);
10399                         bcopy(b+off, b, len);
10400                         if (bcmp(b, abc, len))
10401                                 exit(1);
10402                 }
10403         }
10404 }
10405 exit(0);
10406 }
10407 EOCP
10408         set try
10409         if eval $compile_ok; then
10410                 if ./try 2>/dev/null; then
10411                         echo "Yes, it can."
10412                         val="$define"
10413                 else
10414                         echo "It can't, sorry."
10415                         case "$d_memmove" in
10416                         "$define") echo "But that's Ok since you have memmove()." ;;
10417                         esac
10418                 fi
10419         else
10420                 echo "(I can't compile the test program, so we'll assume not...)"
10421                 case "$d_memmove" in
10422                 "$define") echo "But that's Ok since you have memmove()." ;;
10423                 esac
10424         fi
10425         ;;
10426 esac
10427 $rm -f try.* try core
10428 set d_safebcpy
10429 eval $setvar
10430
10431 : can memcpy handle overlapping blocks?
10432 val="$undef"
10433 case "$d_memcpy" in
10434 "$define")
10435         echo " "
10436         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10437         $cat >try.c <<EOCP
10438 #$i_memory I_MEMORY
10439 #$i_stdlib I_STDLIB
10440 #$i_string I_STRING
10441 #$i_unistd I_UNISTD
10442 EOCP
10443         $cat >>try.c <<'EOCP'
10444 #include <stdio.h>
10445 #ifdef I_MEMORY
10446 #  include <memory.h>
10447 #endif
10448 #ifdef I_STDLIB
10449 #  include <stdlib.h>
10450 #endif
10451 #ifdef I_STRING
10452 #  include <string.h>
10453 #else
10454 #  include <strings.h>
10455 #endif
10456 #ifdef I_UNISTD
10457 #  include <unistd.h>  /* Needed for NetBSD */
10458 #endif
10459 int main()
10460 {
10461 char buf[128], abc[128];
10462 char *b;
10463 int len;
10464 int off;
10465 int align;
10466
10467 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10468    try to store the string in read-only memory. */
10469 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10470
10471 for (align = 7; align >= 0; align--) {
10472         for (len = 36; len; len--) {
10473                 b = buf+align;
10474                 memcpy(b, abc, len);
10475                 for (off = 1; off <= len; off++) {
10476                         memcpy(b+off, b, len);
10477                         memcpy(b, b+off, len);
10478                         if (memcmp(b, abc, len))
10479                                 exit(1);
10480                 }
10481         }
10482 }
10483 exit(0);
10484 }
10485 EOCP
10486         set try
10487         if eval $compile_ok; then
10488                 if ./try 2>/dev/null; then
10489                         echo "Yes, it can."
10490                         val="$define"
10491                 else
10492                         echo "It can't, sorry."
10493                         case "$d_memmove" in
10494                         "$define") echo "But that's Ok since you have memmove()." ;;
10495                         esac
10496                 fi
10497         else
10498                 echo "(I can't compile the test program, so we'll assume not...)"
10499                 case "$d_memmove" in
10500                 "$define") echo "But that's Ok since you have memmove()." ;;
10501                 esac
10502         fi
10503         ;;
10504 esac
10505 $rm -f try.* try core
10506 set d_safemcpy
10507 eval $setvar
10508
10509 : can memcmp be trusted to compare relative magnitude?
10510 val="$undef"
10511 case "$d_memcmp" in
10512 "$define")
10513         echo " "
10514         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10515         $cat >try.c <<EOCP
10516 #$i_memory I_MEMORY
10517 #$i_stdlib I_STDLIB
10518 #$i_string I_STRING
10519 #$i_unistd I_UNISTD
10520 EOCP
10521         $cat >>try.c <<'EOCP'
10522 #include <stdio.h>
10523 #ifdef I_MEMORY
10524 #  include <memory.h>
10525 #endif
10526 #ifdef I_STDLIB
10527 #  include <stdlib.h>
10528 #endif
10529 #ifdef I_STRING
10530 #  include <string.h>
10531 #else
10532 #  include <strings.h>
10533 #endif
10534 #ifdef I_UNISTD
10535 #  include <unistd.h>  /* Needed for NetBSD */
10536 #endif
10537 int main()
10538 {
10539 char a = -1;
10540 char b = 0;
10541 if ((a < b) && memcmp(&a, &b, 1) < 0)
10542         exit(1);
10543 exit(0);
10544 }
10545 EOCP
10546         set try
10547         if eval $compile_ok; then
10548                 if ./try 2>/dev/null; then
10549                         echo "Yes, it can."
10550                         val="$define"
10551                 else
10552                         echo "No, it can't (it uses signed chars)."
10553                 fi
10554         else
10555                 echo "(I can't compile the test program, so we'll assume not...)"
10556         fi
10557         ;;
10558 esac
10559 $rm -f try.* try core
10560 set d_sanemcmp
10561 eval $setvar
10562
10563 : see if select exists
10564 set select d_select
10565 eval $inlibc
10566
10567 : see if semctl exists
10568 set semctl d_semctl
10569 eval $inlibc
10570
10571 : see if semget exists
10572 set semget d_semget
10573 eval $inlibc
10574
10575 : see if semop exists
10576 set semop d_semop
10577 eval $inlibc
10578
10579 : see how much of the 'sem*(2)' library is present.
10580 h_sem=true
10581 echo " "
10582 case "$d_semctl$d_semget$d_semop" in
10583 *"$undef"*) h_sem=false;;
10584 esac
10585 case "$osname" in
10586 freebsd)
10587     case "`ipcs 2>&1`" in
10588     "SVID messages"*"not configured"*)
10589         echo "Your $osname does not have the sem*(2) configured." >&4
10590         h_sem=false
10591         val="$undef"
10592         set semctl d_semctl
10593         eval $setvar
10594         set semget d_semget
10595         eval $setvar
10596         set semop d_semop
10597         eval $setvar
10598         ;;
10599     esac
10600     ;;
10601 esac
10602 : we could also check for sys/ipc.h ...
10603 if $h_sem && $test `./findhdr sys/sem.h`; then
10604         echo "You have the full sem*(2) library." >&4
10605         val="$define"
10606 else
10607         echo "You don't have the full sem*(2) library." >&4
10608         val="$undef"
10609 fi
10610 set d_sem
10611 eval $setvar
10612
10613 : see whether sys/sem.h defines union semun
10614 echo " "
10615 $cat > try.c <<'END'
10616 #include <sys/types.h>
10617 #include <sys/ipc.h>
10618 #include <sys/sem.h>
10619 int main () { union semun semun; semun.buf = 0; }
10620 END
10621 set try
10622 if eval $compile; then
10623     echo "You have union semun in <sys/sem.h>." >&4
10624     val="$define"
10625 else
10626     echo "You do not have union semun in <sys/sem.h>." >&4
10627     val="$undef"
10628 fi
10629 $rm -f try try.c try.h
10630 set d_union_semun
10631 eval $setvar
10632
10633 : see how to do semctl IPC_STAT
10634 case "$d_sem" in
10635 $define)
10636     : see whether semctl IPC_STAT can use union semun
10637     echo " "
10638     $cat > try.h <<END
10639 #ifndef S_IRUSR
10640 #   ifdef S_IREAD
10641 #       define S_IRUSR S_IREAD
10642 #       define S_IWUSR S_IWRITE
10643 #       define S_IXUSR S_IEXEC
10644 #   else
10645 #       define S_IRUSR 0400
10646 #       define S_IWUSR 0200
10647 #       define S_IXUSR 0100
10648 #   endif
10649 #   define S_IRGRP (S_IRUSR>>3)
10650 #   define S_IWGRP (S_IWUSR>>3)
10651 #   define S_IXGRP (S_IXUSR>>3)
10652 #   define S_IROTH (S_IRUSR>>6)
10653 #   define S_IWOTH (S_IWUSR>>6)
10654 #   define S_IXOTH (S_IXUSR>>6)
10655 #endif
10656 #ifndef S_IRWXU
10657 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10658 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10659 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10660 #endif
10661 END
10662
10663     $cat > try.c <<END
10664 #include <sys/types.h>
10665 #include <sys/ipc.h>
10666 #include <sys/sem.h>
10667 #include <sys/stat.h>
10668 #include <stdio.h>
10669 #include <errno.h>
10670 #include "try.h"
10671 #ifndef errno
10672 extern int errno;
10673 #endif
10674 #$d_union_semun HAS_UNION_SEMUN
10675 int main() {
10676     union semun
10677 #ifndef HAS_UNION_SEMUN
10678     {
10679         int val;
10680         struct semid_ds *buf;
10681         unsigned short *array;
10682     }
10683 #endif
10684     arg;
10685     int sem, st;
10686
10687 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10688     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10689     if (sem > -1) {
10690         struct semid_ds argbuf;
10691         arg.buf = &argbuf;
10692 #       ifdef IPC_STAT
10693         st = semctl(sem, 0, IPC_STAT, arg);
10694         if (st == 0)
10695             printf("semun\n");
10696         else
10697 #       endif /* IPC_STAT */
10698             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10699 #       ifdef IPC_RMID
10700         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10701 #       endif /* IPC_RMID */
10702             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10703     } else
10704 #endif /* IPC_PRIVATE && ... */
10705         printf("semget failed: errno = %d\n", errno);
10706   return 0;
10707 }
10708 END
10709     val="$undef"
10710     set try
10711     if eval $compile; then
10712         xxx=`./try`
10713         case "$xxx" in
10714         semun) val="$define" ;;
10715         esac
10716     fi
10717     $rm -f try try.c
10718     set d_semctl_semun
10719     eval $setvar
10720     case "$d_semctl_semun" in
10721     $define)
10722         echo "You can use union semun for semctl IPC_STAT." >&4
10723         also='also'
10724         ;;
10725     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10726         also=''
10727         ;;
10728     esac
10729
10730     : see whether semctl IPC_STAT can use struct semid_ds pointer
10731     $cat > try.c <<'END'
10732 #include <sys/types.h>
10733 #include <sys/ipc.h>
10734 #include <sys/sem.h>
10735 #include <sys/stat.h>
10736 #include "try.h"
10737 #include <stdio.h>
10738 #include <errno.h>
10739 #ifndef errno
10740 extern int errno;
10741 #endif
10742 int main() {
10743     struct semid_ds arg;
10744     int sem, st;
10745
10746 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10747     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10748     if (sem > -1) {
10749 #       ifdef IPC_STAT
10750         st = semctl(sem, 0, IPC_STAT, &arg);
10751         if (st == 0)
10752             printf("semid_ds\n");
10753         else
10754 #       endif /* IPC_STAT */
10755             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10756 #       ifdef IPC_RMID
10757         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10758 #       endif /* IPC_RMID */
10759             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10760     } else
10761 #endif /* IPC_PRIVATE && ... */
10762         printf("semget failed: errno = %d\n", errno);
10763
10764     return 0;
10765 }
10766 END
10767     val="$undef"
10768     set try
10769     if eval $compile; then
10770         xxx=`./try`
10771         case "$xxx" in
10772         semid_ds) val="$define" ;;
10773         esac
10774     fi
10775     $rm -f try try.c
10776     set d_semctl_semid_ds
10777     eval $setvar
10778     case "$d_semctl_semid_ds" in
10779     $define)
10780         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10781         ;;
10782     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10783         ;;
10784     esac
10785     $rm -f try.h
10786     ;;
10787 *)  val="$undef"
10788
10789     # We do not have the full sem*(2) library, so assume we can not
10790     # use either.
10791
10792     set d_semctl_semun
10793     eval $setvar
10794
10795     set d_semctl_semid_ds
10796     eval $setvar
10797     ;;
10798 esac
10799
10800 : see if setegid exists
10801 set setegid d_setegid
10802 eval $inlibc
10803
10804 : see if seteuid exists
10805 set seteuid d_seteuid
10806 eval $inlibc
10807
10808 : see if setgrent exists
10809 set setgrent d_setgrent
10810 eval $inlibc
10811
10812 : see if sethostent exists
10813 set sethostent d_sethent
10814 eval $inlibc
10815
10816 : see if setlinebuf exists
10817 set setlinebuf d_setlinebuf
10818 eval $inlibc
10819
10820 : see if setlocale exists
10821 set setlocale d_setlocale
10822 eval $inlibc
10823
10824 : see if setnetent exists
10825 set setnetent d_setnent
10826 eval $inlibc
10827
10828 : see if setprotoent exists
10829 set setprotoent d_setpent
10830 eval $inlibc
10831
10832 : see if setpgid exists
10833 set setpgid d_setpgid
10834 eval $inlibc
10835
10836 : see if setpgrp2 exists
10837 set setpgrp2 d_setpgrp2
10838 eval $inlibc
10839
10840 : see if setpriority exists
10841 set setpriority d_setprior
10842 eval $inlibc
10843
10844 : see if setpwent exists
10845 set setpwent d_setpwent
10846 eval $inlibc
10847
10848 : see if setregid exists
10849 set setregid d_setregid
10850 eval $inlibc
10851 set setresgid d_setresgid
10852 eval $inlibc
10853
10854 : see if setreuid exists
10855 set setreuid d_setreuid
10856 eval $inlibc
10857 set setresuid d_setresuid
10858 eval $inlibc
10859
10860 : see if setrgid exists
10861 set setrgid d_setrgid
10862 eval $inlibc
10863
10864 : see if setruid exists
10865 set setruid d_setruid
10866 eval $inlibc
10867
10868 : see if setservent exists
10869 set setservent d_setsent
10870 eval $inlibc
10871
10872 : see if setsid exists
10873 set setsid d_setsid
10874 eval $inlibc
10875
10876 : see if setspent exists
10877 set setspent d_setspent
10878 eval $inlibc
10879
10880 : see if setvbuf exists
10881 set setvbuf d_setvbuf
10882 eval $inlibc
10883
10884 : see if sfio.h is available
10885 set sfio.h i_sfio
10886 eval $inhdr
10887
10888
10889 : see if sfio library is available
10890 case "$i_sfio" in
10891 $define)
10892         val=''
10893         set sfreserve val
10894         eval $inlibc
10895         ;;
10896 *)
10897         val="$undef"
10898         ;;
10899 esac
10900 : Ok, but do we want to use it.
10901 case "$val" in
10902 $define)
10903         case "$usesfio" in
10904         true|$define|[yY]*) dflt='y';;
10905         *) dflt='n';;
10906         esac
10907         echo "$package can use the sfio library, but it is experimental."
10908         rp="You seem to have sfio available, do you want to try using it?"
10909         . ./myread
10910         case "$ans" in
10911         y|Y) ;;
10912         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10913                 val="$undef"
10914                 : Remove sfio from list of libraries to use
10915                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10916                 shift
10917                 libs="$*"
10918                 echo "libs = $libs" >&4
10919                 ;;
10920         esac
10921         ;;
10922 *)      case "$usesfio" in
10923         true|$define|[yY]*)
10924                 echo "Sorry, cannot find sfio on this machine" >&4
10925                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10926                 ;;
10927         esac
10928         ;;
10929 esac
10930 set d_sfio
10931 eval $setvar
10932 case "$d_sfio" in
10933 $define) usesfio='true';;
10934 *) usesfio='false';;
10935 esac
10936
10937 : see if shmctl exists
10938 set shmctl d_shmctl
10939 eval $inlibc
10940
10941 : see if shmget exists
10942 set shmget d_shmget
10943 eval $inlibc
10944
10945 : see if shmat exists
10946 set shmat d_shmat
10947 eval $inlibc
10948 : see what shmat returns
10949 case "$d_shmat" in
10950 "$define")
10951         $cat >shmat.c <<'END'
10952 #include <sys/shm.h>
10953 void *shmat();
10954 END
10955         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10956                 shmattype='void *'
10957         else
10958                 shmattype='char *'
10959         fi
10960         echo "and it returns ($shmattype)." >&4
10961         : see if a prototype for shmat is available
10962         xxx=`./findhdr sys/shm.h`
10963         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10964         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10965                 val="$define"
10966         else
10967                 val="$undef"
10968         fi
10969         $rm -f shmat.[co]
10970         ;;
10971 *)
10972         val="$undef"
10973         ;;
10974 esac
10975 set d_shmatprototype
10976 eval $setvar
10977
10978 : see if shmdt exists
10979 set shmdt d_shmdt
10980 eval $inlibc
10981
10982 : see how much of the 'shm*(2)' library is present.
10983 h_shm=true
10984 echo " "
10985 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10986 *"$undef"*) h_shm=false;;
10987 esac
10988 case "$osname" in
10989 freebsd)
10990     case "`ipcs 2>&1`" in
10991     "SVID shared memory"*"not configured"*)
10992         echo "Your $osname does not have the shm*(2) configured." >&4
10993         h_shm=false
10994         val="$undef"
10995         set shmctl d_shmctl
10996         evat $setvar
10997         set shmget d_shmget
10998         evat $setvar
10999         set shmat d_shmat
11000         evat $setvar
11001         set shmdt d_shmdt
11002         evat $setvar
11003         ;;
11004     esac
11005     ;;
11006 esac
11007 : we could also check for sys/ipc.h ...
11008 if $h_shm && $test `./findhdr sys/shm.h`; then
11009         echo "You have the full shm*(2) library." >&4
11010         val="$define"
11011 else
11012         echo "You don't have the full shm*(2) library." >&4
11013         val="$undef"
11014 fi
11015 set d_shm
11016 eval $setvar
11017
11018 echo " "
11019 : see if we have sigaction
11020 if set sigaction val -f d_sigaction; eval $csym; $val; then
11021         echo 'sigaction() found.' >&4
11022         $cat > try.c <<'EOP'
11023 #include <stdio.h>
11024 #include <sys/types.h>
11025 #include <signal.h>
11026 int main()
11027 {
11028     struct sigaction act, oact;
11029     act.sa_flags = 0;
11030     oact.sa_handler = 0;
11031     /* so that act and oact are used */
11032     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11033 }
11034 EOP
11035         set try
11036         if eval $compile_ok; then
11037                 val="$define"
11038         else
11039                 echo "But you don't seem to have a useable struct sigaction." >&4
11040                 val="$undef"
11041         fi
11042 else
11043         echo 'sigaction NOT found.' >&4
11044         val="$undef"
11045 fi
11046 set d_sigaction; eval $setvar
11047 $rm -f try try$_o try.c
11048
11049 : see if sigsetjmp exists
11050 echo " "
11051 case "$d_sigsetjmp" in
11052 '')
11053         $cat >try.c <<'EOP'
11054 #include <setjmp.h>
11055 sigjmp_buf env;
11056 int set = 1;
11057 int main()
11058 {
11059         if (sigsetjmp(env,1))
11060                 exit(set);
11061         set = 0;
11062         siglongjmp(env, 1);
11063         exit(1);
11064 }
11065 EOP
11066         set try
11067         if eval $compile; then
11068                 if ./try >/dev/null 2>&1; then
11069                         echo "POSIX sigsetjmp found." >&4
11070                         val="$define"
11071                 else
11072                         $cat >&4 <<EOM
11073 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11074 I'll ignore them.
11075 EOM
11076                         val="$undef"
11077                 fi
11078         else
11079                 echo "sigsetjmp not found." >&4
11080                 val="$undef"
11081         fi
11082         ;;
11083 *) val="$d_sigsetjmp"
11084         case "$d_sigsetjmp" in
11085         $define) echo "POSIX sigsetjmp found." >&4;;
11086         $undef) echo "sigsetjmp not found." >&4;;
11087         esac
11088         ;;
11089 esac
11090 set d_sigsetjmp
11091 eval $setvar
11092 $rm -f try.c try
11093
11094 : see if sys/stat.h is available
11095 set sys/stat.h i_sysstat
11096 eval $inhdr
11097
11098
11099 : see if stat knows about block sizes
11100 echo " "
11101 echo "Checking to see if your struct stat has st_blocks field..." >&4
11102 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11103 eval $hasfield
11104
11105
11106 : see if this is a sys/vfs.h system
11107 set sys/vfs.h i_sysvfs
11108 eval $inhdr
11109
11110
11111 : see if this is a sys/statfs.h system
11112 set sys/statfs.h i_sysstatfs
11113 eval $inhdr
11114
11115
11116 echo " "
11117 echo "Checking to see if your system supports struct statfs..." >&4
11118 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
11119 eval $hasstruct
11120 case "$d_statfs_s" in
11121 "$define")      echo "Yes, it does."   ;;
11122 *)              echo "No, it doesn't." ;;
11123 esac
11124
11125
11126
11127 : see if struct statfs knows about f_flags
11128 case "$d_statfs_s" in
11129 define) 
11130         echo " "
11131         echo "Checking to see if your struct statfs has f_flags field..." >&4
11132         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
11133         eval $hasfield
11134         ;;
11135 *)      val="$undef"
11136         set d_statfs_f_flags
11137         eval $setvar
11138         ;;
11139 esac
11140 case "$d_statfs_f_flags" in
11141 "$define")      echo "Yes, it does."   ;;
11142 *)              echo "No, it doesn't." ;;
11143 esac
11144
11145 : see if _ptr and _cnt from stdio act std
11146 echo " "
11147 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11148         echo "(Looks like you have stdio.h from Linux.)"
11149         case "$stdio_ptr" in
11150         '') stdio_ptr='((fp)->_IO_read_ptr)'
11151                 ptr_lval=$define
11152                 ;;
11153         *)      ptr_lval=$d_stdio_ptr_lval;;
11154         esac
11155         case "$stdio_cnt" in
11156         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11157                 cnt_lval=$undef
11158                 ;;
11159         *)      cnt_lval=$d_stdio_cnt_lval;;
11160         esac
11161         case "$stdio_base" in
11162         '') stdio_base='((fp)->_IO_read_base)';;
11163         esac
11164         case "$stdio_bufsiz" in
11165         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11166         esac
11167 else
11168         case "$stdio_ptr" in
11169         '') stdio_ptr='((fp)->_ptr)'
11170                 ptr_lval=$define
11171                 ;;
11172         *)      ptr_lval=$d_stdio_ptr_lval;;
11173         esac
11174         case "$stdio_cnt" in
11175         '') stdio_cnt='((fp)->_cnt)'
11176                 cnt_lval=$define
11177                 ;;
11178         *)      cnt_lval=$d_stdio_cnt_lval;;
11179         esac
11180         case "$stdio_base" in
11181         '') stdio_base='((fp)->_base)';;
11182         esac
11183         case "$stdio_bufsiz" in
11184         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11185         esac
11186 fi
11187 : test whether _ptr and _cnt really work
11188 echo "Checking how std your stdio is..." >&4
11189 $cat >try.c <<EOP
11190 #include <stdio.h>
11191 #define FILE_ptr(fp)    $stdio_ptr
11192 #define FILE_cnt(fp)    $stdio_cnt
11193 int main() {
11194         FILE *fp = fopen("try.c", "r");
11195         char c = getc(fp);
11196         if (
11197                 18 <= FILE_cnt(fp) &&
11198                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11199         )
11200                 exit(0);
11201         exit(1);
11202 }
11203 EOP
11204 val="$undef"
11205 set try
11206 if eval $compile; then
11207         if ./try; then
11208                 echo "Your stdio acts pretty std."
11209                 val="$define"
11210         else
11211                 echo "Your stdio isn't very std."
11212         fi
11213 else
11214         echo "Your stdio doesn't appear very std."
11215 fi
11216 $rm -f try.c try
11217 set d_stdstdio
11218 eval $setvar
11219
11220 : Can _ptr be used as an lvalue?
11221 case "$d_stdstdio$ptr_lval" in
11222 $define$define) val=$define ;;
11223 *) val=$undef ;;
11224 esac
11225 set d_stdio_ptr_lval
11226 eval $setvar
11227
11228 : Can _cnt be used as an lvalue?
11229 case "$d_stdstdio$cnt_lval" in
11230 $define$define) val=$define ;;
11231 *) val=$undef ;;
11232 esac
11233 set d_stdio_cnt_lval
11234 eval $setvar
11235
11236 : see if _base is also standard
11237 val="$undef"
11238 case "$d_stdstdio" in
11239 $define)
11240         $cat >try.c <<EOP
11241 #include <stdio.h>
11242 #define FILE_base(fp)   $stdio_base
11243 #define FILE_bufsiz(fp) $stdio_bufsiz
11244 int main() {
11245         FILE *fp = fopen("try.c", "r");
11246         char c = getc(fp);
11247         if (
11248                 19 <= FILE_bufsiz(fp) &&
11249                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11250         )
11251                 exit(0);
11252         exit(1);
11253 }
11254 EOP
11255         set try
11256         if eval $compile; then
11257                 if ./try; then
11258                         echo "And its _base field acts std."
11259                         val="$define"
11260                 else
11261                         echo "But its _base field isn't std."
11262                 fi
11263         else
11264                 echo "However, it seems to be lacking the _base field."
11265         fi
11266         $rm -f try.c try
11267         ;;
11268 esac
11269 set d_stdiobase
11270 eval $setvar
11271
11272 $cat >&4 <<EOM
11273 Checking how to access stdio streams by file descriptor number...
11274 EOM
11275 case "$stdio_stream_array" in
11276 '')     $cat >try.c <<EOCP
11277 #include <stdio.h>
11278 int main() {
11279   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11280     printf("yes\n");
11281 }
11282 EOCP
11283         for s in _iob __iob __sF
11284         do
11285                 set try -DSTDIO_STREAM_ARRAY=$s
11286                 if eval $compile; then
11287                         case "`./try$exe_ext`" in
11288                         yes)    stdio_stream_array=$s; break ;;
11289                         esac
11290                 fi
11291         done
11292         $rm -f try.* try$exe_ext
11293 esac
11294 case "$stdio_stream_array" in
11295 '')     $cat >&4 <<EOM
11296 I can't figure out how to access stdio streams by file descriptor number.
11297 EOM
11298         d_stdio_stream_array="$undef"
11299         ;;
11300 *)      $cat >&4 <<EOM
11301 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11302 EOM
11303         d_stdio_stream_array="$define"
11304         ;;
11305 esac
11306
11307 : see if strcoll exists
11308 set strcoll d_strcoll
11309 eval $inlibc
11310
11311 : check for structure copying
11312 echo " "
11313 echo "Checking to see if your C compiler can copy structs..." >&4
11314 $cat >try.c <<'EOCP'
11315 int main()
11316 {
11317         struct blurfl {
11318                 int dyick;
11319         } foo, bar;
11320
11321         foo = bar;
11322 }
11323 EOCP
11324 if $cc -c try.c >/dev/null 2>&1 ; then
11325         val="$define"
11326         echo "Yup, it can."
11327 else
11328         val="$undef"
11329         echo "Nope, it can't."
11330 fi
11331 set d_strctcpy
11332 eval $setvar
11333 $rm -f try.*
11334
11335 : see if strerror and/or sys_errlist[] exist
11336 echo " "
11337 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11338     if set strerror val -f d_strerror; eval $csym; $val; then
11339                 echo 'strerror() found.' >&4
11340                 d_strerror="$define"
11341                 d_strerrm='strerror(e)'
11342                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11343                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11344                         d_syserrlst="$define"
11345                 else
11346                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11347                         d_syserrlst="$undef"
11348                 fi
11349     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11350                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11351                 echo 'strerror() found in string header.' >&4
11352                 d_strerror="$define"
11353                 d_strerrm='strerror(e)'
11354                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11355                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11356                                 d_syserrlst="$define"
11357                 else
11358                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11359                         d_syserrlst="$undef"
11360                 fi
11361     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11362                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11363                 d_strerror="$undef"
11364                 d_syserrlst="$define"
11365                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11366     else
11367                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11368                 d_strerror="$undef"
11369                 d_syserrlst="$undef"
11370                 d_strerrm='"unknown"'
11371     fi
11372 fi
11373
11374 : see if strtod exists
11375 set strtod d_strtod
11376 eval $inlibc
11377
11378 : see if strtol exists
11379 set strtol d_strtol
11380 eval $inlibc
11381
11382 : see if strtold exists
11383 set strtold d_strtold
11384 eval $inlibc
11385
11386 : see if strtoll exists
11387 set strtoll d_strtoll
11388 eval $inlibc
11389
11390 : see if strtoul exists
11391 set strtoul d_strtoul
11392 eval $inlibc
11393
11394 : see if strtoull exists
11395 set strtoull d_strtoull
11396 eval $inlibc
11397
11398 : see if strtouq exists
11399 set strtouq d_strtouq
11400 eval $inlibc
11401
11402 : see if strxfrm exists
11403 set strxfrm d_strxfrm
11404 eval $inlibc
11405
11406 : see if symlink exists
11407 set symlink d_symlink
11408 eval $inlibc
11409
11410 : see if syscall exists
11411 set syscall d_syscall
11412 eval $inlibc
11413
11414 : see if sysconf exists
11415 set sysconf d_sysconf
11416 eval $inlibc
11417
11418 : see if system exists
11419 set system d_system
11420 eval $inlibc
11421
11422 : see if tcgetpgrp exists
11423 set tcgetpgrp d_tcgetpgrp
11424 eval $inlibc
11425
11426 : see if tcsetpgrp exists
11427 set tcsetpgrp d_tcsetpgrp
11428 eval $inlibc
11429
11430 : see if prototype for telldir is available
11431 echo " "
11432 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11433 eval $hasproto
11434
11435 : see if this is a sys/times.h system
11436 set sys/times.h i_systimes
11437 eval $inhdr
11438
11439 : see if times exists
11440 echo " "
11441 if set times val -f d_times; eval $csym; $val; then
11442         echo 'times() found.' >&4
11443         d_times="$define"
11444         inc=''
11445         case "$i_systimes" in
11446         "$define") inc='sys/times.h';;
11447         esac
11448         rp="What is the type returned by times() on this system?"
11449         set clock_t clocktype long stdio.h sys/types.h $inc
11450         eval $typedef_ask
11451 else
11452         echo 'times() NOT found, hope that will do.' >&4
11453         d_times="$undef"
11454         clocktype='int'
11455 fi
11456
11457 : see if truncate exists
11458 set truncate d_truncate
11459 eval $inlibc
11460
11461 : see if tzname[] exists
11462 echo " "
11463 if set tzname val -a d_tzname; eval $csym; $val; then
11464         val="$define"
11465         echo 'tzname[] found.' >&4
11466 else
11467         val="$undef"
11468         echo 'tzname[] NOT found.' >&4
11469 fi
11470 set d_tzname
11471 eval $setvar
11472
11473 : see if umask exists
11474 set umask d_umask
11475 eval $inlibc
11476
11477 : see if ustat exists
11478 set ustat d_ustat
11479 eval $inlibc
11480
11481 : backward compatibility for d_hvfork
11482 if test X$d_hvfork != X; then
11483         d_vfork="$d_hvfork"
11484         d_hvfork=''
11485 fi
11486 : see if there is a vfork
11487 val=''
11488 set vfork val
11489 eval $inlibc
11490
11491 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11492 : perl on Solaris 2.x, and probably elsewhere.
11493 case "$val" in
11494 $define)
11495         echo " "
11496         case "$usevfork" in
11497         false) dflt='n';;
11498         *) dflt='y';;
11499         esac
11500         cat <<'EOM'
11501  
11502 Perl can only use a vfork() that doesn't suffer from strict
11503 restrictions on calling functions or modifying global data in
11504 the child.  For example, glibc-2.1 contains such a vfork()
11505 that is unsuitable.  If your system provides a proper fork()
11506 call, chances are that you do NOT want perl to use vfork().
11507
11508 EOM
11509         rp="Do you still want to use vfork()?"
11510         . ./myread
11511         case "$ans" in
11512         y|Y) ;;
11513         *)
11514                 echo "Ok, we won't use vfork()."
11515                 val="$undef"
11516                 ;;
11517         esac
11518         ;;
11519 esac
11520 set d_vfork
11521 eval $setvar
11522 case "$d_vfork" in
11523 $define) usevfork='true';;
11524 *) usevfork='false';;
11525 esac
11526
11527 : see if this is an sysdir system
11528 set sys/dir.h i_sysdir
11529 eval $inhdr
11530
11531 : see if this is an sysndir system
11532 set sys/ndir.h i_sysndir
11533 eval $inhdr
11534
11535 : see if closedir exists
11536 set closedir d_closedir
11537 eval $inlibc
11538
11539 case "$d_closedir" in
11540 "$define")
11541         echo " "
11542         echo "Checking whether closedir() returns a status..." >&4
11543         cat > closedir.c <<EOM
11544 #$i_dirent I_DIRENT             /**/
11545 #$i_sysdir I_SYS_DIR            /**/
11546 #$i_sysndir I_SYS_NDIR          /**/
11547 #$i_systypes I_SYS_TYPES        /**/
11548
11549 #if defined(I_SYS_TYPES)
11550 #include <sys/types.h>
11551 #endif
11552 #if defined(I_DIRENT)
11553 #include <dirent.h>
11554 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11555 #include <sys/dir.h>
11556 #endif
11557 #else
11558 #ifdef I_SYS_NDIR
11559 #include <sys/ndir.h>
11560 #else
11561 #ifdef I_SYS_DIR
11562 #ifdef hp9000s500
11563 #include <ndir.h>       /* may be wrong in the future */
11564 #else
11565 #include <sys/dir.h>
11566 #endif
11567 #endif
11568 #endif
11569 #endif 
11570 int main() { return closedir(opendir(".")); }
11571 EOM
11572         set closedir
11573         if eval $compile_ok; then
11574                 if ./closedir > /dev/null 2>&1 ; then
11575                         echo "Yes, it does."
11576                         val="$undef"
11577                 else
11578                         echo "No, it doesn't."
11579                         val="$define"
11580                 fi
11581         else
11582                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11583                 val="$define"
11584         fi
11585         ;;
11586 *)
11587         val="$undef";
11588         ;;
11589 esac
11590 set d_void_closedir
11591 eval $setvar
11592 $rm -f closedir*
11593 : check for volatile keyword
11594 echo " "
11595 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11596 $cat >try.c <<'EOCP'
11597 int main()
11598 {
11599         typedef struct _goo_struct goo_struct;
11600         goo_struct * volatile goo = ((goo_struct *)0);
11601         struct _goo_struct {
11602                 long long_int;
11603                 int reg_int;
11604                 char char_var;
11605         };
11606         typedef unsigned short foo_t;
11607         char *volatile foo;
11608         volatile int bar;
11609         volatile foo_t blech;
11610         foo = foo;
11611 }
11612 EOCP
11613 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11614         val="$define"
11615         echo "Yup, it does."
11616 else
11617         val="$undef"
11618         echo "Nope, it doesn't."
11619 fi
11620 set d_volatile
11621 eval $setvar
11622 $rm -f try.*
11623
11624 : see if there is a wait4
11625 set wait4 d_wait4
11626 eval $inlibc
11627
11628 : see if waitpid exists
11629 set waitpid d_waitpid
11630 eval $inlibc
11631
11632 : see if wcstombs exists
11633 set wcstombs d_wcstombs
11634 eval $inlibc
11635
11636 : see if wctomb exists
11637 set wctomb d_wctomb
11638 eval $inlibc
11639
11640 : preserve RCS keywords in files with variable substitution, grrr
11641 Date='$Date'
11642 Id='$Id'
11643 Log='$Log'
11644 RCSfile='$RCSfile'
11645 Revision='$Revision'
11646
11647 case "$crosscompile" in
11648 ''|[nN]*) crosscompile="$undef" ;;
11649 esac
11650
11651 case "$osname" in
11652 next|rhapsody|darwin) multiarch="$define" ;;
11653 esac
11654 case "$multiarch" in
11655 ''|[nN]*) multiarch="$undef" ;;
11656 esac
11657
11658 : check for alignment requirements
11659 echo " "
11660 case "$crosscompile$multiarch" in
11661 *$define*)
11662         $cat <<EOM
11663 You seem to be either cross-compiling or doing a multiarchitecture build,
11664 skipping the memory alignment check.
11665
11666 EOM
11667         case "$alignbytes" in
11668         '') alignbytes=8 ;;
11669         esac
11670         ;;
11671 *)
11672         case "$alignbytes" in
11673         '') echo "Checking alignment constraints..." >&4
11674                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11675                         $cat >try.c <<'EOCP'
11676 typedef long double NV;
11677 EOCP
11678                 else
11679                         $cat >try.c <<'EOCP'
11680 typedef double NV;
11681 EOCP
11682                 fi
11683                 $cat >>try.c <<'EOCP'
11684 #include <stdio.h>
11685 struct foobar {
11686         char foo;
11687         NV bar;
11688 } try_algn;
11689 int main()
11690 {
11691     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11692     return(0);
11693 }
11694 EOCP
11695                 set try
11696                 if eval $compile_ok; then
11697                         dflt=`./try`
11698                 else
11699                         dflt='8'
11700                         echo "(I can't seem to compile the test program...)"
11701                 fi
11702                 ;;
11703         *) dflt="$alignbytes"
11704                 ;;
11705         esac
11706         rp="Doubles must be aligned on a how-many-byte boundary?"
11707         . ./myread
11708         alignbytes="$ans"
11709         $rm -f try.c try
11710         ;;
11711 esac
11712
11713
11714 : set the base revision
11715 baserev=5.0
11716
11717 : check for ordering of bytes in a long
11718 echo " "
11719 case "$crosscompile$multiarch" in
11720 *$define*)
11721         $cat <<EOM
11722 You seem to be either cross-compiling or doing a multiarchitecture build,
11723 skipping the byteorder check.
11724
11725 EOM
11726         byteorder='0xffff'
11727         ;;
11728 *)
11729         case "$byteorder" in
11730         '')
11731                 $cat <<'EOM'
11732 In the following, larger digits indicate more significance.  A big-endian
11733 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11734 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11735 machines may have weird orders like 3412.  A Cray will report 87654321,
11736 an Alpha will report 12345678. If the test program works the default is
11737 probably right.
11738 I'm now running the test program...
11739 EOM
11740                 $cat >try.c <<'EOCP'
11741 #include <stdio.h>
11742 int main()
11743 {
11744         int i;
11745         union {
11746                 unsigned long l;
11747                 char c[sizeof(long)];
11748         } u;
11749
11750         if (sizeof(long) > 4)
11751                 u.l = (0x08070605L << 32) | 0x04030201L;
11752         else
11753                 u.l = 0x04030201L;
11754         for (i = 0; i < sizeof(long); i++)
11755                 printf("%c", u.c[i]+'0');
11756         printf("\n");
11757         exit(0);
11758 }
11759 EOCP
11760                 xxx_prompt=y
11761                 set try
11762                 if eval $compile && ./try > /dev/null; then
11763                         dflt=`./try`
11764                         case "$dflt" in
11765                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11766                                 echo "(The test program ran ok.)"
11767                                 echo "byteorder=$dflt"
11768                                 xxx_prompt=n
11769                         ;;
11770                         ????|????????) echo "(The test program ran ok.)" ;;
11771                         *) echo "(The test program didn't run right for some reason.)" ;;
11772                         esac
11773                 else
11774                         dflt='4321'
11775                         cat <<'EOM'
11776 (I can't seem to compile the test program.  Guessing big-endian...)
11777 EOM
11778                 fi
11779                 case "$xxx_prompt" in
11780                 y)
11781                         rp="What is the order of bytes in a long?"
11782                         . ./myread
11783                         byteorder="$ans"
11784                         ;;
11785                 *)      byteorder=$dflt
11786                         ;;
11787                 esac
11788                 ;;
11789         esac
11790         $rm -f try.c try
11791         ;;
11792 esac
11793
11794
11795 : how do we catenate cpp tokens here?
11796 echo " "
11797 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11798 $cat >cpp_stuff.c <<'EOCP'
11799 #define RCAT(a,b)a/**/b
11800 #define ACAT(a,b)a ## b
11801 RCAT(Rei,ser)
11802 ACAT(Cir,cus)
11803 EOCP
11804 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11805 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11806         echo "Oh!  Smells like ANSI's been here." >&4
11807         echo "We can catify or stringify, separately or together!"
11808         cpp_stuff=42
11809 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11810         echo "Ah, yes!  The good old days!" >&4
11811         echo "However, in the good old days we don't know how to stringify and"
11812         echo "catify at the same time."
11813         cpp_stuff=1
11814 else
11815         $cat >&4 <<EOM
11816 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11817 to have to edit the values of CAT[2-5] in config.h...
11818 EOM
11819         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11820 fi
11821 $rm -f cpp_stuff.*
11822
11823 : see if this is a db.h system
11824 set db.h i_db
11825 eval $inhdr
11826
11827 case "$i_db" in
11828 $define)
11829         : Check db version.
11830         echo " "
11831         echo "Checking Berkeley DB version ..." >&4
11832         $cat >try.c <<EOCP
11833 #$d_const HASCONST
11834 #ifndef HASCONST
11835 #define const
11836 #endif
11837 #include <sys/types.h>
11838 #include <stdio.h>
11839 #include <db.h>
11840 int main()
11841 {
11842 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11843     int Major, Minor, Patch ;
11844     unsigned long Version ;
11845     (void)db_version(&Major, &Minor, &Patch) ;
11846     printf("You have Berkeley DB Version 2 or greater\n");
11847
11848     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11849                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11850     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11851                 Major, Minor, Patch) ;
11852
11853     /* check that db.h & libdb are compatible */
11854     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11855         printf("db.h and libdb are incompatible\n") ;
11856         exit(3);        
11857     }
11858
11859     printf("db.h and libdb are compatible\n") ;
11860
11861     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11862                 + DB_VERSION_PATCH ;
11863
11864     /* needs to be >= 2.3.4 */
11865     if (Version < 2003004) {
11866     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11867         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11868         exit(2);        
11869     }
11870
11871     exit(0);
11872 #else
11873 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11874     printf("You have Berkeley DB Version 1\n");
11875     exit(0);    /* DB version < 2: the coast is clear. */
11876 #else
11877     exit(1);    /* <db.h> not Berkeley DB? */
11878 #endif
11879 #endif
11880 }
11881 EOCP
11882         set try
11883         if eval $compile_ok && ./try; then
11884                 echo 'Looks OK.' >&4
11885         else
11886                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11887                 i_db=$undef
11888                 case " $libs " in
11889                 *"-ldb "*)
11890                         : Remove db from list of libraries to use
11891                         echo "Removing unusable -ldb from library list" >&4
11892                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11893                         shift
11894                         libs="$*"
11895                         echo "libs = $libs" >&4
11896                         ;;
11897                 esac
11898         fi
11899         $rm -f try.*
11900         ;;
11901 esac
11902
11903 case "$i_db" in
11904 define)
11905         : Check the return type needed for hash 
11906         echo " "
11907         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11908         $cat >try.c <<EOCP
11909 #$d_const HASCONST
11910 #ifndef HASCONST
11911 #define const
11912 #endif
11913 #include <sys/types.h>
11914 #include <db.h>
11915
11916 #ifndef DB_VERSION_MAJOR
11917 u_int32_t hash_cb (ptr, size)
11918 const void *ptr;
11919 size_t size;
11920 {
11921 }
11922 HASHINFO info;
11923 int main()
11924 {
11925         info.hash = hash_cb;
11926 }
11927 #endif
11928 EOCP
11929         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11930                 if $contains warning try.out >>/dev/null 2>&1 ; then
11931                         db_hashtype='int'
11932                 else
11933                         db_hashtype='u_int32_t'
11934                 fi
11935         else
11936                 : XXX Maybe we should just give up here.
11937                 db_hashtype=u_int32_t
11938                 $cat try.out >&4
11939                 echo "Help:  I can't seem to compile the db test program." >&4
11940                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11941         fi
11942         $rm -f try.*
11943         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11944         ;;
11945 *)      db_hashtype=u_int32_t
11946         ;;
11947 esac
11948 case "$i_db" in
11949 define)
11950         : Check the return type needed for prefix 
11951         echo " "
11952         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11953         cat >try.c <<EOCP
11954 #$d_const HASCONST
11955 #ifndef HASCONST
11956 #define const
11957 #endif
11958 #include <sys/types.h>
11959 #include <db.h>
11960
11961 #ifndef DB_VERSION_MAJOR
11962 size_t prefix_cb (key1, key2)
11963 const DBT *key1;
11964 const DBT *key2;
11965 {
11966 }
11967 BTREEINFO info;
11968 int main()
11969 {
11970         info.prefix = prefix_cb;
11971 }
11972 #endif
11973 EOCP
11974         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11975                 if $contains warning try.out >>/dev/null 2>&1 ; then
11976                         db_prefixtype='int'
11977                 else
11978                         db_prefixtype='size_t'
11979                 fi
11980         else
11981                 db_prefixtype='size_t'
11982                 : XXX Maybe we should just give up here.
11983                 $cat try.out >&4
11984                 echo "Help:  I can't seem to compile the db test program." >&4
11985                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11986         fi
11987         $rm -f try.*
11988         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11989         ;;
11990 *)      db_prefixtype='size_t'
11991         ;;
11992 esac
11993
11994 : check for void type
11995 echo " "
11996 echo "Checking to see how well your C compiler groks the void type..." >&4
11997 case "$voidflags" in
11998 '')
11999         $cat >try.c <<'EOCP'
12000 #if TRY & 1
12001 void sub() {
12002 #else
12003 sub() {
12004 #endif
12005         extern void moo();      /* function returning void */
12006         void (*goo)();          /* ptr to func returning void */
12007 #if TRY & 8
12008         void *hue;              /* generic ptr */
12009 #endif
12010 #if TRY & 2
12011         void (*foo[10])();
12012 #endif
12013
12014 #if TRY & 4
12015         if(goo == moo) {
12016                 exit(0);
12017         }
12018 #endif
12019         exit(0);
12020 }
12021 int main() { sub(); }
12022 EOCP
12023         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12024                 voidflags=$defvoidused
12025         echo "Good.  It appears to support void to the level $package wants.">&4
12026                 if $contains warning .out >/dev/null 2>&1; then
12027                         echo "However, you might get some warnings that look like this:"
12028                         $cat .out
12029                 fi
12030         else
12031 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12032                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12033                         echo "It supports 1..."
12034                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12035                                 echo "It also supports 2..."
12036                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12037                                         voidflags=7
12038                                         echo "And it supports 4 but not 8 definitely."
12039                                 else
12040                                         echo "It doesn't support 4..."
12041                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12042                                                 voidflags=11
12043                                                 echo "But it supports 8."
12044                                         else
12045                                                 voidflags=3
12046                                                 echo "Neither does it support 8."
12047                                         fi
12048                                 fi
12049                         else
12050                                 echo "It does not support 2..."
12051                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12052                                         voidflags=13
12053                                         echo "But it supports 4 and 8."
12054                                 else
12055                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12056                                                 voidflags=5
12057                                                 echo "And it supports 4 but has not heard about 8."
12058                                         else
12059                                                 echo "However it supports 8 but not 4."
12060                                         fi
12061                                 fi
12062                         fi
12063                 else
12064                         echo "There is no support at all for void."
12065                         voidflags=0
12066                 fi
12067         fi
12068 esac
12069 case "$voidflags" in
12070 "$defvoidused") ;;
12071 *)      $cat >&4 <<'EOM'
12072   Support flag bits are:
12073     1: basic void declarations.
12074     2: arrays of pointers to functions returning void.
12075     4: operations between pointers to and addresses of void functions.
12076     8: generic void pointers.
12077 EOM
12078         dflt="$voidflags";
12079         rp="Your void support flags add up to what?"
12080         . ./myread
12081         voidflags="$ans"
12082         ;;
12083 esac
12084 $rm -f try.* .out
12085
12086
12087 : How can we generate normalized random numbers ?
12088 echo " "
12089 echo "Looking for a random number function..." >&4
12090 case "$randfunc" in
12091 '')
12092         if set drand48 val -f; eval $csym; $val; then
12093                 dflt="drand48"
12094                 echo "Good, found drand48()." >&4
12095         elif set random val -f; eval $csym; $val; then
12096                 dflt="random"
12097                 echo "OK, found random()." >&4
12098         else
12099                 dflt="rand"
12100                 echo "Yick, looks like I have to use rand()." >&4
12101         fi
12102         echo " "
12103         ;;
12104 *)
12105         dflt="$randfunc"
12106         ;;
12107 esac
12108 cont=true
12109
12110 case "$ccflags" in
12111 *-Dmy_rand=*|*-Dmy_srand=*)
12112         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12113         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12114         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12115         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12116         ;;
12117 esac
12118
12119 while $test "$cont"; do
12120         rp="Use which function to generate random numbers?"
12121         . ./myread
12122         if $test "$ans" = "$dflt"; then
12123                 : null
12124         else
12125                 randbits=''
12126         fi
12127         randfunc="$ans"
12128         if set $ans val -f; eval $csym; $val; then
12129                 cont=''
12130         else
12131                 dflt=y
12132                 rp="I cannot find function $ans. Use that name anyway?"
12133                 . ./myread
12134                 dflt=rand
12135                 case "$ans" in
12136                         [yY]*) cont='';;
12137                 esac
12138         fi
12139         case "$cont" in
12140         '')
12141                 case "$randfunc" in
12142                 drand48)
12143                         drand01="drand48()"
12144                         seedfunc="srand48"
12145                         randbits=48
12146                         randseedtype=long
12147                         ;;
12148                 rand|random)
12149                         case "$randbits" in
12150                         '')
12151 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12152                                 $cat >try.c <<EOCP
12153 #$i_unistd I_UNISTD
12154 #$i_stdlib I_STDLIB
12155 #include <stdio.h>
12156 #ifdef I_UNISTD
12157 #  include <unistd.h>
12158 #endif
12159 #ifdef I_STDLIB
12160 #  include <stdlib.h>
12161 #endif
12162 int main()
12163 {
12164         register int i;
12165         register unsigned long tmp;
12166         register unsigned long max = 0L;
12167
12168         for (i = 1000; i; i--) {
12169                 tmp = (unsigned long) $randfunc();
12170                 if (tmp > max) max = tmp;
12171         }
12172         for (i = 0; max; i++)
12173                 max /= 2;
12174         printf("%d\n",i);
12175 }
12176 EOCP
12177                                 set try
12178                                 if eval $compile_ok; then
12179                                         dflt=`try`
12180                                 else
12181                                         dflt='?'
12182                                         echo "(I can't seem to compile the test program...)"
12183                                 fi
12184                                 ;;
12185                         *)
12186                                 dflt="$randbits"
12187                                 ;;
12188                         esac
12189                         rp="How many bits does your $randfunc() function produce?"
12190                         . ./myread
12191                         randbits="$ans"
12192                         $rm -f try.c try
12193                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12194                         seedfunc="s$randfunc"
12195                         randseedtype=unsigned
12196                         ;;
12197                 *)
12198                         dflt="31"
12199                         rp="How many bits does your $randfunc() function produce?"
12200                         . ./myread
12201                         randbits="$ans"
12202                         seedfunc="s$randfunc"
12203                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12204                         if set $seedfunc val -f; eval $csym; $val; then
12205                                 echo "(Using $seedfunc() to seed random generator)"
12206                         else
12207                                 echo "(Warning: no $seedfunc() to seed random generator)"
12208                                 seedfunc=rand
12209                         fi
12210                         randseedtype=unsigned
12211                         ;;
12212                 esac
12213                 ;;
12214         esac
12215 done
12216
12217 echo " "
12218 echo "Determining whether or not we are on an EBCDIC system..." >&4
12219 $cat >tebcdic.c <<'EOM'
12220 int main()
12221 {
12222   if ('M'==0xd4) return 0;
12223   return 1;
12224 }
12225 EOM
12226
12227 val=$undef
12228 set tebcdic
12229 if eval $compile_ok; then
12230         if ./tebcdic; then
12231                 echo "You have EBCDIC." >&4
12232                 val="$define"
12233         else
12234                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12235         fi
12236 else
12237         echo "I'm unable to compile the test program." >&4
12238         echo "I'll assume ASCII or some ISO Latin." >&4
12239 fi
12240 $rm -f tebcdic.c tebcdic
12241 set ebcdic
12242 eval $setvar
12243
12244 echo " "
12245 $cat >&4 <<EOM
12246 Checking how to flush all pending stdio output...
12247 EOM
12248 # I only know how to find the first 32 possibly open files on SunOS.
12249 # See also hints/sunos_4_1.sh and util.c  --AD
12250 case "$osname" in
12251 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12252 esac
12253 $cat >>try.c <<EOCP
12254 #include <stdio.h>
12255 #$i_unistd I_UNISTD
12256 #ifdef I_UNISTD
12257 # include <unistd.h>
12258 #endif
12259 #$d_sysconf HAS_SYSCONF
12260 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12261 #ifdef HAS_STDIO_STREAM_ARRAY
12262 # define STDIO_STREAM_ARRAY $stdio_stream_array
12263 #endif
12264 int main() {
12265   FILE* p = fopen("try.out", "w");
12266 #ifdef TRY_FPUTC
12267   fputc('x', p);
12268 #else
12269 # ifdef TRY_FPRINTF
12270   fprintf(p, "x");
12271 # endif
12272 #endif
12273 #ifdef TRY_FFLUSH_NULL
12274   fflush(NULL);
12275 #endif
12276 #ifdef TRY_FFLUSH_ALL
12277   {
12278     long open_max = -1;
12279 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12280     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12281 # else
12282 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12283     open_max = sysconf(_SC_OPEN_MAX);
12284 #  else
12285 #   ifdef FOPEN_MAX
12286     open_max = FOPEN_MAX;
12287 #   else
12288 #    ifdef OPEN_MAX
12289     open_max = OPEN_MAX;
12290 #    else
12291 #     ifdef _NFILE
12292     open_max = _NFILE;
12293 #     endif
12294 #    endif
12295 #   endif
12296 #  endif
12297 # endif 
12298 # ifdef HAS_STDIO_STREAM_ARRAY
12299     if (open_max > 0) {
12300       long i;
12301       for (i = 0; i < open_max; i++)
12302             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12303                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12304                 STDIO_STREAM_ARRAY[i]._flag)
12305                 fflush(&STDIO_STREAM_ARRAY[i]);
12306     }   
12307   }
12308 # endif
12309 #endif
12310   _exit(42);
12311 }
12312 EOCP
12313 : first we have to find out how _not_ to flush
12314 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12315     output=''
12316     set try -DTRY_FPUTC
12317     if eval $compile; then
12318             $rm -f try.out
12319             ./try$exe_ext 2>/dev/null
12320             if $test ! -s try.out -a "X$?" = X42; then
12321                 output=-DTRY_FPUTC
12322             fi
12323     fi
12324     case "$output" in
12325     '')
12326             set try -DTRY_FPRINTF
12327             $rm -f try.out
12328             if eval $compile; then
12329                     $rm -f try.out
12330                     ./try$exe_ext 2>/dev/null
12331                     if $test ! -s try.out -a "X$?" = X42; then
12332                         output=-DTRY_FPRINTF
12333                     fi
12334             fi
12335         ;;
12336     esac
12337 fi
12338 : check for fflush NULL behaviour
12339 case "$fflushNULL" in
12340 '')     set try -DTRY_FFLUSH_NULL $output
12341         if eval $compile; then
12342                 $rm -f try.out
12343                 ./try$exe_ext 2>/dev/null
12344                 code="$?"
12345                 if $test -s try.out -a "X$code" = X42; then
12346                         fflushNULL="`$cat try.out`"
12347                 else
12348                         if $test "X$code" != X42; then
12349                                 $cat >&4 <<EOM
12350 (If this test failed, don't worry, we'll try another method shortly.)
12351 EOM
12352                         fi
12353                 fi
12354         fi
12355         $rm -f core try.core core.try.*
12356         case "$fflushNULL" in
12357         x)      $cat >&4 <<EOM
12358 Your fflush(NULL) works okay.
12359 EOM
12360                 fflushNULL="$define"
12361                 ;;
12362         '')     $cat >&4 <<EOM
12363 Your fflush(NULL) isn't working (contrary to ANSI C).
12364 EOM
12365                 fflushNULL="$undef"
12366                 ;;
12367         *)      $cat >&4 <<EOM
12368 Cannot figure out whether your fflush(NULL) works or not.
12369 I'm assuming it doesn't (contrary to ANSI C).
12370 EOM
12371                 fflushNULL="$undef"
12372                 ;;
12373         esac
12374         ;;
12375 $define|true|[yY]*)
12376         fflushNULL="$define"
12377         ;;
12378 *)
12379         fflushNULL="$undef"
12380         ;;
12381 esac
12382 : check explicit looping only if NULL did not work
12383 case "$fflushNULL" in
12384 "$undef")
12385         : check for fflush all behaviour
12386         case "$fflushall" in
12387         '')     set try -DTRY_FFLUSH_ALL $output
12388                 if eval $compile; then
12389                         $cat >&4 <<EOM
12390 (Now testing the other method--but note that also this may fail.)
12391 EOM
12392                         $rm -f try.out
12393                         ./try$exe_ext 2>/dev/null
12394                         if $test -s try.out -a "X$?" = X42; then
12395                                 fflushall="`$cat try.out`"
12396                         fi
12397                 fi
12398                 $rm -f core try.core core.try.*
12399                 case "$fflushall" in
12400                 x)      $cat >&4 <<EOM
12401 Whew. Flushing explicitly all the stdio streams works.
12402 EOM
12403                         fflushall="$define"
12404                         ;;
12405                 '')     $cat >&4 <<EOM
12406 Sigh. Flushing explicitly all the stdio streams doesn't work.
12407 EOM
12408                         fflushall="$undef"
12409                         ;;
12410                 *)      $cat >&4 <<EOM
12411 Cannot figure out whether flushing stdio streams explicitly works or not.
12412 I'm assuming it doesn't.
12413 EOM
12414                         fflushall="$undef"
12415                         ;;
12416                 esac
12417                 ;;
12418         "$define"|true|[yY]*)
12419                 fflushall="$define"
12420                 ;;
12421         *)
12422                 fflushall="$undef"
12423                 ;;
12424         esac
12425         ;;
12426 *)      fflushall="$undef"      
12427         ;;
12428 esac
12429 case "$fflushNULL$fflushall" in
12430 undefundef)
12431         $cat <<EOM
12432 I cannot figure out how to flush pending stdio output.
12433 EOM
12434         ;;
12435 esac
12436 $rm -f try.* try$exe_ext
12437
12438 : Store the full pathname to the ar program for use in the C program
12439 : Respect a hint or command line value for full_ar.
12440 case "$full_ar" in
12441 '') full_ar=$ar ;;
12442 esac
12443
12444 : Store the full pathname to the sed program for use in the C program
12445 full_sed=$sed
12446
12447 : see what type gids are declared as in the kernel
12448 echo " "
12449 echo "Looking for the type for group ids returned by getgid()."
12450 set gid_t gidtype xxx stdio.h sys/types.h
12451 eval $typedef
12452 case "$gidtype" in
12453 xxx)
12454         xxx=`./findhdr sys/user.h`
12455         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12456         case $1 in
12457         unsigned) dflt="$1 $2" ;;
12458         *) dflt="$1" ;;
12459         esac
12460         ;;
12461 *) dflt="$gidtype";;
12462 esac
12463 case "$gidtype" in
12464 gid_t) echo "gid_t found." ;;
12465 *)      rp="What is the type for group ids returned by getgid()?"
12466         . ./myread
12467         gidtype="$ans"
12468         ;;
12469 esac
12470
12471 echo " "
12472 case "$gidtype" in
12473 *_t) zzz="$gidtype"     ;;
12474 *)   zzz="gid"          ;;
12475 esac
12476 echo "Checking the size of $zzz..." >&4 
12477 cat > try.c <<EOCP
12478 #include <sys/types.h>
12479 #include <stdio.h>
12480 int main() {
12481     printf("%d\n", (int)sizeof($gidtype));
12482     exit(0);
12483 }
12484 EOCP
12485 set try
12486 if eval $compile_ok; then
12487         yyy=`./try`
12488         case "$yyy" in
12489         '')     gidsize=4
12490                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12491                 ;;
12492         *)      gidsize=$yyy
12493                 echo "Your $zzz is $gidsize bytes long."
12494                 ;;
12495         esac
12496 else
12497         gidsize=4
12498         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12499 fi
12500
12501
12502 echo " "
12503 case "$gidtype" in
12504 *_t) zzz="$gidtype"     ;;
12505 *)   zzz="gid"          ;;
12506 esac
12507 echo "Checking the sign of $zzz..." >&4 
12508 cat > try.c <<EOCP
12509 #include <sys/types.h>
12510 #include <stdio.h>
12511 int main() {
12512         $gidtype foo = -1;
12513         if (foo < 0)
12514                 printf("-1\n");
12515         else
12516                 printf("1\n");
12517 }
12518 EOCP
12519 set try
12520 if eval $compile; then
12521         yyy=`./try`
12522         case "$yyy" in
12523         '')     gidsign=1
12524                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12525                 ;;
12526         *)      gidsign=$yyy
12527                 case "$gidsign" in
12528                  1) echo "Your $zzz is unsigned." ;;
12529                 -1) echo "Your $zzz is signed."   ;;
12530                 esac
12531                 ;;
12532         esac
12533 else
12534         gidsign=1
12535         echo "(I can't compile the test program--guessing unsigned.)" >&4
12536 fi
12537
12538
12539 echo " "
12540
12541 if $test X"$quadtype" != X; then
12542
12543 echo "Checking how to print 64-bit integers..." >&4
12544
12545 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12546         $cat >try.c <<'EOCP'
12547 #include <sys/types.h>
12548 #include <stdio.h>
12549 int main() {
12550   int q = 12345678901;
12551   printf("%ld\n", q);
12552 }
12553 EOCP
12554         set try
12555         if eval $compile; then
12556                 yyy=`./try$exe_ext`
12557                 case "$yyy" in
12558                 12345678901)
12559                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12560                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12561                         echo "We will use %d."
12562                         ;;
12563                 esac
12564         fi
12565 fi
12566
12567 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12568         $cat >try.c <<'EOCP'
12569 #include <sys/types.h>
12570 #include <stdio.h>
12571 int main() {
12572   long q = 12345678901;
12573   printf("%ld\n", q);
12574 }
12575 EOCP
12576         set try
12577         if eval $compile; then
12578                 yyy=`./try$exe_ext`
12579                 case "$yyy" in
12580                 12345678901)
12581                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12582                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12583                         echo "We will use %ld."
12584                         ;;
12585                 esac
12586         fi
12587 fi
12588
12589 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12590         $cat >try.c <<'EOCP'
12591 #include <sys/types.h>
12592 #include <inttypes.h>
12593 #include <stdio.h>
12594 int main() {
12595   int64_t q = 12345678901;
12596   printf("%" PRId64 "\n", q);
12597 }
12598 EOCP
12599         set try
12600         if eval $compile; then
12601                 yyy=`./try$exe_ext`
12602                 case "$yyy" in
12603                 12345678901)
12604                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12605                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12606                         echo "We will use the C9X style."
12607                         ;;
12608                 esac
12609         fi
12610 fi
12611
12612 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12613         $cat >try.c <<'EOCP'
12614 #include <sys/types.h>
12615 #include <stdio.h>
12616 int main() {
12617   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12618   printf("%lld\n", q);
12619 }
12620 EOCP
12621         set try
12622         if eval $compile; then
12623                 yyy=`./try$exe_ext`
12624                 case "$yyy" in
12625                 12345678901)
12626                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12627                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12628                         echo "We will use the %lld style."
12629                         ;;
12630                 esac
12631         fi
12632 fi
12633
12634 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12635         $cat >try.c <<EOCP
12636 #include <sys/types.h>
12637 #include <stdio.h>
12638 int main() {
12639   $quadtype q = 12345678901;
12640   printf("%Ld\n", q);
12641 }
12642 EOCP
12643         set try
12644         if eval $compile; then
12645                 yyy=`./try$exe_ext`
12646                 case "$yyy" in
12647                 12345678901)
12648                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12649                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12650                         echo "We will use %Ld."
12651                         ;;
12652                 esac
12653         fi
12654 fi
12655
12656 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12657         $cat >try.c <<EOCP
12658 #include <sys/types.h>
12659 #include <stdio.h>
12660 int main() {
12661   $quadtype q = 12345678901;
12662   printf("%qd\n", q);
12663 }
12664 EOCP
12665         set try
12666         if eval $compile; then
12667                 yyy=`./try$exe_ext`
12668                 case "$yyy" in
12669                 12345678901)
12670                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12671                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12672                         echo "We will use %qd."
12673                         ;;
12674                 esac
12675         fi
12676 fi
12677
12678 if $test X"$sPRId64" = X; then
12679         echo "Cannot figure out how to print 64-bit integers." >&4
12680 fi
12681
12682 $rm -f try try.*
12683
12684 fi
12685
12686 case "$sPRId64" in
12687 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12688         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12689         ;;
12690 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12691         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12692         ;;
12693 esac
12694
12695
12696 echo " "
12697 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12698
12699 if $test X"$ivsize" = X8; then
12700         ivdformat="$sPRId64"
12701         uvuformat="$sPRIu64"
12702         uvoformat="$sPRIo64"
12703         uvxformat="$sPRIx64"
12704 else
12705         if $test X"$ivsize" = X"$longsize"; then
12706                 ivdformat='"ld"'
12707                 uvuformat='"lu"'
12708                 uvoformat='"lo"'
12709                 uvxformat='"lx"'
12710         else
12711                 if $test X"$ivsize" = X"$intsize"; then
12712                         ivdformat='"d"'
12713                         uvuformat='"u"'
12714                         uvoformat='"o"'
12715                         uvxformat='"x"'
12716                 else
12717                         : far out
12718                         if $test X"$ivsize" = X"$shortsize"; then
12719                                 ivdformat='"hd"'
12720                                 uvuformat='"hu"'
12721                                 uvoformat='"ho"'
12722                                 uvxformat='"hx"'
12723                         fi
12724                 fi
12725         fi
12726 fi
12727
12728 case "$ivdformat" in
12729 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12730     exit 1
12731     ;;
12732 esac
12733
12734
12735 echo " "
12736 $echo "Checking the format string to be used for gids..." >&4
12737
12738 case "$gidsign" in
12739 -1)     if $test X"$gidsize" = X"$ivsize"; then
12740                 gidformat="$ivdformat"
12741         else
12742                 if $test X"$gidsize" = X"$longsize"; then
12743                         gidformat='"ld"'
12744                 else
12745                         if $test X"$gidsize" = X"$intsize"; then
12746                                 gidformat='"d"'
12747                         else
12748                                 if $test X"$gidsize" = X"$shortsize"; then
12749                                         gidformat='"hd"'
12750                                 fi
12751                         fi
12752                 fi
12753         fi
12754         ;;
12755 *)      if $test X"$gidsize" = X"$uvsize"; then
12756                 gidformat="$uvuformat"
12757         else
12758                 if $test X"$gidsize" = X"$longsize"; then
12759                         gidformat='"lu"'
12760                 else
12761                         if $test X"$gidsize" = X"$intsize"; then
12762                                 gidformat='"u"'
12763                         else
12764                                 if $test X"$gidsize" = X"$shortsize"; then
12765                                         gidformat='"hu"'
12766                                 fi
12767                         fi
12768                 fi
12769         fi
12770         ;;
12771 esac
12772
12773 : see if getgroups exists
12774 set getgroups d_getgrps
12775 eval $inlibc
12776
12777 : see if setgroups exists
12778 set setgroups d_setgrps
12779 eval $inlibc
12780
12781
12782 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12783 echo " "
12784 case "$d_getgrps$d_setgrps" in
12785 *define*)
12786         case "$groupstype" in
12787         '') dflt="$gidtype" ;;
12788         *)  dflt="$groupstype" ;;
12789         esac
12790         $cat <<EOM
12791 What type of pointer is the second argument to getgroups() and setgroups()?
12792 Usually this is the same as group ids, $gidtype, but not always.
12793
12794 EOM
12795         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12796         . ./myread
12797         groupstype="$ans"
12798         ;;
12799 *)  groupstype="$gidtype";;
12800 esac
12801
12802 echo " "
12803 echo "Checking if your $make program sets \$(MAKE)..." >&4
12804 case "$make_set_make" in
12805 '')
12806         $sed 's/^X //' > testmake.mak << 'EOF'
12807 Xall:
12808 X       @echo 'maketemp="$(MAKE)"'
12809 EOF
12810         case "`$make -f testmake.mak 2>/dev/null`" in
12811         *maketemp=*) make_set_make='#' ;;
12812         *)      make_set_make="MAKE=$make" ;;
12813         esac
12814         $rm -f testmake.mak
12815         ;;
12816 esac
12817 case "$make_set_make" in
12818 '#') echo "Yup, it does.";;
12819 *) echo "Nope, it doesn't.";;
12820 esac
12821
12822 : see what type is used for mode_t
12823 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12824 set mode_t modetype int stdio.h sys/types.h
12825 eval $typedef_ask
12826
12827 : define a fucntion to check prototypes
12828 $cat > protochk <<EOSH
12829 $startsh
12830 cc="$cc"
12831 optimize="$optimize"
12832 ccflags="$ccflags"
12833 prototype="$prototype"
12834 define="$define"
12835 rm=$rm
12836 EOSH
12837
12838 $cat >> protochk <<'EOSH'
12839
12840 $rm -f try.c
12841 foo="$1"
12842 shift
12843 while test $# -ge 2; do
12844         case "$1" in
12845                 $define) echo "#include <$2>" >> try.c ;;
12846                 literal) echo "$2" >> try.c ;;
12847         esac
12848     shift 2
12849 done
12850 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12851 cat >> try.c <<'EOCP'
12852 #ifdef CAN_PROTOTYPE
12853 #define _(args) args
12854 #else
12855 #define _(args) ()
12856 #endif
12857 EOCP
12858 echo "$foo" >> try.c
12859 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12860 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12861 status=$?
12862 $rm -f try.[co]
12863 exit $status
12864 EOSH
12865 chmod +x protochk
12866 $eunicefix protochk
12867
12868 : see what type is used for size_t
12869 rp="What is the type used for the length parameter for string functions?"
12870 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12871 eval $typedef_ask
12872
12873 : check for type of arguments to gethostbyaddr. 
12874 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12875         case "$d_gethbyaddr" in
12876         $define)
12877                 $cat <<EOM
12878
12879 Checking to see what type of arguments are accepted by gethostbyaddr().
12880 EOM
12881                 hdrs="$define sys/types.h
12882                         $d_socket sys/socket.h 
12883                         $i_niin netinet/in.h 
12884                         $i_netdb netdb.h
12885                         $i_unistd unistd.h"
12886                 : The first arg can 'char *' or 'void *'
12887                 : The second arg is some of integral type
12888                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12889                         for yyy in size_t long int; do
12890                                 case "$netdb_host_type" in
12891                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12892                                         if ./protochk "$try" $hdrs; then
12893                                                 echo "Your system accepts $xxx for the first arg."
12894                                                 echo "...and $yyy for the second arg."
12895                                                 netdb_host_type="$xxx"
12896                                                 netdb_hlen_type="$yyy"
12897                                         fi
12898                                         ;;
12899                                 esac
12900                         done
12901                 done
12902                 : In case none of those worked, prompt the user.
12903                 case "$netdb_host_type" in
12904                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12905                         dflt='char *'
12906                         . ./myread
12907                         netdb_host_type=$ans
12908                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12909                         dflt="$sizetype"
12910                         . ./myread
12911                         netdb_hlen_type=$ans
12912                         ;;
12913                 esac
12914                 ;;
12915         *)      : no gethostbyaddr, so pick harmless defaults
12916                 netdb_host_type='char *'
12917                 netdb_hlen_type="$sizetype"
12918                 ;;
12919         esac
12920         # Remove the "const" if needed. -- but then we'll have a 
12921         # prototype clash!
12922         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12923 fi
12924
12925 : check for type of argument to gethostbyname. 
12926 if test "X$netdb_name_type" = X ; then
12927         case "$d_gethbyname" in
12928         $define)
12929                 $cat <<EOM
12930
12931 Checking to see what type of argument is accepted by gethostbyname().
12932 EOM
12933                 hdrs="$define sys/types.h
12934                         $d_socket sys/socket.h 
12935                         $i_niin netinet/in.h 
12936                         $i_netdb netdb.h
12937                         $i_unistd unistd.h"
12938                 for xxx in "const char *" "char *"; do
12939                         case "$netdb_name_type" in
12940                         '')     try="extern struct hostent *gethostbyname($xxx);"
12941                                 if ./protochk "$try" $hdrs; then
12942                                         echo "Your system accepts $xxx."
12943                                         netdb_name_type="$xxx"
12944                                 fi
12945                                 ;;
12946                         esac
12947                 done
12948                 : In case none of those worked, prompt the user.
12949                 case "$netdb_name_type" in
12950                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12951                         dflt='char *'
12952                         . ./myread
12953                         netdb_name_type=$ans
12954                         ;;
12955                 esac
12956                 ;;
12957         *)      : no gethostbyname, so pick harmless default
12958                 netdb_name_type='char *'
12959                 ;;
12960         esac
12961 fi
12962
12963 : check for type of 1st argument to getnetbyaddr. 
12964 if test "X$netdb_net_type" = X ; then
12965         case "$d_getnbyaddr" in
12966         $define)
12967                 $cat <<EOM
12968
12969 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12970 EOM
12971                 hdrs="$define sys/types.h
12972                         $d_socket sys/socket.h 
12973                         $i_niin netinet/in.h 
12974                         $i_netdb netdb.h
12975                         $i_unistd unistd.h"
12976                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12977                         case "$netdb_net_type" in
12978                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12979                                 if ./protochk "$try" $hdrs; then
12980                                         echo "Your system accepts $xxx."
12981                                         netdb_net_type="$xxx"
12982                                 fi
12983                                 ;;
12984                         esac
12985                 done
12986                 : In case none of those worked, prompt the user.
12987                 case "$netdb_net_type" in
12988                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12989                         dflt='long'
12990                         . ./myread
12991                         netdb_net_type=$ans
12992                         ;;
12993                 esac
12994                 ;;
12995         *)      : no getnetbyaddr, so pick harmless default
12996                 netdb_net_type='long'
12997                 ;;
12998         esac
12999 fi
13000 : locate the preferred pager for this system
13001 case "$pager" in
13002 '')
13003         dflt=''
13004         case "$pg" in
13005         /*) dflt=$pg;;
13006         esac
13007         case "$more" in
13008         /*) dflt=$more;;
13009         esac
13010         case "$less" in
13011         /*) dflt=$less;;
13012         esac
13013         case "$dflt" in
13014         '') dflt=/usr/ucb/more;;
13015         esac
13016         ;;
13017 *) dflt="$pager";;
13018 esac
13019 echo " "
13020 fn=f/
13021 rp='What pager is used on your system?'
13022 . ./getfile
13023 pager="$ans"
13024
13025 : see what type pids are declared as in the kernel
13026 rp="What is the type of process ids on this system?"
13027 set pid_t pidtype int stdio.h sys/types.h
13028 eval $typedef_ask
13029
13030 : Find earliest binary compatible site_perl subdirectory perl can use.
13031 case "$bincompat5005" in
13032 "$define") xs_apiversion='5.005' ;;
13033 *) xs_apiversion=$version ;;   # The current site_perl version.
13034 esac
13035 : Find earliest pure perl site_perl subdirectory perl can use.
13036 : The versioned directories started at 5.005.
13037 pm_apiversion='5.005'
13038
13039 : check for length of pointer
13040 echo " "
13041 case "$ptrsize" in
13042 '')
13043         echo "Checking to see how big your pointers are..." >&4
13044         if test "$voidflags" -gt 7; then
13045                 echo '#define VOID_PTR char *' > try.c
13046         else
13047                 echo '#define VOID_PTR void *' > try.c
13048         fi
13049         $cat >>try.c <<'EOCP'
13050 #include <stdio.h>
13051 int main()
13052 {
13053     printf("%d\n", (int)sizeof(VOID_PTR));
13054     exit(0);
13055 }
13056 EOCP
13057         set try
13058         if eval $compile_ok; then
13059                 ptrsize=`./try`
13060                 echo "Your pointers are $ptrsize bytes long."
13061         else
13062                 dflt='4'
13063                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13064                 rp="What is the size of a pointer (in bytes)?"
13065                 . ./myread
13066                 ptrsize="$ans"
13067         fi
13068         ;;
13069 esac
13070 $rm -f try.c try
13071
13072 : see if ar generates random libraries by itself
13073 echo " "
13074 echo "Checking how to generate random libraries on your machine..." >&4
13075 echo 'int bar1() { return bar2(); }' > bar1.c
13076 echo 'int bar2() { return 2; }' > bar2.c
13077 $cat > foo.c <<'EOP'
13078 int main() { printf("%d\n", bar1()); exit(0); }
13079 EOP
13080 $cc $ccflags -c bar1.c >/dev/null 2>&1
13081 $cc $ccflags -c bar2.c >/dev/null 2>&1
13082 $cc $ccflags -c foo.c >/dev/null 2>&1
13083 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13084 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13085         ./foobar >/dev/null 2>&1; then
13086         echo "$ar appears to generate random libraries itself."
13087         orderlib=false
13088         ranlib=":"
13089 elif $ar ts bar$_a >/dev/null 2>&1 &&
13090         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13091         ./foobar >/dev/null 2>&1; then
13092                 echo "a table of contents needs to be added with '$ar ts'."
13093                 orderlib=false
13094                 ranlib="$ar ts"
13095 else
13096         case "$ranlib" in
13097         :) ranlib='';;
13098         '')
13099                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13100                 $test -f $ranlib || ranlib=''
13101                 ;;
13102         esac
13103         if $test -n "$ranlib"; then
13104                 echo "your system has '$ranlib'; we'll use that."
13105                 orderlib=false
13106         else
13107                 echo "your system doesn't seem to support random libraries"
13108                 echo "so we'll use lorder and tsort to order the libraries."
13109                 orderlib=true
13110                 ranlib=":"
13111         fi
13112 fi
13113 $rm -f foo* bar* 
13114
13115 : check for type of arguments to select. 
13116 case "$selecttype" in
13117 '') case "$d_select" in
13118         $define)
13119                 echo " "
13120                 $cat <<EOM
13121 Checking to see what type of arguments are accepted by select().
13122 EOM
13123                 hdrs="$define sys/types.h
13124                         $i_systime sys/time.h 
13125                         $i_sysselct sys/select.h
13126                         $d_socket sys/socket.h"
13127                 : The first arg can be int, unsigned, or size_t
13128                 : The last arg may or may not be 'const'
13129                 val=''
13130                 : void pointer has been seen but using that
13131                 : breaks the selectminbits test
13132                 for xxx in 'fd_set *' 'int *'; do
13133                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13134                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13135                                         case "$val" in
13136                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13137                                                 if ./protochk "$try" $hdrs; then
13138                                                         echo "Your system accepts $xxx."
13139                                                         val="$xxx"
13140                                                 fi
13141                                                 ;;
13142                                         esac
13143                                 done
13144                         done
13145                 done
13146                 case "$val" in
13147                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13148                         case "$d_fd_set" in
13149                                 $define) dflt="fd_set *" ;;
13150                                 *)              dflt="int *" ;;
13151                         esac
13152                         . ./myread
13153                         val=$ans
13154                         ;;
13155                 esac
13156                 selecttype="$val"
13157                 ;;
13158         *)      : no select, so pick a harmless default
13159                 selecttype='int *'
13160                 ;;
13161         esac
13162         ;;
13163 esac
13164
13165 : check for the select 'width'
13166 case "$selectminbits" in
13167 '') case "$d_select" in
13168         $define)
13169                 $cat <<EOM
13170
13171 Checking to see on how many bits at a time your select() operates...
13172 EOM
13173                 $cat >try.c <<EOCP
13174 #include <sys/types.h>
13175 #$i_time I_TIME
13176 #$i_systime I_SYS_TIME
13177 #$i_systimek I_SYS_TIME_KERNEL
13178 #ifdef I_TIME
13179 #   include <time.h>
13180 #endif
13181 #ifdef I_SYS_TIME
13182 #   ifdef I_SYS_TIME_KERNEL
13183 #       define KERNEL
13184 #   endif
13185 #   include <sys/time.h>
13186 #   ifdef I_SYS_TIME_KERNEL
13187 #       undef KERNEL
13188 #   endif
13189 #endif
13190 #$i_sysselct I_SYS_SELECT
13191 #ifdef I_SYS_SELECT
13192 #include <sys/select.h>
13193 #endif
13194 #$d_socket HAS_SOCKET
13195 #ifdef HAS_SOCKET
13196 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13197 #endif
13198 #include <stdio.h>
13199 $selecttype b;
13200 #define S sizeof(*(b))
13201 #define MINBITS 64
13202 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13203 #define NBITS  (NBYTES * 8)
13204 int main() {
13205     char s[NBYTES];
13206     struct timeval t;
13207     int i;
13208     FILE* fp;
13209     int fd;
13210
13211     fclose(stdin);
13212     fp = fopen("try.c", "r");
13213     if (fp == 0)
13214       exit(1);
13215     fd = fileno(fp);
13216     if (fd < 0)
13217       exit(2);
13218     b = ($selecttype)s;
13219     for (i = 0; i < NBITS; i++)
13220         FD_SET(i, b);
13221     t.tv_sec  = 0;
13222     t.tv_usec = 0;
13223     select(fd + 1, b, 0, 0, &t);
13224     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13225     printf("%d\n", i + 1);
13226     return 0;
13227 }
13228 EOCP
13229                 set try
13230                 if eval $compile_ok; then
13231                         selectminbits=`./try`
13232                         case "$selectminbits" in
13233                         '')     cat >&4 <<EOM
13234 Cannot figure out on how many bits at a time your select() operates.
13235 I'll play safe and guess it is 32 bits.
13236 EOM
13237                                 selectminbits=32
13238                                 bits="32 bits"
13239                                 ;;
13240                         1)      bits="1 bit" ;;
13241                         *)      bits="$selectminbits bits" ;;
13242                         esac
13243                         echo "Your select() operates on $bits at a time." >&4
13244                 else
13245                         rp='What is the minimum number of bits your select() operates on?'
13246                         case "$byteorder" in
13247                         1234|12345678)  dflt=32 ;;
13248                         *)              dflt=1  ;;
13249                         esac
13250                         . ./myread
13251                         val=$ans
13252                         selectminbits="$val"
13253                 fi
13254                 $rm -f try.* try
13255                 ;;
13256         *)      : no select, so pick a harmless default
13257                 selectminbits='32'
13258                 ;;
13259         esac
13260         ;;
13261 esac
13262
13263 : Trace out the files included by signal.h, then look for SIGxxx names.
13264 : Remove SIGARRAYSIZE used by HPUX.
13265 : Remove SIGSTKSIZE used by Linux.
13266 : Remove SIGSTKSZ used by Posix.
13267 : Remove SIGTYP void lines used by OS2.
13268 : Some cpps, like os390, dont give the file name anywhere
13269 if [ "X$fieldn" = X ]; then
13270         : Just make some guesses.  We check them later.
13271         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13272 else
13273         xxx=`echo '#include <signal.h>' |
13274         $cppstdin $cppminus $cppflags 2>/dev/null |
13275         $grep '^[       ]*#.*include' | 
13276         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13277 fi
13278 : Check this list of files to be sure we have parsed the cpp output ok.
13279 : This will also avoid potentially non-existent files, such 
13280 : as ../foo/bar.h
13281 xxxfiles=''
13282 for xx in $xxx /dev/null ; do
13283         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13284 done
13285 : If we have found no files, at least try signal.h
13286 case "$xxxfiles" in
13287 '')     xxxfiles=`./findhdr signal.h` ;;
13288 esac
13289 xxx=`awk '
13290 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13291         print substr($2, 4, 20)
13292 }
13293 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13294         print substr($3, 4, 20)
13295 }' $xxxfiles`
13296 : Append some common names just in case the awk scan failed.
13297 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13298 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13299 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13300 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13301 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13302
13303 : generate a few handy files for later
13304 $cat > signal.c <<'EOCP'
13305 #include <sys/types.h>
13306 #include <signal.h>
13307 #include <stdio.h>
13308 int main() {
13309
13310 /* Strange style to avoid deeply-nested #if/#else/#endif */
13311 #ifndef NSIG
13312 #  ifdef _NSIG
13313 #    define NSIG (_NSIG)
13314 #  endif
13315 #endif
13316
13317 #ifndef NSIG
13318 #  ifdef SIGMAX
13319 #    define NSIG (SIGMAX+1)
13320 #  endif
13321 #endif
13322
13323 #ifndef NSIG
13324 #  ifdef SIG_MAX
13325 #    define NSIG (SIG_MAX+1)
13326 #  endif
13327 #endif
13328
13329 #ifndef NSIG
13330 #  ifdef MAXSIG
13331 #    define NSIG (MAXSIG+1)
13332 #  endif
13333 #endif
13334
13335 #ifndef NSIG
13336 #  ifdef MAX_SIG
13337 #    define NSIG (MAX_SIG+1)
13338 #  endif
13339 #endif
13340
13341 #ifndef NSIG
13342 #  ifdef SIGARRAYSIZE
13343 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13344 #  endif
13345 #endif
13346
13347 #ifndef NSIG
13348 #  ifdef _sys_nsig
13349 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13350 #  endif
13351 #endif
13352
13353 /* Default to some arbitrary number that's big enough to get most
13354    of the common signals.
13355 */
13356 #ifndef NSIG
13357 #    define NSIG 50
13358 #endif
13359
13360 printf("NSIG %d\n", NSIG);
13361
13362 #ifndef JUST_NSIG
13363
13364 EOCP
13365
13366 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13367 {
13368         printf "#ifdef SIG"; printf $1; printf "\n"
13369         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13370         printf $1; printf ");\n"
13371         printf "#endif\n"
13372 }
13373 END {
13374         printf "#endif /* JUST_NSIG */\n";
13375         printf "exit(0);\n}\n";
13376 }
13377 ' >>signal.c
13378 $cat >signal.awk <<'EOP'
13379 BEGIN { ndups = 0 }
13380 $1 ~ /^NSIG$/ { nsig = $2 }
13381 ($1 !~ /^NSIG$/) && (NF == 2) {
13382     if ($2 > maxsig) { maxsig = $2 }
13383     if (sig_name[$2]) {
13384         dup_name[ndups] = $1
13385         dup_num[ndups] = $2
13386         ndups++ 
13387     }
13388     else {
13389         sig_name[$2] = $1
13390         sig_num[$2] = $2
13391     }
13392 }
13393 END { 
13394     if (nsig == 0) {
13395         nsig = maxsig + 1
13396     }
13397     printf("NSIG %d\n", nsig);
13398     for (n = 1; n < nsig; n++) {
13399         if (sig_name[n]) {
13400             printf("%s %d\n", sig_name[n], sig_num[n])
13401         }
13402         else {
13403             printf("NUM%d %d\n", n, n) 
13404         }
13405     }
13406     for (n = 0; n < ndups; n++) {
13407         printf("%s %d\n", dup_name[n], dup_num[n])
13408     }
13409 }
13410 EOP
13411 $cat >signal_cmd <<EOS
13412 $startsh
13413 if $test -s signal.lst; then
13414     echo "Using your existing signal.lst file"
13415         exit 0
13416 fi
13417 xxx="$xxx"
13418 EOS
13419 $cat >>signal_cmd <<'EOS'
13420
13421 set signal
13422 if eval $compile_ok; then
13423         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13424 else
13425         echo "(I can't seem be able to compile the whole test program)" >&4
13426         echo "(I'll try it in little pieces.)" >&4
13427         set signal -DJUST_NSIG
13428         if eval $compile_ok; then
13429                 ./signal$_exe > signal.nsg
13430                 $cat signal.nsg
13431         else
13432                 echo "I can't seem to figure out how many signals you have." >&4
13433                 echo "Guessing 50." >&4
13434                 echo 'NSIG 50' > signal.nsg
13435         fi
13436         : Now look at all the signal names, one at a time.
13437         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13438                 $cat > signal.c <<EOCP
13439 #include <sys/types.h>
13440 #include <signal.h>
13441 #include <stdio.h>
13442 int main() {
13443 printf("$xx %d\n", SIG${xx});
13444 return 0;
13445 }
13446 EOCP
13447                 set signal
13448                 if eval $compile; then
13449                         echo "SIG${xx} found."
13450                         ./signal$_exe  >> signal.ls1
13451                 else
13452                         echo "SIG${xx} NOT found."
13453                 fi
13454         done
13455         if $test -s signal.ls1; then
13456                 $cat signal.nsg signal.ls1 |
13457                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13458         fi
13459
13460 fi
13461 if $test -s signal.lst; then
13462         :
13463 else
13464         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13465         echo 'kill -l' >signal
13466         set X `csh -f <signal`
13467         $rm -f signal
13468         shift
13469         case $# in
13470         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13471         esac
13472         echo $@ | $tr ' ' $trnl | \
13473             $awk '{ printf "%s %d\n", $1, ++s; }
13474                   END { printf "NSIG %d\n", ++s }' >signal.lst
13475 fi
13476 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13477 EOS
13478 chmod a+x signal_cmd
13479 $eunicefix signal_cmd
13480
13481 : generate list of signal names
13482 echo " "
13483 case "$sig_name_init" in
13484 '') doinit=yes ;;
13485 *)  case "$sig_num_init" in
13486     ''|*,*) doinit=yes ;;
13487     esac ;;
13488 esac
13489 case "$doinit" in
13490 yes)
13491         echo "Generating a list of signal names and numbers..." >&4
13492         . ./signal_cmd
13493         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13494         sig_name=`$awk 'BEGIN { printf "ZERO " }
13495                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13496         sig_num=`$awk  'BEGIN { printf "0 " }
13497                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13498         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13499                              !/^NSIG/   { printf "\"%s\", ", $1 }
13500                              END        { printf "0\n" }' signal.lst`
13501         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13502                              !/^NSIG/   { printf "%d, ", $2}
13503                              END        { printf "0\n"}' signal.lst`
13504         ;;
13505 esac
13506 echo "The following $sig_count signals are available:"
13507 echo " "
13508 echo $sig_name | $awk \
13509 'BEGIN { linelen = 0 }
13510 {
13511         for (i = 1; i <= NF; i++) {
13512                 name = "SIG" $i " "
13513                 linelen = linelen + length(name)
13514                 if (linelen > 70) {
13515                         printf "\n"
13516                         linelen = length(name)
13517                 }
13518                 printf "%s", name
13519         }
13520         printf "\n"
13521 }'
13522 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13523
13524 : check for socklen_t
13525 echo " "
13526 echo "Checking to see if you have socklen_t..." >&4
13527 $cat >try.c <<EOCP
13528 #include <sys/types.h>
13529 #$d_socket HAS_SOCKET
13530 #ifdef HAS_SOCKET
13531 #include <sys/socket.h>
13532 #endif
13533 int main() { socklen_t x = 16; }
13534 EOCP
13535 set try
13536 if eval $compile; then
13537         val="$define"
13538         echo "You have socklen_t."
13539 else
13540         val="$undef"
13541         echo "You do not have socklen_t."
13542         case "$sizetype" in
13543         size_t) echo "(You do have size_t, that might work.)" ;;
13544         esac
13545 fi
13546 $rm -f try try.*
13547 set d_socklen_t
13548 eval $setvar
13549
13550 : check for type of the size argument to socket calls
13551 case "$d_socket" in
13552 "$define")
13553         $cat <<EOM
13554
13555 Checking to see what type is the last argument of accept().
13556 EOM
13557         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13558         yyy=''
13559         case "$d_socklen_t" in
13560         "$define") yyy="$yyy socklen_t"
13561         esac
13562         yyy="$yyy $sizetype int long"
13563         for xxx in $yyy; do
13564                 case "$socksizetype" in
13565                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13566                         if ./protochk "$try" $hdrs; then
13567                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13568                                 socksizetype="$xxx"
13569                         fi
13570                         ;;
13571                 esac
13572         done
13573 : In case none of those worked, prompt the user.
13574         case "$socksizetype" in
13575         '')     rp='What is the type for the last argument to accept()?'
13576                 dflt='int'
13577                 . ./myread
13578                 socksizetype=$ans
13579                 ;;
13580         esac
13581         ;;
13582 *)      : no sockets, so pick relatively harmless defaults
13583         socksizetype='char *'
13584         ;;
13585 esac
13586
13587 : see what type is used for signed size_t
13588 set ssize_t ssizetype int stdio.h sys/types.h
13589 eval $typedef
13590 dflt="$ssizetype"
13591 $cat > ssize.c <<EOM
13592 #include <stdio.h>
13593 #include <sys/types.h>
13594 #define Size_t $sizetype
13595 #define SSize_t $dflt
13596 int main()
13597 {
13598         if (sizeof(Size_t) == sizeof(SSize_t))
13599                 printf("$dflt\n");
13600         else if (sizeof(Size_t) == sizeof(int))
13601                 printf("int\n");
13602         else 
13603                 printf("long\n");
13604         exit(0);
13605 }
13606 EOM
13607 echo " "
13608 set ssize
13609 if eval $compile_ok && ./ssize > /dev/null; then
13610         ssizetype=`./ssize`
13611         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13612 else
13613         $cat >&4 <<EOM
13614 Help! I can't compile and run the ssize_t test program: please enlighten me!
13615 (This is probably a misconfiguration in your system or libraries, and
13616 you really ought to fix it.  Still, I'll try anyway.)
13617
13618 I need a type that is the same size as $sizetype, but is guaranteed to
13619 be signed.  Common values are ssize_t, int and long.
13620
13621 EOM
13622         rp="What signed type is the same size as $sizetype?"
13623         . ./myread
13624         ssizetype="$ans"
13625 fi
13626 $rm -f ssize ssize.*
13627
13628 : see what type of char stdio uses.
13629 echo " "
13630 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13631         echo "Your stdio uses unsigned chars." >&4
13632         stdchar="unsigned char"
13633 else
13634         echo "Your stdio uses signed chars." >&4
13635         stdchar="char"
13636 fi
13637
13638 : see if time exists
13639 echo " "
13640 if test "X$d_time" = X -o X"$timetype" = X; then
13641     if set time val -f d_time; eval $csym; $val; then
13642                 echo 'time() found.' >&4
13643                 val="$define"
13644                 rp="What is the type returned by time() on this system?"
13645                 set time_t timetype long stdio.h sys/types.h
13646                 eval $typedef_ask
13647     else
13648                 echo 'time() not found, hope that will do.' >&4
13649                 val="$undef"
13650                 timetype='int';
13651     fi
13652     set d_time
13653     eval $setvar
13654 fi
13655
13656 : see what type uids are declared as in the kernel
13657 echo " "
13658 echo "Looking for the type for user ids returned by getuid()."
13659 set uid_t uidtype xxx stdio.h sys/types.h
13660 eval $typedef
13661 case "$uidtype" in
13662 xxx)
13663         xxx=`./findhdr sys/user.h`
13664         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13665         case $1 in
13666         unsigned) dflt="$1 $2" ;;
13667         *) dflt="$1" ;;
13668         esac
13669         ;;
13670 *) dflt="$uidtype";;
13671 esac
13672 case "$uidtype" in
13673 uid_t)  echo "uid_t found." ;;
13674 *)      rp="What is the type for user ids returned by getuid()?"
13675         . ./myread
13676         uidtype="$ans"
13677         ;;
13678 esac
13679
13680 echo " "
13681 case "$uidtype" in
13682 *_t) zzz="$uidtype"     ;;
13683 *)   zzz="uid"          ;;
13684 esac
13685 echo "Checking the size of $zzz..." >&4 
13686 cat > try.c <<EOCP
13687 #include <sys/types.h>
13688 #include <stdio.h>
13689 int main() {
13690     printf("%d\n", (int)sizeof($uidtype));
13691     exit(0);
13692 }
13693 EOCP
13694 set try
13695 if eval $compile_ok; then
13696         yyy=`./try`
13697         case "$yyy" in
13698         '')     uidsize=4
13699                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13700                 ;;
13701         *)      uidsize=$yyy
13702                 echo "Your $zzz is $uidsize bytes long."
13703                 ;;
13704         esac
13705 else
13706         uidsize=4
13707         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13708 fi
13709
13710 echo " "
13711 case "$uidtype" in
13712 *_t) zzz="$uidtype"     ;;
13713 *)   zzz="uid"          ;;
13714 esac
13715 echo "Checking the sign of $zzz..." >&4
13716 cat > try.c <<EOCP
13717 #include <sys/types.h>
13718 #include <stdio.h>
13719 int main() {
13720         $uidtype foo = -1;
13721         if (foo < 0)
13722                 printf("-1\n");
13723         else
13724                 printf("1\n");
13725 }
13726 EOCP
13727 set try
13728 if eval $compile; then
13729         yyy=`./try`
13730         case "$yyy" in
13731         '')     uidsign=1
13732                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13733                 ;;
13734         *)      uidsign=$yyy
13735                 case "$uidsign" in
13736                  1) echo "Your $zzz is unsigned." ;;
13737                 -1) echo "Your $zzz is signed."   ;;
13738                 esac
13739                 ;;
13740         esac
13741 else
13742         uidsign=1
13743         echo "(I can't compile the test program--guessing unsigned.)" >&4
13744 fi
13745
13746
13747
13748 echo " "
13749 $echo "Checking the format string to be used for uids..." >&4
13750
13751 case "$uidsign" in
13752 -1)     if $test X"$uidsize" = X"$ivsize"; then
13753                 uidformat="$ivdformat"
13754         else
13755                 if $test X"$uidsize" = X"$longsize"; then
13756                         uidformat='"ld"'
13757                 else
13758                         if $test X"$uidsize" = X"$intsize"; then
13759                                 uidformat='"d"'
13760                         else
13761                                 if $test X"$uidsize" = X"$shortsize"; then
13762                                         uidformat='"hd"'
13763                                 fi
13764                         fi
13765                 fi
13766         fi
13767         ;;
13768 *)      if $test X"$uidsize" = X"$uvsize"; then
13769                 uidformat="$uvuformat"
13770         else
13771                 if $test X"$uidsize" = X"$longsize"; then
13772                         uidformat='"lu"'
13773                 else
13774                         if $test X"$uidsize" = X"$intsize"; then
13775                                 uidformat='"u"'
13776                         else
13777                                 if $test X"$uidsize" = X"$shortsize"; then
13778                                         uidformat='"hu"'
13779                                 fi
13780                         fi
13781                 fi
13782         fi
13783         ;;
13784 esac
13785
13786 : see if dbm.h is available
13787 : see if dbmclose exists
13788 set dbmclose d_dbmclose
13789 eval $inlibc
13790
13791 case "$d_dbmclose" in
13792 $define)
13793         set dbm.h i_dbm
13794         eval $inhdr
13795         case "$i_dbm" in
13796         $define)
13797                 val="$undef"
13798                 set i_rpcsvcdbm
13799                 eval $setvar
13800                 ;;
13801         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13802                 eval $inhdr
13803                 ;;
13804         esac
13805         ;;
13806 *)      echo "We won't be including <dbm.h>"
13807         val="$undef"
13808         set i_dbm
13809         eval $setvar
13810         val="$undef"
13811         set i_rpcsvcdbm
13812         eval $setvar
13813         ;;
13814 esac
13815
13816 : see if this is a sys/file.h system
13817 val=''
13818 set sys/file.h val
13819 eval $inhdr
13820
13821 : do we need to include sys/file.h ?
13822 case "$val" in
13823 "$define")
13824         echo " "
13825         if $h_sysfile; then
13826                 val="$define"
13827                 echo "We'll be including <sys/file.h>." >&4
13828         else
13829                 val="$undef"
13830                 echo "We won't be including <sys/file.h>." >&4
13831         fi
13832         ;;
13833 *)
13834         h_sysfile=false
13835         ;;
13836 esac
13837 set i_sysfile
13838 eval $setvar
13839
13840 : see if fcntl.h is there
13841 val=''
13842 set fcntl.h val
13843 eval $inhdr
13844
13845 : see if we can include fcntl.h
13846 case "$val" in
13847 "$define")
13848         echo " "
13849         if $h_fcntl; then
13850                 val="$define"
13851                 echo "We'll be including <fcntl.h>." >&4
13852         else
13853                 val="$undef"
13854                 if $h_sysfile; then
13855         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13856                 else
13857                         echo "We won't be including <fcntl.h>." >&4
13858                 fi
13859         fi
13860         ;;
13861 *)
13862         h_fcntl=false
13863         val="$undef"
13864         ;;
13865 esac
13866 set i_fcntl
13867 eval $setvar
13868
13869 : see if this is a iconv.h system
13870 set iconv.h i_iconv
13871 eval $inhdr
13872
13873 : see if locale.h is available
13874 set locale.h i_locale
13875 eval $inhdr
13876
13877 : see if mach cthreads are available
13878 if test "X$usethreads" = "X$define"; then
13879         set mach/cthreads.h i_machcthr
13880         eval $inhdr
13881 else
13882         i_machcthr="$undef"
13883 fi
13884
13885
13886
13887 : see if this is a math.h system
13888 set math.h i_math
13889 eval $inhdr
13890
13891 : see if this is a mntent.h system
13892 set mntent.h i_mntent
13893 eval $inhdr
13894
13895 : see if ndbm.h is available
13896 set ndbm.h t_ndbm
13897 eval $inhdr
13898 case "$t_ndbm" in
13899 $define)
13900         : see if dbm_open exists
13901         set dbm_open d_dbm_open
13902         eval $inlibc
13903         case "$d_dbm_open" in
13904         $undef)
13905                 t_ndbm="$undef"
13906                 echo "We won't be including <ndbm.h>"
13907                 ;;
13908         esac
13909         ;;
13910 esac
13911 val="$t_ndbm"
13912 set i_ndbm
13913 eval $setvar
13914
13915 : see if net/errno.h is available
13916 val=''
13917 set net/errno.h val
13918 eval $inhdr
13919
13920 : Unfortunately, it causes problems on some systems.  Arrgh.
13921 case "$val" in
13922 $define)
13923         cat > try.c <<'EOM'
13924 #include <stdio.h>
13925 #include <errno.h>
13926 #include <net/errno.h>
13927 int func()
13928 {
13929         return ENOTSOCK;
13930 }
13931 EOM
13932         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13933                 echo "We'll be including <net/errno.h>." >&4
13934         else
13935                 echo "We won't be including <net/errno.h>." >&4
13936                 val="$undef"
13937         fi
13938         $rm -f try.* try
13939         ;;
13940 esac
13941 set i_neterrno
13942 eval $setvar
13943
13944 : see if netinet/tcp.h is available
13945 set netinet/tcp.h i_netinettcp
13946 eval $inhdr
13947
13948 : see if this is a poll.h system
13949 set poll.h i_poll
13950 eval $inhdr
13951
13952 echo " "
13953 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13954 $cat <<'EOSH' > Cppsym.know
13955 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13956 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13957 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13958 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13959 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13960 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13961 bull c cadmus clipper CMU COFF COMPILER_VERSION
13962 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13963 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13964 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13965 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13966 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13967 H3050R H3050RX hbullx20 hcx host_mips
13968 hp200 hp300 hp700 HP700 hp800 hp9000
13969 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13970 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13971 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13972 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13973 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13974 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13975 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13976 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13977 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13978 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13979 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13980 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13981 MATH_HAS_NO_SIDE_EFFECTS
13982 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13983 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13984 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13985 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13986 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13987 NetBSD news1500 news1700 news1800 news1900 news3700
13988 news700 news800 news900 NeXT NLS ns16000 ns32000
13989 ns32016 ns32332 ns32k nsc32000
13990 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13991 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13992 pc532 pdp11 PGC PIC plexus PORTAR posix
13993 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13994 POSIX_C_SOURCE POSIX_SOURCE POWER
13995 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13996 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13997 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13998 sony sony_news sonyrisc sparc sparclite spectrum
13999 stardent stdc STDC_EXT stratos sun sun3 sun386
14000 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14001 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14002 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14003 sysV68 sysV88 Tek4132 Tek4300 titan
14004 tower tower32 tower32_200 tower32_600 tower32_700
14005 tower32_800 tower32_850 tss
14006 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14007 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14008 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14009 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14010 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14011 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14012 z8000
14013 EOSH
14014 # Maybe put other stuff here too.
14015 cat <<EOSH >>Cppsym.know
14016 $osname
14017 EOSH
14018 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14019 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14020 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14021 $rm -f Cppsym.a Cppsym.b
14022 cat <<EOSH > Cppsym
14023 $startsh
14024 if $test \$# -gt 0; then
14025     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14026     if $test -s Cppsym.got; then
14027         $rm -f Cppsym.got
14028         exit 0
14029     fi
14030     $rm -f Cppsym.got
14031     exit 1
14032 else
14033     $tr " " "$trnl" | ./Cppsym.try
14034     exit 0
14035 fi
14036 EOSH
14037 chmod +x Cppsym
14038 $eunicefix Cppsym
14039 cat <<EOSH > Cppsym.try
14040 $startsh
14041 cat <<'EOCP' > try.c
14042 #include <stdio.h>
14043 int main() {
14044 EOCP
14045 $awk \\
14046 EOSH
14047 cat <<'EOSH' >> Cppsym.try
14048 'length($1) > 0 {
14049     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
14050     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
14051     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
14052     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
14053 }'       >> try.c
14054 echo '}' >> try.c
14055 EOSH
14056 cat <<EOSH >> Cppsym.try
14057 cc="$cc"
14058 optimize="$optimize"
14059 ccflags="$ccflags"
14060 ldflags="$ldflags"
14061 libs="$libs"
14062 exe_ext="$exe_ext"
14063 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14064 EOSH
14065 chmod +x Cppsym.try
14066 $eunicefix Cppsym.try
14067 ./Cppsym < Cppsym.know > Cppsym.true
14068 : now check the C compiler for additional symbols
14069 postprocess_cc_v=''
14070 case "$osname" in
14071 aix) postprocess_cc_v="|$tr , ' '" ;;
14072 esac
14073 $cat >ccsym <<EOS
14074 $startsh
14075 $cat >tmp.c <<EOF
14076 extern int foo;
14077 EOF
14078 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14079 do
14080         case "\$i" in
14081         -D*) echo "\$i" | $sed 's/^-D//';;
14082         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14083         esac
14084 done
14085 $rm -f try.c
14086 EOS
14087 postprocess_cc_v=''
14088 chmod +x ccsym
14089 $eunicefix ccsym
14090 ./ccsym > ccsym1.raw
14091 if $test -s ccsym1.raw; then
14092        $sort ccsym1.raw | $uniq >ccsym.raw
14093 else
14094        mv ccsym1.raw ccsym.raw
14095 fi
14096
14097 $awk '/\=/ { print $0; next }
14098         { print $0"=1" }' ccsym.raw >ccsym.list
14099 $awk '/\=/ { print $0; next }
14100         { print $0"=1" }' Cppsym.true >ccsym.true
14101 $comm -13 ccsym.true ccsym.list >ccsym.own
14102 $comm -12 ccsym.true ccsym.list >ccsym.com
14103 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14104 also=''
14105 if $test -z ccsym.raw; then
14106         echo "Your C compiler doesn't seem to define any symbols!" >&4
14107         echo " "
14108         echo "However, your C preprocessor defines the following symbols:"
14109         $cat Cppsym.true
14110         ccsymbols=''
14111         cppsymbols=`$cat Cppsym.true`
14112         cppsymbols=`echo $cppsymbols`
14113         cppccsymbols="$cppsymbols"
14114 else
14115         if $test -s ccsym.com; then
14116                 echo "Your C compiler and pre-processor define these symbols:"
14117                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14118                 also='also '
14119                 symbols='ones'
14120                 cppccsymbols=`$cat ccsym.com`
14121                 cppccsymbols=`echo $cppccsymbols`
14122                 $test "$silent" || sleep 1
14123         fi
14124         if $test -s ccsym.cpp; then
14125                 $test "$also" && echo " "
14126                 echo "Your C pre-processor ${also}defines the following symbols:"
14127                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14128                 also='further '
14129                 cppsymbols=`$cat ccsym.cpp`
14130                 cppsymbols=`echo $cppsymbols`
14131                 $test "$silent" || sleep 1
14132         fi
14133         if $test -s ccsym.own; then
14134                 $test "$also" && echo " "
14135                 echo "Your C compiler ${also}defines the following cpp symbols:"
14136                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14137                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14138                 ccsymbols=`$cat ccsym.own`
14139                 ccsymbols=`echo $ccsymbols`
14140                 $test "$silent" || sleep 1
14141         fi
14142 fi
14143 $rm -f ccsym*
14144
14145 : see if this is a termio system
14146 val="$undef"
14147 val2="$undef"
14148 val3="$undef"
14149 if $test `./findhdr termios.h`; then
14150         set tcsetattr i_termios
14151         eval $inlibc
14152         val3="$i_termios"
14153 fi
14154 echo " "
14155 case "$val3" in
14156 "$define") echo "You have POSIX termios.h... good!" >&4;;
14157 *) if ./Cppsym pyr; then
14158                 case "`/bin/universe`" in
14159                 ucb) if $test `./findhdr sgtty.h`; then
14160                                 val2="$define"
14161                                 echo "<sgtty.h> found." >&4
14162                         else
14163                                 echo "System is pyramid with BSD universe."
14164                                 echo "<sgtty.h> not found--you could have problems." >&4
14165                         fi;;
14166                 *) if $test `./findhdr termio.h`; then
14167                                 val="$define"
14168                                 echo "<termio.h> found." >&4
14169                         else
14170                                 echo "System is pyramid with USG universe."
14171                                 echo "<termio.h> not found--you could have problems." >&4
14172                         fi;;
14173                 esac
14174         elif ./usg; then
14175                 if $test `./findhdr termio.h`; then
14176                         echo "<termio.h> found." >&4
14177                         val="$define"
14178                 elif $test `./findhdr sgtty.h`; then
14179                         echo "<sgtty.h> found." >&4
14180                         val2="$define"
14181                 else
14182 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14183                 fi
14184         else
14185                 if $test `./findhdr sgtty.h`; then
14186                         echo "<sgtty.h> found." >&4
14187                         val2="$define"
14188                 elif $test `./findhdr termio.h`; then
14189                         echo "<termio.h> found." >&4
14190                         val="$define"
14191                 else
14192 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14193                 fi
14194         fi;;
14195 esac
14196 set i_termio; eval $setvar
14197 val=$val2; set i_sgtty; eval $setvar
14198 val=$val3; set i_termios; eval $setvar
14199
14200 : see if this is a shadow.h system
14201 set shadow.h i_shadow
14202 eval $inhdr
14203
14204 : see if this is a socks.h system
14205 set socks.h i_socks
14206 eval $inhdr
14207
14208 : see if stdarg is available
14209 echo " "
14210 if $test `./findhdr stdarg.h`; then
14211         echo "<stdarg.h> found." >&4
14212         valstd="$define"
14213 else
14214         echo "<stdarg.h> NOT found." >&4
14215         valstd="$undef"
14216 fi
14217
14218 : see if varags is available
14219 echo " "
14220 if $test `./findhdr varargs.h`; then
14221         echo "<varargs.h> found." >&4
14222 else
14223         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14224 fi
14225
14226 : set up the varargs testing programs
14227 $cat > varargs.c <<EOP
14228 #ifdef I_STDARG
14229 #include <stdarg.h>
14230 #endif
14231 #ifdef I_VARARGS
14232 #include <varargs.h>
14233 #endif
14234
14235 #ifdef I_STDARG
14236 int f(char *p, ...)
14237 #else
14238 int f(va_alist)
14239 va_dcl
14240 #endif
14241 {
14242         va_list ap;
14243 #ifndef I_STDARG
14244         char *p;
14245 #endif
14246 #ifdef I_STDARG
14247         va_start(ap,p);
14248 #else
14249         va_start(ap);
14250         p = va_arg(ap, char *);
14251 #endif
14252         va_end(ap);
14253 }
14254 EOP
14255 $cat > varargs <<EOP
14256 $startsh
14257 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14258         echo "true"
14259 else
14260         echo "false"
14261 fi
14262 $rm -f varargs$_o
14263 EOP
14264 chmod +x varargs
14265
14266 : now check which varargs header should be included
14267 echo " "
14268 i_varhdr=''
14269 case "$valstd" in
14270 "$define")
14271         if `./varargs I_STDARG`; then
14272                 val='stdarg.h'
14273         elif `./varargs I_VARARGS`; then
14274                 val='varargs.h'
14275         fi
14276         ;;
14277 *)
14278         if `./varargs I_VARARGS`; then
14279                 val='varargs.h'
14280         fi
14281         ;;
14282 esac
14283 case "$val" in
14284 '')
14285 echo "I could not find the definition for va_dcl... You have problems..." >&4
14286         val="$undef"; set i_stdarg; eval $setvar
14287         val="$undef"; set i_varargs; eval $setvar
14288         ;;
14289 *) 
14290         set i_varhdr
14291         eval $setvar
14292         case "$i_varhdr" in
14293         stdarg.h)
14294                 val="$define"; set i_stdarg; eval $setvar
14295                 val="$undef"; set i_varargs; eval $setvar
14296                 ;;
14297         varargs.h)
14298                 val="$undef"; set i_stdarg; eval $setvar
14299                 val="$define"; set i_varargs; eval $setvar
14300                 ;;
14301         esac
14302         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14303 esac
14304 $rm -f varargs*
14305
14306 : see if stddef is available
14307 set stddef.h i_stddef
14308 eval $inhdr
14309
14310 : see if sys/access.h is available
14311 set sys/access.h i_sysaccess
14312 eval $inhdr
14313
14314 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14315 set sys/filio.h i_sysfilio
14316 eval $inhdr
14317 echo " "
14318 if $test `./findhdr sys/ioctl.h`; then
14319         val="$define"
14320         echo '<sys/ioctl.h> found.' >&4
14321 else
14322         val="$undef"
14323         if $test $i_sysfilio = "$define"; then
14324             echo '<sys/ioctl.h> NOT found.' >&4
14325         else
14326                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14327                 $test $i_termio = "$define" && xxx="termio.h"
14328                 $test $i_termios = "$define" && xxx="termios.h"
14329 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14330         fi
14331 fi
14332 set i_sysioctl
14333 eval $setvar
14334
14335
14336 : see if this is a syslog.h system
14337 set syslog.h i_syslog
14338 eval $inhdr
14339
14340
14341 : see if this is a sys/mode.h system
14342 set sys/mode.h i_sysmode
14343 eval $inhdr
14344
14345 : see if sys/resource.h has to be included
14346 set sys/resource.h i_sysresrc
14347 eval $inhdr
14348
14349 : see if sys/security.h is available
14350 set sys/security.h i_syssecrt
14351 eval $inhdr
14352
14353 : see if this is a sys/statvfs.h system
14354 set sys/statvfs.h i_sysstatvfs
14355 eval $inhdr
14356
14357 : see if this is a sys/uio.h system
14358 set sys/uio.h i_sysuio
14359 eval $inhdr
14360
14361 : see if this is a sys/un.h system
14362 set sys/un.h i_sysun
14363 eval $inhdr
14364
14365
14366 : see if this is a sys/utsname.h system
14367 set sys/utsname.h i_sysutsname
14368 eval $inhdr
14369
14370 : see if this is a syswait system
14371 set sys/wait.h i_syswait
14372 eval $inhdr
14373
14374 : see if this is a ustat.h system
14375 set ustat.h i_ustat
14376 eval $inhdr
14377
14378 : see if this is an utime system
14379 set utime.h i_utime
14380 eval $inhdr
14381
14382 : see if this is a values.h system
14383 set values.h i_values
14384 eval $inhdr
14385
14386 : see if this is a vfork system
14387 case "$d_vfork" in
14388 "$define")
14389         set vfork.h i_vfork
14390         eval $inhdr
14391         ;;
14392 *)
14393         i_vfork="$undef"
14394         ;;
14395 esac
14396
14397 : see if gdbm.h is available
14398 set gdbm.h t_gdbm
14399 eval $inhdr
14400 case "$t_gdbm" in
14401 $define)
14402         : see if gdbm_open exists
14403         set gdbm_open d_gdbm_open
14404         eval $inlibc
14405         case "$d_gdbm_open" in
14406         $undef)
14407                 t_gdbm="$undef"
14408                 echo "We won't be including <gdbm.h>"
14409                 ;;
14410         esac
14411         ;;
14412 esac
14413 val="$t_gdbm"
14414 set i_gdbm
14415 eval $setvar
14416
14417 echo " "
14418 echo "Looking for extensions..." >&4
14419 : If we are using the old config.sh, known_extensions may contain
14420 : old or inaccurate or duplicate values.
14421 known_extensions=''
14422 nonxs_extensions=''
14423 : We do not use find because it might not be available.
14424 : We do not just use MANIFEST because the user may have dropped
14425 : some additional extensions into the source tree and expect them
14426 : to be built.
14427
14428 : Function to recursively find available extensions, ignoring DynaLoader
14429 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14430 find_extensions='
14431     for xxx in *; do
14432        case "$xxx" in
14433            DynaLoader|dynaload) ;;
14434            *)
14435            if $test -f $xxx/$xxx.xs; then
14436                known_extensions="$known_extensions $1$xxx";
14437            elif $test -f $xxx/Makefile.PL; then
14438                nonxs_extensions="$nonxs_extensions $1$xxx";
14439            else
14440                if $test -d $xxx -a $# -lt 10; then
14441                    set $1$xxx/ $*;
14442                    cd $xxx;
14443                    eval $find_extensions;
14444                    cd ..;
14445                    shift;
14446                fi;
14447            fi
14448            ;;
14449        esac;
14450     done'
14451 tdir=`pwd`
14452 cd $rsrc/ext
14453 set X
14454 shift
14455 eval $find_extensions
14456 set X $nonxs_extensions
14457 shift
14458 nonxs_extensions="$*"
14459 set X $known_extensions
14460 shift
14461 known_extensions="$*"
14462 cd $tdir
14463
14464 : Now see which are supported on this system.
14465 avail_ext=''
14466 for xxx in $known_extensions ; do
14467         case "$xxx" in
14468         DB_File|db_file)
14469                 case "$i_db" in
14470                 $define) avail_ext="$avail_ext $xxx" ;;
14471                 esac
14472                 ;;
14473         GDBM_File|gdbm_fil)
14474                 case "$i_gdbm" in 
14475                 $define) avail_ext="$avail_ext $xxx" ;;
14476                 esac
14477                 ;;
14478         NDBM_File|ndbm_fil)
14479                 case "$i_ndbm" in
14480                 $define)
14481                     case "$osname-$use64bitint" in
14482                     hpux-define)
14483                         case "$libs" in
14484                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14485                         esac
14486                         ;;
14487                     *) avail_ext="$avail_ext $xxx" ;;
14488                     esac
14489                     ;;
14490                 esac
14491                 ;;
14492         ODBM_File|odbm_fil) 
14493                 case "${i_dbm}${i_rpcsvcdbm}" in
14494                 *"${define}"*)
14495                     case "$osname-$use64bitint" in
14496                     hpux-define)
14497                         case "$libs" in
14498                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14499                         esac
14500                         ;;
14501                     *) avail_ext="$avail_ext $xxx" ;;
14502                     esac
14503                     ;;
14504                 esac
14505                 ;;
14506         POSIX|posix)
14507                 case "$useposix" in
14508                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14509                 esac
14510                 ;;
14511         Opcode|opcode)
14512                 case "$useopcode" in
14513                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14514                 esac
14515                 ;;
14516         Socket|socket)
14517                 case "$d_socket" in 
14518                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14519                 esac
14520                 ;;
14521         Thread|thread)
14522                 case "$usethreads" in 
14523                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14524                 esac
14525                 ;;
14526         IPC/SysV|ipc/sysv)
14527                 : XXX Do we need a useipcsysv variable here
14528                 case "${d_msg}${d_sem}${d_shm}" in 
14529                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14530                 esac
14531                 ;;
14532         *)      avail_ext="$avail_ext $xxx"
14533                 ;;
14534         esac
14535 done
14536
14537 set X $avail_ext
14538 shift
14539 avail_ext="$*"
14540
14541 : Now see which nonxs extensions are supported on this system.
14542 : For now assume all are.
14543 nonxs_ext=''
14544 for xxx in $nonxs_extensions ; do
14545         case "$xxx" in
14546         *)      nonxs_ext="$nonxs_ext $xxx"
14547                 ;;
14548         esac
14549 done
14550
14551 set X $nonxs_ext
14552 shift
14553 nonxs_ext="$*"
14554
14555 case $usedl in
14556 $define)
14557         $cat <<EOM
14558 A number of extensions are supplied with $package.  You may choose to
14559 compile these extensions for dynamic loading (the default), compile
14560 them into the $package executable (static loading), or not include
14561 them at all.  Answer "none" to include no extensions.
14562 Note that DynaLoader is always built and need not be mentioned here.
14563
14564 EOM
14565         case "$dynamic_ext" in
14566         '') dflt="$avail_ext" ;;
14567         *)      dflt="$dynamic_ext"
14568                 # Perhaps we are reusing an old out-of-date config.sh.
14569                 case "$hint" in
14570                 previous)
14571                         if test X"$dynamic_ext" != X"$avail_ext"; then
14572                                 $cat <<EOM
14573 NOTICE:  Your previous config.sh list may be incorrect. 
14574 The extensions now available to you are 
14575         ${avail_ext}
14576 but the default list from your previous config.sh is
14577         ${dynamic_ext} 
14578
14579 EOM
14580                         fi
14581                         ;;
14582                 esac
14583                 ;;
14584         esac
14585         case "$dflt" in
14586         '')     dflt=none;;
14587         esac
14588         rp="What extensions do you wish to load dynamically?"
14589         . ./myread
14590         case "$ans" in
14591         none) dynamic_ext=' ' ;;
14592         *) dynamic_ext="$ans" ;;
14593         esac
14594
14595         case "$static_ext" in
14596         '')
14597                 : Exclude those already listed in dynamic linking
14598                 dflt=''
14599                 for xxx in $avail_ext; do
14600                         case " $dynamic_ext " in
14601                         *" $xxx "*) ;;
14602                         *) dflt="$dflt $xxx" ;;
14603                         esac
14604                 done
14605                 set X $dflt
14606                 shift
14607                 dflt="$*"
14608                 ;;
14609         *)  dflt="$static_ext" 
14610                 ;;
14611         esac
14612
14613         case "$dflt" in
14614         '')     dflt=none;;
14615         esac
14616         rp="What extensions do you wish to load statically?"
14617         . ./myread
14618         case "$ans" in
14619         none) static_ext=' ' ;;
14620         *) static_ext="$ans" ;;
14621         esac
14622         ;;
14623 *)
14624         $cat <<EOM
14625 A number of extensions are supplied with $package.  Answer "none" 
14626 to include no extensions. 
14627 Note that DynaLoader is always built and need not be mentioned here.
14628
14629 EOM
14630         case "$static_ext" in
14631         '') dflt="$avail_ext" ;;
14632         *)      dflt="$static_ext"
14633                 # Perhaps we are reusing an old out-of-date config.sh.
14634                 case "$hint" in
14635                 previous)
14636                         if test X"$static_ext" != X"$avail_ext"; then
14637                                 $cat <<EOM
14638 NOTICE:  Your previous config.sh list may be incorrect. 
14639 The extensions now available to you are 
14640         ${avail_ext}
14641 but the default list from your previous config.sh is
14642         ${static_ext} 
14643
14644 EOM
14645                         fi
14646                         ;;
14647                 esac
14648                 ;;
14649         esac
14650         : Exclude those that are not xs extensions
14651         case "$dflt" in
14652         '')     dflt=none;;
14653         esac
14654         rp="What extensions do you wish to include?"
14655         . ./myread
14656         case "$ans" in
14657         none) static_ext=' ' ;;
14658         *) static_ext="$ans" ;;
14659         esac
14660         ;;
14661 esac
14662
14663 set X $dynamic_ext $static_ext $nonxs_ext
14664 shift
14665 extensions="$*"
14666
14667 : Remove build directory name from cppstdin so it can be used from
14668 : either the present location or the final installed location.
14669 echo " "
14670 : Get out of the UU directory to get correct path name.
14671 cd ..
14672 case "$cppstdin" in
14673 `pwd`/cppstdin)
14674         echo "Stripping down cppstdin path name"
14675         cppstdin=cppstdin
14676         ;;
14677 esac
14678 cd UU
14679
14680 : end of configuration questions
14681 echo " "
14682 echo "End of configuration questions."
14683 echo " "
14684
14685 : back to where it started
14686 if test -d ../UU; then
14687         cd ..
14688 fi
14689
14690 : configuration may be patched via a 'config.over' file
14691 if $test -f config.over; then
14692         echo " "
14693         dflt=y
14694         rp='I see a config.over file.  Do you wish to load it?'
14695         . UU/myread
14696         case "$ans" in
14697         n*) echo "OK, I'll ignore it.";;
14698         *)      . ./config.over
14699                 echo "Configuration override changes have been loaded."
14700                 ;;
14701         esac
14702 fi
14703
14704 : in case they want portability, strip down executable paths
14705 case "$d_portable" in
14706 "$define")
14707         echo " "
14708         echo "Stripping down executable paths..." >&4
14709         for file in $loclist $trylist; do
14710                 eval temp=\$$file
14711                 eval $file=`basename $temp`
14712         done
14713         ;;
14714 esac
14715
14716 : create config.sh file
14717 echo " "
14718 echo "Creating config.sh..." >&4
14719 $spitshell <<EOT >config.sh
14720 $startsh
14721 #
14722 # This file was produced by running the Configure script. It holds all the
14723 # definitions figured out by Configure. Should you modify one of these values,
14724 # do not forget to propagate your changes by running "Configure -der". You may
14725 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14726 #
14727
14728 # Package name      : $package
14729 # Source directory  : $src
14730 # Configuration time: $cf_time
14731 # Configured by     : $cf_by
14732 # Target system     : $myuname
14733
14734 Author='$Author'
14735 Date='$Date'
14736 Header='$Header'
14737 Id='$Id'
14738 Locker='$Locker'
14739 Log='$Log'
14740 Mcc='$Mcc'
14741 RCSfile='$RCSfile'
14742 Revision='$Revision'
14743 Source='$Source'
14744 State='$State'
14745 _a='$_a'
14746 _exe='$_exe'
14747 _o='$_o'
14748 afs='$afs'
14749 alignbytes='$alignbytes'
14750 ansi2knr='$ansi2knr'
14751 aphostname='$aphostname'
14752 api_revision='$api_revision'
14753 api_subversion='$api_subversion'
14754 api_version='$api_version'
14755 api_versionstring='$api_versionstring'
14756 ar='$ar'
14757 archlib='$archlib'
14758 archlibexp='$archlibexp'
14759 archname64='$archname64'
14760 archname='$archname'
14761 archobjs='$archobjs'
14762 awk='$awk'
14763 baserev='$baserev'
14764 bash='$bash'
14765 bin='$bin'
14766 bincompat5005='$bincompat5005'
14767 binexp='$binexp'
14768 bison='$bison'
14769 byacc='$byacc'
14770 byteorder='$byteorder'
14771 c='$c'
14772 castflags='$castflags'
14773 cat='$cat'
14774 cc='$cc'
14775 cccdlflags='$cccdlflags'
14776 ccdlflags='$ccdlflags'
14777 ccflags='$ccflags'
14778 ccsymbols='$ccsymbols'
14779 cf_by='$cf_by'
14780 cf_email='$cf_email'
14781 cf_time='$cf_time'
14782 charsize='$charsize'
14783 chgrp='$chgrp'
14784 chmod='$chmod'
14785 chown='$chown'
14786 clocktype='$clocktype'
14787 comm='$comm'
14788 compress='$compress'
14789 contains='$contains'
14790 cp='$cp'
14791 cpio='$cpio'
14792 cpp='$cpp'
14793 cpp_stuff='$cpp_stuff'
14794 cppccsymbols='$cppccsymbols'
14795 cppflags='$cppflags'
14796 cpplast='$cpplast'
14797 cppminus='$cppminus'
14798 cpprun='$cpprun'
14799 cppstdin='$cppstdin'
14800 cppsymbols='$cppsymbols'
14801 crosscompile='$crosscompile'
14802 cryptlib='$cryptlib'
14803 csh='$csh'
14804 d_Gconvert='$d_Gconvert'
14805 d_PRIEldbl='$d_PRIEldbl'
14806 d_PRIFldbl='$d_PRIFldbl'
14807 d_PRIGldbl='$d_PRIGldbl'
14808 d_PRIX64='$d_PRIX64'
14809 d_PRId64='$d_PRId64'
14810 d_PRIeldbl='$d_PRIeldbl'
14811 d_PRIfldbl='$d_PRIfldbl'
14812 d_PRIgldbl='$d_PRIgldbl'
14813 d_PRIi64='$d_PRIi64'
14814 d_PRIo64='$d_PRIo64'
14815 d_PRIu64='$d_PRIu64'
14816 d_PRIx64='$d_PRIx64'
14817 d_access='$d_access'
14818 d_accessx='$d_accessx'
14819 d_alarm='$d_alarm'
14820 d_archlib='$d_archlib'
14821 d_atolf='$d_atolf'
14822 d_atoll='$d_atoll'
14823 d_attribut='$d_attribut'
14824 d_bcmp='$d_bcmp'
14825 d_bcopy='$d_bcopy'
14826 d_bincompat5005='$d_bincompat5005'
14827 d_bsd='$d_bsd'
14828 d_bsdgetpgrp='$d_bsdgetpgrp'
14829 d_bsdsetpgrp='$d_bsdsetpgrp'
14830 d_bzero='$d_bzero'
14831 d_casti32='$d_casti32'
14832 d_castneg='$d_castneg'
14833 d_charvspr='$d_charvspr'
14834 d_chown='$d_chown'
14835 d_chroot='$d_chroot'
14836 d_chsize='$d_chsize'
14837 d_closedir='$d_closedir'
14838 d_const='$d_const'
14839 d_crypt='$d_crypt'
14840 d_csh='$d_csh'
14841 d_cuserid='$d_cuserid'
14842 d_dbl_dig='$d_dbl_dig'
14843 d_difftime='$d_difftime'
14844 d_dirnamlen='$d_dirnamlen'
14845 d_dlerror='$d_dlerror'
14846 d_dlopen='$d_dlopen'
14847 d_dlsymun='$d_dlsymun'
14848 d_dosuid='$d_dosuid'
14849 d_drand48proto='$d_drand48proto'
14850 d_dup2='$d_dup2'
14851 d_eaccess='$d_eaccess'
14852 d_endgrent='$d_endgrent'
14853 d_endhent='$d_endhent'
14854 d_endnent='$d_endnent'
14855 d_endpent='$d_endpent'
14856 d_endpwent='$d_endpwent'
14857 d_endsent='$d_endsent'
14858 d_endspent='$d_endspent'
14859 d_eofnblk='$d_eofnblk'
14860 d_eunice='$d_eunice'
14861 d_fchmod='$d_fchmod'
14862 d_fchown='$d_fchown'
14863 d_fcntl='$d_fcntl'
14864 d_fd_macros='$d_fd_macros'
14865 d_fd_set='$d_fd_set'
14866 d_fds_bits='$d_fds_bits'
14867 d_fgetpos='$d_fgetpos'
14868 d_flexfnam='$d_flexfnam'
14869 d_flock='$d_flock'
14870 d_fork='$d_fork'
14871 d_fpathconf='$d_fpathconf'
14872 d_fpos64_t='$d_fpos64_t'
14873 d_fs_data_s='$d_fs_data_s'
14874 d_fseeko='$d_fseeko'
14875 d_fsetpos='$d_fsetpos'
14876 d_fstatfs='$d_fstatfs'
14877 d_fstatvfs='$d_fstatvfs'
14878 d_ftello='$d_ftello'
14879 d_ftime='$d_ftime'
14880 d_getcwd='$d_getcwd'
14881 d_getfsstat='$d_getfsstat'
14882 d_getgrent='$d_getgrent'
14883 d_getgrps='$d_getgrps'
14884 d_gethbyaddr='$d_gethbyaddr'
14885 d_gethbyname='$d_gethbyname'
14886 d_gethent='$d_gethent'
14887 d_gethname='$d_gethname'
14888 d_gethostprotos='$d_gethostprotos'
14889 d_getlogin='$d_getlogin'
14890 d_getmnt='$d_getmnt'
14891 d_getmntent='$d_getmntent'
14892 d_getnbyaddr='$d_getnbyaddr'
14893 d_getnbyname='$d_getnbyname'
14894 d_getnent='$d_getnent'
14895 d_getnetprotos='$d_getnetprotos'
14896 d_getpbyname='$d_getpbyname'
14897 d_getpbynumber='$d_getpbynumber'
14898 d_getpent='$d_getpent'
14899 d_getpgid='$d_getpgid'
14900 d_getpgrp2='$d_getpgrp2'
14901 d_getpgrp='$d_getpgrp'
14902 d_getppid='$d_getppid'
14903 d_getprior='$d_getprior'
14904 d_getprotoprotos='$d_getprotoprotos'
14905 d_getpwent='$d_getpwent'
14906 d_getsbyname='$d_getsbyname'
14907 d_getsbyport='$d_getsbyport'
14908 d_getsent='$d_getsent'
14909 d_getservprotos='$d_getservprotos'
14910 d_getspent='$d_getspent'
14911 d_getspnam='$d_getspnam'
14912 d_gettimeod='$d_gettimeod'
14913 d_gnulibc='$d_gnulibc'
14914 d_grpasswd='$d_grpasswd'
14915 d_hasmntopt='$d_hasmntopt'
14916 d_htonl='$d_htonl'
14917 d_iconv='$d_iconv'
14918 d_index='$d_index'
14919 d_inetaton='$d_inetaton'
14920 d_int64_t='$d_int64_t'
14921 d_isascii='$d_isascii'
14922 d_killpg='$d_killpg'
14923 d_lchown='$d_lchown'
14924 d_ldbl_dig='$d_ldbl_dig'
14925 d_link='$d_link'
14926 d_locconv='$d_locconv'
14927 d_lockf='$d_lockf'
14928 d_longdbl='$d_longdbl'
14929 d_longlong='$d_longlong'
14930 d_lseekproto='$d_lseekproto'
14931 d_lstat='$d_lstat'
14932 d_mblen='$d_mblen'
14933 d_mbstowcs='$d_mbstowcs'
14934 d_mbtowc='$d_mbtowc'
14935 d_memchr='$d_memchr'
14936 d_memcmp='$d_memcmp'
14937 d_memcpy='$d_memcpy'
14938 d_memmove='$d_memmove'
14939 d_memset='$d_memset'
14940 d_mkdir='$d_mkdir'
14941 d_mkdtemp='$d_mkdtemp'
14942 d_mkfifo='$d_mkfifo'
14943 d_mkstemp='$d_mkstemp'
14944 d_mkstemps='$d_mkstemps'
14945 d_mktime='$d_mktime'
14946 d_mmap='$d_mmap'
14947 d_mprotect='$d_mprotect'
14948 d_msg='$d_msg'
14949 d_msg_ctrunc='$d_msg_ctrunc'
14950 d_msg_dontroute='$d_msg_dontroute'
14951 d_msg_oob='$d_msg_oob'
14952 d_msg_peek='$d_msg_peek'
14953 d_msg_proxy='$d_msg_proxy'
14954 d_msgctl='$d_msgctl'
14955 d_msgget='$d_msgget'
14956 d_msgrcv='$d_msgrcv'
14957 d_msgsnd='$d_msgsnd'
14958 d_msync='$d_msync'
14959 d_munmap='$d_munmap'
14960 d_mymalloc='$d_mymalloc'
14961 d_nice='$d_nice'
14962 d_nv_preserves_uv='$d_nv_preserves_uv'
14963 d_off64_t='$d_off64_t'
14964 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14965 d_oldpthreads='$d_oldpthreads'
14966 d_oldsock='$d_oldsock'
14967 d_open3='$d_open3'
14968 d_pathconf='$d_pathconf'
14969 d_pause='$d_pause'
14970 d_phostname='$d_phostname'
14971 d_pipe='$d_pipe'
14972 d_poll='$d_poll'
14973 d_portable='$d_portable'
14974 d_pthread_yield='$d_pthread_yield'
14975 d_pwage='$d_pwage'
14976 d_pwchange='$d_pwchange'
14977 d_pwclass='$d_pwclass'
14978 d_pwcomment='$d_pwcomment'
14979 d_pwexpire='$d_pwexpire'
14980 d_pwgecos='$d_pwgecos'
14981 d_pwpasswd='$d_pwpasswd'
14982 d_pwquota='$d_pwquota'
14983 d_quad='$d_quad'
14984 d_readdir='$d_readdir'
14985 d_readlink='$d_readlink'
14986 d_rename='$d_rename'
14987 d_rewinddir='$d_rewinddir'
14988 d_rmdir='$d_rmdir'
14989 d_safebcpy='$d_safebcpy'
14990 d_safemcpy='$d_safemcpy'
14991 d_sanemcmp='$d_sanemcmp'
14992 d_sched_yield='$d_sched_yield'
14993 d_scm_rights='$d_scm_rights'
14994 d_seekdir='$d_seekdir'
14995 d_select='$d_select'
14996 d_sem='$d_sem'
14997 d_semctl='$d_semctl'
14998 d_semctl_semid_ds='$d_semctl_semid_ds'
14999 d_semctl_semun='$d_semctl_semun'
15000 d_semget='$d_semget'
15001 d_semop='$d_semop'
15002 d_setegid='$d_setegid'
15003 d_seteuid='$d_seteuid'
15004 d_setgrent='$d_setgrent'
15005 d_setgrps='$d_setgrps'
15006 d_sethent='$d_sethent'
15007 d_setlinebuf='$d_setlinebuf'
15008 d_setlocale='$d_setlocale'
15009 d_setnent='$d_setnent'
15010 d_setpent='$d_setpent'
15011 d_setpgid='$d_setpgid'
15012 d_setpgrp2='$d_setpgrp2'
15013 d_setpgrp='$d_setpgrp'
15014 d_setprior='$d_setprior'
15015 d_setpwent='$d_setpwent'
15016 d_setregid='$d_setregid'
15017 d_setresgid='$d_setresgid'
15018 d_setresuid='$d_setresuid'
15019 d_setreuid='$d_setreuid'
15020 d_setrgid='$d_setrgid'
15021 d_setruid='$d_setruid'
15022 d_setsent='$d_setsent'
15023 d_setsid='$d_setsid'
15024 d_setspent='$d_setspent'
15025 d_setvbuf='$d_setvbuf'
15026 d_sfio='$d_sfio'
15027 d_shm='$d_shm'
15028 d_shmat='$d_shmat'
15029 d_shmatprototype='$d_shmatprototype'
15030 d_shmctl='$d_shmctl'
15031 d_shmdt='$d_shmdt'
15032 d_shmget='$d_shmget'
15033 d_sigaction='$d_sigaction'
15034 d_sigsetjmp='$d_sigsetjmp'
15035 d_socket='$d_socket'
15036 d_socklen_t='$d_socklen_t'
15037 d_sockpair='$d_sockpair'
15038 d_sqrtl='$d_sqrtl'
15039 d_statblks='$d_statblks'
15040 d_statfs_f_flags='$d_statfs_f_flags'
15041 d_statfs_s='$d_statfs_s'
15042 d_statvfs='$d_statvfs'
15043 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15044 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15045 d_stdio_stream_array='$d_stdio_stream_array'
15046 d_stdiobase='$d_stdiobase'
15047 d_stdstdio='$d_stdstdio'
15048 d_strchr='$d_strchr'
15049 d_strcoll='$d_strcoll'
15050 d_strctcpy='$d_strctcpy'
15051 d_strerrm='$d_strerrm'
15052 d_strerror='$d_strerror'
15053 d_strtod='$d_strtod'
15054 d_strtol='$d_strtol'
15055 d_strtold='$d_strtold'
15056 d_strtoll='$d_strtoll'
15057 d_strtoul='$d_strtoul'
15058 d_strtoull='$d_strtoull'
15059 d_strtouq='$d_strtouq'
15060 d_strxfrm='$d_strxfrm'
15061 d_suidsafe='$d_suidsafe'
15062 d_symlink='$d_symlink'
15063 d_syscall='$d_syscall'
15064 d_sysconf='$d_sysconf'
15065 d_sysernlst='$d_sysernlst'
15066 d_syserrlst='$d_syserrlst'
15067 d_system='$d_system'
15068 d_tcgetpgrp='$d_tcgetpgrp'
15069 d_tcsetpgrp='$d_tcsetpgrp'
15070 d_telldir='$d_telldir'
15071 d_telldirproto='$d_telldirproto'
15072 d_time='$d_time'
15073 d_times='$d_times'
15074 d_truncate='$d_truncate'
15075 d_tzname='$d_tzname'
15076 d_umask='$d_umask'
15077 d_uname='$d_uname'
15078 d_union_semun='$d_union_semun'
15079 d_ustat='$d_ustat'
15080 d_vendorbin='$d_vendorbin'
15081 d_vendorlib='$d_vendorlib'
15082 d_vfork='$d_vfork'
15083 d_void_closedir='$d_void_closedir'
15084 d_voidsig='$d_voidsig'
15085 d_voidtty='$d_voidtty'
15086 d_volatile='$d_volatile'
15087 d_vprintf='$d_vprintf'
15088 d_wait4='$d_wait4'
15089 d_waitpid='$d_waitpid'
15090 d_wcstombs='$d_wcstombs'
15091 d_wctomb='$d_wctomb'
15092 d_xenix='$d_xenix'
15093 date='$date'
15094 db_hashtype='$db_hashtype'
15095 db_prefixtype='$db_prefixtype'
15096 defvoidused='$defvoidused'
15097 direntrytype='$direntrytype'
15098 dlext='$dlext'
15099 dlsrc='$dlsrc'
15100 doublesize='$doublesize'
15101 drand01='$drand01'
15102 dynamic_ext='$dynamic_ext'
15103 eagain='$eagain'
15104 ebcdic='$ebcdic'
15105 echo='$echo'
15106 egrep='$egrep'
15107 emacs='$emacs'
15108 eunicefix='$eunicefix'
15109 exe_ext='$exe_ext'
15110 expr='$expr'
15111 extensions='$extensions'
15112 fflushNULL='$fflushNULL'
15113 fflushall='$fflushall'
15114 find='$find'
15115 firstmakefile='$firstmakefile'
15116 flex='$flex'
15117 fpossize='$fpossize'
15118 fpostype='$fpostype'
15119 freetype='$freetype'
15120 full_ar='$full_ar'
15121 full_csh='$full_csh'
15122 full_sed='$full_sed'
15123 gccversion='$gccversion'
15124 gidformat='$gidformat'
15125 gidsign='$gidsign'
15126 gidsize='$gidsize'
15127 gidtype='$gidtype'
15128 glibpth='$glibpth'
15129 grep='$grep'
15130 groupcat='$groupcat'
15131 groupstype='$groupstype'
15132 gzip='$gzip'
15133 h_fcntl='$h_fcntl'
15134 h_sysfile='$h_sysfile'
15135 hint='$hint'
15136 hostcat='$hostcat'
15137 huge='$huge'
15138 i16size='$i16size'
15139 i16type='$i16type'
15140 i32size='$i32size'
15141 i32type='$i32type'
15142 i64size='$i64size'
15143 i64type='$i64type'
15144 i8size='$i8size'
15145 i8type='$i8type'
15146 i_arpainet='$i_arpainet'
15147 i_bsdioctl='$i_bsdioctl'
15148 i_db='$i_db'
15149 i_dbm='$i_dbm'
15150 i_dirent='$i_dirent'
15151 i_dld='$i_dld'
15152 i_dlfcn='$i_dlfcn'
15153 i_fcntl='$i_fcntl'
15154 i_float='$i_float'
15155 i_gdbm='$i_gdbm'
15156 i_grp='$i_grp'
15157 i_iconv='$i_iconv'
15158 i_inttypes='$i_inttypes'
15159 i_limits='$i_limits'
15160 i_locale='$i_locale'
15161 i_machcthr='$i_machcthr'
15162 i_malloc='$i_malloc'
15163 i_math='$i_math'
15164 i_memory='$i_memory'
15165 i_mntent='$i_mntent'
15166 i_ndbm='$i_ndbm'
15167 i_netdb='$i_netdb'
15168 i_neterrno='$i_neterrno'
15169 i_netinettcp='$i_netinettcp'
15170 i_niin='$i_niin'
15171 i_poll='$i_poll'
15172 i_pthread='$i_pthread'
15173 i_pwd='$i_pwd'
15174 i_rpcsvcdbm='$i_rpcsvcdbm'
15175 i_sfio='$i_sfio'
15176 i_sgtty='$i_sgtty'
15177 i_shadow='$i_shadow'
15178 i_socks='$i_socks'
15179 i_stdarg='$i_stdarg'
15180 i_stddef='$i_stddef'
15181 i_stdlib='$i_stdlib'
15182 i_string='$i_string'
15183 i_sysaccess='$i_sysaccess'
15184 i_sysdir='$i_sysdir'
15185 i_sysfile='$i_sysfile'
15186 i_sysfilio='$i_sysfilio'
15187 i_sysin='$i_sysin'
15188 i_sysioctl='$i_sysioctl'
15189 i_syslog='$i_syslog'
15190 i_sysmman='$i_sysmman'
15191 i_sysmode='$i_sysmode'
15192 i_sysmount='$i_sysmount'
15193 i_sysndir='$i_sysndir'
15194 i_sysparam='$i_sysparam'
15195 i_sysresrc='$i_sysresrc'
15196 i_syssecrt='$i_syssecrt'
15197 i_sysselct='$i_sysselct'
15198 i_syssockio='$i_syssockio'
15199 i_sysstat='$i_sysstat'
15200 i_sysstatfs='$i_sysstatfs'
15201 i_sysstatvfs='$i_sysstatvfs'
15202 i_systime='$i_systime'
15203 i_systimek='$i_systimek'
15204 i_systimes='$i_systimes'
15205 i_systypes='$i_systypes'
15206 i_sysuio='$i_sysuio'
15207 i_sysun='$i_sysun'
15208 i_sysutsname='$i_sysutsname'
15209 i_sysvfs='$i_sysvfs'
15210 i_syswait='$i_syswait'
15211 i_termio='$i_termio'
15212 i_termios='$i_termios'
15213 i_time='$i_time'
15214 i_unistd='$i_unistd'
15215 i_ustat='$i_ustat'
15216 i_utime='$i_utime'
15217 i_values='$i_values'
15218 i_varargs='$i_varargs'
15219 i_varhdr='$i_varhdr'
15220 i_vfork='$i_vfork'
15221 ignore_versioned_solibs='$ignore_versioned_solibs'
15222 inc_version_list='$inc_version_list'
15223 inc_version_list_init='$inc_version_list_init'
15224 incpath='$incpath'
15225 inews='$inews'
15226 installarchlib='$installarchlib'
15227 installbin='$installbin'
15228 installman1dir='$installman1dir'
15229 installman3dir='$installman3dir'
15230 installprefix='$installprefix'
15231 installprefixexp='$installprefixexp'
15232 installprivlib='$installprivlib'
15233 installscript='$installscript'
15234 installsitearch='$installsitearch'
15235 installsitebin='$installsitebin'
15236 installsitelib='$installsitelib'
15237 installstyle='$installstyle'
15238 installusrbinperl='$installusrbinperl'
15239 installvendorbin='$installvendorbin'
15240 installvendorlib='$installvendorlib'
15241 intsize='$intsize'
15242 ivdformat='$ivdformat'
15243 ivsize='$ivsize'
15244 ivtype='$ivtype'
15245 known_extensions='$known_extensions'
15246 ksh='$ksh'
15247 large='$large'
15248 ld='$ld'
15249 lddlflags='$lddlflags'
15250 ldflags='$ldflags'
15251 ldlibpthname='$ldlibpthname'
15252 less='$less'
15253 lib_ext='$lib_ext'
15254 libc='$libc'
15255 libperl='$libperl'
15256 libpth='$libpth'
15257 libs='$libs'
15258 libsdirs='$libsdirs'
15259 libsfiles='$libsfiles'
15260 libsfound='$libsfound'
15261 libspath='$libspath'
15262 libswanted='$libswanted'
15263 line='$line'
15264 lint='$lint'
15265 lkflags='$lkflags'
15266 ln='$ln'
15267 lns='$lns'
15268 locincpth='$locincpth'
15269 loclibpth='$loclibpth'
15270 longdblsize='$longdblsize'
15271 longlongsize='$longlongsize'
15272 longsize='$longsize'
15273 lp='$lp'
15274 lpr='$lpr'
15275 ls='$ls'
15276 lseeksize='$lseeksize'
15277 lseektype='$lseektype'
15278 mail='$mail'
15279 mailx='$mailx'
15280 make='$make'
15281 make_set_make='$make_set_make'
15282 mallocobj='$mallocobj'
15283 mallocsrc='$mallocsrc'
15284 malloctype='$malloctype'
15285 man1dir='$man1dir'
15286 man1direxp='$man1direxp'
15287 man1ext='$man1ext'
15288 man3dir='$man3dir'
15289 man3direxp='$man3direxp'
15290 man3ext='$man3ext'
15291 medium='$medium'
15292 mips_type='$mips_type'
15293 mkdir='$mkdir'
15294 mmaptype='$mmaptype'
15295 models='$models'
15296 modetype='$modetype'
15297 more='$more'
15298 multiarch='$multiarch'
15299 mv='$mv'
15300 myarchname='$myarchname'
15301 mydomain='$mydomain'
15302 myhostname='$myhostname'
15303 myuname='$myuname'
15304 n='$n'
15305 netdb_hlen_type='$netdb_hlen_type'
15306 netdb_host_type='$netdb_host_type'
15307 netdb_name_type='$netdb_name_type'
15308 netdb_net_type='$netdb_net_type'
15309 nm='$nm'
15310 nm_opt='$nm_opt'
15311 nm_so_opt='$nm_so_opt'
15312 nonxs_ext='$nonxs_ext'
15313 nroff='$nroff'
15314 nvsize='$nvsize'
15315 nvtype='$nvtype'
15316 o_nonblock='$o_nonblock'
15317 obj_ext='$obj_ext'
15318 old_pthread_create_joinable='$old_pthread_create_joinable'
15319 optimize='$optimize'
15320 orderlib='$orderlib'
15321 osname='$osname'
15322 osvers='$osvers'
15323 package='$package'
15324 pager='$pager'
15325 passcat='$passcat'
15326 patchlevel='$patchlevel'
15327 path_sep='$path_sep'
15328 perl5='$perl5'
15329 perl='$perl'
15330 perladmin='$perladmin'
15331 perlpath='$perlpath'
15332 pg='$pg'
15333 phostname='$phostname'
15334 pidtype='$pidtype'
15335 plibpth='$plibpth'
15336 pm_apiversion='$pm_apiversion'
15337 pmake='$pmake'
15338 pr='$pr'
15339 prefix='$prefix'
15340 prefixexp='$prefixexp'
15341 privlib='$privlib'
15342 privlibexp='$privlibexp'
15343 prototype='$prototype'
15344 ptrsize='$ptrsize'
15345 quadkind='$quadkind'
15346 quadtype='$quadtype'
15347 randbits='$randbits'
15348 randfunc='$randfunc'
15349 randseedtype='$randseedtype'
15350 ranlib='$ranlib'
15351 rd_nodata='$rd_nodata'
15352 revision='$revision'
15353 rm='$rm'
15354 rmail='$rmail'
15355 runnm='$runnm'
15356 sPRIEldbl='$sPRIEldbl'
15357 sPRIFldbl='$sPRIFldbl'
15358 sPRIGldbl='$sPRIGldbl'
15359 sPRIX64='$sPRIX64'
15360 sPRId64='$sPRId64'
15361 sPRIeldbl='$sPRIeldbl'
15362 sPRIfldbl='$sPRIfldbl'
15363 sPRIgldbl='$sPRIgldbl'
15364 sPRIi64='$sPRIi64'
15365 sPRIo64='$sPRIo64'
15366 sPRIu64='$sPRIu64'
15367 sPRIx64='$sPRIx64'
15368 sched_yield='$sched_yield'
15369 scriptdir='$scriptdir'
15370 scriptdirexp='$scriptdirexp'
15371 sed='$sed'
15372 seedfunc='$seedfunc'
15373 selectminbits='$selectminbits'
15374 selecttype='$selecttype'
15375 sendmail='$sendmail'
15376 sh='$sh'
15377 shar='$shar'
15378 sharpbang='$sharpbang'
15379 shmattype='$shmattype'
15380 shortsize='$shortsize'
15381 shrpenv='$shrpenv'
15382 shsharp='$shsharp'
15383 sig_count='$sig_count'
15384 sig_name='$sig_name'
15385 sig_name_init='$sig_name_init'
15386 sig_num='$sig_num'
15387 sig_num_init='$sig_num_init'
15388 signal_t='$signal_t'
15389 sitearch='$sitearch'
15390 sitearchexp='$sitearchexp'
15391 sitebin='$sitebin'
15392 sitebinexp='$sitebinexp'
15393 sitelib='$sitelib'
15394 sitelibexp='$sitelibexp'
15395 siteprefix='$siteprefix'
15396 siteprefixexp='$siteprefixexp'
15397 sizetype='$sizetype'
15398 sleep='$sleep'
15399 smail='$smail'
15400 small='$small'
15401 so='$so'
15402 sockethdr='$sockethdr'
15403 socketlib='$socketlib'
15404 socksizetype='$socksizetype'
15405 sort='$sort'
15406 spackage='$spackage'
15407 spitshell='$spitshell'
15408 split='$split'
15409 src='$src'
15410 ssizetype='$ssizetype'
15411 startperl='$startperl'
15412 startsh='$startsh'
15413 static_ext='$static_ext'
15414 stdchar='$stdchar'
15415 stdio_base='$stdio_base'
15416 stdio_bufsiz='$stdio_bufsiz'
15417 stdio_cnt='$stdio_cnt'
15418 stdio_filbuf='$stdio_filbuf'
15419 stdio_ptr='$stdio_ptr'
15420 stdio_stream_array='$stdio_stream_array'
15421 strings='$strings'
15422 submit='$submit'
15423 subversion='$subversion'
15424 sysman='$sysman'
15425 tail='$tail'
15426 tar='$tar'
15427 tbl='$tbl'
15428 tee='$tee'
15429 test='$test'
15430 timeincl='$timeincl'
15431 timetype='$timetype'
15432 touch='$touch'
15433 tr='$tr'
15434 trnl='$trnl'
15435 troff='$troff'
15436 u16size='$u16size'
15437 u16type='$u16type'
15438 u32size='$u32size'
15439 u32type='$u32type'
15440 u64size='$u64size'
15441 u64type='$u64type'
15442 u8size='$u8size'
15443 u8type='$u8type'
15444 uidformat='$uidformat'
15445 uidsign='$uidsign'
15446 uidsize='$uidsize'
15447 uidtype='$uidtype'
15448 uname='$uname'
15449 uniq='$uniq'
15450 uquadtype='$uquadtype'
15451 use5005threads='$use5005threads'
15452 use64bitall='$use64bitall'
15453 use64bitint='$use64bitint'
15454 usedl='$usedl'
15455 useithreads='$useithreads'
15456 uselargefiles='$uselargefiles'
15457 uselongdouble='$uselongdouble'
15458 usemorebits='$usemorebits'
15459 usemultiplicity='$usemultiplicity'
15460 usemymalloc='$usemymalloc'
15461 usenm='$usenm'
15462 useopcode='$useopcode'
15463 useperlio='$useperlio'
15464 useposix='$useposix'
15465 usesfio='$usesfio'
15466 useshrplib='$useshrplib'
15467 usesocks='$usesocks'
15468 usethreads='$usethreads'
15469 usevendorprefix='$usevendorprefix'
15470 usevfork='$usevfork'
15471 usrinc='$usrinc'
15472 uuname='$uuname'
15473 uvoformat='$uvoformat'
15474 uvsize='$uvsize'
15475 uvtype='$uvtype'
15476 uvuformat='$uvuformat'
15477 uvxformat='$uvxformat'
15478 vendorbin='$vendorbin'
15479 vendorbinexp='$vendorbinexp'
15480 vendorlib='$vendorlib'
15481 vendorlibexp='$vendorlibexp'
15482 vendorprefix='$vendorprefix'
15483 vendorprefixexp='$vendorprefixexp'
15484 version='$version'
15485 vi='$vi'
15486 voidflags='$voidflags'
15487 xlibpth='$xlibpth'
15488 xs_apiversion='$xs_apiversion'
15489 zcat='$zcat'
15490 zip='$zip'
15491 EOT
15492
15493 : Add in command line options if available
15494 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15495
15496 : add special variables
15497 $test -f $src/patchlevel.h && \
15498 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15499 echo "CONFIGDOTSH=true" >>config.sh
15500
15501 : propagate old symbols
15502 if $test -f UU/config.sh; then
15503         <UU/config.sh sort | uniq >UU/oldconfig.sh
15504         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15505         sort | uniq -u >UU/oldsyms
15506         set X `cat UU/oldsyms`
15507         shift
15508         case $# in
15509         0) ;;
15510         *)
15511                 cat <<EOM
15512 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15513 EOM
15514                 echo "# Variables propagated from previous config.sh file." >>config.sh
15515                 for sym in `cat UU/oldsyms`; do
15516                         echo "    Propagating $hint variable "'$'"$sym..."
15517                         eval 'tmp="$'"${sym}"'"'
15518                         echo "$tmp" | \
15519                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15520                 done
15521                 ;;
15522         esac
15523 fi
15524
15525 : Finish up by extracting the .SH files
15526 case "$alldone" in
15527 exit)
15528         $rm -rf UU
15529         echo "Done."
15530         exit 0
15531         ;;
15532 cont)
15533         ;;
15534 '')
15535         dflt=''
15536         nostick=true
15537         $cat <<EOM
15538
15539 If you'd like to make any changes to the config.sh file before I begin
15540 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15541
15542 EOM
15543         rp="Press return or use a shell escape to edit config.sh:"
15544         . UU/myread
15545         nostick=''
15546         case "$ans" in
15547         '') ;;
15548         *) : in case they cannot read
15549                 sh 1>&4 -c "$ans";;
15550         esac
15551         ;;
15552 esac
15553
15554 : if this fails, just run all the .SH files by hand
15555 . ./config.sh
15556
15557 echo " "
15558 exec 1>&4
15559 . ./UU/extract
15560
15561 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15562         dflt=y
15563         case "$silent" in
15564         true) ;;
15565         *)
15566                 $cat <<EOM
15567
15568 Now you need to generate make dependencies by running "$make depend".
15569 You might prefer to run it in background: "$make depend > makedepend.out &"
15570 It can take a while, so you might not want to run it right now.
15571
15572 EOM
15573                 ;;
15574         esac
15575         rp="Run $make depend now?"
15576         . UU/myread
15577         case "$ans" in
15578         y*)
15579                 $make depend && echo "Now you must run a $make."
15580                 ;;
15581         *)
15582                 echo "You must run '$make depend' then '$make'."
15583                 ;;
15584         esac
15585 elif test -f [Mm]akefile; then
15586         echo " "
15587         echo "Now you must run a $make."
15588 else
15589         echo "Done."
15590 fi
15591
15592 if $test -f Policy.sh; then
15593     $cat <<EOM
15594
15595 If you compile $package on a different machine or from a different object
15596 directory, copy the Policy.sh file from this object directory to the
15597 new one before you run Configure -- this will help you with most of
15598 the policy defaults.
15599
15600 EOM
15601 fi
15602 if $test -f config.msg; then
15603     echo "Hmm.  I also noted the following information while running:"
15604     echo " "
15605     $cat config.msg >&4
15606     $rm -f config.msg
15607 fi
15608 $rm -f kit*isdone ark*isdone
15609 $rm -rf UU
15610
15611 : End of Configure
15612