f397079482c54b520717819762f5250720b26129
[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 Wed Oct 27 16:30:21 EET DST 1999 [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 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_fstatfs=''
359 d_ftello=''
360 d_ftime=''
361 d_gettimeod=''
362 d_Gconvert=''
363 d_getgrent=''
364 d_getgrps=''
365 d_gethbyaddr=''
366 d_gethbyname=''
367 d_gethent=''
368 aphostname=''
369 d_gethname=''
370 d_phostname=''
371 d_uname=''
372 d_gethostprotos=''
373 d_getlogin=''
374 d_getmntent=''
375 d_getnbyaddr=''
376 d_getnbyname=''
377 d_getnent=''
378 d_getnetprotos=''
379 d_getpent=''
380 d_getpgid=''
381 d_getpgrp2=''
382 d_bsdgetpgrp=''
383 d_getpgrp=''
384 d_getppid=''
385 d_getprior=''
386 d_getpbyname=''
387 d_getpbynumber=''
388 d_getprotoprotos=''
389 d_getpwent=''
390 d_getsent=''
391 d_getservprotos=''
392 d_getspent=''
393 d_getspnam=''
394 d_getsbyname=''
395 d_getsbyport=''
396 d_gnulibc=''
397 d_hasmntopt=''
398 d_htonl=''
399 d_inetaton=''
400 d_isascii=''
401 d_killpg=''
402 d_lchown=''
403 d_ldbl_dig=''
404 d_link=''
405 d_locconv=''
406 d_lockf=''
407 d_longdbl=''
408 longdblsize=''
409 d_longlong=''
410 longlongsize=''
411 d_lstat=''
412 d_madvise=''
413 d_mblen=''
414 d_mbstowcs=''
415 d_mbtowc=''
416 d_memchr=''
417 d_memcmp=''
418 d_memcpy=''
419 d_memmove=''
420 d_memset=''
421 d_mkdir=''
422 d_mkfifo=''
423 d_mktime=''
424 d_mmap=''
425 mmaptype=''
426 d_mprotect=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_msync=''
433 d_munmap=''
434 d_nice=''
435 d_open3=''
436 d_fpathconf=''
437 d_pathconf=''
438 d_pause=''
439 d_pipe=''
440 d_poll=''
441 d_portable=''
442 d_old_pthread_create_joinable=''
443 old_pthread_create_joinable=''
444 d_pthread_yield=''
445 d_sched_yield=''
446 sched_yield=''
447 d_readdir=''
448 d_rewinddir=''
449 d_seekdir=''
450 d_telldir=''
451 d_readlink=''
452 d_readv=''
453 d_rename=''
454 d_rmdir=''
455 d_safebcpy=''
456 d_safemcpy=''
457 d_sanemcmp=''
458 d_select=''
459 d_sem=''
460 d_semctl=''
461 d_semget=''
462 d_semop=''
463 d_setegid=''
464 d_seteuid=''
465 d_setgrent=''
466 d_setgrps=''
467 d_sethent=''
468 d_setlinebuf=''
469 d_setlocale=''
470 d_setnent=''
471 d_setpent=''
472 d_setpgid=''
473 d_setpgrp2=''
474 d_bsdsetpgrp=''
475 d_setpgrp=''
476 d_setprior=''
477 d_setpwent=''
478 d_setregid=''
479 d_setresgid=''
480 d_setresuid=''
481 d_setreuid=''
482 d_setrgid=''
483 d_setruid=''
484 d_setsent=''
485 d_setsid=''
486 d_setspent=''
487 d_setvbuf=''
488 d_sfio=''
489 usesfio=''
490 d_shm=''
491 d_shmat=''
492 d_shmatprototype=''
493 shmattype=''
494 d_shmctl=''
495 d_shmdt=''
496 d_shmget=''
497 d_sigaction=''
498 d_sigsetjmp=''
499 d_cmsghdr_s=''
500 d_msg_ctrunc=''
501 d_msg_dontroute=''
502 d_msg_oob=''
503 d_msg_peek=''
504 d_msg_proxy=''
505 d_msghdr_s=''
506 d_oldsock=''
507 d_recvmsg=''
508 d_scm_rights=''
509 d_sendmsg=''
510 d_socket=''
511 d_sockpair=''
512 sockethdr=''
513 socketlib=''
514 d_sqrtl=''
515 d_statblks=''
516 d_fs_data_s=''
517 d_statfs=''
518 d_statfs_f_flags=''
519 d_statfs_s=''
520 d_fstatvfs=''
521 d_statvfs=''
522 d_stdio_cnt_lval=''
523 d_stdio_ptr_lval=''
524 d_stdiobase=''
525 d_stdstdio=''
526 stdio_base=''
527 stdio_bufsiz=''
528 stdio_cnt=''
529 stdio_filbuf=''
530 stdio_ptr=''
531 d_index=''
532 d_strchr=''
533 d_strcoll=''
534 d_strctcpy=''
535 d_strerrm=''
536 d_strerror=''
537 d_sysernlst=''
538 d_syserrlst=''
539 d_strtod=''
540 d_strtol=''
541 d_strtoul=''
542 d_strxfrm=''
543 d_symlink=''
544 d_syscall=''
545 d_sysconf=''
546 d_system=''
547 d_tcgetpgrp=''
548 d_tcsetpgrp=''
549 d_telldirproto=''
550 d_time=''
551 timetype=''
552 clocktype=''
553 d_times=''
554 d_truncate=''
555 d_tzname=''
556 d_umask=''
557 d_semctl_semid_ds=''
558 d_semctl_semun=''
559 d_union_semun=''
560 d_ustat=''
561 d_vfork=''
562 usevfork=''
563 d_voidsig=''
564 signal_t=''
565 d_volatile=''
566 d_charvspr=''
567 d_vprintf=''
568 d_wait4=''
569 d_waitpid=''
570 d_wcstombs=''
571 d_wctomb=''
572 d_writev=''
573 dlext=''
574 cccdlflags=''
575 ccdlflags=''
576 dlsrc=''
577 ld=''
578 lddlflags=''
579 usedl=''
580 doublesize=''
581 ebcdic=''
582 fflushNULL=''
583 fflushall=''
584 fpostype=''
585 gidtype=''
586 groupstype=''
587 h_fcntl=''
588 h_sysfile=''
589 i_arpainet=''
590 db_hashtype=''
591 db_prefixtype=''
592 i_db=''
593 i_dbm=''
594 i_rpcsvcdbm=''
595 d_dirnamlen=''
596 direntrytype=''
597 i_dirent=''
598 i_dld=''
599 i_dlfcn=''
600 i_fcntl=''
601 i_float=''
602 i_gdbm=''
603 d_grpasswd=''
604 i_grp=''
605 d_int64t=''
606 i_inttypes=''
607 i_limits=''
608 i_locale=''
609 i_machcthr=''
610 i_malloc=''
611 i_math=''
612 i_memory=''
613 i_mntent=''
614 i_ndbm=''
615 i_netdb=''
616 i_neterrno=''
617 i_netinettcp=''
618 i_niin=''
619 i_sysin=''
620 i_poll=''
621 i_pthread=''
622 d_pwage=''
623 d_pwchange=''
624 d_pwclass=''
625 d_pwcomment=''
626 d_pwexpire=''
627 d_pwgecos=''
628 d_pwpasswd=''
629 d_pwquota=''
630 i_pwd=''
631 i_sfio=''
632 i_shadow=''
633 i_socks=''
634 i_stddef=''
635 i_stdlib=''
636 i_string=''
637 strings=''
638 i_sysaccess=''
639 i_sysdir=''
640 i_sysfile=''
641 d_voidtty=''
642 i_bsdioctl=''
643 i_sysfilio=''
644 i_sysioctl=''
645 i_syssockio=''
646 i_sysmman=''
647 i_sysmount=''
648 i_sysndir=''
649 i_sysparam=''
650 i_sysresrc=''
651 i_syssecrt=''
652 i_sysselct=''
653 i_sysstat=''
654 i_sysstatfs=''
655 i_sysstatvfs=''
656 i_systimes=''
657 i_systypes=''
658 d_iovec_s=''
659 i_sysuio=''
660 i_sysun=''
661 i_sysvfs=''
662 i_syswait=''
663 i_sgtty=''
664 i_termio=''
665 i_termios=''
666 i_systime=''
667 i_systimek=''
668 i_time=''
669 timeincl=''
670 i_unistd=''
671 i_ustat=''
672 i_utime=''
673 i_values=''
674 i_stdarg=''
675 i_varargs=''
676 i_varhdr=''
677 i_vfork=''
678 installprefix=''
679 installprefixexp=''
680 installstyle=''
681 installusrbinperl=''
682 intsize=''
683 longsize=''
684 shortsize=''
685 d_fpos64_t=''
686 d_llseek=''
687 d_off64_t=''
688 libc=''
689 ldlibpthname=''
690 libperl=''
691 shrpenv=''
692 useshrplib=''
693 glibpth=''
694 libpth=''
695 loclibpth=''
696 plibpth=''
697 xlibpth=''
698 ignore_versioned_solibs=''
699 libs=''
700 lns=''
701 d_PRIEldbl=''
702 d_PRIFldbl=''
703 d_PRIGldbl=''
704 d_PRIeldbl=''
705 d_PRIfldbl=''
706 d_PRIgldbl=''
707 sPRIEldbl=''
708 sPRIFldbl=''
709 sPRIGldbl=''
710 sPRIeldbl=''
711 sPRIfldbl=''
712 sPRIgldbl=''
713 lseeksize=''
714 lseektype=''
715 make_set_make=''
716 d_mymalloc=''
717 freetype=''
718 mallocobj=''
719 mallocsrc=''
720 malloctype=''
721 usemymalloc=''
722 installman1dir=''
723 man1dir=''
724 man1direxp=''
725 man1ext=''
726 installman3dir=''
727 man3dir=''
728 man3direxp=''
729 man3ext=''
730 huge=''
731 large=''
732 medium=''
733 models=''
734 small=''
735 split=''
736 modetype=''
737 multiarch=''
738 mydomain=''
739 myhostname=''
740 phostname=''
741 c=''
742 n=''
743 d_eofnblk=''
744 eagain=''
745 o_nonblock=''
746 rd_nodata=''
747 netdb_hlen_type=''
748 netdb_host_type=''
749 netdb_name_type=''
750 netdb_net_type=''
751 groupcat=''
752 hostcat=''
753 passcat=''
754 orderlib=''
755 ranlib=''
756 package=''
757 spackage=''
758 pager=''
759 apiversion=''
760 patchlevel=''
761 subversion=''
762 version=''
763 perladmin=''
764 perlpath=''
765 pidtype=''
766 prefix=''
767 prefixexp=''
768 installprivlib=''
769 privlib=''
770 privlibexp=''
771 prototype=''
772 ptrsize=''
773 d_PRIX64=''
774 d_PRId64=''
775 d_PRIi64=''
776 d_PRIo64=''
777 d_PRIu64=''
778 d_PRIx64=''
779 sPRIX64=''
780 sPRId64=''
781 sPRIi64=''
782 sPRIo64=''
783 sPRIu64=''
784 sPRIx64=''
785 drand01=''
786 randbits=''
787 randfunc=''
788 randseedtype=''
789 seedfunc=''
790 installscript=''
791 scriptdir=''
792 scriptdirexp=''
793 selectminbits=''
794 selecttype=''
795 sh=''
796 sig_count=''
797 sig_name=''
798 sig_name_init=''
799 sig_num=''
800 sig_num_init=''
801 installsitearch=''
802 sitearch=''
803 sitearchexp=''
804 installsitebin=''
805 sitebin=''
806 sitebinexp=''
807 installsitelib=''
808 sitelib=''
809 sitelibexp=''
810 siteprefix=''
811 siteprefixexp=''
812 sizetype=''
813 so=''
814 sharpbang=''
815 shsharp=''
816 spitshell=''
817 src=''
818 ssizetype=''
819 startperl=''
820 startsh=''
821 stdchar=''
822 d_stdio_stream_array=''
823 stdio_stream_array=''
824 d_strtoull=''
825 sysman=''
826 trnl=''
827 uidsign=''
828 uidtype=''
829 archname64=''
830 use64bits=''
831 uselargefiles=''
832 uselongdouble=''
833 usemorebits=''
834 usemultiplicity=''
835 nm_opt=''
836 nm_so_opt=''
837 runnm=''
838 usenm=''
839 useperlio=''
840 usesocks=''
841 d_oldpthreads=''
842 usethreads=''
843 incpath=''
844 mips_type=''
845 usrinc=''
846 d_vendorbin=''
847 installvendorbin=''
848 vendorbin=''
849 vendorbinexp=''
850 d_vendorlib=''
851 installvendorlib=''
852 vendorlib=''
853 vendorlibexp=''
854 usevendorprefix=''
855 vendorprefix=''
856 vendorprefixexp=''
857 defvoidused=''
858 voidflags=''
859 pm_apiversion=''
860 xs_apiversion=''
861 CONFIG=''
862
863 define='define'
864 undef='undef'
865 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
866 rmlist=''
867
868 : We must find out about Eunice early
869 eunicefix=':'
870 if test -f /etc/unixtovms; then
871         eunicefix=/etc/unixtovms
872 fi
873 if test -f /etc/unixtovms.exe; then
874         eunicefix=/etc/unixtovms.exe
875 fi
876
877 i_whoami=''
878 : Possible local include directories to search.
879 : Set locincpth to "" in a hint file to defeat local include searches.
880 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
881 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
882 :
883 : no include file wanted by default
884 inclwanted=''
885
886 : list of known cpp symbols, sorted alphabetically
887 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
888 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
889 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
890 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
891 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
892 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
893 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
894 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
895 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
896 al="$al VMS Xenix286"
897 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
898 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
899 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
900 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
901 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
902 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
903 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
904 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
905 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
906 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
907 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
908 al="$al __SVR4_2__ __UMAXV__"
909 al="$al ____386BSD____ __alpha __alpha__ __amiga"
910 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
911 al="$al __host_mips__"
912 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
913 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
914 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
915 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
916 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
917 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
918 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
919 al="$al __mc88100 __mc88100__ __mips __mips__"
920 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
921 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
922 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
923 al="$al _host_mips _mips _unix"
924 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
925 al="$al apollo ardent att386 att3b"
926 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
927 al="$al cadmus clipper concurrent convex cray ctix"
928 al="$al dmert encore gcos gcx gimpel gould"
929 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
930 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
931 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
932 al="$al i186 i286 i386 i486 i8086"
933 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
934 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
935 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
936 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
937 al="$al mc88000 mc88100 merlin mert mips mvs n16"
938 al="$al ncl_el ncl_mr"
939 al="$al news1500 news1700 news1800 news1900 news3700"
940 al="$al news700 news800 news900 ns16000 ns32000"
941 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
942 al="$al parisc pc532 pdp11 plexus posix pyr"
943 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
944 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
945 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
946 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
947 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
948 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
949 al="$al xenix z8000"
950
951 : Trailing extension.  Override this in a hint file, if needed.
952 _exe=''
953 : Extra object files, if any, needed on this platform.
954 archobjs=''
955 groupstype=''
956 : change the next line if compiling for Xenix/286 on Xenix/386
957 xlibpth='/usr/lib/386 /lib/386'
958
959 : Possible local library directories to search.
960 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
961 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
962
963 : general looking path for locating libraries
964 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
965 glibpth="$glibpth /lib /usr/lib $xlibpth"
966 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
967 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
968
969 : Private path used by Configure to find libraries.  Its value
970 : is prepended to libpth. This variable takes care of special
971 : machines, like the mips.  Usually, it should be empty.
972 plibpth=''
973
974 : default library list
975 libswanted=''
976 : some systems want to use only the non-versioned libso:s
977 ignore_versioned_solibs=''
978 : full support for void wanted by default
979 defvoidused=15
980
981 : set useposix=false in your hint file to disable the POSIX extension.
982 useposix=true
983 : set useopcode=false in your hint file to disable the Opcode extension.
984 useopcode=true
985 : set usemultiplicity on the Configure command line to enable multiplicity.
986 : set usesocks on the Configure command line to enable socks.
987 : set usethreads on the Configure command line to enable threads.
988 : List of libraries we want.
989 : If anyone needs -lnet, put it in a hint file.
990 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
991 libswanted="$libswanted dld ld sun m c cposix posix"
992 libswanted="$libswanted ndir dir crypt sec"
993 libswanted="$libswanted ucb bsd BSD PW x"
994 : We probably want to search /usr/shlib before most other libraries.
995 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
996 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
997 glibpth="/usr/shlib $glibpth"
998 : Do not use vfork unless overridden by a hint file.
999 usevfork=false
1000
1001 : Find the basic shell for Bourne shell scripts
1002 case "$sh" in
1003 '')
1004         case "$SYSTYPE" in
1005         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1006         *) xxx='/bin/sh';;
1007         esac
1008         if test -f "$xxx"; then
1009                 sh="$xxx"
1010         else
1011                 : Build up a list and do a single loop so we can 'break' out.
1012                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1013                 for xxx in sh bash ksh pdksh ash; do
1014                         for p in $pth; do
1015                                 try="$try ${p}/${xxx}"
1016                         done
1017                 done
1018                 for xxx in $try; do
1019                         if test -f "$xxx"; then
1020                                 sh="$xxx";
1021                                 break
1022                         elif test -f "$xxx.exe"; then
1023                                 sh="$xxx";
1024                                 break
1025                         fi
1026                 done
1027         fi
1028         ;;
1029 esac
1030
1031 case "$sh" in
1032 '')     cat <<EOM >&2
1033 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1034
1035 Usually it's in /bin/sh.  How did you even get this far?
1036 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1037 we'll try to straighten this all out.
1038 EOM
1039         exit 1
1040         ;;
1041 esac
1042
1043 : see if sh knows # comments
1044 if `$sh -c '#' >/dev/null 2>&1`; then
1045         shsharp=true
1046         spitshell=cat
1047         xcat=/bin/cat
1048         test -f $xcat || xcat=/usr/bin/cat
1049         echo "#!$xcat" >try
1050         $eunicefix try
1051         chmod +x try
1052         ./try > today
1053         if test -s today; then
1054                 sharpbang='#!'
1055         else
1056                 echo "#! $xcat" > try
1057                 $eunicefix try
1058                 chmod +x try
1059                 ./try > today
1060                 if test -s today; then
1061                         sharpbang='#! '
1062                 else
1063                         sharpbang=': use '
1064                 fi
1065         fi
1066 else
1067         echo " "
1068         echo "Your $sh doesn't grok # comments--I will strip them later on."
1069         shsharp=false
1070         cd ..
1071         echo "exec grep -v '^[  ]*#'" >spitshell
1072         chmod +x spitshell
1073         $eunicefix spitshell
1074         spitshell=`pwd`/spitshell
1075         cd UU
1076         echo "I presume that if # doesn't work, #! won't work either!"
1077         sharpbang=': use '
1078 fi
1079 rm -f try today
1080
1081 : figure out how to guarantee sh startup
1082 case "$startsh" in
1083 '') startsh=${sharpbang}${sh} ;;
1084 *)
1085 esac
1086 cat >try <<EOSS
1087 $startsh
1088 set abc
1089 test "$?abc" != 1
1090 EOSS
1091
1092 chmod +x try
1093 $eunicefix try
1094 if ./try; then
1095         : echo "Yup, it does."
1096 else
1097         echo "Hmm... '$startsh' does not guarantee sh startup..."
1098         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1099 fi
1100 rm -f try
1101
1102
1103 : Save command line options in file UU/cmdline.opt for later use in
1104 : generating config.sh.
1105 cat > cmdline.opt <<EOSH
1106 # Configure command line arguments.
1107 config_arg0='$0'
1108 config_args='$*'
1109 config_argc=$#
1110 EOSH
1111 argn=1
1112 for arg in "$@"; do
1113         cat >>cmdline.opt <<EOSH
1114 config_arg$argn='$arg'
1115 EOSH
1116         argn=`expr $argn + 1`
1117 done
1118
1119 : produce awk script to parse command line options
1120 cat >options.awk <<'EOF'
1121 BEGIN {
1122         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1123
1124         len = length(optstr);
1125         for (i = 1; i <= len; i++) {
1126                 c = substr(optstr, i, 1);
1127                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1128                 if (a == ":") {
1129                         arg[c] = 1;
1130                         i++;
1131                 }
1132                 opt[c] = 1;
1133         }
1134 }
1135 {
1136         expect = 0;
1137         str = $0;
1138         if (substr(str, 1, 1) != "-") {
1139                 printf("'%s'\n", str);
1140                 next;
1141         }
1142         len = length($0);
1143         for (i = 2; i <= len; i++) {
1144                 c = substr(str, i, 1);
1145                 if (!opt[c]) {
1146                         printf("-%s\n", substr(str, i));
1147                         next;
1148                 }
1149                 printf("-%s\n", c);
1150                 if (arg[c]) {
1151                         if (i < len)
1152                                 printf("'%s'\n", substr(str, i + 1));
1153                         else
1154                                 expect = 1;
1155                         next;
1156                 }
1157         }
1158 }
1159 END {
1160         if (expect)
1161                 print "?";
1162 }
1163 EOF
1164
1165 : process the command line options
1166 set X `for arg in "$@"; do echo "X$arg"; done |
1167         sed -e s/X// | awk -f options.awk`
1168 eval "set $*"
1169 shift
1170 rm -f options.awk
1171
1172 : set up default values
1173 fastread=''
1174 reuseval=false
1175 config_sh=''
1176 alldone=''
1177 error=''
1178 silent=''
1179 extractsh=''
1180 override=''
1181 knowitall=''
1182 rm -f optdef.sh posthint.sh
1183 cat >optdef.sh <<EOS
1184 $startsh
1185 EOS
1186
1187
1188 : option parsing
1189 while test $# -gt 0; do
1190         case "$1" in
1191         -d) shift; fastread=yes;;
1192         -e) shift; alldone=cont;;
1193         -f)
1194                 shift
1195                 cd ..
1196                 if test -r "$1"; then
1197                         config_sh="$1"
1198                 else
1199                         echo "$me: cannot read config file $1." >&2
1200                         error=true
1201                 fi
1202                 cd UU
1203                 shift;;
1204         -h) shift; error=true;;
1205         -r) shift; reuseval=true;;
1206         -s) shift; silent=true; realsilent=true;;
1207         -E) shift; alldone=exit;;
1208         -K) shift; knowitall=true;;
1209         -O) shift; override=true;;
1210         -S) shift; silent=true; extractsh=true;;
1211         -D)
1212                 shift
1213                 case "$1" in
1214                 *=)
1215                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1216                         echo "$me: ignoring -D $1" >&2
1217                         ;;
1218                 *=*) echo "$1" | \
1219                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1220                 *) echo "$1='define'" >> optdef.sh;;
1221                 esac
1222                 shift
1223                 ;;
1224         -U)
1225                 shift
1226                 case "$1" in
1227                 *=) echo "$1" >> optdef.sh;;
1228                 *=*)
1229                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1230                         echo "$me: ignoring -U $1" >&2
1231                         ;;
1232                 *) echo "$1='undef'" >> optdef.sh;;
1233                 esac
1234                 shift
1235                 ;;
1236         -A)
1237             shift
1238             xxx=''
1239             yyy="$1"
1240             zzz=''
1241             uuu=undef
1242             case "$yyy" in
1243             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1244                  case "$zzz" in
1245                  *:*) zzz='' ;;
1246                  *)   xxx=append
1247                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1248                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1249                  esac
1250                  ;;
1251             esac
1252             case "$xxx" in
1253             '')  case "$yyy" in
1254                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1255                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1256                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1257                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1258                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1259                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1260                  esac
1261                  ;;       
1262             esac
1263             case "$xxx" in
1264             append)
1265                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1266             clear)
1267                 echo "$yyy=''"                  >> posthint.sh ;;
1268             define)
1269                 case "$zzz" in
1270                 '') zzz=define ;;
1271                 esac
1272                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1273             eval)
1274                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1275             prepend)
1276                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1277             undef)
1278                 case "$zzz" in
1279                 '') zzz="$uuu" ;;
1280                 esac
1281                 echo "$yyy=$zzz"                >> posthint.sh ;;
1282             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1283             esac
1284             ;;
1285         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1286             exit 0;;
1287         --) break;;
1288         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1289         *) break;;
1290         esac
1291 done
1292
1293 case "$error" in
1294 true)
1295         cat >&2 <<EOM
1296 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1297                  [-U symbol] [-U symbol=] [-A command:symbol...]
1298   -d : use defaults for all answers.
1299   -e : go on without questioning past the production of config.sh.
1300   -f : specify an alternate default configuration file.
1301   -h : print this help message and exit (with an error status).
1302   -r : reuse C symbols value if possible (skips costly nm extraction).
1303   -s : silent mode, only echoes questions and essential information.
1304   -D : define symbol to have some value:
1305          -D symbol         symbol gets the value 'define'
1306          -D symbol=value   symbol gets the value 'value'
1307   -E : stop at the end of questions, after having produced config.sh.
1308   -K : do not use unless you know what you are doing.
1309   -O : let -D and -U override definitions from loaded configuration file.
1310   -S : perform variable substitutions on all .SH files (can mix with -f)
1311   -U : undefine symbol:
1312          -U symbol    symbol gets the value 'undef'
1313          -U symbol=   symbol gets completely empty
1314   -A : manipulate symbol after the platform specific hints have been applied:
1315          -A symbol=value                append " "value to symbol
1316          -A append:symbol=value         append value to symbol
1317          -A define:symbol=value         define symbol to have value
1318          -A clear:symbol                define symbol to be ''
1319          -A define:symbol               define symbol to be 'define'
1320          -A eval:symbol=value           define symbol to be eval of value
1321          -A prepend:symbol=value        prepend value to symbol
1322          -A undef:symbol                define symbol to be 'undef'
1323          -A undef:symbol=               define symbol to be ''
1324   -V : print version number and exit (with a zero status).
1325 EOM
1326         exit 1
1327         ;;
1328 esac
1329
1330 : Sanity checks
1331 case "$fastread$alldone" in
1332 yescont|yesexit) ;;
1333 *)
1334         if test ! -t 0; then
1335                 echo "Say 'sh Configure', not 'sh <Configure'"
1336                 exit 1
1337         fi
1338         ;;
1339 esac
1340
1341 exec 4>&1
1342 case "$silent" in
1343 true) exec 1>/dev/null;;
1344 esac
1345
1346 : run the defines and the undefines, if any, but leave the file out there...
1347 touch optdef.sh
1348 . ./optdef.sh
1349 : create the posthint manipulation script and leave the file out there...
1350 touch posthint.sh
1351
1352 : set package name
1353 package=perl5
1354 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1355 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1356 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1357 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1358 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1359 esac
1360
1361 : Some greps do not return status, grrr.
1362 echo "grimblepritz" >grimble
1363 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1364         contains=contains
1365 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1366         contains=grep
1367 else
1368         contains=contains
1369 fi
1370 rm -f grimble
1371 : the following should work in any shell
1372 case "$contains" in
1373 contains*)
1374         echo " "
1375         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1376         cat >contains <<'EOSS'
1377 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1378 EOSS
1379 chmod +x contains
1380 esac
1381
1382 : Find the path to the source tree
1383 case "$src" in
1384 '') case "$0" in
1385     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1386          case "$src" in
1387          /*)    ;;
1388          *)     src=`cd ../$src && pwd` ;;
1389          esac
1390          ;;
1391     *)   src='.';;
1392     esac;;
1393 esac
1394 case "$src" in
1395 '')     src=/
1396         rsrc=/
1397         ;;
1398 /*) rsrc="$src";;
1399 *) rsrc="../$src";;
1400 esac
1401 if test -f $rsrc/Configure && \
1402         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1403 then
1404    : found it, so we are ok.
1405 else
1406         rsrc=''
1407         for src in . .. ../.. ../../.. ../../../..; do
1408                 if test -f ../$src/Configure && \
1409                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1410                 then
1411                         rsrc=../$src
1412                         break
1413                 fi
1414         done
1415 fi
1416 case "$rsrc" in
1417 '')
1418         cat <<EOM >&4
1419
1420 Sorry, I can't seem to locate the source dir for $package.  Please start
1421 Configure with an explicit path -- i.e. /some/path/Configure.
1422
1423 EOM
1424         exit 1
1425         ;;
1426 ../.)   rsrc='..';;
1427 *)
1428         echo " "
1429         echo "Sources for $package found in \"$src\"." >&4
1430         ;;
1431 esac
1432
1433 : script used to extract .SH files with variable substitutions
1434 cat >extract <<'EOS'
1435 CONFIGDOTSH=true
1436 echo "Doing variable substitutions on .SH files..."
1437 if test -f $src/MANIFEST; then
1438         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1439 else
1440         echo "(Looking for .SH files under the source directory.)"
1441         set x `(cd $src; find . -name "*.SH" -print)`
1442 fi
1443 shift
1444 case $# in
1445 0) set x `(cd $src; echo *.SH)`; shift;;
1446 esac
1447 if test ! -f $src/$1; then
1448         shift
1449 fi
1450 mkdir_p='
1451 name=$1;
1452 create="";
1453 while test $name; do
1454         if test ! -d "$name"; then
1455                 create="$name $create";
1456                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1457                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1458         else
1459                 name="";
1460         fi;
1461 done;
1462 for file in $create; do
1463         mkdir $file;
1464 done
1465 '
1466 for file in $*; do
1467         case "$src" in
1468         ".")
1469                 case "$file" in
1470                 */*)
1471                         dir=`expr X$file : 'X\(.*\)/'`
1472                         file=`expr X$file : 'X.*/\(.*\)'`
1473                         (cd $dir && . ./$file)
1474                         ;;
1475                 *)
1476                         . ./$file
1477                         ;;
1478                 esac
1479                 ;;
1480         *)
1481                 case "$file" in
1482                 */*)
1483                         dir=`expr X$file : 'X\(.*\)/'`
1484                         file=`expr X$file : 'X.*/\(.*\)'`
1485                         (set x $dir; shift; eval $mkdir_p)
1486                         sh <$src/$dir/$file
1487                         ;;
1488                 *)
1489                         sh <$src/$file
1490                         ;;
1491                 esac
1492                 ;;
1493         esac
1494 done
1495 if test -f $src/config_h.SH; then
1496         if test ! -f config.h; then
1497         : oops, they left it out of MANIFEST, probably, so do it anyway.
1498         . $src/config_h.SH
1499         fi
1500 fi
1501 EOS
1502
1503 : extract files and exit if asked to do so
1504 case "$extractsh" in
1505 true)
1506         case "$realsilent" in
1507         true) ;;
1508         *) exec 1>&4;;
1509         esac
1510         case "$config_sh" in
1511         '') config_sh='config.sh';;
1512         esac
1513         echo " "
1514         echo "Fetching answers from $config_sh..."
1515         cd ..
1516         . $config_sh
1517         test "$override" && . ./optdef.sh
1518         echo " "
1519         . UU/extract
1520         rm -rf UU
1521         echo "Done."
1522         exit 0
1523         ;;
1524 esac
1525
1526 : Eunice requires " " instead of "", can you believe it
1527 echo " "
1528 : Here we go...
1529 echo "Beginning of configuration questions for $package."
1530
1531 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1532
1533 : first determine how to suppress newline on echo command
1534 echo " "
1535 echo "Checking echo to see how to suppress newlines..."
1536 (echo "hi there\c" ; echo " ") >.echotmp
1537 if $contains c .echotmp >/dev/null 2>&1 ; then
1538         echo "...using -n."
1539         n='-n'
1540         c=''
1541 else
1542         cat <<'EOM'
1543 ...using \c
1544 EOM
1545         n=''
1546         c='\c'
1547 fi
1548 echo $n "The star should be here-->$c"
1549 echo '*'
1550 rm -f .echotmp
1551
1552 : Now test for existence of everything in MANIFEST
1553 echo " "
1554 if test -f $rsrc/MANIFEST; then
1555         echo "First let's make sure your kit is complete.  Checking..." >&4
1556         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1557         rm -f missing
1558         tmppwd=`pwd`
1559         for filelist in x??; do
1560                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1561         done
1562         if test -s missing; then
1563                 cat missing >&4
1564                 cat >&4 <<'EOM'
1565
1566 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1567
1568 You have the option of continuing the configuration process, despite the
1569 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1570 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1571 and contact the author (perlbug@perl.com).
1572
1573 EOM
1574                 echo $n "Continue? [n] $c" >&4
1575                 read ans
1576                 case "$ans" in
1577                 y*)
1578                         echo "Continuing..." >&4
1579                         rm -f missing
1580                         ;;
1581                 *)
1582                         echo "ABORTING..." >&4
1583                         kill $$
1584                         ;;
1585                 esac
1586         else
1587                 echo "Looks good..."
1588         fi
1589 else
1590         echo "There is no MANIFEST file.  I hope your kit is complete !"
1591 fi
1592 rm -f missing x??
1593
1594 echo " "
1595 : Find the appropriate value for a newline for tr
1596 if test -n "$DJGPP"; then
1597        trnl='\012'
1598 fi
1599 if test X"$trnl" = X; then
1600         case "`echo foo|tr '\n' x 2>/dev/null`" in
1601         foox) trnl='\n' ;;
1602         esac
1603 fi
1604 if test X"$trnl" = X; then
1605         case "`echo foo|tr '\012' x 2>/dev/null`" in
1606         foox) trnl='\012' ;;
1607         esac
1608 fi
1609 if test X"$trnl" = X; then
1610         cat <<EOM >&2
1611
1612 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1613
1614 EOM
1615         exit 1
1616 fi
1617
1618 : compute the number of columns on the terminal for proper question formatting
1619 case "$COLUMNS" in
1620 '') COLUMNS='80';;
1621 esac
1622
1623 : set up the echo used in my read
1624 myecho="case \"\$xxxm\" in
1625 '') echo $n \"\$rp $c\" >&4;;
1626 *) case \"\$rp\" in
1627         '') echo $n \"[\$xxxm] $c\";;
1628         *)
1629                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1630                         echo \"\$rp\" >&4
1631                         echo $n \"[\$xxxm] $c\" >&4
1632                 else
1633                         echo $n \"\$rp [\$xxxm] $c\" >&4
1634                 fi
1635                 ;;
1636         esac;;
1637 esac"
1638
1639 : now set up to do reads with possible shell escape and default assignment
1640 cat <<EOSC >myread
1641 $startsh
1642 xxxm=\$dflt
1643 $myecho
1644 ans='!'
1645 case "\$fastread" in
1646 yes) case "\$dflt" in
1647         '') ;;
1648         *) ans='';
1649                 case "\$silent-\$rp" in
1650                 true-) ;;
1651                 *) echo " " >&4;;
1652                 esac;;
1653         esac;;
1654 *) case "\$silent" in
1655         true) case "\$rp" in
1656                 '') ans='';;
1657                 esac;;
1658         esac;;
1659 esac
1660 while expr "X\$ans" : "X!" >/dev/null; do
1661         read answ
1662         set x \$xxxm
1663         shift
1664         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1665         case  "\$answ" in
1666         "!")
1667                 sh 1>&4
1668                 echo " "
1669                 $myecho
1670                 ;;
1671         !*)
1672                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1673                 shift
1674                 sh 1>&4 -c "\$*"
1675                 echo " "
1676                 $myecho
1677                 ;;
1678         "\$ans")
1679                 case "\$ans" in
1680                 \\&*)
1681                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1682                         shift
1683                         case "\$1" in
1684                         -d)
1685                                 fastread=yes
1686                                 echo "(OK, I'll run with -d after this question.)" >&4
1687                                 ;;
1688                         -*)
1689                                 echo "*** Sorry, \$1 not supported yet." >&4
1690                                 ;;
1691                         esac
1692                         $myecho
1693                         ans=!
1694                         ;;
1695                 esac;;
1696         *)
1697                 case "\$aok" in
1698                 y)
1699                         echo "*** Substitution done -- please confirm."
1700                         xxxm="\$ans"
1701                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1702                         xxxm="\$ans"
1703                         ans=!
1704                         ;;
1705                 *)
1706                         echo "*** Error -- try again."
1707                         ans=!
1708                         ;;
1709                 esac
1710                 $myecho
1711                 ;;
1712         esac
1713         case "\$ans\$xxxm\$nostick" in
1714         '')
1715                 ans=!
1716                 $myecho
1717                 ;;
1718         esac
1719 done
1720 case "\$ans" in
1721 '') ans="\$xxxm";;
1722 esac
1723 EOSC
1724
1725 : create .config dir to save info across Configure sessions
1726 test -d ../.config || mkdir ../.config
1727 cat >../.config/README <<EOF
1728 This directory created by Configure to save information that should
1729 persist across sessions for $package.
1730
1731 You may safely delete it if you wish.
1732 EOF
1733
1734 : general instructions
1735 needman=true
1736 firsttime=true
1737 user=`(logname) 2>/dev/null`
1738 case "$user" in
1739 '') user=`whoami 2>&1`;;
1740 esac
1741 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1742         firsttime=false
1743         echo " "
1744         rp='Would you like to see the instructions?'
1745         dflt=n
1746         . ./myread
1747         case "$ans" in
1748         [yY]*) ;;
1749         *) needman=false;;
1750         esac
1751 fi
1752 if $needman; then
1753         cat <<EOH
1754
1755 This installation shell script will examine your system and ask you questions
1756 to determine how the perl5 package should be installed. If you get
1757 stuck on a question, you may use a ! shell escape to start a subshell or
1758 execute a command.  Many of the questions will have default answers in square
1759 brackets; typing carriage return will give you the default.
1760
1761 On some of the questions which ask for file or directory names you are allowed
1762 to use the ~name construct to specify the login directory belonging to "name",
1763 even if you don't have a shell which knows about that.  Questions where this is
1764 allowed will be marked "(~name ok)".
1765
1766 EOH
1767         rp=''
1768         dflt='Type carriage return to continue'
1769         . ./myread
1770         cat <<'EOH'
1771
1772 The prompter used in this script allows you to use shell variables and
1773 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1774 in the default answer, as if the default line was a set of arguments given to a
1775 script shell.  This means you may also use $* to repeat the whole default line,
1776 so you do not have to re-type everything to add something to the default.
1777
1778 Everytime there is a substitution, you will have to confirm.  If there is an
1779 error (e.g. an unmatched backtick), the default answer will remain unchanged
1780 and you will be prompted again.
1781
1782 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1783 the questions and use the computed defaults (or the previous answers if there
1784 was already a config.sh file). Type 'Configure -h' for a list of options.
1785 You may also start interactively and then answer '& -d' at any prompt to turn
1786 on the non-interactive behaviour for the remainder of the execution.
1787
1788 EOH
1789         . ./myread
1790         cat <<EOH
1791
1792 Much effort has been expended to ensure that this shell script will run on any
1793 Unix system.  If despite that it blows up on yours, your best bet is to edit
1794 Configure and run it again.  If you can't run Configure for some reason,
1795 you'll have to generate a config.sh file by hand.  Whatever problems you
1796 have, let me (perlbug@perl.com) know how I blew it.
1797
1798 This installation script affects things in two ways:
1799
1800 1) it may do direct variable substitutions on some of the files included
1801    in this kit.
1802 2) it builds a config.h file for inclusion in C programs.  You may edit
1803    any of these files as the need arises after running this script.
1804
1805 If you make a mistake on a question, there is no easy way to back up to it
1806 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1807 files.  Configure will offer to let you do this before it runs the SH files.
1808
1809 EOH
1810         dflt='Type carriage return to continue'
1811         . ./myread
1812         case "$firsttime" in
1813         true) echo $user >>../.config/instruct;;
1814         esac
1815 fi
1816
1817 : find out where common programs are
1818 echo " "
1819 echo "Locating common programs..." >&4
1820 cat <<EOSC >loc
1821 $startsh
1822 case \$# in
1823 0) exit 1;;
1824 esac
1825 thing=\$1
1826 shift
1827 dflt=\$1
1828 shift
1829 for dir in \$*; do
1830         case "\$thing" in
1831         .)
1832         if test -d \$dir/\$thing; then
1833                 echo \$dir
1834                 exit 0
1835         fi
1836         ;;
1837         *)
1838         for thisthing in \$dir/\$thing; do
1839                 : just loop through to pick last item
1840         done
1841         if test -f \$thisthing; then
1842                 echo \$thisthing
1843                 exit 0
1844         elif test -f \$dir/\$thing.exe; then
1845                 if test -n "$DJGPP"; then
1846                         echo \$dir/\$thing.exe
1847                 else
1848                         : on Eunice apparently
1849                         echo \$dir/\$thing
1850                 fi
1851                 exit 0
1852         fi
1853         ;;
1854         esac
1855 done
1856 echo \$dflt
1857 exit 1
1858 EOSC
1859 chmod +x loc
1860 $eunicefix loc
1861 loclist="
1862 awk
1863 cat
1864 comm
1865 cp
1866 echo
1867 expr
1868 grep
1869 ls
1870 make
1871 mkdir
1872 rm
1873 sed
1874 sort
1875 touch
1876 tr
1877 uniq
1878 "
1879 trylist="
1880 Mcc
1881 ar
1882 byacc
1883 cpp
1884 csh
1885 date
1886 egrep
1887 gzip
1888 less
1889 ln
1890 more
1891 nm
1892 nroff
1893 pg
1894 test
1895 uname
1896 zip
1897 "
1898 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1899 pth="$pth /lib /usr/lib"
1900 for file in $loclist; do
1901         eval xxx=\$$file
1902         case "$xxx" in
1903         /*|?:[\\/]*)
1904                 if test -f "$xxx"; then
1905                         : ok
1906                 else
1907                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1908                         xxx=`./loc $file $file $pth`
1909                 fi
1910                 ;;
1911         '') xxx=`./loc $file $file $pth`;;
1912         *) xxx=`./loc $xxx $xxx $pth`;;
1913         esac
1914         eval $file=$xxx
1915         eval _$file=$xxx
1916         case "$xxx" in
1917         /*)
1918                 echo $file is in $xxx.
1919                 ;;
1920         ?:[\\/]*)
1921                 echo $file is in $xxx.
1922                 ;;
1923         *)
1924                 echo "I don't know where '$file' is, and my life depends on it." >&4
1925                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1926                 exit 1
1927                 ;;
1928         esac
1929 done
1930 echo " "
1931 echo "Don't worry if any of the following aren't found..."
1932 say=offhand
1933 for file in $trylist; do
1934         eval xxx=\$$file
1935         case "$xxx" in
1936         /*|?:[\\/]*)
1937                 if test -f "$xxx"; then
1938                         : ok
1939                 else
1940                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1941                         xxx=`./loc $file $file $pth`
1942                 fi
1943                 ;;
1944         '') xxx=`./loc $file $file $pth`;;
1945         *) xxx=`./loc $xxx $xxx $pth`;;
1946         esac
1947         eval $file=$xxx
1948         eval _$file=$xxx
1949         case "$xxx" in
1950         /*)
1951                 echo $file is in $xxx.
1952                 ;;
1953         ?:[\\/]*)
1954                 echo $file is in $xxx.
1955                 ;;
1956         *)
1957                 echo "I don't see $file out there, $say."
1958                 say=either
1959                 ;;
1960         esac
1961 done
1962 case "$egrep" in
1963 egrep)
1964         echo "Substituting grep for egrep."
1965         egrep=$grep
1966         ;;
1967 esac
1968 case "$ln" in
1969 ln)
1970         echo "Substituting cp for ln."
1971         ln=$cp
1972         ;;
1973 esac
1974 case "$test" in
1975 test)
1976         echo "Hopefully test is built into your sh."
1977         ;;
1978 *)
1979         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1980                 echo "Using the test built into your sh."
1981                 test=test
1982                 _test=test
1983         fi
1984         ;;
1985 esac
1986 case "$echo" in
1987 echo)
1988         echo "Hopefully echo is built into your sh."
1989         ;;
1990 '') ;;
1991 *)
1992         echo " "
1993 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1994         $echo $n "hi there$c" >foo1
1995         echo $n "hi there$c" >foo2
1996         if cmp foo1 foo2 >/dev/null 2>&1; then
1997                 echo "They are compatible.  In fact, they may be identical."
1998         else
1999                 case "$n" in
2000                 '-n') n='' c='\c';;
2001                 *) n='-n' c='';;
2002                 esac
2003                 cat <<FOO
2004 They are not compatible!  You are probably running ksh on a non-USG system.
2005 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2006 have echo built in and we may have to run some Bourne shell scripts.  That
2007 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2008
2009 FOO
2010                 $echo $n "The star should be here-->$c"
2011                 $echo "*"
2012         fi
2013         $rm -f foo1 foo2
2014         ;;
2015 esac
2016
2017 : determine whether symbolic links are supported
2018 echo " "
2019 $touch blurfl
2020 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2021         echo "Symbolic links are supported." >&4
2022         lns="$ln -s"
2023 else
2024         echo "Symbolic links are NOT supported." >&4
2025         lns="$ln"
2026 fi
2027 $rm -f blurfl sym
2028
2029 : see whether [:lower:] and [:upper:] are supported character classes
2030 echo " "
2031 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2032 ABYZ)
2033         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2034         up='[:upper:]'
2035         low='[:lower:]'
2036         ;;
2037 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2038         # (0xc9 and 0xd1), therefore that is a nice testing point.
2039         if test "X$up" = X -o "X$low" = X; then
2040             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2041             ij) up='[A-Z]'
2042                 low='[a-z]'
2043                 ;;
2044             esac
2045         fi
2046         if test "X$up" = X -o "X$low" = X; then
2047             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2048             ij) up='A-Z'
2049                 low='a-z'
2050                 ;;
2051             esac
2052         fi
2053         if test "X$up" = X -o "X$low" = X; then
2054             case "`echo IJ | od -x 2>/dev/null`" in
2055             *C9D1*|*c9d1*)
2056                 echo "Hey, this might be EBCDIC." >&4
2057                 if test "X$up" = X -o "X$low" = X; then
2058                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2059                     ij) up='[A-IJ-RS-Z]'
2060                         low='[a-ij-rs-z]'
2061                         ;;
2062                     esac
2063                 fi
2064                 if test "X$up" = X -o "X$low" = X; then
2065                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2066                     ij) up='A-IJ-RS-Z'
2067                         low='a-ij-rs-z'
2068                         ;;
2069                     esac
2070                 fi
2071                 ;;
2072             esac
2073         fi
2074 esac
2075 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2076 ij)
2077     echo "Using $up and $low to convert case." >&4
2078     ;;
2079 *)
2080     echo "I don't know how to translate letters from upper to lower case." >&4
2081     echo "Your tr is not acting any way I know of." >&4
2082     exit 1
2083     ;;
2084 esac
2085 : set up the translation script tr, must be called with ./tr of course
2086 cat >tr <<EOSC
2087 $startsh
2088 case "\$1\$2" in
2089 '[A-Z][a-z]') exec $tr '$up' '$low';;
2090 '[a-z][A-Z]') exec $tr '$low' '$up';;
2091 esac
2092 exec $tr "\$@"
2093 EOSC
2094 chmod +x tr
2095 $eunicefix tr
2096
2097 : Try to determine whether config.sh was made on this system
2098 case "$config_sh" in
2099 '')
2100 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2101 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2102 # because the A-Z/a-z are not consecutive.
2103 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2104         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2105 newmyuname="$myuname"
2106 dflt=n
2107 case "$knowitall" in
2108 '')
2109         if test -f ../config.sh; then
2110                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2111                         eval "`grep myuname= ../config.sh`"
2112                 fi
2113                 if test "X$myuname" = "X$newmyuname"; then
2114                         dflt=y
2115                 fi
2116         fi
2117         ;;
2118 *) dflt=y;;
2119 esac
2120
2121 : Get old answers from old config file if Configure was run on the
2122 : same system, otherwise use the hints.
2123 hint=default
2124 cd ..
2125 if test -f config.sh; then
2126         echo " "
2127         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2128         . UU/myread
2129         case "$ans" in
2130         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2131         *)  echo "Fetching default answers from your old config.sh file..." >&4
2132                 tmp_n="$n"
2133                 tmp_c="$c"
2134                 tmp_sh="$sh"
2135                 . ./config.sh
2136                 cp config.sh UU
2137                 n="$tmp_n"
2138                 c="$tmp_c"
2139                 : Older versions did not always set $sh.  Catch re-use of such
2140                 : an old config.sh.
2141                 case "$sh" in
2142                 '') sh="$tmp_sh" ;;
2143                 esac
2144                 hint=previous
2145                 ;;
2146         esac
2147 fi
2148 if test ! -f config.sh; then
2149         $cat <<EOM
2150
2151 First time through, eh?  I have some defaults handy for some systems
2152 that need some extra help getting the Configure answers right:
2153
2154 EOM
2155         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2156         dflt=''
2157         : Half the following guesses are probably wrong... If you have better
2158         : tests or hints, please send them to perlbug@perl.com
2159         : The metaconfig authors would also appreciate a copy...
2160         $test -f /irix && osname=irix
2161         $test -f /xenix && osname=sco_xenix
2162         $test -f /dynix && osname=dynix
2163         $test -f /dnix && osname=dnix
2164         $test -f /lynx.os && osname=lynxos
2165         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2166         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2167         $test -f /bin/mips && /bin/mips && osname=mips
2168         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2169                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2170         $test -d /usr/apollo/bin && osname=apollo
2171         $test -f /etc/saf/_sactab && osname=svr4
2172         $test -d /usr/include/minix && osname=minix
2173         if $test -d /MachTen -o -d /MachTen_Folder; then
2174                 osname=machten
2175                 if $test -x /sbin/version; then
2176                         osvers=`/sbin/version | $awk '{print $2}' |
2177                         $sed -e 's/[A-Za-z]$//'`
2178                 elif $test -x /usr/etc/version; then
2179                         osvers=`/usr/etc/version | $awk '{print $2}' |
2180                         $sed -e 's/[A-Za-z]$//'`
2181                 else
2182                         osvers="$2.$3"
2183                 fi
2184         fi
2185        $test -f /sys/posix.dll &&
2186                $test -f /usr/bin/what &&
2187                set X `/usr/bin/what /sys/posix.dll` &&
2188                $test "$3" = UWIN &&
2189                osname=uwin &&
2190                osvers="$5"
2191         if $test -f $uname; then
2192                 set X $myuname
2193                 shift
2194
2195                 case "$5" in
2196                 fps*) osname=fps ;;
2197                 mips*)
2198                         case "$4" in
2199                         umips) osname=umips ;;
2200                         *) osname=mips ;;
2201                         esac;;
2202                 [23]100) osname=mips ;;
2203                 next*) osname=next ;;
2204                 i386*)
2205                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2206                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2207                                 osname='sco'
2208                                 osvers=$tmp
2209                         elif $test -f /etc/kconfig; then
2210                                 osname=isc
2211                                 if test "$lns" = "$ln -s"; then
2212                                         osvers=4
2213                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2214                                         osvers=3
2215                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2216                                         osvers=2
2217                                 fi
2218                         fi
2219                         tmp=''
2220                         ;;
2221                 pc*)
2222                         if test -n "$DJGPP"; then
2223                                 osname=dos
2224                                 osvers=djgpp
2225                         fi
2226                         ;;
2227                 esac
2228
2229                 case "$1" in
2230                 aix) osname=aix
2231                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2232                         case "$tmp" in
2233                         'not found') osvers="$4"."$3" ;;
2234                         '<3240'|'<>3240') osvers=3.2.0 ;;
2235                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2236                         '=3250'|'>3250') osvers=3.2.5 ;;
2237                         *) osvers=$tmp;;
2238                         esac
2239                         ;;
2240                 *dc.osx) osname=dcosx
2241                         osvers="$3"
2242                         ;;
2243                 dnix) osname=dnix
2244                         osvers="$3"
2245                         ;;
2246                 domainos) osname=apollo
2247                         osvers="$3"
2248                         ;;
2249                 dgux) osname=dgux 
2250                         osvers="$3"
2251                         ;;
2252                 dynixptx*) osname=dynixptx
2253                         osvers=`echo "$4"|sed 's/^v//'`
2254                         ;;
2255                 freebsd) osname=freebsd 
2256                         osvers="$3" ;;
2257                 genix) osname=genix ;;
2258                 hp*) osname=hpux 
2259                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2260                         ;;
2261                 irix*) osname=irix
2262                         case "$3" in
2263                         4*) osvers=4 ;;
2264                         5*) osvers=5 ;;
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 linux) osname=linux
2269                         case "$3" in
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 MiNT) osname=mint
2274                         ;;
2275                 netbsd*) osname=netbsd
2276                         osvers="$3"
2277                         ;;
2278                 news-os) osvers="$3"
2279                         case "$3" in
2280                         4*) osname=newsos4 ;;
2281                         *) osname=newsos ;;
2282                         esac
2283                         ;;
2284                 bsd386) osname=bsd386
2285                         osvers=`$uname -r`
2286                         ;;
2287                 POSIX-BC | posix-bc ) osname=posix-bc
2288                         osvers="$3"
2289                         ;;
2290                 powerux | power_ux | powermax_os | powermaxos | \
2291                 powerunix | power_unix) osname=powerux
2292                         osvers="$3"
2293                         ;;
2294                 next*) osname=next ;;
2295                 solaris) osname=solaris
2296                         case "$3" in
2297                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2298                         *)      osvers="$3" ;;
2299                         esac
2300                         ;;
2301                 sunos) osname=sunos
2302                         case "$3" in
2303                         5*) osname=solaris
2304                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2305                         *)      osvers="$3" ;;
2306                         esac
2307                         ;;
2308                 titanos) osname=titanos
2309                         case "$3" in
2310                         1*) osvers=1 ;;
2311                         2*) osvers=2 ;;
2312                         3*) osvers=3 ;;
2313                         4*) osvers=4 ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 ultrix) osname=ultrix
2318                         osvers="$3"
2319                         ;;
2320                 osf1|mls+)      case "$5" in
2321                                 alpha)
2322                                         osname=dec_osf
2323                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2324                                         ;;
2325                         hp*)    osname=hp_osf1  ;;
2326                         mips)   osname=mips_osf1 ;;
2327                         esac
2328                         ;;
2329                 unixware) osname=svr5
2330                         osvers="$4"
2331                         ;;
2332                 uts) osname=uts
2333                         osvers="$3"
2334                         ;;
2335                 qnx) osname=qnx
2336                         osvers="$4"
2337                         ;;
2338                 $2) case "$osname" in
2339                         *isc*) ;;
2340                         *freebsd*) ;;
2341                         svr*)
2342                                 : svr4.x or possibly later
2343                                 case "svr$3" in 
2344                                 ${osname}*)
2345                                         osname=svr$3
2346                                         osvers=$4
2347                                         ;;
2348                                 esac
2349                                 case "$osname" in
2350                                 svr4.0)
2351                                         : Check for ESIX
2352                                         if test -f /stand/boot ; then
2353                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2354                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2355                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2356                                                         if test -n "$isesix"; then
2357                                                                 osname=esix4
2358                                                         fi
2359                                                 fi
2360                                         fi
2361                                         ;;
2362                                 esac
2363                                 ;;
2364                         *)      if test -f /etc/systemid; then
2365                                         osname=sco
2366                                         set `echo $3 | $sed 's/\./ /g'` $4
2367                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2368                                                 osvers=$1.$2.$3
2369                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2370                                                 osvers=$1.$2
2371                                         elif $test -f $src/hints/sco_$1.sh; then
2372                                                 osvers=$1
2373                                         fi
2374                                 else
2375                                         case "$osname" in
2376                                         '') : Still unknown.  Probably a generic Sys V.
2377                                                 osname="sysv"
2378                                                 osvers="$3"
2379                                                 ;;
2380                                         esac
2381                                 fi
2382                                 ;;
2383                         esac
2384                         ;;
2385                 *)      case "$osname" in
2386                         '') : Still unknown.  Probably a generic BSD.
2387                                 osname="$1"
2388                                 osvers="$3"
2389                                 ;;
2390                         esac
2391                         ;;
2392                 esac
2393         else
2394                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2395                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2396                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2397                                 osname=news_os
2398                         fi
2399                         $rm -f UU/kernel.what
2400                 elif test -d c:/.; then
2401                         set X $myuname
2402                         osname=os2
2403                         osvers="$5"
2404                 fi
2405         fi
2406         
2407         : Now look for a hint file osname_osvers, unless one has been
2408         : specified already.
2409         case "$hintfile" in
2410         ''|' ')
2411                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2412                 : Also try without trailing minor version numbers.
2413                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2414                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2415                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2416                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2417                 case "$file" in
2418                 '') dflt=none ;;
2419                 *)  case "$osvers" in
2420                         '') dflt=$file
2421                                 ;;
2422                         *)  if $test -f $src/hints/$file.sh ; then
2423                                         dflt=$file
2424                                 elif $test -f $src/hints/$xfile.sh ; then
2425                                         dflt=$xfile
2426                                 elif $test -f $src/hints/$xxfile.sh ; then
2427                                         dflt=$xxfile
2428                                 elif $test -f $src/hints/$xxxfile.sh ; then
2429                                         dflt=$xxxfile
2430                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2431                                         dflt=$xxxxfile
2432                                 elif $test -f "$src/hints/${osname}.sh" ; then
2433                                         dflt="${osname}"
2434                                 else
2435                                         dflt=none
2436                                 fi
2437                                 ;;
2438                         esac
2439                         ;;
2440                 esac
2441                 if $test -f Policy.sh ; then
2442                         case "$dflt" in
2443                         *Policy*) ;;
2444                         none) dflt="Policy" ;;
2445                         *) dflt="Policy $dflt" ;;
2446                         esac
2447                 fi
2448                 ;;
2449         *)
2450                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2451                 ;;
2452         esac
2453
2454         if $test -f Policy.sh ; then
2455                 $cat <<EOM
2456
2457 There's also a Policy hint file available, which should make the
2458 site-specific (policy) questions easier to answer.
2459 EOM
2460
2461         fi
2462
2463         $cat <<EOM
2464
2465 You may give one or more space-separated answers, or "none" if appropriate.
2466 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2467 is a good thing.  DO NOT give a wrong version or a wrong OS.
2468
2469 EOM
2470
2471         rp="Which of these apply, if any?"
2472         . UU/myread
2473         tans=$ans
2474         for file in $tans; do
2475                 if $test X$file = XPolicy -a -f Policy.sh; then
2476                         . Policy.sh
2477                         $cat Policy.sh >> UU/config.sh
2478                 elif $test -f $src/hints/$file.sh; then
2479                         . $src/hints/$file.sh
2480                         $cat $src/hints/$file.sh >> UU/config.sh
2481                 elif $test X$tans = X -o X$tans = Xnone ; then
2482                         : nothing
2483                 else
2484                         : Give one chance to correct a possible typo.
2485                         echo "$file.sh does not exist"
2486                         dflt=$file
2487                         rp="hint to use instead?"
2488                         . UU/myread
2489                         for file in $ans; do
2490                                 if $test -f "$src/hints/$file.sh"; then
2491                                         . $src/hints/$file.sh
2492                                         $cat $src/hints/$file.sh >> UU/config.sh
2493                                 elif $test X$ans = X -o X$ans = Xnone ; then
2494                                         : nothing
2495                                 else
2496                                         echo "$file.sh does not exist -- ignored."
2497                                 fi
2498                         done
2499                 fi
2500         done
2501
2502         hint=recommended
2503         : Remember our hint file for later.
2504         if $test -f "$src/hints/$file.sh" ; then
2505                 hintfile="$file"
2506         else
2507                 hintfile=''
2508         fi
2509 fi
2510 cd UU
2511 ;;
2512 *)
2513         echo " "
2514         echo "Fetching default answers from $config_sh..." >&4
2515         tmp_n="$n"
2516         tmp_c="$c"
2517         cd ..
2518         cp $config_sh config.sh 2>/dev/null
2519         chmod +w config.sh
2520         . ./config.sh
2521         cd UU
2522         cp ../config.sh .
2523         n="$tmp_n"
2524         c="$tmp_c"
2525         hint=previous
2526         ;;
2527 esac
2528 test "$override" && . ./optdef.sh
2529 myuname="$newmyuname"
2530
2531 : Restore computed paths
2532 for file in $loclist $trylist; do
2533         eval $file="\$_$file"
2534 done
2535
2536 cat << EOM
2537
2538 Configure uses the operating system name and version to set some defaults.
2539 The default value is probably right if the name rings a bell. Otherwise,
2540 since spelling matters for me, either accept the default or answer "none"
2541 to leave it blank.
2542
2543 EOM
2544 case "$osname" in
2545         ''|' ')
2546                 case "$hintfile" in
2547                 ''|' '|none) dflt=none ;;
2548                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2549                 esac
2550                 ;;
2551         *) dflt="$osname" ;;
2552 esac
2553 rp="Operating system name?"
2554 . ./myread
2555 case "$ans" in
2556 none)  osname='' ;;
2557 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2558 esac
2559 echo " "
2560 case "$osvers" in
2561         ''|' ')
2562                 case "$hintfile" in
2563                 ''|' '|none) dflt=none ;;
2564                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2565                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2566                         case "$dflt" in
2567                         ''|' ') dflt=none ;;
2568                         esac
2569                         ;;
2570                 esac
2571                 ;;
2572         *) dflt="$osvers" ;;
2573 esac
2574 rp="Operating system version?"
2575 . ./myread
2576 case "$ans" in
2577 none)  osvers='' ;;
2578 *) osvers="$ans" ;;
2579 esac
2580
2581
2582 . ./posthint.sh
2583
2584 : who configured the system
2585 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2586 cf_by=`(logname) 2>/dev/null`
2587 case "$cf_by" in
2588 "")
2589         cf_by=`(whoami) 2>/dev/null`
2590         case "$cf_by" in
2591         "") cf_by=unknown ;;
2592         esac ;;
2593 esac
2594
2595 : set up the script used to warn in case of inconsistency
2596 cat <<EOS >whoa
2597 $startsh
2598 EOS
2599 cat <<'EOSC' >>whoa
2600 dflt=y
2601 echo " "
2602 echo "*** WHOA THERE!!! ***" >&4
2603 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2604 rp="    Keep the $hint value?"
2605 . ./myread
2606 case "$ans" in
2607 y) td=$was; tu=$was;;
2608 esac
2609 EOSC
2610
2611 : function used to set $1 to $val
2612 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2613 case "$val$was" in
2614 $define$undef) . ./whoa; eval "$var=\$td";;
2615 $undef$define) . ./whoa; eval "$var=\$tu";;
2616 *) eval "$var=$val";;
2617 esac'
2618
2619 cat <<EOM
2620
2621 Perl can be built to take advantage of threads, on some systems.
2622 To do so, Configure must be run with -Dusethreads.
2623
2624 Note that threading is a highly experimental feature, and
2625 some known race conditions still remain.  If you choose to try
2626 it, be very sure to not actually deploy it for production
2627 purposes.  README.threads has more details, and is required
2628 reading if you enable threads.
2629 EOM
2630 case "$usethreads" in
2631 $define|true|[yY]*)     dflt='y';;
2632 *) dflt='n';;
2633 esac
2634 rp='Build a threading Perl?'
2635 . ./myread
2636 case "$ans" in
2637 y|Y)    val="$define" ;;     
2638 *)      val="$undef" ;;
2639 esac
2640 set usethreads
2641 eval $setvar 
2642
2643 case "$d_oldpthreads" in
2644 '')     : Configure tests would be welcome here.  For now, assume undef.
2645         val="$undef" ;;
2646 *)      val="$d_oldpthreads" ;;
2647 esac
2648 set d_oldpthreads
2649 eval $setvar
2650
2651
2652 case "$usethreads" in
2653 "$define"|true|[yY]*)
2654 : Look for a hint-file generated 'call-back-unit'.  If the
2655 : user has specified that a threading perl is to be built,
2656 : we may need to set or change some other defaults.
2657         if $test -f usethreads.cbu; then
2658                 echo "Your platform has some specific hints for threaded builds, using them..."
2659                 . ./usethreads.cbu
2660         else
2661                 $cat <<EOM
2662 (Your platform doesn't have any specific hints for threaded builds.
2663  Assuming POSIX threads, then.)
2664 EOM
2665         fi
2666     ;;
2667 esac
2668
2669 cat <<EOM
2670
2671 Perl can be built so that multiple Perl interpreters can coexist
2672 within the same Perl executable.  To do so, Configure must be run with
2673 -Dusemultiplicity.
2674
2675 Normally you do not need this and you should answer no.
2676
2677 EOM
2678 case "$usemultiplicity" in
2679 $define|true|[yY]*)     dflt='y';;
2680 *) dflt='n';;
2681 esac
2682 rp='Build Perl for multiplicity?'
2683 . ./myread
2684 case "$ans" in
2685 y|Y)    val="$define" ;;     
2686 *)      val="$undef" ;;
2687 esac
2688 set usemultiplicity
2689 eval $setvar 
2690
2691 : determine where manual pages are on this system
2692 echo " "
2693 case "$sysman" in
2694 '') 
2695         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2696         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2697         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2698         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2699         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2700         sysman=`./loc . /usr/man/man1 $syspath`
2701         ;;
2702 esac
2703 if $test -d "$sysman"; then
2704         echo "System manual is in $sysman." >&4
2705 else
2706         echo "Could not find manual pages in source form." >&4
2707 fi
2708
2709 : see what memory models we can support
2710 case "$models" in
2711 '')
2712         $cat >pdp11.c <<'EOP'
2713 int main() {
2714 #ifdef pdp11
2715         exit(0);
2716 #else
2717         exit(1);
2718 #endif
2719 }
2720 EOP
2721         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2722         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2723                 dflt='unsplit split'
2724         else
2725                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2726                 case "$tans" in
2727                 X) dflt='none';;
2728                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2729                                 dflt='small'
2730                         else
2731                                 dflt=''
2732                         fi
2733                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2734                                 dflt="$dflt medium"
2735                         fi
2736                         if $test -d /lib/large || $test -d /usr/lib/large; then
2737                                 dflt="$dflt large"
2738                         fi
2739                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2740                                 dflt="$dflt huge"
2741                         fi
2742                 esac
2743         fi;;
2744 *) dflt="$models";;
2745 esac
2746 $cat <<EOM
2747  
2748 Some systems have different model sizes.  On most systems they are called
2749 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2750 split.  If your system doesn't support different memory models, say "none".
2751 If you wish to force everything to one memory model, say "none" here and
2752 put the appropriate flags later when it asks you for other cc and ld flags.
2753 Venix systems may wish to put "none" and let the compiler figure things out.
2754 (In the following question multiple model names should be space separated.)
2755
2756 The default for most systems is "none".
2757
2758 EOM
2759 rp="Which memory models are supported?"
2760 . ./myread
2761 models="$ans"
2762
2763 case "$models" in
2764 none)
2765         small=''
2766         medium=''
2767         large=''
2768         huge=''
2769         unsplit=''
2770         split=''
2771         ;;
2772 *split)
2773         case "$split" in
2774         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2775                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2776                         dflt='-i'
2777                 else
2778                         dflt='none'
2779                 fi;;
2780         *) dflt="$split";;
2781         esac
2782         rp="What flag indicates separate I and D space?"
2783         . ./myread
2784         tans="$ans"
2785         case "$tans" in
2786         none) tans='';;
2787         esac
2788         split="$tans"
2789         unsplit='';;
2790 *large*|*small*|*medium*|*huge*)
2791         case "$models" in
2792         *large*)
2793                 case "$large" in
2794                 '') dflt='-Ml';;
2795                 *) dflt="$large";;
2796                 esac
2797         rp="What flag indicates large model?"
2798         . ./myread
2799         tans="$ans"
2800         case "$tans" in
2801         none) tans='';
2802         esac
2803         large="$tans";;
2804         *) large='';;
2805         esac
2806         case "$models" in
2807         *huge*) case "$huge" in
2808                 '') dflt='-Mh';;
2809                 *) dflt="$huge";;
2810                 esac
2811                 rp="What flag indicates huge model?"
2812                 . ./myread
2813                 tans="$ans"
2814                 case "$tans" in
2815                 none) tans='';
2816                 esac
2817                 huge="$tans";;
2818         *) huge="$large";;
2819         esac
2820         case "$models" in
2821         *medium*) case "$medium" in
2822                 '') dflt='-Mm';;
2823                 *) dflt="$medium";;
2824                 esac
2825                 rp="What flag indicates medium model?"
2826                 . ./myread
2827                 tans="$ans"
2828                 case "$tans" in
2829                 none) tans='';
2830                 esac
2831                 medium="$tans";;
2832         *) medium="$large";;
2833         esac
2834         case "$models" in
2835         *small*) case "$small" in
2836                 '') dflt='none';;
2837                 *) dflt="$small";;
2838                 esac
2839                 rp="What flag indicates small model?"
2840                 . ./myread
2841                 tans="$ans"
2842                 case "$tans" in
2843                 none) tans='';
2844                 esac
2845                 small="$tans";;
2846         *) small='';;
2847         esac
2848         ;;
2849 *)
2850         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2851         ;;
2852 esac
2853 $rm -f pdp11.* pdp11
2854
2855 : make some quick guesses about what we are up against
2856 echo " "
2857 $echo $n "Hmm...  $c"
2858 echo exit 1 >bsd
2859 echo exit 1 >usg
2860 echo exit 1 >v7
2861 echo exit 1 >osf1
2862 echo exit 1 >eunice
2863 echo exit 1 >xenix
2864 echo exit 1 >venix
2865 echo exit 1 >os2
2866 d_bsd="$undef"
2867 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2868 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2869 then
2870         echo "Looks kind of like an OSF/1 system, but we'll see..."
2871         echo exit 0 >osf1
2872 elif test `echo abc | tr a-z A-Z` = Abc ; then
2873         xxx=`./loc addbib blurfl $pth`
2874         if $test -f $xxx; then
2875         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2876                 echo exit 0 >bsd
2877                 echo exit 0 >usg
2878         else
2879                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2880                         echo "Looks kind of like an extended USG system, but we'll see..."
2881                 else
2882                         echo "Looks kind of like a USG system, but we'll see..."
2883                 fi
2884                 echo exit 0 >usg
2885         fi
2886 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2887         echo "Looks kind of like a BSD system, but we'll see..."
2888         d_bsd="$define"
2889         echo exit 0 >bsd
2890 else
2891         echo "Looks kind of like a Version 7 system, but we'll see..."
2892         echo exit 0 >v7
2893 fi
2894 case "$eunicefix" in
2895 *unixtovms*)
2896         $cat <<'EOI'
2897 There is, however, a strange, musty smell in the air that reminds me of
2898 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2899 EOI
2900         echo exit 0 >eunice
2901         d_eunice="$define"
2902 : it so happens the Eunice I know will not run shell scripts in Unix format
2903         ;;
2904 *)
2905         echo " "
2906         echo "Congratulations.  You aren't running Eunice."
2907         d_eunice="$undef"
2908         ;;
2909 esac
2910 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2911 case "$p_" in
2912 :) ;;
2913 *)
2914         $cat <<'EOI'
2915 I have the feeling something is not exactly right, however...don't tell me...
2916 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2917 EOI
2918         echo exit 0 >os2
2919         ;;
2920 esac
2921 if test -f /xenix; then
2922         echo "Actually, this looks more like a XENIX system..."
2923         echo exit 0 >xenix
2924         d_xenix="$define"
2925 else
2926         echo " "
2927         echo "It's not Xenix..."
2928         d_xenix="$undef"
2929 fi
2930 chmod +x xenix
2931 $eunicefix xenix
2932 if test -f /venix; then
2933         echo "Actually, this looks more like a VENIX system..."
2934         echo exit 0 >venix
2935 else
2936         echo " "
2937         if ./xenix; then
2938                 : null
2939         else
2940                 echo "Nor is it Venix..."
2941         fi
2942 fi
2943 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2944 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2945 $rm -f foo
2946
2947 : see if we need a special compiler
2948 echo " "
2949 if ./usg; then
2950         case "$cc" in
2951         '') case "$Mcc" in
2952                 /*) dflt='Mcc';;
2953                 *) case "$large" in
2954                         -M*) dflt='cc';;
2955                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2956                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2957                                                 dflt='cc'
2958                                         else
2959                                                 dflt='cc -M'
2960                                         fi
2961                                 else
2962                                         dflt='cc'
2963                                 fi;;
2964                         esac;;
2965                 esac;;
2966         *)  dflt="$cc";;
2967         esac
2968         case "$dflt" in
2969         *M*)    $cat <<'EOM'
2970 On some older systems the default C compiler will not resolve multiple global
2971 references that happen to have the same name.  On some such systems the "Mcc"
2972 command may be used to force these to be resolved.  On other systems a "cc -M"
2973 command is required.  (Note that the -M flag on other systems indicates a
2974 memory model to use!) If you have the Gnu C compiler, you might wish to use
2975 that instead.
2976
2977 EOM
2978         ;;
2979         esac
2980         rp="Use which C compiler?"
2981         . ./myread
2982         cc="$ans"
2983 else
2984         case "$cc" in
2985         '') dflt=cc;;
2986         *) dflt="$cc";;
2987         esac
2988         rp="Use which C compiler?"
2989         . ./myread
2990         cc="$ans"
2991 fi
2992 : Look for a hint-file generated 'call-back-unit'.  Now that the
2993 : user has specified the compiler, we may need to set or change some
2994 : other defaults.
2995 if $test -f cc.cbu; then
2996     . ./cc.cbu
2997 fi
2998 echo " "
2999 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3000 $cat >gccvers.c <<EOM
3001 #include <stdio.h>
3002 int main() {
3003 #ifdef __GNUC__
3004 #ifdef __VERSION__
3005         printf("%s\n", __VERSION__);
3006 #else
3007         printf("%s\n", "1");
3008 #endif
3009 #endif
3010         exit(0);
3011 }
3012 EOM
3013 if $cc -o gccvers gccvers.c; then
3014         gccversion=`./gccvers`
3015         case "$gccversion" in
3016         '') echo "You are not using GNU cc." ;;
3017         *)  echo "You are using GNU cc $gccversion." ;;
3018         esac
3019 else
3020         echo " "
3021         echo "*** WHOA THERE!!! ***" >&4
3022         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3023         case "$knowitall" in
3024         '')
3025         echo "    You'd better start hunting for one and let me know about it." >&4
3026                 exit 1
3027                 ;;
3028         esac
3029 fi
3030 $rm -f gccvers*
3031 case "$gccversion" in
3032 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3033 esac
3034
3035
3036 case "$usemorebits" in
3037 "$define"|true|[yY]*)
3038         use64bits="$define"
3039         uselongdouble="$define"
3040         usemorebits="$define"
3041         ;;
3042 *)      usemorebits="$undef"
3043         ;;
3044 esac
3045
3046
3047 cat <<EOM
3048
3049 Perl can be built to understand large files (files larger than 2 gigabytes)
3050 on some systems.  To do so, Configure must be run with -Duselargefiles.
3051
3052 If this doesn't make any sense to you, just accept the default.
3053 EOM
3054 case "$uselargefiles" in
3055 "$define"|true|[yY]*) dflt='y' ;;
3056 *)      dflt='n' ;;
3057 esac
3058 rp='Try to understand large files?'
3059 . ./myread
3060 case "$ans" in
3061 y|Y)    val="$define" ;;
3062 *)      val="$undef"  ;;
3063 esac
3064 set uselargefiles
3065 eval $setvar
3066 case "$uselargefiles" in
3067 "$define") use64bits="$define" ;;
3068 esac
3069
3070 cat <<EOM
3071
3072 Perl can be built to take advantage of explicit 64-bit interfaces,
3073 on some systems.  To do so, Configure must be run with -Duse64bits.
3074
3075 If this doesn't make any sense to you, just accept the default.
3076 EOM
3077 case "$use64bits" in
3078 $define|true|[yY]*)     dflt='y';;
3079 *) dflt='n';;
3080 esac
3081 rp='Try to use explicit 64-bit interfaces, if available?'
3082 . ./myread
3083 case "$ans" in
3084 y|Y) 
3085         val="$define"
3086         ;;     
3087 *)      
3088         val="$undef"
3089         ;;
3090 esac
3091 set use64bits
3092 eval $setvar
3093
3094 case "$archname64" in
3095 '') archname64='' ;;    # not a typo
3096 esac
3097
3098 case "$use64bits" in
3099 "$define"|true|[yY]*)
3100 : Look for a hint-file generated 'call-back-unit'.  If the
3101 : user has specified that a 64 bit perl is to be built,
3102 : we may need to set or change some other defaults.
3103         if $test -f use64bits.cbu; then
3104                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3105                 . ./use64bits.cbu
3106         else
3107                 $cat <<EOM
3108 (Your platform doesn't have any specific hints for 64-bit builds.
3109  This is probably okay, especially if your system is a true 64-bit system.)
3110 EOM
3111                 case "$gccversion" in
3112                 '')     ;;
3113                 *)      $cat <<EOM
3114 But since you seem to be using gcc,
3115 I will now add -DUSE_LONG_LONG to the compilation flags.
3116 EOM
3117                         ccflags="$ccflags -DUSE_LONG_LONG"
3118                         ;;
3119                 esac
3120         fi
3121         ;;
3122 esac
3123
3124 : determine the architecture name
3125 echo " "
3126 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3127         tarch=`arch`"-$osname"
3128 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3129         if uname -m > tmparch 2>&1 ; then
3130                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3131                         -e 's/$/'"-$osname/" tmparch`
3132         else
3133                 tarch="$osname"
3134         fi
3135         $rm -f tmparch
3136 else
3137         tarch="$osname"
3138 fi
3139 case "$myarchname" in
3140 ''|"$tarch") ;;
3141 *)
3142         echo "(Your architecture name used to be $myarchname.)"
3143         archname=''
3144         ;;
3145 esac
3146 myarchname="$tarch"
3147 case "$archname" in
3148 '') dflt="$tarch";;
3149 *) dflt="$archname";;
3150 esac
3151 rp='What is your architecture name'
3152 . ./myread
3153 archname="$ans"
3154 case "$usethreads" in
3155 $define)
3156         echo "Threads selected." >&4
3157         case "$archname" in
3158         *-thread*) echo "...and architecture name already has -thread." >&4
3159                 ;;
3160         *)      archname="$archname-thread"
3161                 echo "...setting architecture name to $archname." >&4
3162                 ;;
3163         esac
3164         ;;
3165 esac
3166 case "$usemultiplicity" in
3167 $define)
3168         echo "Multiplicity selected." >&4
3169         case "$archname" in
3170         *-multi*) echo "...and architecture name already has -multi." >&4
3171                 ;;
3172         *)      archname="$archname-multi"
3173                 echo "...setting architecture name to $archname." >&4
3174                 ;;
3175         esac
3176         ;;
3177 esac
3178 case "$use64bits" in
3179 $define)
3180         echo "Explicit 64-bitness selected." >&4
3181         case "$archname64" in
3182         '')
3183                 ;;
3184         *)
3185                 case "$archname" in
3186                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3187                         ;;
3188                 *)      archname="$archname-$archname64"
3189                         echo "...setting architecture name to $archname." >&4
3190                         ;;
3191                 esac
3192                 ;;
3193         esac
3194 esac
3195
3196 : decide how portable to be.  Allow command line overrides.
3197 case "$d_portable" in
3198 "$undef") ;;
3199 *)      d_portable="$define" ;;
3200 esac
3201
3202 : set up shell script to do ~ expansion
3203 cat >filexp <<EOSS
3204 $startsh
3205 : expand filename
3206 case "\$1" in
3207  ~/*|~)
3208         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3209         ;;
3210  ~*)
3211         if $test -f /bin/csh; then
3212                 /bin/csh -f -c "glob \$1"
3213                 failed=\$?
3214                 echo ""
3215                 exit \$failed
3216         else
3217                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3218                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3219                 if $test ! -d "\$dir"; then
3220                         me=\`basename \$0\`
3221                         echo "\$me: can't locate home directory for: \$name" >&2
3222                         exit 1
3223                 fi
3224                 case "\$1" in
3225                 */*)
3226                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3227                         ;;
3228                 *)
3229                         echo \$dir
3230                         ;;
3231                 esac
3232         fi
3233         ;;
3234 *)
3235         echo \$1
3236         ;;
3237 esac
3238 EOSS
3239 chmod +x filexp
3240 $eunicefix filexp
3241
3242 : now set up to get a file name
3243 cat <<EOS >getfile
3244 $startsh
3245 EOS
3246 cat <<'EOSC' >>getfile
3247 tilde=''
3248 fullpath=''
3249 already=''
3250 skip=''
3251 none_ok=''
3252 exp_file=''
3253 nopath_ok=''
3254 orig_rp="$rp"
3255 orig_dflt="$dflt"
3256 case "$gfpth" in
3257 '') gfpth='.' ;;
3258 esac
3259
3260 case "$fn" in
3261 *\(*)
3262         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3263         fn=`echo $fn | sed 's/(.*)//'`
3264         ;;
3265 esac
3266
3267 case "$fn" in
3268 *:*)
3269         loc_file=`expr $fn : '.*:\(.*\)'`
3270         fn=`expr $fn : '\(.*\):.*'`
3271         ;;
3272 esac
3273
3274 case "$fn" in
3275 *~*) tilde=true;;
3276 esac
3277 case "$fn" in
3278 */*) fullpath=true;;
3279 esac
3280 case "$fn" in
3281 *+*) skip=true;;
3282 esac
3283 case "$fn" in
3284 *n*) none_ok=true;;
3285 esac
3286 case "$fn" in
3287 *e*) exp_file=true;;
3288 esac
3289 case "$fn" in
3290 *p*) nopath_ok=true;;
3291 esac
3292
3293 case "$fn" in
3294 *f*) type='File';;
3295 *d*) type='Directory';;
3296 *l*) type='Locate';;
3297 esac
3298
3299 what="$type"
3300 case "$what" in
3301 Locate) what='File';;
3302 esac
3303
3304 case "$exp_file" in
3305 '')
3306         case "$d_portable" in
3307         "$define") ;;
3308         *) exp_file=true;;
3309         esac
3310         ;;
3311 esac
3312
3313 cd ..
3314 while test "$type"; do
3315         redo=''
3316         rp="$orig_rp"
3317         dflt="$orig_dflt"
3318         case "$tilde" in
3319         true) rp="$rp (~name ok)";;
3320         esac
3321         . UU/myread
3322         if test -f UU/getfile.ok && \
3323                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3324         then
3325                 value="$ans"
3326                 ansexp="$ans"
3327                 break
3328         fi
3329         case "$ans" in
3330         none)
3331                 value=''
3332                 ansexp=''
3333                 case "$none_ok" in
3334                 true) type='';;
3335                 esac
3336                 ;;
3337         *)
3338                 case "$tilde" in
3339                 '') value="$ans"
3340                         ansexp="$ans";;
3341                 *)
3342                         value=`UU/filexp $ans`
3343                         case $? in
3344                         0)
3345                                 if test "$ans" != "$value"; then
3346                                         echo "(That expands to $value on this system.)"
3347                                 fi
3348                                 ;;
3349                         *) value="$ans";;
3350                         esac
3351                         ansexp="$value"
3352                         case "$exp_file" in
3353                         '') value="$ans";;
3354                         esac
3355                         ;;
3356                 esac
3357                 case "$fullpath" in
3358                 true)
3359                         case "$ansexp" in
3360                         /*) value="$ansexp" ;;
3361                         *)
3362                                 redo=true
3363                                 case "$already" in
3364                                 true)
3365                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3366                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3367                                         ;;
3368                                 *)
3369                                 echo "Please give a full path name, starting with slash." >&4
3370                                         case "$tilde" in
3371                                         true)
3372                                 echo "Note that using ~name is ok provided it expands well." >&4
3373                                                 already=true
3374                                                 ;;
3375                                         esac
3376                                 esac
3377                                 ;;
3378                         esac
3379                         ;;
3380                 esac
3381                 case "$redo" in
3382                 '')
3383                         case "$type" in
3384                         File)
3385                                 for fp in $gfpth; do
3386                                         if test "X$fp" = X.; then
3387                                             pf="$ansexp"
3388                                         else    
3389                                             pf="$fp/$ansexp"
3390                                         fi
3391                                         if test -f "$pf"; then
3392                                                 type=''
3393                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3394                                         then
3395                                                 echo "($value is not a plain file, but that's ok.)"
3396                                                 type=''
3397                                         fi
3398                                         if test X"$type" = X; then
3399                                             value="$pf"
3400                                             break
3401                                         fi
3402                                 done
3403                                 ;;
3404                         Directory)
3405                                 for fp in $gfpth; do
3406                                         if test "X$fp" = X.; then
3407                                             pf="$ansexp"
3408                                         else    
3409                                             pf="$fp/$ansexp"
3410                                         fi
3411                                         if test -d "$pf"; then
3412                                                 type=''
3413                                                 value="$pf"
3414                                                 break
3415                                         fi
3416                                 done
3417                                 ;;
3418                         Locate)
3419                                 if test -d "$ansexp"; then
3420                                         echo "(Looking for $loc_file in directory $value.)"
3421                                         value="$value/$loc_file"
3422                                         ansexp="$ansexp/$loc_file"
3423                                 fi
3424                                 if test -f "$ansexp"; then
3425                                         type=''
3426                                 fi
3427                                 case "$nopath_ok" in
3428                                 true)   case "$value" in
3429                                         */*) ;;
3430                                         *)      echo "Assuming $value will be in people's path."
3431                                                 type=''
3432                                                 ;;
3433                                         esac
3434                                         ;;
3435                                 esac
3436                                 ;;
3437                         esac
3438
3439                         case "$skip" in
3440                         true) type='';
3441                         esac
3442
3443                         case "$type" in
3444                         '') ;;
3445                         *)
3446                                 if test "$fastread" = yes; then
3447                                         dflt=y
3448                                 else
3449                                         dflt=n
3450                                 fi
3451                                 rp="$what $value doesn't exist.  Use that name anyway?"
3452                                 . UU/myread
3453                                 dflt=''
3454                                 case "$ans" in
3455                                 y*) type='';;
3456                                 *) echo " ";;
3457                                 esac
3458                                 ;;
3459                         esac
3460                         ;;
3461                 esac
3462                 ;;
3463         esac
3464 done
3465 cd UU
3466 ans="$value"
3467 rp="$orig_rp"
3468 dflt="$orig_dflt"
3469 rm -f getfile.ok
3470 test "X$gfpthkeep" != Xy && gfpth=""
3471 EOSC
3472
3473 : determine root of directory hierarchy where package will be installed.
3474 case "$prefix" in
3475 '')
3476         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3477         ;;
3478 *)
3479         dflt="$prefix"
3480         ;;
3481 esac
3482 $cat <<EOM
3483
3484 By default, $package will be installed in $dflt/bin, manual pages
3485 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3486 installation directories. Typically this is something like /usr/local.
3487 If you wish to have binaries under /usr/bin but other parts of the
3488 installation under /usr/local, that's ok: you will be prompted
3489 separately for each of the installation directories, the prefix being
3490 only used to set the defaults.
3491
3492 EOM
3493 fn=d~
3494 rp='Installation prefix to use?'
3495 . ./getfile
3496 oldprefix=''
3497 case "$prefix" in
3498 '') ;;
3499 *)
3500         case "$ans" in
3501         "$prefix") ;;
3502         *) oldprefix="$prefix";;
3503         esac
3504         ;;
3505 esac
3506 prefix="$ans"
3507 prefixexp="$ansexp"
3508
3509 : is AFS running?
3510 echo " "
3511 case "$afs" in
3512 $define|true)   afs=true ;;
3513 $undef|false)   afs=false ;;
3514 *)      if test -d /afs; then
3515                 afs=true
3516         else
3517                 afs=false
3518         fi
3519         ;;
3520 esac
3521 if $afs; then
3522         echo "AFS may be running... I'll be extra cautious then..." >&4
3523 else
3524         echo "AFS does not seem to be running..." >&4
3525 fi
3526
3527 : determine installation prefix for where package is to be installed.
3528 if $afs; then 
3529 $cat <<EOM
3530
3531 Since you are running AFS, I need to distinguish the directory in which
3532 files will reside from the directory in which they are installed (and from
3533 which they are presumably copied to the former directory by occult means).
3534
3535 EOM
3536         case "$installprefix" in
3537         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3538         *) dflt="$installprefix";;
3539         esac
3540 else
3541 $cat <<EOM
3542
3543 In some special cases, particularly when building $package for distribution,
3544 it is convenient to distinguish between the directory in which files should 
3545 be installed from the directory ($prefix) in which they 
3546 will eventually reside.  For most users, these two directories are the same.
3547
3548 EOM
3549         case "$installprefix" in
3550         '') dflt=$prefix ;;
3551         *) dflt=$installprefix;;
3552         esac
3553 fi
3554 fn=d~
3555 rp='What installation prefix should I use for installing files?'
3556 . ./getfile
3557 installprefix="$ans"
3558 installprefixexp="$ansexp"
3559
3560 : set the prefixit variable, to compute a suitable default value
3561 prefixit='case "$3" in
3562 ""|none)
3563         case "$oldprefix" in
3564         "") eval "$1=\"\$$2\"";;
3565         *)
3566                 case "$3" in
3567                 "") eval "$1=";;
3568                 none)
3569                         eval "tp=\"\$$2\"";
3570                         case "$tp" in
3571                         ""|" ") eval "$1=\"\$$2\"";;
3572                         *) eval "$1=";;
3573                         esac;;
3574                 esac;;
3575         esac;;
3576 *)
3577         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3578         case "$tp" in
3579         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3580         /*-$oldprefix/*|\~*-$oldprefix/*)
3581                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3582         *) eval "$1=\"\$$2\"";;
3583         esac;;
3584 esac'
3585
3586 : set the base revision
3587 baserev=5.0
3588
3589 : get the patchlevel
3590 echo " "
3591 echo "Getting the current patchlevel..." >&4
3592 if $test -r $rsrc/patchlevel.h;then
3593         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3594         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3595         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3596 else
3597         patchlevel=0
3598         subversion=0
3599         apiversion=0
3600 fi
3601 $echo $n "(You have $package" $c
3602 case "$package" in
3603 "*$baserev")    ;;
3604 *)              $echo $n " $baserev" $c ;;
3605 esac
3606 $echo $n " patchlevel $patchlevel" $c
3607 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3608 echo ".)"
3609
3610 if test 0 -eq "$subversion"; then
3611         version=`LC_ALL=C; export LC_ALL; \
3612                  echo $baserev $patchlevel | \
3613                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3614 else
3615         version=`LC_ALL=C; export LC_ALL; \
3616                  echo $baserev $patchlevel $subversion | \
3617                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3618 fi
3619
3620 : determine installation style
3621 : For now, try to deduce it from prefix unless it is already set.
3622 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3623 case "$installstyle" in
3624 '')     case "$prefix" in
3625                 *perl*) dflt='lib';;
3626                 *) dflt='lib/perl5' ;;
3627         esac
3628         ;;
3629 *)      dflt='lib/perl5' ;;
3630 esac
3631 : Probably not worth prompting for this since we prompt for all
3632 : the directories individually, and the prompt would be too long and
3633 : confusing anyway.
3634 installstyle=$dflt
3635
3636 : determine where private library files go
3637 : Usual default is /usr/local/lib/perl5/$version.
3638 : Also allow things like /opt/perl/lib/$version, since 
3639 : /opt/perl/lib/perl5... would be redundant.
3640 : The default "style" setting is made in installstyle.U
3641 case "$installstyle" in
3642 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3643 *)       set dflt privlib lib/$version ;;
3644 esac
3645 eval $prefixit
3646 $cat <<EOM
3647
3648 There are some auxiliary files for $package that need to be put into a
3649 private library directory that is accessible by everyone.
3650
3651 EOM
3652 fn=d~+
3653 rp='Pathname where the private library files will reside?'
3654 . ./getfile
3655 privlib="$ans"
3656 privlibexp="$ansexp"
3657 : Change installation prefix, if necessary.
3658 if $test X"$prefix" != X"$installprefix"; then
3659         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3660 else
3661         installprivlib="$privlibexp"
3662 fi
3663
3664 : set the prefixup variable, to restore leading tilda escape
3665 prefixup='case "$prefixexp" in
3666 "$prefix") ;;
3667 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3668 esac'
3669
3670 : determine where public architecture dependent libraries go
3671 set archlib archlib
3672 eval $prefixit
3673 : privlib default is /usr/local/lib/$package/$version
3674 : archlib default is /usr/local/lib/$package/$version/$archname
3675 : privlib may have an optional trailing /share.
3676 tdflt=`echo $privlib | $sed 's,/share$,,'`
3677 tdflt=$tdflt/$archname
3678 case "$archlib" in
3679 '')     dflt=$tdflt
3680         ;;
3681 *)      dflt="$archlib"
3682     ;;
3683 esac
3684 $cat <<EOM
3685
3686 $spackage contains architecture-dependent library files.  If you are
3687 sharing libraries in a heterogeneous environment, you might store
3688 these files in a separate location.  Otherwise, you can just include
3689 them with the rest of the public library files.
3690
3691 EOM
3692 fn=d+~
3693 rp='Where do you want to put the public architecture-dependent libraries?'
3694 . ./getfile
3695 archlib="$ans"
3696 archlibexp="$ansexp"
3697 if $test X"$archlib" = X"$privlib"; then
3698         d_archlib="$undef"
3699 else
3700         d_archlib="$define"
3701 fi
3702 : Change installation prefix, if necessary.
3703 if $test X"$prefix" != X"$installprefix"; then
3704         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3705 else
3706         installarchlib="$archlibexp"
3707 fi
3708
3709
3710 : Binary compatibility with 5.005 is not possible for builds
3711 : with advanced features
3712 case "$usethreads$usemultiplicity" in
3713 *define*)
3714         bincompat5005="$undef"
3715         d_bincompat5005="$undef"
3716         ;;
3717 *)      $cat <<EOM
3718
3719 Perl 5.006 can be compiled for binary compatibility with 5.005.
3720 If you decide to do so, you will be able to continue using most
3721 of the extensions that were compiled for Perl 5.005.
3722
3723 EOM
3724         case "$bincompat5005$d_bincompat5005" in
3725         *"$undef"*) dflt=n ;;
3726         *) dflt=y ;;
3727         esac
3728         rp='Binary compatibility with Perl 5.005?'
3729         . ./myread
3730         case "$ans" in
3731         y*) val="$define" ;;
3732         *)  val="$undef" ;;
3733         esac
3734         set d_bincompat5005
3735         eval $setvar
3736         case "$d_bincompat5005" in
3737         "$define")
3738                 bincompat5005="$define"
3739                 ;;
3740         *)      bincompat5005="$undef"
3741                 d_bincompat5005="$undef"
3742                 ;;
3743         esac
3744         ;;
3745 esac
3746
3747
3748 : see if setuid scripts can be secure
3749 $cat <<EOM
3750
3751 Some kernels have a bug that prevents setuid #! scripts from being
3752 secure.  Some sites have disabled setuid #! scripts because of this.
3753
3754 First let's decide if your kernel supports secure setuid #! scripts.
3755 (If setuid #! scripts would be secure but have been disabled anyway,
3756 don't say that they are secure if asked.)
3757
3758 EOM
3759
3760 val="$undef"
3761 if $test -d /dev/fd; then
3762         echo "#!$ls" >reflect
3763         chmod +x,u+s reflect
3764         ./reflect >flect 2>&1
3765         if $contains "/dev/fd" flect >/dev/null; then
3766                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3767                 val="$define"
3768         else
3769                 $cat <<EOM
3770 If you are not sure if they are secure, I can check but I'll need a
3771 username and password different from the one you are using right now.
3772 If you don't have such a username or don't want me to test, simply
3773 enter 'none'.
3774
3775 EOM
3776                 rp='Other username to test security of setuid scripts with?'
3777                 dflt='none'
3778                 . ./myread
3779                 case "$ans" in
3780                 n|none)
3781                         case "$d_suidsafe" in
3782                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3783                                 dflt=n;;
3784                         "$undef")
3785                                 echo "Well, the $hint value is *not* secure." >&4
3786                                 dflt=n;;
3787                         *)      echo "Well, the $hint value *is* secure." >&4
3788                                 dflt=y;;
3789                         esac
3790                         ;;
3791                 *)
3792                         $rm -f reflect flect
3793                         echo "#!$ls" >reflect
3794                         chmod +x,u+s reflect
3795                         echo >flect
3796                         chmod a+w flect
3797                         echo '"su" will (probably) prompt you for '"$ans's password."
3798                         su $ans -c './reflect >flect'
3799                         if $contains "/dev/fd" flect >/dev/null; then
3800                                 echo "Okay, it looks like setuid scripts are secure." >&4
3801                                 dflt=y
3802                         else
3803                                 echo "I don't think setuid scripts are secure." >&4
3804                                 dflt=n
3805                         fi
3806                         ;;
3807                 esac
3808                 rp='Does your kernel have *secure* setuid scripts?'
3809                 . ./myread
3810                 case "$ans" in
3811                 [yY]*)  val="$define";;
3812                 *)      val="$undef";;
3813                 esac
3814         fi
3815 else
3816         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3817         echo "(That's for file descriptors, not floppy disks.)"
3818         val="$undef"
3819 fi
3820 set d_suidsafe
3821 eval $setvar
3822
3823 $rm -f reflect flect
3824
3825 : now see if they want to do setuid emulation
3826 echo " "
3827 val="$undef"
3828 case "$d_suidsafe" in
3829 "$define")
3830         val="$undef"
3831         echo "No need to emulate SUID scripts since they are secure here." >& 4
3832         ;;
3833 *)
3834         $cat <<EOM
3835 Some systems have disabled setuid scripts, especially systems where
3836 setuid scripts cannot be secure.  On systems where setuid scripts have
3837 been disabled, the setuid/setgid bits on scripts are currently
3838 useless.  It is possible for $package to detect those bits and emulate
3839 setuid/setgid in a secure fashion.  This emulation will only work if
3840 setuid scripts have been disabled in your kernel.
3841
3842 EOM
3843         case "$d_dosuid" in
3844         "$define") dflt=y ;;
3845         *) dflt=n ;;
3846         esac
3847         rp="Do you want to do setuid/setgid emulation?"
3848         . ./myread
3849         case "$ans" in
3850         [yY]*)  val="$define";;
3851         *)      val="$undef";;
3852         esac
3853         ;;
3854 esac
3855 set d_dosuid
3856 eval $setvar
3857
3858 : What should the include directory be ?
3859 echo " "
3860 $echo $n "Hmm...  $c"
3861 dflt='/usr/include'
3862 incpath=''
3863 mips_type=''
3864 if $test -f /bin/mips && /bin/mips; then
3865         echo "Looks like a MIPS system..."
3866         $cat >usr.c <<'EOCP'
3867 #ifdef SYSTYPE_BSD43
3868 /bsd43
3869 #endif
3870 EOCP
3871         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3872                 dflt='/bsd43/usr/include'
3873                 incpath='/bsd43'
3874                 mips_type='BSD 4.3'
3875         else
3876                 mips_type='System V'
3877         fi
3878         $rm -f usr.c usr.out
3879         echo "and you're compiling with the $mips_type compiler and libraries."
3880         xxx_prompt=y
3881         echo "exit 0" >mips
3882 else
3883         echo "Doesn't look like a MIPS system."
3884         xxx_prompt=n
3885         echo "exit 1" >mips
3886 fi
3887 chmod +x mips
3888 $eunicefix mips
3889 case "$usrinc" in
3890 '') ;;
3891 *) dflt="$usrinc";;
3892 esac
3893 case "$xxx_prompt" in
3894 y)      fn=d/
3895         echo " "
3896         rp='Where are the include files you want to use?'
3897         . ./getfile
3898         usrinc="$ans"
3899         ;;
3900 *)      usrinc="$dflt"
3901         ;;
3902 esac
3903
3904 : see how we invoke the C preprocessor
3905 echo " "
3906 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3907 cat <<'EOT' >testcpp.c
3908 #define ABC abc
3909 #define XYZ xyz
3910 ABC.XYZ
3911 EOT
3912 cd ..
3913 if test ! -f cppstdin; then
3914         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3915                 # AIX cc -E doesn't show the absolute headerfile
3916                 # locations but we'll cheat by using the -M flag.
3917                 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
3918         else
3919                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3920         fi
3921 else
3922         echo "Keeping your $hint cppstdin wrapper."
3923 fi
3924 chmod 755 cppstdin
3925 wrapper=`pwd`/cppstdin
3926 ok='false'
3927 cd UU
3928
3929 if $test "X$cppstdin" != "X" && \
3930         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3931         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3932 then
3933         echo "You used to use $cppstdin $cppminus so we'll use that again."
3934         case "$cpprun" in
3935         '') echo "But let's see if we can live without a wrapper..." ;;
3936         *)
3937                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3938                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3939                 then
3940                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3941                         ok='true'
3942                 else
3943                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3944                 fi
3945                 ;;
3946         esac
3947 else
3948         case "$cppstdin" in
3949         '') ;;
3950         *)
3951                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3952                 ;;
3953         esac
3954 fi
3955
3956 if $ok; then
3957         : nothing
3958 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3959         $cc -E <testcpp.c >testcpp.out 2>&1; \
3960         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3961         echo "Yup, it does."
3962         x_cpp="$cc -E"
3963         x_minus='';
3964 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3965         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3966         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3967         echo "Yup, it does."
3968         x_cpp="$cc -E"
3969         x_minus='-';
3970 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3971         $cc -P <testcpp.c >testcpp.out 2>&1; \
3972         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3973         echo "Yipee, that works!"
3974         x_cpp="$cc -P"
3975         x_minus='';
3976 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3977         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3978         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3979         echo "At long last!"
3980         x_cpp="$cc -P"
3981         x_minus='-';
3982 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3983         $cpp <testcpp.c >testcpp.out 2>&1; \
3984         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3985         echo "It works!"
3986         x_cpp="$cpp"
3987         x_minus='';
3988 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3989         $cpp - <testcpp.c >testcpp.out 2>&1; \
3990         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3991         echo "Hooray, it works!  I was beginning to wonder."
3992         x_cpp="$cpp"
3993         x_minus='-';
3994 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3995         $wrapper <testcpp.c >testcpp.out 2>&1; \
3996         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3997         x_cpp="$wrapper"
3998         x_minus=''
3999         echo "Eureka!"
4000 else
4001         dflt=''
4002         rp="No dice.  I can't find a C preprocessor.  Name one:"
4003         . ./myread
4004         x_cpp="$ans"
4005         x_minus=''
4006         $x_cpp <testcpp.c >testcpp.out 2>&1
4007         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4008                 echo "OK, that will do." >&4
4009         else
4010 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4011                 exit 1
4012         fi
4013 fi
4014
4015 case "$ok" in
4016 false)
4017         cppstdin="$x_cpp"
4018         cppminus="$x_minus"
4019         cpprun="$x_cpp"
4020         cpplast="$x_minus"
4021         set X $x_cpp
4022         shift
4023         case "$1" in
4024         "$cpp")
4025                 echo "Perhaps can we force $cc -E using a wrapper..."
4026                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4027                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4028                 then
4029                         echo "Yup, we can."
4030                         cppstdin="$wrapper"
4031                         cppminus='';
4032                 else
4033                         echo "Nope, we'll have to live without it..."
4034                 fi
4035                 ;;
4036         esac
4037         case "$cpprun" in
4038         "$wrapper")
4039                 cpprun=''
4040                 cpplast=''
4041                 ;;
4042         esac
4043         ;;
4044 esac
4045
4046 case "$cppstdin" in
4047 "$wrapper"|'cppstdin') ;;
4048 *) $rm -f $wrapper;;
4049 esac
4050 $rm -f testcpp.c testcpp.out
4051
4052 : Set private lib path
4053 case "$plibpth" in
4054 '') if ./mips; then
4055                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4056         fi;;
4057 esac
4058 case "$libpth" in
4059 ' ') dlist='';;
4060 '') dlist="$loclibpth $plibpth $glibpth";;
4061 *) dlist="$libpth";;
4062 esac
4063
4064 : Now check and see which directories actually exist, avoiding duplicates
4065 libpth=''
4066 for xxx in $dlist
4067 do
4068     if $test -d $xxx; then
4069                 case " $libpth " in
4070                 *" $xxx "*) ;;
4071                 *) libpth="$libpth $xxx";;
4072                 esac
4073     fi
4074 done
4075 $cat <<'EOM'
4076
4077 Some systems have incompatible or broken versions of libraries.  Among
4078 the directories listed in the question below, please remove any you
4079 know not to be holding relevant libraries, and add any that are needed.
4080 Say "none" for none.
4081
4082 EOM
4083 case "$libpth" in
4084 '') dflt='none';;
4085 *)
4086         set X $libpth
4087         shift
4088         dflt=${1+"$@"}
4089         ;;
4090 esac
4091 rp="Directories to use for library searches?"
4092 . ./myread
4093 case "$ans" in
4094 none) libpth=' ';;
4095 *) libpth="$ans";;
4096 esac
4097
4098 : compute shared library extension
4099 case "$so" in
4100 '')
4101         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4102                 dflt='sl'
4103         else
4104                 dflt='so'
4105         fi
4106         ;;
4107 *) dflt="$so";;
4108 esac
4109 $cat <<EOM
4110
4111 On some systems, shared libraries may be available.  Answer 'none' if
4112 you want to suppress searching of shared libraries for the remaining
4113 of this configuration.
4114
4115 EOM
4116 rp='What is the file extension used for shared libraries?'
4117 . ./myread
4118 so="$ans"
4119
4120 : Define several unixisms.
4121 : Hints files or command line option can be used to override them.
4122 : The convoluted testing is in case hints files set either the old
4123 : or the new name.
4124 case "$_exe" in
4125 '')     case "$exe_ext" in
4126     '') ;;
4127         *)      _exe="$exe_ext" ;;
4128         esac
4129         ;;
4130 esac
4131 case "$_a" in
4132 '')     case "$lib_ext" in
4133     '') _a='.a';;
4134         *)      _a="$lib_ext" ;;
4135         esac
4136         ;;
4137 esac
4138 case "$_o" in
4139 '') case "$obj_ext" in
4140         '')     _o='.o';;
4141         *)      _o="$obj_ext";;
4142         esac
4143         ;;
4144 esac
4145 case "$p_" in
4146 '') case "$path_sep" in
4147         '')     p_=':';;
4148         *)      p_="$path_sep";;
4149         esac
4150         ;;
4151 esac
4152 exe_ext=$_exe
4153 lib_ext=$_a
4154 obj_ext=$_o
4155 path_sep=$p_
4156
4157 : Which makefile gets called first.  This is used by make depend.
4158 case "$firstmakefile" in
4159 '') firstmakefile='makefile';;
4160 esac
4161
4162 cat <<EOM
4163
4164 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4165 Configure must be run with -Dusesocks.
4166
4167 Normally you do not need this and you should answer no.
4168
4169 EOM
4170 case "$usesocks" in
4171 $define|true|[yY]*)     dflt='y';;
4172 *) dflt='n';;
4173 esac
4174 rp='Build Perl for SOCKS?'
4175 . ./myread
4176 case "$ans" in
4177 y|Y)    val="$define" ;;     
4178 *)      val="$undef" ;;
4179 esac
4180 set usesocks
4181 eval $setvar
4182
4183 : Looking for optional libraries
4184 echo " "
4185 echo "Checking for optional libraries..." >&4
4186 case "$libs" in
4187 ' '|'') dflt='';;
4188 *) dflt="$libs";;
4189 esac
4190 case "$libswanted" in
4191 '') libswanted='c_s';;
4192 esac
4193 case "$usesocks" in
4194 $define)
4195         libswanted="$libswanted socks5 socks5_sh"
4196         ;;
4197 esac
4198 for thislib in $libswanted; do
4199         
4200         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4201                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4202                 echo "Found -l$thislib (shared)."
4203                 case " $dflt " in
4204                 *"-l$thislib "*);;
4205                 *) dflt="$dflt -l$thislib";;
4206                 esac
4207         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4208                 echo "Found -l$thislib (shared)."
4209                 case " $dflt " in
4210                 *"-l$thislib "*);;
4211                 *) dflt="$dflt -l$thislib";;
4212                 esac
4213         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4214                 echo "Found -l$thislib."
4215                 case " $dflt " in
4216                 *"-l$thislib "*);;
4217                 *) dflt="$dflt -l$thislib";;
4218                 esac
4219         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4220                 echo "Found -l$thislib."
4221                 case " $dflt " in
4222                 *"-l$thislib "*);;
4223                 *) dflt="$dflt -l$thislib";;
4224                 esac
4225         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4226                 echo "Found -l${thislib}_s."
4227                 case " $dflt " in
4228                 *"-l$thislib "*);;
4229                 *) dflt="$dflt -l${thislib}_s";;
4230                 esac
4231         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4232                 echo "Found -l$thislib."
4233                 case " $dflt " in
4234                 *"-l$thislib "*);;
4235                 *) dflt="$dflt -l$thislib";;
4236                 esac
4237         else
4238                 echo "No -l$thislib."
4239         fi
4240 done
4241 set X $dflt
4242 shift
4243 dflt="$*"
4244 case "$libs" in
4245 '') dflt="$dflt";;
4246 *) dflt="$libs";;
4247 esac
4248 case "$dflt" in
4249 ' '|'') dflt='none';;
4250 esac
4251
4252 $cat <<EOM
4253
4254 In order to compile $package on your machine, a number of libraries
4255 are usually needed.  Include any other special libraries here as well.
4256 Say "none" for none.  The default list is almost always right.
4257 EOM
4258
4259 echo " "
4260 rp="What libraries to use?"
4261 . ./myread
4262 case "$ans" in
4263 none) libs=' ';;
4264 *) libs="$ans";;
4265 esac
4266
4267 : determine optimization, if desired, or use for debug flag also
4268 case "$optimize" in
4269 ' '|$undef) dflt='none';;
4270 '') dflt='-O';;
4271 *) dflt="$optimize";;
4272 esac
4273 $cat <<EOH
4274
4275 By default, $package compiles with the -O flag to use the optimizer.
4276 Alternately, you might want to use the symbolic debugger, which uses
4277 the -g flag (on traditional Unix systems).  Either flag can be
4278 specified here.  To use neither flag, specify the word "none".
4279
4280 EOH
4281 rp="What optimizer/debugger flag should be used?"
4282 . ./myread
4283 optimize="$ans"
4284 case "$optimize" in
4285 'none') optimize=" ";;
4286 esac
4287
4288 dflt=''
4289 : We will not override a previous value, but we might want to
4290 : augment a hint file
4291 case "$hint" in
4292 default|recommended)
4293         case "$gccversion" in
4294         1*) dflt='-fpcc-struct-return' ;;
4295         esac
4296         case "$optimize" in
4297         *-g*) dflt="$dflt -DDEBUGGING";;
4298         esac
4299         case "$gccversion" in
4300         2*) if test -d /etc/conf/kconfig.d &&
4301                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4302                 then
4303                         dflt="$dflt -posix"
4304                 fi
4305                 ;;
4306         esac
4307         case "$gccversion" in
4308         1*) ;;
4309         2.[0-8]*) ;;
4310         ?*)     echo " "
4311                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4312                 echo 'int main(void) { return 0; }' > gcctest.c
4313                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4314                         echo "Yes, it does." 2>&1
4315                         case "$ccflags" in
4316                         *strict-aliasing*) 
4317                                 echo "Leaving current flags $ccflags alone." 2>&1
4318                                 ;;
4319                         *) dflt="$dflt -fno-strict-aliasing" ;;
4320                         esac
4321                 else
4322                         echo "Nope, it doesn't, but that's ok." 2>&1
4323                 fi
4324                 ;;
4325         esac
4326         ;;
4327 esac
4328
4329 case "$mips_type" in
4330 *BSD*|'') inclwanted="$locincpth $usrinc";;
4331 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4332 esac
4333 for thisincl in $inclwanted; do
4334         if $test -d $thisincl; then
4335                 if $test x$thisincl != x$usrinc; then
4336                         case "$dflt" in
4337                         *$thisincl*);;
4338                         *) dflt="$dflt -I$thisincl";;
4339                         esac
4340                 fi
4341         fi
4342 done
4343
4344 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4345         xxx=true;
4346 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4347         xxx=true;
4348 else
4349         xxx=false;
4350 fi;
4351 if $xxx; then
4352         case "$dflt" in
4353         *$2*);;
4354         *) dflt="$dflt -D$2";;
4355         esac;
4356 fi'
4357
4358 set signal.h LANGUAGE_C; eval $inctest
4359
4360 case "$usesocks" in
4361 $define)
4362         ccflags="$ccflags -DSOCKS"
4363         ;;
4364 esac
4365
4366 case "$hint" in
4367 default|recommended) dflt="$ccflags $dflt" ;;
4368 *) dflt="$ccflags";;
4369 esac
4370
4371 case "$dflt" in
4372 ''|' ') dflt=none;;
4373 esac
4374 $cat <<EOH
4375
4376 Your C compiler may want other flags.  For this question you should include
4377 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4378 but you should NOT include libraries or ld flags like -lwhatever.  If you
4379 want $package to honor its debug switch, you should include -DDEBUGGING here.
4380 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4381
4382 To use no flags, specify the word "none".
4383
4384 EOH
4385 set X $dflt
4386 shift
4387 dflt=${1+"$@"}
4388 rp="Any additional cc flags?"
4389 . ./myread
4390 case "$ans" in
4391 none) ccflags='';;
4392 *) ccflags="$ans";;
4393 esac
4394
4395 : the following weeds options from ccflags that are of no interest to cpp
4396 cppflags="$ccflags"
4397 case "$gccversion" in
4398 1*) cppflags="$cppflags -D__GNUC__"
4399 esac
4400 case "$mips_type" in
4401 '');;
4402 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4403 esac
4404 case "$cppflags" in
4405 '');;
4406 *)
4407         echo " "
4408         echo "Let me guess what the preprocessor flags are..." >&4
4409         set X $cppflags
4410         shift
4411         cppflags=''
4412         $cat >cpp.c <<'EOM'
4413 #define BLURFL foo
4414
4415 BLURFL xx LFRULB
4416 EOM
4417         previous=''
4418         for flag in $*
4419         do
4420                 case "$flag" in
4421                 -*) ftry="$flag";;
4422                 *) ftry="$previous $flag";;
4423                 esac
4424                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4425                         >cpp1.out 2>/dev/null && \
4426                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4427                         >cpp2.out 2>/dev/null && \
4428                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4429                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4430                 then
4431                         cppflags="$cppflags $ftry"
4432                         previous=''
4433                 else
4434                         previous="$flag"
4435                 fi
4436         done
4437         set X $cppflags
4438         shift
4439         cppflags=${1+"$@"}
4440         case "$cppflags" in
4441         *-*)  echo "They appear to be: $cppflags";;
4442         esac
4443         $rm -f cpp.c cpp?.out
4444         ;;
4445 esac
4446
4447 : flags used in final linking phase
4448 case "$ldflags" in
4449 '') if ./venix; then
4450                 dflt='-i -z'
4451         else
4452                 dflt=''
4453         fi
4454         case "$ccflags" in
4455         *-posix*) dflt="$dflt -posix" ;;
4456         esac
4457         ;;
4458 *) dflt="$ldflags";;
4459 esac
4460
4461 : Try to guess additional flags to pick up local libraries.
4462 for thislibdir in $libpth; do
4463         case " $loclibpth " in
4464         *" $thislibdir "*)
4465                 case "$dflt " in 
4466                 *"-L$thislibdir "*) ;;
4467                 *)  dflt="$dflt -L$thislibdir" ;;
4468                 esac
4469                 ;;
4470         esac
4471 done
4472
4473 case "$dflt" in
4474 '') dflt='none' ;;
4475 esac
4476
4477 $cat <<EOH
4478
4479 Your C linker may need flags.  For this question you should
4480 include -L/whatever and any other flags used by the C linker, but you
4481 should NOT include libraries like -lwhatever.
4482
4483 Make sure you include the appropriate -L/path flags if your C linker
4484 does not normally search all of the directories you specified above,
4485 namely
4486         $libpth
4487 To use no flags, specify the word "none".
4488
4489 EOH
4490
4491 rp="Any additional ld flags (NOT including libraries)?"
4492 . ./myread
4493 case "$ans" in
4494 none) ldflags='';;
4495 *) ldflags="$ans";;
4496 esac
4497 rmlist="$rmlist pdp11"
4498
4499 : coherency check
4500 echo " "
4501 echo "Checking your choice of C compiler and flags for coherency..." >&4
4502 $cat > try.c <<'EOF'
4503 #include <stdio.h>
4504 int main() { printf("Ok\n"); exit(0); }
4505 EOF
4506 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4507 shift
4508 $cat >try.msg <<'EOM'
4509 I've tried to compile and run the following simple program:
4510
4511 EOM
4512 $cat try.c >> try.msg
4513
4514 $cat >> try.msg <<EOM
4515
4516 I used the command:
4517
4518         $*
4519         ./try
4520
4521 and I got the following output:
4522
4523 EOM
4524 dflt=y
4525 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4526         if sh -c './try' >>try.msg 2>&1; then
4527                 xxx=`./try`
4528                 case "$xxx" in
4529                 "Ok") dflt=n ;;
4530                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4531                         case " $libs " in
4532                         *" -lsfio "*)
4533                                 cat >> try.msg <<'EOQS'
4534 If $libs contains -lsfio, and sfio is mis-configured, then it
4535 sometimes (apparently) runs and exits with a 0 status, but with no
4536 output!  It may have to do with sfio's use of _exit vs. exit.
4537
4538 EOQS
4539                                 rp="You have a big problem.  Shall I abort Configure"
4540                                 dflt=y
4541                                 ;;
4542                         esac
4543                         ;;
4544                 esac
4545         else
4546                 echo "The program compiled OK, but exited with status $?." >>try.msg
4547                 rp="You have a problem.  Shall I abort Configure"
4548                 dflt=y
4549         fi
4550 else
4551         echo "I can't compile the test program." >>try.msg
4552         rp="You have a BIG problem.  Shall I abort Configure"
4553         dflt=y
4554 fi
4555 case "$dflt" in
4556 y)
4557         $cat try.msg >&4
4558         case "$knowitall" in
4559         '')
4560                 echo "(The supplied flags or libraries might be incorrect.)"
4561                 ;;
4562         *) dflt=n;;
4563         esac
4564         echo " "
4565         . ./myread
4566         case "$ans" in
4567         n*|N*) ;;
4568         *)      echo "Ok.  Stopping Configure." >&4
4569                 exit 1
4570                 ;;
4571         esac
4572         ;;
4573 n) echo "OK, that should do.";;
4574 esac
4575 $rm -f try try.* core
4576
4577 : determine filename position in cpp output
4578 echo " "
4579 echo "Computing filename position in cpp output for #include directives..." >&4
4580 echo '#include <stdio.h>' > foo.c
4581 $cat >fieldn <<EOF
4582 $startsh
4583 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4584 $grep '^[       ]*#.*stdio\.h' | \
4585 while read cline; do
4586         pos=1
4587         set \$cline
4588         while $test \$# -gt 0; do
4589                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4590                         echo "\$pos"
4591                         exit 0
4592                 fi
4593                 shift
4594                 pos=\`expr \$pos + 1\`
4595         done
4596 done
4597 EOF
4598 chmod +x fieldn
4599 fieldn=`./fieldn`
4600 $rm -f foo.c fieldn
4601 case $fieldn in
4602 '') pos='???';;
4603 1) pos=first;;
4604 2) pos=second;;
4605 3) pos=third;;
4606 *) pos="${fieldn}th";;
4607 esac
4608 echo "Your cpp writes the filename in the $pos field of the line."
4609
4610 : locate header file
4611 $cat >findhdr <<EOF
4612 $startsh
4613 wanted=\$1
4614 name=''
4615 for usrincdir in $usrinc
4616 do
4617         if test -f \$usrincdir/\$wanted; then
4618                 echo "\$usrincdir/\$wanted"
4619                 exit 0
4620         fi
4621 done
4622 awkprg='{ print \$$fieldn }'
4623 echo "#include <\$wanted>" > foo\$\$.c
4624 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4625 $grep "^[       ]*#.*\$wanted" | \
4626 while read cline; do
4627         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4628         case "\$name" in
4629         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4630         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4631         *) exit 2;;
4632         esac;
4633 done;
4634 #
4635 # status = 0: grep returned 0 lines, case statement not executed
4636 # status = 1: headerfile found
4637 # status = 2: while loop executed, no headerfile found
4638 #
4639 status=\$?
4640 $rm -f foo\$\$.c;
4641 if test \$status -eq 1; then
4642         exit 0;
4643 fi
4644 exit 1
4645 EOF
4646 chmod +x findhdr
4647
4648 : define an alternate in-header-list? function
4649 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4650 cont=true; xxf="echo \"<\$1> found.\" >&4";
4651 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4652 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4653 esac;
4654 case $# in 4) instead=instead;; *) instead="at last";; esac;
4655 while $test "$cont"; do
4656         xxx=`./findhdr $1`
4657         var=$2; eval "was=\$$2";
4658         if $test "$xxx" && $test -r "$xxx";
4659         then eval $xxf;
4660         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4661                 cont="";
4662         else eval $xxnf;
4663         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4664         set $yyy; shift; shift; yyy=$@;
4665         case $# in 0) cont="";;
4666         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4667                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4668         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4669                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4670         esac;
4671 done;
4672 while $test "$yyy";
4673 do set $yyy; var=$2; eval "was=\$$2";
4674         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4675         set $yyy; shift; shift; yyy=$@;
4676 done'
4677
4678 : see if this is a malloc.h system
4679 set malloc.h i_malloc
4680 eval $inhdr
4681
4682 : see if stdlib is available
4683 set stdlib.h i_stdlib
4684 eval $inhdr
4685
4686 : determine which malloc to compile in
4687 echo " "
4688 case "$usemymalloc" in
4689 ''|[yY]*|true|$define)  dflt='y' ;;
4690 *)      dflt='n' ;;
4691 esac
4692 rp="Do you wish to attempt to use the malloc that comes with $package?"
4693 . ./myread
4694 usemymalloc="$ans"
4695 case "$ans" in
4696 y*|true)
4697         usemymalloc='y'
4698         mallocsrc='malloc.c'
4699         mallocobj="malloc$_o"
4700         d_mymalloc="$define"
4701         case "$libs" in
4702         *-lmalloc*)
4703                 : Remove malloc from list of libraries to use
4704                 echo "Removing unneeded -lmalloc from library list" >&4
4705                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4706                 shift
4707                 libs="$*"
4708                 echo "libs = $libs" >&4
4709                 ;;
4710         esac
4711         ;;
4712 *)
4713         usemymalloc='n'
4714         mallocsrc=''
4715         mallocobj=''
4716         d_mymalloc="$undef"
4717         ;;
4718 esac
4719
4720 : compute the return types of malloc and free
4721 echo " "
4722 $cat >malloc.c <<END
4723 #$i_malloc I_MALLOC
4724 #$i_stdlib I_STDLIB
4725 #include <stdio.h>
4726 #include <sys/types.h>
4727 #ifdef I_MALLOC
4728 #include <malloc.h>
4729 #endif
4730 #ifdef I_STDLIB
4731 #include <stdlib.h>
4732 #endif
4733 #ifdef TRY_MALLOC
4734 void *malloc();
4735 #endif
4736 #ifdef TRY_FREE
4737 void free();
4738 #endif
4739 END
4740 case "$malloctype" in
4741 '')
4742         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4743                 malloctype='void *'
4744         else
4745                 malloctype='char *'
4746         fi
4747         ;;
4748 esac
4749 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4750
4751 case "$freetype" in
4752 '')
4753         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4754                 freetype='void'
4755         else
4756                 freetype='int'
4757         fi
4758         ;;
4759 esac
4760 echo "Your system uses $freetype free(), it would seem." >&4
4761 $rm -f malloc.[co]
4762 $cat <<EOM
4763
4764 The installation process will also create a directory for
4765 vendor-supplied add-ons.  Vendors who supply perl with their system
4766 may find it convenient to place all vendor-supplied files in this
4767 directory rather than in the main distribution directory.  This will
4768 ease upgrades between binary-compatible maintenance versions of perl.
4769
4770 Of course you may also use these directories in whatever way you see
4771 fit.  For example, you might use them to access modules shared over a
4772 company-wide network.
4773
4774 The default answer should be fine for most people.
4775 This causes further questions about vendor add-ons to be skipped
4776 and no vendor-specific directories will be configured for perl.
4777
4778 EOM
4779 rp='Do you want to configure vendor-specific add-on directories?'
4780 case "$usevendorprefix" in
4781 define|true|[yY]*) dflt=y ;;
4782 *) dflt=n ;;
4783 esac
4784 . ./myread
4785 case "$ans" in
4786 [yY]*)  fn=d~+
4787         rp='Installation prefix to use for vendor-supplied add-ons?'
4788         case "$vendorprefix" in
4789         '') dflt='' ;;
4790         *)  dflt=$vendorprefix ;;
4791         esac
4792         . ./getfile
4793         oldvendorprefix=''
4794         case "$vendorprefix" in
4795         '') ;;
4796         *)      case "$ans" in
4797                 "$prefix") ;;
4798                 *) oldvendorprefix="$prefix";;
4799                 esac
4800                 ;;
4801         esac
4802         usevendorprefix="$define"
4803         vendorprefix="$ans"
4804         vendorprefixexp="$ansexp"
4805         ;;
4806 *)      usevendorprefix="$undef"
4807         vendorprefix=''
4808         vendorprefixexp=''
4809         ;;
4810 esac
4811
4812 case "$vendorprefix" in
4813 '')     d_vendorlib="$undef"
4814         vendorlib=''
4815         vendorlibexp=''
4816         ;;
4817 *)      d_vendorlib="$define"
4818         : determine where vendor-supplied modules go.
4819         : Usual default is /usr/local/lib/perl5/vendor_perl
4820         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4821         case "$installstyle" in
4822         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4823         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4824         esac
4825         fn=d~+
4826         rp='Pathname for the vendor-supplied library files?'
4827         . ./getfile
4828         vendorlib="$ans"
4829         vendorlibexp="$ansexp"
4830         : Change installation prefix, if necessary.
4831         if $test X"$prefix" != X"$installprefix"; then
4832                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4833         else
4834                 installvendorlib="$vendorlibexp"
4835         fi
4836         ;;
4837 esac
4838
4839 : Cruising for prototypes
4840 echo " "
4841 echo "Checking out function prototypes..." >&4
4842 $cat >prototype.c <<'EOCP'
4843 int main(int argc, char *argv[]) {
4844         exit(0);}
4845 EOCP
4846 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4847         echo "Your C compiler appears to support function prototypes."
4848         val="$define"
4849 else
4850         echo "Your C compiler doesn't seem to understand function prototypes."
4851         val="$undef"
4852 fi
4853 set prototype
4854 eval $setvar
4855 $rm -f prototype*
4856
4857 case "$prototype" in
4858 "$define") ;;
4859 *)      ansi2knr='ansi2knr'
4860         echo " "
4861         cat <<EOM >&4
4862
4863 $me:  FATAL ERROR:
4864 This version of $package can only be compiled by a compiler that 
4865 understands function prototypes.  Unfortunately, your C compiler 
4866         $cc $ccflags
4867 doesn't seem to understand them.  Sorry about that.
4868
4869 If GNU cc is available for your system, perhaps you could try that instead.  
4870
4871 Eventually, we hope to support building Perl with pre-ANSI compilers.
4872 If you would like to help in that effort, please contact <perlbug@perl.org>.
4873
4874 Aborting Configure now.
4875 EOM
4876         exit 2
4877         ;;
4878 esac
4879
4880 : determine where public executables go
4881 echo " "
4882 set dflt bin bin
4883 eval $prefixit
4884 fn=d~
4885 rp='Pathname where the public executables will reside?'
4886 . ./getfile
4887 if $test "X$ansexp" != "X$binexp"; then
4888         installbin=''
4889 fi
4890 bin="$ans"
4891 binexp="$ansexp"
4892 : Change installation prefix, if necessary.
4893 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4894 if $test X"$prefix" != X"$installprefix"; then
4895         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4896 else
4897         installbin="$binexp"
4898 fi
4899
4900 : determine whether to install perl also as /usr/bin/perl
4901
4902 echo " "
4903 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4904         $cat <<EOM
4905 Many scripts expect to perl to be installed as /usr/bin/perl.
4906 I can install the perl you are about to compile also as /usr/bin/perl
4907 (in addition to $installbin/perl).
4908 EOM
4909         case "$installusrbinperl" in
4910         "$undef"|[nN]*) dflt='n';;
4911         *)              dflt='y';;
4912         esac
4913         rp="Do you want to install perl as /usr/bin/perl?"
4914         . ./myread
4915         case "$ans" in
4916         [yY]*)  val="$define";;
4917         *)      val="$undef" ;;
4918         esac
4919 else
4920         val="$undef"
4921 fi
4922 set installusrbinperl
4923 eval $setvar
4924
4925 : define a shorthand compile call
4926 compile='
4927 mc_file=$1;
4928 shift;
4929 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4930 : define a shorthand compile call for compilations that should be ok.
4931 compile_ok='
4932 mc_file=$1;
4933 shift;
4934 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4935
4936 echo " "
4937 echo "Checking for GNU C Library..." >&4
4938 cat >gnulibc.c <<EOM
4939 #include <stdio.h>
4940 int main()
4941 {
4942 #ifdef __GLIBC__
4943     exit(0);
4944 #else
4945     exit(1);
4946 #endif
4947 }
4948 EOM
4949 set gnulibc
4950 if eval $compile_ok && ./gnulibc; then
4951         val="$define"
4952         echo "You are using the GNU C Library"
4953 else
4954         val="$undef"
4955         echo "You are not using the GNU C Library"
4956 fi
4957 $rm -f gnulibc*
4958 set d_gnulibc
4959 eval $setvar
4960
4961 : see if nm is to be used to determine whether a symbol is defined or not
4962 case "$usenm" in
4963 '')
4964         dflt=''
4965         case "$d_gnulibc" in
4966         "$define")
4967                 echo " "
4968                 echo "nm probably won't work on the GNU C Library." >&4
4969                 dflt=n
4970                 ;;
4971         esac
4972         case "$dflt" in
4973         '') 
4974                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4975                         echo " "
4976                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4977                         echo "'nm' won't be sufficient on this sytem." >&4
4978                         dflt=n
4979                 fi
4980                 ;;
4981         esac
4982         case "$dflt" in
4983         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4984                 if $test $dflt -gt 20; then
4985                         dflt=y
4986                 else
4987                         dflt=n
4988                 fi
4989                 ;;
4990         esac
4991         ;;
4992 *)
4993         case "$usenm" in
4994         true|$define) dflt=y;;
4995         *) dflt=n;;
4996         esac
4997         ;;
4998 esac
4999 $cat <<EOM
5000
5001 I can use $nm to extract the symbols from your C libraries. This
5002 is a time consuming task which may generate huge output on the disk (up
5003 to 3 megabytes) but that should make the symbols extraction faster. The
5004 alternative is to skip the 'nm' extraction part and to compile a small
5005 test program instead to determine whether each symbol is present. If
5006 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5007 this may be the best solution.
5008
5009 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5010
5011 EOM
5012 rp="Shall I use $nm to extract C symbols from the libraries?"
5013 . ./myread
5014 case "$ans" in
5015 [Nn]*) usenm=false;;
5016 *) usenm=true;;
5017 esac
5018
5019 runnm=$usenm
5020 case "$reuseval" in
5021 true) runnm=false;;
5022 esac
5023
5024 : nm options which may be necessary
5025 case "$nm_opt" in
5026 '') if $test -f /mach_boot; then
5027                 nm_opt=''       # Mach
5028         elif $test -d /usr/ccs/lib; then
5029                 nm_opt='-p'     # Solaris (and SunOS?)
5030         elif $test -f /dgux; then
5031                 nm_opt='-p'     # DG-UX
5032         elif $test -f /lib64/rld; then
5033                 nm_opt='-p'     # 64-bit Irix
5034         else
5035                 nm_opt=''
5036         fi;;
5037 esac
5038
5039 : nm options which may be necessary for shared libraries but illegal
5040 : for archive libraries.  Thank you, Linux.
5041 case "$nm_so_opt" in
5042 '')     case "$myuname" in
5043         *linux*)
5044                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5045                         nm_so_opt='--dynamic'
5046                 fi
5047                 ;;
5048         esac
5049         ;;
5050 esac
5051
5052 case "$runnm" in
5053 true)
5054 : get list of predefined functions in a handy place
5055 echo " "
5056 case "$libc" in
5057 '') libc=unknown
5058         case "$libs" in
5059         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5060         esac
5061         ;;
5062 esac
5063 libnames='';
5064 case "$libs" in
5065 '') ;;
5066 *)  for thislib in $libs; do
5067         case "$thislib" in
5068         -lc|-lc_s)
5069                 : Handle C library specially below.
5070                 ;;
5071         -l*)
5072                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5073                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5074                         :
5075                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5076                         :
5077                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5078                         :
5079                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5080                         :
5081                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5082                         :
5083                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5084                         :
5085                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5086                         :
5087                 else
5088                         try=''
5089                 fi
5090                 libnames="$libnames $try"
5091                 ;;
5092         *) libnames="$libnames $thislib" ;;
5093         esac
5094         done
5095         ;;
5096 esac
5097 xxx=normal
5098 case "$libc" in
5099 unknown)
5100         set /lib/libc.$so
5101         for xxx in $libpth; do
5102                 $test -r $1 || set $xxx/libc.$so
5103                 : The messy sed command sorts on library version numbers.
5104                 $test -r $1 || \
5105                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5106                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5107                                 h
5108                                 s/[0-9][0-9]*/0000&/g
5109                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5110                                 G
5111                                 s/\n/ /' | \
5112                          sort | $sed -e 's/^.* //'`
5113                 eval set \$$#
5114         done
5115         $test -r $1 || set /usr/ccs/lib/libc.$so
5116         $test -r $1 || set /lib/libsys_s$_a
5117         ;;
5118 *)
5119         set blurfl
5120         ;;
5121 esac
5122 if $test -r "$1"; then
5123         echo "Your (shared) C library seems to be in $1."
5124         libc="$1"
5125 elif $test -r /lib/libc && $test -r /lib/clib; then
5126         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5127         xxx=apollo
5128         libc='/lib/clib /lib/libc'
5129         if $test -r /lib/syslib; then
5130                 echo "(Your math library is in /lib/syslib.)"
5131                 libc="$libc /lib/syslib"
5132         fi
5133 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5134         echo "Your C library seems to be in $libc, as you said before."
5135 elif $test -r $incpath/usr/lib/libc$_a; then
5136         libc=$incpath/usr/lib/libc$_a;
5137         echo "Your C library seems to be in $libc.  That's fine."
5138 elif $test -r /lib/libc$_a; then
5139         libc=/lib/libc$_a;
5140         echo "Your C library seems to be in $libc.  You're normal."
5141 else
5142         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5143                 :
5144         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5145                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5146         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5147                 :
5148         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5149                 :
5150         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5151                 :
5152         else
5153                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5154         fi
5155         if $test -r "$tans"; then
5156                 echo "Your C library seems to be in $tans, of all places."
5157                 libc=$tans
5158         else
5159                 libc='blurfl'
5160         fi
5161 fi
5162 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5163         dflt="$libc"
5164         cat <<EOM
5165
5166 If the guess above is wrong (which it might be if you're using a strange
5167 compiler, or your machine supports multiple models), you can override it here.
5168
5169 EOM
5170 else
5171         dflt=''
5172         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5173         cat >&4 <<EOM
5174 I can't seem to find your C library.  I've looked in the following places:
5175
5176 EOM
5177         $sed 's/^/      /' libpath
5178         cat <<EOM
5179
5180 None of these seems to contain your C library. I need to get its name...
5181
5182 EOM
5183 fi
5184 fn=f
5185 rp='Where is your C library?'
5186 . ./getfile
5187 libc="$ans"
5188
5189 echo " "
5190 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5191 set X `cat libnames`
5192 shift
5193 xxx=files
5194 case $# in 1) xxx=file; esac
5195 echo "Extracting names from the following $xxx for later perusal:" >&4
5196 echo " "
5197 $sed 's/^/      /' libnames >&4
5198 echo " "
5199 $echo $n "This may take a while...$c" >&4
5200
5201 for file in $*; do
5202         case $file in
5203         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5204         *) $nm $nm_opt $file 2>/dev/null;;
5205         esac
5206 done >libc.tmp
5207
5208 $echo $n ".$c"
5209 $grep fprintf libc.tmp > libc.ptf
5210 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5211 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5212 xxx='[ADTSIW]'
5213 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5214         eval $xscan;\
5215         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5216                 eval $xrun
5217 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5218         eval $xscan;\
5219         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5220                 eval $xrun
5221 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5222         eval $xscan;\
5223         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5224                 eval $xrun
5225 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5226         eval $xscan;\
5227         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5228                 eval $xrun
5229 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5230         eval $xscan;\
5231         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5232                 eval $xrun
5233 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5234         eval $xscan;\
5235         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5236                 eval $xrun
5237 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5238                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5239         eval $xscan;\
5240         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5241                 eval $xrun
5242 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5243         eval $xscan;\
5244         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5245                 eval $xrun
5246 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5247         eval $xscan;\
5248         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5249                 eval $xrun
5250 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5251         eval $xscan;\
5252         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5253                 eval $xrun
5254 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5255         eval $xscan;\
5256         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5257                 eval $xrun
5258 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5259         eval $xscan;\
5260         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5261                 eval $xrun
5262 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5263         eval $xscan;\
5264         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5265                 eval $xrun
5266 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5267         eval $xscan;\
5268         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5269                 eval $xrun
5270 else
5271         $nm -p $* 2>/dev/null >libc.tmp
5272         $grep fprintf libc.tmp > libc.ptf
5273         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5274                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5275         then
5276                 nm_opt='-p'
5277                 eval $xrun
5278         else
5279                 echo " "
5280                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5281                 com=''
5282                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5283                         for thisname in $libnames $libc; do
5284                                 $ar t $thisname >>libc.tmp
5285                         done
5286                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5287                         echo "Ok." >&4
5288                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5289                         # Repeat libc to extract forwarders to DLL entries too
5290                         for thisname in $libnames $libc; do
5291                                 $ar tv $thisname >>libc.tmp
5292                                 # Revision 50 of EMX has bug in $ar.
5293                                 # it will not extract forwarders to DLL entries
5294                                 # Use emximp which will extract exactly them.
5295                                 emximp -o tmp.imp $thisname \
5296                                     2>/dev/null && \
5297                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5298                                     < tmp.imp >>libc.tmp
5299                                 $rm tmp.imp
5300                         done
5301                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5302                         echo "Ok." >&4
5303                 else
5304                         echo "$ar didn't seem to work right." >&4
5305                         echo "Maybe this is a Cray...trying bld instead..." >&4
5306                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5307                         then
5308                                 for thisname in $libnames; do
5309                                         bld t $libnames | \
5310                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5311                                         $ar t $thisname >>libc.tmp
5312                                 done
5313                                 echo "Ok." >&4
5314                         else
5315                                 echo "That didn't work either.  Giving up." >&4
5316                                 exit 1
5317                         fi
5318                 fi
5319         fi
5320 fi
5321 nm_extract="$com"
5322 if $test -f /lib/syscalls.exp; then
5323         echo " "
5324         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5325         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5326 fi
5327 ;;
5328 esac
5329 $rm -f libnames libpath
5330
5331 : see if dld is available
5332 set dld.h i_dld
5333 eval $inhdr
5334
5335 : is a C symbol defined?
5336 csym='tlook=$1;
5337 case "$3" in
5338 -v) tf=libc.tmp; tc=""; tdc="";;
5339 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5340 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5341 esac;
5342 tx=yes;
5343 case "$reuseval-$4" in
5344 true-) ;;
5345 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5346 esac;
5347 case "$tx" in
5348 yes)
5349         case "$runnm" in
5350         true)
5351                 if $contains $tlook $tf >/dev/null 2>&1;
5352                 then tval=true;
5353                 else tval=false;
5354                 fi;;
5355         *)
5356                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5357                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5358                 then tval=true;
5359                 else tval=false;
5360                 fi;
5361                 $rm -f t t.c;;
5362         esac;;
5363 *)
5364         case "$tval" in
5365         $define) tval=true;;
5366         *) tval=false;;
5367         esac;;
5368 esac;
5369 eval "$2=$tval"'
5370
5371 : define an is-in-libc? function
5372 inlibc='echo " "; td=$define; tu=$undef;
5373 sym=$1; var=$2; eval "was=\$$2";
5374 tx=yes;
5375 case "$reuseval$was" in
5376 true) ;;
5377 true*) tx=no;;
5378 esac;
5379 case "$tx" in
5380 yes)
5381         set $sym tres -f;
5382         eval $csym;
5383         case "$tres" in
5384         true)
5385                 echo "$sym() found." >&4;
5386                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5387         *)
5388                 echo "$sym() NOT found." >&4;
5389                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5390         esac;;
5391 *)
5392         case "$was" in
5393         $define) echo "$sym() found." >&4;;
5394         *) echo "$sym() NOT found." >&4;;
5395         esac;;
5396 esac'
5397
5398 : see if dlopen exists
5399 xxx_runnm="$runnm"
5400 runnm=false
5401 set dlopen d_dlopen
5402 eval $inlibc
5403 runnm="$xxx_runnm"
5404
5405 : determine which dynamic loading, if any, to compile in
5406 echo " "
5407 dldir="ext/DynaLoader"
5408 case "$usedl" in
5409 $define|y|true)
5410         dflt='y'
5411         usedl="$define"
5412         ;;
5413 $undef|n|false)
5414         dflt='n'
5415         usedl="$undef"
5416         ;;
5417 *) 
5418         dflt='n'
5419         case "$d_dlopen" in
5420             $define) dflt='y' ;;
5421         esac
5422         case "$i_dld" in
5423             $define) dflt='y' ;;
5424         esac
5425         : Does a dl_xxx.xs file exist for this operating system
5426         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5427         ;;
5428 esac
5429 rp="Do you wish to use dynamic loading?"
5430 . ./myread
5431 usedl="$ans"
5432 case "$ans" in
5433 y*) usedl="$define"
5434         case "$dlsrc" in
5435         '')
5436                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5437                         dflt="$dldir/dl_${osname}.xs"
5438                 elif $test "$d_dlopen" = "$define" ; then
5439                         dflt="$dldir/dl_dlopen.xs"
5440                 elif $test "$i_dld" = "$define" ; then
5441                         dflt="$dldir/dl_dld.xs"
5442                 else
5443                         dflt=''
5444                 fi
5445                 ;;
5446         *)      dflt="$dldir/$dlsrc"
5447                 ;;
5448         esac
5449     echo "The following dynamic loading files are available:"
5450         : Can not go over to $dldir because getfile has path hard-coded in.
5451         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5452         rp="Source file to use for dynamic loading"
5453         fn="fne"
5454         gfpth="$src"
5455         . ./getfile
5456         usedl="$define"
5457         : emulate basename
5458         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5459
5460         $cat << EOM
5461
5462 Some systems may require passing special flags to $cc -c to
5463 compile modules that will be used to create a shared library.
5464 To use no flags, say "none".
5465
5466 EOM
5467     case "$cccdlflags" in
5468     '') case "$gccversion" in
5469                 '') case "$osname" in
5470                         hpux)   dflt='+z' ;;
5471                         next)   dflt='none' ;;
5472                         irix*)  dflt='-KPIC' ;;
5473                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5474                         sunos)  dflt='-pic' ;;
5475                         *)      dflt='none' ;;
5476                     esac
5477                         ;;
5478                 *)  case "$osname" in
5479                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5480                         *)      dflt='-fpic' ;;
5481                     esac ;;
5482             esac ;;
5483         ' ') dflt='none' ;;
5484     *)  dflt="$cccdlflags" ;;
5485     esac
5486     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5487     . ./myread
5488     case "$ans" in
5489     none) cccdlflags=' ' ;;
5490     *) cccdlflags="$ans" ;;
5491     esac
5492
5493     cat << EOM
5494
5495 Some systems use ld to create libraries that can be dynamically loaded,
5496 while other systems (such as those using ELF) use $cc.
5497
5498 EOM
5499         case "$ld" in
5500         '')     $cat >try.c <<'EOM'
5501 /* Test for whether ELF binaries are produced */
5502 #include <fcntl.h>
5503 #include <stdlib.h>
5504 int main() {
5505         char b[4];
5506         int i = open("a.out",O_RDONLY);
5507         if(i == -1) 
5508                 exit(1); /* fail */
5509         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5510                 exit(0); /* succeed (yes, it's ELF) */
5511         else
5512                 exit(1); /* fail */
5513 }
5514 EOM
5515                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5516                         cat <<EOM
5517 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5518 EOM
5519                         dflt="$cc"
5520                 else
5521                         echo "I'll use ld to build dynamic libraries."
5522                         dflt='ld'
5523                 fi
5524                 rm -f try.c a.out
5525                 ;;
5526         *)      dflt="$ld"
5527                 ;;
5528         esac
5529
5530     rp="What command should be used to create dynamic libraries?"
5531     . ./myread
5532         ld="$ans"
5533
5534     cat << EOM
5535
5536 Some systems may require passing special flags to $ld to create a
5537 library that can be dynamically loaded.  If your ld flags include
5538 -L/other/path options to locate libraries outside your loader's normal
5539 search path, you may need to specify those -L options here as well.  To
5540 use no flags, say "none".
5541
5542 EOM
5543     case "$lddlflags" in
5544     '') case "$osname" in
5545                         beos) dflt='-nostart' ;;
5546                         hpux)  dflt='-b' ;;
5547                         linux|irix*)    dflt='-shared' ;;
5548                         next)  dflt='none' ;;
5549                         solaris) dflt='-G' ;;
5550                         sunos) dflt='-assert nodefinitions' ;;
5551                         svr4*|esix*) dflt="-G $ldflags" ;;
5552                 *)     dflt='none' ;;
5553                         esac
5554                         ;;
5555     *) dflt="$lddlflags" ;;
5556     esac
5557
5558         : Try to guess additional flags to pick up local libraries.
5559         : Be careful not to append to a plain 'none'
5560         case "$dflt" in
5561         none) dflt='' ;;
5562         esac
5563         for thisflag in $ldflags; do
5564                 case "$thisflag" in
5565                 -L*)
5566                         case " $dflt " in
5567                         *" $thisflag "*) ;;
5568                         *) dflt="$dflt $thisflag" ;;
5569                         esac
5570                         ;;
5571                 esac
5572         done
5573
5574         case "$dflt" in
5575         ''|' ') dflt='none' ;;
5576         esac
5577
5578     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5579     . ./myread
5580     case "$ans" in
5581     none) lddlflags=' ' ;;
5582     *) lddlflags="$ans" ;;
5583     esac
5584
5585         cat <<EOM
5586
5587 Some systems may require passing special flags to $cc to indicate that
5588 the resulting executable will use dynamic linking.  To use no flags,
5589 say "none".
5590
5591 EOM
5592     case "$ccdlflags" in
5593     '') case "$osname" in
5594                 hpux)   dflt='-Wl,-E' ;;
5595                 linux)  dflt='-rdynamic' ;;
5596                 next)   dflt='none' ;;
5597                 sunos)  dflt='none' ;;
5598                 *)      dflt='none' ;;
5599             esac ;;
5600     ' ')  dflt='none' ;;
5601     *)  dflt="$ccdlflags" ;;
5602     esac
5603     rp="Any special flags to pass to $cc to use dynamic loading?"
5604     . ./myread
5605     case "$ans" in
5606     none) ccdlflags=' ' ;;
5607     *) ccdlflags="$ans" ;;
5608     esac
5609     ;;
5610 *)  usedl="$undef"
5611         ld='ld'
5612     dlsrc='dl_none.xs'
5613     lddlflags=''
5614     ccdlflags=''
5615     ;;
5616 esac
5617
5618 also=''
5619 case "$usedl" in
5620 $undef)
5621         # No dynamic loading being used, so don't bother even to prompt.
5622         useshrplib='false'
5623         ;;
5624 *)      case "$useshrplib" in
5625         '')     case "$osname" in
5626                 svr4*|dgux|dynixptx|esix|powerux|beos)
5627                         dflt=y
5628                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5629                         ;;
5630                 next*)
5631                         case "$osvers" in
5632                         4*)     dflt=y
5633                                 also='Building a shared libperl is needed for MAB support.'
5634                                 ;;
5635                         *)      dflt=n
5636                                 ;;
5637                         esac
5638                         ;;
5639                 *)      dflt=n
5640                         ;;
5641                 esac
5642                 ;;
5643         $define|true|[Yy]*)
5644                 dflt=y
5645                 ;;
5646         *)      dflt=n
5647                 ;;
5648         esac
5649         $cat << EOM
5650
5651 The perl executable is normally obtained by linking perlmain.c with
5652 libperl${_a}, any static extensions (usually just DynaLoader), and
5653 any other libraries needed on this system (such as -lm, etc.).  Since
5654 your system supports dynamic loading, it is probably possible to build
5655 a shared libperl.$so.  If you will have more than one executable linked
5656 to libperl.$so, this will significantly reduce the size of each
5657 executable, but it may have a noticeable affect on performance.  The
5658 default is probably sensible for your system.
5659 $also
5660
5661 EOM
5662         rp="Build a shared libperl.$so (y/n)"
5663         . ./myread
5664         case "$ans" in
5665         true|$define|[Yy]*)
5666                 useshrplib='true'  ;;
5667         *)      useshrplib='false' ;;
5668         esac
5669         ;;
5670 esac
5671
5672 case "$useshrplib" in
5673 true)
5674         case "$libperl" in
5675         '')
5676                 # Figure out a good name for libperl.so.  Since it gets stored in
5677                 # a version-specific architecture-dependent library, the version
5678                 # number isn't really that important, except for making cc/ld happy.
5679                 #
5680                 # A name such as libperl.so.3.1
5681                 majmin="libperl.$so.$patchlevel.$subversion"
5682                 # A name such as libperl.so.301
5683                 majonly=`echo $patchlevel $subversion |
5684                         $awk '{printf "%d%02d", $1, $2}'`
5685                 majonly=libperl.$so.$majonly
5686                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5687                 # rely on figuring it out from the naming of libc.
5688                 case "${osname}${osvers}" in
5689                 next4*)
5690                         dflt=libperl.5.$so
5691                         # XXX How handle the --version stuff for MAB?
5692                         ;;
5693                 linux*)  # ld won't link with a bare -lperl otherwise.
5694                         dflt=libperl.$so
5695                         ;;
5696                 *)      # Try to guess based on whether libc has major.minor.
5697                         case "$libc" in
5698                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5699                         *libc.$so.[0-9]*) dflt=$majonly ;;
5700                         *)      dflt=libperl.$so ;;
5701                         esac
5702                         ;;
5703                 esac
5704                 ;;
5705         *)      dflt=$libperl
5706                 ;;
5707         esac
5708         cat << EOM
5709
5710 I need to select a good name for the shared libperl.  If your system uses
5711 library names with major and minor numbers, then you might want something
5712 like $majmin.  Alternatively, if your system uses a single version
5713 number for shared libraries, then you might want to use $majonly.
5714 Or, your system might be quite happy with a simple libperl.$so.
5715
5716 Since the shared libperl will get installed into a version-specific
5717 architecture-dependent directory, the version number of the shared perl
5718 library probably isn't important, so the default should be o.k.
5719
5720 EOM
5721         rp='What name do you want to give to the shared libperl?'
5722         . ./myread
5723         libperl=$ans
5724         echo "Ok, I'll use $libperl"
5725         ;;
5726 *)
5727         libperl="libperl${_a}"
5728         ;;
5729 esac
5730
5731 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5732 case "$shrpdir" in
5733 '') ;;
5734 *)      $cat >&4 <<EOM
5735 WARNING:  Use of the shrpdir variable for the installation location of
5736 the shared $libperl is not supported.  It was never documented and
5737 will not work in this version.  Let me (perlbug@perl.com)
5738 know of any problems this may cause.
5739
5740 EOM
5741         case "$shrpdir" in
5742         "$archlibexp/CORE")
5743                 $cat >&4 <<EOM
5744 But your current setting of $shrpdir is
5745 the default anyway, so it's harmless.
5746 EOM
5747                 ;;
5748         *)
5749                 $cat >&4 <<EOM
5750 Further, your current attempted setting of $shrpdir
5751 conflicts with the value of $archlibexp/CORE
5752 that installperl will use.
5753 EOM
5754                 ;;
5755         esac
5756         ;;
5757 esac
5758
5759 # How will the perl executable find the installed shared $libperl?
5760 # Add $xxx to ccdlflags.
5761 # If we can't figure out a command-line option, use $shrpenv to
5762 # set env LD_RUN_PATH.  The main perl makefile uses this.
5763 shrpdir=$archlibexp/CORE
5764 xxx=''
5765 tmp_shrpenv=''
5766 if "$useshrplib"; then
5767     case "$osname" in 
5768         aix)
5769                 # We'll set it in Makefile.SH...
5770                 ;;
5771         solaris|netbsd)
5772                 xxx="-R $shrpdir"
5773                 ;;
5774         freebsd)
5775                 xxx="-Wl,-R$shrpdir"
5776                 ;;
5777         linux|irix*|dec_osf)
5778                 xxx="-Wl,-rpath,$shrpdir"
5779                 ;;
5780         next)
5781                 # next doesn't like the default...
5782                 ;;
5783         beos)
5784                 # beos doesn't like the default, either.
5785                 ;;
5786         hpux*)
5787                 # hpux doesn't like the default, either.
5788                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5789                 ;;
5790         *)
5791                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5792                 ;;
5793         esac
5794         case "$xxx" in
5795         '') ;;
5796         *)      
5797                 # Only add $xxx if it isn't already in ccdlflags.
5798                 case " $ccdlflags " in
5799                 *" $xxx "*)     ;;
5800                 *)      ccdlflags="$ccdlflags $xxx"
5801                         cat <<EOM >&4
5802
5803 Adding $xxx to the flags
5804 passed to $ld so that the perl executable will find the 
5805 installed shared $libperl.
5806
5807 EOM
5808                         ;;
5809                 esac
5810                 ;;
5811         esac
5812 fi
5813 # Fix ccdlflags in AIX for building external extensions.
5814 # (For building Perl itself bare -bE:perl.exp is needed,
5815 #  Makefile.SH takes care of this.)
5816 case "$osname" in
5817 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5818 esac
5819 # Respect a hint or command-line value.
5820 case "$shrpenv" in
5821 '') shrpenv="$tmp_shrpenv" ;;
5822 esac
5823 case "$ldlibpthname" in
5824 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5825 none)   ldlibpthname='' ;;
5826 esac
5827
5828 : determine where manual pages go
5829 set man1dir man1dir none
5830 eval $prefixit
5831 $cat <<EOM
5832
5833 $spackage has manual pages available in source form.
5834 EOM
5835 case "$nroff" in
5836 nroff)
5837         echo "However, you don't have nroff, so they're probably useless to you."
5838         case "$man1dir" in
5839         '') man1dir="none";;
5840         esac;;
5841 esac
5842 echo "If you don't want the manual sources installed, answer 'none'."
5843 case "$man1dir" in
5844 ' ') dflt=none
5845         ;;
5846 '')
5847         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5848         lookpath="$lookpath $prefixexp/man/p_man/man1"
5849         lookpath="$lookpath $prefixexp/man/u_man/man1"
5850         lookpath="$lookpath $prefixexp/man/man.1"
5851         case "$sysman" in
5852         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5853         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5854         esac
5855         set dflt
5856         eval $prefixup
5857         ;;
5858 *)  dflt="$man1dir"
5859         ;;
5860 esac
5861 echo " "
5862 fn=dn+~
5863 rp="Where do the main $spackage manual pages (source) go?"
5864 . ./getfile
5865 if $test "X$man1direxp" != "X$ansexp"; then
5866         installman1dir=''
5867 fi
5868 man1dir="$ans"
5869 man1direxp="$ansexp"
5870 case "$man1dir" in
5871 '')     man1dir=' '
5872         installman1dir='';;
5873 esac
5874
5875 : Change installation prefix, if necessary.
5876 if $test X"$prefix" != X"$installprefix"; then
5877         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5878 else
5879         installman1dir="$man1direxp"
5880 fi
5881
5882 : What suffix to use on installed man pages
5883
5884 case "$man1dir" in
5885 ' ')
5886         man1ext='0'
5887         ;;
5888 *)
5889         rp="What suffix should be used for the main $spackage man pages?"
5890         case "$man1ext" in
5891         '')     case "$man1dir" in
5892                 *1)  dflt=1 ;;
5893                 *1p) dflt=1p ;;
5894                 *1pm) dflt=1pm ;;
5895                 *l) dflt=l;;
5896                 *n) dflt=n;;
5897                 *o) dflt=o;;
5898                 *p) dflt=p;;
5899                 *C) dflt=C;;
5900                 *L) dflt=L;;
5901                 *L1) dflt=L1;;
5902                 *) dflt=1;;
5903                 esac
5904                 ;;
5905         *)      dflt="$man1ext";;
5906         esac
5907         . ./myread
5908         man1ext="$ans"
5909         ;;
5910 esac
5911
5912 : see if we can have long filenames
5913 echo " "
5914 rmlist="$rmlist /tmp/cf$$"
5915 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5916 first=123456789abcdef
5917 second=/tmp/cf$$/$first
5918 $rm -f $first $second
5919 if (echo hi >$first) 2>/dev/null; then
5920         if $test -f 123456789abcde; then
5921                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5922                 val="$undef"
5923         else
5924                 if (echo hi >$second) 2>/dev/null; then
5925                         if $test -f /tmp/cf$$/123456789abcde; then
5926                                 $cat <<'EOM'
5927 That's peculiar... You can have filenames longer than 14 characters, but only
5928 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5929 I shall consider your system cannot support long filenames at all.
5930 EOM
5931                                 val="$undef"
5932                         else
5933                                 echo 'You can have filenames longer than 14 characters.' >&4
5934                                 val="$define"
5935                         fi
5936                 else
5937                         $cat <<'EOM'
5938 How confusing! Some of your filesystems are sane enough to allow filenames
5939 longer than 14 characters but some others like /tmp can't even think about them.
5940 So, for now on, I shall assume your kernel does not allow them at all.
5941 EOM
5942                         val="$undef"
5943                 fi
5944         fi
5945 else
5946         $cat <<'EOM'
5947 You can't have filenames longer than 14 chars.  You can't even think about them!
5948 EOM
5949         val="$undef"
5950 fi 
5951 set d_flexfnam
5952 eval $setvar
5953 $rm -rf /tmp/cf$$ 123456789abcde*
5954
5955 : determine where library module manual pages go
5956 set man3dir man3dir none
5957 eval $prefixit
5958 $cat <<EOM
5959
5960 $spackage has manual pages for many of the library modules.
5961 EOM
5962
5963 case "$nroff" in
5964 nroff)
5965         $cat <<'EOM'
5966 However, you don't have nroff, so they're probably useless to you.
5967 EOM
5968         case "$man3dir" in
5969         '') man3dir="none";;
5970         esac;;
5971 esac
5972
5973 case "$d_flexfnam" in
5974 undef)
5975         $cat <<'EOM'
5976 However, your system can't handle the long file names like File::Basename.3. 
5977 EOM
5978         case "$man3dir" in
5979         '') man3dir="none";;
5980         esac;;
5981 esac
5982
5983 echo "If you don't want the manual sources installed, answer 'none'."
5984 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5985 case "$man3dir" in
5986 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5987         if $test -d "$privlib/man/man3"; then
5988                 cat <<EOM >&4
5989
5990 WARNING:  Previous versions of perl installed man3 pages into
5991 $privlib/man/man3.  This version will suggest a 
5992 new default of $dflt.  
5993 EOM
5994                 tdflt=$dflt
5995                 dflt='n'
5996                 rp='Do you wish to preserve the old behavior?(y/n)'
5997                 . ./myread
5998                 case "$ans" in
5999                 y*) dflt="$privlib/man/man3" ;;
6000                 *)  dflt=$tdflt ;;
6001                 esac
6002     fi
6003         ;;
6004 ' ') dflt=none;;
6005 *)      dflt="$man3dir" ;;
6006 esac
6007 echo " "
6008 fn=dn+~
6009 rp="Where do the $package library man pages (source) go?"
6010 . ./getfile
6011 man3dir="$ans"
6012 man3direxp="$ansexp"
6013 case "$man1dir" in
6014 '')     man3dir=' '
6015         installman3dir='';;
6016 esac
6017
6018 : Change installation prefix, if necessary.
6019 if $test X"$prefix" != X"$installprefix"; then
6020         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6021 else
6022         installman3dir="$man3direxp"
6023 fi
6024
6025 : What suffix to use on installed man pages
6026 case "$man3dir" in
6027 ' ')
6028         man3ext='0'
6029         ;;
6030 *)
6031         rp="What suffix should be used for the $package library man pages?"
6032         case "$man3ext" in
6033         '')     case "$man3dir" in
6034                 *3)  dflt=3 ;;
6035                 *3p) dflt=3p ;;
6036                 *3pm) dflt=3pm ;;
6037                 *l) dflt=l;;
6038                 *n) dflt=n;;
6039                 *o) dflt=o;;
6040                 *p) dflt=p;;
6041                 *C) dflt=C;;
6042                 *L) dflt=L;;
6043                 *L3) dflt=L3;;
6044                 *) dflt=3;;
6045                 esac
6046                 ;;
6047         *)      dflt="$man3ext";;
6048         esac
6049         . ./myread
6050         man3ext="$ans"
6051         ;;
6052 esac
6053
6054 : see if we have to deal with yellow pages, now NIS.
6055 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6056         if $test -f /usr/etc/nibindd; then
6057                 echo " "
6058                 echo "I'm fairly confident you're on a NeXT."
6059                 echo " "
6060                 rp='Do you get the hosts file via NetInfo?'
6061                 dflt=y
6062                 case "$hostcat" in
6063                 nidump*) ;;
6064                 '') ;;
6065                 *) dflt=n;;
6066                 esac
6067                 . ./myread
6068                 case "$ans" in
6069                 y*) hostcat='nidump hosts .';;
6070                 *)      case "$hostcat" in
6071                         nidump*) hostcat='';;
6072                         esac
6073                         ;;
6074                 esac
6075         fi
6076         case "$hostcat" in
6077         nidump*) ;;
6078         *)
6079                 case "$hostcat" in
6080                 *ypcat*) dflt=y;;
6081                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6082                                 dflt=y
6083                         else
6084                                 dflt=n
6085                         fi;;
6086                 *) dflt=n;;
6087                 esac
6088                 echo " "
6089                 rp='Are you getting the hosts file via yellow pages?'
6090                 . ./myread
6091                 case "$ans" in
6092                 y*) hostcat='ypcat hosts';;
6093                 *) hostcat='cat /etc/hosts';;
6094                 esac
6095                 ;;
6096         esac
6097 fi
6098 case "$hostcat" in
6099 '') hostcat='cat /etc/hosts';;
6100 esac
6101 case "$groupcat" in
6102 '') groupcat='cat /etc/group';;
6103 esac
6104 case "$passcat" in
6105 '') passcat='cat /etc/passwd';;
6106 esac
6107
6108 : now get the host name
6109 echo " "
6110 echo "Figuring out host name..." >&4
6111 case "$myhostname" in
6112 '') cont=true
6113         echo 'Maybe "hostname" will work...'
6114         if tans=`sh -c hostname 2>&1` ; then
6115                 myhostname=$tans
6116                 phostname=hostname
6117                 cont=''
6118         fi
6119         ;;
6120 *) cont='';;
6121 esac
6122 if $test "$cont"; then
6123         if ./xenix; then
6124                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6125                 if tans=`cat /etc/systemid 2>&1` ; then
6126                         myhostname=$tans
6127                         phostname='cat /etc/systemid'
6128                         echo "Whadyaknow.  Xenix always was a bit strange..."
6129                         cont=''
6130                 fi
6131         elif $test -r /etc/systemid; then
6132                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6133         fi
6134 fi
6135 if $test "$cont"; then
6136         echo 'No, maybe "uuname -l" will work...'
6137         if tans=`sh -c 'uuname -l' 2>&1` ; then
6138                 myhostname=$tans
6139                 phostname='uuname -l'
6140         else
6141                 echo 'Strange.  Maybe "uname -n" will work...'
6142                 if tans=`sh -c 'uname -n' 2>&1` ; then
6143                         myhostname=$tans
6144                         phostname='uname -n'
6145                 else
6146                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6147                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6148                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6149                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6150                         else
6151                                 case "$myhostname" in
6152                                 '') echo "Does this machine have an identity crisis or something?"
6153                                         phostname='';;
6154                                 *)
6155                                         echo "Well, you said $myhostname before..."
6156                                         phostname='echo $myhostname';;
6157                                 esac
6158                         fi
6159                 fi
6160         fi
6161 fi
6162 : you do not want to know about this
6163 set $myhostname
6164 myhostname=$1
6165
6166 : verify guess
6167 if $test "$myhostname" ; then
6168         dflt=y
6169         rp='Your host name appears to be "'$myhostname'".'" Right?"
6170         . ./myread
6171         case "$ans" in
6172         y*) ;;
6173         *) myhostname='';;
6174         esac
6175 fi
6176
6177 : bad guess or no guess
6178 while $test "X$myhostname" = X ; do
6179         dflt=''
6180         rp="Please type the (one word) name of your host:"
6181         . ./myread
6182         myhostname="$ans"
6183 done
6184
6185 : translate upper to lower if necessary
6186 case "$myhostname" in
6187 *[A-Z]*)
6188         echo "(Normalizing case in your host name)"
6189         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6190         ;;
6191 esac
6192
6193 case "$myhostname" in
6194 *.*)
6195         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6196         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6197         echo "(Trimming domain name from host name--host name is now $myhostname)"
6198         ;;
6199 *) case "$mydomain" in
6200         '')
6201                 {
6202                         test "X$hostcat" = "Xypcat hosts" &&
6203                         ypmatch "$myhostname" hosts 2>/dev/null |\
6204                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6205                         $test -s hosts
6206                 } || {
6207                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6208                                         /[       ]$myhostname[  . ]/p" > hosts
6209                 }
6210                 tmp_re="[       . ]"
6211                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6212                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6213                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6214                         hosts | $sort | $uniq | \
6215                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6216                 case `$echo X$dflt` in
6217                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6218                         dflt=.
6219                         ;;
6220                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6221                         ;;
6222                 esac
6223                 case "$dflt" in
6224                 .)
6225                         tans=`./loc resolv.conf X /etc /usr/etc`
6226                         if $test -f "$tans"; then
6227                                 echo "(Attempting domain name extraction from $tans)"
6228                                 dflt=.`$sed -n -e 's/   / /g' \
6229                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6230                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6231                                 case "$dflt" in
6232                                 .) dflt=.`$sed -n -e 's/        / /g' \
6233                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6234                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6235                                         ;;
6236                                 esac
6237                         fi
6238                         ;;
6239                 esac
6240                 case "$dflt" in
6241                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6242                         dflt=.`sh -c domainname 2>/dev/null`
6243                         case "$dflt" in
6244                         '') dflt='.';;
6245                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6246                         esac
6247                         ;;
6248                 esac
6249                 case "$dflt" in
6250                 .) echo "(Lost all hope -- silly guess then)"
6251                         dflt='.uucp'
6252                         ;;
6253                 esac
6254                 $rm -f hosts
6255                 ;;
6256         *) dflt="$mydomain";;
6257         esac;;
6258 esac
6259 echo " "
6260 rp="What is your domain name?"
6261 . ./myread
6262 tans="$ans"
6263 case "$ans" in
6264 '') ;;
6265 .*) ;;
6266 *) tans=".$tans";;
6267 esac
6268 mydomain="$tans"
6269
6270 : translate upper to lower if necessary
6271 case "$mydomain" in
6272 *[A-Z]*)
6273         echo "(Normalizing case in your domain name)"
6274         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6275         ;;
6276 esac
6277
6278 : a little sanity check here
6279 case "$phostname" in
6280 '') ;;
6281 *)
6282         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6283         $myhostname$mydomain|$myhostname) ;;
6284         *)
6285                 case "$phostname" in
6286                 sed*)
6287                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6288                         ;;
6289                 *)
6290                         echo "(That doesn't agree with your $phostname command, by the way.)"
6291                         ;;
6292                 esac
6293         ;;
6294         esac
6295         ;;
6296 esac
6297
6298 $cat <<EOM
6299
6300 I need to get your e-mail address in Internet format if possible, i.e.
6301 something like user@host.domain. Please answer accurately since I have
6302 no easy means to double check it. The default value provided below
6303 is most probably close to the reality but may not be valid from outside
6304 your organization...
6305
6306 EOM
6307 cont=x
6308 while test "$cont"; do
6309         case "$cf_email" in
6310         '') dflt="$cf_by@$myhostname$mydomain";;
6311         *) dflt="$cf_email";;
6312         esac
6313         rp='What is your e-mail address?'
6314         . ./myread
6315         cf_email="$ans"
6316         case "$cf_email" in
6317         *@*.*) cont='' ;;
6318         *)
6319                 rp='Address does not look like an Internet one.  Use it anyway?'
6320                 case "$fastread" in
6321                 yes) dflt=y ;;
6322                 *) dflt=n ;;
6323                 esac
6324                 . ./myread
6325                 case "$ans" in
6326                 y*) cont='' ;;
6327                 *) echo " " ;;
6328                 esac
6329                 ;;
6330         esac
6331 done
6332
6333 $cat <<EOM
6334
6335 If you or somebody else will be maintaining perl at your site, please
6336 fill in the correct e-mail address here so that they may be contacted
6337 if necessary. Currently, the "perlbug" program included with perl
6338 will send mail to this address in addition to perlbug@perl.com. You may
6339 enter "none" for no administrator.
6340
6341 EOM
6342 case "$perladmin" in
6343 '') dflt="$cf_email";;
6344 *) dflt="$perladmin";;
6345 esac
6346 rp='Perl administrator e-mail address'
6347 . ./myread
6348 perladmin="$ans"
6349
6350 : figure out how to guarantee perl startup
6351 case "$startperl" in
6352 '')
6353         case "$sharpbang" in
6354         *!)
6355                 $cat <<EOH
6356
6357 I can use the #! construct to start perl on your system. This will
6358 make startup of perl scripts faster, but may cause problems if you
6359 want to share those scripts and perl is not in a standard place
6360 ($binexp/perl) on all your platforms. The alternative is to force
6361 a shell by starting the script with a single ':' character.
6362
6363 EOH
6364                 dflt="$binexp/perl"
6365                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6366                 . ./myread
6367                 case "$ans" in
6368                 none)   startperl=": # use perl";;
6369                 *)      startperl="#!$ans"
6370                         if $test 30 -lt `echo "$ans" | wc -c`; then
6371                                 $cat >&4 <<EOM
6372
6373 WARNING:  Some systems limit the #! command to 32 characters.
6374 If you experience difficulty running Perl scripts with #!, try
6375 installing Perl in a directory with a shorter pathname.
6376
6377 EOM
6378                         fi ;;
6379                 esac
6380                 ;;
6381         *) startperl=": # use perl"
6382                 ;;
6383         esac
6384         ;;
6385 esac
6386 echo "I'll use $startperl to start perl scripts."
6387
6388 : figure best path for perl in scripts
6389 case "$perlpath" in
6390 '')
6391         perlpath="$binexp/perl"
6392         case "$startperl" in
6393         *!*) ;;
6394         *)
6395                 $cat <<EOH
6396
6397 I will use the "eval 'exec'" idiom to start Perl on your system.
6398 I can use the full path of your Perl binary for this purpose, but
6399 doing so may cause problems if you want to share those scripts and
6400 Perl is not always in a standard place ($binexp/perl).
6401
6402 EOH
6403                 dflt="$binexp/perl"
6404                 rp="What path shall I use in \"eval 'exec'\"?"
6405                 . ./myread
6406                 perlpath="$ans"
6407                 ;;
6408         esac
6409         ;;
6410 esac
6411 case "$startperl" in
6412 *!*)    ;;
6413 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6414 esac
6415
6416 : determine where public executable scripts go
6417 set scriptdir scriptdir
6418 eval $prefixit
6419 case "$scriptdir" in
6420 '')
6421         dflt="$bin"
6422         : guess some guesses
6423         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6424         $test -d /usr/share/bin     && dflt=/usr/share/bin
6425         $test -d /usr/local/script  && dflt=/usr/local/script
6426         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6427         $test -d $prefixexp/script  && dflt=$prefixexp/script
6428         set dflt
6429         eval $prefixup
6430         ;;
6431 *)  dflt="$scriptdir"
6432         ;;
6433 esac
6434 $cat <<EOM
6435  
6436 Some installations have a separate directory just for executable scripts so
6437 that they can mount it across multiple architectures but keep the scripts in
6438 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6439 Or you might just lump your scripts in with all your other executables.
6440  
6441 EOM
6442 fn=d~
6443 rp='Where do you keep publicly executable scripts?'
6444 . ./getfile
6445 if $test "X$ansexp" != "X$scriptdirexp"; then
6446         installscript=''
6447 fi
6448 scriptdir="$ans"
6449 scriptdirexp="$ansexp"
6450 : Change installation prefix, if necessary.
6451 if $test X"$prefix" != X"$installprefix"; then
6452         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6453 else
6454         installscript="$scriptdirexp"
6455 fi
6456
6457 $cat <<EOM
6458
6459 After $package is installed, you may wish to install various
6460 add-on modules and utilities.  Typically, these add-ons will
6461 be installed under $prefix with the rest
6462 of this package.  However, you may wish to install such add-ons
6463 elsewhere under a different prefix.
6464
6465 If you do not wish to put everything under a single prefix, that's
6466 ok.  You will be prompted for the individual locations; this siteprefix
6467 is only used to suggest the defaults.
6468
6469 The default should be fine for most people.
6470
6471 EOM
6472 fn=d~+
6473 rp='Installation prefix to use for add-on modules and utilities?'
6474 : XXX Here might be another good place for an installstyle setting.
6475 case "$siteprefix" in
6476 '') dflt=$prefix ;;
6477 *)  dflt=$siteprefix ;;
6478 esac
6479 . ./getfile
6480 oldsiteprefix=''
6481 case "$siteprefix" in
6482 '') ;;
6483 *)
6484         case "$ans" in
6485         "$prefix") ;;
6486         *) oldsiteprefix="$prefix";;
6487         esac
6488         ;;
6489 esac
6490 siteprefix="$ans"
6491 siteprefixexp="$ansexp"
6492
6493 : determine where site specific libraries go.
6494 : Usual default is /usr/local/lib/perl5/site_perl
6495 : The default "style" setting is made in installstyle.U
6496 : XXX No longer works with Prefixit stuff.
6497 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6498 case "$installstyle" in
6499 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6500 *)       dflt=$siteprefix/lib/site_$prog ;;
6501 esac
6502 $cat <<EOM
6503
6504 The installation process will create a directory for
6505 site-specific extensions and modules.  Most users find it convenient
6506 to place all site-specific files in this directory rather than in the
6507 main distribution directory.
6508
6509 EOM
6510 fn=d~+
6511 rp='Pathname for the site-specific library files?'
6512 . ./getfile
6513 sitelib="$ans"
6514 sitelibexp="$ansexp"
6515 : Change installation prefix, if necessary.
6516 if $test X"$prefix" != X"$installprefix"; then
6517         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6518 else
6519         installsitelib="$sitelibexp"
6520 fi
6521
6522 : determine where site specific architecture-dependent libraries go.
6523 : sitelib  default is /usr/local/lib/perl5/site_perl/
6524 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6525 : sitelib may have an optional trailing /share.
6526 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6527 tdflt="$tdflt/$apiversion/$archname"
6528 set sitearch sitearch none
6529 eval $prefixit
6530 case "$sitearch" in
6531 '')     dflt="$tdflt" ;;
6532 *)      dflt="$sitearch" ;;
6533 esac
6534 $cat <<EOM
6535
6536 The installation process will also create a directory for
6537 architecture-dependent site-specific extensions and modules.
6538
6539 EOM
6540 fn=nd~+
6541 rp='Pathname for the site-specific architecture-dependent library files?'
6542 . ./getfile
6543 sitearch="$ans"
6544 sitearchexp="$ansexp"
6545 : Change installation prefix, if necessary.
6546 if $test X"$prefix" != X"$installprefix"; then
6547         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6548 else
6549         installsitearch="$sitearchexp"
6550 fi
6551
6552 : determine where add-on public executables go
6553 case "$sitebin" in
6554 '')     dflt=$siteprefix/bin ;;
6555 *)      dflt=$sitebin ;;
6556 esac
6557 fn=d~
6558 rp='Pathname where the add-on public executables should be installed?'
6559 . ./getfile
6560 sitebin="$ans"
6561 sitebinexp="$ansexp"
6562 : Change installation prefix, if necessary.
6563 if $test X"$prefix" != X"$installprefix"; then
6564         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6565 else
6566         installsitebin="$sitebinexp"
6567 fi
6568
6569 cat <<EOM
6570
6571 Perl can be built to take advantage of long doubles which
6572 (if available) may give more accuracy and range for floating point
6573 numbers.  To do so, Configure must be run with -Duselongdouble.
6574
6575 If this doesn't make any sense to you, just accept the default 'n'.
6576 EOM
6577 case "$uselongdouble" in
6578 $define|true|[yY]*)     dflt='y';;
6579 *) dflt='n';;
6580 esac
6581 rp='Try to use long doubles if available?'
6582 . ./myread
6583 case "$ans" in
6584 y|Y)    val="$define"   ;;
6585 *)      val="$undef"    ;;
6586 esac
6587 set uselongdouble
6588 eval $setvar
6589
6590 case "$uselongdouble" in
6591 "$define"|true|[yY]*)
6592 : Look for a hint-file generated 'call-back-unit'.  If the
6593 : user has specified that long doubles should be used,
6594 : we may need to set or change some other defaults.
6595         if $test -f uselongdouble.cbu; then
6596                 echo "Your platform has some specific hints for long doubles, using them..."
6597                 . ./uselongdouble.cbu
6598         else
6599                 $cat <<EOM
6600 (Your platform doesn't have any specific hints for long doubles.)
6601 EOM
6602         fi
6603         ;;
6604 esac
6605
6606 cat <<EOM
6607
6608 Previous version of $package used the standard IO mechanisms as defined
6609 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6610 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6611 the default.  This abstraction layer can use AT&T's sfio (if you already
6612 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6613 problems with some extension modules.  Using PerlIO with stdio is safe,
6614 but it is slower than plain stdio and therefore is not the default.
6615
6616 If this doesn't make any sense to you, just accept the default 'n'.
6617 EOM
6618 case "$useperlio" in
6619 $define|true|[yY]*)     dflt='y';;
6620 *) dflt='n';;
6621 esac
6622 rp='Use the experimental PerlIO abstraction layer?'
6623 . ./myread
6624 case "$ans" in
6625 y|Y) 
6626         val="$define"
6627         ;;     
6628 *)      
6629         echo "Ok, doing things the stdio way"
6630         val="$undef"
6631         ;;
6632 esac
6633 set useperlio
6634 eval $setvar 
6635
6636 case "$vendorprefix" in
6637 '')     d_vendorbin="$undef"
6638         vendorbin=''
6639         vendorbinexp=''
6640         ;;
6641 *)      d_vendorbin="$define"
6642         : determine where vendor-supplied executables go.
6643         dflt=$vendorprefix/bin
6644         fn=d~+
6645         rp='Pathname for the vendor-supplied executables directory?'
6646         . ./getfile
6647         vendorbin="$ans"
6648         vendorbinexp="$ansexp"
6649         : Change installation prefix, if necessary.
6650         if $test X"$prefix" != X"$installprefix"; then
6651                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6652         else
6653                 installvendorbin="$vendorbinexp"
6654         fi
6655         ;;
6656 esac
6657
6658 : Check how to convert floats to strings.
6659 if test "X$d_Gconvert" = X; then
6660         echo " "
6661         echo "Checking for an efficient way to convert floats to strings."
6662         $cat >try.c <<'EOP'
6663 #ifdef TRY_gconvert
6664 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6665 char *myname = "gconvert";
6666 #endif
6667 #ifdef TRY_gcvt
6668 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6669 char *myname = "gcvt";
6670 #endif
6671 #ifdef TRY_sprintf
6672 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6673 char *myname = "sprintf";
6674 #endif
6675
6676 #include <stdio.h>
6677
6678 int
6679 checkit(expect, got)
6680 char *expect;
6681 char *got;
6682 {
6683     if (strcmp(expect, got)) {
6684                 printf("%s oddity:  Expected %s, got %s\n",
6685                         myname, expect, got);
6686                 exit(1);
6687         }
6688 }
6689
6690 int main()
6691
6692         char buf[64]; 
6693         buf[63] = '\0';
6694
6695         /* This must be 1st test on (which?) platform */
6696         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6697         Gconvert(0.1, 8, 0, buf);
6698         checkit("0.1", buf);
6699
6700         Gconvert(1.0, 8, 0, buf); 
6701         checkit("1", buf);
6702
6703         Gconvert(0.0, 8, 0, buf); 
6704         checkit("0", buf);
6705
6706         Gconvert(-1.0, 8, 0, buf); 
6707         checkit("-1", buf);
6708
6709         /* Some Linux gcvt's give 1.e+5 here. */
6710         Gconvert(100000.0, 8, 0, buf); 
6711         checkit("100000", buf);
6712         
6713         /* Some Linux gcvt's give -1.e+5 here. */
6714         Gconvert(-100000.0, 8, 0, buf); 
6715         checkit("-100000", buf);
6716
6717         exit(0);
6718 }
6719 EOP
6720         case "$d_Gconvert" in
6721         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6722         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6723         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6724         *) xxx_list='gconvert gcvt sprintf' ;;
6725         esac
6726
6727         for xxx_convert in $xxx_list; do
6728                 echo "Trying $xxx_convert"
6729                 $rm -f try try$_o
6730                 set try -DTRY_$xxx_convert
6731                 if eval $compile; then
6732                         echo "$xxx_convert" found. >&4
6733                         if ./try; then
6734                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6735                                 break;
6736                         else
6737                                 echo "...But $xxx_convert didn't work as I expected."
6738                         fi
6739                 else
6740                         echo "$xxx_convert NOT found." >&4
6741                 fi
6742         done
6743                 
6744         case "$xxx_convert" in
6745         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6746         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6747         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6748         esac
6749 fi
6750
6751 : see if inttypes.h is available
6752 : we want a real compile instead of Inhdr because some systems
6753 : have an inttypes.h which includes non-existent headers
6754 echo " "
6755 $cat >try.c <<EOCP
6756 #include <inttypes.h>
6757 int main() {
6758         static int32_t foo32 = 0x12345678;
6759 }
6760 EOCP
6761 set try
6762 if eval $compile; then
6763         echo "<inttypes.h> found." >&4
6764         val="$define"
6765 else
6766         echo "<inttypes.h> NOT found." >&4
6767         val="$undef"
6768 fi
6769 $rm -f try.c try
6770 set i_inttypes
6771 eval $setvar
6772
6773 : check for int64_t
6774 case "$use64bits" in
6775 "$define" )
6776         echo " "
6777         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6778         $cat >try.c <<EOCP
6779 #include <sys/types.h>
6780 #$i_inttypes I_INTTYPES
6781 #ifdef I_INTTYPES
6782 #include <inttypes.h>
6783 #endif
6784 int64_t foo() { int64_t x; x = 7; return x; }
6785 EOCP
6786         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6787                 val="$define"
6788                 echo " Yup, it does." >&4
6789         else
6790                 val="$undef"
6791                 echo " Nope, it doesn't." >&4
6792         fi
6793         $rm -f try.*
6794         ;;
6795 *)      val="$undef"
6796         ;;
6797 esac
6798 set d_int64t
6799 eval $setvar
6800
6801
6802 : check for lengths of integral types
6803 echo " "
6804 case "$intsize" in
6805 '')
6806         echo "Checking to see how big your integers are..." >&4
6807         $cat >intsize.c <<'EOCP'
6808 #include <stdio.h>
6809 int main()
6810 {
6811         printf("intsize=%d;\n", sizeof(int));
6812         printf("longsize=%d;\n", sizeof(long));
6813         printf("shortsize=%d;\n", sizeof(short));
6814         exit(0);
6815 }
6816 EOCP
6817         set intsize
6818         if eval $compile_ok && ./intsize > /dev/null; then
6819                 eval `./intsize`
6820                 echo "Your integers are $intsize bytes long."
6821                 echo "Your long integers are $longsize bytes long."
6822                 echo "Your short integers are $shortsize bytes long."
6823         else
6824                 $cat >&4 <<EOM
6825 !
6826 Help! I can't compile and run the intsize test program: please enlighten me!
6827 (This is probably a misconfiguration in your system or libraries, and
6828 you really ought to fix it.  Still, I'll try anyway.)
6829 !
6830 EOM
6831                 dflt=4
6832                 rp="What is the size of an integer (in bytes)?"
6833                 . ./myread
6834                 intsize="$ans"
6835                 dflt=$intsize
6836                 rp="What is the size of a long integer (in bytes)?"
6837                 . ./myread
6838                 longsize="$ans"
6839                 dflt=2
6840                 rp="What is the size of a short integer (in bytes)?"
6841                 . ./myread
6842                 shortsize="$ans"
6843         fi
6844         ;;
6845 esac
6846 $rm -f intsize intsize.*
6847
6848 : check for long long
6849 echo " "
6850 $echo $n "Checking to see if your system supports long long...$c" >&4
6851 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6852 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6853         val="$define"
6854         echo " Yup, it does." >&4
6855 else
6856         val="$undef"
6857         echo " Nope, it doesn't." >&4
6858 fi
6859 $rm try.*
6860 set d_longlong
6861 eval $setvar
6862
6863 : check for length of long long
6864 case "${d_longlong}${longlongsize}" in
6865 $define)
6866         echo " "
6867         $echo $n "Checking to see how big your long longs are...$c" >&4
6868         $cat >try.c <<'EOCP'
6869 #include <stdio.h>
6870 int main()
6871 {
6872         printf("%d\n", sizeof(long long));
6873 }
6874 EOCP
6875         set try
6876         if eval $compile_ok; then
6877                 longlongsize=`./try`
6878                 $echo " $longlongsize bytes." >&4
6879         else
6880                 dflt='8'
6881                 echo " "
6882                 echo "(I can't seem to compile the test program.  Guessing...)"
6883                 rp="What is the size of a long long (in bytes)?"
6884                 . ./myread
6885                 longlongsize="$ans"
6886         fi
6887         if $test "X$longsize" = "X$longlongsize"; then
6888                 echo "(That isn't any different from an ordinary long.)"
6889         fi      
6890         ;;
6891 esac
6892 $rm -f try.c try
6893
6894 echo " "
6895
6896 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6897
6898 echo "Checking how to print 64-bit integers..." >&4
6899
6900 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6901         quad=int
6902         $cat >try.c <<'EOCP'
6903 #include <sys/types.h>
6904 #include <stdio.h>
6905 int main() {
6906   int q = 12345678901;
6907   printf("%ld\n", q);
6908 }
6909 EOCP
6910         set try
6911         if eval $compile; then
6912                 yyy=`./try$exe_ext`
6913                 case "$yyy" in
6914                 12345678901)
6915                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6916                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6917                         echo "We will use %d."
6918                         ;;
6919                 esac
6920         fi
6921 fi
6922
6923 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6924         quad=long
6925         $cat >try.c <<'EOCP'
6926 #include <sys/types.h>
6927 #include <stdio.h>
6928 int main() {
6929   long q = 12345678901;
6930   printf("%ld\n", q);
6931 }
6932 EOCP
6933         set try
6934         if eval $compile; then
6935                 yyy=`./try$exe_ext`
6936                 case "$yyy" in
6937                 12345678901)
6938                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6939                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6940                         echo "We will use %ld."
6941                         ;;
6942                 esac
6943         fi
6944 fi
6945
6946 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6947         quad=int64_t
6948         $cat >try.c <<'EOCP'
6949 #include <sys/types.h>
6950 #include <inttypes.h>
6951 #include <stdio.h>
6952 int main() {
6953   int64_t q = 12345678901;
6954   printf("%" PRId64 "\n", q);
6955 }
6956 EOCP
6957         set try
6958         if eval $compile; then
6959                 yyy=`./try$exe_ext`
6960                 case "$yyy" in
6961                 12345678901)
6962                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6963                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6964                         echo "We will use the C9X style."
6965                         ;;
6966                 esac
6967         fi
6968 fi
6969
6970 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6971         quad="long long"
6972         $cat >try.c <<'EOCP'
6973 #include <sys/types.h>
6974 #include <stdio.h>
6975 int main() {
6976   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6977   printf("%lld\n", q);
6978 }
6979 EOCP
6980         set try
6981         if eval $compile; then
6982                 yyy=`./try$exe_ext`
6983                 case "$yyy" in
6984                 12345678901)
6985                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6986                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6987                         echo "We will use the %lld style."
6988                         ;;
6989                 esac
6990         fi
6991 fi
6992
6993 if $test X"$sPRId64" = X -a X"$quad" != X; then
6994         $cat >try.c <<EOCP
6995 #include <sys/types.h>
6996 #include <stdio.h>
6997 int main() {
6998   $quad q = 12345678901;
6999   printf("%Ld\n", q);
7000 }
7001 EOCP
7002         set try
7003         if eval $compile; then
7004                 yyy=`./try$exe_ext`
7005                 case "$yyy" in
7006                 12345678901)
7007                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
7008                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
7009                         echo "We will use %lld."
7010                         ;;
7011                 esac
7012         fi
7013 fi
7014
7015 if $test X"$sPRId64" = X -a X"$quad" != X; then
7016         $cat >try.c <<EOCP
7017 #include <sys/types.h>
7018 #include <stdio.h>
7019 int main() {
7020   $quad q = 12345678901;
7021   printf("%qd\n", q);
7022 }
7023 EOCP
7024         set try
7025         if eval $compile; then
7026                 yyy=`./try$exe_ext`
7027                 case "$yyy" in
7028                 12345678901)
7029                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
7030                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
7031                         echo "We will use %qd."
7032                         ;;
7033                 esac
7034         fi
7035 fi
7036
7037 if $test X"$sPRId64" = X; then
7038         echo "Cannot figure out how to print 64-bit integers." >&4
7039 fi
7040
7041 $rm -f try try.*
7042
7043 fi # intsize -o longsize -o d_int64t -o d_longlong
7044
7045 case "$sPRId64" in
7046 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
7047         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7048         ;;
7049 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7050         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7051         ;;
7052 esac
7053
7054 : check for length of double
7055 echo " "
7056 case "$doublesize" in
7057 '')
7058         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7059         $cat >try.c <<'EOCP'
7060 #include <stdio.h>
7061 int main()
7062 {
7063         printf("%d\n", sizeof(double));
7064 }
7065 EOCP
7066         set try
7067         if eval $compile_ok; then
7068                 doublesize=`./try`
7069                 $echo " $doublesize bytes." >&4
7070         else
7071                 dflt='8'
7072                 echo "(I can't seem to compile the test program.  Guessing...)"
7073                 rp="What is the size of a double precision number (in bytes)?"
7074                 . ./myread
7075                 doublesize="$ans"
7076         fi
7077         ;;
7078 esac
7079 $rm -f try.c try
7080
7081 : check for long doubles
7082 echo " "
7083 $echo $n "Checking to see if your system supports long double...$c" >&4
7084 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7085 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7086         val="$define"
7087         echo " Yup, it does." >&4
7088 else
7089         val="$undef"
7090         echo " Nope, it doesn't." >&4
7091 fi
7092 $rm try.*
7093 set d_longdbl
7094 eval $setvar
7095
7096 : check for length of long double
7097 case "${d_longdbl}${longdblsize}" in
7098 $define)
7099         echo " "
7100         $echo $n "Checking to see how big your long doubles are...$c" >&4
7101         $cat >try.c <<'EOCP'
7102 #include <stdio.h>
7103 int main()
7104 {
7105         printf("%d\n", sizeof(long double));
7106 }
7107 EOCP
7108         set try
7109         if eval $compile; then
7110                 longdblsize=`./try`
7111                 $echo " $longdblsize bytes." >&4
7112         else
7113                 dflt='8'
7114                 echo " "
7115                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7116                 rp="What is the size of a long double (in bytes)?"
7117                 . ./myread
7118                 longdblsize="$ans"
7119         fi
7120         if $test "X$doublesize" = "X$longdblsize"; then
7121                 echo "(That isn't any different from an ordinary double.)"
7122         fi      
7123         ;;
7124 esac
7125 $rm -f try.c try
7126
7127 echo " "
7128
7129 if $test X"$d_longdbl" = X"$define"; then
7130
7131 echo "Checking how to print long doubles..." >&4
7132
7133 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7134         $cat >try.c <<'EOCP'
7135 #include <sys/types.h>
7136 #include <stdio.h>
7137 int main() {
7138   double d = 123.456;
7139   printf("%.3f\n", d);
7140 }
7141 EOCP
7142         set try
7143         if eval $compile; then
7144                 yyy=`./try$exe_ext`
7145                 case "$yyy" in
7146                 123.456)
7147                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7148                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7149                         echo "We will use %f."
7150                         ;;
7151                 esac
7152         fi
7153 fi
7154
7155 if $test X"$sPRIfldbl" = X; then
7156         $cat >try.c <<'EOCP'
7157 #include <sys/types.h>
7158 #include <stdio.h>
7159 int main() {
7160   long double d = 123.456;
7161   printf("%.3llf\n", d);
7162 }
7163 EOCP
7164         set try
7165         if eval $compile; then
7166                 yyy=`./try$exe_ext`
7167                 case "$yyy" in
7168                 123.456)
7169                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7170                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7171                         echo "We will use %llf."
7172                         ;;
7173                 esac
7174         fi
7175 fi
7176
7177 if $test X"$sPRIfldbl" = X; then
7178         $cat >try.c <<'EOCP'
7179 #include <sys/types.h>
7180 #include <stdio.h>
7181 int main() {
7182   long double d = 123.456;
7183   printf("%.3Lf\n", d);
7184 }
7185 EOCP
7186         set try
7187         if eval $compile; then
7188                 yyy=`./try$exe_ext`
7189                 case "$yyy" in
7190                 123.456)
7191                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7192                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7193                         echo "We will use %Lf."
7194                         ;;
7195                 esac
7196         fi
7197 fi
7198
7199 if $test X"$sPRIfldbl" = X; then
7200         $cat >try.c <<'EOCP'
7201 #include <sys/types.h>
7202 #include <stdio.h>
7203 int main() {
7204   long double d = 123.456;
7205   printf("%.3lf\n", d);
7206 }
7207 EOCP
7208         set try
7209         if eval $compile; then
7210                 yyy=`./try$exe_ext`
7211                 case "$yyy" in
7212                 123.456)
7213                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7214                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7215                         echo "We will use %lf."
7216                         ;;
7217                 esac
7218         fi
7219 fi
7220
7221 if $test X"$sPRIfldbl" = X; then
7222         echo "Cannot figure out how to print long doubles." >&4
7223 fi
7224
7225 $rm -f try try.*
7226
7227 fi # d_longdbl
7228
7229 case "$sPRIfldbl" in
7230 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7231         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7232         ;;
7233 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7234         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7235         ;;
7236 esac
7237
7238 : Initialize h_fcntl
7239 h_fcntl=false
7240
7241 : Initialize h_sysfile
7242 h_sysfile=false
7243
7244 : access call always available on UNIX
7245 set access d_access
7246 eval $inlibc
7247
7248 : locate the flags for 'access()'
7249 case "$d_access" in
7250 "$define")
7251         echo " "
7252         $cat >access.c <<'EOCP'
7253 #include <sys/types.h>
7254 #ifdef I_FCNTL
7255 #include <fcntl.h>
7256 #endif
7257 #ifdef I_SYS_FILE
7258 #include <sys/file.h>
7259 #endif
7260 #ifdef I_UNISTD
7261 #include <unistd.h>
7262 #endif
7263 int main() {
7264         exit(R_OK);
7265 }
7266 EOCP
7267         : check sys/file.h first, no particular reason here
7268         if $test `./findhdr sys/file.h` && \
7269                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7270                 h_sysfile=true;
7271                 echo "<sys/file.h> defines the *_OK access constants." >&4
7272         elif $test `./findhdr fcntl.h` && \
7273                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7274                 h_fcntl=true;
7275                 echo "<fcntl.h> defines the *_OK access constants." >&4
7276         elif $test `./findhdr unistd.h` && \
7277                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7278                 echo "<unistd.h> defines the *_OK access constants." >&4
7279         else
7280                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7281         fi
7282         ;;
7283 esac
7284 $rm -f access*
7285
7286 : see if accessx exists
7287 set accessx d_accessx
7288 eval $inlibc
7289
7290 : see if alarm exists
7291 set alarm d_alarm
7292 eval $inlibc
7293
7294 : see if atolf exists
7295 set atolf d_atolf
7296 eval $inlibc
7297
7298 : see if atoll exists
7299 set atoll d_atoll
7300 eval $inlibc
7301
7302 : Look for GNU-cc style attribute checking
7303 echo " "
7304 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7305 $cat >attrib.c <<'EOCP'
7306 #include <stdio.h>
7307 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7308 EOCP
7309 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7310         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7311                 echo "Your C compiler doesn't fully support __attribute__."
7312                 val="$undef"
7313         else
7314                 echo "Your C compiler supports __attribute__."
7315                 val="$define"
7316         fi
7317 else
7318         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7319         val="$undef"
7320 fi
7321 set d_attribut
7322 eval $setvar
7323 $rm -f attrib*
7324
7325 : see if bcmp exists
7326 set bcmp d_bcmp
7327 eval $inlibc
7328
7329 : see if bcopy exists
7330 set bcopy d_bcopy
7331 eval $inlibc
7332
7333 : see if this is a unistd.h system
7334 set unistd.h i_unistd
7335 eval $inhdr
7336
7337 : see if getpgrp exists
7338 set getpgrp d_getpgrp
7339 eval $inlibc
7340
7341 case "$d_getpgrp" in
7342 "$define")
7343         echo " "
7344         echo "Checking to see which flavor of getpgrp is in use..."
7345         $cat >set.c <<EOP
7346 #$i_unistd I_UNISTD
7347 #include <sys/types.h>
7348 #ifdef I_UNISTD
7349 #  include <unistd.h>
7350 #endif
7351 int main()
7352 {
7353         if (getuid() == 0) {
7354                 printf("(I see you are running Configure as super-user...)\n");
7355                 setuid(1);
7356         }
7357 #ifdef TRY_BSD_PGRP
7358         if (getpgrp(1) == 0)
7359                 exit(0);
7360 #else
7361         if (getpgrp() > 0)
7362                 exit(0);
7363 #endif
7364         exit(1);
7365 }
7366 EOP
7367         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7368                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7369                 val="$define"
7370         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7371                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7372                 val="$undef"
7373         else
7374                 echo "I can't seem to compile and run the test program."
7375                 if ./usg; then
7376                         xxx="a USG one, i.e. you use getpgrp()."
7377                 else
7378                         # SVR4 systems can appear rather BSD-ish.
7379                         case "$i_unistd" in
7380                         $undef)
7381                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7382                                 val="$define"
7383                                 ;;
7384                         $define)
7385                                 xxx="probably a USG one, i.e. you use getpgrp()."
7386                                 val="$undef"
7387                                 ;;
7388                         esac
7389                 fi
7390                 echo "Assuming your getpgrp is $xxx" >&4
7391         fi
7392         ;;
7393 *) val="$undef";;
7394 esac
7395 set d_bsdgetpgrp
7396 eval $setvar
7397 $rm -f set set.c
7398
7399 : see if setpgrp exists
7400 set setpgrp d_setpgrp
7401 eval $inlibc
7402
7403 case "$d_setpgrp" in
7404 "$define")
7405         echo " "
7406         echo "Checking to see which flavor of setpgrp is in use..."
7407         $cat >set.c <<EOP
7408 #$i_unistd I_UNISTD
7409 #include <sys/types.h>
7410 #ifdef I_UNISTD
7411 #  include <unistd.h>
7412 #endif
7413 int main()
7414 {
7415         if (getuid() == 0) {
7416                 printf("(I see you are running Configure as super-user...)\n");
7417                 setuid(1);
7418         }
7419 #ifdef TRY_BSD_PGRP
7420         if (-1 == setpgrp(1, 1))
7421                 exit(0);
7422 #else
7423         if (setpgrp() != -1)
7424                 exit(0);
7425 #endif
7426         exit(1);
7427 }
7428 EOP
7429         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7430                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7431                 val="$define"
7432         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7433                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7434                 val="$undef"
7435         else
7436                 echo "(I can't seem to compile and run the test program.)"
7437                 if ./usg; then
7438                         xxx="a USG one, i.e. you use setpgrp()."
7439                 else
7440                         # SVR4 systems can appear rather BSD-ish.
7441                         case "$i_unistd" in
7442                         $undef)
7443                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7444                                 val="$define"
7445                                 ;;
7446                         $define)
7447                                 xxx="probably a USG one, i.e. you use setpgrp()."
7448                                 val="$undef"
7449                                 ;;
7450                         esac
7451                 fi
7452                 echo "Assuming your setpgrp is $xxx" >&4
7453         fi
7454         ;;
7455 *) val="$undef";;
7456 esac
7457 set d_bsdsetpgrp
7458 eval $setvar
7459 $rm -f set set.c
7460 : see if bzero exists
7461 set bzero d_bzero
7462 eval $inlibc
7463
7464 : see if signal is declared as pointer to function returning int or void
7465 echo " "
7466 xxx=`./findhdr signal.h`
7467 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7468 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7469         echo "You have int (*signal())() instead of void." >&4
7470         val="$undef"
7471 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7472         echo "You have void (*signal())()." >&4
7473         val="$define"
7474 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7475         echo "You have int (*signal())() instead of void." >&4
7476         val="$undef"
7477 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7478         echo "You have void (*signal())()." >&4
7479         val="$define"
7480 else
7481         case "$d_voidsig" in
7482         '')
7483         echo "I can't determine whether signal handler returns void or int..." >&4
7484                 dflt=void
7485                 rp="What type does your signal handler return?"
7486                 . ./myread
7487                 case "$ans" in
7488                 v*) val="$define";;
7489                 *) val="$undef";;
7490                 esac;;
7491         "$define")
7492                 echo "As you already told me, signal handler returns void." >&4
7493                 val="$define"
7494                 ;;
7495         *)      echo "As you already told me, signal handler returns int." >&4
7496                 val="$undef"
7497                 ;;
7498         esac
7499 fi
7500 set d_voidsig
7501 eval $setvar
7502 case "$d_voidsig" in
7503 "$define") signal_t="void";;
7504 *) signal_t="int";;
7505 esac
7506 $rm -f $$.tmp
7507
7508 : check for ability to cast large floats to 32-bit ints.
7509 echo " "
7510 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7511 if $test "$intsize" -ge 4; then
7512         xxx=int
7513 else
7514         xxx=long
7515 fi
7516 $cat >try.c <<EOCP
7517 #include <stdio.h>
7518 #include <sys/types.h>
7519 #include <signal.h>
7520 $signal_t blech(s) int s; { exit(3); }
7521 int main()
7522 {
7523         $xxx i32;
7524         double f, g;
7525         int result = 0;
7526         char str[16];
7527         signal(SIGFPE, blech);
7528
7529         /* Don't let compiler optimize the test away.  Store the number 
7530            in a writable string for gcc to pass to sscanf under HP/UX.
7531         */
7532         sprintf(str, "2147483647");
7533         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7534         g = 10 * f;
7535         i32  = ($xxx) g;
7536
7537         /* x86 processors will probably give 0x8000 0000, which is a
7538        sign change.  We don't want that.  We want to mimic SPARC
7539            behavior here, which is to preserve the sign and give
7540            back 0x7fff ffff.
7541         */
7542         if (i32 != ($xxx) f)
7543                 result |= 1;
7544         exit(result);
7545 }
7546 EOCP
7547 set try
7548 if eval $compile_ok; then
7549         ./try
7550         yyy=$?
7551 else
7552         echo "(I can't seem to compile the test program--assuming it can't)"
7553         yyy=1
7554 fi
7555 case "$yyy" in
7556 0)      val="$define"
7557         echo "Yup, it can."
7558         ;;
7559 *)      val="$undef"
7560         echo "Nope, it can't."
7561         ;;
7562 esac
7563 set d_casti32
7564 eval $setvar
7565 $rm -f try try.*
7566
7567 : check for ability to cast negative floats to unsigned
7568 echo " "
7569 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7570 $cat >try.c <<EOCP
7571 #include <stdio.h>
7572 #include <sys/types.h>
7573 #include <signal.h>
7574 $signal_t blech(s) int s; { exit(7); }
7575 $signal_t blech_in_list(s) int s; { exit(4); }
7576 unsigned long dummy_long(p) unsigned long p; { return p; }
7577 unsigned int dummy_int(p) unsigned int p; { return p; }
7578 unsigned short dummy_short(p) unsigned short p; { return p; }
7579 int main()
7580 {
7581         double f;
7582         unsigned long along;
7583         unsigned int aint;
7584         unsigned short ashort;
7585         int result = 0;
7586         char str[16];
7587         
7588         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7589            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7590            optimized the whole file away
7591         */
7592         /* Store the number in a writable string for gcc to pass to 
7593            sscanf under HP/UX.
7594         */
7595         sprintf(str, "-123");
7596         sscanf(str, "%lf", &f);  /* f = -123.; */
7597
7598         signal(SIGFPE, blech);
7599         along = (unsigned long)f;
7600         aint = (unsigned int)f;
7601         ashort = (unsigned short)f;
7602         if (along != (unsigned long)-123)
7603                 result |= 1;
7604         if (aint != (unsigned int)-123)
7605                 result |= 1;
7606         if (ashort != (unsigned short)-123)
7607                 result |= 1;
7608         sprintf(str, "1073741824.");
7609         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7610         f = f + f;
7611         along = 0;
7612         along = (unsigned long)f;
7613         if (along != 0x80000000)
7614                 result |= 2;
7615         f -= 1.;
7616         along = 0;
7617         along = (unsigned long)f;
7618         if (along != 0x7fffffff)
7619                 result |= 1;
7620         f += 2.;
7621         along = 0;
7622         along = (unsigned long)f;
7623         if (along != 0x80000001)
7624                 result |= 2;
7625         if (result)
7626                 exit(result);
7627         signal(SIGFPE, blech_in_list);
7628         sprintf(str, "123.");
7629         sscanf(str, "%lf", &f);  /* f = 123.; */
7630         along = dummy_long((unsigned long)f);
7631         aint = dummy_int((unsigned int)f);
7632         ashort = dummy_short((unsigned short)f);
7633         if (along != (unsigned long)123)
7634                 result |= 4;
7635         if (aint != (unsigned int)123)
7636                 result |= 4;
7637         if (ashort != (unsigned short)123)
7638                 result |= 4;
7639         exit(result);
7640
7641 }
7642 EOCP
7643 set try
7644 if eval $compile_ok; then
7645         ./try
7646         castflags=$?
7647 else
7648         echo "(I can't seem to compile the test program--assuming it can't)"
7649         castflags=7
7650 fi
7651 case "$castflags" in
7652 0)      val="$define"
7653         echo "Yup, it can."
7654         ;;
7655 *)      val="$undef"
7656         echo "Nope, it can't."
7657         ;;
7658 esac
7659 set d_castneg
7660 eval $setvar
7661 $rm -f try.*
7662
7663 : see if vprintf exists
7664 echo " "
7665 if set vprintf val -f d_vprintf; eval $csym; $val; then
7666         echo 'vprintf() found.' >&4
7667         val="$define"
7668         $cat >vprintf.c <<'EOF'
7669 #include <varargs.h>
7670
7671 int main() { xxx("foo"); }
7672
7673 xxx(va_alist)
7674 va_dcl
7675 {
7676         va_list args;
7677         char buf[10];
7678
7679         va_start(args);
7680         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7681 }
7682 EOF
7683         set vprintf
7684         if eval $compile && ./vprintf; then
7685                 echo "Your vsprintf() returns (int)." >&4
7686                 val2="$undef"
7687         else
7688                 echo "Your vsprintf() returns (char*)." >&4
7689                 val2="$define"
7690         fi
7691 else
7692         echo 'vprintf() NOT found.' >&4
7693                 val="$undef"
7694                 val2="$undef"
7695 fi
7696 set d_vprintf
7697 eval $setvar
7698 val=$val2
7699 set d_charvspr
7700 eval $setvar
7701
7702 : see if chown exists
7703 set chown d_chown
7704 eval $inlibc
7705
7706 : see if chroot exists
7707 set chroot d_chroot
7708 eval $inlibc
7709
7710 : see if chsize exists
7711 set chsize d_chsize
7712 eval $inlibc
7713
7714 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7715 while $test $# -ge 2; do
7716         case "$1" in
7717         $define) echo "#include <$2>";;
7718         esac ;
7719     shift 2;
7720 done > try.c;
7721 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
7722 set try;
7723 if eval $compile; then
7724         val="$define";
7725 else
7726         val="$undef";
7727 fi;
7728 set $varname;
7729 eval $setvar;
7730 $rm -f try.c try.o'
7731
7732 : see if this is a sys/uio.h system
7733 set sys/uio.h i_sysuio
7734 eval $inhdr
7735
7736 echo "Checking to see if your system supports struct iovec..." >&4
7737 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7738 eval $hasfield
7739 case "$d_iovec_s" in
7740 "$define")      echo "Yup, it does." >&4
7741                 ;;
7742 *)              echo "Nope, it doesn't." >&4
7743                 ;;
7744 esac
7745
7746 socketlib=''
7747 sockethdr=''
7748 : see whether socket exists
7749 echo " "
7750 $echo $n "Hmm... $c" >&4
7751 if set socket val -f d_socket; eval $csym; $val; then
7752         echo "Looks like you have Berkeley networking support." >&4
7753         d_socket="$define"
7754         if set setsockopt val -f; eval $csym; $val; then
7755                 d_oldsock="$undef"
7756         else
7757                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7758                 d_oldsock="$define"
7759         fi
7760 else
7761         if $contains socklib libc.list >/dev/null 2>&1; then
7762                 echo "Looks like you have Berkeley networking support." >&4
7763                 d_socket="$define"
7764                 : we will have to assume that it supports the 4.2 BSD interface
7765                 d_oldsock="$undef"
7766         else
7767                 echo "You don't have Berkeley networking in libc$_a..." >&4
7768                 if test "X$d_socket" = "X$define"; then
7769                    echo "...but you seem to believe that you have sockets." >&4
7770                 else
7771                         for net in net socket
7772                         do
7773                                 if test -f /usr/lib/lib$net$_a; then
7774                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7775                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7776                                         if $contains socket libc.list >/dev/null 2>&1; then
7777                                                 d_socket="$define"
7778                                                 socketlib="-l$net"
7779                                                 case "$net" in
7780                                                 net)
7781                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7782                                                         sockethdr="-I/usr/netinclude"
7783                                                         ;;
7784                                                 esac
7785                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7786                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7787                                                         d_oldsock="$undef"
7788                                                 else
7789                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7790                                                         d_oldsock="$define"
7791                                                 fi
7792                                                 break
7793                                         fi
7794                                 fi
7795                         done
7796                         if test "X$d_socket" != "X$define"; then
7797                            echo "or anywhere else I see." >&4
7798                            d_socket="$undef"
7799                            d_oldsock="$undef"
7800                         fi
7801                 fi
7802         fi
7803 fi
7804
7805 : see if socketpair exists
7806 set socketpair d_sockpair
7807 eval $inlibc
7808
7809
7810 echo " "
7811 echo "Checking the availability of certain socket constants..." >& 4
7812 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7813         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7814         $cat >try.c <<EOF
7815 #include <sys/types.h>
7816 #include <sys/socket.h>
7817 int main() {
7818     int i = $ENUM;
7819 }
7820 EOF
7821         val="$undef"
7822         set try; if eval $compile; then
7823                 val="$define"
7824         fi
7825         set d_${enum}; eval $setvar
7826         $rm -f try.c try
7827 done
7828
7829 set sendmsg d_sendmsg
7830 eval $inlibc
7831
7832 set recvmsg d_recvmsg
7833 eval $inlibc
7834
7835 echo " "
7836 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7837 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7838 eval $hasfield
7839 case "$d_msghdr_s" in
7840 "$define")      echo "Yup, it does." >&4
7841                 ;;
7842 *)              echo "Nope, it doesn't." >&4
7843                 ;;
7844 esac
7845
7846 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7847 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7848 eval $hasfield
7849 case "$d_cmsghdr_s" in
7850 "$define")      echo "Yup, it does." >&4
7851                 ;;
7852 *)              echo "Nope, it doesn't." >&4
7853                 ;;
7854 esac
7855
7856 : check for const keyword
7857 echo " "
7858 echo 'Checking to see if your C compiler knows about "const"...' >&4
7859 $cat >const.c <<'EOCP'
7860 typedef struct spug { int drokk; } spug;
7861 int main()
7862 {
7863         const char *foo;
7864         const spug y;
7865 }
7866 EOCP
7867 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7868         val="$define"
7869         echo "Yup, it does."
7870 else
7871         val="$undef"
7872         echo "Nope, it doesn't."
7873 fi
7874 set d_const
7875 eval $setvar
7876
7877 : see if crypt exists
7878 echo " "
7879 if set crypt val -f d_crypt; eval $csym; $val; then
7880         echo 'crypt() found.' >&4
7881         val="$define"
7882         cryptlib=''
7883 else
7884         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7885         if $test -z "$cryptlib"; then
7886                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7887         else
7888                 cryptlib=-lcrypt
7889         fi
7890         if $test -z "$cryptlib"; then
7891                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7892         else
7893                 cryptlib=-lcrypt
7894         fi
7895         if $test -z "$cryptlib"; then
7896                 cryptlib=`./loc libcrypt$_a "" $libpth`
7897         else
7898                 cryptlib=-lcrypt
7899         fi
7900         if $test -z "$cryptlib"; then
7901                 echo 'crypt() NOT found.' >&4
7902                 val="$undef"
7903         else
7904                 val="$define"
7905         fi
7906 fi
7907 set d_crypt
7908 eval $setvar
7909
7910 : get csh whereabouts
7911 case "$csh" in
7912 'csh') val="$undef" ;;
7913 *) val="$define" ;;
7914 esac
7915 set d_csh
7916 eval $setvar
7917 : Respect a hint or command line value for full_csh.
7918 case "$full_csh" in
7919 '') full_csh=$csh ;;
7920 esac
7921
7922 : see if cuserid exists
7923 set cuserid d_cuserid
7924 eval $inlibc
7925
7926 : see if this is a limits.h system
7927 set limits.h i_limits
7928 eval $inhdr
7929
7930 : see if this is a float.h system
7931 set float.h i_float
7932 eval $inhdr
7933
7934 : See if number of significant digits in a double precision number is known
7935 echo " "
7936 $cat >dbl_dig.c <<EOM
7937 #$i_limits I_LIMITS
7938 #$i_float I_FLOAT
7939 #ifdef I_LIMITS
7940 #include <limits.h>
7941 #endif
7942 #ifdef I_FLOAT
7943 #include <float.h>
7944 #endif
7945 #ifdef DBL_DIG
7946 printf("Contains DBL_DIG");
7947 #endif
7948 EOM
7949 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7950 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7951         echo "DBL_DIG found." >&4
7952         val="$define"
7953 else
7954         echo "DBL_DIG NOT found." >&4
7955         val="$undef"
7956 fi
7957 $rm -f dbl_dig.?
7958 set d_dbl_dig
7959 eval $setvar
7960
7961 : see if difftime exists
7962 set difftime d_difftime
7963 eval $inlibc
7964
7965 : see if this is a dirent system
7966 echo " "
7967 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7968         val="$define"
7969         echo "<dirent.h> found." >&4
7970 else
7971         val="$undef"
7972         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7973                 echo "<sys/dir.h> found." >&4
7974                 echo " "
7975         else
7976                 xinc=`./findhdr sys/ndir.h`
7977         fi
7978         echo "<dirent.h> NOT found." >&4
7979 fi
7980 set i_dirent
7981 eval $setvar
7982
7983 : Look for type of directory structure.
7984 echo " "
7985 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7986
7987 case "$direntrytype" in
7988 ''|' ')
7989         case "$i_dirent" in
7990         $define) guess1='struct dirent' ;;
7991         *) guess1='struct direct'  ;;
7992         esac
7993         ;;
7994 *)      guess1="$direntrytype"
7995         ;;
7996 esac
7997
7998 case "$guess1" in
7999 'struct dirent') guess2='struct direct' ;;
8000 *) guess2='struct dirent' ;;
8001 esac
8002                 
8003 if $contains "$guess1" try.c >/dev/null 2>&1; then
8004         direntrytype="$guess1"
8005         echo "Your directory entries are $direntrytype." >&4
8006 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8007         direntrytype="$guess2"
8008         echo "Your directory entries seem to be $direntrytype." >&4
8009 else
8010         echo "I don't recognize your system's directory entries." >&4
8011         rp="What type is used for directory entries on this system?"
8012         dflt="$guess1"
8013         . ./myread
8014         direntrytype="$ans"
8015 fi
8016 $rm -f try.c
8017
8018
8019 : see if the directory entry stores field length
8020 echo " "
8021 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8022 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8023         echo "Good, your directory entry keeps length information in d_namlen." >&4
8024         val="$define"
8025 else
8026         echo "Your directory entry does not know about the d_namlen field." >&4
8027         val="$undef"
8028 fi
8029 set d_dirnamlen
8030 eval $setvar
8031 $rm -f try.c
8032
8033 : see if dlerror exists
8034 xxx_runnm="$runnm"
8035 runnm=false
8036 set dlerror d_dlerror
8037 eval $inlibc
8038 runnm="$xxx_runnm"
8039
8040 : see if dlfcn is available
8041 set dlfcn.h i_dlfcn
8042 eval $inhdr
8043
8044 case "$usedl" in
8045 $define|y|true)
8046         $cat << EOM
8047
8048 On a few systems, the dynamically loaded modules that perl generates and uses
8049 will need a different extension than shared libs. The default will probably
8050 be appropriate.
8051
8052 EOM
8053         case "$dlext" in
8054         '')     dflt="$so" ;;
8055         *)      dflt="$dlext" ;;
8056         esac
8057         rp='What is the extension of dynamically loaded modules'
8058         . ./myread
8059         dlext="$ans"
8060         ;;
8061 *)
8062         dlext="none"
8063         ;;
8064 esac
8065
8066 : Check if dlsym need a leading underscore
8067 echo " "
8068 val="$undef"
8069
8070 case "$dlsrc" in
8071 dl_dlopen.xs)
8072         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8073         $cat >dyna.c <<'EOM'
8074 fred () { }
8075 EOM
8076
8077 $cat >fred.c<<EOM
8078
8079 #include <stdio.h>
8080 #$i_dlfcn I_DLFCN
8081 #ifdef I_DLFCN
8082 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8083 #else
8084 #include <sys/types.h>
8085 #include <nlist.h>
8086 #include <link.h>
8087 #endif
8088
8089 extern int fred() ;
8090
8091 int main()
8092 {
8093     void * handle ;
8094     void * symbol ;
8095 #ifndef RTLD_LAZY
8096     int mode = 1 ;
8097 #else
8098     int mode = RTLD_LAZY ;
8099 #endif
8100     handle = dlopen("./dyna.$dlext", mode) ;
8101     if (handle == NULL) {
8102         printf ("1\n") ;
8103         fflush (stdout) ;
8104         exit(0);
8105     }
8106     symbol = dlsym(handle, "fred") ;
8107     if (symbol == NULL) {
8108         /* try putting a leading underscore */
8109         symbol = dlsym(handle, "_fred") ;
8110         if (symbol == NULL) {
8111             printf ("2\n") ;
8112             fflush (stdout) ;
8113             exit(0);
8114         }
8115         printf ("3\n") ;
8116     }
8117     else
8118         printf ("4\n") ;
8119     fflush (stdout) ;
8120     exit(0);
8121 }
8122 EOM
8123         : Call the object file tmp-dyna.o in case dlext=o.
8124         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8125                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8126                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8127                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8128                 xxx=`./fred`
8129                 case $xxx in
8130                 1)      echo "Test program failed using dlopen." >&4
8131                         echo "Perhaps you should not use dynamic loading." >&4;;
8132                 2)      echo "Test program failed using dlsym." >&4
8133                         echo "Perhaps you should not use dynamic loading." >&4;;
8134                 3)      echo "dlsym needs a leading underscore" >&4
8135                         val="$define" ;;
8136                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8137                 esac
8138         else
8139                 echo "I can't compile and run the test program." >&4
8140                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8141         fi
8142         ;;
8143 esac
8144                 
8145 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8146
8147 set d_dlsymun
8148 eval $setvar
8149
8150 hasproto='varname=$1; func=$2; shift; shift;
8151 while $test $# -ge 2; do
8152         case "$1" in
8153         $define) echo "#include <$2>";;
8154         esac ;
8155     shift 2;
8156 done > try.c;
8157 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8158 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8159         echo "$func() prototype found.";
8160         val="$define";
8161 else
8162         echo "$func() prototype NOT found.";
8163         val="$undef";
8164 fi;
8165 set $varname;
8166 eval $setvar;
8167 $rm -f try.c tryout.c'
8168
8169 : see if prototype for drand48 is available
8170 echo " "
8171 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8172 eval $hasproto
8173
8174 : see if dup2 exists
8175 set dup2 d_dup2
8176 eval $inlibc
8177
8178 : see if eaccess exists
8179 set eaccess d_eaccess
8180 eval $inlibc
8181
8182 : see if endgrent exists
8183 set endgrent d_endgrent
8184 eval $inlibc
8185
8186 : see if endhostent exists
8187 set endhostent d_endhent
8188 eval $inlibc
8189
8190 : see if endnetent exists
8191 set endnetent d_endnent
8192 eval $inlibc
8193
8194 : see if endprotoent exists
8195 set endprotoent d_endpent
8196 eval $inlibc
8197
8198 : see if endpwent exists
8199 set endpwent d_endpwent
8200 eval $inlibc
8201
8202 : see if endservent exists
8203 set endservent d_endsent
8204 eval $inlibc
8205
8206 : see if endspent exists
8207 set endspent d_endspent
8208 eval $inlibc
8209
8210 : Locate the flags for 'open()'
8211 echo " "
8212 $cat >open3.c <<'EOCP'
8213 #include <sys/types.h>
8214 #ifdef I_FCNTL
8215 #include <fcntl.h>
8216 #endif
8217 #ifdef I_SYS_FILE
8218 #include <sys/file.h>
8219 #endif
8220 int main() {
8221         if(O_RDONLY);
8222 #ifdef O_TRUNC
8223         exit(0);
8224 #else
8225         exit(1);
8226 #endif
8227 }
8228 EOCP
8229 : check sys/file.h first to get FREAD on Sun
8230 if $test `./findhdr sys/file.h` && \
8231                 set open3 -DI_SYS_FILE && eval $compile; then
8232         h_sysfile=true;
8233         echo "<sys/file.h> defines the O_* constants..." >&4
8234         if ./open3; then
8235                 echo "and you have the 3 argument form of open()." >&4
8236                 val="$define"
8237         else
8238                 echo "but not the 3 argument form of open().  Oh, well." >&4
8239                 val="$undef"
8240         fi
8241 elif $test `./findhdr fcntl.h` && \
8242                 set open3 -DI_FCNTL && eval $compile; then
8243         h_fcntl=true;
8244         echo "<fcntl.h> defines the O_* constants..." >&4
8245         if ./open3; then
8246                 echo "and you have the 3 argument form of open()." >&4
8247                 val="$define"
8248         else
8249                 echo "but not the 3 argument form of open().  Oh, well." >&4
8250                 val="$undef"
8251         fi
8252 else
8253         val="$undef"
8254         echo "I can't find the O_* constant definitions!  You got problems." >&4
8255 fi
8256 set d_open3
8257 eval $setvar
8258 $rm -f open3*
8259
8260 : check for non-blocking I/O stuff
8261 case "$h_sysfile" in
8262 true) echo "#include <sys/file.h>" > head.c;;
8263 *)
8264         case "$h_fcntl" in
8265         true) echo "#include <fcntl.h>" > head.c;;
8266         *) echo "#include <sys/fcntl.h>" > head.c;;
8267         esac
8268         ;;
8269 esac
8270 echo " "
8271 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8272 case "$o_nonblock" in
8273 '')
8274         $cat head.c > try.c
8275         $cat >>try.c <<'EOCP'
8276 int main() {
8277 #ifdef O_NONBLOCK
8278         printf("O_NONBLOCK\n");
8279         exit(0);
8280 #endif
8281 #ifdef O_NDELAY
8282         printf("O_NDELAY\n");
8283         exit(0);
8284 #endif
8285 #ifdef FNDELAY
8286         printf("FNDELAY\n");
8287         exit(0);
8288 #endif
8289         exit(0);
8290 }
8291 EOCP
8292         set try
8293         if eval $compile_ok; then
8294                 o_nonblock=`./try`
8295                 case "$o_nonblock" in
8296                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8297                 *) echo "Seems like we can use $o_nonblock.";;
8298                 esac
8299         else
8300                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8301         fi
8302         ;;
8303 *) echo "Using $hint value $o_nonblock.";;
8304 esac
8305 $rm -f try try.* .out core
8306
8307 echo " "
8308 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8309 case "$eagain" in
8310 '')
8311         $cat head.c > try.c
8312         $cat >>try.c <<EOCP
8313 #include <errno.h>
8314 #include <sys/types.h>
8315 #include <signal.h>
8316 #define MY_O_NONBLOCK $o_nonblock
8317 #ifndef errno  /* XXX need better Configure test */
8318 extern int errno;
8319 #endif
8320 $signal_t blech(x) int x; { exit(3); }
8321 EOCP
8322         $cat >> try.c <<'EOCP'
8323 int main()
8324 {
8325         int pd[2];
8326         int pu[2];
8327         char buf[1];
8328         char string[100];
8329
8330         pipe(pd);       /* Down: child -> parent */
8331         pipe(pu);       /* Up: parent -> child */
8332         if (0 != fork()) {
8333                 int ret;
8334                 close(pd[1]);   /* Parent reads from pd[0] */
8335                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8336                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8337                         exit(1);
8338                 signal(SIGALRM, blech);
8339                 alarm(5);
8340                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8341                         exit(2);
8342                 sprintf(string, "%d\n", ret);
8343                 write(2, string, strlen(string));
8344                 alarm(0);
8345 #ifdef EAGAIN
8346                 if (errno == EAGAIN) {
8347                         printf("EAGAIN\n");
8348                         goto ok;
8349                 }
8350 #endif
8351 #ifdef EWOULDBLOCK
8352                 if (errno == EWOULDBLOCK)
8353                         printf("EWOULDBLOCK\n");
8354 #endif
8355         ok:
8356                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8357                 sleep(2);                               /* Give it time to close our pipe */
8358                 alarm(5);
8359                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8360                 alarm(0);
8361                 sprintf(string, "%d\n", ret);
8362                 write(3, string, strlen(string));
8363                 exit(0);
8364         }
8365
8366         close(pd[0]);                   /* We write to pd[1] */
8367         close(pu[1]);                   /* We read from pu[0] */
8368         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8369         close(pd[1]);                   /* Pipe pd is now fully closed! */
8370         exit(0);                                /* Bye bye, thank you for playing! */
8371 }
8372 EOCP
8373         set try
8374         if eval $compile_ok; then
8375                 echo "$startsh" >mtry
8376                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8377                 chmod +x mtry
8378                 ./mtry >/dev/null 2>&1
8379                 case $? in
8380                 0) eagain=`$cat try.out`;;
8381                 1) echo "Could not perform non-blocking setting!";;
8382                 2) echo "I did a successful read() for something that was not there!";;
8383                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8384                 *) echo "Something terribly wrong happened during testing.";;
8385                 esac
8386                 rd_nodata=`$cat try.ret`
8387                 echo "A read() system call with no data present returns $rd_nodata."
8388                 case "$rd_nodata" in
8389                 0|-1) ;;
8390                 *)
8391                         echo "(That's peculiar, fixing that to be -1.)"
8392                         rd_nodata=-1
8393                         ;;
8394                 esac
8395                 case "$eagain" in
8396                 '')
8397                         echo "Forcing errno EAGAIN on read() with no data available."
8398                         eagain=EAGAIN
8399                         ;;
8400                 *)
8401                         echo "Your read() sets errno to $eagain when no data is available."
8402                         ;;
8403                 esac
8404                 status=`$cat try.err`
8405                 case "$status" in
8406                 0) echo "And it correctly returns 0 to signal EOF.";;
8407                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8408                 *) echo "However, your read() returns '$status' on EOF??";;
8409                 esac
8410                 val="$define"
8411                 if test "$status" = "$rd_nodata"; then
8412                         echo "WARNING: you can't distinguish between EOF and no data!"
8413                         val="$undef"
8414                 fi
8415         else
8416                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8417                 eagain=EAGAIN
8418         fi
8419         set d_eofnblk
8420         eval $setvar
8421         ;;
8422 *)
8423         echo "Using $hint value $eagain."
8424         echo "Your read() returns $rd_nodata when no data is present."
8425         case "$d_eofnblk" in
8426         "$define") echo "And you can see EOF because read() returns 0.";;
8427         "$undef") echo "But you can't see EOF status from read() returned value.";;
8428         *)
8429                 echo "(Assuming you can't see EOF status from read anyway.)"
8430                 d_eofnblk=$undef
8431                 ;;
8432         esac
8433         ;;
8434 esac
8435 $rm -f try try.* .out core head.c mtry
8436
8437 : see if fchmod exists
8438 set fchmod d_fchmod
8439 eval $inlibc
8440
8441 : see if fchown exists
8442 set fchown d_fchown
8443 eval $inlibc
8444
8445 : see if this is an fcntl system
8446 set fcntl d_fcntl
8447 eval $inlibc
8448
8449 : see if sys/select.h has to be included
8450 set sys/select.h i_sysselct
8451 eval $inhdr
8452
8453 : see if we should include time.h, sys/time.h, or both
8454 echo " "
8455 if test "X$timeincl" = X; then
8456         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8457         $echo $n "I'm now running the test program...$c"
8458         $cat >try.c <<'EOCP'
8459 #include <sys/types.h>
8460 #ifdef I_TIME
8461 #include <time.h>
8462 #endif
8463 #ifdef I_SYSTIME
8464 #ifdef SYSTIMEKERNEL
8465 #define KERNEL
8466 #endif
8467 #include <sys/time.h>
8468 #endif
8469 #ifdef I_SYSSELECT
8470 #include <sys/select.h>
8471 #endif
8472 int main()
8473 {
8474         struct tm foo;
8475 #ifdef S_TIMEVAL
8476         struct timeval bar;
8477 #endif
8478 #ifdef S_TIMEZONE
8479         struct timezone tzp;
8480 #endif
8481         if (foo.tm_sec == foo.tm_sec)
8482                 exit(0);
8483 #ifdef S_TIMEVAL
8484         if (bar.tv_sec == bar.tv_sec)
8485                 exit(0);
8486 #endif
8487         exit(1);
8488 }
8489 EOCP
8490         flags=''
8491         for s_timezone in '-DS_TIMEZONE' ''; do
8492         sysselect=''
8493         for s_timeval in '-DS_TIMEVAL' ''; do
8494         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8495         for i_time in '' '-DI_TIME'; do
8496         for i_systime in '-DI_SYSTIME' ''; do
8497                 case "$flags" in
8498                 '') $echo $n ".$c"
8499                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8500                         if eval $compile; then
8501                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8502                                 shift
8503                                 flags="$*"
8504                                 echo " "
8505                                 $echo $n "Succeeded with $flags$c"
8506                         fi
8507                         ;;
8508                 esac
8509         done
8510         done
8511         done
8512         done
8513         done
8514         timeincl=''
8515         echo " "
8516         case "$flags" in
8517         *SYSTIMEKERNEL*) i_systimek="$define"
8518                 timeincl=`./findhdr sys/time.h`
8519                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8520         *) i_systimek="$undef";;
8521         esac
8522         case "$flags" in
8523         *I_TIME*) i_time="$define"
8524                 timeincl=`./findhdr time.h`" $timeincl"
8525                 echo "We'll include <time.h>." >&4;;
8526         *) i_time="$undef";;
8527         esac
8528         case "$flags" in
8529         *I_SYSTIME*) i_systime="$define"
8530                 timeincl=`./findhdr sys/time.h`" $timeincl"
8531                 echo "We'll include <sys/time.h>." >&4;;
8532         *) i_systime="$undef";;
8533         esac
8534         $rm -f try.c try
8535 fi
8536
8537 : check for fd_set items
8538 $cat <<EOM
8539
8540 Checking to see how well your C compiler handles fd_set and friends ...
8541 EOM
8542 $cat >fd_set.c <<EOCP
8543 #$i_systime I_SYS_TIME
8544 #$i_sysselct I_SYS_SELECT
8545 #$d_socket HAS_SOCKET
8546 #include <sys/types.h>
8547 #ifdef HAS_SOCKET
8548 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8549 #endif
8550 #ifdef I_SYS_TIME
8551 #include <sys/time.h>
8552 #endif
8553 #ifdef I_SYS_SELECT
8554 #include <sys/select.h>
8555 #endif
8556 int main() {
8557         fd_set fds;
8558
8559 #ifdef TRYBITS
8560         if(fds.fds_bits);
8561 #endif
8562
8563 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8564         exit(0);
8565 #else
8566         exit(1);
8567 #endif
8568 }
8569 EOCP
8570 set fd_set -DTRYBITS
8571 if eval $compile; then
8572         d_fds_bits="$define"
8573         d_fd_set="$define"
8574         echo "Well, your system knows about the normal fd_set typedef..." >&4
8575         if ./fd_set; then
8576                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8577                 d_fd_macros="$define"
8578         else
8579                 $cat >&4 <<'EOM'
8580 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8581 EOM
8582                 d_fd_macros="$undef"
8583         fi
8584 else
8585         $cat <<'EOM'
8586 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8587 EOM
8588         set fd_set
8589         if eval $compile; then
8590                 d_fds_bits="$undef"
8591                 d_fd_set="$define"
8592                 echo "Well, your system has some sort of fd_set available..." >&4
8593                 if ./fd_set; then
8594                         echo "and you have the normal fd_set macros." >&4
8595                         d_fd_macros="$define"
8596                 else
8597                         $cat <<'EOM'
8598 but not the normal fd_set macros!  Gross!  More work for me...
8599 EOM
8600                         d_fd_macros="$undef"
8601                 fi
8602         else
8603         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8604                 d_fd_set="$undef"
8605                 d_fds_bits="$undef"
8606                 d_fd_macros="$undef"
8607         fi
8608 fi
8609 $rm -f fd_set*
8610
8611 : see if fgetpos exists
8612 set fgetpos d_fgetpos
8613 eval $inlibc
8614
8615 : see if flock exists
8616 set flock d_flock
8617 eval $inlibc
8618
8619 : see if fork exists
8620 set fork d_fork
8621 eval $inlibc
8622
8623 : see if pathconf exists
8624 set pathconf d_pathconf
8625 eval $inlibc
8626
8627 : see if fpathconf exists
8628 set fpathconf d_fpathconf
8629 eval $inlibc
8630
8631
8632 : see if llseek exists
8633 set llseek d_llseek
8634 eval $inlibc
8635
8636 : check for off64_t
8637 echo " "
8638 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8639 $cat >try.c <<EOCP
8640 #include <sys/types.h>
8641 #include <unistd.h>
8642 off64_t foo() { off64_t x; x = 7; return x; }'
8643 EOCP
8644 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8645         val="$define"
8646         echo " Yup, it does." >&4
8647 else
8648         val="$undef"
8649         echo " Nope, it doesn't." >&4
8650 fi
8651 $rm -f try.*
8652 set d_off64_t
8653 eval $setvar
8654
8655 : check for fpos64_t
8656 echo " "
8657 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8658 $cat >try.c <<EOCP
8659 #include <sys/stdio.h>
8660 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8661 EOCP
8662 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8663         val="$define"
8664         echo " Yup, it does." >&4
8665 else
8666         val="$undef"
8667         echo " Nope, it doesn't." >&4
8668 fi
8669 $rm -f try.*
8670 set d_fpos64_t
8671 eval $setvar
8672
8673 hasstruct='varname=$1; struct=$2; shift; shift;
8674 while $test $# -ge 2; do
8675         case "$1" in
8676         $define) echo "#include <$2>";;
8677         esac ;
8678     shift 2;
8679 done > try.c;
8680 echo "int main () { struct $struct foo; }" >> try.c;
8681 set try;
8682 if eval $compile; then
8683         val="$define";
8684 else
8685         val="$undef";
8686 fi;
8687 set $varname;
8688 eval $setvar;
8689 $rm -f try.c try.o'
8690
8691 : see if this is a sys/param system
8692 set sys/param.h i_sysparam
8693 eval $inhdr
8694
8695 : see if this is a sys/mount.h system
8696 set sys/mount.h i_sysmount
8697 eval $inhdr
8698
8699 : see if sys/types.h has to be included
8700 set sys/types.h i_systypes
8701 eval $inhdr
8702
8703 : see if this is a sys/vfs.h system
8704 set sys/vfs.h i_sysvfs
8705 eval $inhdr
8706
8707 : see if this is a sys/statfs.h system
8708 set sys/statfs.h i_sysstatfs
8709 eval $inhdr
8710
8711
8712 : see if statfs exists
8713 set statfs d_statfs
8714 eval $inlibc
8715
8716 echo "Checking to see if your system supports struct statfs..." >&4
8717 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
8718 eval $hasstruct
8719 case "$d_statfs_s" in
8720 "$define")      echo "Yup, it does."     >&4 ;;
8721 *)              echo "Nope, it doesn't." >&4 ;;
8722 esac
8723
8724 : see if struct statfs knows about f_flags
8725 case "$d_statfs_s" in
8726 define) 
8727         echo "Checking to see if your struct statfs has f_flags field..." >&4
8728         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
8729         eval $hasfield
8730         ;;
8731 *)      val="$undef"
8732         set d_statfs_f_flags
8733         eval $setvar
8734         ;;
8735 esac
8736 case "$d_statfs_f_flags" in
8737 "$define")      echo "Yup, it does."     >&4 ;;
8738 *)              echo "Nope, it doesn't." >&4 ;;
8739 esac
8740
8741 echo "Checking to see if your system supports struct fs_data..." >&4
8742 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8743 eval $hasstruct
8744 case "$d_fs_data_s" in
8745 "$define")      echo "Yup, it does."     >&4 ;;
8746 *)              echo "Nope, it doesn't." >&4 ;;
8747 esac
8748
8749 : see if fseeko exists
8750 set fseeko d_fseeko
8751 eval $inlibc
8752
8753 : see if fsetpos exists
8754 set fsetpos d_fsetpos
8755 eval $inlibc
8756
8757
8758 : see if fstatfs exists
8759 set fstatfs d_fstatfs
8760 eval $inlibc
8761
8762
8763 : see if statvfs exists
8764 set statvfs d_statvfs
8765 eval $inlibc
8766
8767 : see if fstatvfs exists
8768 set fstatvfs d_fstatvfs
8769 eval $inlibc
8770
8771
8772 : see if ftello exists
8773 set ftello d_ftello
8774 eval $inlibc
8775
8776 : see if getgrent exists
8777 set getgrent d_getgrent
8778 eval $inlibc
8779
8780 : see if gethostbyaddr exists
8781 set gethostbyaddr d_gethbyaddr
8782 eval $inlibc
8783
8784 : see if gethostbyname exists
8785 set gethostbyname d_gethbyname
8786 eval $inlibc
8787
8788 : see if gethostent exists
8789 set gethostent d_gethent
8790 eval $inlibc
8791
8792 : see how we will look up host name
8793 echo " "
8794 call=''
8795 if set gethostname val -f d_gethname; eval $csym; $val; then
8796         echo 'gethostname() found.' >&4
8797         d_gethname="$define"
8798         call=gethostname
8799 fi
8800 if set uname val -f d_uname; eval $csym; $val; then
8801         if ./xenix; then
8802                 $cat <<'EOM'
8803 uname() was found, but you're running xenix, and older versions of xenix
8804 have a broken uname(). If you don't really know whether your xenix is old
8805 enough to have a broken system call, use the default answer.
8806
8807 EOM
8808                 dflt=y
8809                 case "$d_uname" in
8810                 "$define") dflt=n;;
8811                 esac
8812                 rp='Is your uname() broken?'
8813                 . ./myread
8814                 case "$ans" in
8815                 n*) d_uname="$define"; call=uname;;
8816                 esac
8817         else
8818                 echo 'uname() found.' >&4
8819                 d_uname="$define"
8820                 case "$call" in
8821                 '') call=uname ;;
8822                 esac
8823         fi
8824 fi
8825 case "$d_gethname" in
8826 '') d_gethname="$undef";;
8827 esac
8828 case "$d_uname" in
8829 '') d_uname="$undef";;
8830 esac
8831 case "$d_uname$d_gethname" in
8832 *define*)
8833         dflt=n
8834         cat <<EOM
8835  
8836 Every now and then someone has a $call() that lies about the hostname
8837 but can't be fixed for political or economic reasons.  If you wish, I can
8838 pretend $call() isn't there and maybe compute hostname at run-time
8839 thanks to the '$phostname' command.
8840
8841 EOM
8842         rp="Shall I ignore $call() from now on?"
8843         . ./myread
8844         case "$ans" in
8845         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8846         esac;;
8847 esac
8848 case "$phostname" in
8849 '') aphostname='';;
8850 *) case "$aphostname" in
8851         /*) ;;
8852         *) set X $phostname
8853                 shift
8854                 file=$1
8855                 shift
8856                 file=`./loc $file $file $pth`
8857                 aphostname=`echo $file $*`
8858                 ;;
8859         esac
8860         ;;
8861 esac
8862 case "$d_uname$d_gethname" in
8863 *define*) ;;
8864 *)
8865         case "$phostname" in
8866         '')
8867                 echo "There will be no way for $package to get your hostname." >&4;;
8868         *)
8869         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8870                 ;;
8871         esac;;
8872 esac
8873 case "$d_phostname" in
8874 '') d_phostname="$undef";;
8875 esac
8876
8877 : see if this is a netdb.h system
8878 set netdb.h i_netdb
8879 eval $inhdr
8880
8881 : see if prototypes for various gethostxxx netdb.h functions are available
8882 echo " "
8883 set d_gethostprotos gethostent $i_netdb netdb.h
8884 eval $hasproto
8885
8886 : see if getlogin exists
8887 set getlogin d_getlogin
8888 eval $inlibc
8889
8890 : see if getmntent exists
8891 set getmntent d_getmntent
8892 eval $inlibc
8893
8894 : see if getnetbyaddr exists
8895 set getnetbyaddr d_getnbyaddr
8896 eval $inlibc
8897
8898 : see if getnetbyname exists
8899 set getnetbyname d_getnbyname
8900 eval $inlibc
8901
8902 : see if getnetent exists
8903 set getnetent d_getnent
8904 eval $inlibc
8905
8906 : see if prototypes for various getnetxxx netdb.h functions are available
8907 echo " "
8908 set d_getnetprotos getnetent $i_netdb netdb.h
8909 eval $hasproto
8910
8911
8912 : see if getprotobyname exists
8913 set getprotobyname d_getpbyname
8914 eval $inlibc
8915
8916 : see if getprotobynumber exists
8917 set getprotobynumber d_getpbynumber
8918 eval $inlibc
8919
8920 : see if getprotoent exists
8921 set getprotoent d_getpent
8922 eval $inlibc
8923
8924 : see if getpgid exists
8925 set getpgid d_getpgid
8926 eval $inlibc
8927
8928 : see if getpgrp2 exists
8929 set getpgrp2 d_getpgrp2
8930 eval $inlibc
8931
8932 : see if getppid exists
8933 set getppid d_getppid
8934 eval $inlibc
8935
8936 : see if getpriority exists
8937 set getpriority d_getprior
8938 eval $inlibc
8939
8940 : see if prototypes for various getprotoxxx netdb.h functions are available
8941 echo " "
8942 set d_getprotoprotos getprotoent $i_netdb netdb.h
8943 eval $hasproto
8944
8945 : see if getpwent exists
8946 set getpwent d_getpwent
8947 eval $inlibc
8948
8949
8950 : see if getservbyname exists
8951 set getservbyname d_getsbyname
8952 eval $inlibc
8953
8954 : see if getservbyport exists
8955 set getservbyport d_getsbyport
8956 eval $inlibc
8957
8958 : see if getservent exists
8959 set getservent d_getsent
8960 eval $inlibc
8961
8962 : see if prototypes for various getservxxx netdb.h functions are available
8963 echo " "
8964 set d_getservprotos getservent $i_netdb netdb.h
8965 eval $hasproto
8966
8967 : see if getspent exists
8968 set getspent d_getspent
8969 eval $inlibc
8970
8971 : see if getspnam exists
8972 set getspnam d_getspnam
8973 eval $inlibc
8974
8975 : see if gettimeofday or ftime exists
8976 set gettimeofday d_gettimeod
8977 eval $inlibc
8978 case "$d_gettimeod" in
8979 "$undef")
8980         set ftime d_ftime 
8981         eval $inlibc
8982         ;;
8983 *)
8984         val="$undef"; set d_ftime; eval $setvar
8985         ;;
8986 esac
8987 case "$d_gettimeod$d_ftime" in
8988 "$undef$undef")
8989         echo " "
8990         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8991         ;;
8992 esac
8993
8994 : see if this is an grp system
8995 set grp.h i_grp
8996 eval $inhdr
8997
8998 case "$i_grp" in
8999 $define)
9000         xxx=`./findhdr grp.h`
9001         $cppstdin $cppflags $cppminus < $xxx >$$.h
9002
9003         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9004                 val="$define"
9005         else
9006                 val="$undef"
9007         fi
9008         set d_grpasswd
9009         eval $setvar
9010
9011         $rm -f $$.h
9012         ;;
9013 *)
9014         val="$undef";
9015         set d_grpasswd; eval $setvar
9016         ;;
9017 esac
9018
9019 : see if hasmntopt exists
9020 set hasmntopt d_hasmntopt
9021 eval $inlibc
9022
9023 : see if this is a netinet/in.h or sys/in.h system
9024 set netinet/in.h i_niin sys/in.h i_sysin
9025 eval $inhdr
9026
9027 : see if arpa/inet.h has to be included
9028 set arpa/inet.h i_arpainet
9029 eval $inhdr
9030
9031 : see if htonl --and friends-- exists
9032 val=''
9033 set htonl val
9034 eval $inlibc
9035
9036 : Maybe they are macros.
9037 case "$val" in
9038 $undef)
9039         $cat >htonl.c <<EOM
9040 #include <stdio.h>
9041 #include <sys/types.h>
9042 #$i_niin I_NETINET_IN
9043 #$i_sysin I_SYS_IN
9044 #$i_arpainet I_ARPA_INET
9045 #ifdef I_NETINET_IN
9046 #include <netinet/in.h>
9047 #endif
9048 #ifdef I_SYS_IN
9049 #include <sys/in.h>
9050 #endif
9051 #ifdef I_ARPA_INET
9052 #include <arpa/inet.h>
9053 #endif
9054 #ifdef htonl
9055 printf("Defined as a macro.");
9056 #endif
9057 EOM
9058         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9059         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9060                 val="$define"
9061                 echo "But it seems to be defined as a macro." >&4
9062         fi
9063         $rm -f htonl.?
9064         ;;
9065 esac
9066 set d_htonl
9067 eval $setvar
9068
9069 : see which of string.h or strings.h is needed
9070 echo " "
9071 strings=`./findhdr string.h`
9072 if $test "$strings" && $test -r "$strings"; then
9073         echo "Using <string.h> instead of <strings.h>." >&4
9074         val="$define"
9075 else
9076         val="$undef"
9077         strings=`./findhdr strings.h`
9078         if $test "$strings" && $test -r "$strings"; then
9079                 echo "Using <strings.h> instead of <string.h>." >&4
9080         else
9081                 echo "No string header found -- You'll surely have problems." >&4
9082         fi
9083 fi
9084 set i_string
9085 eval $setvar
9086 case "$i_string" in
9087 "$undef") strings=`./findhdr strings.h`;;
9088 *)        strings=`./findhdr string.h`;;
9089 esac
9090
9091 : index or strchr
9092 echo " "
9093 if set index val -f; eval $csym; $val; then
9094         if set strchr val -f d_strchr; eval $csym; $val; then
9095                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9096                         val="$define"
9097                         vali="$undef"
9098                         echo "strchr() found." >&4
9099                 else
9100                         val="$undef"
9101                         vali="$define"
9102                         echo "index() found." >&4
9103                 fi
9104         else
9105                 val="$undef"
9106                 vali="$define"
9107                 echo "index() found." >&4
9108         fi
9109 else
9110         if set strchr val -f d_strchr; eval $csym; $val; then
9111                 val="$define"
9112                 vali="$undef"
9113                 echo "strchr() found." >&4
9114         else
9115                 echo "No index() or strchr() found!" >&4
9116                 val="$undef"
9117                 vali="$undef"
9118         fi
9119 fi
9120 set d_strchr; eval $setvar
9121 val="$vali"
9122 set d_index; eval $setvar
9123
9124 : check whether inet_aton exists
9125 set inet_aton d_inetaton
9126 eval $inlibc
9127
9128 : Look for isascii
9129 echo " "
9130 $cat >isascii.c <<'EOCP'
9131 #include <stdio.h>
9132 #include <ctype.h>
9133 int main() {
9134         int c = 'A';
9135         if (isascii(c))
9136                 exit(0);
9137         else
9138                 exit(1);
9139 }
9140 EOCP
9141 set isascii
9142 if eval $compile; then
9143         echo "isascii() found." >&4
9144         val="$define"
9145 else
9146         echo "isascii() NOT found." >&4
9147         val="$undef"
9148 fi
9149 set d_isascii
9150 eval $setvar
9151 $rm -f isascii*
9152
9153 : see if killpg exists
9154 set killpg d_killpg
9155 eval $inlibc
9156
9157 : see if lchown exists
9158 echo " "
9159 $cat > try.c <<'EOCP'
9160 /* System header to define __stub macros and hopefully few prototypes,
9161     which can conflict with char lchown(); below.  */
9162 #include <assert.h>
9163 /* Override any gcc2 internal prototype to avoid an error.  */
9164 /* We use char because int might match the return type of a gcc2
9165    builtin and then its argument prototype would still apply.  */
9166 char lchown();
9167 int main() {
9168     /*  The GNU C library defines this for functions which it implements
9169         to always fail with ENOSYS.  Some functions are actually named
9170         something starting with __ and the normal name is an alias.  */
9171 #if defined (__stub_lchown) || defined (__stub___lchown)
9172 choke me
9173 #else
9174 lchown();
9175 #endif
9176 ; return 0; }
9177 EOCP
9178 set try
9179 if eval $compile; then
9180     $echo "lchown() found." >&4
9181     val="$define"
9182 else
9183     $echo "lchown() NOT found." >&4
9184     val="$undef"
9185 fi
9186 set d_lchown
9187 eval $setvar
9188
9189 : See if number of significant digits in a double precision number is known
9190 echo " "
9191 $cat >ldbl_dig.c <<EOM
9192 #$i_limits I_LIMITS
9193 #$i_float I_FLOAT
9194 #ifdef I_LIMITS
9195 #include <limits.h>
9196 #endif
9197 #ifdef I_FLOAT
9198 #include <float.h>
9199 #endif
9200 #ifdef LDBL_DIG
9201 printf("Contains LDBL_DIG");
9202 #endif
9203 EOM
9204 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9205 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9206         echo "LDBL_DIG found." >&4
9207         val="$define"
9208 else
9209         echo "LDBL_DIG NOT found." >&4
9210         val="$undef"
9211 fi
9212 $rm -f ldbl_dig.?
9213 set d_ldbl_dig
9214 eval $setvar
9215
9216 : see if link exists
9217 set link d_link
9218 eval $inlibc
9219
9220 : see if localeconv exists
9221 set localeconv d_locconv
9222 eval $inlibc
9223
9224 : see if lockf exists
9225 set lockf d_lockf
9226 eval $inlibc
9227
9228 : see if lstat exists
9229 set lstat d_lstat
9230 eval $inlibc
9231
9232 : see if madvise exists
9233 set madvise d_madvise
9234 eval $inlibc
9235
9236 : see if mblen exists
9237 set mblen d_mblen
9238 eval $inlibc
9239
9240 : see if mbstowcs exists
9241 set mbstowcs d_mbstowcs
9242 eval $inlibc
9243
9244 : see if mbtowc exists
9245 set mbtowc d_mbtowc
9246 eval $inlibc
9247
9248 : see if memchr exists
9249 set memchr d_memchr
9250 eval $inlibc
9251
9252 : see if memcmp exists
9253 set memcmp d_memcmp
9254 eval $inlibc
9255
9256 : see if memcpy exists
9257 set memcpy d_memcpy
9258 eval $inlibc
9259
9260 : see if memmove exists
9261 set memmove d_memmove
9262 eval $inlibc
9263
9264 : see if memset exists
9265 set memset d_memset
9266 eval $inlibc
9267
9268 : see if mkdir exists
9269 set mkdir d_mkdir
9270 eval $inlibc
9271
9272 : see if mkfifo exists
9273 set mkfifo d_mkfifo
9274 eval $inlibc
9275
9276 : see if mktime exists
9277 set mktime d_mktime
9278 eval $inlibc
9279
9280 : see if this is a sys/mman.h system
9281 set sys/mman.h i_sysmman
9282 eval $inhdr
9283
9284 : see if mmap exists
9285 set mmap d_mmap
9286 eval $inlibc
9287 : see what shmat returns
9288 : default to something harmless
9289 mmaptype='void *'
9290 case "$i_sysmman$d_mmap" in
9291 "$define$define")
9292         $cat >mmap.c <<'END'
9293 #include <sys/mman.h>
9294 void *mmap();
9295 END
9296         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9297                 mmaptype='void *'
9298         else
9299                 mmaptype='caddr_t'
9300         fi
9301         echo "and it returns ($mmaptype)." >&4
9302         ;;
9303 esac
9304
9305
9306
9307 : see if mprotect exists
9308 set mprotect d_mprotect
9309 eval $inlibc
9310
9311 : see if msgctl exists
9312 set msgctl d_msgctl
9313 eval $inlibc
9314
9315 : see if msgget exists
9316 set msgget d_msgget
9317 eval $inlibc
9318
9319 : see if msgsnd exists
9320 set msgsnd d_msgsnd
9321 eval $inlibc
9322
9323 : see if msgrcv exists
9324 set msgrcv d_msgrcv
9325 eval $inlibc
9326
9327 : see how much of the 'msg*(2)' library is present.
9328 h_msg=true
9329 echo " "
9330 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9331 *"$undef"*) h_msg=false;;
9332 esac
9333 case "$osname" in
9334 freebsd)
9335     case "`ipcs 2>&1`" in
9336     "SVID messages"*"not configured"*)
9337         echo "Your $osname does not have the msg*(2) configured." >&4
9338         h_msg=false
9339         val="$undef"
9340         set msgctl d_msgctl
9341         eval $setvar
9342         set msgget d_msgget
9343         eval $setvar
9344         set msgsnd d_msgsnd
9345         eval $setvar
9346         set msgrcv d_msgrcv
9347         eval $setvar
9348         ;;
9349     esac
9350     ;;
9351 esac
9352 : we could also check for sys/ipc.h ...
9353 if $h_msg && $test `./findhdr sys/msg.h`; then
9354         echo "You have the full msg*(2) library." >&4
9355         val="$define"
9356 else
9357         echo "You don't have the full msg*(2) library." >&4
9358         val="$undef"
9359 fi
9360 set d_msg
9361 eval $setvar
9362
9363 : see if msync exists
9364 set msync d_msync
9365 eval $inlibc
9366
9367 : see if munmap exists
9368 set munmap d_munmap
9369 eval $inlibc
9370
9371 : see if nice exists
9372 set nice d_nice
9373 eval $inlibc
9374
9375 : see if POSIX threads are available
9376 set pthread.h i_pthread
9377 eval $inhdr
9378
9379
9380
9381
9382 : how to create joinable pthreads
9383 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9384         echo " "
9385         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9386         $cat >try.c <<'EOCP'
9387 #include <pthread.h>
9388 int main() {
9389     int detachstate = JOINABLE;
9390 }
9391 EOCP
9392         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9393         if eval $compile; then
9394                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9395                 val="$undef" # Yes, undef.
9396                 set d_old_pthread_create_joinable
9397                 eval $setvar
9398                 val=""
9399                 set old_pthread_create_joinable
9400                 eval $setvar
9401         else
9402                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9403                 if eval $compile; then
9404                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9405                         val="$define"
9406                         set d_old_pthread_create_joinable
9407                         eval $setvar
9408                         val=PTHREAD_CREATE_UNDETACHED
9409                         set old_pthread_create_joinable
9410                         eval $setvar
9411                 else            
9412                         set try -DJOINABLE=__UNDETACHED
9413                         if eval $compile; then
9414                                 echo "You seem to use __UNDETACHED." >&4
9415                                 val="$define"
9416                                 set d_old_pthread_create_joinable
9417                                 eval $setvar
9418                                 val=__UNDETACHED
9419                                 set old_pthread_create_joinable
9420                                 eval $setvar
9421                         else
9422                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9423                                 val="$define"
9424                                 set d_old_pthread_create_joinable
9425                                 eval $setvar
9426                                 val=0
9427                                 set old_pthread_create_joinable
9428                                 eval $setvar
9429                         fi
9430                 fi
9431         fi
9432         $rm -f try try.*
9433 else
9434     d_old_pthread_create_joinable="$undef"
9435     old_pthread_create_joinable=""
9436 fi
9437
9438 : see if pause exists
9439 set pause d_pause
9440 eval $inlibc
9441
9442 : see if pipe exists
9443 set pipe d_pipe
9444 eval $inlibc
9445
9446 : see if poll exists
9447 set poll d_poll
9448 eval $inlibc
9449
9450
9451 : see whether the various POSIXish _yields exist
9452 $cat >try.c <<EOP
9453 #include <pthread.h>
9454 #include <stdio.h>
9455 int main() {
9456 #ifdef SCHED_YIELD
9457         sched_yield();
9458 #else
9459 #ifdef PTHREAD_YIELD
9460         pthread_yield();
9461 #else
9462 #ifdef PTHREAD_YIELD_NULL
9463         pthread_yield(NULL);
9464 #endif
9465 #endif
9466 #endif
9467 }
9468 EOP
9469 : see if sched_yield exists
9470 set try -DSCHED_YIELD
9471 if eval $compile; then
9472     val="$define"
9473     sched_yield='sched_yield()'
9474 else
9475     val="$undef"
9476 fi
9477 case "$usethreads" in
9478 $define)
9479         case "$val" in
9480         $define) echo 'sched_yield() found.' >&4        ;;
9481         *)       echo 'sched_yield() NOT found.' >&4    ;;
9482         esac
9483 esac
9484 set d_sched_yield
9485 eval $setvar
9486
9487 : see if pthread_yield exists
9488 set try -DPTHREAD_YIELD
9489 if eval $compile; then
9490     val="$define"
9491     case "$sched_yield" in
9492     '') sched_yield='pthread_yield()' ;;
9493     esac
9494 else
9495     set try -DPTHREAD_YIELD_NULL
9496     if eval $compile; then
9497         val="$define"
9498         case "$sched_yield" in
9499         '') sched_yield='pthread_yield(NULL)' ;;
9500         esac
9501     else
9502         val="$undef"
9503     fi
9504 fi
9505 case "$usethreads" in
9506 $define)
9507         case "$val" in
9508         $define) echo 'pthread_yield() found.' >&4      ;;
9509         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9510         esac
9511         ;;
9512 esac
9513 set d_pthread_yield
9514 eval $setvar
9515
9516 case "$sched_yield" in
9517 '') sched_yield=undef ;;
9518 esac
9519
9520 $rm -f try try.*
9521
9522 : see if this is a pwd.h system
9523 set pwd.h i_pwd
9524 eval $inhdr
9525
9526 case "$i_pwd" in
9527 $define)
9528         xxx=`./findhdr pwd.h`
9529         $cppstdin $cppflags $cppminus < $xxx >$$.h
9530
9531         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9532                 val="$define"
9533         else
9534                 val="$undef"
9535         fi
9536         set d_pwquota
9537         eval $setvar
9538
9539         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9540                 val="$define"
9541         else
9542                 val="$undef"
9543         fi
9544         set d_pwage
9545         eval $setvar
9546
9547         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9548                 val="$define"
9549         else
9550                 val="$undef"
9551         fi
9552         set d_pwchange
9553         eval $setvar
9554
9555         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9556                 val="$define"
9557         else
9558                 val="$undef"
9559         fi
9560         set d_pwclass
9561         eval $setvar
9562
9563         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9564                 val="$define"
9565         else
9566                 val="$undef"
9567         fi
9568         set d_pwexpire
9569         eval $setvar
9570
9571         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9572                 val="$define"
9573         else
9574                 val="$undef"
9575         fi
9576         set d_pwcomment
9577         eval $setvar
9578
9579         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9580                 val="$define"
9581         else
9582                 val="$undef"
9583         fi
9584         set d_pwgecos
9585         eval $setvar
9586
9587         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9588                 val="$define"
9589         else
9590                 val="$undef"
9591         fi
9592         set d_pwpasswd
9593         eval $setvar
9594
9595         $rm -f $$.h
9596         ;;
9597 *)
9598         val="$undef"; 
9599         set d_pwquota; eval $setvar
9600         set d_pwage; eval $setvar
9601         set d_pwchange; eval $setvar
9602         set d_pwclass; eval $setvar
9603         set d_pwexpire; eval $setvar
9604         set d_pwcomment; eval $setvar
9605         set d_pwgecos; eval $setvar
9606         set d_pwpasswd; eval $setvar
9607         ;;
9608 esac
9609
9610 : see if readdir and friends exist
9611 set readdir d_readdir
9612 eval $inlibc
9613 set seekdir d_seekdir
9614 eval $inlibc
9615 set telldir d_telldir
9616 eval $inlibc
9617 set rewinddir d_rewinddir
9618 eval $inlibc
9619
9620 : see if readlink exists
9621 set readlink d_readlink
9622 eval $inlibc
9623
9624 : see if readv exists
9625 set readv d_readv
9626 eval $inlibc
9627
9628 : see if rename exists
9629 set rename d_rename
9630 eval $inlibc
9631
9632 : see if rmdir exists
9633 set rmdir d_rmdir
9634 eval $inlibc
9635
9636 : see if memory.h is available.
9637 val=''
9638 set memory.h val
9639 eval $inhdr
9640
9641 : See if it conflicts with string.h
9642 case "$val" in
9643 $define)
9644         case "$strings" in
9645         '') ;;
9646         *)
9647                 $cppstdin $cppflags $cppminus < $strings > mem.h
9648                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9649                         echo " "
9650                         echo "We won't be including <memory.h>."
9651                         val="$undef"
9652                 fi
9653                 $rm -f mem.h
9654                 ;;
9655         esac
9656 esac
9657 set i_memory
9658 eval $setvar
9659
9660 : can bcopy handle overlapping blocks?
9661 val="$undef"
9662 case "$d_bcopy" in
9663 "$define")
9664         echo " "
9665         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9666         $cat >try.c <<EOCP
9667 #$i_memory I_MEMORY
9668 #$i_stdlib I_STDLIB
9669 #$i_string I_STRING
9670 #$i_unistd I_UNISTD
9671 EOCP
9672         $cat >>try.c <<'EOCP'
9673 #include <stdio.h>
9674 #ifdef I_MEMORY
9675 #  include <memory.h>
9676 #endif
9677 #ifdef I_STDLIB
9678 #  include <stdlib.h>
9679 #endif
9680 #ifdef I_STRING
9681 #  include <string.h>
9682 #else
9683 #  include <strings.h>
9684 #endif
9685 #ifdef I_UNISTD
9686 #  include <unistd.h>  /* Needed for NetBSD */
9687 #endif
9688 int main()
9689 {
9690 char buf[128], abc[128];
9691 char *b;
9692 int len;
9693 int off;
9694 int align;
9695
9696 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9697
9698 for (align = 7; align >= 0; align--) {
9699         for (len = 36; len; len--) {
9700                 b = buf+align;
9701                 bcopy(abc, b, len);
9702                 for (off = 1; off <= len; off++) {
9703                         bcopy(b, b+off, len);
9704                         bcopy(b+off, b, len);
9705                         if (bcmp(b, abc, len))
9706                                 exit(1);
9707                 }
9708         }
9709 }
9710 exit(0);
9711 }
9712 EOCP
9713         set try
9714         if eval $compile_ok; then
9715                 if ./try 2>/dev/null; then
9716                         echo "Yes, it can."
9717                         val="$define"
9718                 else
9719                         echo "It can't, sorry."
9720                         case "$d_memmove" in
9721                         "$define") echo "But that's Ok since you have memmove()." ;;
9722                         esac
9723                 fi
9724         else
9725                 echo "(I can't compile the test program, so we'll assume not...)"
9726                 case "$d_memmove" in
9727                 "$define") echo "But that's Ok since you have memmove()." ;;
9728                 esac
9729         fi
9730         ;;
9731 esac
9732 $rm -f try.* try core
9733 set d_safebcpy
9734 eval $setvar
9735
9736 : can memcpy handle overlapping blocks?
9737 val="$undef"
9738 case "$d_memcpy" in
9739 "$define")
9740         echo " "
9741         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9742         $cat >try.c <<EOCP
9743 #$i_memory I_MEMORY
9744 #$i_stdlib I_STDLIB
9745 #$i_string I_STRING
9746 #$i_unistd I_UNISTD
9747 EOCP
9748         $cat >>try.c <<'EOCP'
9749 #include <stdio.h>
9750 #ifdef I_MEMORY
9751 #  include <memory.h>
9752 #endif
9753 #ifdef I_STDLIB
9754 #  include <stdlib.h>
9755 #endif
9756 #ifdef I_STRING
9757 #  include <string.h>
9758 #else
9759 #  include <strings.h>
9760 #endif
9761 #ifdef I_UNISTD
9762 #  include <unistd.h>  /* Needed for NetBSD */
9763 #endif
9764 int main()
9765 {
9766 char buf[128], abc[128];
9767 char *b;
9768 int len;
9769 int off;
9770 int align;
9771
9772 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9773    try to store the string in read-only memory. */
9774 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9775
9776 for (align = 7; align >= 0; align--) {
9777         for (len = 36; len; len--) {
9778                 b = buf+align;
9779                 memcpy(b, abc, len);
9780                 for (off = 1; off <= len; off++) {
9781                         memcpy(b+off, b, len);
9782                         memcpy(b, b+off, len);
9783                         if (memcmp(b, abc, len))
9784                                 exit(1);
9785                 }
9786         }
9787 }
9788 exit(0);
9789 }
9790 EOCP
9791         set try
9792         if eval $compile_ok; then
9793                 if ./try 2>/dev/null; then
9794                         echo "Yes, it can."
9795                         val="$define"
9796                 else
9797                         echo "It can't, sorry."
9798                         case "$d_memmove" in
9799                         "$define") echo "But that's Ok since you have memmove()." ;;
9800                         esac
9801                 fi
9802         else
9803                 echo "(I can't compile the test program, so we'll assume not...)"
9804                 case "$d_memmove" in
9805                 "$define") echo "But that's Ok since you have memmove()." ;;
9806                 esac
9807         fi
9808         ;;
9809 esac
9810 $rm -f try.* try core
9811 set d_safemcpy
9812 eval $setvar
9813
9814 : can memcmp be trusted to compare relative magnitude?
9815 val="$undef"
9816 case "$d_memcmp" in
9817 "$define")
9818         echo " "
9819         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9820         $cat >try.c <<EOCP
9821 #$i_memory I_MEMORY
9822 #$i_stdlib I_STDLIB
9823 #$i_string I_STRING
9824 #$i_unistd I_UNISTD
9825 EOCP
9826         $cat >>try.c <<'EOCP'
9827 #include <stdio.h>
9828 #ifdef I_MEMORY
9829 #  include <memory.h>
9830 #endif
9831 #ifdef I_STDLIB
9832 #  include <stdlib.h>
9833 #endif
9834 #ifdef I_STRING
9835 #  include <string.h>
9836 #else
9837 #  include <strings.h>
9838 #endif
9839 #ifdef I_UNISTD
9840 #  include <unistd.h>  /* Needed for NetBSD */
9841 #endif
9842 int main()
9843 {
9844 char a = -1;
9845 char b = 0;
9846 if ((a < b) && memcmp(&a, &b, 1) < 0)
9847         exit(1);
9848 exit(0);
9849 }
9850 EOCP
9851         set try
9852         if eval $compile_ok; then
9853                 if ./try 2>/dev/null; then
9854                         echo "Yes, it can."
9855                         val="$define"
9856                 else
9857                         echo "No, it can't (it uses signed chars)."
9858                 fi
9859         else
9860                 echo "(I can't compile the test program, so we'll assume not...)"
9861         fi
9862         ;;
9863 esac
9864 $rm -f try.* try core
9865 set d_sanemcmp
9866 eval $setvar
9867
9868 : see if select exists
9869 set select d_select
9870 eval $inlibc
9871
9872 : see if semctl exists
9873 set semctl d_semctl
9874 eval $inlibc
9875
9876 : see if semget exists
9877 set semget d_semget
9878 eval $inlibc
9879
9880 : see if semop exists
9881 set semop d_semop
9882 eval $inlibc
9883
9884 : see how much of the 'sem*(2)' library is present.
9885 h_sem=true
9886 echo " "
9887 case "$d_semctl$d_semget$d_semop" in
9888 *"$undef"*) h_sem=false;;
9889 esac
9890 case "$osname" in
9891 freebsd)
9892     case "`ipcs 2>&1`" in
9893     "SVID messages"*"not configured"*)
9894         echo "Your $osname does not have the sem*(2) configured." >&4
9895         h_sem=false
9896         val="$undef"
9897         set semctl d_semctl
9898         eval $setvar
9899         set semget d_semget
9900         eval $setvar
9901         set semop d_semop
9902         eval $setvar
9903         ;;
9904     esac
9905     ;;
9906 esac
9907 : we could also check for sys/ipc.h ...
9908 if $h_sem && $test `./findhdr sys/sem.h`; then
9909         echo "You have the full sem*(2) library." >&4
9910         val="$define"
9911 else
9912         echo "You don't have the full sem*(2) library." >&4
9913         val="$undef"
9914 fi
9915 set d_sem
9916 eval $setvar
9917
9918 : see whether sys/sem.h defines union semun
9919 echo " "
9920 $cat > try.c <<'END'
9921 #include <sys/types.h>
9922 #include <sys/ipc.h>
9923 #include <sys/sem.h>
9924 int main () { union semun semun; semun.buf = 0; }
9925 END
9926 set try
9927 if eval $compile; then
9928     echo "You have union semun in <sys/sem.h>." >&4
9929     val="$define"
9930 else
9931     echo "You do not have union semun in <sys/sem.h>." >&4
9932     val="$undef"
9933 fi
9934 $rm -f try try.c try.h
9935 set d_union_semun
9936 eval $setvar
9937
9938 : see how to do semctl IPC_STAT
9939 case "$d_sem" in
9940 $define)
9941     : see whether semctl IPC_STAT can use union semun
9942     echo " "
9943     $cat > try.h <<END
9944 #ifndef S_IRUSR
9945 #   ifdef S_IREAD
9946 #       define S_IRUSR S_IREAD
9947 #       define S_IWUSR S_IWRITE
9948 #       define S_IXUSR S_IEXEC
9949 #   else
9950 #       define S_IRUSR 0400
9951 #       define S_IWUSR 0200
9952 #       define S_IXUSR 0100
9953 #   endif
9954 #   define S_IRGRP (S_IRUSR>>3)
9955 #   define S_IWGRP (S_IWUSR>>3)
9956 #   define S_IXGRP (S_IXUSR>>3)
9957 #   define S_IROTH (S_IRUSR>>6)
9958 #   define S_IWOTH (S_IWUSR>>6)
9959 #   define S_IXOTH (S_IXUSR>>6)
9960 #endif
9961 #ifndef S_IRWXU
9962 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9963 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9964 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9965 #endif
9966 END
9967
9968     $cat > try.c <<END
9969 #include <sys/types.h>
9970 #include <sys/ipc.h>
9971 #include <sys/sem.h>
9972 #include <sys/stat.h>
9973 #include <stdio.h>
9974 #include <errno.h>
9975 #include "try.h"
9976 #ifndef errno
9977 extern int errno;
9978 #endif
9979 #$d_union_semun HAS_UNION_SEMUN
9980 int main() {
9981     union semun
9982 #ifndef HAS_UNION_SEMUN
9983     {
9984         int val;
9985         struct semid_ds *buf;
9986         unsigned short *array;
9987     }
9988 #endif
9989     arg;
9990     int sem, st;
9991
9992 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9993     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9994     if (sem > -1) {
9995         struct semid_ds argbuf;
9996         arg.buf = &argbuf;
9997 #       ifdef IPC_STAT
9998         st = semctl(sem, 0, IPC_STAT, arg);
9999         if (st == 0)
10000             printf("semun\n");
10001         else
10002 #       endif /* IPC_STAT */
10003             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10004 #       ifdef IPC_RMID
10005         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10006 #       endif /* IPC_RMID */
10007             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10008     } else
10009 #endif /* IPC_PRIVATE && ... */
10010         printf("semget failed: errno = %d\n", errno);
10011   return 0;
10012 }
10013 END
10014     val="$undef"
10015     set try
10016     if eval $compile; then
10017         xxx=`./try`
10018         case "$xxx" in
10019         semun) val="$define" ;;
10020         esac
10021     fi
10022     $rm -f try try.c
10023     set d_semctl_semun
10024     eval $setvar
10025     case "$d_semctl_semun" in
10026     $define)
10027         echo "You can use union semun for semctl IPC_STAT." >&4
10028         also='also'
10029         ;;
10030     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10031         also=''
10032         ;;
10033     esac
10034
10035     : see whether semctl IPC_STAT can use struct semid_ds pointer
10036     $cat > try.c <<'END'
10037 #include <sys/types.h>
10038 #include <sys/ipc.h>
10039 #include <sys/sem.h>
10040 #include <sys/stat.h>
10041 #include "try.h"
10042 #include <stdio.h>
10043 #include <errno.h>
10044 #ifndef errno
10045 extern int errno;
10046 #endif
10047 int main() {
10048     struct semid_ds arg;
10049     int sem, st;
10050
10051 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10052     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10053     if (sem > -1) {
10054 #       ifdef IPC_STAT
10055         st = semctl(sem, 0, IPC_STAT, &arg);
10056         if (st == 0)
10057             printf("semid_ds\n");
10058         else
10059 #       endif /* IPC_STAT */
10060             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10061 #       ifdef IPC_RMID
10062         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10063 #       endif /* IPC_RMID */
10064             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10065     } else
10066 #endif /* IPC_PRIVATE && ... */
10067         printf("semget failed: errno = %d\n", errno);
10068
10069     return 0;
10070 }
10071 END
10072     val="$undef"
10073     set try
10074     if eval $compile; then
10075         xxx=`./try`
10076         case "$xxx" in
10077         semid_ds) val="$define" ;;
10078         esac
10079     fi
10080     $rm -f try try.c
10081     set d_semctl_semid_ds
10082     eval $setvar
10083     case "$d_semctl_semid_ds" in
10084     $define)
10085         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10086         ;;
10087     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10088         ;;
10089     esac
10090     $rm -f try.h
10091     ;;
10092 *)  val="$undef"
10093
10094     # We do not have the full sem*(2) library, so assume we can not
10095     # use either.
10096
10097     set d_semctl_semun
10098     eval $setvar
10099
10100     set d_semctl_semid_ds
10101     eval $setvar
10102     ;;
10103 esac
10104
10105 : see if setegid exists
10106 set setegid d_setegid
10107 eval $inlibc
10108
10109 : see if seteuid exists
10110 set seteuid d_seteuid
10111 eval $inlibc
10112
10113 : see if setgrent exists
10114 set setgrent d_setgrent
10115 eval $inlibc
10116
10117 : see if sethostent exists
10118 set sethostent d_sethent
10119 eval $inlibc
10120
10121 : see if setlinebuf exists
10122 set setlinebuf d_setlinebuf
10123 eval $inlibc
10124
10125 : see if setlocale exists
10126 set setlocale d_setlocale
10127 eval $inlibc
10128
10129 : see if setnetent exists
10130 set setnetent d_setnent
10131 eval $inlibc
10132
10133 : see if setprotoent exists
10134 set setprotoent d_setpent
10135 eval $inlibc
10136
10137 : see if setpgid exists
10138 set setpgid d_setpgid
10139 eval $inlibc
10140
10141 : see if setpgrp2 exists
10142 set setpgrp2 d_setpgrp2
10143 eval $inlibc
10144
10145 : see if setpriority exists
10146 set setpriority d_setprior
10147 eval $inlibc
10148
10149 : see if setpwent exists
10150 set setpwent d_setpwent
10151 eval $inlibc
10152
10153 : see if setregid exists
10154 set setregid d_setregid
10155 eval $inlibc
10156 set setresgid d_setresgid
10157 eval $inlibc
10158
10159 : see if setreuid exists
10160 set setreuid d_setreuid
10161 eval $inlibc
10162 set setresuid d_setresuid
10163 eval $inlibc
10164
10165 : see if setrgid exists
10166 set setrgid d_setrgid
10167 eval $inlibc
10168
10169 : see if setruid exists
10170 set setruid d_setruid
10171 eval $inlibc
10172
10173 : see if setservent exists
10174 set setservent d_setsent
10175 eval $inlibc
10176
10177 : see if setsid exists
10178 set setsid d_setsid
10179 eval $inlibc
10180
10181 : see if setspent exists
10182 set setspent d_setspent
10183 eval $inlibc
10184
10185 : see if setvbuf exists
10186 set setvbuf d_setvbuf
10187 eval $inlibc
10188
10189 : see if sfio.h is available
10190 set sfio.h i_sfio
10191 eval $inhdr
10192
10193
10194 : see if sfio library is available
10195 case "$i_sfio" in
10196 $define)
10197         val=''
10198         set sfreserve val
10199         eval $inlibc
10200         ;;
10201 *)
10202         val="$undef"
10203         ;;
10204 esac
10205 : Ok, but do we want to use it.
10206 case "$val" in
10207 $define)
10208         case "$usesfio" in
10209         true|$define|[yY]*) dflt='y';;
10210         *) dflt='n';;
10211         esac
10212         echo "$package can use the sfio library, but it is experimental."
10213         rp="You seem to have sfio available, do you want to try using it?"
10214         . ./myread
10215         case "$ans" in
10216         y|Y) ;;
10217         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10218                 val="$undef"
10219                 : Remove sfio from list of libraries to use
10220                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10221                 shift
10222                 libs="$*"
10223                 echo "libs = $libs" >&4
10224                 ;;
10225         esac
10226         ;;
10227 *)      case "$usesfio" in
10228         true|$define|[yY]*)
10229                 echo "Sorry, cannot find sfio on this machine" >&4
10230                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10231                 ;;
10232         esac
10233         ;;
10234 esac
10235 set d_sfio
10236 eval $setvar
10237 case "$d_sfio" in
10238 $define) usesfio='true';;
10239 *) usesfio='false';;
10240 esac
10241
10242 : see if shmctl exists
10243 set shmctl d_shmctl
10244 eval $inlibc
10245
10246 : see if shmget exists
10247 set shmget d_shmget
10248 eval $inlibc
10249
10250 : see if shmat exists
10251 set shmat d_shmat
10252 eval $inlibc
10253 : see what shmat returns
10254 case "$d_shmat" in
10255 "$define")
10256         $cat >shmat.c <<'END'
10257 #include <sys/shm.h>
10258 void *shmat();
10259 END
10260         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10261                 shmattype='void *'
10262         else
10263                 shmattype='char *'
10264         fi
10265         echo "and it returns ($shmattype)." >&4
10266         : see if a prototype for shmat is available
10267         xxx=`./findhdr sys/shm.h`
10268         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10269         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10270                 val="$define"
10271         else
10272                 val="$undef"
10273         fi
10274         $rm -f shmat.[co]
10275         ;;
10276 *)
10277         val="$undef"
10278         ;;
10279 esac
10280 set d_shmatprototype
10281 eval $setvar
10282
10283 : see if shmdt exists
10284 set shmdt d_shmdt
10285 eval $inlibc
10286
10287 : see how much of the 'shm*(2)' library is present.
10288 h_shm=true
10289 echo " "
10290 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10291 *"$undef"*) h_shm=false;;
10292 esac
10293 case "$osname" in
10294 freebsd)
10295     case "`ipcs 2>&1`" in
10296     "SVID shared memory"*"not configured"*)
10297         echo "Your $osname does not have the shm*(2) configured." >&4
10298         h_shm=false
10299         val="$undef"
10300         set shmctl d_shmctl
10301         evat $setvar
10302         set shmget d_shmget
10303         evat $setvar
10304         set shmat d_shmat
10305         evat $setvar
10306         set shmdt d_shmdt
10307         evat $setvar
10308         ;;
10309     esac
10310     ;;
10311 esac
10312 : we could also check for sys/ipc.h ...
10313 if $h_shm && $test `./findhdr sys/shm.h`; then
10314         echo "You have the full shm*(2) library." >&4
10315         val="$define"
10316 else
10317         echo "You don't have the full shm*(2) library." >&4
10318         val="$undef"
10319 fi
10320 set d_shm
10321 eval $setvar
10322
10323 echo " "
10324 : see if we have sigaction
10325 if set sigaction val -f d_sigaction; eval $csym; $val; then
10326         echo 'sigaction() found.' >&4
10327         $cat > try.c <<'EOP'
10328 #include <stdio.h>
10329 #include <sys/types.h>
10330 #include <signal.h>
10331 int main()
10332 {
10333     struct sigaction act, oact;
10334     act.sa_flags = 0;
10335     oact.sa_handler = 0;
10336 }
10337 EOP
10338         set try
10339         if eval $compile_ok; then
10340                 val="$define"
10341         else
10342                 echo "But you don't seem to have a useable struct sigaction." >&4
10343                 val="$undef"
10344         fi
10345 else
10346         echo 'sigaction NOT found.' >&4
10347         val="$undef"
10348 fi
10349 set d_sigaction; eval $setvar
10350 $rm -f try try$_o try.c
10351
10352 : see if sigsetjmp exists
10353 echo " "
10354 case "$d_sigsetjmp" in
10355 '')
10356         $cat >try.c <<'EOP'
10357 #include <setjmp.h>
10358 sigjmp_buf env;
10359 int set = 1;
10360 int main()
10361 {
10362         if (sigsetjmp(env,1))
10363                 exit(set);
10364         set = 0;
10365         siglongjmp(env, 1);
10366         exit(1);
10367 }
10368 EOP
10369         set try
10370         if eval $compile; then
10371                 if ./try >/dev/null 2>&1; then
10372                         echo "POSIX sigsetjmp found." >&4
10373                         val="$define"
10374                 else
10375                         $cat >&4 <<EOM
10376 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10377 I'll ignore them.
10378 EOM
10379                         val="$undef"
10380                 fi
10381         else
10382                 echo "sigsetjmp not found." >&4
10383                 val="$undef"
10384         fi
10385         ;;
10386 *) val="$d_sigsetjmp"
10387         case "$d_sigsetjmp" in
10388         $define) echo "POSIX sigsetjmp found." >&4;;
10389         $undef) echo "sigsetjmp not found." >&4;;
10390         esac
10391         ;;
10392 esac
10393 set d_sigsetjmp
10394 eval $setvar
10395 $rm -f try.c try
10396
10397 : see if sqrtl exists
10398 set sqrtl d_sqrtl
10399 eval $inlibc
10400
10401 : see if sys/stat.h is available
10402 set sys/stat.h i_sysstat
10403 eval $inhdr
10404
10405 : see if stat knows about block sizes
10406 echo " "
10407 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10408 eval $hasfield
10409
10410 : see if _ptr and _cnt from stdio act std
10411 echo " "
10412 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10413         echo "(Looks like you have stdio.h from Linux.)"
10414         case "$stdio_ptr" in
10415         '') stdio_ptr='((fp)->_IO_read_ptr)'
10416                 ptr_lval=$define
10417                 ;;
10418         *)      ptr_lval=$d_stdio_ptr_lval;;
10419         esac
10420         case "$stdio_cnt" in
10421         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10422                 cnt_lval=$undef
10423                 ;;
10424         *)      cnt_lval=$d_stdio_cnt_lval;;
10425         esac
10426         case "$stdio_base" in
10427         '') stdio_base='((fp)->_IO_read_base)';;
10428         esac
10429         case "$stdio_bufsiz" in
10430         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10431         esac
10432 else
10433         case "$stdio_ptr" in
10434         '') stdio_ptr='((fp)->_ptr)'
10435                 ptr_lval=$define
10436                 ;;
10437         *)      ptr_lval=$d_stdio_ptr_lval;;
10438         esac
10439         case "$stdio_cnt" in
10440         '') stdio_cnt='((fp)->_cnt)'
10441                 cnt_lval=$define
10442                 ;;
10443         *)      cnt_lval=$d_stdio_cnt_lval;;
10444         esac
10445         case "$stdio_base" in
10446         '') stdio_base='((fp)->_base)';;
10447         esac
10448         case "$stdio_bufsiz" in
10449         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10450         esac
10451 fi
10452 : test whether _ptr and _cnt really work
10453 echo "Checking how std your stdio is..." >&4
10454 $cat >try.c <<EOP
10455 #include <stdio.h>
10456 #define FILE_ptr(fp)    $stdio_ptr
10457 #define FILE_cnt(fp)    $stdio_cnt
10458 int main() {
10459         FILE *fp = fopen("try.c", "r");
10460         char c = getc(fp);
10461         if (
10462                 18 <= FILE_cnt(fp) &&
10463                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10464         )
10465                 exit(0);
10466         exit(1);
10467 }
10468 EOP
10469 val="$undef"
10470 set try
10471 if eval $compile; then
10472         if ./try; then
10473                 echo "Your stdio acts pretty std."
10474                 val="$define"
10475         else
10476                 echo "Your stdio isn't very std."
10477         fi
10478 else
10479         echo "Your stdio doesn't appear very std."
10480 fi
10481 $rm -f try.c try
10482 set d_stdstdio
10483 eval $setvar
10484
10485 : Can _ptr be used as an lvalue?
10486 case "$d_stdstdio$ptr_lval" in
10487 $define$define) val=$define ;;
10488 *) val=$undef ;;
10489 esac
10490 set d_stdio_ptr_lval
10491 eval $setvar
10492
10493 : Can _cnt be used as an lvalue?
10494 case "$d_stdstdio$cnt_lval" in
10495 $define$define) val=$define ;;
10496 *) val=$undef ;;
10497 esac
10498 set d_stdio_cnt_lval
10499 eval $setvar
10500
10501 : see if _base is also standard
10502 val="$undef"
10503 case "$d_stdstdio" in
10504 $define)
10505         $cat >try.c <<EOP
10506 #include <stdio.h>
10507 #define FILE_base(fp)   $stdio_base
10508 #define FILE_bufsiz(fp) $stdio_bufsiz
10509 int main() {
10510         FILE *fp = fopen("try.c", "r");
10511         char c = getc(fp);
10512         if (
10513                 19 <= FILE_bufsiz(fp) &&
10514                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10515         )
10516                 exit(0);
10517         exit(1);
10518 }
10519 EOP
10520         set try
10521         if eval $compile; then
10522                 if ./try; then
10523                         echo "And its _base field acts std."
10524                         val="$define"
10525                 else
10526                         echo "But its _base field isn't std."
10527                 fi
10528         else
10529                 echo "However, it seems to be lacking the _base field."
10530         fi
10531         $rm -f try.c try
10532         ;;
10533 esac
10534 set d_stdiobase
10535 eval $setvar
10536
10537 $cat >&4 <<EOM
10538 Checking how to access stdio streams by file descriptor number...
10539 EOM
10540 case "$stdio_stream_array" in
10541 '')     $cat >try.c <<EOCP
10542 #include <stdio.h>
10543 int main() {
10544   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10545     printf("yes\n");
10546 }
10547 EOCP
10548         for s in _iob __iob __sF
10549         do
10550                 set try -DSTDIO_STREAM_ARRAY=$s
10551                 if eval $compile; then
10552                         case "`./try$exe_ext`" in
10553                         yes)    stdio_stream_array=$s; break ;;
10554                         esac
10555                 fi
10556         done
10557         $rm -f try.* try$exe_ext
10558 esac
10559 case "$stdio_stream_array" in
10560 '')     $cat >&4 <<EOM
10561 I can't figure out how to access stdio streams by file descriptor number.
10562 EOM
10563         d_stdio_stream_array="$undef"
10564         ;;
10565 *)      $cat >&4 <<EOM
10566 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10567 EOM
10568         d_stdio_stream_array="$define"
10569         ;;
10570 esac
10571
10572 : see if strcoll exists
10573 set strcoll d_strcoll
10574 eval $inlibc
10575
10576 : check for structure copying
10577 echo " "
10578 echo "Checking to see if your C compiler can copy structs..." >&4
10579 $cat >try.c <<'EOCP'
10580 int main()
10581 {
10582         struct blurfl {
10583                 int dyick;
10584         } foo, bar;
10585
10586         foo = bar;
10587 }
10588 EOCP
10589 if $cc -c try.c >/dev/null 2>&1 ; then
10590         val="$define"
10591         echo "Yup, it can."
10592 else
10593         val="$undef"
10594         echo "Nope, it can't."
10595 fi
10596 set d_strctcpy
10597 eval $setvar
10598 $rm -f try.*
10599
10600 : see if strerror and/or sys_errlist[] exist
10601 echo " "
10602 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10603     if set strerror val -f d_strerror; eval $csym; $val; then
10604                 echo 'strerror() found.' >&4
10605                 d_strerror="$define"
10606                 d_strerrm='strerror(e)'
10607                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10608                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10609                         d_syserrlst="$define"
10610                 else
10611                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10612                         d_syserrlst="$undef"
10613                 fi
10614     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10615                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10616                 echo 'strerror() found in string header.' >&4
10617                 d_strerror="$define"
10618                 d_strerrm='strerror(e)'
10619                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10620                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10621                                 d_syserrlst="$define"
10622                 else
10623                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10624                         d_syserrlst="$undef"
10625                 fi
10626     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10627                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10628                 d_strerror="$undef"
10629                 d_syserrlst="$define"
10630                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10631     else
10632                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10633                 d_strerror="$undef"
10634                 d_syserrlst="$undef"
10635                 d_strerrm='"unknown"'
10636     fi
10637 fi
10638
10639 : see if strtod exists
10640 set strtod d_strtod
10641 eval $inlibc
10642
10643 : see if strtol exists
10644 set strtol d_strtol
10645 eval $inlibc
10646
10647 : see if strtoul exists
10648 set strtoul d_strtoul
10649 eval $inlibc
10650
10651 : see if strtoull exists
10652 set strtoull d_strtoull
10653 eval $inlibc
10654
10655 : see if strxfrm exists
10656 set strxfrm d_strxfrm
10657 eval $inlibc
10658
10659 : see if symlink exists
10660 set symlink d_symlink
10661 eval $inlibc
10662
10663 : see if syscall exists
10664 set syscall d_syscall
10665 eval $inlibc
10666
10667 : see if sysconf exists
10668 set sysconf d_sysconf
10669 eval $inlibc
10670
10671 : see if system exists
10672 set system d_system
10673 eval $inlibc
10674
10675 : see if tcgetpgrp exists
10676 set tcgetpgrp d_tcgetpgrp
10677 eval $inlibc
10678
10679 : see if tcsetpgrp exists
10680 set tcsetpgrp d_tcsetpgrp
10681 eval $inlibc
10682
10683 : see if prototype for telldir is available
10684 echo " "
10685 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10686 eval $hasproto
10687
10688 : define an is-a-typedef? function
10689 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10690 case "$inclist" in
10691 "") inclist="sys/types.h";;
10692 esac;
10693 eval "varval=\$$var";
10694 case "$varval" in
10695 "")
10696         $rm -f temp.c;
10697         for inc in $inclist; do
10698                 echo "#include <$inc>" >>temp.c;
10699         done;
10700         echo "#ifdef $type" >> temp.c;
10701         echo "printf(\"We have $type\");" >> temp.c;
10702         echo "#endif" >> temp.c;
10703         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10704         if $contains $type temp.E >/dev/null 2>&1; then
10705                 eval "$var=\$type";
10706         else
10707                 eval "$var=\$def";
10708         fi;
10709         $rm -f temp.?;;
10710 *) eval "$var=\$varval";;
10711 esac'
10712
10713 : define an is-a-typedef? function that prompts if the type is not available.
10714 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10715 case "$inclist" in
10716 "") inclist="sys/types.h";;
10717 esac;
10718 eval "varval=\$$var";
10719 case "$varval" in
10720 "")
10721         $rm -f temp.c;
10722         for inc in $inclist; do
10723                 echo "#include <$inc>" >>temp.c;
10724         done;
10725         echo "#ifdef $type" >> temp.c;
10726         echo "printf(\"We have $type\");" >> temp.c;
10727         echo "#endif" >> temp.c;
10728         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10729         echo " " ;
10730         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10731         if $contains $type temp.E >/dev/null 2>&1; then
10732                 echo "$type found." >&4;
10733                 eval "$var=\$type";
10734         else
10735                 echo "$type NOT found." >&4;
10736                 dflt="$def";
10737                 . ./myread ;
10738                 eval "$var=\$ans";
10739         fi;
10740         $rm -f temp.?;;
10741 *) eval "$var=\$varval";;
10742 esac'
10743
10744 : see if this is a sys/times.h system
10745 set sys/times.h i_systimes
10746 eval $inhdr
10747
10748 : see if times exists
10749 echo " "
10750 if set times val -f d_times; eval $csym; $val; then
10751         echo 'times() found.' >&4
10752         d_times="$define"
10753         inc=''
10754         case "$i_systimes" in
10755         "$define") inc='sys/times.h';;
10756         esac
10757         rp="What is the type returned by times() on this system?"
10758         set clock_t clocktype long stdio.h sys/types.h $inc
10759         eval $typedef_ask
10760 else
10761         echo 'times() NOT found, hope that will do.' >&4
10762         d_times="$undef"
10763         clocktype='int'
10764 fi
10765
10766 : see if truncate exists
10767 set truncate d_truncate
10768 eval $inlibc
10769
10770 : see if tzname[] exists
10771 echo " "
10772 if set tzname val -a d_tzname; eval $csym; $val; then
10773         val="$define"
10774         echo 'tzname[] found.' >&4
10775 else
10776         val="$undef"
10777         echo 'tzname[] NOT found.' >&4
10778 fi
10779 set d_tzname
10780 eval $setvar
10781
10782 : see if umask exists
10783 set umask d_umask
10784 eval $inlibc
10785
10786 : see if ustat exists
10787 set ustat d_ustat
10788 eval $inlibc
10789
10790 : backward compatibility for d_hvfork
10791 if test X$d_hvfork != X; then
10792         d_vfork="$d_hvfork"
10793         d_hvfork=''
10794 fi
10795 : see if there is a vfork
10796 val=''
10797 set vfork val
10798 eval $inlibc
10799
10800 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10801 : perl on Solaris 2.x, and probably elsewhere.
10802 case "$val" in
10803 $define)
10804         echo " "
10805         case "$usevfork" in
10806         false) dflt='n';;
10807         *) dflt='y';;
10808         esac
10809         cat <<'EOM'
10810  
10811 Perl can only use a vfork() that doesn't suffer from strict
10812 restrictions on calling functions or modifying global data in
10813 the child.  For example, glibc-2.1 contains such a vfork()
10814 that is unsuitable.  If your system provides a proper fork()
10815 call, chances are that you do NOT want perl to use vfork().
10816
10817 EOM
10818         rp="Do you still want to use vfork()?"
10819         . ./myread
10820         case "$ans" in
10821         y|Y) ;;
10822         *)
10823                 echo "Ok, we won't use vfork()."
10824                 val="$undef"
10825                 ;;
10826         esac
10827         ;;
10828 esac
10829 set d_vfork
10830 eval $setvar
10831 case "$d_vfork" in
10832 $define) usevfork='true';;
10833 *) usevfork='false';;
10834 esac
10835
10836 : see if this is an sysdir system
10837 set sys/dir.h i_sysdir
10838 eval $inhdr
10839
10840 : see if this is an sysndir system
10841 set sys/ndir.h i_sysndir
10842 eval $inhdr
10843
10844 : see if closedir exists
10845 set closedir d_closedir
10846 eval $inlibc
10847
10848 case "$d_closedir" in
10849 "$define")
10850         echo " "
10851         echo "Checking whether closedir() returns a status..." >&4
10852         cat > closedir.c <<EOM
10853 #$i_dirent I_DIRENT             /**/
10854 #$i_sysdir I_SYS_DIR            /**/
10855 #$i_sysndir I_SYS_NDIR          /**/
10856 #$i_systypes I_SYS_TYPES        /**/
10857
10858 #if defined(I_SYS_TYPES)
10859 #include <sys/types.h>
10860 #endif
10861 #if defined(I_DIRENT)
10862 #include <dirent.h>
10863 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10864 #include <sys/dir.h>
10865 #endif
10866 #else
10867 #ifdef I_SYS_NDIR
10868 #include <sys/ndir.h>
10869 #else
10870 #ifdef I_SYS_DIR
10871 #ifdef hp9000s500
10872 #include <ndir.h>       /* may be wrong in the future */
10873 #else
10874 #include <sys/dir.h>
10875 #endif
10876 #endif
10877 #endif
10878 #endif 
10879 int main() { return closedir(opendir(".")); }
10880 EOM
10881         set closedir
10882         if eval $compile_ok; then
10883                 if ./closedir > /dev/null 2>&1 ; then
10884                         echo "Yes, it does."
10885                         val="$undef"
10886                 else
10887                         echo "No, it doesn't."
10888                         val="$define"
10889                 fi
10890         else
10891                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10892                 val="$define"
10893         fi
10894         ;;
10895 *)
10896         val="$undef";
10897         ;;
10898 esac
10899 set d_void_closedir
10900 eval $setvar
10901 $rm -f closedir*
10902 : check for volatile keyword
10903 echo " "
10904 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10905 $cat >try.c <<'EOCP'
10906 int main()
10907 {
10908         typedef struct _goo_struct goo_struct;
10909         goo_struct * volatile goo = ((goo_struct *)0);
10910         struct _goo_struct {
10911                 long long_int;
10912                 int reg_int;
10913                 char char_var;
10914         };
10915         typedef unsigned short foo_t;
10916         char *volatile foo;
10917         volatile int bar;
10918         volatile foo_t blech;
10919         foo = foo;
10920 }
10921 EOCP
10922 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10923         val="$define"
10924         echo "Yup, it does."
10925 else
10926         val="$undef"
10927         echo "Nope, it doesn't."
10928 fi
10929 set d_volatile
10930 eval $setvar
10931 $rm -f try.*
10932
10933 : see if there is a wait4
10934 set wait4 d_wait4
10935 eval $inlibc
10936
10937 : see if waitpid exists
10938 set waitpid d_waitpid
10939 eval $inlibc
10940
10941 : see if wcstombs exists
10942 set wcstombs d_wcstombs
10943 eval $inlibc
10944
10945 : see if wctomb exists
10946 set wctomb d_wctomb
10947 eval $inlibc
10948
10949 : see if writev exists
10950 set writev d_writev
10951 eval $inlibc
10952
10953 : preserve RCS keywords in files with variable substitution, grrr
10954 Date='$Date'
10955 Id='$Id'
10956 Log='$Log'
10957 RCSfile='$RCSfile'
10958 Revision='$Revision'
10959
10960 case "$crosscompile" in
10961 ''|[nN]*) crosscompile="$undef" ;;
10962 esac
10963
10964 case "$osname" in
10965 next|rhapsody) multiarch="$define" ;;
10966 esac
10967 case "$multiarch" in
10968 ''|[nN]*) multiarch="$undef" ;;
10969 esac
10970
10971 : check for alignment requirements
10972 echo " "
10973 case "$crosscompile$multiarch" in
10974 *$define*)
10975         $cat <<EOM
10976 You seem to be either cross-compiling or doing a multiarchitecture build,
10977 skipping the memory alignment check.
10978
10979 EOM
10980         case "$alignbytes" in
10981         '') alignbytes=8 ;;
10982         esac
10983         ;;
10984 *)
10985         case "$alignbytes" in
10986         '') echo "Checking alignment constraints..." >&4
10987                 $cat >try.c <<'EOCP'
10988 struct foobar {
10989         char foo;
10990         double bar;
10991 } try_algn;
10992 int main()
10993 {
10994         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10995 }
10996 EOCP
10997                 set try
10998                 if eval $compile_ok; then
10999                         dflt=`./try`
11000                 else
11001                         dflt='8'
11002                         echo "(I can't seem to compile the test program...)"
11003                 fi
11004                 ;;
11005         *) dflt="$alignbytes"
11006                 ;;
11007         esac
11008         rp="Doubles must be aligned on a how-many-byte boundary?"
11009         . ./myread
11010         alignbytes="$ans"
11011         $rm -f try.c try
11012         ;;
11013 esac
11014
11015
11016 : check for ordering of bytes in a long
11017 echo " "
11018 case "$crosscompile$multiarch" in
11019 *$define*)
11020         $cat <<EOM
11021 You seem to be either cross-compiling or doing a multiarchitecture build,
11022 skipping the byteorder check.
11023
11024 EOM
11025         byteorder='0xffff'
11026         ;;
11027 *)
11028         case "$byteorder" in
11029         '')
11030                 $cat <<'EOM'
11031 In the following, larger digits indicate more significance.  A big-endian
11032 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11033 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11034 machines may have weird orders like 3412.  A Cray will report 87654321,
11035 an Alpha will report 12345678. If the test program works the default is
11036 probably right.
11037 I'm now running the test program...
11038 EOM
11039                 $cat >try.c <<'EOCP'
11040 #include <stdio.h>
11041 int main()
11042 {
11043         int i;
11044         union {
11045                 unsigned long l;
11046                 char c[sizeof(long)];
11047         } u;
11048
11049         if (sizeof(long) > 4)
11050                 u.l = (0x08070605L << 32) | 0x04030201L;
11051         else
11052                 u.l = 0x04030201L;
11053         for (i = 0; i < sizeof(long); i++)
11054                 printf("%c", u.c[i]+'0');
11055         printf("\n");
11056         exit(0);
11057 }
11058 EOCP
11059                 xxx_prompt=y
11060                 set try
11061                 if eval $compile && ./try > /dev/null; then
11062                         dflt=`./try`
11063                         case "$dflt" in
11064                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11065                                 echo "(The test program ran ok.)"
11066                                 echo "byteorder=$dflt"
11067                                 xxx_prompt=n
11068                         ;;
11069                         ????|????????) echo "(The test program ran ok.)" ;;
11070                         *) echo "(The test program didn't run right for some reason.)" ;;
11071                         esac
11072                 else
11073                         dflt='4321'
11074                         cat <<'EOM'
11075 (I can't seem to compile the test program.  Guessing big-endian...)
11076 EOM
11077                 fi
11078                 case "$xxx_prompt" in
11079                 y)
11080                         rp="What is the order of bytes in a long?"
11081                         . ./myread
11082                         byteorder="$ans"
11083                         ;;
11084                 *)      byteorder=$dflt
11085                         ;;
11086                 esac
11087                 ;;
11088         esac
11089         $rm -f try.c try
11090         ;;
11091 esac
11092
11093
11094 : how do we catenate cpp tokens here?
11095 echo " "
11096 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11097 $cat >cpp_stuff.c <<'EOCP'
11098 #define RCAT(a,b)a/**/b
11099 #define ACAT(a,b)a ## b
11100 RCAT(Rei,ser)
11101 ACAT(Cir,cus)
11102 EOCP
11103 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11104 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11105         echo "Oh!  Smells like ANSI's been here." >&4
11106         echo "We can catify or stringify, separately or together!"
11107         cpp_stuff=42
11108 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11109         echo "Ah, yes!  The good old days!" >&4
11110         echo "However, in the good old days we don't know how to stringify and"
11111         echo "catify at the same time."
11112         cpp_stuff=1
11113 else
11114         $cat >&4 <<EOM
11115 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11116 to have to edit the values of CAT[2-5] in config.h...
11117 EOM
11118         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11119 fi
11120 $rm -f cpp_stuff.*
11121
11122 : see if this is a db.h system
11123 set db.h i_db
11124 eval $inhdr
11125
11126 case "$i_db" in
11127 $define)
11128         : Check db version.
11129         echo " "
11130         echo "Checking Berkeley DB version ..." >&4
11131         $cat >try.c <<EOCP
11132 #$d_const HASCONST
11133 #ifndef HASCONST
11134 #define const
11135 #endif
11136 #include <sys/types.h>
11137 #include <stdio.h>
11138 #include <db.h>
11139 int main()
11140 {
11141 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11142     int Major, Minor, Patch ;
11143     unsigned long Version ;
11144     (void)db_version(&Major, &Minor, &Patch) ;
11145     printf("You have Berkeley DB Version 2 or greater\n");
11146
11147     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11148                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11149     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11150                 Major, Minor, Patch) ;
11151
11152     /* check that db.h & libdb are compatible */
11153     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11154         printf("db.h and libdb are incompatible\n") ;
11155         exit(3);        
11156     }
11157
11158     printf("db.h and libdb are compatible\n") ;
11159
11160     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11161                 + DB_VERSION_PATCH ;
11162
11163     /* needs to be >= 2.3.4 */
11164     if (Version < 2003004) {
11165     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11166         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11167         exit(2);        
11168     }
11169
11170     exit(0);
11171 #else
11172 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11173     printf("You have Berkeley DB Version 1\n");
11174     exit(0);    /* DB version < 2: the coast is clear. */
11175 #else
11176     exit(1);    /* <db.h> not Berkeley DB? */
11177 #endif
11178 #endif
11179 }
11180 EOCP
11181         set try
11182         if eval $compile && ./try; then
11183                 echo 'Looks OK.' >&4
11184         else
11185                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11186                 i_db=$undef
11187                 case " $libs " in
11188                 *"-ldb "*)
11189                         : Remove db from list of libraries to use
11190                         echo "Removing unusable -ldb from library list" >&4
11191                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11192                         shift
11193                         libs="$*"
11194                         echo "libs = $libs" >&4
11195                         ;;
11196                 esac
11197         fi
11198         $rm -f try.*
11199         ;;
11200 esac
11201
11202 case "$i_db" in
11203 define)
11204         : Check the return type needed for hash 
11205         echo " "
11206         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11207         $cat >try.c <<EOCP
11208 #$d_const HASCONST
11209 #ifndef HASCONST
11210 #define const
11211 #endif
11212 #include <sys/types.h>
11213 #include <db.h>
11214
11215 #ifndef DB_VERSION_MAJOR
11216 u_int32_t hash_cb (ptr, size)
11217 const void *ptr;
11218 size_t size;
11219 {
11220 }
11221 HASHINFO info;
11222 int main()
11223 {
11224         info.hash = hash_cb;
11225 }
11226 #endif
11227 EOCP
11228         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11229                 if $contains warning try.out >>/dev/null 2>&1 ; then
11230                         db_hashtype='int'
11231                 else
11232                         db_hashtype='u_int32_t'
11233                 fi
11234         else
11235                 : XXX Maybe we should just give up here.
11236                 db_hashtype=u_int32_t
11237                 $cat try.out >&4
11238                 echo "Help:  I can't seem to compile the db test program." >&4
11239                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11240         fi
11241         $rm -f try.*
11242         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11243         ;;
11244 *)      db_hashtype=u_int32_t
11245         ;;
11246 esac
11247 case "$i_db" in
11248 define)
11249         : Check the return type needed for prefix 
11250         echo " "
11251         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11252         cat >try.c <<EOCP
11253 #$d_const HASCONST
11254 #ifndef HASCONST
11255 #define const
11256 #endif
11257 #include <sys/types.h>
11258 #include <db.h>
11259
11260 #ifndef DB_VERSION_MAJOR
11261 size_t prefix_cb (key1, key2)
11262 const DBT *key1;
11263 const DBT *key2;
11264 {
11265 }
11266 BTREEINFO info;
11267 int main()
11268 {
11269         info.prefix = prefix_cb;
11270 }
11271 #endif
11272 EOCP
11273         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11274                 if $contains warning try.out >>/dev/null 2>&1 ; then
11275                         db_prefixtype='int'
11276                 else
11277                         db_prefixtype='size_t'
11278                 fi
11279         else
11280                 db_prefixtype='size_t'
11281                 : XXX Maybe we should just give up here.
11282                 $cat try.out >&4
11283                 echo "Help:  I can't seem to compile the db test program." >&4
11284                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11285         fi
11286         $rm -f try.*
11287         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11288         ;;
11289 *)      db_prefixtype='size_t'
11290         ;;
11291 esac
11292
11293 : check for void type
11294 echo " "
11295 echo "Checking to see how well your C compiler groks the void type..." >&4
11296 case "$voidflags" in
11297 '')
11298         $cat >try.c <<'EOCP'
11299 #if TRY & 1
11300 void sub() {
11301 #else
11302 sub() {
11303 #endif
11304         extern void moo();      /* function returning void */
11305         void (*goo)();          /* ptr to func returning void */
11306 #if TRY & 8
11307         void *hue;              /* generic ptr */
11308 #endif
11309 #if TRY & 2
11310         void (*foo[10])();
11311 #endif
11312
11313 #if TRY & 4
11314         if(goo == moo) {
11315                 exit(0);
11316         }
11317 #endif
11318         exit(0);
11319 }
11320 int main() { sub(); }
11321 EOCP
11322         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11323                 voidflags=$defvoidused
11324         echo "Good.  It appears to support void to the level $package wants.">&4
11325                 if $contains warning .out >/dev/null 2>&1; then
11326                         echo "However, you might get some warnings that look like this:"
11327                         $cat .out
11328                 fi
11329         else
11330 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11331                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11332                         echo "It supports 1..."
11333                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11334                                 echo "It also supports 2..."
11335                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11336                                         voidflags=7
11337                                         echo "And it supports 4 but not 8 definitely."
11338                                 else
11339                                         echo "It doesn't support 4..."
11340                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11341                                                 voidflags=11
11342                                                 echo "But it supports 8."
11343                                         else
11344                                                 voidflags=3
11345                                                 echo "Neither does it support 8."
11346                                         fi
11347                                 fi
11348                         else
11349                                 echo "It does not support 2..."
11350                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11351                                         voidflags=13
11352                                         echo "But it supports 4 and 8."
11353                                 else
11354                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11355                                                 voidflags=5
11356                                                 echo "And it supports 4 but has not heard about 8."
11357                                         else
11358                                                 echo "However it supports 8 but not 4."
11359                                         fi
11360                                 fi
11361                         fi
11362                 else
11363                         echo "There is no support at all for void."
11364                         voidflags=0
11365                 fi
11366         fi
11367 esac
11368 case "$voidflags" in
11369 "$defvoidused") ;;
11370 *)      $cat >&4 <<'EOM'
11371   Support flag bits are:
11372     1: basic void declarations.
11373     2: arrays of pointers to functions returning void.
11374     4: operations between pointers to and addresses of void functions.
11375     8: generic void pointers.
11376 EOM
11377         dflt="$voidflags";
11378         rp="Your void support flags add up to what?"
11379         . ./myread
11380         voidflags="$ans"
11381         ;;
11382 esac
11383 $rm -f try.* .out
11384
11385
11386 : How can we generate normalized random numbers ?
11387 echo " "
11388 echo "Looking for a random number function..." >&4
11389 case "$randfunc" in
11390 '')
11391         if set drand48 val -f; eval $csym; $val; then
11392                 dflt="drand48"
11393                 echo "Good, found drand48()." >&4
11394         elif set random val -f; eval $csym; $val; then
11395                 dflt="random"
11396                 echo "OK, found random()." >&4
11397         else
11398                 dflt="rand"
11399                 echo "Yick, looks like I have to use rand()." >&4
11400         fi
11401         echo " "
11402         ;;
11403 *)
11404         dflt="$randfunc"
11405         ;;
11406 esac
11407 cont=true
11408
11409 case "$ccflags" in
11410 *-Dmy_rand=*|*-Dmy_srand=*)
11411         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11412         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11413         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11414         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11415         ;;
11416 esac
11417
11418 while $test "$cont"; do
11419         rp="Use which function to generate random numbers?"
11420         . ./myread
11421         if $test "$ans" = "$dflt"; then
11422                 : null
11423         else
11424                 randbits=''
11425         fi
11426         randfunc="$ans"
11427         if set $ans val -f; eval $csym; $val; then
11428                 cont=''
11429         else
11430                 dflt=y
11431                 rp="I cannot find function $ans. Use that name anyway?"
11432                 . ./myread
11433                 dflt=rand
11434                 case "$ans" in
11435                         [yY]*) cont='';;
11436                 esac
11437         fi
11438         case "$cont" in
11439         '')
11440                 case "$randfunc" in
11441                 drand48)
11442                         drand01="drand48()"
11443                         seedfunc="srand48"
11444                         randbits=48
11445                         randseedtype=long
11446                         ;;
11447                 rand|random)
11448                         case "$randbits" in
11449                         '')
11450 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11451                                 $cat >try.c <<EOCP
11452 #$i_unistd I_UNISTD
11453 #$i_stdlib I_STDLIB
11454 #include <stdio.h>
11455 #ifdef I_UNISTD
11456 #  include <unistd.h>
11457 #endif
11458 #ifdef I_STDLIB
11459 #  include <stdlib.h>
11460 #endif
11461 int main()
11462 {
11463         register int i;
11464         register unsigned long tmp;
11465         register unsigned long max = 0L;
11466
11467         for (i = 1000; i; i--) {
11468                 tmp = (unsigned long) $randfunc();
11469                 if (tmp > max) max = tmp;
11470         }
11471         for (i = 0; max; i++)
11472                 max /= 2;
11473         printf("%d\n",i);
11474 }
11475 EOCP
11476                                 set try
11477                                 if eval $compile_ok; then
11478                                         dflt=`try`
11479                                 else
11480                                         dflt='?'
11481                                         echo "(I can't seem to compile the test program...)"
11482                                 fi
11483                                 ;;
11484                         *)
11485                                 dflt="$randbits"
11486                                 ;;
11487                         esac
11488                         rp="How many bits does your $randfunc() function produce?"
11489                         . ./myread
11490                         randbits="$ans"
11491                         $rm -f try.c try
11492                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11493                         seedfunc="s$randfunc"
11494                         randseedtype=unsigned
11495                         ;;
11496                 *)
11497                         dflt="31"
11498                         rp="How many bits does your $randfunc() function produce?"
11499                         . ./myread
11500                         randbits="$ans"
11501                         seedfunc="s$randfunc"
11502                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11503                         if set $seedfunc val -f; eval $csym; $val; then
11504                                 echo "(Using $seedfunc() to seed random generator)"
11505                         else
11506                                 echo "(Warning: no $seedfunc() to seed random generator)"
11507                                 seedfunc=rand
11508                         fi
11509                         randseedtype=unsigned
11510                         ;;
11511                 esac
11512                 ;;
11513         esac
11514 done
11515
11516 echo " "
11517 echo "Determining whether or not we are on an EBCDIC system..." >&4
11518 $cat >tebcdic.c <<'EOM'
11519 int main()
11520 {
11521   if ('M'==0xd4) return 0;
11522   return 1;
11523 }
11524 EOM
11525
11526 val=$undef
11527 set tebcdic
11528 if eval $compile_ok; then
11529         if ./tebcdic; then
11530                 echo "You have EBCDIC." >&4
11531                 val="$define"
11532         else
11533                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11534         fi
11535 else
11536         echo "I'm unable to compile the test program." >&4
11537         echo "I'll assume ASCII or some ISO Latin." >&4
11538 fi
11539 $rm -f tebcdic.c tebcdic
11540 set ebcdic
11541 eval $setvar
11542
11543 echo " "
11544 $cat >&4 <<EOM
11545 Checking how to flush all pending stdio output...
11546 EOM
11547 # I only know how to find the first 32 possibly open files on SunOS.
11548 # See also hints/sunos_4_1.sh and util.c  --AD
11549 case "$osname" in
11550 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11551 esac
11552 $cat >>try.c <<EOCP
11553 #include <stdio.h>
11554 #$i_unistd I_UNISTD
11555 #ifdef I_UNISTD
11556 # include <unistd.h>
11557 #endif
11558 #$d_sysconf HAS_SYSCONF
11559 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11560 #ifdef HAS_STDIO_STREAM_ARRAY
11561 # define STDIO_STREAM_ARRAY $stdio_stream_array
11562 #endif
11563 int main() {
11564   FILE* p = fopen("try.out", "w");
11565 #ifdef TRY_FPUTC
11566   fputc('x', p);
11567 #else
11568 # ifdef TRY_FPRINTF
11569   fprintf(p, "x");
11570 # endif
11571 #endif
11572 #ifdef TRY_FFLUSH_NULL
11573   fflush(NULL);
11574 #endif
11575 #ifdef TRY_FFLUSH_ALL
11576   {
11577     long open_max = -1;
11578 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11579     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11580 # else
11581 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11582     open_max = sysconf(_SC_OPEN_MAX);
11583 #  else
11584 #   ifdef FOPEN_MAX
11585     open_max = FOPEN_MAX;
11586 #   else
11587 #    ifdef OPEN_MAX
11588     open_max = OPEN_MAX;
11589 #    else
11590 #     ifdef _NFILE
11591     open_max = _NFILE;
11592 #     endif
11593 #    endif
11594 #   endif
11595 #  endif
11596 # endif 
11597 # ifdef HAS_STDIO_STREAM_ARRAY
11598     if (open_max > 0) {
11599       long i;
11600       for (i = 0; i < open_max; i++)
11601             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11602                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11603                 STDIO_STREAM_ARRAY[i]._flag)
11604                 fflush(&STDIO_STREAM_ARRAY[i]);
11605     }   
11606   }
11607 # endif
11608 #endif
11609   _exit(42);
11610 }
11611 EOCP
11612 : first we have to find out how _not_ to flush
11613 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11614     output=''
11615     set try -DTRY_FPUTC
11616     if eval $compile; then
11617             $rm -f try.out
11618             ./try$exe_ext 2>/dev/null
11619             if $test ! -s try.out -a "X$?" = X42; then
11620                 output=-DTRY_FPUTC
11621             fi
11622     fi
11623     case "$output" in
11624     '')
11625             set try -DTRY_FPRINTF
11626             $rm -f try.out
11627             if eval $compile; then
11628                     $rm -f try.out
11629                     ./try$exe_ext 2>/dev/null
11630                     if $test ! -s try.out -a "X$?" = X42; then
11631                         output=-DTRY_FPRINTF
11632                     fi
11633             fi
11634         ;;
11635     esac
11636 fi
11637 : check for fflush NULL behaviour
11638 case "$fflushNULL" in
11639 '')     set try -DTRY_FFLUSH_NULL $output
11640         if eval $compile; then
11641                 $rm -f try.out
11642                 ./try$exe_ext 2>/dev/null
11643                 code="$?"
11644                 if $test -s try.out -a "X$code" = X42; then
11645                         fflushNULL="`$cat try.out`"
11646                 else
11647                         if $test "X$code" != X42; then
11648                                 $cat >&4 <<EOM
11649 (If this test failed, don't worry, we'll try another method shortly.)
11650 EOM
11651                         fi
11652                 fi
11653         fi
11654         $rm -f core try.core core.try.*
11655         case "$fflushNULL" in
11656         x)      $cat >&4 <<EOM
11657 Your fflush(NULL) works okay.
11658 EOM
11659                 fflushNULL="$define"
11660                 ;;
11661         '')     $cat >&4 <<EOM
11662 Your fflush(NULL) isn't working (contrary to ANSI C).
11663 EOM
11664                 fflushNULL="$undef"
11665                 ;;
11666         *)      $cat >&4 <<EOM
11667 Cannot figure out whether your fflush(NULL) works or not.
11668 I'm assuming it doesn't (contrary to ANSI C).
11669 EOM
11670                 fflushNULL="$undef"
11671                 ;;
11672         esac
11673         ;;
11674 $define|true|[yY]*)
11675         fflushNULL="$define"
11676         ;;
11677 *)
11678         fflushNULL="$undef"
11679         ;;
11680 esac
11681 : check explicit looping only if NULL did not work
11682 case "$fflushNULL" in
11683 "$undef")
11684         : check for fflush all behaviour
11685         case "$fflushall" in
11686         '')     set try -DTRY_FFLUSH_ALL $output
11687                 if eval $compile; then
11688                         $cat >&4 <<EOM
11689 (Now testing the other method--but note that also this may fail.)
11690 EOM
11691                         $rm -f try.out
11692                         ./try$exe_ext 2>/dev/null
11693                         if $test -s try.out -a "X$?" = X42; then
11694                                 fflushall="`$cat try.out`"
11695                         fi
11696                 fi
11697                 $rm -f core try.core core.try.*
11698                 case "$fflushall" in
11699                 x)      $cat >&4 <<EOM
11700 Whew. Flushing explicitly all the stdio streams works.
11701 EOM
11702                         fflushall="$define"
11703                         ;;
11704                 '')     $cat >&4 <<EOM
11705 Sigh. Flushing explicitly all the stdio streams doesn't work.
11706 EOM
11707                         fflushall="$undef"
11708                         ;;
11709                 *)      $cat >&4 <<EOM
11710 Cannot figure out whether flushing stdio streams explicitly works or not.
11711 I'm assuming it doesn't.
11712 EOM
11713                         fflushall="$undef"
11714                         ;;
11715                 esac
11716                 ;;
11717         "$define"|true|[yY]*)
11718                 fflushall="$define"
11719                 ;;
11720         *)
11721                 fflushall="$undef"
11722                 ;;
11723         esac
11724         ;;
11725 *)      fflushall="$undef"      
11726         ;;
11727 esac
11728 case "$fflushNULL$fflushall" in
11729 undefundef)
11730         $cat <<EOM
11731 I cannot figure out how to flush pending stdio output.
11732 EOM
11733         ;;
11734 esac
11735 $rm -f try.* try$exe_ext
11736
11737 : see what type file positions are declared as in the library
11738 rp="What is the type for file position used by fsetpos()?"
11739 set fpos_t fpostype long stdio.h sys/types.h
11740 eval $typedef_ask
11741
11742 : Store the full pathname to the ar program for use in the C program
11743 : Respect a hint or command line value for full_ar.
11744 case "$full_ar" in
11745 '') full_ar=$ar ;;
11746 esac
11747
11748 : Store the full pathname to the sed program for use in the C program
11749 full_sed=$sed
11750
11751 : see what type gids are declared as in the kernel
11752 echo " "
11753 echo "Looking for the type for group ids returned by getgid()."
11754 set gid_t gidtype xxx stdio.h sys/types.h
11755 eval $typedef
11756 case "$gidtype" in
11757 xxx)
11758         xxx=`./findhdr sys/user.h`
11759         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11760         case $1 in
11761         unsigned) dflt="$1 $2" ;;
11762         *) dflt="$1" ;;
11763         esac
11764         ;;
11765 *) dflt="$gidtype";;
11766 esac
11767 case "$gidtype" in
11768 gid_t) echo "gid_t found." ;;
11769 *)      rp="What is the type for group ids returned by getgid()?"
11770         . ./myread
11771         gidtype="$ans"
11772         ;;
11773 esac
11774
11775 : see if getgroups exists
11776 set getgroups d_getgrps
11777 eval $inlibc
11778
11779 : see if setgroups exists
11780 set setgroups d_setgrps
11781 eval $inlibc
11782
11783
11784 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11785 echo " "
11786 case "$d_getgrps$d_setgrps" in
11787 *define*)
11788         case "$groupstype" in
11789         '') dflt="$gidtype" ;;
11790         *)  dflt="$groupstype" ;;
11791         esac
11792         $cat <<EOM
11793 What type of pointer is the second argument to getgroups() and setgroups()?
11794 Usually this is the same as group ids, $gidtype, but not always.
11795
11796 EOM
11797         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11798         . ./myread
11799         groupstype="$ans"
11800         ;;
11801 *)  groupstype="$gidtype";;
11802 esac
11803
11804 : see what type lseek is declared as in the kernel
11805 rp="What is the type used for lseek's offset on this system?"
11806 set off_t lseektype long stdio.h sys/types.h
11807 eval $typedef_ask
11808
11809 echo " "
11810 $echo $n "Checking to see how big your file offsets are...$c" >&4
11811 $cat >try.c <<EOCP
11812 #include <sys/types.h>
11813 #include <stdio.h>
11814 int main()
11815 {
11816         printf("%d\n", sizeof($lseektype));
11817 }
11818 EOCP
11819 set try
11820 if eval $compile_ok; then
11821         lseeksize=`./try`
11822         $echo " $lseeksize bytes." >&4
11823 else
11824         dflt='4'
11825         echo " "
11826         echo "(I can't seem to compile the test program.  Guessing...)"
11827         rp="What is the size of your file offsets (in bytes)?"
11828         . ./myread
11829         lseeksize="$ans"
11830 fi
11831 $rm -f try.c try
11832
11833 echo " "
11834 echo "Checking if your $make program sets \$(MAKE)..." >&4
11835 case "$make_set_make" in
11836 '')
11837         $sed 's/^X //' > testmake.mak << 'EOF'
11838 Xall:
11839 X       @echo 'maketemp="$(MAKE)"'
11840 EOF
11841         case "`$make -f testmake.mak 2>/dev/null`" in
11842         *maketemp=*) make_set_make='#' ;;
11843         *)      make_set_make="MAKE=$make" ;;
11844         esac
11845         $rm -f testmake.mak
11846         ;;
11847 esac
11848 case "$make_set_make" in
11849 '#') echo "Yup, it does.";;
11850 *) echo "Nope, it doesn't.";;
11851 esac
11852
11853 : see what type is used for mode_t
11854 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11855 set mode_t modetype int stdio.h sys/types.h
11856 eval $typedef_ask
11857
11858 : define a fucntion to check prototypes
11859 $cat > protochk <<EOSH
11860 $startsh
11861 cc="$cc"
11862 optimize="$optimize"
11863 ccflags="$ccflags"
11864 prototype="$prototype"
11865 define="$define"
11866 rm=$rm
11867 EOSH
11868
11869 $cat >> protochk <<'EOSH'
11870
11871 $rm -f try.c
11872 foo="$1"
11873 shift
11874 while test $# -ge 2; do
11875         case "$1" in
11876                 $define) echo "#include <$2>" >> try.c ;;
11877                 literal) echo "$2" >> try.c ;;
11878         esac
11879     shift 2
11880 done
11881 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11882 cat >> try.c <<'EOCP'
11883 #ifdef CAN_PROTOTYPE
11884 #define _(args) args
11885 #else
11886 #define _(args) ()
11887 #endif
11888 EOCP
11889 echo "$foo" >> try.c
11890 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11891 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11892 status=$?
11893 $rm -f try.[co]
11894 exit $status
11895 EOSH
11896 chmod +x protochk
11897 $eunicefix protochk
11898
11899 : see what type is used for size_t
11900 rp="What is the type used for the length parameter for string functions?"
11901 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11902 eval $typedef_ask
11903
11904 : check for type of arguments to gethostbyaddr. 
11905 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11906         case "$d_gethbyaddr" in
11907         $define)
11908                 $cat <<EOM
11909
11910 Checking to see what type of arguments are accepted by gethostbyaddr().
11911 EOM
11912                 hdrs="$define sys/types.h
11913                         $d_socket sys/socket.h 
11914                         $i_niin netinet/in.h 
11915                         $i_netdb netdb.h
11916                         $i_unistd unistd.h"
11917                 : The first arg can 'char *' or 'void *'
11918                 : The second arg is some of integral type
11919                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11920                         for yyy in size_t long int; do
11921                                 case "$netdb_host_type" in
11922                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11923                                         if ./protochk "$try" $hdrs; then
11924                                                 echo "Your system accepts $xxx for the first arg."
11925                                                 echo "...and $yyy for the second arg."
11926                                                 netdb_host_type="$xxx"
11927                                                 netdb_hlen_type="$yyy"
11928                                         fi
11929                                         ;;
11930                                 esac
11931                         done
11932                 done
11933                 : In case none of those worked, prompt the user.
11934                 case "$netdb_host_type" in
11935                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11936                         dflt='char *'
11937                         . ./myread
11938                         netdb_host_type=$ans
11939                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11940                         dflt="$sizetype"
11941                         . ./myread
11942                         netdb_hlen_type=$ans
11943                         ;;
11944                 esac
11945                 ;;
11946         *)      : no gethostbyaddr, so pick harmless defaults
11947                 netdb_host_type='char *'
11948                 netdb_hlen_type="$sizetype"
11949                 ;;
11950         esac
11951         # Remove the "const" if needed. -- but then we'll have a 
11952         # prototype clash!
11953         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11954 fi
11955
11956 : check for type of argument to gethostbyname. 
11957 if test "X$netdb_name_type" = X ; then
11958         case "$d_gethbyname" in
11959         $define)
11960                 $cat <<EOM
11961
11962 Checking to see what type of argument is accepted by gethostbyname().
11963 EOM
11964                 hdrs="$define sys/types.h
11965                         $d_socket sys/socket.h 
11966                         $i_niin netinet/in.h 
11967                         $i_netdb netdb.h
11968                         $i_unistd unistd.h"
11969                 for xxx in "const char *" "char *"; do
11970                         case "$netdb_name_type" in
11971                         '')     try="extern struct hostent *gethostbyname($xxx);"
11972                                 if ./protochk "$try" $hdrs; then
11973                                         echo "Your system accepts $xxx."
11974                                         netdb_name_type="$xxx"
11975                                 fi
11976                                 ;;
11977                         esac
11978                 done
11979                 : In case none of those worked, prompt the user.
11980                 case "$netdb_name_type" in
11981                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11982                         dflt='char *'
11983                         . ./myread
11984                         netdb_name_type=$ans
11985                         ;;
11986                 esac
11987                 ;;
11988         *)      : no gethostbyname, so pick harmless default
11989                 netdb_name_type='char *'
11990                 ;;
11991         esac
11992 fi
11993
11994 : check for type of 1st argument to getnetbyaddr. 
11995 if test "X$netdb_net_type" = X ; then
11996         case "$d_getnbyaddr" in
11997         $define)
11998                 $cat <<EOM
11999
12000 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12001 EOM
12002                 hdrs="$define sys/types.h
12003                         $d_socket sys/socket.h 
12004                         $i_niin netinet/in.h 
12005                         $i_netdb netdb.h
12006                         $i_unistd unistd.h"
12007                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12008                         case "$netdb_net_type" in
12009                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12010                                 if ./protochk "$try" $hdrs; then
12011                                         echo "Your system accepts $xxx."
12012                                         netdb_net_type="$xxx"
12013                                 fi
12014                                 ;;
12015                         esac
12016                 done
12017                 : In case none of those worked, prompt the user.
12018                 case "$netdb_net_type" in
12019                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12020                         dflt='long'
12021                         . ./myread
12022                         netdb_net_type=$ans
12023                         ;;
12024                 esac
12025                 ;;
12026         *)      : no getnetbyaddr, so pick harmless default
12027                 netdb_net_type='long'
12028                 ;;
12029         esac
12030 fi
12031 : locate the preferred pager for this system
12032 case "$pager" in
12033 '')
12034         dflt=''
12035         case "$pg" in
12036         /*) dflt=$pg;;
12037         esac
12038         case "$more" in
12039         /*) dflt=$more;;
12040         esac
12041         case "$less" in
12042         /*) dflt=$less;;
12043         esac
12044         case "$dflt" in
12045         '') dflt=/usr/ucb/more;;
12046         esac
12047         ;;
12048 *) dflt="$pager";;
12049 esac
12050 echo " "
12051 fn=f/
12052 rp='What pager is used on your system?'
12053 . ./getfile
12054 pager="$ans"
12055
12056 : see what type pids are declared as in the kernel
12057 rp="What is the type of process ids on this system?"
12058 set pid_t pidtype int stdio.h sys/types.h
12059 eval $typedef_ask
12060
12061 : Find earliest binary compatible site_perl subdirectory perl can use.
12062 case "$bincompat5005" in
12063 "$define") xs_apiversion='5.005' ;;
12064 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12065 esac
12066 : Find earliest pure perl site_perl subdirectory perl can use.
12067 : The versioned directories started at 5.005.
12068 pm_apiversion='5.005'
12069
12070 : check for length of pointer
12071 echo " "
12072 case "$ptrsize" in
12073 '')
12074         $echo $n "Checking to see how big your pointers are...$c" >&4
12075         if test "$voidflags" -gt 7; then
12076                 echo '#define VOID_PTR char *' > try.c
12077         else
12078                 echo '#define VOID_PTR void *' > try.c
12079         fi
12080         $cat >>try.c <<'EOCP'
12081 #include <stdio.h>
12082 int main()
12083 {
12084         printf("%d\n", sizeof(VOID_PTR));
12085         exit(0);
12086 }
12087 EOCP
12088         set try
12089         if eval $compile_ok; then
12090                 ptrsize=`./try`
12091                 $echo " $ptrsize bytes." >&4
12092         else
12093                 dflt='4'
12094                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12095                 rp="What is the size of a pointer (in bytes)?"
12096                 . ./myread
12097                 ptrsize="$ans"
12098         fi
12099         ;;
12100 esac
12101 $rm -f try.c try
12102
12103 : see if ar generates random libraries by itself
12104 echo " "
12105 echo "Checking how to generate random libraries on your machine..." >&4
12106 echo 'int bar1() { return bar2(); }' > bar1.c
12107 echo 'int bar2() { return 2; }' > bar2.c
12108 $cat > foo.c <<'EOP'
12109 int main() { printf("%d\n", bar1()); exit(0); }
12110 EOP
12111 $cc $ccflags -c bar1.c >/dev/null 2>&1
12112 $cc $ccflags -c bar2.c >/dev/null 2>&1
12113 $cc $ccflags -c foo.c >/dev/null 2>&1
12114 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12115 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12116         ./foobar >/dev/null 2>&1; then
12117         echo "$ar appears to generate random libraries itself."
12118         orderlib=false
12119         ranlib=":"
12120 elif $ar ts bar$_a >/dev/null 2>&1 &&
12121         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12122         ./foobar >/dev/null 2>&1; then
12123                 echo "a table of contents needs to be added with '$ar ts'."
12124                 orderlib=false
12125                 ranlib="$ar ts"
12126 else
12127         case "$ranlib" in
12128         :) ranlib='';;
12129         '')
12130                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12131                 $test -f $ranlib || ranlib=''
12132                 ;;
12133         esac
12134         if $test -n "$ranlib"; then
12135                 echo "your system has '$ranlib'; we'll use that."
12136                 orderlib=false
12137         else
12138                 echo "your system doesn't seem to support random libraries"
12139                 echo "so we'll use lorder and tsort to order the libraries."
12140                 orderlib=true
12141                 ranlib=":"
12142         fi
12143 fi
12144 $rm -f foo* bar* 
12145
12146 : check for type of arguments to select. 
12147 case "$selecttype" in
12148 '') case "$d_select" in
12149         $define)
12150                 $cat <<EOM
12151 Checking to see what type of arguments are accepted by select().
12152 EOM
12153                 hdrs="$define sys/types.h
12154                         $i_systime sys/time.h 
12155                         $i_sysselct sys/select.h
12156                         $d_socket sys/socket.h"
12157                 : The first arg can be int, unsigned, or size_t
12158                 : The last arg may or may not be 'const'
12159                 val=''
12160                 : void pointer has been seen but using that
12161                 : breaks the selectminbits test
12162                 for xxx in 'fd_set *' 'int *'; do
12163                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12164                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12165                                         case "$val" in
12166                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12167                                                 if ./protochk "$try" $hdrs; then
12168                                                         echo "Your system accepts $xxx."
12169                                                         val="$xxx"
12170                                                 fi
12171                                                 ;;
12172                                         esac
12173                                 done
12174                         done
12175                 done
12176                 case "$val" in
12177                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12178                         case "$d_fd_set" in
12179                                 $define) dflt="fd_set *" ;;
12180                                 *)              dflt="int *" ;;
12181                         esac
12182                         . ./myread
12183                         val=$ans
12184                         ;;
12185                 esac
12186                 selecttype="$val"
12187                 ;;
12188         *)      : no select, so pick a harmless default
12189                 selecttype='int *'
12190                 ;;
12191         esac
12192         ;;
12193 esac
12194
12195 : check for the select 'width'
12196 case "$selectminbits" in
12197 '') case "$d_select" in
12198         $define)
12199                 $cat <<EOM
12200
12201 Checking to see on how many bits at a time your select() operates...
12202 EOM
12203                 $cat >try.c <<EOCP
12204 #include <sys/types.h>
12205 #$i_time I_TIME
12206 #$i_systime I_SYS_TIME
12207 #$i_systimek I_SYS_TIME_KERNEL
12208 #ifdef I_TIME
12209 #   include <time.h>
12210 #endif
12211 #ifdef I_SYS_TIME
12212 #   ifdef I_SYS_TIME_KERNEL
12213 #       define KERNEL
12214 #   endif
12215 #   include <sys/time.h>
12216 #   ifdef I_SYS_TIME_KERNEL
12217 #       undef KERNEL
12218 #   endif
12219 #endif
12220 #$i_sysselct I_SYS_SELECT
12221 #ifdef I_SYS_SELECT
12222 #include <sys/select.h>
12223 #endif
12224 #$d_socket HAS_SOCKET
12225 #ifdef HAS_SOCKET
12226 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12227 #endif
12228 #include <stdio.h>
12229 $selecttype b;
12230 #define S sizeof(*(b))
12231 #define MINBITS 64
12232 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12233 #define NBITS  (NBYTES * 8)
12234 int main() {
12235     char s[NBYTES];
12236     struct timeval t;
12237     int i;
12238     FILE* fp;
12239     int fd;
12240
12241     fclose(stdin);
12242     fp = fopen("try.c", "r");
12243     if (fp == 0)
12244       exit(1);
12245     fd = fileno(fp);
12246     if (fd < 0)
12247       exit(2);
12248     b = ($selecttype)s;
12249     for (i = 0; i < NBITS; i++)
12250         FD_SET(i, b);
12251     t.tv_sec  = 0;
12252     t.tv_usec = 0;
12253     select(fd + 1, b, 0, 0, &t);
12254     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12255     printf("%d\n", i + 1);
12256     return 0;
12257 }
12258 EOCP
12259                 set try
12260                 if eval $compile_ok; then
12261                         selectminbits=`./try`
12262                         case "$selectminbits" in
12263                         '')     cat >&4 <<EOM
12264 Cannot figure out on how many bits at a time your select() operates.
12265 I'll play safe and guess it is 32 bits.
12266 EOM
12267                                 selectminbits=32
12268                                 bits="32 bits"
12269                                 ;;
12270                         1)      bits="1 bit" ;;
12271                         *)      bits="$selectminbits bits" ;;
12272                         esac
12273                         echo "Your select() operates on $bits at a time." >&4
12274                 else
12275                         rp='What is the minimum number of bits your select() operates on?'
12276                         case "$byteorder" in
12277                         1234|12345678)  dflt=32 ;;
12278                         *)              dflt=1  ;;
12279                         esac
12280                         . ./myread
12281                         val=$ans
12282                         selectminbits="$val"
12283                 fi
12284                 $rm -f try.* try
12285                 ;;
12286         *)      : no select, so pick a harmless default
12287                 selectminbits='32'
12288                 ;;
12289         esac
12290         ;;
12291 esac
12292
12293 : Trace out the files included by signal.h, then look for SIGxxx names.
12294 : Remove SIGARRAYSIZE used by HPUX.
12295 : Remove SIGSTKSIZE used by Linux.
12296 : Remove SIGSTKSZ used by Posix.
12297 : Remove SIGTYP void lines used by OS2.
12298 xxx=`echo '#include <signal.h>' |
12299         $cppstdin $cppminus $cppflags 2>/dev/null |
12300         $grep '^[       ]*#.*include' | 
12301         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12302 : Check this list of files to be sure we have parsed the cpp output ok.
12303 : This will also avoid potentially non-existent files, such 
12304 : as ../foo/bar.h
12305 xxxfiles=''
12306 for xx in $xxx /dev/null ; do
12307         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12308 done
12309 : If we have found no files, at least try signal.h
12310 case "$xxxfiles" in
12311 '')     xxxfiles=`./findhdr signal.h` ;;
12312 esac
12313 xxx=`awk '
12314 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12315         print substr($2, 4, 20)
12316 }
12317 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12318         print substr($3, 4, 20)
12319 }' $xxxfiles`
12320 : Append some common names just in case the awk scan failed.
12321 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12322 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12323 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12324 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12325 : generate a few handy files for later
12326 $cat > signal.c <<'EOCP'
12327 #include <sys/types.h>
12328 #include <signal.h>
12329 #include <stdio.h>
12330 int main() {
12331
12332 /* Strange style to avoid deeply-nested #if/#else/#endif */
12333 #ifndef NSIG
12334 #  ifdef _NSIG
12335 #    define NSIG (_NSIG)
12336 #  endif
12337 #endif
12338
12339 #ifndef NSIG
12340 #  ifdef SIGMAX
12341 #    define NSIG (SIGMAX+1)
12342 #  endif
12343 #endif
12344
12345 #ifndef NSIG
12346 #  ifdef SIG_MAX
12347 #    define NSIG (SIG_MAX+1)
12348 #  endif
12349 #endif
12350
12351 #ifndef NSIG
12352 #  ifdef MAXSIG
12353 #    define NSIG (MAXSIG+1)
12354 #  endif
12355 #endif
12356
12357 #ifndef NSIG
12358 #  ifdef MAX_SIG
12359 #    define NSIG (MAX_SIG+1)
12360 #  endif
12361 #endif
12362
12363 #ifndef NSIG
12364 #  ifdef SIGARRAYSIZE
12365 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12366 #  endif
12367 #endif
12368
12369 #ifndef NSIG
12370 #  ifdef _sys_nsig
12371 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12372 #  endif
12373 #endif
12374
12375 /* Default to some arbitrary number that's big enough to get most
12376    of the common signals.
12377 */
12378 #ifndef NSIG
12379 #    define NSIG 50
12380 #endif
12381
12382 printf("NSIG %d\n", NSIG);
12383
12384 #ifndef JUST_NSIG
12385
12386 EOCP
12387
12388 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12389 {
12390         printf "#ifdef SIG"; printf $1; printf "\n"
12391         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12392         printf $1; printf ");\n"
12393         printf "#endif\n"
12394 }
12395 END {
12396         printf "#endif /* JUST_NSIG */\n";
12397         printf "}\n";
12398 }
12399 ' >>signal.c
12400 $cat >signal.awk <<'EOP'
12401 BEGIN { ndups = 0 }
12402 $1 ~ /^NSIG$/ { nsig = $2 }
12403 ($1 !~ /^NSIG$/) && (NF == 2) {
12404     if ($2 > maxsig) { maxsig = $2 }
12405     if (sig_name[$2]) {
12406         dup_name[ndups] = $1
12407         dup_num[ndups] = $2
12408         ndups++ 
12409     }
12410     else {
12411         sig_name[$2] = $1
12412         sig_num[$2] = $2
12413     }
12414 }
12415 END { 
12416     if (nsig == 0) {
12417         nsig = maxsig + 1
12418     }
12419     printf("NSIG %d\n", nsig);
12420     for (n = 1; n < nsig; n++) {
12421         if (sig_name[n]) {
12422             printf("%s %d\n", sig_name[n], sig_num[n])
12423         }
12424         else {
12425             printf("NUM%d %d\n", n, n) 
12426         }
12427     }
12428     for (n = 0; n < ndups; n++) {
12429         printf("%s %d\n", dup_name[n], dup_num[n])
12430     }
12431 }
12432 EOP
12433 $cat >signal_cmd <<EOS
12434 $startsh
12435 if $test -s signal.lst; then
12436     echo "Using your existing signal.lst file"
12437         exit 0
12438 fi
12439 xxx="$xxx"
12440 EOS
12441 $cat >>signal_cmd <<'EOS'
12442
12443 set signal
12444 if eval $compile_ok; then
12445         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12446 else
12447         echo "(I can't seem be able to compile the whole test program)" >&4
12448         echo "(I'll try it in little pieces.)" >&4
12449         set signal -DJUST_NSIG
12450         if eval $compile_ok; then
12451                 ./signal$_exe > signal.nsg
12452                 $cat signal.nsg
12453         else
12454                 echo "I can't seem to figure out how many signals you have." >&4
12455                 echo "Guessing 50." >&4
12456                 echo 'NSIG 50' > signal.nsg
12457         fi
12458         : Now look at all the signal names, one at a time.
12459         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12460                 $cat > signal.c <<EOCP
12461 #include <sys/types.h>
12462 #include <signal.h>
12463 #include <stdio.h>
12464 int main() {
12465 printf("$xx %d\n", SIG${xx});
12466 return 0;
12467 }
12468 EOCP
12469                 set signal
12470                 if eval $compile; then
12471                         echo "SIG${xx} found."
12472                         ./signal$_exe  >> signal.ls1
12473                 else
12474                         echo "SIG${xx} NOT found."
12475                 fi
12476         done
12477         if $test -s signal.ls1; then
12478                 $cat signal.nsg signal.ls1 |
12479                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12480         fi
12481
12482 fi
12483 if $test -s signal.lst; then
12484         :
12485 else
12486         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12487         echo 'kill -l' >signal
12488         set X `csh -f <signal`
12489         $rm -f signal
12490         shift
12491         case $# in
12492         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12493         esac
12494         echo $@ | $tr ' ' $trnl | \
12495             $awk '{ printf "%s %d\n", $1, ++s; }
12496                   END { printf "NSIG %d\n", ++s }' >signal.lst
12497 fi
12498 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12499 EOS
12500 chmod a+x signal_cmd
12501 $eunicefix signal_cmd
12502
12503 : generate list of signal names
12504 echo " "
12505 case "$sig_name_init" in
12506 '') doinit=yes ;;
12507 *)  case "$sig_num_init" in
12508     ''|*,*) doinit=yes ;;
12509     esac ;;
12510 esac
12511 case "$doinit" in
12512 yes)
12513         echo "Generating a list of signal names and numbers..." >&4
12514         . ./signal_cmd
12515         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12516         sig_name=`$awk 'BEGIN { printf "ZERO " }
12517                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12518         sig_num=`$awk  'BEGIN { printf "0 " }
12519                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12520         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12521                              !/^NSIG/   { printf "\"%s\", ", $1 }
12522                              END        { printf "0\n" }' signal.lst`
12523         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12524                              !/^NSIG/   { printf "%d, ", $2}
12525                              END        { printf "0\n"}' signal.lst`
12526         ;;
12527 esac
12528 echo "The following $sig_count signals are available:"
12529 echo " "
12530 echo $sig_name | $awk \
12531 'BEGIN { linelen = 0 }
12532 {
12533         for (i = 1; i <= NF; i++) {
12534                 name = "SIG" $i " "
12535                 linelen = linelen + length(name)
12536                 if (linelen > 70) {
12537                         printf "\n"
12538                         linelen = length(name)
12539                 }
12540                 printf "%s", name
12541         }
12542         printf "\n"
12543 }'
12544 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12545
12546 : see what type is used for signed size_t
12547 set ssize_t ssizetype int stdio.h sys/types.h
12548 eval $typedef
12549 dflt="$ssizetype"
12550 $cat > ssize.c <<EOM
12551 #include <stdio.h>
12552 #include <sys/types.h>
12553 #define Size_t $sizetype
12554 #define SSize_t $dflt
12555 int main()
12556 {
12557         if (sizeof(Size_t) == sizeof(SSize_t))
12558                 printf("$dflt\n");
12559         else if (sizeof(Size_t) == sizeof(int))
12560                 printf("int\n");
12561         else 
12562                 printf("long\n");
12563         exit(0);
12564 }
12565 EOM
12566 echo " "
12567 set ssize
12568 if eval $compile_ok && ./ssize > /dev/null; then
12569         ssizetype=`./ssize`
12570         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12571 else
12572         $cat >&4 <<EOM
12573 Help! I can't compile and run the ssize_t test program: please enlighten me!
12574 (This is probably a misconfiguration in your system or libraries, and
12575 you really ought to fix it.  Still, I'll try anyway.)
12576
12577 I need a type that is the same size as $sizetype, but is guaranteed to
12578 be signed.  Common values are ssize_t, int and long.
12579
12580 EOM
12581         rp="What signed type is the same size as $sizetype?"
12582         . ./myread
12583         ssizetype="$ans"
12584 fi
12585 $rm -f ssize ssize.*
12586
12587 : see what type of char stdio uses.
12588 echo " "
12589 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12590         echo "Your stdio uses unsigned chars." >&4
12591         stdchar="unsigned char"
12592 else
12593         echo "Your stdio uses signed chars." >&4
12594         stdchar="char"
12595 fi
12596
12597 : see if time exists
12598 echo " "
12599 if test "X$d_time" = X -o X"$timetype" = X; then
12600     if set time val -f d_time; eval $csym; $val; then
12601                 echo 'time() found.' >&4
12602                 val="$define"
12603                 rp="What is the type returned by time() on this system?"
12604                 set time_t timetype long stdio.h sys/types.h
12605                 eval $typedef_ask
12606     else
12607                 echo 'time() not found, hope that will do.' >&4
12608                 val="$undef"
12609                 timetype='int';
12610     fi
12611     set d_time
12612     eval $setvar
12613 fi
12614
12615 : see what type uids are declared as in the kernel
12616 echo " "
12617 echo "Looking for the type for user ids returned by getuid()."
12618 set uid_t uidtype xxx stdio.h sys/types.h
12619 eval $typedef
12620 case "$uidtype" in
12621 xxx)
12622         xxx=`./findhdr sys/user.h`
12623         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12624         case $1 in
12625         unsigned) dflt="$1 $2" ;;
12626         *) dflt="$1" ;;
12627         esac
12628         ;;
12629 *) dflt="$uidtype";;
12630 esac
12631 case "$uidtype" in
12632 uid_t)  echo "uid_t found." ;;
12633 *)      rp="What is the type for user ids returned by getuid()?"
12634         . ./myread
12635         uidtype="$ans"
12636         ;;
12637 esac
12638
12639 echo " "
12640 case "$uidtype" in
12641 *_t) zzz="$uidtype"     ;;
12642 *)   zzz="uid"          ;;
12643 esac
12644 echo "Checking the sign of $zzz..." >&4
12645 cat > try.c <<EOCP
12646 #include <sys/types.h>
12647 #include <stdio.h>
12648 int main() {
12649         $uidtype foo = -1;
12650         if (foo < 0)
12651                 printf("-1\n");
12652         else
12653                 printf("1\n");
12654 }
12655 EOCP
12656 set try
12657 if eval $compile; then
12658         yyy=`./try`
12659         case "$yyy" in
12660         '')     uidsign=1
12661                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12662                 ;;
12663         *)      uidsign=$yyy
12664                 case "$uidsign" in
12665                  1) echo "Your $zzz is unsigned." ;;
12666                 -1) echo "Your $zzz is signed."   ;;
12667                 esac
12668                 ;;
12669         esac
12670 else
12671         uidsign=1
12672         echo "(I can't compile the test program--guessing unsigned.)" >&4
12673 fi
12674
12675
12676 : see if dbm.h is available
12677 : see if dbmclose exists
12678 set dbmclose d_dbmclose
12679 eval $inlibc
12680
12681 case "$d_dbmclose" in
12682 $define)
12683         set dbm.h i_dbm
12684         eval $inhdr
12685         case "$i_dbm" in
12686         $define)
12687                 val="$undef"
12688                 set i_rpcsvcdbm
12689                 eval $setvar
12690                 ;;
12691         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12692                 eval $inhdr
12693                 ;;
12694         esac
12695         ;;
12696 *)      echo "We won't be including <dbm.h>"
12697         val="$undef"
12698         set i_dbm
12699         eval $setvar
12700         val="$undef"
12701         set i_rpcsvcdbm
12702         eval $setvar
12703         ;;
12704 esac
12705
12706 : see if this is a sys/file.h system
12707 val=''
12708 set sys/file.h val
12709 eval $inhdr
12710
12711 : do we need to include sys/file.h ?
12712 case "$val" in
12713 "$define")
12714         echo " "
12715         if $h_sysfile; then
12716                 val="$define"
12717                 echo "We'll be including <sys/file.h>." >&4
12718         else
12719                 val="$undef"
12720                 echo "We won't be including <sys/file.h>." >&4
12721         fi
12722         ;;
12723 *)
12724         h_sysfile=false
12725         ;;
12726 esac
12727 set i_sysfile
12728 eval $setvar
12729
12730 : see if fcntl.h is there
12731 val=''
12732 set fcntl.h val
12733 eval $inhdr
12734
12735 : see if we can include fcntl.h
12736 case "$val" in
12737 "$define")
12738         echo " "
12739         if $h_fcntl; then
12740                 val="$define"
12741                 echo "We'll be including <fcntl.h>." >&4
12742         else
12743                 val="$undef"
12744                 if $h_sysfile; then
12745         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12746                 else
12747                         echo "We won't be including <fcntl.h>." >&4
12748                 fi
12749         fi
12750         ;;
12751 *)
12752         h_fcntl=false
12753         val="$undef"
12754         ;;
12755 esac
12756 set i_fcntl
12757 eval $setvar
12758
12759 : see if locale.h is available
12760 set locale.h i_locale
12761 eval $inhdr
12762
12763 : see if mach cthreads are available
12764 if test "X$usethreads" = "X$define"; then
12765         set mach/cthreads.h i_machcthr
12766         eval $inhdr
12767 else
12768         i_machcthr="$undef"
12769 fi
12770
12771
12772
12773 : see if this is a math.h system
12774 set math.h i_math
12775 eval $inhdr
12776
12777 : see if this is a mntent.h system
12778 set mntent.h i_mntent
12779 eval $inhdr
12780
12781 : see if ndbm.h is available
12782 set ndbm.h t_ndbm
12783 eval $inhdr
12784 case "$t_ndbm" in
12785 $define)
12786         : see if dbm_open exists
12787         set dbm_open d_dbm_open
12788         eval $inlibc
12789         case "$d_dbm_open" in
12790         $undef)
12791                 t_ndbm="$undef"
12792                 echo "We won't be including <ndbm.h>"
12793                 ;;
12794         esac
12795         ;;
12796 esac
12797 val="$t_ndbm"
12798 set i_ndbm
12799 eval $setvar
12800
12801 : see if net/errno.h is available
12802 val=''
12803 set net/errno.h val
12804 eval $inhdr
12805
12806 : Unfortunately, it causes problems on some systems.  Arrgh.
12807 case "$val" in
12808 $define)
12809         cat > try.c <<'EOM'
12810 #include <stdio.h>
12811 #include <errno.h>
12812 #include <net/errno.h>
12813 int func()
12814 {
12815         return ENOTSOCK;
12816 }
12817 EOM
12818         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12819                 echo "We'll be including <net/errno.h>." >&4
12820         else
12821                 echo "We won't be including <net/errno.h>." >&4
12822                 val="$undef"
12823         fi
12824         $rm -f try.* try
12825         ;;
12826 esac
12827 set i_neterrno
12828 eval $setvar
12829
12830 : see if netinet/tcp.h is available
12831 set netinet/tcp.h i_netinettcp
12832 eval $inhdr
12833
12834 : see if this is a poll.h system
12835 set poll.h i_poll
12836 eval $inhdr
12837
12838 : get C preprocessor symbols handy
12839 echo " "
12840 $echo $n "Hmm... $c"
12841 echo $al | $tr ' ' $trnl >Cppsym.know
12842 $cat <<EOSS >Cppsym
12843 $startsh
12844 case "\$1" in
12845 -l) list=true
12846         shift
12847         ;;
12848 esac
12849 unknown=''
12850 case "\$list\$#" in
12851 1|2)
12852         for sym do
12853                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12854                         exit 0
12855                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12856                         :
12857                 else
12858                         unknown="\$unknown \$sym"
12859                 fi
12860         done
12861         set X \$unknown
12862         shift
12863         ;;
12864 esac
12865 case \$# in
12866 0) exit 1;;
12867 esac
12868 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12869 #ifdef \1\\
12870 exit 0; _ _ _ _\1\\      \1\\
12871 #endif\\
12872 /' >Cppsym\$\$
12873 echo "exit 1; _ _ _" >>Cppsym\$\$
12874 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12875 case "\$list" in
12876 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12877 *)
12878         sh Cppsym2\$\$
12879         status=\$?
12880         ;;
12881 esac
12882 $rm -f Cppsym\$\$ Cppsym2\$\$
12883 exit \$status
12884 EOSS
12885 chmod +x Cppsym
12886 $eunicefix Cppsym
12887 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12888
12889 : now check the C compiler for additional symbols
12890 postprocess_cc_v=''
12891 case "$osname" in
12892 aix) postprocess_cc_v="|$tr , ' '" ;;
12893 esac
12894 $cat >ccsym <<EOS
12895 $startsh
12896 $cat >tmp.c <<EOF
12897 extern int foo;
12898 EOF
12899 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12900 do
12901         case "\$i" in
12902         -D*) echo "\$i" | $sed 's/^-D//';;
12903         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12904         esac
12905 done
12906 $rm -f try.c
12907 EOS
12908 postprocess_cc_v=''
12909 chmod +x ccsym
12910 $eunicefix ccsym
12911 ./ccsym > ccsym1.raw
12912 if $test -s ccsym1.raw; then
12913        $sort ccsym1.raw | $uniq >ccsym.raw
12914 else
12915        mv ccsym1.raw ccsym.raw
12916 fi
12917
12918 $awk '/\=/ { print $0; next }
12919         { print $0"=1" }' ccsym.raw >ccsym.list
12920 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12921 $comm -13 ccsym.true ccsym.list >ccsym.own
12922 $comm -12 ccsym.true ccsym.list >ccsym.com
12923 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12924 also=''
12925 if $test -z ccsym.raw; then
12926         echo "Your C compiler doesn't seem to define any symbols!" >&4
12927         echo " "
12928         echo "However, your C preprocessor defines the following symbols:"
12929         $cat Cppsym.true
12930         ccsymbols=''
12931         cppsymbols=`$cat Cppsym.true`
12932         cppsymbols=`echo $cppsymbols`
12933         cppccsymbols="$cppsymbols"
12934 else
12935         if $test -s ccsym.com; then
12936                 echo "Your C compiler and pre-processor define these symbols:"
12937                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12938                 also='also '
12939                 symbols='ones'
12940                 cppccsymbols=`$cat ccsym.com`
12941                 cppccsymbols=`echo $cppccsymbols`
12942                 $test "$silent" || sleep 1
12943         fi
12944         if $test -s ccsym.cpp; then
12945                 $test "$also" && echo " "
12946                 echo "Your C pre-processor ${also}defines the following symbols:"
12947                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12948                 also='further '
12949                 cppsymbols=`$cat ccsym.cpp`
12950                 cppsymbols=`echo $cppsymbols`
12951                 $test "$silent" || sleep 1
12952         fi
12953         if $test -s ccsym.own; then
12954                 $test "$also" && echo " "
12955                 echo "Your C compiler ${also}defines the following cpp symbols:"
12956                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12957                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12958                 ccsymbols=`$cat ccsym.own`
12959                 ccsymbols=`echo $ccsymbols`
12960                 $test "$silent" || sleep 1
12961         fi
12962 fi
12963 $rm -f ccsym*
12964
12965 : see if this is a termio system
12966 val="$undef"
12967 val2="$undef"
12968 val3="$undef"
12969 if $test `./findhdr termios.h`; then
12970         set tcsetattr i_termios
12971         eval $inlibc
12972         val3="$i_termios"
12973 fi
12974 echo " "
12975 case "$val3" in
12976 "$define") echo "You have POSIX termios.h... good!" >&4;;
12977 *) if ./Cppsym pyr; then
12978                 case "`/bin/universe`" in
12979                 ucb) if $test `./findhdr sgtty.h`; then
12980                                 val2="$define"
12981                                 echo "<sgtty.h> found." >&4
12982                         else
12983                                 echo "System is pyramid with BSD universe."
12984                                 echo "<sgtty.h> not found--you could have problems." >&4
12985                         fi;;
12986                 *) if $test `./findhdr termio.h`; then
12987                                 val="$define"
12988                                 echo "<termio.h> found." >&4
12989                         else
12990                                 echo "System is pyramid with USG universe."
12991                                 echo "<termio.h> not found--you could have problems." >&4
12992                         fi;;
12993                 esac
12994         elif ./usg; then
12995                 if $test `./findhdr termio.h`; then
12996                         echo "<termio.h> found." >&4
12997                         val="$define"
12998                 elif $test `./findhdr sgtty.h`; then
12999                         echo "<sgtty.h> found." >&4
13000                         val2="$define"
13001                 else
13002 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13003                 fi
13004         else
13005                 if $test `./findhdr sgtty.h`; then
13006                         echo "<sgtty.h> found." >&4
13007                         val2="$define"
13008                 elif $test `./findhdr termio.h`; then
13009                         echo "<termio.h> found." >&4
13010                         val="$define"
13011                 else
13012 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13013                 fi
13014         fi;;
13015 esac
13016 set i_termio; eval $setvar
13017 val=$val2; set i_sgtty; eval $setvar
13018 val=$val3; set i_termios; eval $setvar
13019
13020 : see if this is a shadow.h system
13021 set shadow.h i_shadow
13022 eval $inhdr
13023
13024 : see if this is a socks.h system
13025 set socks.h i_socks
13026 eval $inhdr
13027
13028 : see if stdarg is available
13029 echo " "
13030 if $test `./findhdr stdarg.h`; then
13031         echo "<stdarg.h> found." >&4
13032         valstd="$define"
13033 else
13034         echo "<stdarg.h> NOT found." >&4
13035         valstd="$undef"
13036 fi
13037
13038 : see if varags is available
13039 echo " "
13040 if $test `./findhdr varargs.h`; then
13041         echo "<varargs.h> found." >&4
13042 else
13043         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13044 fi
13045
13046 : set up the varargs testing programs
13047 $cat > varargs.c <<EOP
13048 #ifdef I_STDARG
13049 #include <stdarg.h>
13050 #endif
13051 #ifdef I_VARARGS
13052 #include <varargs.h>
13053 #endif
13054
13055 #ifdef I_STDARG
13056 int f(char *p, ...)
13057 #else
13058 int f(va_alist)
13059 va_dcl
13060 #endif
13061 {
13062         va_list ap;
13063 #ifndef I_STDARG
13064         char *p;
13065 #endif
13066 #ifdef I_STDARG
13067         va_start(ap,p);
13068 #else
13069         va_start(ap);
13070         p = va_arg(ap, char *);
13071 #endif
13072         va_end(ap);
13073 }
13074 EOP
13075 $cat > varargs <<EOP
13076 $startsh
13077 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13078         echo "true"
13079 else
13080         echo "false"
13081 fi
13082 $rm -f varargs$_o
13083 EOP
13084 chmod +x varargs
13085
13086 : now check which varargs header should be included
13087 echo " "
13088 i_varhdr=''
13089 case "$valstd" in
13090 "$define")
13091         if `./varargs I_STDARG`; then
13092                 val='stdarg.h'
13093         elif `./varargs I_VARARGS`; then
13094                 val='varargs.h'
13095         fi
13096         ;;
13097 *)
13098         if `./varargs I_VARARGS`; then
13099                 val='varargs.h'
13100         fi
13101         ;;
13102 esac
13103 case "$val" in
13104 '')
13105 echo "I could not find the definition for va_dcl... You have problems..." >&4
13106         val="$undef"; set i_stdarg; eval $setvar
13107         val="$undef"; set i_varargs; eval $setvar
13108         ;;
13109 *) 
13110         set i_varhdr
13111         eval $setvar
13112         case "$i_varhdr" in
13113         stdarg.h)
13114                 val="$define"; set i_stdarg; eval $setvar
13115                 val="$undef"; set i_varargs; eval $setvar
13116                 ;;
13117         varargs.h)
13118                 val="$undef"; set i_stdarg; eval $setvar
13119                 val="$define"; set i_varargs; eval $setvar
13120                 ;;
13121         esac
13122         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13123 esac
13124 $rm -f varargs*
13125
13126 : see if stddef is available
13127 set stddef.h i_stddef
13128 eval $inhdr
13129
13130 : see if sys/access.h is available
13131 set sys/access.h i_sysaccess
13132 eval $inhdr
13133
13134 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13135 set sys/filio.h i_sysfilio
13136 eval $inhdr
13137 echo " "
13138 if $test `./findhdr sys/ioctl.h`; then
13139         val="$define"
13140         echo '<sys/ioctl.h> found.' >&4
13141 else
13142         val="$undef"
13143         if $test $i_sysfilio = "$define"; then
13144             echo '<sys/ioctl.h> NOT found.' >&4
13145         else
13146                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13147                 $test $i_termio = "$define" && xxx="termio.h"
13148                 $test $i_termios = "$define" && xxx="termios.h"
13149 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13150         fi
13151 fi
13152 set i_sysioctl
13153 eval $setvar
13154
13155 : see if sys/resource.h has to be included
13156 set sys/resource.h i_sysresrc
13157 eval $inhdr
13158
13159 : see if sys/security.h is available
13160 set sys/security.h i_syssecrt
13161 eval $inhdr
13162
13163 : see if this is a sys/statvfs.h system
13164 set sys/statvfs.h i_sysstatvfs
13165 eval $inhdr
13166
13167 : see if this is a sys/un.h system
13168 set sys/un.h i_sysun
13169 eval $inhdr
13170
13171 : see if this is a syswait system
13172 set sys/wait.h i_syswait
13173 eval $inhdr
13174
13175 : see if this is a ustat.h system
13176 set ustat.h i_ustat
13177 eval $inhdr
13178
13179 : see if this is an utime system
13180 set utime.h i_utime
13181 eval $inhdr
13182
13183 : see if this is a values.h system
13184 set values.h i_values
13185 eval $inhdr
13186
13187 : see if this is a vfork system
13188 case "$d_vfork" in
13189 "$define")
13190         set vfork.h i_vfork
13191         eval $inhdr
13192         ;;
13193 *)
13194         i_vfork="$undef"
13195         ;;
13196 esac
13197
13198 : see if gdbm.h is available
13199 set gdbm.h t_gdbm
13200 eval $inhdr
13201 case "$t_gdbm" in
13202 $define)
13203         : see if gdbm_open exists
13204         set gdbm_open d_gdbm_open
13205         eval $inlibc
13206         case "$d_gdbm_open" in
13207         $undef)
13208                 t_gdbm="$undef"
13209                 echo "We won't be including <gdbm.h>"
13210                 ;;
13211         esac
13212         ;;
13213 esac
13214 val="$t_gdbm"
13215 set i_gdbm
13216 eval $setvar
13217
13218 echo " "
13219 echo "Looking for extensions..." >&4
13220 : If we are using the old config.sh, known_extensions may contain
13221 : old or inaccurate or duplicate values.
13222 known_extensions=''
13223 nonxs_extensions=''
13224 : We do not use find because it might not be available.
13225 : We do not just use MANIFEST because the user may have dropped
13226 : some additional extensions into the source tree and expect them
13227 : to be built.
13228
13229 : Function to recursively find available extensions, ignoring DynaLoader
13230 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13231 find_extensions='
13232     for xxx in *; do
13233        case "$xxx" in
13234            DynaLoader|dynaload) ;;
13235            *)
13236            if $test -f $xxx/$xxx.xs; then
13237                known_extensions="$known_extensions $1$xxx";
13238            elif $test -f $xxx/Makefile.PL; then
13239                nonxs_extensions="$nonxs_extensions $1$xxx";
13240            else
13241                if $test -d $xxx -a $# -lt 10; then
13242                    set $1$xxx/ $*;
13243                    cd $xxx;
13244                    eval $find_extensions;
13245                    cd ..;
13246                    shift;
13247                fi;
13248            fi
13249            ;;
13250        esac;
13251     done'
13252 tdir=`pwd`
13253 cd $rsrc/ext
13254 set X
13255 shift
13256 eval $find_extensions
13257 set X $nonxs_extensions
13258 shift
13259 nonxs_extensions="$*"
13260 set X $known_extensions
13261 shift
13262 known_extensions="$*"
13263 cd $tdir
13264
13265 : Now see which are supported on this system.
13266 avail_ext=''
13267 for xxx in $known_extensions ; do
13268         case "$xxx" in
13269         DB_File|db_file)
13270                 case "$i_db" in
13271                 $define) avail_ext="$avail_ext $xxx" ;;
13272                 esac
13273                 ;;
13274         GDBM_File|gdbm_fil)
13275                 case "$i_gdbm" in 
13276                 $define) avail_ext="$avail_ext $xxx" ;;
13277                 esac
13278                 ;;
13279         NDBM_File|ndbm_fil)
13280                 case "$i_ndbm" in
13281                 $define) avail_ext="$avail_ext $xxx" ;;
13282                 esac
13283                 ;;
13284         ODBM_File|odbm_fil) 
13285                 case "${i_dbm}${i_rpcsvcdbm}" in
13286                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13287                 esac
13288                 ;;
13289         POSIX|posix)
13290                 case "$useposix" in
13291                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13292                 esac
13293                 ;;
13294         Opcode|opcode)
13295                 case "$useopcode" in
13296                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13297                 esac
13298                 ;;
13299         Socket|socket)
13300                 case "$d_socket" in 
13301                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13302                 esac
13303                 ;;
13304         Thread|thread)
13305                 case "$usethreads" in 
13306                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13307                 esac
13308                 ;;
13309         IPC/SysV|ipc/sysv)
13310                 : XXX Do we need a useipcsysv variable here
13311                 case "${d_msg}${d_sem}${d_shm}" in 
13312                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13313                 esac
13314                 ;;
13315         *)      avail_ext="$avail_ext $xxx"
13316                 ;;
13317         esac
13318 done
13319
13320 set X $avail_ext
13321 shift
13322 avail_ext="$*"
13323
13324 : Now see which nonxs extensions are supported on this system.
13325 : For now assume all are.
13326 nonxs_ext=''
13327 for xxx in $nonxs_extensions ; do
13328         case "$xxx" in
13329         *)      nonxs_ext="$nonxs_ext $xxx"
13330                 ;;
13331         esac
13332 done
13333
13334 set X $nonxs_ext
13335 shift
13336 nonxs_ext="$*"
13337
13338 case $usedl in
13339 $define)
13340         $cat <<EOM
13341 A number of extensions are supplied with $package.  You may choose to
13342 compile these extensions for dynamic loading (the default), compile
13343 them into the $package executable (static loading), or not include
13344 them at all.  Answer "none" to include no extensions.
13345 Note that DynaLoader is always built and need not be mentioned here.
13346
13347 EOM
13348         case "$dynamic_ext" in
13349         '') dflt="$avail_ext" ;;
13350         *)      dflt="$dynamic_ext"
13351                 # Perhaps we are reusing an old out-of-date config.sh.
13352                 case "$hint" in
13353                 previous)
13354                         if test X"$dynamic_ext" != X"$avail_ext"; then
13355                                 $cat <<EOM
13356 NOTICE:  Your previous config.sh list may be incorrect. 
13357 The extensions now available to you are 
13358         ${avail_ext}
13359 but the default list from your previous config.sh is
13360         ${dynamic_ext} 
13361
13362 EOM
13363                         fi
13364                         ;;
13365                 esac
13366                 ;;
13367         esac
13368         case "$dflt" in
13369         '')     dflt=none;;
13370         esac
13371         rp="What extensions do you wish to load dynamically?"
13372         . ./myread
13373         case "$ans" in
13374         none) dynamic_ext=' ' ;;
13375         *) dynamic_ext="$ans" ;;
13376         esac
13377
13378         case "$static_ext" in
13379         '')
13380                 : Exclude those already listed in dynamic linking
13381                 dflt=''
13382                 for xxx in $avail_ext; do
13383                         case " $dynamic_ext " in
13384                         *" $xxx "*) ;;
13385                         *) dflt="$dflt $xxx" ;;
13386                         esac
13387                 done
13388                 set X $dflt
13389                 shift
13390                 dflt="$*"
13391                 ;;
13392         *)  dflt="$static_ext" 
13393                 ;;
13394         esac
13395
13396         case "$dflt" in
13397         '')     dflt=none;;
13398         esac
13399         rp="What extensions do you wish to load statically?"
13400         . ./myread
13401         case "$ans" in
13402         none) static_ext=' ' ;;
13403         *) static_ext="$ans" ;;
13404         esac
13405         ;;
13406 *)
13407         $cat <<EOM
13408 A number of extensions are supplied with $package.  Answer "none" 
13409 to include no extensions. 
13410 Note that DynaLoader is always built and need not be mentioned here.
13411
13412 EOM
13413         case "$static_ext" in
13414         '') dflt="$avail_ext" ;;
13415         *)      dflt="$static_ext"
13416                 # Perhaps we are reusing an old out-of-date config.sh.
13417                 case "$hint" in
13418                 previous)
13419                         if test X"$static_ext" != X"$avail_ext"; then
13420                                 $cat <<EOM
13421 NOTICE:  Your previous config.sh list may be incorrect. 
13422 The extensions now available to you are 
13423         ${avail_ext}
13424 but the default list from your previous config.sh is
13425         ${static_ext} 
13426
13427 EOM
13428                         fi
13429                         ;;
13430                 esac
13431                 ;;
13432         esac
13433         : Exclude those that are not xs extensions
13434         case "$dflt" in
13435         '')     dflt=none;;
13436         esac
13437         rp="What extensions do you wish to include?"
13438         . ./myread
13439         case "$ans" in
13440         none) static_ext=' ' ;;
13441         *) static_ext="$ans" ;;
13442         esac
13443         ;;
13444 esac
13445
13446 set X $dynamic_ext $static_ext $nonxs_ext
13447 shift
13448 extensions="$*"
13449
13450 : Remove build directory name from cppstdin so it can be used from
13451 : either the present location or the final installed location.
13452 echo " "
13453 : Get out of the UU directory to get correct path name.
13454 cd ..
13455 case "$cppstdin" in
13456 `pwd`/cppstdin)
13457         echo "Stripping down cppstdin path name"
13458         cppstdin=cppstdin
13459         ;;
13460 esac
13461 cd UU
13462
13463 : end of configuration questions
13464 echo " "
13465 echo "End of configuration questions."
13466 echo " "
13467
13468 : back to where it started
13469 if test -d ../UU; then
13470         cd ..
13471 fi
13472
13473 : configuration may be patched via a 'config.over' file
13474 if $test -f config.over; then
13475         echo " "
13476         dflt=y
13477         rp='I see a config.over file.  Do you wish to load it?'
13478         . UU/myread
13479         case "$ans" in
13480         n*) echo "OK, I'll ignore it.";;
13481         *)      . ./config.over
13482                 echo "Configuration override changes have been loaded."
13483                 ;;
13484         esac
13485 fi
13486
13487 : in case they want portability, strip down executable paths
13488 case "$d_portable" in
13489 "$define")
13490         echo " "
13491         echo "Stripping down executable paths..." >&4
13492         for file in $loclist $trylist; do
13493                 eval temp=\$$file
13494                 eval $file=`basename $temp`
13495         done
13496         ;;
13497 esac
13498
13499 : create config.sh file
13500 echo " "
13501 echo "Creating config.sh..." >&4
13502 $spitshell <<EOT >config.sh
13503 $startsh
13504 #
13505 # This file was produced by running the Configure script. It holds all the
13506 # definitions figured out by Configure. Should you modify one of these values,
13507 # do not forget to propagate your changes by running "Configure -der". You may
13508 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13509 #
13510
13511 # Package name      : $package
13512 # Source directory  : $src
13513 # Configuration time: $cf_time
13514 # Configured by     : $cf_by
13515 # Target system     : $myuname
13516
13517 Author='$Author'
13518 Date='$Date'
13519 Header='$Header'
13520 Id='$Id'
13521 Locker='$Locker'
13522 Log='$Log'
13523 Mcc='$Mcc'
13524 RCSfile='$RCSfile'
13525 Revision='$Revision'
13526 Source='$Source'
13527 State='$State'
13528 _a='$_a'
13529 _exe='$_exe'
13530 _o='$_o'
13531 afs='$afs'
13532 alignbytes='$alignbytes'
13533 ansi2knr='$ansi2knr'
13534 aphostname='$aphostname'
13535 apiversion='$apiversion'
13536 ar='$ar'
13537 archlib='$archlib'
13538 archlibexp='$archlibexp'
13539 archname64='$archname64'
13540 archname='$archname'
13541 archobjs='$archobjs'
13542 awk='$awk'
13543 baserev='$baserev'
13544 bash='$bash'
13545 bin='$bin'
13546 bincompat5005='$bincompat5005'
13547 binexp='$binexp'
13548 bison='$bison'
13549 byacc='$byacc'
13550 byteorder='$byteorder'
13551 c='$c'
13552 castflags='$castflags'
13553 cat='$cat'
13554 cc='$cc'
13555 cccdlflags='$cccdlflags'
13556 ccdlflags='$ccdlflags'
13557 ccflags='$ccflags'
13558 ccsymbols='$ccsymbols'
13559 cf_by='$cf_by'
13560 cf_email='$cf_email'
13561 cf_time='$cf_time'
13562 chgrp='$chgrp'
13563 chmod='$chmod'
13564 chown='$chown'
13565 clocktype='$clocktype'
13566 comm='$comm'
13567 compress='$compress'
13568 contains='$contains'
13569 cp='$cp'
13570 cpio='$cpio'
13571 cpp='$cpp'
13572 cpp_stuff='$cpp_stuff'
13573 cppccsymbols='$cppccsymbols'
13574 cppflags='$cppflags'
13575 cpplast='$cpplast'
13576 cppminus='$cppminus'
13577 cpprun='$cpprun'
13578 cppstdin='$cppstdin'
13579 cppsymbols='$cppsymbols'
13580 crosscompile='$crosscompile'
13581 cryptlib='$cryptlib'
13582 csh='$csh'
13583 d_Gconvert='$d_Gconvert'
13584 d_PRIEldbl='$d_PRIEldbl'
13585 d_PRIFldbl='$d_PRIFldbl'
13586 d_PRIGldbl='$d_PRIGldbl'
13587 d_PRIX64='$d_PRIX64'
13588 d_PRId64='$d_PRId64'
13589 d_PRIeldbl='$d_PRIeldbl'
13590 d_PRIfldbl='$d_PRIfldbl'
13591 d_PRIgldbl='$d_PRIgldbl'
13592 d_PRIi64='$d_PRIi64'
13593 d_PRIo64='$d_PRIo64'
13594 d_PRIu64='$d_PRIu64'
13595 d_PRIx64='$d_PRIx64'
13596 d_access='$d_access'
13597 d_accessx='$d_accessx'
13598 d_alarm='$d_alarm'
13599 d_archlib='$d_archlib'
13600 d_atolf='$d_atolf'
13601 d_atoll='$d_atoll'
13602 d_attribut='$d_attribut'
13603 d_bcmp='$d_bcmp'
13604 d_bcopy='$d_bcopy'
13605 d_bincompat5005='$d_bincompat5005'
13606 d_bsd='$d_bsd'
13607 d_bsdgetpgrp='$d_bsdgetpgrp'
13608 d_bsdsetpgrp='$d_bsdsetpgrp'
13609 d_bzero='$d_bzero'
13610 d_casti32='$d_casti32'
13611 d_castneg='$d_castneg'
13612 d_charvspr='$d_charvspr'
13613 d_chown='$d_chown'
13614 d_chroot='$d_chroot'
13615 d_chsize='$d_chsize'
13616 d_closedir='$d_closedir'
13617 d_cmsghdr_s='$d_cmsghdr_s'
13618 d_const='$d_const'
13619 d_crypt='$d_crypt'
13620 d_csh='$d_csh'
13621 d_cuserid='$d_cuserid'
13622 d_dbl_dig='$d_dbl_dig'
13623 d_difftime='$d_difftime'
13624 d_dirnamlen='$d_dirnamlen'
13625 d_dlerror='$d_dlerror'
13626 d_dlopen='$d_dlopen'
13627 d_dlsymun='$d_dlsymun'
13628 d_dosuid='$d_dosuid'
13629 d_drand48proto='$d_drand48proto'
13630 d_dup2='$d_dup2'
13631 d_eaccess='$d_eaccess'
13632 d_endgrent='$d_endgrent'
13633 d_endhent='$d_endhent'
13634 d_endnent='$d_endnent'
13635 d_endpent='$d_endpent'
13636 d_endpwent='$d_endpwent'
13637 d_endsent='$d_endsent'
13638 d_endspent='$d_endspent'
13639 d_eofnblk='$d_eofnblk'
13640 d_eunice='$d_eunice'
13641 d_fchmod='$d_fchmod'
13642 d_fchown='$d_fchown'
13643 d_fcntl='$d_fcntl'
13644 d_fd_macros='$d_fd_macros'
13645 d_fd_set='$d_fd_set'
13646 d_fds_bits='$d_fds_bits'
13647 d_fgetpos='$d_fgetpos'
13648 d_flexfnam='$d_flexfnam'
13649 d_flock='$d_flock'
13650 d_fork='$d_fork'
13651 d_fpathconf='$d_fpathconf'
13652 d_fpos64_t='$d_fpos64_t'
13653 d_fs_data_s='$d_fs_data_s'
13654 d_fseeko='$d_fseeko'
13655 d_fsetpos='$d_fsetpos'
13656 d_fstatfs='$d_fstatfs'
13657 d_fstatvfs='$d_fstatvfs'
13658 d_ftello='$d_ftello'
13659 d_ftime='$d_ftime'
13660 d_getgrent='$d_getgrent'
13661 d_getgrps='$d_getgrps'
13662 d_gethbyaddr='$d_gethbyaddr'
13663 d_gethbyname='$d_gethbyname'
13664 d_gethent='$d_gethent'
13665 d_gethname='$d_gethname'
13666 d_gethostprotos='$d_gethostprotos'
13667 d_getlogin='$d_getlogin'
13668 d_getmntent='$d_getmntent'
13669 d_getnbyaddr='$d_getnbyaddr'
13670 d_getnbyname='$d_getnbyname'
13671 d_getnent='$d_getnent'
13672 d_getnetprotos='$d_getnetprotos'
13673 d_getpbyname='$d_getpbyname'
13674 d_getpbynumber='$d_getpbynumber'
13675 d_getpent='$d_getpent'
13676 d_getpgid='$d_getpgid'
13677 d_getpgrp2='$d_getpgrp2'
13678 d_getpgrp='$d_getpgrp'
13679 d_getppid='$d_getppid'
13680 d_getprior='$d_getprior'
13681 d_getprotoprotos='$d_getprotoprotos'
13682 d_getpwent='$d_getpwent'
13683 d_getsbyname='$d_getsbyname'
13684 d_getsbyport='$d_getsbyport'
13685 d_getsent='$d_getsent'
13686 d_getservprotos='$d_getservprotos'
13687 d_getspent='$d_getspent'
13688 d_getspnam='$d_getspnam'
13689 d_gettimeod='$d_gettimeod'
13690 d_gnulibc='$d_gnulibc'
13691 d_grpasswd='$d_grpasswd'
13692 d_hasmntopt='$d_hasmntopt'
13693 d_htonl='$d_htonl'
13694 d_index='$d_index'
13695 d_inetaton='$d_inetaton'
13696 d_int64t='$d_int64t'
13697 d_iovec_s='$d_iovec_s'
13698 d_isascii='$d_isascii'
13699 d_killpg='$d_killpg'
13700 d_lchown='$d_lchown'
13701 d_ldbl_dig='$d_ldbl_dig'
13702 d_link='$d_link'
13703 d_llseek='$d_llseek'
13704 d_locconv='$d_locconv'
13705 d_lockf='$d_lockf'
13706 d_longdbl='$d_longdbl'
13707 d_longlong='$d_longlong'
13708 d_lstat='$d_lstat'
13709 d_madvise='$d_madvise'
13710 d_mblen='$d_mblen'
13711 d_mbstowcs='$d_mbstowcs'
13712 d_mbtowc='$d_mbtowc'
13713 d_memchr='$d_memchr'
13714 d_memcmp='$d_memcmp'
13715 d_memcpy='$d_memcpy'
13716 d_memmove='$d_memmove'
13717 d_memset='$d_memset'
13718 d_mkdir='$d_mkdir'
13719 d_mkfifo='$d_mkfifo'
13720 d_mktime='$d_mktime'
13721 d_mmap='$d_mmap'
13722 d_mprotect='$d_mprotect'
13723 d_msg='$d_msg'
13724 d_msg_ctrunc='$d_msg_ctrunc'
13725 d_msg_dontroute='$d_msg_dontroute'
13726 d_msg_oob='$d_msg_oob'
13727 d_msg_peek='$d_msg_peek'
13728 d_msg_proxy='$d_msg_proxy'
13729 d_msgctl='$d_msgctl'
13730 d_msgget='$d_msgget'
13731 d_msghdr_s='$d_msghdr_s'
13732 d_msgrcv='$d_msgrcv'
13733 d_msgsnd='$d_msgsnd'
13734 d_msync='$d_msync'
13735 d_munmap='$d_munmap'
13736 d_mymalloc='$d_mymalloc'
13737 d_nice='$d_nice'
13738 d_off64_t='$d_off64_t'
13739 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13740 d_oldpthreads='$d_oldpthreads'
13741 d_oldsock='$d_oldsock'
13742 d_open3='$d_open3'
13743 d_pathconf='$d_pathconf'
13744 d_pause='$d_pause'
13745 d_phostname='$d_phostname'
13746 d_pipe='$d_pipe'
13747 d_poll='$d_poll'
13748 d_portable='$d_portable'
13749 d_pthread_yield='$d_pthread_yield'
13750 d_pwage='$d_pwage'
13751 d_pwchange='$d_pwchange'
13752 d_pwclass='$d_pwclass'
13753 d_pwcomment='$d_pwcomment'
13754 d_pwexpire='$d_pwexpire'
13755 d_pwgecos='$d_pwgecos'
13756 d_pwpasswd='$d_pwpasswd'
13757 d_pwquota='$d_pwquota'
13758 d_readdir='$d_readdir'
13759 d_readlink='$d_readlink'
13760 d_readv='$d_readv'
13761 d_recvmsg='$d_recvmsg'
13762 d_rename='$d_rename'
13763 d_rewinddir='$d_rewinddir'
13764 d_rmdir='$d_rmdir'
13765 d_safebcpy='$d_safebcpy'
13766 d_safemcpy='$d_safemcpy'
13767 d_sanemcmp='$d_sanemcmp'
13768 d_sched_yield='$d_sched_yield'
13769 d_scm_rights='$d_scm_rights'
13770 d_seekdir='$d_seekdir'
13771 d_select='$d_select'
13772 d_sem='$d_sem'
13773 d_semctl='$d_semctl'
13774 d_semctl_semid_ds='$d_semctl_semid_ds'
13775 d_semctl_semun='$d_semctl_semun'
13776 d_semget='$d_semget'
13777 d_semop='$d_semop'
13778 d_sendmsg='$d_sendmsg'
13779 d_setegid='$d_setegid'
13780 d_seteuid='$d_seteuid'
13781 d_setgrent='$d_setgrent'
13782 d_setgrps='$d_setgrps'
13783 d_sethent='$d_sethent'
13784 d_setlinebuf='$d_setlinebuf'
13785 d_setlocale='$d_setlocale'
13786 d_setnent='$d_setnent'
13787 d_setpent='$d_setpent'
13788 d_setpgid='$d_setpgid'
13789 d_setpgrp2='$d_setpgrp2'
13790 d_setpgrp='$d_setpgrp'
13791 d_setprior='$d_setprior'
13792 d_setpwent='$d_setpwent'
13793 d_setregid='$d_setregid'
13794 d_setresgid='$d_setresgid'
13795 d_setresuid='$d_setresuid'
13796 d_setreuid='$d_setreuid'
13797 d_setrgid='$d_setrgid'
13798 d_setruid='$d_setruid'
13799 d_setsent='$d_setsent'
13800 d_setsid='$d_setsid'
13801 d_setspent='$d_setspent'
13802 d_setvbuf='$d_setvbuf'
13803 d_sfio='$d_sfio'
13804 d_shm='$d_shm'
13805 d_shmat='$d_shmat'
13806 d_shmatprototype='$d_shmatprototype'
13807 d_shmctl='$d_shmctl'
13808 d_shmdt='$d_shmdt'
13809 d_shmget='$d_shmget'
13810 d_sigaction='$d_sigaction'
13811 d_sigsetjmp='$d_sigsetjmp'
13812 d_socket='$d_socket'
13813 d_sockpair='$d_sockpair'
13814 d_sqrtl='$d_sqrtl'
13815 d_statblks='$d_statblks'
13816 d_statfs='$d_statfs'
13817 d_statfs_f_flags='$d_statfs_f_flags'
13818 d_statfs_s='$d_statfs_s'
13819 d_statvfs='$d_statvfs'
13820 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13821 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13822 d_stdio_stream_array='$d_stdio_stream_array'
13823 d_stdiobase='$d_stdiobase'
13824 d_stdstdio='$d_stdstdio'
13825 d_strchr='$d_strchr'
13826 d_strcoll='$d_strcoll'
13827 d_strctcpy='$d_strctcpy'
13828 d_strerrm='$d_strerrm'
13829 d_strerror='$d_strerror'
13830 d_strtod='$d_strtod'
13831 d_strtol='$d_strtol'
13832 d_strtoul='$d_strtoul'
13833 d_strtoull='$d_strtoull'
13834 d_strxfrm='$d_strxfrm'
13835 d_suidsafe='$d_suidsafe'
13836 d_symlink='$d_symlink'
13837 d_syscall='$d_syscall'
13838 d_sysconf='$d_sysconf'
13839 d_sysernlst='$d_sysernlst'
13840 d_syserrlst='$d_syserrlst'
13841 d_system='$d_system'
13842 d_tcgetpgrp='$d_tcgetpgrp'
13843 d_tcsetpgrp='$d_tcsetpgrp'
13844 d_telldir='$d_telldir'
13845 d_telldirproto='$d_telldirproto'
13846 d_time='$d_time'
13847 d_times='$d_times'
13848 d_truncate='$d_truncate'
13849 d_tzname='$d_tzname'
13850 d_umask='$d_umask'
13851 d_uname='$d_uname'
13852 d_union_semun='$d_union_semun'
13853 d_ustat='$d_ustat'
13854 d_vendorbin='$d_vendorbin'
13855 d_vendorlib='$d_vendorlib'
13856 d_vfork='$d_vfork'
13857 d_void_closedir='$d_void_closedir'
13858 d_voidsig='$d_voidsig'
13859 d_voidtty='$d_voidtty'
13860 d_volatile='$d_volatile'
13861 d_vprintf='$d_vprintf'
13862 d_wait4='$d_wait4'
13863 d_waitpid='$d_waitpid'
13864 d_wcstombs='$d_wcstombs'
13865 d_wctomb='$d_wctomb'
13866 d_writev='$d_writev'
13867 d_xenix='$d_xenix'
13868 date='$date'
13869 db_hashtype='$db_hashtype'
13870 db_prefixtype='$db_prefixtype'
13871 defvoidused='$defvoidused'
13872 direntrytype='$direntrytype'
13873 dlext='$dlext'
13874 dlsrc='$dlsrc'
13875 doublesize='$doublesize'
13876 drand01='$drand01'
13877 dynamic_ext='$dynamic_ext'
13878 eagain='$eagain'
13879 ebcdic='$ebcdic'
13880 echo='$echo'
13881 egrep='$egrep'
13882 emacs='$emacs'
13883 eunicefix='$eunicefix'
13884 exe_ext='$exe_ext'
13885 expr='$expr'
13886 extensions='$extensions'
13887 fflushNULL='$fflushNULL'
13888 fflushall='$fflushall'
13889 find='$find'
13890 firstmakefile='$firstmakefile'
13891 flex='$flex'
13892 fpostype='$fpostype'
13893 freetype='$freetype'
13894 full_ar='$full_ar'
13895 full_csh='$full_csh'
13896 full_sed='$full_sed'
13897 gccversion='$gccversion'
13898 gidtype='$gidtype'
13899 glibpth='$glibpth'
13900 grep='$grep'
13901 groupcat='$groupcat'
13902 groupstype='$groupstype'
13903 gzip='$gzip'
13904 h_fcntl='$h_fcntl'
13905 h_sysfile='$h_sysfile'
13906 hint='$hint'
13907 hostcat='$hostcat'
13908 huge='$huge'
13909 i_arpainet='$i_arpainet'
13910 i_bsdioctl='$i_bsdioctl'
13911 i_db='$i_db'
13912 i_dbm='$i_dbm'
13913 i_dirent='$i_dirent'
13914 i_dld='$i_dld'
13915 i_dlfcn='$i_dlfcn'
13916 i_fcntl='$i_fcntl'
13917 i_float='$i_float'
13918 i_gdbm='$i_gdbm'
13919 i_grp='$i_grp'
13920 i_inttypes='$i_inttypes'
13921 i_limits='$i_limits'
13922 i_locale='$i_locale'
13923 i_machcthr='$i_machcthr'
13924 i_malloc='$i_malloc'
13925 i_math='$i_math'
13926 i_memory='$i_memory'
13927 i_mntent='$i_mntent'
13928 i_ndbm='$i_ndbm'
13929 i_netdb='$i_netdb'
13930 i_neterrno='$i_neterrno'
13931 i_netinettcp='$i_netinettcp'
13932 i_niin='$i_niin'
13933 i_poll='$i_poll'
13934 i_pthread='$i_pthread'
13935 i_pwd='$i_pwd'
13936 i_rpcsvcdbm='$i_rpcsvcdbm'
13937 i_sfio='$i_sfio'
13938 i_sgtty='$i_sgtty'
13939 i_shadow='$i_shadow'
13940 i_socks='$i_socks'
13941 i_stdarg='$i_stdarg'
13942 i_stddef='$i_stddef'
13943 i_stdlib='$i_stdlib'
13944 i_string='$i_string'
13945 i_sysaccess='$i_sysaccess'
13946 i_sysdir='$i_sysdir'
13947 i_sysfile='$i_sysfile'
13948 i_sysfilio='$i_sysfilio'
13949 i_sysin='$i_sysin'
13950 i_sysioctl='$i_sysioctl'
13951 i_sysmman='$i_sysmman'
13952 i_sysmount='$i_sysmount'
13953 i_sysndir='$i_sysndir'
13954 i_sysparam='$i_sysparam'
13955 i_sysresrc='$i_sysresrc'
13956 i_syssecrt='$i_syssecrt'
13957 i_sysselct='$i_sysselct'
13958 i_syssockio='$i_syssockio'
13959 i_sysstat='$i_sysstat'
13960 i_sysstatfs='$i_sysstatfs'
13961 i_sysstatvfs='$i_sysstatvfs'
13962 i_systime='$i_systime'
13963 i_systimek='$i_systimek'
13964 i_systimes='$i_systimes'
13965 i_systypes='$i_systypes'
13966 i_sysuio='$i_sysuio'
13967 i_sysun='$i_sysun'
13968 i_sysvfs='$i_sysvfs'
13969 i_syswait='$i_syswait'
13970 i_termio='$i_termio'
13971 i_termios='$i_termios'
13972 i_time='$i_time'
13973 i_unistd='$i_unistd'
13974 i_ustat='$i_ustat'
13975 i_utime='$i_utime'
13976 i_values='$i_values'
13977 i_varargs='$i_varargs'
13978 i_varhdr='$i_varhdr'
13979 i_vfork='$i_vfork'
13980 ignore_versioned_solibs='$ignore_versioned_solibs'
13981 incpath='$incpath'
13982 inews='$inews'
13983 installarchlib='$installarchlib'
13984 installbin='$installbin'
13985 installman1dir='$installman1dir'
13986 installman3dir='$installman3dir'
13987 installprefix='$installprefix'
13988 installprefixexp='$installprefixexp'
13989 installprivlib='$installprivlib'
13990 installscript='$installscript'
13991 installsitearch='$installsitearch'
13992 installsitebin='$installsitebin'
13993 installsitelib='$installsitelib'
13994 installstyle='$installstyle'
13995 installusrbinperl='$installusrbinperl'
13996 installvendorbin='$installvendorbin'
13997 installvendorlib='$installvendorlib'
13998 intsize='$intsize'
13999 known_extensions='$known_extensions'
14000 ksh='$ksh'
14001 large='$large'
14002 ld='$ld'
14003 lddlflags='$lddlflags'
14004 ldflags='$ldflags'
14005 ldlibpthname='$ldlibpthname'
14006 less='$less'
14007 lib_ext='$lib_ext'
14008 libc='$libc'
14009 libperl='$libperl'
14010 libpth='$libpth'
14011 libs='$libs'
14012 libswanted='$libswanted'
14013 line='$line'
14014 lint='$lint'
14015 lkflags='$lkflags'
14016 ln='$ln'
14017 lns='$lns'
14018 locincpth='$locincpth'
14019 loclibpth='$loclibpth'
14020 longdblsize='$longdblsize'
14021 longlongsize='$longlongsize'
14022 longsize='$longsize'
14023 lp='$lp'
14024 lpr='$lpr'
14025 ls='$ls'
14026 lseeksize='$lseeksize'
14027 lseektype='$lseektype'
14028 mail='$mail'
14029 mailx='$mailx'
14030 make='$make'
14031 make_set_make='$make_set_make'
14032 mallocobj='$mallocobj'
14033 mallocsrc='$mallocsrc'
14034 malloctype='$malloctype'
14035 man1dir='$man1dir'
14036 man1direxp='$man1direxp'
14037 man1ext='$man1ext'
14038 man3dir='$man3dir'
14039 man3direxp='$man3direxp'
14040 man3ext='$man3ext'
14041 medium='$medium'
14042 mips_type='$mips_type'
14043 mkdir='$mkdir'
14044 mmaptype='$mmaptype'
14045 models='$models'
14046 modetype='$modetype'
14047 more='$more'
14048 multiarch='$multiarch'
14049 mv='$mv'
14050 myarchname='$myarchname'
14051 mydomain='$mydomain'
14052 myhostname='$myhostname'
14053 myuname='$myuname'
14054 n='$n'
14055 netdb_hlen_type='$netdb_hlen_type'
14056 netdb_host_type='$netdb_host_type'
14057 netdb_name_type='$netdb_name_type'
14058 netdb_net_type='$netdb_net_type'
14059 nm='$nm'
14060 nm_opt='$nm_opt'
14061 nm_so_opt='$nm_so_opt'
14062 nonxs_ext='$nonxs_ext'
14063 nroff='$nroff'
14064 o_nonblock='$o_nonblock'
14065 obj_ext='$obj_ext'
14066 old_pthread_create_joinable='$old_pthread_create_joinable'
14067 optimize='$optimize'
14068 orderlib='$orderlib'
14069 osname='$osname'
14070 osvers='$osvers'
14071 package='$package'
14072 pager='$pager'
14073 passcat='$passcat'
14074 patchlevel='$patchlevel'
14075 path_sep='$path_sep'
14076 perl='$perl'
14077 perladmin='$perladmin'
14078 perlpath='$perlpath'
14079 pg='$pg'
14080 phostname='$phostname'
14081 pidtype='$pidtype'
14082 plibpth='$plibpth'
14083 pm_apiversion='$pm_apiversion'
14084 pmake='$pmake'
14085 pr='$pr'
14086 prefix='$prefix'
14087 prefixexp='$prefixexp'
14088 privlib='$privlib'
14089 privlibexp='$privlibexp'
14090 prototype='$prototype'
14091 ptrsize='$ptrsize'
14092 randbits='$randbits'
14093 randfunc='$randfunc'
14094 randseedtype='$randseedtype'
14095 ranlib='$ranlib'
14096 rd_nodata='$rd_nodata'
14097 rm='$rm'
14098 rmail='$rmail'
14099 runnm='$runnm'
14100 sPRIEldbl='$sPRIEldbl'
14101 sPRIFldbl='$sPRIFldbl'
14102 sPRIGldbl='$sPRIGldbl'
14103 sPRIX64='$sPRIX64'
14104 sPRId64='$sPRId64'
14105 sPRIeldbl='$sPRIeldbl'
14106 sPRIfldbl='$sPRIfldbl'
14107 sPRIgldbl='$sPRIgldbl'
14108 sPRIi64='$sPRIi64'
14109 sPRIo64='$sPRIo64'
14110 sPRIu64='$sPRIu64'
14111 sPRIx64='$sPRIx64'
14112 sched_yield='$sched_yield'
14113 scriptdir='$scriptdir'
14114 scriptdirexp='$scriptdirexp'
14115 sed='$sed'
14116 seedfunc='$seedfunc'
14117 selectminbits='$selectminbits'
14118 selecttype='$selecttype'
14119 sendmail='$sendmail'
14120 sh='$sh'
14121 shar='$shar'
14122 sharpbang='$sharpbang'
14123 shmattype='$shmattype'
14124 shortsize='$shortsize'
14125 shrpenv='$shrpenv'
14126 shsharp='$shsharp'
14127 sig_count='$sig_count'
14128 sig_name='$sig_name'
14129 sig_name_init='$sig_name_init'
14130 sig_num='$sig_num'
14131 sig_num_init='$sig_num_init'
14132 signal_t='$signal_t'
14133 sitearch='$sitearch'
14134 sitearchexp='$sitearchexp'
14135 sitebin='$sitebin'
14136 sitebinexp='$sitebinexp'
14137 sitelib='$sitelib'
14138 sitelibexp='$sitelibexp'
14139 siteprefix='$siteprefix'
14140 siteprefixexp='$siteprefixexp'
14141 sizetype='$sizetype'
14142 sleep='$sleep'
14143 smail='$smail'
14144 small='$small'
14145 so='$so'
14146 sockethdr='$sockethdr'
14147 socketlib='$socketlib'
14148 sort='$sort'
14149 spackage='$spackage'
14150 spitshell='$spitshell'
14151 split='$split'
14152 src='$src'
14153 ssizetype='$ssizetype'
14154 startperl='$startperl'
14155 startsh='$startsh'
14156 static_ext='$static_ext'
14157 stdchar='$stdchar'
14158 stdio_base='$stdio_base'
14159 stdio_bufsiz='$stdio_bufsiz'
14160 stdio_cnt='$stdio_cnt'
14161 stdio_filbuf='$stdio_filbuf'
14162 stdio_ptr='$stdio_ptr'
14163 stdio_stream_array='$stdio_stream_array'
14164 strings='$strings'
14165 submit='$submit'
14166 subversion='$subversion'
14167 sysman='$sysman'
14168 tail='$tail'
14169 tar='$tar'
14170 tbl='$tbl'
14171 tee='$tee'
14172 test='$test'
14173 timeincl='$timeincl'
14174 timetype='$timetype'
14175 touch='$touch'
14176 tr='$tr'
14177 trnl='$trnl'
14178 troff='$troff'
14179 uidsign='$uidsign'
14180 uidtype='$uidtype'
14181 uname='$uname'
14182 uniq='$uniq'
14183 use64bits='$use64bits'
14184 usedl='$usedl'
14185 uselargefiles='$uselargefiles'
14186 uselongdouble='$uselongdouble'
14187 usemorebits='$usemorebits'
14188 usemultiplicity='$usemultiplicity'
14189 usemymalloc='$usemymalloc'
14190 usenm='$usenm'
14191 useopcode='$useopcode'
14192 useperlio='$useperlio'
14193 useposix='$useposix'
14194 usesfio='$usesfio'
14195 useshrplib='$useshrplib'
14196 usesocks='$usesocks'
14197 usethreads='$usethreads'
14198 usevendorprefix='$usevendorprefix'
14199 usevfork='$usevfork'
14200 usrinc='$usrinc'
14201 uuname='$uuname'
14202 vendorbin='$vendorbin'
14203 vendorbinexp='$vendorbinexp'
14204 vendorlib='$vendorlib'
14205 vendorlibexp='$vendorlibexp'
14206 vendorprefix='$vendorprefix'
14207 vendorprefixexp='$vendorprefixexp'
14208 version='$version'
14209 vi='$vi'
14210 voidflags='$voidflags'
14211 xlibpth='$xlibpth'
14212 xs_apiversion='$xs_apiversion'
14213 zcat='$zcat'
14214 zip='$zip'
14215 EOT
14216
14217 : Add in command line options if available
14218 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14219
14220 : add special variables
14221 $test -f $src/patchlevel.h && \
14222 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14223 echo "CONFIGDOTSH=true" >>config.sh
14224
14225 : propagate old symbols
14226 if $test -f UU/config.sh; then
14227         <UU/config.sh sort | uniq >UU/oldconfig.sh
14228         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14229         sort | uniq -u >UU/oldsyms
14230         set X `cat UU/oldsyms`
14231         shift
14232         case $# in
14233         0) ;;
14234         *)
14235                 cat <<EOM
14236 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14237 EOM
14238                 echo "# Variables propagated from previous config.sh file." >>config.sh
14239                 for sym in `cat UU/oldsyms`; do
14240                         echo "    Propagating $hint variable "'$'"$sym..."
14241                         eval 'tmp="$'"${sym}"'"'
14242                         echo "$tmp" | \
14243                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14244                 done
14245                 ;;
14246         esac
14247 fi
14248
14249 : Finish up by extracting the .SH files
14250 case "$alldone" in
14251 exit)
14252         $rm -rf UU
14253         echo "Done."
14254         exit 0
14255         ;;
14256 cont)
14257         ;;
14258 '')
14259         dflt=''
14260         nostick=true
14261         $cat <<EOM
14262
14263 If you'd like to make any changes to the config.sh file before I begin
14264 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14265
14266 EOM
14267         rp="Press return or use a shell escape to edit config.sh:"
14268         . UU/myread
14269         nostick=''
14270         case "$ans" in
14271         '') ;;
14272         *) : in case they cannot read
14273                 sh 1>&4 -c "$ans";;
14274         esac
14275         ;;
14276 esac
14277
14278 : if this fails, just run all the .SH files by hand
14279 . ./config.sh
14280
14281 echo " "
14282 exec 1>&4
14283 . ./UU/extract
14284
14285 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14286         dflt=y
14287         case "$silent" in
14288         true) ;;
14289         *)
14290                 $cat <<EOM
14291
14292 Now you need to generate make dependencies by running "$make depend".
14293 You might prefer to run it in background: "$make depend > makedepend.out &"
14294 It can take a while, so you might not want to run it right now.
14295
14296 EOM
14297                 ;;
14298         esac
14299         rp="Run $make depend now?"
14300         . UU/myread
14301         case "$ans" in
14302         y*)
14303                 $make depend && echo "Now you must run a $make."
14304                 ;;
14305         *)
14306                 echo "You must run '$make depend' then '$make'."
14307                 ;;
14308         esac
14309 elif test -f [Mm]akefile; then
14310         echo " "
14311         echo "Now you must run a $make."
14312 else
14313         echo "Done."
14314 fi
14315
14316 if $test -f Policy.sh; then
14317     $cat <<EOM
14318
14319 If you compile $package on a different machine or from a different object
14320 directory, copy the Policy.sh file from this object directory to the
14321 new one before you run Configure -- this will help you with most of
14322 the policy defaults.
14323
14324 EOM
14325 fi
14326 if $test -f config.msg; then
14327     echo "Hmm.  I also noted the following information while running:"
14328     echo " "
14329     $cat config.msg >&4
14330     $rm -f config.msg
14331 fi
14332 $rm -f kit*isdone ark*isdone
14333 $rm -rf UU
14334
14335 : End of Configure
14336