72bab7c6f3523640efa22fb27b5cf7ae3196b996
[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 20:27:00 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_fs_data_s=''
357 d_fseeko=''
358 d_fsetpos=''
359 d_fstatfs=''
360 d_ftello=''
361 d_ftime=''
362 d_gettimeod=''
363 d_Gconvert=''
364 d_getgrent=''
365 d_getgrps=''
366 d_gethbyaddr=''
367 d_gethbyname=''
368 d_gethent=''
369 aphostname=''
370 d_gethname=''
371 d_phostname=''
372 d_uname=''
373 d_gethostprotos=''
374 d_getlogin=''
375 d_getmnt=''
376 d_getmntent=''
377 d_getnbyaddr=''
378 d_getnbyname=''
379 d_getnent=''
380 d_getnetprotos=''
381 d_getpent=''
382 d_getpgid=''
383 d_getpgrp2=''
384 d_bsdgetpgrp=''
385 d_getpgrp=''
386 d_getppid=''
387 d_getprior=''
388 d_getpbyname=''
389 d_getpbynumber=''
390 d_getprotoprotos=''
391 d_getpwent=''
392 d_getsent=''
393 d_getservprotos=''
394 d_getspent=''
395 d_getspnam=''
396 d_getsbyname=''
397 d_getsbyport=''
398 d_gnulibc=''
399 d_hasmntopt=''
400 d_htonl=''
401 d_inetaton=''
402 d_isascii=''
403 d_killpg=''
404 d_lchown=''
405 d_ldbl_dig=''
406 d_link=''
407 d_locconv=''
408 d_lockf=''
409 d_longdbl=''
410 longdblsize=''
411 d_longlong=''
412 longlongsize=''
413 d_lstat=''
414 d_madvise=''
415 d_mblen=''
416 d_mbstowcs=''
417 d_mbtowc=''
418 d_memchr=''
419 d_memcmp=''
420 d_memcpy=''
421 d_memmove=''
422 d_memset=''
423 d_mkdir=''
424 d_mkfifo=''
425 d_mktime=''
426 d_mmap=''
427 mmaptype=''
428 d_mprotect=''
429 d_msg=''
430 d_msgctl=''
431 d_msgget=''
432 d_msgrcv=''
433 d_msgsnd=''
434 d_msync=''
435 d_munmap=''
436 d_nice=''
437 d_open3=''
438 d_fpathconf=''
439 d_pathconf=''
440 d_pause=''
441 d_pipe=''
442 d_poll=''
443 d_portable=''
444 d_old_pthread_create_joinable=''
445 old_pthread_create_joinable=''
446 d_pthread_yield=''
447 d_sched_yield=''
448 sched_yield=''
449 d_readdir=''
450 d_rewinddir=''
451 d_seekdir=''
452 d_telldir=''
453 d_readlink=''
454 d_readv=''
455 d_rename=''
456 d_rmdir=''
457 d_safebcpy=''
458 d_safemcpy=''
459 d_sanemcmp=''
460 d_select=''
461 d_sem=''
462 d_semctl=''
463 d_semget=''
464 d_semop=''
465 d_setegid=''
466 d_seteuid=''
467 d_setgrent=''
468 d_setgrps=''
469 d_sethent=''
470 d_setlinebuf=''
471 d_setlocale=''
472 d_setnent=''
473 d_setpent=''
474 d_setpgid=''
475 d_setpgrp2=''
476 d_bsdsetpgrp=''
477 d_setpgrp=''
478 d_setprior=''
479 d_setpwent=''
480 d_setregid=''
481 d_setresgid=''
482 d_setresuid=''
483 d_setreuid=''
484 d_setrgid=''
485 d_setruid=''
486 d_setsent=''
487 d_setsid=''
488 d_setspent=''
489 d_setvbuf=''
490 d_sfio=''
491 usesfio=''
492 d_shm=''
493 d_shmat=''
494 d_shmatprototype=''
495 shmattype=''
496 d_shmctl=''
497 d_shmdt=''
498 d_shmget=''
499 d_sigaction=''
500 d_sigsetjmp=''
501 d_cmsghdr_s=''
502 d_msg_ctrunc=''
503 d_msg_dontroute=''
504 d_msg_oob=''
505 d_msg_peek=''
506 d_msg_proxy=''
507 d_msghdr_s=''
508 d_oldsock=''
509 d_recvmsg=''
510 d_scm_rights=''
511 d_sendmsg=''
512 d_socket=''
513 d_sockpair=''
514 sockethdr=''
515 socketlib=''
516 d_sqrtl=''
517 d_statblks=''
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
8704 echo " "
8705 echo "Checking to see if your system supports struct fs_data..." >&4
8706 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8707 eval $hasstruct
8708 case "$d_fs_data_s" in
8709 "$define")      echo "Yup, it does."     >&4 ;;
8710 *)              echo "Nope, it doesn't." >&4 ;;
8711 esac
8712
8713 : see if fseeko exists
8714 set fseeko d_fseeko
8715 eval $inlibc
8716
8717 : see if fsetpos exists
8718 set fsetpos d_fsetpos
8719 eval $inlibc
8720
8721
8722 : see if fstatfs exists
8723 set fstatfs d_fstatfs
8724 eval $inlibc
8725
8726
8727 : see if statvfs exists
8728 set statvfs d_statvfs
8729 eval $inlibc
8730
8731 : see if fstatvfs exists
8732 set fstatvfs d_fstatvfs
8733 eval $inlibc
8734
8735
8736 : see if ftello exists
8737 set ftello d_ftello
8738 eval $inlibc
8739
8740 : see if getgrent exists
8741 set getgrent d_getgrent
8742 eval $inlibc
8743
8744 : see if gethostbyaddr exists
8745 set gethostbyaddr d_gethbyaddr
8746 eval $inlibc
8747
8748 : see if gethostbyname exists
8749 set gethostbyname d_gethbyname
8750 eval $inlibc
8751
8752 : see if gethostent exists
8753 set gethostent d_gethent
8754 eval $inlibc
8755
8756 : see how we will look up host name
8757 echo " "
8758 call=''
8759 if set gethostname val -f d_gethname; eval $csym; $val; then
8760         echo 'gethostname() found.' >&4
8761         d_gethname="$define"
8762         call=gethostname
8763 fi
8764 if set uname val -f d_uname; eval $csym; $val; then
8765         if ./xenix; then
8766                 $cat <<'EOM'
8767 uname() was found, but you're running xenix, and older versions of xenix
8768 have a broken uname(). If you don't really know whether your xenix is old
8769 enough to have a broken system call, use the default answer.
8770
8771 EOM
8772                 dflt=y
8773                 case "$d_uname" in
8774                 "$define") dflt=n;;
8775                 esac
8776                 rp='Is your uname() broken?'
8777                 . ./myread
8778                 case "$ans" in
8779                 n*) d_uname="$define"; call=uname;;
8780                 esac
8781         else
8782                 echo 'uname() found.' >&4
8783                 d_uname="$define"
8784                 case "$call" in
8785                 '') call=uname ;;
8786                 esac
8787         fi
8788 fi
8789 case "$d_gethname" in
8790 '') d_gethname="$undef";;
8791 esac
8792 case "$d_uname" in
8793 '') d_uname="$undef";;
8794 esac
8795 case "$d_uname$d_gethname" in
8796 *define*)
8797         dflt=n
8798         cat <<EOM
8799  
8800 Every now and then someone has a $call() that lies about the hostname
8801 but can't be fixed for political or economic reasons.  If you wish, I can
8802 pretend $call() isn't there and maybe compute hostname at run-time
8803 thanks to the '$phostname' command.
8804
8805 EOM
8806         rp="Shall I ignore $call() from now on?"
8807         . ./myread
8808         case "$ans" in
8809         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8810         esac;;
8811 esac
8812 case "$phostname" in
8813 '') aphostname='';;
8814 *) case "$aphostname" in
8815         /*) ;;
8816         *) set X $phostname
8817                 shift
8818                 file=$1
8819                 shift
8820                 file=`./loc $file $file $pth`
8821                 aphostname=`echo $file $*`
8822                 ;;
8823         esac
8824         ;;
8825 esac
8826 case "$d_uname$d_gethname" in
8827 *define*) ;;
8828 *)
8829         case "$phostname" in
8830         '')
8831                 echo "There will be no way for $package to get your hostname." >&4;;
8832         *)
8833         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8834                 ;;
8835         esac;;
8836 esac
8837 case "$d_phostname" in
8838 '') d_phostname="$undef";;
8839 esac
8840
8841 : see if this is a netdb.h system
8842 set netdb.h i_netdb
8843 eval $inhdr
8844
8845 : see if prototypes for various gethostxxx netdb.h functions are available
8846 echo " "
8847 set d_gethostprotos gethostent $i_netdb netdb.h
8848 eval $hasproto
8849
8850 : see if getlogin exists
8851 set getlogin d_getlogin
8852 eval $inlibc
8853
8854 : see if getmnt exists
8855 set getmnt d_getmnt
8856 eval $inlibc
8857
8858 : see if getmntent exists
8859 set getmntent d_getmntent
8860 eval $inlibc
8861
8862 : see if getnetbyaddr exists
8863 set getnetbyaddr d_getnbyaddr
8864 eval $inlibc
8865
8866 : see if getnetbyname exists
8867 set getnetbyname d_getnbyname
8868 eval $inlibc
8869
8870 : see if getnetent exists
8871 set getnetent d_getnent
8872 eval $inlibc
8873
8874 : see if prototypes for various getnetxxx netdb.h functions are available
8875 echo " "
8876 set d_getnetprotos getnetent $i_netdb netdb.h
8877 eval $hasproto
8878
8879
8880 : see if getprotobyname exists
8881 set getprotobyname d_getpbyname
8882 eval $inlibc
8883
8884 : see if getprotobynumber exists
8885 set getprotobynumber d_getpbynumber
8886 eval $inlibc
8887
8888 : see if getprotoent exists
8889 set getprotoent d_getpent
8890 eval $inlibc
8891
8892 : see if getpgid exists
8893 set getpgid d_getpgid
8894 eval $inlibc
8895
8896 : see if getpgrp2 exists
8897 set getpgrp2 d_getpgrp2
8898 eval $inlibc
8899
8900 : see if getppid exists
8901 set getppid d_getppid
8902 eval $inlibc
8903
8904 : see if getpriority exists
8905 set getpriority d_getprior
8906 eval $inlibc
8907
8908 : see if prototypes for various getprotoxxx netdb.h functions are available
8909 echo " "
8910 set d_getprotoprotos getprotoent $i_netdb netdb.h
8911 eval $hasproto
8912
8913 : see if getpwent exists
8914 set getpwent d_getpwent
8915 eval $inlibc
8916
8917
8918 : see if getservbyname exists
8919 set getservbyname d_getsbyname
8920 eval $inlibc
8921
8922 : see if getservbyport exists
8923 set getservbyport d_getsbyport
8924 eval $inlibc
8925
8926 : see if getservent exists
8927 set getservent d_getsent
8928 eval $inlibc
8929
8930 : see if prototypes for various getservxxx netdb.h functions are available
8931 echo " "
8932 set d_getservprotos getservent $i_netdb netdb.h
8933 eval $hasproto
8934
8935 : see if getspent exists
8936 set getspent d_getspent
8937 eval $inlibc
8938
8939 : see if getspnam exists
8940 set getspnam d_getspnam
8941 eval $inlibc
8942
8943 : see if gettimeofday or ftime exists
8944 set gettimeofday d_gettimeod
8945 eval $inlibc
8946 case "$d_gettimeod" in
8947 "$undef")
8948         set ftime d_ftime 
8949         eval $inlibc
8950         ;;
8951 *)
8952         val="$undef"; set d_ftime; eval $setvar
8953         ;;
8954 esac
8955 case "$d_gettimeod$d_ftime" in
8956 "$undef$undef")
8957         echo " "
8958         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8959         ;;
8960 esac
8961
8962 : see if this is an grp system
8963 set grp.h i_grp
8964 eval $inhdr
8965
8966 case "$i_grp" in
8967 $define)
8968         xxx=`./findhdr grp.h`
8969         $cppstdin $cppflags $cppminus < $xxx >$$.h
8970
8971         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8972                 val="$define"
8973         else
8974                 val="$undef"
8975         fi
8976         set d_grpasswd
8977         eval $setvar
8978
8979         $rm -f $$.h
8980         ;;
8981 *)
8982         val="$undef";
8983         set d_grpasswd; eval $setvar
8984         ;;
8985 esac
8986
8987 : see if hasmntopt exists
8988 set hasmntopt d_hasmntopt
8989 eval $inlibc
8990
8991 : see if this is a netinet/in.h or sys/in.h system
8992 set netinet/in.h i_niin sys/in.h i_sysin
8993 eval $inhdr
8994
8995 : see if arpa/inet.h has to be included
8996 set arpa/inet.h i_arpainet
8997 eval $inhdr
8998
8999 : see if htonl --and friends-- exists
9000 val=''
9001 set htonl val
9002 eval $inlibc
9003
9004 : Maybe they are macros.
9005 case "$val" in
9006 $undef)
9007         $cat >htonl.c <<EOM
9008 #include <stdio.h>
9009 #include <sys/types.h>
9010 #$i_niin I_NETINET_IN
9011 #$i_sysin I_SYS_IN
9012 #$i_arpainet I_ARPA_INET
9013 #ifdef I_NETINET_IN
9014 #include <netinet/in.h>
9015 #endif
9016 #ifdef I_SYS_IN
9017 #include <sys/in.h>
9018 #endif
9019 #ifdef I_ARPA_INET
9020 #include <arpa/inet.h>
9021 #endif
9022 #ifdef htonl
9023 printf("Defined as a macro.");
9024 #endif
9025 EOM
9026         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9027         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9028                 val="$define"
9029                 echo "But it seems to be defined as a macro." >&4
9030         fi
9031         $rm -f htonl.?
9032         ;;
9033 esac
9034 set d_htonl
9035 eval $setvar
9036
9037 : see which of string.h or strings.h is needed
9038 echo " "
9039 strings=`./findhdr string.h`
9040 if $test "$strings" && $test -r "$strings"; then
9041         echo "Using <string.h> instead of <strings.h>." >&4
9042         val="$define"
9043 else
9044         val="$undef"
9045         strings=`./findhdr strings.h`
9046         if $test "$strings" && $test -r "$strings"; then
9047                 echo "Using <strings.h> instead of <string.h>." >&4
9048         else
9049                 echo "No string header found -- You'll surely have problems." >&4
9050         fi
9051 fi
9052 set i_string
9053 eval $setvar
9054 case "$i_string" in
9055 "$undef") strings=`./findhdr strings.h`;;
9056 *)        strings=`./findhdr string.h`;;
9057 esac
9058
9059 : index or strchr
9060 echo " "
9061 if set index val -f; eval $csym; $val; then
9062         if set strchr val -f d_strchr; eval $csym; $val; then
9063                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9064                         val="$define"
9065                         vali="$undef"
9066                         echo "strchr() found." >&4
9067                 else
9068                         val="$undef"
9069                         vali="$define"
9070                         echo "index() found." >&4
9071                 fi
9072         else
9073                 val="$undef"
9074                 vali="$define"
9075                 echo "index() found." >&4
9076         fi
9077 else
9078         if set strchr val -f d_strchr; eval $csym; $val; then
9079                 val="$define"
9080                 vali="$undef"
9081                 echo "strchr() found." >&4
9082         else
9083                 echo "No index() or strchr() found!" >&4
9084                 val="$undef"
9085                 vali="$undef"
9086         fi
9087 fi
9088 set d_strchr; eval $setvar
9089 val="$vali"
9090 set d_index; eval $setvar
9091
9092 : check whether inet_aton exists
9093 set inet_aton d_inetaton
9094 eval $inlibc
9095
9096 : Look for isascii
9097 echo " "
9098 $cat >isascii.c <<'EOCP'
9099 #include <stdio.h>
9100 #include <ctype.h>
9101 int main() {
9102         int c = 'A';
9103         if (isascii(c))
9104                 exit(0);
9105         else
9106                 exit(1);
9107 }
9108 EOCP
9109 set isascii
9110 if eval $compile; then
9111         echo "isascii() found." >&4
9112         val="$define"
9113 else
9114         echo "isascii() NOT found." >&4
9115         val="$undef"
9116 fi
9117 set d_isascii
9118 eval $setvar
9119 $rm -f isascii*
9120
9121 : see if killpg exists
9122 set killpg d_killpg
9123 eval $inlibc
9124
9125 : see if lchown exists
9126 echo " "
9127 $cat > try.c <<'EOCP'
9128 /* System header to define __stub macros and hopefully few prototypes,
9129     which can conflict with char lchown(); below.  */
9130 #include <assert.h>
9131 /* Override any gcc2 internal prototype to avoid an error.  */
9132 /* We use char because int might match the return type of a gcc2
9133    builtin and then its argument prototype would still apply.  */
9134 char lchown();
9135 int main() {
9136     /*  The GNU C library defines this for functions which it implements
9137         to always fail with ENOSYS.  Some functions are actually named
9138         something starting with __ and the normal name is an alias.  */
9139 #if defined (__stub_lchown) || defined (__stub___lchown)
9140 choke me
9141 #else
9142 lchown();
9143 #endif
9144 ; return 0; }
9145 EOCP
9146 set try
9147 if eval $compile; then
9148     $echo "lchown() found." >&4
9149     val="$define"
9150 else
9151     $echo "lchown() NOT found." >&4
9152     val="$undef"
9153 fi
9154 set d_lchown
9155 eval $setvar
9156
9157 : See if number of significant digits in a double precision number is known
9158 echo " "
9159 $cat >ldbl_dig.c <<EOM
9160 #$i_limits I_LIMITS
9161 #$i_float I_FLOAT
9162 #ifdef I_LIMITS
9163 #include <limits.h>
9164 #endif
9165 #ifdef I_FLOAT
9166 #include <float.h>
9167 #endif
9168 #ifdef LDBL_DIG
9169 printf("Contains LDBL_DIG");
9170 #endif
9171 EOM
9172 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9173 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9174         echo "LDBL_DIG found." >&4
9175         val="$define"
9176 else
9177         echo "LDBL_DIG NOT found." >&4
9178         val="$undef"
9179 fi
9180 $rm -f ldbl_dig.?
9181 set d_ldbl_dig
9182 eval $setvar
9183
9184 : see if link exists
9185 set link d_link
9186 eval $inlibc
9187
9188 : see if localeconv exists
9189 set localeconv d_locconv
9190 eval $inlibc
9191
9192 : see if lockf exists
9193 set lockf d_lockf
9194 eval $inlibc
9195
9196 : see if lstat exists
9197 set lstat d_lstat
9198 eval $inlibc
9199
9200 : see if madvise exists
9201 set madvise d_madvise
9202 eval $inlibc
9203
9204 : see if mblen exists
9205 set mblen d_mblen
9206 eval $inlibc
9207
9208 : see if mbstowcs exists
9209 set mbstowcs d_mbstowcs
9210 eval $inlibc
9211
9212 : see if mbtowc exists
9213 set mbtowc d_mbtowc
9214 eval $inlibc
9215
9216 : see if memchr exists
9217 set memchr d_memchr
9218 eval $inlibc
9219
9220 : see if memcmp exists
9221 set memcmp d_memcmp
9222 eval $inlibc
9223
9224 : see if memcpy exists
9225 set memcpy d_memcpy
9226 eval $inlibc
9227
9228 : see if memmove exists
9229 set memmove d_memmove
9230 eval $inlibc
9231
9232 : see if memset exists
9233 set memset d_memset
9234 eval $inlibc
9235
9236 : see if mkdir exists
9237 set mkdir d_mkdir
9238 eval $inlibc
9239
9240 : see if mkfifo exists
9241 set mkfifo d_mkfifo
9242 eval $inlibc
9243
9244 : see if mktime exists
9245 set mktime d_mktime
9246 eval $inlibc
9247
9248 : see if this is a sys/mman.h system
9249 set sys/mman.h i_sysmman
9250 eval $inhdr
9251
9252 : see if mmap exists
9253 set mmap d_mmap
9254 eval $inlibc
9255 : see what shmat returns
9256 : default to something harmless
9257 mmaptype='void *'
9258 case "$i_sysmman$d_mmap" in
9259 "$define$define")
9260         $cat >mmap.c <<'END'
9261 #include <sys/mman.h>
9262 void *mmap();
9263 END
9264         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9265                 mmaptype='void *'
9266         else
9267                 mmaptype='caddr_t'
9268         fi
9269         echo "and it returns ($mmaptype)." >&4
9270         ;;
9271 esac
9272
9273
9274
9275 : see if mprotect exists
9276 set mprotect d_mprotect
9277 eval $inlibc
9278
9279 : see if msgctl exists
9280 set msgctl d_msgctl
9281 eval $inlibc
9282
9283 : see if msgget exists
9284 set msgget d_msgget
9285 eval $inlibc
9286
9287 : see if msgsnd exists
9288 set msgsnd d_msgsnd
9289 eval $inlibc
9290
9291 : see if msgrcv exists
9292 set msgrcv d_msgrcv
9293 eval $inlibc
9294
9295 : see how much of the 'msg*(2)' library is present.
9296 h_msg=true
9297 echo " "
9298 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9299 *"$undef"*) h_msg=false;;
9300 esac
9301 case "$osname" in
9302 freebsd)
9303     case "`ipcs 2>&1`" in
9304     "SVID messages"*"not configured"*)
9305         echo "Your $osname does not have the msg*(2) configured." >&4
9306         h_msg=false
9307         val="$undef"
9308         set msgctl d_msgctl
9309         eval $setvar
9310         set msgget d_msgget
9311         eval $setvar
9312         set msgsnd d_msgsnd
9313         eval $setvar
9314         set msgrcv d_msgrcv
9315         eval $setvar
9316         ;;
9317     esac
9318     ;;
9319 esac
9320 : we could also check for sys/ipc.h ...
9321 if $h_msg && $test `./findhdr sys/msg.h`; then
9322         echo "You have the full msg*(2) library." >&4
9323         val="$define"
9324 else
9325         echo "You don't have the full msg*(2) library." >&4
9326         val="$undef"
9327 fi
9328 set d_msg
9329 eval $setvar
9330
9331 : see if msync exists
9332 set msync d_msync
9333 eval $inlibc
9334
9335 : see if munmap exists
9336 set munmap d_munmap
9337 eval $inlibc
9338
9339 : see if nice exists
9340 set nice d_nice
9341 eval $inlibc
9342
9343 : see if POSIX threads are available
9344 set pthread.h i_pthread
9345 eval $inhdr
9346
9347
9348
9349
9350 : how to create joinable pthreads
9351 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9352         echo " "
9353         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9354         $cat >try.c <<'EOCP'
9355 #include <pthread.h>
9356 int main() {
9357     int detachstate = JOINABLE;
9358 }
9359 EOCP
9360         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9361         if eval $compile; then
9362                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9363                 val="$undef" # Yes, undef.
9364                 set d_old_pthread_create_joinable
9365                 eval $setvar
9366                 val=""
9367                 set old_pthread_create_joinable
9368                 eval $setvar
9369         else
9370                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9371                 if eval $compile; then
9372                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9373                         val="$define"
9374                         set d_old_pthread_create_joinable
9375                         eval $setvar
9376                         val=PTHREAD_CREATE_UNDETACHED
9377                         set old_pthread_create_joinable
9378                         eval $setvar
9379                 else            
9380                         set try -DJOINABLE=__UNDETACHED
9381                         if eval $compile; then
9382                                 echo "You seem to use __UNDETACHED." >&4
9383                                 val="$define"
9384                                 set d_old_pthread_create_joinable
9385                                 eval $setvar
9386                                 val=__UNDETACHED
9387                                 set old_pthread_create_joinable
9388                                 eval $setvar
9389                         else
9390                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9391                                 val="$define"
9392                                 set d_old_pthread_create_joinable
9393                                 eval $setvar
9394                                 val=0
9395                                 set old_pthread_create_joinable
9396                                 eval $setvar
9397                         fi
9398                 fi
9399         fi
9400         $rm -f try try.*
9401 else
9402     d_old_pthread_create_joinable="$undef"
9403     old_pthread_create_joinable=""
9404 fi
9405
9406 : see if pause exists
9407 set pause d_pause
9408 eval $inlibc
9409
9410 : see if pipe exists
9411 set pipe d_pipe
9412 eval $inlibc
9413
9414 : see if poll exists
9415 set poll d_poll
9416 eval $inlibc
9417
9418
9419 : see whether the various POSIXish _yields exist
9420 $cat >try.c <<EOP
9421 #include <pthread.h>
9422 #include <stdio.h>
9423 int main() {
9424 #ifdef SCHED_YIELD
9425         sched_yield();
9426 #else
9427 #ifdef PTHREAD_YIELD
9428         pthread_yield();
9429 #else
9430 #ifdef PTHREAD_YIELD_NULL
9431         pthread_yield(NULL);
9432 #endif
9433 #endif
9434 #endif
9435 }
9436 EOP
9437 : see if sched_yield exists
9438 set try -DSCHED_YIELD
9439 if eval $compile; then
9440     val="$define"
9441     sched_yield='sched_yield()'
9442 else
9443     val="$undef"
9444 fi
9445 case "$usethreads" in
9446 $define)
9447         case "$val" in
9448         $define) echo 'sched_yield() found.' >&4        ;;
9449         *)       echo 'sched_yield() NOT found.' >&4    ;;
9450         esac
9451 esac
9452 set d_sched_yield
9453 eval $setvar
9454
9455 : see if pthread_yield exists
9456 set try -DPTHREAD_YIELD
9457 if eval $compile; then
9458     val="$define"
9459     case "$sched_yield" in
9460     '') sched_yield='pthread_yield()' ;;
9461     esac
9462 else
9463     set try -DPTHREAD_YIELD_NULL
9464     if eval $compile; then
9465         val="$define"
9466         case "$sched_yield" in
9467         '') sched_yield='pthread_yield(NULL)' ;;
9468         esac
9469     else
9470         val="$undef"
9471     fi
9472 fi
9473 case "$usethreads" in
9474 $define)
9475         case "$val" in
9476         $define) echo 'pthread_yield() found.' >&4      ;;
9477         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9478         esac
9479         ;;
9480 esac
9481 set d_pthread_yield
9482 eval $setvar
9483
9484 case "$sched_yield" in
9485 '') sched_yield=undef ;;
9486 esac
9487
9488 $rm -f try try.*
9489
9490 : see if this is a pwd.h system
9491 set pwd.h i_pwd
9492 eval $inhdr
9493
9494 case "$i_pwd" in
9495 $define)
9496         xxx=`./findhdr pwd.h`
9497         $cppstdin $cppflags $cppminus < $xxx >$$.h
9498
9499         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9500                 val="$define"
9501         else
9502                 val="$undef"
9503         fi
9504         set d_pwquota
9505         eval $setvar
9506
9507         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9508                 val="$define"
9509         else
9510                 val="$undef"
9511         fi
9512         set d_pwage
9513         eval $setvar
9514
9515         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9516                 val="$define"
9517         else
9518                 val="$undef"
9519         fi
9520         set d_pwchange
9521         eval $setvar
9522
9523         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9524                 val="$define"
9525         else
9526                 val="$undef"
9527         fi
9528         set d_pwclass
9529         eval $setvar
9530
9531         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9532                 val="$define"
9533         else
9534                 val="$undef"
9535         fi
9536         set d_pwexpire
9537         eval $setvar
9538
9539         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9540                 val="$define"
9541         else
9542                 val="$undef"
9543         fi
9544         set d_pwcomment
9545         eval $setvar
9546
9547         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9548                 val="$define"
9549         else
9550                 val="$undef"
9551         fi
9552         set d_pwgecos
9553         eval $setvar
9554
9555         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9556                 val="$define"
9557         else
9558                 val="$undef"
9559         fi
9560         set d_pwpasswd
9561         eval $setvar
9562
9563         $rm -f $$.h
9564         ;;
9565 *)
9566         val="$undef"; 
9567         set d_pwquota; eval $setvar
9568         set d_pwage; eval $setvar
9569         set d_pwchange; eval $setvar
9570         set d_pwclass; eval $setvar
9571         set d_pwexpire; eval $setvar
9572         set d_pwcomment; eval $setvar
9573         set d_pwgecos; eval $setvar
9574         set d_pwpasswd; eval $setvar
9575         ;;
9576 esac
9577
9578 : see if readdir and friends exist
9579 set readdir d_readdir
9580 eval $inlibc
9581 set seekdir d_seekdir
9582 eval $inlibc
9583 set telldir d_telldir
9584 eval $inlibc
9585 set rewinddir d_rewinddir
9586 eval $inlibc
9587
9588 : see if readlink exists
9589 set readlink d_readlink
9590 eval $inlibc
9591
9592 : see if readv exists
9593 set readv d_readv
9594 eval $inlibc
9595
9596 : see if rename exists
9597 set rename d_rename
9598 eval $inlibc
9599
9600 : see if rmdir exists
9601 set rmdir d_rmdir
9602 eval $inlibc
9603
9604 : see if memory.h is available.
9605 val=''
9606 set memory.h val
9607 eval $inhdr
9608
9609 : See if it conflicts with string.h
9610 case "$val" in
9611 $define)
9612         case "$strings" in
9613         '') ;;
9614         *)
9615                 $cppstdin $cppflags $cppminus < $strings > mem.h
9616                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9617                         echo " "
9618                         echo "We won't be including <memory.h>."
9619                         val="$undef"
9620                 fi
9621                 $rm -f mem.h
9622                 ;;
9623         esac
9624 esac
9625 set i_memory
9626 eval $setvar
9627
9628 : can bcopy handle overlapping blocks?
9629 val="$undef"
9630 case "$d_bcopy" in
9631 "$define")
9632         echo " "
9633         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9634         $cat >try.c <<EOCP
9635 #$i_memory I_MEMORY
9636 #$i_stdlib I_STDLIB
9637 #$i_string I_STRING
9638 #$i_unistd I_UNISTD
9639 EOCP
9640         $cat >>try.c <<'EOCP'
9641 #include <stdio.h>
9642 #ifdef I_MEMORY
9643 #  include <memory.h>
9644 #endif
9645 #ifdef I_STDLIB
9646 #  include <stdlib.h>
9647 #endif
9648 #ifdef I_STRING
9649 #  include <string.h>
9650 #else
9651 #  include <strings.h>
9652 #endif
9653 #ifdef I_UNISTD
9654 #  include <unistd.h>  /* Needed for NetBSD */
9655 #endif
9656 int main()
9657 {
9658 char buf[128], abc[128];
9659 char *b;
9660 int len;
9661 int off;
9662 int align;
9663
9664 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9665
9666 for (align = 7; align >= 0; align--) {
9667         for (len = 36; len; len--) {
9668                 b = buf+align;
9669                 bcopy(abc, b, len);
9670                 for (off = 1; off <= len; off++) {
9671                         bcopy(b, b+off, len);
9672                         bcopy(b+off, b, len);
9673                         if (bcmp(b, abc, len))
9674                                 exit(1);
9675                 }
9676         }
9677 }
9678 exit(0);
9679 }
9680 EOCP
9681         set try
9682         if eval $compile_ok; then
9683                 if ./try 2>/dev/null; then
9684                         echo "Yes, it can."
9685                         val="$define"
9686                 else
9687                         echo "It can't, sorry."
9688                         case "$d_memmove" in
9689                         "$define") echo "But that's Ok since you have memmove()." ;;
9690                         esac
9691                 fi
9692         else
9693                 echo "(I can't compile the test program, so we'll assume not...)"
9694                 case "$d_memmove" in
9695                 "$define") echo "But that's Ok since you have memmove()." ;;
9696                 esac
9697         fi
9698         ;;
9699 esac
9700 $rm -f try.* try core
9701 set d_safebcpy
9702 eval $setvar
9703
9704 : can memcpy handle overlapping blocks?
9705 val="$undef"
9706 case "$d_memcpy" in
9707 "$define")
9708         echo " "
9709         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9710         $cat >try.c <<EOCP
9711 #$i_memory I_MEMORY
9712 #$i_stdlib I_STDLIB
9713 #$i_string I_STRING
9714 #$i_unistd I_UNISTD
9715 EOCP
9716         $cat >>try.c <<'EOCP'
9717 #include <stdio.h>
9718 #ifdef I_MEMORY
9719 #  include <memory.h>
9720 #endif
9721 #ifdef I_STDLIB
9722 #  include <stdlib.h>
9723 #endif
9724 #ifdef I_STRING
9725 #  include <string.h>
9726 #else
9727 #  include <strings.h>
9728 #endif
9729 #ifdef I_UNISTD
9730 #  include <unistd.h>  /* Needed for NetBSD */
9731 #endif
9732 int main()
9733 {
9734 char buf[128], abc[128];
9735 char *b;
9736 int len;
9737 int off;
9738 int align;
9739
9740 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9741    try to store the string in read-only memory. */
9742 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9743
9744 for (align = 7; align >= 0; align--) {
9745         for (len = 36; len; len--) {
9746                 b = buf+align;
9747                 memcpy(b, abc, len);
9748                 for (off = 1; off <= len; off++) {
9749                         memcpy(b+off, b, len);
9750                         memcpy(b, b+off, len);
9751                         if (memcmp(b, abc, len))
9752                                 exit(1);
9753                 }
9754         }
9755 }
9756 exit(0);
9757 }
9758 EOCP
9759         set try
9760         if eval $compile_ok; then
9761                 if ./try 2>/dev/null; then
9762                         echo "Yes, it can."
9763                         val="$define"
9764                 else
9765                         echo "It can't, sorry."
9766                         case "$d_memmove" in
9767                         "$define") echo "But that's Ok since you have memmove()." ;;
9768                         esac
9769                 fi
9770         else
9771                 echo "(I can't compile the test program, so we'll assume not...)"
9772                 case "$d_memmove" in
9773                 "$define") echo "But that's Ok since you have memmove()." ;;
9774                 esac
9775         fi
9776         ;;
9777 esac
9778 $rm -f try.* try core
9779 set d_safemcpy
9780 eval $setvar
9781
9782 : can memcmp be trusted to compare relative magnitude?
9783 val="$undef"
9784 case "$d_memcmp" in
9785 "$define")
9786         echo " "
9787         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9788         $cat >try.c <<EOCP
9789 #$i_memory I_MEMORY
9790 #$i_stdlib I_STDLIB
9791 #$i_string I_STRING
9792 #$i_unistd I_UNISTD
9793 EOCP
9794         $cat >>try.c <<'EOCP'
9795 #include <stdio.h>
9796 #ifdef I_MEMORY
9797 #  include <memory.h>
9798 #endif
9799 #ifdef I_STDLIB
9800 #  include <stdlib.h>
9801 #endif
9802 #ifdef I_STRING
9803 #  include <string.h>
9804 #else
9805 #  include <strings.h>
9806 #endif
9807 #ifdef I_UNISTD
9808 #  include <unistd.h>  /* Needed for NetBSD */
9809 #endif
9810 int main()
9811 {
9812 char a = -1;
9813 char b = 0;
9814 if ((a < b) && memcmp(&a, &b, 1) < 0)
9815         exit(1);
9816 exit(0);
9817 }
9818 EOCP
9819         set try
9820         if eval $compile_ok; then
9821                 if ./try 2>/dev/null; then
9822                         echo "Yes, it can."
9823                         val="$define"
9824                 else
9825                         echo "No, it can't (it uses signed chars)."
9826                 fi
9827         else
9828                 echo "(I can't compile the test program, so we'll assume not...)"
9829         fi
9830         ;;
9831 esac
9832 $rm -f try.* try core
9833 set d_sanemcmp
9834 eval $setvar
9835
9836 : see if select exists
9837 set select d_select
9838 eval $inlibc
9839
9840 : see if semctl exists
9841 set semctl d_semctl
9842 eval $inlibc
9843
9844 : see if semget exists
9845 set semget d_semget
9846 eval $inlibc
9847
9848 : see if semop exists
9849 set semop d_semop
9850 eval $inlibc
9851
9852 : see how much of the 'sem*(2)' library is present.
9853 h_sem=true
9854 echo " "
9855 case "$d_semctl$d_semget$d_semop" in
9856 *"$undef"*) h_sem=false;;
9857 esac
9858 case "$osname" in
9859 freebsd)
9860     case "`ipcs 2>&1`" in
9861     "SVID messages"*"not configured"*)
9862         echo "Your $osname does not have the sem*(2) configured." >&4
9863         h_sem=false
9864         val="$undef"
9865         set semctl d_semctl
9866         eval $setvar
9867         set semget d_semget
9868         eval $setvar
9869         set semop d_semop
9870         eval $setvar
9871         ;;
9872     esac
9873     ;;
9874 esac
9875 : we could also check for sys/ipc.h ...
9876 if $h_sem && $test `./findhdr sys/sem.h`; then
9877         echo "You have the full sem*(2) library." >&4
9878         val="$define"
9879 else
9880         echo "You don't have the full sem*(2) library." >&4
9881         val="$undef"
9882 fi
9883 set d_sem
9884 eval $setvar
9885
9886 : see whether sys/sem.h defines union semun
9887 echo " "
9888 $cat > try.c <<'END'
9889 #include <sys/types.h>
9890 #include <sys/ipc.h>
9891 #include <sys/sem.h>
9892 int main () { union semun semun; semun.buf = 0; }
9893 END
9894 set try
9895 if eval $compile; then
9896     echo "You have union semun in <sys/sem.h>." >&4
9897     val="$define"
9898 else
9899     echo "You do not have union semun in <sys/sem.h>." >&4
9900     val="$undef"
9901 fi
9902 $rm -f try try.c try.h
9903 set d_union_semun
9904 eval $setvar
9905
9906 : see how to do semctl IPC_STAT
9907 case "$d_sem" in
9908 $define)
9909     : see whether semctl IPC_STAT can use union semun
9910     echo " "
9911     $cat > try.h <<END
9912 #ifndef S_IRUSR
9913 #   ifdef S_IREAD
9914 #       define S_IRUSR S_IREAD
9915 #       define S_IWUSR S_IWRITE
9916 #       define S_IXUSR S_IEXEC
9917 #   else
9918 #       define S_IRUSR 0400
9919 #       define S_IWUSR 0200
9920 #       define S_IXUSR 0100
9921 #   endif
9922 #   define S_IRGRP (S_IRUSR>>3)
9923 #   define S_IWGRP (S_IWUSR>>3)
9924 #   define S_IXGRP (S_IXUSR>>3)
9925 #   define S_IROTH (S_IRUSR>>6)
9926 #   define S_IWOTH (S_IWUSR>>6)
9927 #   define S_IXOTH (S_IXUSR>>6)
9928 #endif
9929 #ifndef S_IRWXU
9930 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9931 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9932 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9933 #endif
9934 END
9935
9936     $cat > try.c <<END
9937 #include <sys/types.h>
9938 #include <sys/ipc.h>
9939 #include <sys/sem.h>
9940 #include <sys/stat.h>
9941 #include <stdio.h>
9942 #include <errno.h>
9943 #include "try.h"
9944 #ifndef errno
9945 extern int errno;
9946 #endif
9947 #$d_union_semun HAS_UNION_SEMUN
9948 int main() {
9949     union semun
9950 #ifndef HAS_UNION_SEMUN
9951     {
9952         int val;
9953         struct semid_ds *buf;
9954         unsigned short *array;
9955     }
9956 #endif
9957     arg;
9958     int sem, st;
9959
9960 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9961     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9962     if (sem > -1) {
9963         struct semid_ds argbuf;
9964         arg.buf = &argbuf;
9965 #       ifdef IPC_STAT
9966         st = semctl(sem, 0, IPC_STAT, arg);
9967         if (st == 0)
9968             printf("semun\n");
9969         else
9970 #       endif /* IPC_STAT */
9971             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9972 #       ifdef IPC_RMID
9973         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9974 #       endif /* IPC_RMID */
9975             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9976     } else
9977 #endif /* IPC_PRIVATE && ... */
9978         printf("semget failed: errno = %d\n", errno);
9979   return 0;
9980 }
9981 END
9982     val="$undef"
9983     set try
9984     if eval $compile; then
9985         xxx=`./try`
9986         case "$xxx" in
9987         semun) val="$define" ;;
9988         esac
9989     fi
9990     $rm -f try try.c
9991     set d_semctl_semun
9992     eval $setvar
9993     case "$d_semctl_semun" in
9994     $define)
9995         echo "You can use union semun for semctl IPC_STAT." >&4
9996         also='also'
9997         ;;
9998     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9999         also=''
10000         ;;
10001     esac
10002
10003     : see whether semctl IPC_STAT can use struct semid_ds pointer
10004     $cat > try.c <<'END'
10005 #include <sys/types.h>
10006 #include <sys/ipc.h>
10007 #include <sys/sem.h>
10008 #include <sys/stat.h>
10009 #include "try.h"
10010 #include <stdio.h>
10011 #include <errno.h>
10012 #ifndef errno
10013 extern int errno;
10014 #endif
10015 int main() {
10016     struct semid_ds arg;
10017     int sem, st;
10018
10019 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10020     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10021     if (sem > -1) {
10022 #       ifdef IPC_STAT
10023         st = semctl(sem, 0, IPC_STAT, &arg);
10024         if (st == 0)
10025             printf("semid_ds\n");
10026         else
10027 #       endif /* IPC_STAT */
10028             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10029 #       ifdef IPC_RMID
10030         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10031 #       endif /* IPC_RMID */
10032             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10033     } else
10034 #endif /* IPC_PRIVATE && ... */
10035         printf("semget failed: errno = %d\n", errno);
10036
10037     return 0;
10038 }
10039 END
10040     val="$undef"
10041     set try
10042     if eval $compile; then
10043         xxx=`./try`
10044         case "$xxx" in
10045         semid_ds) val="$define" ;;
10046         esac
10047     fi
10048     $rm -f try try.c
10049     set d_semctl_semid_ds
10050     eval $setvar
10051     case "$d_semctl_semid_ds" in
10052     $define)
10053         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10054         ;;
10055     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10056         ;;
10057     esac
10058     $rm -f try.h
10059     ;;
10060 *)  val="$undef"
10061
10062     # We do not have the full sem*(2) library, so assume we can not
10063     # use either.
10064
10065     set d_semctl_semun
10066     eval $setvar
10067
10068     set d_semctl_semid_ds
10069     eval $setvar
10070     ;;
10071 esac
10072
10073 : see if setegid exists
10074 set setegid d_setegid
10075 eval $inlibc
10076
10077 : see if seteuid exists
10078 set seteuid d_seteuid
10079 eval $inlibc
10080
10081 : see if setgrent exists
10082 set setgrent d_setgrent
10083 eval $inlibc
10084
10085 : see if sethostent exists
10086 set sethostent d_sethent
10087 eval $inlibc
10088
10089 : see if setlinebuf exists
10090 set setlinebuf d_setlinebuf
10091 eval $inlibc
10092
10093 : see if setlocale exists
10094 set setlocale d_setlocale
10095 eval $inlibc
10096
10097 : see if setnetent exists
10098 set setnetent d_setnent
10099 eval $inlibc
10100
10101 : see if setprotoent exists
10102 set setprotoent d_setpent
10103 eval $inlibc
10104
10105 : see if setpgid exists
10106 set setpgid d_setpgid
10107 eval $inlibc
10108
10109 : see if setpgrp2 exists
10110 set setpgrp2 d_setpgrp2
10111 eval $inlibc
10112
10113 : see if setpriority exists
10114 set setpriority d_setprior
10115 eval $inlibc
10116
10117 : see if setpwent exists
10118 set setpwent d_setpwent
10119 eval $inlibc
10120
10121 : see if setregid exists
10122 set setregid d_setregid
10123 eval $inlibc
10124 set setresgid d_setresgid
10125 eval $inlibc
10126
10127 : see if setreuid exists
10128 set setreuid d_setreuid
10129 eval $inlibc
10130 set setresuid d_setresuid
10131 eval $inlibc
10132
10133 : see if setrgid exists
10134 set setrgid d_setrgid
10135 eval $inlibc
10136
10137 : see if setruid exists
10138 set setruid d_setruid
10139 eval $inlibc
10140
10141 : see if setservent exists
10142 set setservent d_setsent
10143 eval $inlibc
10144
10145 : see if setsid exists
10146 set setsid d_setsid
10147 eval $inlibc
10148
10149 : see if setspent exists
10150 set setspent d_setspent
10151 eval $inlibc
10152
10153 : see if setvbuf exists
10154 set setvbuf d_setvbuf
10155 eval $inlibc
10156
10157 : see if sfio.h is available
10158 set sfio.h i_sfio
10159 eval $inhdr
10160
10161
10162 : see if sfio library is available
10163 case "$i_sfio" in
10164 $define)
10165         val=''
10166         set sfreserve val
10167         eval $inlibc
10168         ;;
10169 *)
10170         val="$undef"
10171         ;;
10172 esac
10173 : Ok, but do we want to use it.
10174 case "$val" in
10175 $define)
10176         case "$usesfio" in
10177         true|$define|[yY]*) dflt='y';;
10178         *) dflt='n';;
10179         esac
10180         echo "$package can use the sfio library, but it is experimental."
10181         rp="You seem to have sfio available, do you want to try using it?"
10182         . ./myread
10183         case "$ans" in
10184         y|Y) ;;
10185         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10186                 val="$undef"
10187                 : Remove sfio from list of libraries to use
10188                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10189                 shift
10190                 libs="$*"
10191                 echo "libs = $libs" >&4
10192                 ;;
10193         esac
10194         ;;
10195 *)      case "$usesfio" in
10196         true|$define|[yY]*)
10197                 echo "Sorry, cannot find sfio on this machine" >&4
10198                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10199                 ;;
10200         esac
10201         ;;
10202 esac
10203 set d_sfio
10204 eval $setvar
10205 case "$d_sfio" in
10206 $define) usesfio='true';;
10207 *) usesfio='false';;
10208 esac
10209
10210 : see if shmctl exists
10211 set shmctl d_shmctl
10212 eval $inlibc
10213
10214 : see if shmget exists
10215 set shmget d_shmget
10216 eval $inlibc
10217
10218 : see if shmat exists
10219 set shmat d_shmat
10220 eval $inlibc
10221 : see what shmat returns
10222 case "$d_shmat" in
10223 "$define")
10224         $cat >shmat.c <<'END'
10225 #include <sys/shm.h>
10226 void *shmat();
10227 END
10228         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10229                 shmattype='void *'
10230         else
10231                 shmattype='char *'
10232         fi
10233         echo "and it returns ($shmattype)." >&4
10234         : see if a prototype for shmat is available
10235         xxx=`./findhdr sys/shm.h`
10236         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10237         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10238                 val="$define"
10239         else
10240                 val="$undef"
10241         fi
10242         $rm -f shmat.[co]
10243         ;;
10244 *)
10245         val="$undef"
10246         ;;
10247 esac
10248 set d_shmatprototype
10249 eval $setvar
10250
10251 : see if shmdt exists
10252 set shmdt d_shmdt
10253 eval $inlibc
10254
10255 : see how much of the 'shm*(2)' library is present.
10256 h_shm=true
10257 echo " "
10258 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10259 *"$undef"*) h_shm=false;;
10260 esac
10261 case "$osname" in
10262 freebsd)
10263     case "`ipcs 2>&1`" in
10264     "SVID shared memory"*"not configured"*)
10265         echo "Your $osname does not have the shm*(2) configured." >&4
10266         h_shm=false
10267         val="$undef"
10268         set shmctl d_shmctl
10269         evat $setvar
10270         set shmget d_shmget
10271         evat $setvar
10272         set shmat d_shmat
10273         evat $setvar
10274         set shmdt d_shmdt
10275         evat $setvar
10276         ;;
10277     esac
10278     ;;
10279 esac
10280 : we could also check for sys/ipc.h ...
10281 if $h_shm && $test `./findhdr sys/shm.h`; then
10282         echo "You have the full shm*(2) library." >&4
10283         val="$define"
10284 else
10285         echo "You don't have the full shm*(2) library." >&4
10286         val="$undef"
10287 fi
10288 set d_shm
10289 eval $setvar
10290
10291 echo " "
10292 : see if we have sigaction
10293 if set sigaction val -f d_sigaction; eval $csym; $val; then
10294         echo 'sigaction() found.' >&4
10295         $cat > try.c <<'EOP'
10296 #include <stdio.h>
10297 #include <sys/types.h>
10298 #include <signal.h>
10299 int main()
10300 {
10301     struct sigaction act, oact;
10302     act.sa_flags = 0;
10303     oact.sa_handler = 0;
10304 }
10305 EOP
10306         set try
10307         if eval $compile_ok; then
10308                 val="$define"
10309         else
10310                 echo "But you don't seem to have a useable struct sigaction." >&4
10311                 val="$undef"
10312         fi
10313 else
10314         echo 'sigaction NOT found.' >&4
10315         val="$undef"
10316 fi
10317 set d_sigaction; eval $setvar
10318 $rm -f try try$_o try.c
10319
10320 : see if sigsetjmp exists
10321 echo " "
10322 case "$d_sigsetjmp" in
10323 '')
10324         $cat >try.c <<'EOP'
10325 #include <setjmp.h>
10326 sigjmp_buf env;
10327 int set = 1;
10328 int main()
10329 {
10330         if (sigsetjmp(env,1))
10331                 exit(set);
10332         set = 0;
10333         siglongjmp(env, 1);
10334         exit(1);
10335 }
10336 EOP
10337         set try
10338         if eval $compile; then
10339                 if ./try >/dev/null 2>&1; then
10340                         echo "POSIX sigsetjmp found." >&4
10341                         val="$define"
10342                 else
10343                         $cat >&4 <<EOM
10344 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10345 I'll ignore them.
10346 EOM
10347                         val="$undef"
10348                 fi
10349         else
10350                 echo "sigsetjmp not found." >&4
10351                 val="$undef"
10352         fi
10353         ;;
10354 *) val="$d_sigsetjmp"
10355         case "$d_sigsetjmp" in
10356         $define) echo "POSIX sigsetjmp found." >&4;;
10357         $undef) echo "sigsetjmp not found." >&4;;
10358         esac
10359         ;;
10360 esac
10361 set d_sigsetjmp
10362 eval $setvar
10363 $rm -f try.c try
10364
10365 : see if sqrtl exists
10366 set sqrtl d_sqrtl
10367 eval $inlibc
10368
10369 : see if sys/stat.h is available
10370 set sys/stat.h i_sysstat
10371 eval $inhdr
10372
10373 : see if stat knows about block sizes
10374 echo " "
10375 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10376 eval $hasfield
10377
10378 : see if this is a sys/vfs.h system
10379 set sys/vfs.h i_sysvfs
10380 eval $inhdr
10381
10382 : see if this is a sys/statfs.h system
10383 set sys/statfs.h i_sysstatfs
10384 eval $inhdr
10385
10386
10387 echo " "
10388 echo "Checking to see if your system supports struct statfs..." >&4
10389 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
10390 eval $hasstruct
10391 case "$d_statfs_s" in
10392 "$define")      echo "Yup, it does."     >&4 ;;
10393 *)              echo "Nope, it doesn't." >&4 ;;
10394 esac
10395
10396
10397
10398 : see if struct statfs knows about f_flags
10399 case "$d_statfs_s" in
10400 define) 
10401         echo " "
10402         echo "Checking to see if your struct statfs has f_flags field..." >&4
10403         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
10404         eval $hasfield
10405         ;;
10406 *)      val="$undef"
10407         set d_statfs_f_flags
10408         eval $setvar
10409         ;;
10410 esac
10411 case "$d_statfs_f_flags" in
10412 "$define")      echo "Yup, it does."     >&4 ;;
10413 *)              echo "Nope, it doesn't." >&4 ;;
10414 esac
10415
10416 : see if _ptr and _cnt from stdio act std
10417 echo " "
10418 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10419         echo "(Looks like you have stdio.h from Linux.)"
10420         case "$stdio_ptr" in
10421         '') stdio_ptr='((fp)->_IO_read_ptr)'
10422                 ptr_lval=$define
10423                 ;;
10424         *)      ptr_lval=$d_stdio_ptr_lval;;
10425         esac
10426         case "$stdio_cnt" in
10427         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10428                 cnt_lval=$undef
10429                 ;;
10430         *)      cnt_lval=$d_stdio_cnt_lval;;
10431         esac
10432         case "$stdio_base" in
10433         '') stdio_base='((fp)->_IO_read_base)';;
10434         esac
10435         case "$stdio_bufsiz" in
10436         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10437         esac
10438 else
10439         case "$stdio_ptr" in
10440         '') stdio_ptr='((fp)->_ptr)'
10441                 ptr_lval=$define
10442                 ;;
10443         *)      ptr_lval=$d_stdio_ptr_lval;;
10444         esac
10445         case "$stdio_cnt" in
10446         '') stdio_cnt='((fp)->_cnt)'
10447                 cnt_lval=$define
10448                 ;;
10449         *)      cnt_lval=$d_stdio_cnt_lval;;
10450         esac
10451         case "$stdio_base" in
10452         '') stdio_base='((fp)->_base)';;
10453         esac
10454         case "$stdio_bufsiz" in
10455         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10456         esac
10457 fi
10458 : test whether _ptr and _cnt really work
10459 echo "Checking how std your stdio is..." >&4
10460 $cat >try.c <<EOP
10461 #include <stdio.h>
10462 #define FILE_ptr(fp)    $stdio_ptr
10463 #define FILE_cnt(fp)    $stdio_cnt
10464 int main() {
10465         FILE *fp = fopen("try.c", "r");
10466         char c = getc(fp);
10467         if (
10468                 18 <= FILE_cnt(fp) &&
10469                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10470         )
10471                 exit(0);
10472         exit(1);
10473 }
10474 EOP
10475 val="$undef"
10476 set try
10477 if eval $compile; then
10478         if ./try; then
10479                 echo "Your stdio acts pretty std."
10480                 val="$define"
10481         else
10482                 echo "Your stdio isn't very std."
10483         fi
10484 else
10485         echo "Your stdio doesn't appear very std."
10486 fi
10487 $rm -f try.c try
10488 set d_stdstdio
10489 eval $setvar
10490
10491 : Can _ptr be used as an lvalue?
10492 case "$d_stdstdio$ptr_lval" in
10493 $define$define) val=$define ;;
10494 *) val=$undef ;;
10495 esac
10496 set d_stdio_ptr_lval
10497 eval $setvar
10498
10499 : Can _cnt be used as an lvalue?
10500 case "$d_stdstdio$cnt_lval" in
10501 $define$define) val=$define ;;
10502 *) val=$undef ;;
10503 esac
10504 set d_stdio_cnt_lval
10505 eval $setvar
10506
10507 : see if _base is also standard
10508 val="$undef"
10509 case "$d_stdstdio" in
10510 $define)
10511         $cat >try.c <<EOP
10512 #include <stdio.h>
10513 #define FILE_base(fp)   $stdio_base
10514 #define FILE_bufsiz(fp) $stdio_bufsiz
10515 int main() {
10516         FILE *fp = fopen("try.c", "r");
10517         char c = getc(fp);
10518         if (
10519                 19 <= FILE_bufsiz(fp) &&
10520                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10521         )
10522                 exit(0);
10523         exit(1);
10524 }
10525 EOP
10526         set try
10527         if eval $compile; then
10528                 if ./try; then
10529                         echo "And its _base field acts std."
10530                         val="$define"
10531                 else
10532                         echo "But its _base field isn't std."
10533                 fi
10534         else
10535                 echo "However, it seems to be lacking the _base field."
10536         fi
10537         $rm -f try.c try
10538         ;;
10539 esac
10540 set d_stdiobase
10541 eval $setvar
10542
10543 $cat >&4 <<EOM
10544 Checking how to access stdio streams by file descriptor number...
10545 EOM
10546 case "$stdio_stream_array" in
10547 '')     $cat >try.c <<EOCP
10548 #include <stdio.h>
10549 int main() {
10550   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10551     printf("yes\n");
10552 }
10553 EOCP
10554         for s in _iob __iob __sF
10555         do
10556                 set try -DSTDIO_STREAM_ARRAY=$s
10557                 if eval $compile; then
10558                         case "`./try$exe_ext`" in
10559                         yes)    stdio_stream_array=$s; break ;;
10560                         esac
10561                 fi
10562         done
10563         $rm -f try.* try$exe_ext
10564 esac
10565 case "$stdio_stream_array" in
10566 '')     $cat >&4 <<EOM
10567 I can't figure out how to access stdio streams by file descriptor number.
10568 EOM
10569         d_stdio_stream_array="$undef"
10570         ;;
10571 *)      $cat >&4 <<EOM
10572 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10573 EOM
10574         d_stdio_stream_array="$define"
10575         ;;
10576 esac
10577
10578 : see if strcoll exists
10579 set strcoll d_strcoll
10580 eval $inlibc
10581
10582 : check for structure copying
10583 echo " "
10584 echo "Checking to see if your C compiler can copy structs..." >&4
10585 $cat >try.c <<'EOCP'
10586 int main()
10587 {
10588         struct blurfl {
10589                 int dyick;
10590         } foo, bar;
10591
10592         foo = bar;
10593 }
10594 EOCP
10595 if $cc -c try.c >/dev/null 2>&1 ; then
10596         val="$define"
10597         echo "Yup, it can."
10598 else
10599         val="$undef"
10600         echo "Nope, it can't."
10601 fi
10602 set d_strctcpy
10603 eval $setvar
10604 $rm -f try.*
10605
10606 : see if strerror and/or sys_errlist[] exist
10607 echo " "
10608 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10609     if set strerror val -f d_strerror; eval $csym; $val; then
10610                 echo 'strerror() found.' >&4
10611                 d_strerror="$define"
10612                 d_strerrm='strerror(e)'
10613                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10614                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10615                         d_syserrlst="$define"
10616                 else
10617                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10618                         d_syserrlst="$undef"
10619                 fi
10620     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10621                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10622                 echo 'strerror() found in string header.' >&4
10623                 d_strerror="$define"
10624                 d_strerrm='strerror(e)'
10625                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10626                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10627                                 d_syserrlst="$define"
10628                 else
10629                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10630                         d_syserrlst="$undef"
10631                 fi
10632     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10633                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10634                 d_strerror="$undef"
10635                 d_syserrlst="$define"
10636                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10637     else
10638                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10639                 d_strerror="$undef"
10640                 d_syserrlst="$undef"
10641                 d_strerrm='"unknown"'
10642     fi
10643 fi
10644
10645 : see if strtod exists
10646 set strtod d_strtod
10647 eval $inlibc
10648
10649 : see if strtol exists
10650 set strtol d_strtol
10651 eval $inlibc
10652
10653 : see if strtoul exists
10654 set strtoul d_strtoul
10655 eval $inlibc
10656
10657 : see if strtoull exists
10658 set strtoull d_strtoull
10659 eval $inlibc
10660
10661 : see if strxfrm exists
10662 set strxfrm d_strxfrm
10663 eval $inlibc
10664
10665 : see if symlink exists
10666 set symlink d_symlink
10667 eval $inlibc
10668
10669 : see if syscall exists
10670 set syscall d_syscall
10671 eval $inlibc
10672
10673 : see if sysconf exists
10674 set sysconf d_sysconf
10675 eval $inlibc
10676
10677 : see if system exists
10678 set system d_system
10679 eval $inlibc
10680
10681 : see if tcgetpgrp exists
10682 set tcgetpgrp d_tcgetpgrp
10683 eval $inlibc
10684
10685 : see if tcsetpgrp exists
10686 set tcsetpgrp d_tcsetpgrp
10687 eval $inlibc
10688
10689 : see if prototype for telldir is available
10690 echo " "
10691 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10692 eval $hasproto
10693
10694 : define an is-a-typedef? function
10695 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10696 case "$inclist" in
10697 "") inclist="sys/types.h";;
10698 esac;
10699 eval "varval=\$$var";
10700 case "$varval" in
10701 "")
10702         $rm -f temp.c;
10703         for inc in $inclist; do
10704                 echo "#include <$inc>" >>temp.c;
10705         done;
10706         echo "#ifdef $type" >> temp.c;
10707         echo "printf(\"We have $type\");" >> temp.c;
10708         echo "#endif" >> temp.c;
10709         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10710         if $contains $type temp.E >/dev/null 2>&1; then
10711                 eval "$var=\$type";
10712         else
10713                 eval "$var=\$def";
10714         fi;
10715         $rm -f temp.?;;
10716 *) eval "$var=\$varval";;
10717 esac'
10718
10719 : define an is-a-typedef? function that prompts if the type is not available.
10720 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10721 case "$inclist" in
10722 "") inclist="sys/types.h";;
10723 esac;
10724 eval "varval=\$$var";
10725 case "$varval" in
10726 "")
10727         $rm -f temp.c;
10728         for inc in $inclist; do
10729                 echo "#include <$inc>" >>temp.c;
10730         done;
10731         echo "#ifdef $type" >> temp.c;
10732         echo "printf(\"We have $type\");" >> temp.c;
10733         echo "#endif" >> temp.c;
10734         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10735         echo " " ;
10736         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10737         if $contains $type temp.E >/dev/null 2>&1; then
10738                 echo "$type found." >&4;
10739                 eval "$var=\$type";
10740         else
10741                 echo "$type NOT found." >&4;
10742                 dflt="$def";
10743                 . ./myread ;
10744                 eval "$var=\$ans";
10745         fi;
10746         $rm -f temp.?;;
10747 *) eval "$var=\$varval";;
10748 esac'
10749
10750 : see if this is a sys/times.h system
10751 set sys/times.h i_systimes
10752 eval $inhdr
10753
10754 : see if times exists
10755 echo " "
10756 if set times val -f d_times; eval $csym; $val; then
10757         echo 'times() found.' >&4
10758         d_times="$define"
10759         inc=''
10760         case "$i_systimes" in
10761         "$define") inc='sys/times.h';;
10762         esac
10763         rp="What is the type returned by times() on this system?"
10764         set clock_t clocktype long stdio.h sys/types.h $inc
10765         eval $typedef_ask
10766 else
10767         echo 'times() NOT found, hope that will do.' >&4
10768         d_times="$undef"
10769         clocktype='int'
10770 fi
10771
10772 : see if truncate exists
10773 set truncate d_truncate
10774 eval $inlibc
10775
10776 : see if tzname[] exists
10777 echo " "
10778 if set tzname val -a d_tzname; eval $csym; $val; then
10779         val="$define"
10780         echo 'tzname[] found.' >&4
10781 else
10782         val="$undef"
10783         echo 'tzname[] NOT found.' >&4
10784 fi
10785 set d_tzname
10786 eval $setvar
10787
10788 : see if umask exists
10789 set umask d_umask
10790 eval $inlibc
10791
10792 : see if ustat exists
10793 set ustat d_ustat
10794 eval $inlibc
10795
10796 : backward compatibility for d_hvfork
10797 if test X$d_hvfork != X; then
10798         d_vfork="$d_hvfork"
10799         d_hvfork=''
10800 fi
10801 : see if there is a vfork
10802 val=''
10803 set vfork val
10804 eval $inlibc
10805
10806 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10807 : perl on Solaris 2.x, and probably elsewhere.
10808 case "$val" in
10809 $define)
10810         echo " "
10811         case "$usevfork" in
10812         false) dflt='n';;
10813         *) dflt='y';;
10814         esac
10815         cat <<'EOM'
10816  
10817 Perl can only use a vfork() that doesn't suffer from strict
10818 restrictions on calling functions or modifying global data in
10819 the child.  For example, glibc-2.1 contains such a vfork()
10820 that is unsuitable.  If your system provides a proper fork()
10821 call, chances are that you do NOT want perl to use vfork().
10822
10823 EOM
10824         rp="Do you still want to use vfork()?"
10825         . ./myread
10826         case "$ans" in
10827         y|Y) ;;
10828         *)
10829                 echo "Ok, we won't use vfork()."
10830                 val="$undef"
10831                 ;;
10832         esac
10833         ;;
10834 esac
10835 set d_vfork
10836 eval $setvar
10837 case "$d_vfork" in
10838 $define) usevfork='true';;
10839 *) usevfork='false';;
10840 esac
10841
10842 : see if this is an sysdir system
10843 set sys/dir.h i_sysdir
10844 eval $inhdr
10845
10846 : see if this is an sysndir system
10847 set sys/ndir.h i_sysndir
10848 eval $inhdr
10849
10850 : see if closedir exists
10851 set closedir d_closedir
10852 eval $inlibc
10853
10854 case "$d_closedir" in
10855 "$define")
10856         echo " "
10857         echo "Checking whether closedir() returns a status..." >&4
10858         cat > closedir.c <<EOM
10859 #$i_dirent I_DIRENT             /**/
10860 #$i_sysdir I_SYS_DIR            /**/
10861 #$i_sysndir I_SYS_NDIR          /**/
10862 #$i_systypes I_SYS_TYPES        /**/
10863
10864 #if defined(I_SYS_TYPES)
10865 #include <sys/types.h>
10866 #endif
10867 #if defined(I_DIRENT)
10868 #include <dirent.h>
10869 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10870 #include <sys/dir.h>
10871 #endif
10872 #else
10873 #ifdef I_SYS_NDIR
10874 #include <sys/ndir.h>
10875 #else
10876 #ifdef I_SYS_DIR
10877 #ifdef hp9000s500
10878 #include <ndir.h>       /* may be wrong in the future */
10879 #else
10880 #include <sys/dir.h>
10881 #endif
10882 #endif
10883 #endif
10884 #endif 
10885 int main() { return closedir(opendir(".")); }
10886 EOM
10887         set closedir
10888         if eval $compile_ok; then
10889                 if ./closedir > /dev/null 2>&1 ; then
10890                         echo "Yes, it does."
10891                         val="$undef"
10892                 else
10893                         echo "No, it doesn't."
10894                         val="$define"
10895                 fi
10896         else
10897                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10898                 val="$define"
10899         fi
10900         ;;
10901 *)
10902         val="$undef";
10903         ;;
10904 esac
10905 set d_void_closedir
10906 eval $setvar
10907 $rm -f closedir*
10908 : check for volatile keyword
10909 echo " "
10910 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10911 $cat >try.c <<'EOCP'
10912 int main()
10913 {
10914         typedef struct _goo_struct goo_struct;
10915         goo_struct * volatile goo = ((goo_struct *)0);
10916         struct _goo_struct {
10917                 long long_int;
10918                 int reg_int;
10919                 char char_var;
10920         };
10921         typedef unsigned short foo_t;
10922         char *volatile foo;
10923         volatile int bar;
10924         volatile foo_t blech;
10925         foo = foo;
10926 }
10927 EOCP
10928 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10929         val="$define"
10930         echo "Yup, it does."
10931 else
10932         val="$undef"
10933         echo "Nope, it doesn't."
10934 fi
10935 set d_volatile
10936 eval $setvar
10937 $rm -f try.*
10938
10939 : see if there is a wait4
10940 set wait4 d_wait4
10941 eval $inlibc
10942
10943 : see if waitpid exists
10944 set waitpid d_waitpid
10945 eval $inlibc
10946
10947 : see if wcstombs exists
10948 set wcstombs d_wcstombs
10949 eval $inlibc
10950
10951 : see if wctomb exists
10952 set wctomb d_wctomb
10953 eval $inlibc
10954
10955 : see if writev exists
10956 set writev d_writev
10957 eval $inlibc
10958
10959 : preserve RCS keywords in files with variable substitution, grrr
10960 Date='$Date'
10961 Id='$Id'
10962 Log='$Log'
10963 RCSfile='$RCSfile'
10964 Revision='$Revision'
10965
10966 case "$crosscompile" in
10967 ''|[nN]*) crosscompile="$undef" ;;
10968 esac
10969
10970 case "$osname" in
10971 next|rhapsody) multiarch="$define" ;;
10972 esac
10973 case "$multiarch" in
10974 ''|[nN]*) multiarch="$undef" ;;
10975 esac
10976
10977 : check for alignment requirements
10978 echo " "
10979 case "$crosscompile$multiarch" in
10980 *$define*)
10981         $cat <<EOM
10982 You seem to be either cross-compiling or doing a multiarchitecture build,
10983 skipping the memory alignment check.
10984
10985 EOM
10986         case "$alignbytes" in
10987         '') alignbytes=8 ;;
10988         esac
10989         ;;
10990 *)
10991         case "$alignbytes" in
10992         '') echo "Checking alignment constraints..." >&4
10993                 $cat >try.c <<'EOCP'
10994 struct foobar {
10995         char foo;
10996         double bar;
10997 } try_algn;
10998 int main()
10999 {
11000         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
11001 }
11002 EOCP
11003                 set try
11004                 if eval $compile_ok; then
11005                         dflt=`./try`
11006                 else
11007                         dflt='8'
11008                         echo "(I can't seem to compile the test program...)"
11009                 fi
11010                 ;;
11011         *) dflt="$alignbytes"
11012                 ;;
11013         esac
11014         rp="Doubles must be aligned on a how-many-byte boundary?"
11015         . ./myread
11016         alignbytes="$ans"
11017         $rm -f try.c try
11018         ;;
11019 esac
11020
11021
11022 : check for ordering of bytes in a long
11023 echo " "
11024 case "$crosscompile$multiarch" in
11025 *$define*)
11026         $cat <<EOM
11027 You seem to be either cross-compiling or doing a multiarchitecture build,
11028 skipping the byteorder check.
11029
11030 EOM
11031         byteorder='0xffff'
11032         ;;
11033 *)
11034         case "$byteorder" in
11035         '')
11036                 $cat <<'EOM'
11037 In the following, larger digits indicate more significance.  A big-endian
11038 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11039 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11040 machines may have weird orders like 3412.  A Cray will report 87654321,
11041 an Alpha will report 12345678. If the test program works the default is
11042 probably right.
11043 I'm now running the test program...
11044 EOM
11045                 $cat >try.c <<'EOCP'
11046 #include <stdio.h>
11047 int main()
11048 {
11049         int i;
11050         union {
11051                 unsigned long l;
11052                 char c[sizeof(long)];
11053         } u;
11054
11055         if (sizeof(long) > 4)
11056                 u.l = (0x08070605L << 32) | 0x04030201L;
11057         else
11058                 u.l = 0x04030201L;
11059         for (i = 0; i < sizeof(long); i++)
11060                 printf("%c", u.c[i]+'0');
11061         printf("\n");
11062         exit(0);
11063 }
11064 EOCP
11065                 xxx_prompt=y
11066                 set try
11067                 if eval $compile && ./try > /dev/null; then
11068                         dflt=`./try`
11069                         case "$dflt" in
11070                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11071                                 echo "(The test program ran ok.)"
11072                                 echo "byteorder=$dflt"
11073                                 xxx_prompt=n
11074                         ;;
11075                         ????|????????) echo "(The test program ran ok.)" ;;
11076                         *) echo "(The test program didn't run right for some reason.)" ;;
11077                         esac
11078                 else
11079                         dflt='4321'
11080                         cat <<'EOM'
11081 (I can't seem to compile the test program.  Guessing big-endian...)
11082 EOM
11083                 fi
11084                 case "$xxx_prompt" in
11085                 y)
11086                         rp="What is the order of bytes in a long?"
11087                         . ./myread
11088                         byteorder="$ans"
11089                         ;;
11090                 *)      byteorder=$dflt
11091                         ;;
11092                 esac
11093                 ;;
11094         esac
11095         $rm -f try.c try
11096         ;;
11097 esac
11098
11099
11100 : how do we catenate cpp tokens here?
11101 echo " "
11102 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11103 $cat >cpp_stuff.c <<'EOCP'
11104 #define RCAT(a,b)a/**/b
11105 #define ACAT(a,b)a ## b
11106 RCAT(Rei,ser)
11107 ACAT(Cir,cus)
11108 EOCP
11109 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11110 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11111         echo "Oh!  Smells like ANSI's been here." >&4
11112         echo "We can catify or stringify, separately or together!"
11113         cpp_stuff=42
11114 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11115         echo "Ah, yes!  The good old days!" >&4
11116         echo "However, in the good old days we don't know how to stringify and"
11117         echo "catify at the same time."
11118         cpp_stuff=1
11119 else
11120         $cat >&4 <<EOM
11121 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11122 to have to edit the values of CAT[2-5] in config.h...
11123 EOM
11124         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11125 fi
11126 $rm -f cpp_stuff.*
11127
11128 : see if this is a db.h system
11129 set db.h i_db
11130 eval $inhdr
11131
11132 case "$i_db" in
11133 $define)
11134         : Check db version.
11135         echo " "
11136         echo "Checking Berkeley DB version ..." >&4
11137         $cat >try.c <<EOCP
11138 #$d_const HASCONST
11139 #ifndef HASCONST
11140 #define const
11141 #endif
11142 #include <sys/types.h>
11143 #include <stdio.h>
11144 #include <db.h>
11145 int main()
11146 {
11147 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11148     int Major, Minor, Patch ;
11149     unsigned long Version ;
11150     (void)db_version(&Major, &Minor, &Patch) ;
11151     printf("You have Berkeley DB Version 2 or greater\n");
11152
11153     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11154                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11155     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11156                 Major, Minor, Patch) ;
11157
11158     /* check that db.h & libdb are compatible */
11159     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11160         printf("db.h and libdb are incompatible\n") ;
11161         exit(3);        
11162     }
11163
11164     printf("db.h and libdb are compatible\n") ;
11165
11166     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11167                 + DB_VERSION_PATCH ;
11168
11169     /* needs to be >= 2.3.4 */
11170     if (Version < 2003004) {
11171     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11172         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11173         exit(2);        
11174     }
11175
11176     exit(0);
11177 #else
11178 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11179     printf("You have Berkeley DB Version 1\n");
11180     exit(0);    /* DB version < 2: the coast is clear. */
11181 #else
11182     exit(1);    /* <db.h> not Berkeley DB? */
11183 #endif
11184 #endif
11185 }
11186 EOCP
11187         set try
11188         if eval $compile && ./try; then
11189                 echo 'Looks OK.' >&4
11190         else
11191                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11192                 i_db=$undef
11193                 case " $libs " in
11194                 *"-ldb "*)
11195                         : Remove db from list of libraries to use
11196                         echo "Removing unusable -ldb from library list" >&4
11197                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11198                         shift
11199                         libs="$*"
11200                         echo "libs = $libs" >&4
11201                         ;;
11202                 esac
11203         fi
11204         $rm -f try.*
11205         ;;
11206 esac
11207
11208 case "$i_db" in
11209 define)
11210         : Check the return type needed for hash 
11211         echo " "
11212         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11213         $cat >try.c <<EOCP
11214 #$d_const HASCONST
11215 #ifndef HASCONST
11216 #define const
11217 #endif
11218 #include <sys/types.h>
11219 #include <db.h>
11220
11221 #ifndef DB_VERSION_MAJOR
11222 u_int32_t hash_cb (ptr, size)
11223 const void *ptr;
11224 size_t size;
11225 {
11226 }
11227 HASHINFO info;
11228 int main()
11229 {
11230         info.hash = hash_cb;
11231 }
11232 #endif
11233 EOCP
11234         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11235                 if $contains warning try.out >>/dev/null 2>&1 ; then
11236                         db_hashtype='int'
11237                 else
11238                         db_hashtype='u_int32_t'
11239                 fi
11240         else
11241                 : XXX Maybe we should just give up here.
11242                 db_hashtype=u_int32_t
11243                 $cat try.out >&4
11244                 echo "Help:  I can't seem to compile the db test program." >&4
11245                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11246         fi
11247         $rm -f try.*
11248         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11249         ;;
11250 *)      db_hashtype=u_int32_t
11251         ;;
11252 esac
11253 case "$i_db" in
11254 define)
11255         : Check the return type needed for prefix 
11256         echo " "
11257         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11258         cat >try.c <<EOCP
11259 #$d_const HASCONST
11260 #ifndef HASCONST
11261 #define const
11262 #endif
11263 #include <sys/types.h>
11264 #include <db.h>
11265
11266 #ifndef DB_VERSION_MAJOR
11267 size_t prefix_cb (key1, key2)
11268 const DBT *key1;
11269 const DBT *key2;
11270 {
11271 }
11272 BTREEINFO info;
11273 int main()
11274 {
11275         info.prefix = prefix_cb;
11276 }
11277 #endif
11278 EOCP
11279         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11280                 if $contains warning try.out >>/dev/null 2>&1 ; then
11281                         db_prefixtype='int'
11282                 else
11283                         db_prefixtype='size_t'
11284                 fi
11285         else
11286                 db_prefixtype='size_t'
11287                 : XXX Maybe we should just give up here.
11288                 $cat try.out >&4
11289                 echo "Help:  I can't seem to compile the db test program." >&4
11290                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11291         fi
11292         $rm -f try.*
11293         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11294         ;;
11295 *)      db_prefixtype='size_t'
11296         ;;
11297 esac
11298
11299 : check for void type
11300 echo " "
11301 echo "Checking to see how well your C compiler groks the void type..." >&4
11302 case "$voidflags" in
11303 '')
11304         $cat >try.c <<'EOCP'
11305 #if TRY & 1
11306 void sub() {
11307 #else
11308 sub() {
11309 #endif
11310         extern void moo();      /* function returning void */
11311         void (*goo)();          /* ptr to func returning void */
11312 #if TRY & 8
11313         void *hue;              /* generic ptr */
11314 #endif
11315 #if TRY & 2
11316         void (*foo[10])();
11317 #endif
11318
11319 #if TRY & 4
11320         if(goo == moo) {
11321                 exit(0);
11322         }
11323 #endif
11324         exit(0);
11325 }
11326 int main() { sub(); }
11327 EOCP
11328         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11329                 voidflags=$defvoidused
11330         echo "Good.  It appears to support void to the level $package wants.">&4
11331                 if $contains warning .out >/dev/null 2>&1; then
11332                         echo "However, you might get some warnings that look like this:"
11333                         $cat .out
11334                 fi
11335         else
11336 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11337                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11338                         echo "It supports 1..."
11339                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11340                                 echo "It also supports 2..."
11341                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11342                                         voidflags=7
11343                                         echo "And it supports 4 but not 8 definitely."
11344                                 else
11345                                         echo "It doesn't support 4..."
11346                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11347                                                 voidflags=11
11348                                                 echo "But it supports 8."
11349                                         else
11350                                                 voidflags=3
11351                                                 echo "Neither does it support 8."
11352                                         fi
11353                                 fi
11354                         else
11355                                 echo "It does not support 2..."
11356                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11357                                         voidflags=13
11358                                         echo "But it supports 4 and 8."
11359                                 else
11360                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11361                                                 voidflags=5
11362                                                 echo "And it supports 4 but has not heard about 8."
11363                                         else
11364                                                 echo "However it supports 8 but not 4."
11365                                         fi
11366                                 fi
11367                         fi
11368                 else
11369                         echo "There is no support at all for void."
11370                         voidflags=0
11371                 fi
11372         fi
11373 esac
11374 case "$voidflags" in
11375 "$defvoidused") ;;
11376 *)      $cat >&4 <<'EOM'
11377   Support flag bits are:
11378     1: basic void declarations.
11379     2: arrays of pointers to functions returning void.
11380     4: operations between pointers to and addresses of void functions.
11381     8: generic void pointers.
11382 EOM
11383         dflt="$voidflags";
11384         rp="Your void support flags add up to what?"
11385         . ./myread
11386         voidflags="$ans"
11387         ;;
11388 esac
11389 $rm -f try.* .out
11390
11391
11392 : How can we generate normalized random numbers ?
11393 echo " "
11394 echo "Looking for a random number function..." >&4
11395 case "$randfunc" in
11396 '')
11397         if set drand48 val -f; eval $csym; $val; then
11398                 dflt="drand48"
11399                 echo "Good, found drand48()." >&4
11400         elif set random val -f; eval $csym; $val; then
11401                 dflt="random"
11402                 echo "OK, found random()." >&4
11403         else
11404                 dflt="rand"
11405                 echo "Yick, looks like I have to use rand()." >&4
11406         fi
11407         echo " "
11408         ;;
11409 *)
11410         dflt="$randfunc"
11411         ;;
11412 esac
11413 cont=true
11414
11415 case "$ccflags" in
11416 *-Dmy_rand=*|*-Dmy_srand=*)
11417         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11418         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11419         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11420         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11421         ;;
11422 esac
11423
11424 while $test "$cont"; do
11425         rp="Use which function to generate random numbers?"
11426         . ./myread
11427         if $test "$ans" = "$dflt"; then
11428                 : null
11429         else
11430                 randbits=''
11431         fi
11432         randfunc="$ans"
11433         if set $ans val -f; eval $csym; $val; then
11434                 cont=''
11435         else
11436                 dflt=y
11437                 rp="I cannot find function $ans. Use that name anyway?"
11438                 . ./myread
11439                 dflt=rand
11440                 case "$ans" in
11441                         [yY]*) cont='';;
11442                 esac
11443         fi
11444         case "$cont" in
11445         '')
11446                 case "$randfunc" in
11447                 drand48)
11448                         drand01="drand48()"
11449                         seedfunc="srand48"
11450                         randbits=48
11451                         randseedtype=long
11452                         ;;
11453                 rand|random)
11454                         case "$randbits" in
11455                         '')
11456 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11457                                 $cat >try.c <<EOCP
11458 #$i_unistd I_UNISTD
11459 #$i_stdlib I_STDLIB
11460 #include <stdio.h>
11461 #ifdef I_UNISTD
11462 #  include <unistd.h>
11463 #endif
11464 #ifdef I_STDLIB
11465 #  include <stdlib.h>
11466 #endif
11467 int main()
11468 {
11469         register int i;
11470         register unsigned long tmp;
11471         register unsigned long max = 0L;
11472
11473         for (i = 1000; i; i--) {
11474                 tmp = (unsigned long) $randfunc();
11475                 if (tmp > max) max = tmp;
11476         }
11477         for (i = 0; max; i++)
11478                 max /= 2;
11479         printf("%d\n",i);
11480 }
11481 EOCP
11482                                 set try
11483                                 if eval $compile_ok; then
11484                                         dflt=`try`
11485                                 else
11486                                         dflt='?'
11487                                         echo "(I can't seem to compile the test program...)"
11488                                 fi
11489                                 ;;
11490                         *)
11491                                 dflt="$randbits"
11492                                 ;;
11493                         esac
11494                         rp="How many bits does your $randfunc() function produce?"
11495                         . ./myread
11496                         randbits="$ans"
11497                         $rm -f try.c try
11498                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11499                         seedfunc="s$randfunc"
11500                         randseedtype=unsigned
11501                         ;;
11502                 *)
11503                         dflt="31"
11504                         rp="How many bits does your $randfunc() function produce?"
11505                         . ./myread
11506                         randbits="$ans"
11507                         seedfunc="s$randfunc"
11508                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11509                         if set $seedfunc val -f; eval $csym; $val; then
11510                                 echo "(Using $seedfunc() to seed random generator)"
11511                         else
11512                                 echo "(Warning: no $seedfunc() to seed random generator)"
11513                                 seedfunc=rand
11514                         fi
11515                         randseedtype=unsigned
11516                         ;;
11517                 esac
11518                 ;;
11519         esac
11520 done
11521
11522 echo " "
11523 echo "Determining whether or not we are on an EBCDIC system..." >&4
11524 $cat >tebcdic.c <<'EOM'
11525 int main()
11526 {
11527   if ('M'==0xd4) return 0;
11528   return 1;
11529 }
11530 EOM
11531
11532 val=$undef
11533 set tebcdic
11534 if eval $compile_ok; then
11535         if ./tebcdic; then
11536                 echo "You have EBCDIC." >&4
11537                 val="$define"
11538         else
11539                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11540         fi
11541 else
11542         echo "I'm unable to compile the test program." >&4
11543         echo "I'll assume ASCII or some ISO Latin." >&4
11544 fi
11545 $rm -f tebcdic.c tebcdic
11546 set ebcdic
11547 eval $setvar
11548
11549 echo " "
11550 $cat >&4 <<EOM
11551 Checking how to flush all pending stdio output...
11552 EOM
11553 # I only know how to find the first 32 possibly open files on SunOS.
11554 # See also hints/sunos_4_1.sh and util.c  --AD
11555 case "$osname" in
11556 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11557 esac
11558 $cat >>try.c <<EOCP
11559 #include <stdio.h>
11560 #$i_unistd I_UNISTD
11561 #ifdef I_UNISTD
11562 # include <unistd.h>
11563 #endif
11564 #$d_sysconf HAS_SYSCONF
11565 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11566 #ifdef HAS_STDIO_STREAM_ARRAY
11567 # define STDIO_STREAM_ARRAY $stdio_stream_array
11568 #endif
11569 int main() {
11570   FILE* p = fopen("try.out", "w");
11571 #ifdef TRY_FPUTC
11572   fputc('x', p);
11573 #else
11574 # ifdef TRY_FPRINTF
11575   fprintf(p, "x");
11576 # endif
11577 #endif
11578 #ifdef TRY_FFLUSH_NULL
11579   fflush(NULL);
11580 #endif
11581 #ifdef TRY_FFLUSH_ALL
11582   {
11583     long open_max = -1;
11584 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11585     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11586 # else
11587 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11588     open_max = sysconf(_SC_OPEN_MAX);
11589 #  else
11590 #   ifdef FOPEN_MAX
11591     open_max = FOPEN_MAX;
11592 #   else
11593 #    ifdef OPEN_MAX
11594     open_max = OPEN_MAX;
11595 #    else
11596 #     ifdef _NFILE
11597     open_max = _NFILE;
11598 #     endif
11599 #    endif
11600 #   endif
11601 #  endif
11602 # endif 
11603 # ifdef HAS_STDIO_STREAM_ARRAY
11604     if (open_max > 0) {
11605       long i;
11606       for (i = 0; i < open_max; i++)
11607             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11608                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11609                 STDIO_STREAM_ARRAY[i]._flag)
11610                 fflush(&STDIO_STREAM_ARRAY[i]);
11611     }   
11612   }
11613 # endif
11614 #endif
11615   _exit(42);
11616 }
11617 EOCP
11618 : first we have to find out how _not_ to flush
11619 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11620     output=''
11621     set try -DTRY_FPUTC
11622     if eval $compile; then
11623             $rm -f try.out
11624             ./try$exe_ext 2>/dev/null
11625             if $test ! -s try.out -a "X$?" = X42; then
11626                 output=-DTRY_FPUTC
11627             fi
11628     fi
11629     case "$output" in
11630     '')
11631             set try -DTRY_FPRINTF
11632             $rm -f try.out
11633             if eval $compile; then
11634                     $rm -f try.out
11635                     ./try$exe_ext 2>/dev/null
11636                     if $test ! -s try.out -a "X$?" = X42; then
11637                         output=-DTRY_FPRINTF
11638                     fi
11639             fi
11640         ;;
11641     esac
11642 fi
11643 : check for fflush NULL behaviour
11644 case "$fflushNULL" in
11645 '')     set try -DTRY_FFLUSH_NULL $output
11646         if eval $compile; then
11647                 $rm -f try.out
11648                 ./try$exe_ext 2>/dev/null
11649                 code="$?"
11650                 if $test -s try.out -a "X$code" = X42; then
11651                         fflushNULL="`$cat try.out`"
11652                 else
11653                         if $test "X$code" != X42; then
11654                                 $cat >&4 <<EOM
11655 (If this test failed, don't worry, we'll try another method shortly.)
11656 EOM
11657                         fi
11658                 fi
11659         fi
11660         $rm -f core try.core core.try.*
11661         case "$fflushNULL" in
11662         x)      $cat >&4 <<EOM
11663 Your fflush(NULL) works okay.
11664 EOM
11665                 fflushNULL="$define"
11666                 ;;
11667         '')     $cat >&4 <<EOM
11668 Your fflush(NULL) isn't working (contrary to ANSI C).
11669 EOM
11670                 fflushNULL="$undef"
11671                 ;;
11672         *)      $cat >&4 <<EOM
11673 Cannot figure out whether your fflush(NULL) works or not.
11674 I'm assuming it doesn't (contrary to ANSI C).
11675 EOM
11676                 fflushNULL="$undef"
11677                 ;;
11678         esac
11679         ;;
11680 $define|true|[yY]*)
11681         fflushNULL="$define"
11682         ;;
11683 *)
11684         fflushNULL="$undef"
11685         ;;
11686 esac
11687 : check explicit looping only if NULL did not work
11688 case "$fflushNULL" in
11689 "$undef")
11690         : check for fflush all behaviour
11691         case "$fflushall" in
11692         '')     set try -DTRY_FFLUSH_ALL $output
11693                 if eval $compile; then
11694                         $cat >&4 <<EOM
11695 (Now testing the other method--but note that also this may fail.)
11696 EOM
11697                         $rm -f try.out
11698                         ./try$exe_ext 2>/dev/null
11699                         if $test -s try.out -a "X$?" = X42; then
11700                                 fflushall="`$cat try.out`"
11701                         fi
11702                 fi
11703                 $rm -f core try.core core.try.*
11704                 case "$fflushall" in
11705                 x)      $cat >&4 <<EOM
11706 Whew. Flushing explicitly all the stdio streams works.
11707 EOM
11708                         fflushall="$define"
11709                         ;;
11710                 '')     $cat >&4 <<EOM
11711 Sigh. Flushing explicitly all the stdio streams doesn't work.
11712 EOM
11713                         fflushall="$undef"
11714                         ;;
11715                 *)      $cat >&4 <<EOM
11716 Cannot figure out whether flushing stdio streams explicitly works or not.
11717 I'm assuming it doesn't.
11718 EOM
11719                         fflushall="$undef"
11720                         ;;
11721                 esac
11722                 ;;
11723         "$define"|true|[yY]*)
11724                 fflushall="$define"
11725                 ;;
11726         *)
11727                 fflushall="$undef"
11728                 ;;
11729         esac
11730         ;;
11731 *)      fflushall="$undef"      
11732         ;;
11733 esac
11734 case "$fflushNULL$fflushall" in
11735 undefundef)
11736         $cat <<EOM
11737 I cannot figure out how to flush pending stdio output.
11738 EOM
11739         ;;
11740 esac
11741 $rm -f try.* try$exe_ext
11742
11743 : see what type file positions are declared as in the library
11744 rp="What is the type for file position used by fsetpos()?"
11745 set fpos_t fpostype long stdio.h sys/types.h
11746 eval $typedef_ask
11747
11748 : Store the full pathname to the ar program for use in the C program
11749 : Respect a hint or command line value for full_ar.
11750 case "$full_ar" in
11751 '') full_ar=$ar ;;
11752 esac
11753
11754 : Store the full pathname to the sed program for use in the C program
11755 full_sed=$sed
11756
11757 : see what type gids are declared as in the kernel
11758 echo " "
11759 echo "Looking for the type for group ids returned by getgid()."
11760 set gid_t gidtype xxx stdio.h sys/types.h
11761 eval $typedef
11762 case "$gidtype" in
11763 xxx)
11764         xxx=`./findhdr sys/user.h`
11765         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11766         case $1 in
11767         unsigned) dflt="$1 $2" ;;
11768         *) dflt="$1" ;;
11769         esac
11770         ;;
11771 *) dflt="$gidtype";;
11772 esac
11773 case "$gidtype" in
11774 gid_t) echo "gid_t found." ;;
11775 *)      rp="What is the type for group ids returned by getgid()?"
11776         . ./myread
11777         gidtype="$ans"
11778         ;;
11779 esac
11780
11781 : see if getgroups exists
11782 set getgroups d_getgrps
11783 eval $inlibc
11784
11785 : see if setgroups exists
11786 set setgroups d_setgrps
11787 eval $inlibc
11788
11789
11790 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11791 echo " "
11792 case "$d_getgrps$d_setgrps" in
11793 *define*)
11794         case "$groupstype" in
11795         '') dflt="$gidtype" ;;
11796         *)  dflt="$groupstype" ;;
11797         esac
11798         $cat <<EOM
11799 What type of pointer is the second argument to getgroups() and setgroups()?
11800 Usually this is the same as group ids, $gidtype, but not always.
11801
11802 EOM
11803         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11804         . ./myread
11805         groupstype="$ans"
11806         ;;
11807 *)  groupstype="$gidtype";;
11808 esac
11809
11810 : see what type lseek is declared as in the kernel
11811 rp="What is the type used for lseek's offset on this system?"
11812 set off_t lseektype long stdio.h sys/types.h
11813 eval $typedef_ask
11814
11815 echo " "
11816 $echo $n "Checking to see how big your file offsets are...$c" >&4
11817 $cat >try.c <<EOCP
11818 #include <sys/types.h>
11819 #include <stdio.h>
11820 int main()
11821 {
11822         printf("%d\n", sizeof($lseektype));
11823 }
11824 EOCP
11825 set try
11826 if eval $compile_ok; then
11827         lseeksize=`./try`
11828         $echo " $lseeksize bytes." >&4
11829 else
11830         dflt='4'
11831         echo " "
11832         echo "(I can't seem to compile the test program.  Guessing...)"
11833         rp="What is the size of your file offsets (in bytes)?"
11834         . ./myread
11835         lseeksize="$ans"
11836 fi
11837 $rm -f try.c try
11838
11839 echo " "
11840 echo "Checking if your $make program sets \$(MAKE)..." >&4
11841 case "$make_set_make" in
11842 '')
11843         $sed 's/^X //' > testmake.mak << 'EOF'
11844 Xall:
11845 X       @echo 'maketemp="$(MAKE)"'
11846 EOF
11847         case "`$make -f testmake.mak 2>/dev/null`" in
11848         *maketemp=*) make_set_make='#' ;;
11849         *)      make_set_make="MAKE=$make" ;;
11850         esac
11851         $rm -f testmake.mak
11852         ;;
11853 esac
11854 case "$make_set_make" in
11855 '#') echo "Yup, it does.";;
11856 *) echo "Nope, it doesn't.";;
11857 esac
11858
11859 : see what type is used for mode_t
11860 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11861 set mode_t modetype int stdio.h sys/types.h
11862 eval $typedef_ask
11863
11864 : define a fucntion to check prototypes
11865 $cat > protochk <<EOSH
11866 $startsh
11867 cc="$cc"
11868 optimize="$optimize"
11869 ccflags="$ccflags"
11870 prototype="$prototype"
11871 define="$define"
11872 rm=$rm
11873 EOSH
11874
11875 $cat >> protochk <<'EOSH'
11876
11877 $rm -f try.c
11878 foo="$1"
11879 shift
11880 while test $# -ge 2; do
11881         case "$1" in
11882                 $define) echo "#include <$2>" >> try.c ;;
11883                 literal) echo "$2" >> try.c ;;
11884         esac
11885     shift 2
11886 done
11887 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11888 cat >> try.c <<'EOCP'
11889 #ifdef CAN_PROTOTYPE
11890 #define _(args) args
11891 #else
11892 #define _(args) ()
11893 #endif
11894 EOCP
11895 echo "$foo" >> try.c
11896 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11897 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11898 status=$?
11899 $rm -f try.[co]
11900 exit $status
11901 EOSH
11902 chmod +x protochk
11903 $eunicefix protochk
11904
11905 : see what type is used for size_t
11906 rp="What is the type used for the length parameter for string functions?"
11907 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11908 eval $typedef_ask
11909
11910 : check for type of arguments to gethostbyaddr. 
11911 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11912         case "$d_gethbyaddr" in
11913         $define)
11914                 $cat <<EOM
11915
11916 Checking to see what type of arguments are accepted by gethostbyaddr().
11917 EOM
11918                 hdrs="$define sys/types.h
11919                         $d_socket sys/socket.h 
11920                         $i_niin netinet/in.h 
11921                         $i_netdb netdb.h
11922                         $i_unistd unistd.h"
11923                 : The first arg can 'char *' or 'void *'
11924                 : The second arg is some of integral type
11925                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11926                         for yyy in size_t long int; do
11927                                 case "$netdb_host_type" in
11928                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11929                                         if ./protochk "$try" $hdrs; then
11930                                                 echo "Your system accepts $xxx for the first arg."
11931                                                 echo "...and $yyy for the second arg."
11932                                                 netdb_host_type="$xxx"
11933                                                 netdb_hlen_type="$yyy"
11934                                         fi
11935                                         ;;
11936                                 esac
11937                         done
11938                 done
11939                 : In case none of those worked, prompt the user.
11940                 case "$netdb_host_type" in
11941                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11942                         dflt='char *'
11943                         . ./myread
11944                         netdb_host_type=$ans
11945                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11946                         dflt="$sizetype"
11947                         . ./myread
11948                         netdb_hlen_type=$ans
11949                         ;;
11950                 esac
11951                 ;;
11952         *)      : no gethostbyaddr, so pick harmless defaults
11953                 netdb_host_type='char *'
11954                 netdb_hlen_type="$sizetype"
11955                 ;;
11956         esac
11957         # Remove the "const" if needed. -- but then we'll have a 
11958         # prototype clash!
11959         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11960 fi
11961
11962 : check for type of argument to gethostbyname. 
11963 if test "X$netdb_name_type" = X ; then
11964         case "$d_gethbyname" in
11965         $define)
11966                 $cat <<EOM
11967
11968 Checking to see what type of argument is accepted by gethostbyname().
11969 EOM
11970                 hdrs="$define sys/types.h
11971                         $d_socket sys/socket.h 
11972                         $i_niin netinet/in.h 
11973                         $i_netdb netdb.h
11974                         $i_unistd unistd.h"
11975                 for xxx in "const char *" "char *"; do
11976                         case "$netdb_name_type" in
11977                         '')     try="extern struct hostent *gethostbyname($xxx);"
11978                                 if ./protochk "$try" $hdrs; then
11979                                         echo "Your system accepts $xxx."
11980                                         netdb_name_type="$xxx"
11981                                 fi
11982                                 ;;
11983                         esac
11984                 done
11985                 : In case none of those worked, prompt the user.
11986                 case "$netdb_name_type" in
11987                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11988                         dflt='char *'
11989                         . ./myread
11990                         netdb_name_type=$ans
11991                         ;;
11992                 esac
11993                 ;;
11994         *)      : no gethostbyname, so pick harmless default
11995                 netdb_name_type='char *'
11996                 ;;
11997         esac
11998 fi
11999
12000 : check for type of 1st argument to getnetbyaddr. 
12001 if test "X$netdb_net_type" = X ; then
12002         case "$d_getnbyaddr" in
12003         $define)
12004                 $cat <<EOM
12005
12006 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12007 EOM
12008                 hdrs="$define sys/types.h
12009                         $d_socket sys/socket.h 
12010                         $i_niin netinet/in.h 
12011                         $i_netdb netdb.h
12012                         $i_unistd unistd.h"
12013                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12014                         case "$netdb_net_type" in
12015                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12016                                 if ./protochk "$try" $hdrs; then
12017                                         echo "Your system accepts $xxx."
12018                                         netdb_net_type="$xxx"
12019                                 fi
12020                                 ;;
12021                         esac
12022                 done
12023                 : In case none of those worked, prompt the user.
12024                 case "$netdb_net_type" in
12025                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12026                         dflt='long'
12027                         . ./myread
12028                         netdb_net_type=$ans
12029                         ;;
12030                 esac
12031                 ;;
12032         *)      : no getnetbyaddr, so pick harmless default
12033                 netdb_net_type='long'
12034                 ;;
12035         esac
12036 fi
12037 : locate the preferred pager for this system
12038 case "$pager" in
12039 '')
12040         dflt=''
12041         case "$pg" in
12042         /*) dflt=$pg;;
12043         esac
12044         case "$more" in
12045         /*) dflt=$more;;
12046         esac
12047         case "$less" in
12048         /*) dflt=$less;;
12049         esac
12050         case "$dflt" in
12051         '') dflt=/usr/ucb/more;;
12052         esac
12053         ;;
12054 *) dflt="$pager";;
12055 esac
12056 echo " "
12057 fn=f/
12058 rp='What pager is used on your system?'
12059 . ./getfile
12060 pager="$ans"
12061
12062 : see what type pids are declared as in the kernel
12063 rp="What is the type of process ids on this system?"
12064 set pid_t pidtype int stdio.h sys/types.h
12065 eval $typedef_ask
12066
12067 : Find earliest binary compatible site_perl subdirectory perl can use.
12068 case "$bincompat5005" in
12069 "$define") xs_apiversion='5.005' ;;
12070 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12071 esac
12072 : Find earliest pure perl site_perl subdirectory perl can use.
12073 : The versioned directories started at 5.005.
12074 pm_apiversion='5.005'
12075
12076 : check for length of pointer
12077 echo " "
12078 case "$ptrsize" in
12079 '')
12080         $echo $n "Checking to see how big your pointers are...$c" >&4
12081         if test "$voidflags" -gt 7; then
12082                 echo '#define VOID_PTR char *' > try.c
12083         else
12084                 echo '#define VOID_PTR void *' > try.c
12085         fi
12086         $cat >>try.c <<'EOCP'
12087 #include <stdio.h>
12088 int main()
12089 {
12090         printf("%d\n", sizeof(VOID_PTR));
12091         exit(0);
12092 }
12093 EOCP
12094         set try
12095         if eval $compile_ok; then
12096                 ptrsize=`./try`
12097                 $echo " $ptrsize bytes." >&4
12098         else
12099                 dflt='4'
12100                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12101                 rp="What is the size of a pointer (in bytes)?"
12102                 . ./myread
12103                 ptrsize="$ans"
12104         fi
12105         ;;
12106 esac
12107 $rm -f try.c try
12108
12109 : see if ar generates random libraries by itself
12110 echo " "
12111 echo "Checking how to generate random libraries on your machine..." >&4
12112 echo 'int bar1() { return bar2(); }' > bar1.c
12113 echo 'int bar2() { return 2; }' > bar2.c
12114 $cat > foo.c <<'EOP'
12115 int main() { printf("%d\n", bar1()); exit(0); }
12116 EOP
12117 $cc $ccflags -c bar1.c >/dev/null 2>&1
12118 $cc $ccflags -c bar2.c >/dev/null 2>&1
12119 $cc $ccflags -c foo.c >/dev/null 2>&1
12120 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12121 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12122         ./foobar >/dev/null 2>&1; then
12123         echo "$ar appears to generate random libraries itself."
12124         orderlib=false
12125         ranlib=":"
12126 elif $ar ts bar$_a >/dev/null 2>&1 &&
12127         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12128         ./foobar >/dev/null 2>&1; then
12129                 echo "a table of contents needs to be added with '$ar ts'."
12130                 orderlib=false
12131                 ranlib="$ar ts"
12132 else
12133         case "$ranlib" in
12134         :) ranlib='';;
12135         '')
12136                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12137                 $test -f $ranlib || ranlib=''
12138                 ;;
12139         esac
12140         if $test -n "$ranlib"; then
12141                 echo "your system has '$ranlib'; we'll use that."
12142                 orderlib=false
12143         else
12144                 echo "your system doesn't seem to support random libraries"
12145                 echo "so we'll use lorder and tsort to order the libraries."
12146                 orderlib=true
12147                 ranlib=":"
12148         fi
12149 fi
12150 $rm -f foo* bar* 
12151
12152 : check for type of arguments to select. 
12153 case "$selecttype" in
12154 '') case "$d_select" in
12155         $define)
12156                 $cat <<EOM
12157 Checking to see what type of arguments are accepted by select().
12158 EOM
12159                 hdrs="$define sys/types.h
12160                         $i_systime sys/time.h 
12161                         $i_sysselct sys/select.h
12162                         $d_socket sys/socket.h"
12163                 : The first arg can be int, unsigned, or size_t
12164                 : The last arg may or may not be 'const'
12165                 val=''
12166                 : void pointer has been seen but using that
12167                 : breaks the selectminbits test
12168                 for xxx in 'fd_set *' 'int *'; do
12169                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12170                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12171                                         case "$val" in
12172                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12173                                                 if ./protochk "$try" $hdrs; then
12174                                                         echo "Your system accepts $xxx."
12175                                                         val="$xxx"
12176                                                 fi
12177                                                 ;;
12178                                         esac
12179                                 done
12180                         done
12181                 done
12182                 case "$val" in
12183                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12184                         case "$d_fd_set" in
12185                                 $define) dflt="fd_set *" ;;
12186                                 *)              dflt="int *" ;;
12187                         esac
12188                         . ./myread
12189                         val=$ans
12190                         ;;
12191                 esac
12192                 selecttype="$val"
12193                 ;;
12194         *)      : no select, so pick a harmless default
12195                 selecttype='int *'
12196                 ;;
12197         esac
12198         ;;
12199 esac
12200
12201 : check for the select 'width'
12202 case "$selectminbits" in
12203 '') case "$d_select" in
12204         $define)
12205                 $cat <<EOM
12206
12207 Checking to see on how many bits at a time your select() operates...
12208 EOM
12209                 $cat >try.c <<EOCP
12210 #include <sys/types.h>
12211 #$i_time I_TIME
12212 #$i_systime I_SYS_TIME
12213 #$i_systimek I_SYS_TIME_KERNEL
12214 #ifdef I_TIME
12215 #   include <time.h>
12216 #endif
12217 #ifdef I_SYS_TIME
12218 #   ifdef I_SYS_TIME_KERNEL
12219 #       define KERNEL
12220 #   endif
12221 #   include <sys/time.h>
12222 #   ifdef I_SYS_TIME_KERNEL
12223 #       undef KERNEL
12224 #   endif
12225 #endif
12226 #$i_sysselct I_SYS_SELECT
12227 #ifdef I_SYS_SELECT
12228 #include <sys/select.h>
12229 #endif
12230 #$d_socket HAS_SOCKET
12231 #ifdef HAS_SOCKET
12232 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12233 #endif
12234 #include <stdio.h>
12235 $selecttype b;
12236 #define S sizeof(*(b))
12237 #define MINBITS 64
12238 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12239 #define NBITS  (NBYTES * 8)
12240 int main() {
12241     char s[NBYTES];
12242     struct timeval t;
12243     int i;
12244     FILE* fp;
12245     int fd;
12246
12247     fclose(stdin);
12248     fp = fopen("try.c", "r");
12249     if (fp == 0)
12250       exit(1);
12251     fd = fileno(fp);
12252     if (fd < 0)
12253       exit(2);
12254     b = ($selecttype)s;
12255     for (i = 0; i < NBITS; i++)
12256         FD_SET(i, b);
12257     t.tv_sec  = 0;
12258     t.tv_usec = 0;
12259     select(fd + 1, b, 0, 0, &t);
12260     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12261     printf("%d\n", i + 1);
12262     return 0;
12263 }
12264 EOCP
12265                 set try
12266                 if eval $compile_ok; then
12267                         selectminbits=`./try`
12268                         case "$selectminbits" in
12269                         '')     cat >&4 <<EOM
12270 Cannot figure out on how many bits at a time your select() operates.
12271 I'll play safe and guess it is 32 bits.
12272 EOM
12273                                 selectminbits=32
12274                                 bits="32 bits"
12275                                 ;;
12276                         1)      bits="1 bit" ;;
12277                         *)      bits="$selectminbits bits" ;;
12278                         esac
12279                         echo "Your select() operates on $bits at a time." >&4
12280                 else
12281                         rp='What is the minimum number of bits your select() operates on?'
12282                         case "$byteorder" in
12283                         1234|12345678)  dflt=32 ;;
12284                         *)              dflt=1  ;;
12285                         esac
12286                         . ./myread
12287                         val=$ans
12288                         selectminbits="$val"
12289                 fi
12290                 $rm -f try.* try
12291                 ;;
12292         *)      : no select, so pick a harmless default
12293                 selectminbits='32'
12294                 ;;
12295         esac
12296         ;;
12297 esac
12298
12299 : Trace out the files included by signal.h, then look for SIGxxx names.
12300 : Remove SIGARRAYSIZE used by HPUX.
12301 : Remove SIGSTKSIZE used by Linux.
12302 : Remove SIGSTKSZ used by Posix.
12303 : Remove SIGTYP void lines used by OS2.
12304 xxx=`echo '#include <signal.h>' |
12305         $cppstdin $cppminus $cppflags 2>/dev/null |
12306         $grep '^[       ]*#.*include' | 
12307         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12308 : Check this list of files to be sure we have parsed the cpp output ok.
12309 : This will also avoid potentially non-existent files, such 
12310 : as ../foo/bar.h
12311 xxxfiles=''
12312 for xx in $xxx /dev/null ; do
12313         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12314 done
12315 : If we have found no files, at least try signal.h
12316 case "$xxxfiles" in
12317 '')     xxxfiles=`./findhdr signal.h` ;;
12318 esac
12319 xxx=`awk '
12320 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12321         print substr($2, 4, 20)
12322 }
12323 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12324         print substr($3, 4, 20)
12325 }' $xxxfiles`
12326 : Append some common names just in case the awk scan failed.
12327 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12328 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12329 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12330 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12331 : generate a few handy files for later
12332 $cat > signal.c <<'EOCP'
12333 #include <sys/types.h>
12334 #include <signal.h>
12335 #include <stdio.h>
12336 int main() {
12337
12338 /* Strange style to avoid deeply-nested #if/#else/#endif */
12339 #ifndef NSIG
12340 #  ifdef _NSIG
12341 #    define NSIG (_NSIG)
12342 #  endif
12343 #endif
12344
12345 #ifndef NSIG
12346 #  ifdef SIGMAX
12347 #    define NSIG (SIGMAX+1)
12348 #  endif
12349 #endif
12350
12351 #ifndef NSIG
12352 #  ifdef SIG_MAX
12353 #    define NSIG (SIG_MAX+1)
12354 #  endif
12355 #endif
12356
12357 #ifndef NSIG
12358 #  ifdef MAXSIG
12359 #    define NSIG (MAXSIG+1)
12360 #  endif
12361 #endif
12362
12363 #ifndef NSIG
12364 #  ifdef MAX_SIG
12365 #    define NSIG (MAX_SIG+1)
12366 #  endif
12367 #endif
12368
12369 #ifndef NSIG
12370 #  ifdef SIGARRAYSIZE
12371 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12372 #  endif
12373 #endif
12374
12375 #ifndef NSIG
12376 #  ifdef _sys_nsig
12377 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12378 #  endif
12379 #endif
12380
12381 /* Default to some arbitrary number that's big enough to get most
12382    of the common signals.
12383 */
12384 #ifndef NSIG
12385 #    define NSIG 50
12386 #endif
12387
12388 printf("NSIG %d\n", NSIG);
12389
12390 #ifndef JUST_NSIG
12391
12392 EOCP
12393
12394 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12395 {
12396         printf "#ifdef SIG"; printf $1; printf "\n"
12397         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12398         printf $1; printf ");\n"
12399         printf "#endif\n"
12400 }
12401 END {
12402         printf "#endif /* JUST_NSIG */\n";
12403         printf "}\n";
12404 }
12405 ' >>signal.c
12406 $cat >signal.awk <<'EOP'
12407 BEGIN { ndups = 0 }
12408 $1 ~ /^NSIG$/ { nsig = $2 }
12409 ($1 !~ /^NSIG$/) && (NF == 2) {
12410     if ($2 > maxsig) { maxsig = $2 }
12411     if (sig_name[$2]) {
12412         dup_name[ndups] = $1
12413         dup_num[ndups] = $2
12414         ndups++ 
12415     }
12416     else {
12417         sig_name[$2] = $1
12418         sig_num[$2] = $2
12419     }
12420 }
12421 END { 
12422     if (nsig == 0) {
12423         nsig = maxsig + 1
12424     }
12425     printf("NSIG %d\n", nsig);
12426     for (n = 1; n < nsig; n++) {
12427         if (sig_name[n]) {
12428             printf("%s %d\n", sig_name[n], sig_num[n])
12429         }
12430         else {
12431             printf("NUM%d %d\n", n, n) 
12432         }
12433     }
12434     for (n = 0; n < ndups; n++) {
12435         printf("%s %d\n", dup_name[n], dup_num[n])
12436     }
12437 }
12438 EOP
12439 $cat >signal_cmd <<EOS
12440 $startsh
12441 if $test -s signal.lst; then
12442     echo "Using your existing signal.lst file"
12443         exit 0
12444 fi
12445 xxx="$xxx"
12446 EOS
12447 $cat >>signal_cmd <<'EOS'
12448
12449 set signal
12450 if eval $compile_ok; then
12451         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12452 else
12453         echo "(I can't seem be able to compile the whole test program)" >&4
12454         echo "(I'll try it in little pieces.)" >&4
12455         set signal -DJUST_NSIG
12456         if eval $compile_ok; then
12457                 ./signal$_exe > signal.nsg
12458                 $cat signal.nsg
12459         else
12460                 echo "I can't seem to figure out how many signals you have." >&4
12461                 echo "Guessing 50." >&4
12462                 echo 'NSIG 50' > signal.nsg
12463         fi
12464         : Now look at all the signal names, one at a time.
12465         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12466                 $cat > signal.c <<EOCP
12467 #include <sys/types.h>
12468 #include <signal.h>
12469 #include <stdio.h>
12470 int main() {
12471 printf("$xx %d\n", SIG${xx});
12472 return 0;
12473 }
12474 EOCP
12475                 set signal
12476                 if eval $compile; then
12477                         echo "SIG${xx} found."
12478                         ./signal$_exe  >> signal.ls1
12479                 else
12480                         echo "SIG${xx} NOT found."
12481                 fi
12482         done
12483         if $test -s signal.ls1; then
12484                 $cat signal.nsg signal.ls1 |
12485                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12486         fi
12487
12488 fi
12489 if $test -s signal.lst; then
12490         :
12491 else
12492         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12493         echo 'kill -l' >signal
12494         set X `csh -f <signal`
12495         $rm -f signal
12496         shift
12497         case $# in
12498         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12499         esac
12500         echo $@ | $tr ' ' $trnl | \
12501             $awk '{ printf "%s %d\n", $1, ++s; }
12502                   END { printf "NSIG %d\n", ++s }' >signal.lst
12503 fi
12504 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12505 EOS
12506 chmod a+x signal_cmd
12507 $eunicefix signal_cmd
12508
12509 : generate list of signal names
12510 echo " "
12511 case "$sig_name_init" in
12512 '') doinit=yes ;;
12513 *)  case "$sig_num_init" in
12514     ''|*,*) doinit=yes ;;
12515     esac ;;
12516 esac
12517 case "$doinit" in
12518 yes)
12519         echo "Generating a list of signal names and numbers..." >&4
12520         . ./signal_cmd
12521         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12522         sig_name=`$awk 'BEGIN { printf "ZERO " }
12523                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12524         sig_num=`$awk  'BEGIN { printf "0 " }
12525                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12526         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12527                              !/^NSIG/   { printf "\"%s\", ", $1 }
12528                              END        { printf "0\n" }' signal.lst`
12529         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12530                              !/^NSIG/   { printf "%d, ", $2}
12531                              END        { printf "0\n"}' signal.lst`
12532         ;;
12533 esac
12534 echo "The following $sig_count signals are available:"
12535 echo " "
12536 echo $sig_name | $awk \
12537 'BEGIN { linelen = 0 }
12538 {
12539         for (i = 1; i <= NF; i++) {
12540                 name = "SIG" $i " "
12541                 linelen = linelen + length(name)
12542                 if (linelen > 70) {
12543                         printf "\n"
12544                         linelen = length(name)
12545                 }
12546                 printf "%s", name
12547         }
12548         printf "\n"
12549 }'
12550 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12551
12552 : see what type is used for signed size_t
12553 set ssize_t ssizetype int stdio.h sys/types.h
12554 eval $typedef
12555 dflt="$ssizetype"
12556 $cat > ssize.c <<EOM
12557 #include <stdio.h>
12558 #include <sys/types.h>
12559 #define Size_t $sizetype
12560 #define SSize_t $dflt
12561 int main()
12562 {
12563         if (sizeof(Size_t) == sizeof(SSize_t))
12564                 printf("$dflt\n");
12565         else if (sizeof(Size_t) == sizeof(int))
12566                 printf("int\n");
12567         else 
12568                 printf("long\n");
12569         exit(0);
12570 }
12571 EOM
12572 echo " "
12573 set ssize
12574 if eval $compile_ok && ./ssize > /dev/null; then
12575         ssizetype=`./ssize`
12576         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12577 else
12578         $cat >&4 <<EOM
12579 Help! I can't compile and run the ssize_t test program: please enlighten me!
12580 (This is probably a misconfiguration in your system or libraries, and
12581 you really ought to fix it.  Still, I'll try anyway.)
12582
12583 I need a type that is the same size as $sizetype, but is guaranteed to
12584 be signed.  Common values are ssize_t, int and long.
12585
12586 EOM
12587         rp="What signed type is the same size as $sizetype?"
12588         . ./myread
12589         ssizetype="$ans"
12590 fi
12591 $rm -f ssize ssize.*
12592
12593 : see what type of char stdio uses.
12594 echo " "
12595 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12596         echo "Your stdio uses unsigned chars." >&4
12597         stdchar="unsigned char"
12598 else
12599         echo "Your stdio uses signed chars." >&4
12600         stdchar="char"
12601 fi
12602
12603 : see if time exists
12604 echo " "
12605 if test "X$d_time" = X -o X"$timetype" = X; then
12606     if set time val -f d_time; eval $csym; $val; then
12607                 echo 'time() found.' >&4
12608                 val="$define"
12609                 rp="What is the type returned by time() on this system?"
12610                 set time_t timetype long stdio.h sys/types.h
12611                 eval $typedef_ask
12612     else
12613                 echo 'time() not found, hope that will do.' >&4
12614                 val="$undef"
12615                 timetype='int';
12616     fi
12617     set d_time
12618     eval $setvar
12619 fi
12620
12621 : see what type uids are declared as in the kernel
12622 echo " "
12623 echo "Looking for the type for user ids returned by getuid()."
12624 set uid_t uidtype xxx stdio.h sys/types.h
12625 eval $typedef
12626 case "$uidtype" in
12627 xxx)
12628         xxx=`./findhdr sys/user.h`
12629         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12630         case $1 in
12631         unsigned) dflt="$1 $2" ;;
12632         *) dflt="$1" ;;
12633         esac
12634         ;;
12635 *) dflt="$uidtype";;
12636 esac
12637 case "$uidtype" in
12638 uid_t)  echo "uid_t found." ;;
12639 *)      rp="What is the type for user ids returned by getuid()?"
12640         . ./myread
12641         uidtype="$ans"
12642         ;;
12643 esac
12644
12645 echo " "
12646 case "$uidtype" in
12647 *_t) zzz="$uidtype"     ;;
12648 *)   zzz="uid"          ;;
12649 esac
12650 echo "Checking the sign of $zzz..." >&4
12651 cat > try.c <<EOCP
12652 #include <sys/types.h>
12653 #include <stdio.h>
12654 int main() {
12655         $uidtype foo = -1;
12656         if (foo < 0)
12657                 printf("-1\n");
12658         else
12659                 printf("1\n");
12660 }
12661 EOCP
12662 set try
12663 if eval $compile; then
12664         yyy=`./try`
12665         case "$yyy" in
12666         '')     uidsign=1
12667                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12668                 ;;
12669         *)      uidsign=$yyy
12670                 case "$uidsign" in
12671                  1) echo "Your $zzz is unsigned." ;;
12672                 -1) echo "Your $zzz is signed."   ;;
12673                 esac
12674                 ;;
12675         esac
12676 else
12677         uidsign=1
12678         echo "(I can't compile the test program--guessing unsigned.)" >&4
12679 fi
12680
12681
12682 : see if dbm.h is available
12683 : see if dbmclose exists
12684 set dbmclose d_dbmclose
12685 eval $inlibc
12686
12687 case "$d_dbmclose" in
12688 $define)
12689         set dbm.h i_dbm
12690         eval $inhdr
12691         case "$i_dbm" in
12692         $define)
12693                 val="$undef"
12694                 set i_rpcsvcdbm
12695                 eval $setvar
12696                 ;;
12697         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12698                 eval $inhdr
12699                 ;;
12700         esac
12701         ;;
12702 *)      echo "We won't be including <dbm.h>"
12703         val="$undef"
12704         set i_dbm
12705         eval $setvar
12706         val="$undef"
12707         set i_rpcsvcdbm
12708         eval $setvar
12709         ;;
12710 esac
12711
12712 : see if this is a sys/file.h system
12713 val=''
12714 set sys/file.h val
12715 eval $inhdr
12716
12717 : do we need to include sys/file.h ?
12718 case "$val" in
12719 "$define")
12720         echo " "
12721         if $h_sysfile; then
12722                 val="$define"
12723                 echo "We'll be including <sys/file.h>." >&4
12724         else
12725                 val="$undef"
12726                 echo "We won't be including <sys/file.h>." >&4
12727         fi
12728         ;;
12729 *)
12730         h_sysfile=false
12731         ;;
12732 esac
12733 set i_sysfile
12734 eval $setvar
12735
12736 : see if fcntl.h is there
12737 val=''
12738 set fcntl.h val
12739 eval $inhdr
12740
12741 : see if we can include fcntl.h
12742 case "$val" in
12743 "$define")
12744         echo " "
12745         if $h_fcntl; then
12746                 val="$define"
12747                 echo "We'll be including <fcntl.h>." >&4
12748         else
12749                 val="$undef"
12750                 if $h_sysfile; then
12751         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12752                 else
12753                         echo "We won't be including <fcntl.h>." >&4
12754                 fi
12755         fi
12756         ;;
12757 *)
12758         h_fcntl=false
12759         val="$undef"
12760         ;;
12761 esac
12762 set i_fcntl
12763 eval $setvar
12764
12765 : see if locale.h is available
12766 set locale.h i_locale
12767 eval $inhdr
12768
12769 : see if mach cthreads are available
12770 if test "X$usethreads" = "X$define"; then
12771         set mach/cthreads.h i_machcthr
12772         eval $inhdr
12773 else
12774         i_machcthr="$undef"
12775 fi
12776
12777
12778
12779 : see if this is a math.h system
12780 set math.h i_math
12781 eval $inhdr
12782
12783 : see if this is a mntent.h system
12784 set mntent.h i_mntent
12785 eval $inhdr
12786
12787 : see if ndbm.h is available
12788 set ndbm.h t_ndbm
12789 eval $inhdr
12790 case "$t_ndbm" in
12791 $define)
12792         : see if dbm_open exists
12793         set dbm_open d_dbm_open
12794         eval $inlibc
12795         case "$d_dbm_open" in
12796         $undef)
12797                 t_ndbm="$undef"
12798                 echo "We won't be including <ndbm.h>"
12799                 ;;
12800         esac
12801         ;;
12802 esac
12803 val="$t_ndbm"
12804 set i_ndbm
12805 eval $setvar
12806
12807 : see if net/errno.h is available
12808 val=''
12809 set net/errno.h val
12810 eval $inhdr
12811
12812 : Unfortunately, it causes problems on some systems.  Arrgh.
12813 case "$val" in
12814 $define)
12815         cat > try.c <<'EOM'
12816 #include <stdio.h>
12817 #include <errno.h>
12818 #include <net/errno.h>
12819 int func()
12820 {
12821         return ENOTSOCK;
12822 }
12823 EOM
12824         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12825                 echo "We'll be including <net/errno.h>." >&4
12826         else
12827                 echo "We won't be including <net/errno.h>." >&4
12828                 val="$undef"
12829         fi
12830         $rm -f try.* try
12831         ;;
12832 esac
12833 set i_neterrno
12834 eval $setvar
12835
12836 : see if netinet/tcp.h is available
12837 set netinet/tcp.h i_netinettcp
12838 eval $inhdr
12839
12840 : see if this is a poll.h system
12841 set poll.h i_poll
12842 eval $inhdr
12843
12844 : get C preprocessor symbols handy
12845 echo " "
12846 $echo $n "Hmm... $c"
12847 echo $al | $tr ' ' $trnl >Cppsym.know
12848 $cat <<EOSS >Cppsym
12849 $startsh
12850 case "\$1" in
12851 -l) list=true
12852         shift
12853         ;;
12854 esac
12855 unknown=''
12856 case "\$list\$#" in
12857 1|2)
12858         for sym do
12859                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12860                         exit 0
12861                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12862                         :
12863                 else
12864                         unknown="\$unknown \$sym"
12865                 fi
12866         done
12867         set X \$unknown
12868         shift
12869         ;;
12870 esac
12871 case \$# in
12872 0) exit 1;;
12873 esac
12874 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12875 #ifdef \1\\
12876 exit 0; _ _ _ _\1\\      \1\\
12877 #endif\\
12878 /' >Cppsym\$\$
12879 echo "exit 1; _ _ _" >>Cppsym\$\$
12880 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12881 case "\$list" in
12882 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12883 *)
12884         sh Cppsym2\$\$
12885         status=\$?
12886         ;;
12887 esac
12888 $rm -f Cppsym\$\$ Cppsym2\$\$
12889 exit \$status
12890 EOSS
12891 chmod +x Cppsym
12892 $eunicefix Cppsym
12893 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12894
12895 : now check the C compiler for additional symbols
12896 postprocess_cc_v=''
12897 case "$osname" in
12898 aix) postprocess_cc_v="|$tr , ' '" ;;
12899 esac
12900 $cat >ccsym <<EOS
12901 $startsh
12902 $cat >tmp.c <<EOF
12903 extern int foo;
12904 EOF
12905 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12906 do
12907         case "\$i" in
12908         -D*) echo "\$i" | $sed 's/^-D//';;
12909         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12910         esac
12911 done
12912 $rm -f try.c
12913 EOS
12914 postprocess_cc_v=''
12915 chmod +x ccsym
12916 $eunicefix ccsym
12917 ./ccsym > ccsym1.raw
12918 if $test -s ccsym1.raw; then
12919        $sort ccsym1.raw | $uniq >ccsym.raw
12920 else
12921        mv ccsym1.raw ccsym.raw
12922 fi
12923
12924 $awk '/\=/ { print $0; next }
12925         { print $0"=1" }' ccsym.raw >ccsym.list
12926 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12927 $comm -13 ccsym.true ccsym.list >ccsym.own
12928 $comm -12 ccsym.true ccsym.list >ccsym.com
12929 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12930 also=''
12931 if $test -z ccsym.raw; then
12932         echo "Your C compiler doesn't seem to define any symbols!" >&4
12933         echo " "
12934         echo "However, your C preprocessor defines the following symbols:"
12935         $cat Cppsym.true
12936         ccsymbols=''
12937         cppsymbols=`$cat Cppsym.true`
12938         cppsymbols=`echo $cppsymbols`
12939         cppccsymbols="$cppsymbols"
12940 else
12941         if $test -s ccsym.com; then
12942                 echo "Your C compiler and pre-processor define these symbols:"
12943                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12944                 also='also '
12945                 symbols='ones'
12946                 cppccsymbols=`$cat ccsym.com`
12947                 cppccsymbols=`echo $cppccsymbols`
12948                 $test "$silent" || sleep 1
12949         fi
12950         if $test -s ccsym.cpp; then
12951                 $test "$also" && echo " "
12952                 echo "Your C pre-processor ${also}defines the following symbols:"
12953                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12954                 also='further '
12955                 cppsymbols=`$cat ccsym.cpp`
12956                 cppsymbols=`echo $cppsymbols`
12957                 $test "$silent" || sleep 1
12958         fi
12959         if $test -s ccsym.own; then
12960                 $test "$also" && echo " "
12961                 echo "Your C compiler ${also}defines the following cpp symbols:"
12962                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12963                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12964                 ccsymbols=`$cat ccsym.own`
12965                 ccsymbols=`echo $ccsymbols`
12966                 $test "$silent" || sleep 1
12967         fi
12968 fi
12969 $rm -f ccsym*
12970
12971 : see if this is a termio system
12972 val="$undef"
12973 val2="$undef"
12974 val3="$undef"
12975 if $test `./findhdr termios.h`; then
12976         set tcsetattr i_termios
12977         eval $inlibc
12978         val3="$i_termios"
12979 fi
12980 echo " "
12981 case "$val3" in
12982 "$define") echo "You have POSIX termios.h... good!" >&4;;
12983 *) if ./Cppsym pyr; then
12984                 case "`/bin/universe`" in
12985                 ucb) if $test `./findhdr sgtty.h`; then
12986                                 val2="$define"
12987                                 echo "<sgtty.h> found." >&4
12988                         else
12989                                 echo "System is pyramid with BSD universe."
12990                                 echo "<sgtty.h> not found--you could have problems." >&4
12991                         fi;;
12992                 *) if $test `./findhdr termio.h`; then
12993                                 val="$define"
12994                                 echo "<termio.h> found." >&4
12995                         else
12996                                 echo "System is pyramid with USG universe."
12997                                 echo "<termio.h> not found--you could have problems." >&4
12998                         fi;;
12999                 esac
13000         elif ./usg; then
13001                 if $test `./findhdr termio.h`; then
13002                         echo "<termio.h> found." >&4
13003                         val="$define"
13004                 elif $test `./findhdr sgtty.h`; then
13005                         echo "<sgtty.h> found." >&4
13006                         val2="$define"
13007                 else
13008 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13009                 fi
13010         else
13011                 if $test `./findhdr sgtty.h`; then
13012                         echo "<sgtty.h> found." >&4
13013                         val2="$define"
13014                 elif $test `./findhdr termio.h`; then
13015                         echo "<termio.h> found." >&4
13016                         val="$define"
13017                 else
13018 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13019                 fi
13020         fi;;
13021 esac
13022 set i_termio; eval $setvar
13023 val=$val2; set i_sgtty; eval $setvar
13024 val=$val3; set i_termios; eval $setvar
13025
13026 : see if this is a shadow.h system
13027 set shadow.h i_shadow
13028 eval $inhdr
13029
13030 : see if this is a socks.h system
13031 set socks.h i_socks
13032 eval $inhdr
13033
13034 : see if stdarg is available
13035 echo " "
13036 if $test `./findhdr stdarg.h`; then
13037         echo "<stdarg.h> found." >&4
13038         valstd="$define"
13039 else
13040         echo "<stdarg.h> NOT found." >&4
13041         valstd="$undef"
13042 fi
13043
13044 : see if varags is available
13045 echo " "
13046 if $test `./findhdr varargs.h`; then
13047         echo "<varargs.h> found." >&4
13048 else
13049         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13050 fi
13051
13052 : set up the varargs testing programs
13053 $cat > varargs.c <<EOP
13054 #ifdef I_STDARG
13055 #include <stdarg.h>
13056 #endif
13057 #ifdef I_VARARGS
13058 #include <varargs.h>
13059 #endif
13060
13061 #ifdef I_STDARG
13062 int f(char *p, ...)
13063 #else
13064 int f(va_alist)
13065 va_dcl
13066 #endif
13067 {
13068         va_list ap;
13069 #ifndef I_STDARG
13070         char *p;
13071 #endif
13072 #ifdef I_STDARG
13073         va_start(ap,p);
13074 #else
13075         va_start(ap);
13076         p = va_arg(ap, char *);
13077 #endif
13078         va_end(ap);
13079 }
13080 EOP
13081 $cat > varargs <<EOP
13082 $startsh
13083 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13084         echo "true"
13085 else
13086         echo "false"
13087 fi
13088 $rm -f varargs$_o
13089 EOP
13090 chmod +x varargs
13091
13092 : now check which varargs header should be included
13093 echo " "
13094 i_varhdr=''
13095 case "$valstd" in
13096 "$define")
13097         if `./varargs I_STDARG`; then
13098                 val='stdarg.h'
13099         elif `./varargs I_VARARGS`; then
13100                 val='varargs.h'
13101         fi
13102         ;;
13103 *)
13104         if `./varargs I_VARARGS`; then
13105                 val='varargs.h'
13106         fi
13107         ;;
13108 esac
13109 case "$val" in
13110 '')
13111 echo "I could not find the definition for va_dcl... You have problems..." >&4
13112         val="$undef"; set i_stdarg; eval $setvar
13113         val="$undef"; set i_varargs; eval $setvar
13114         ;;
13115 *) 
13116         set i_varhdr
13117         eval $setvar
13118         case "$i_varhdr" in
13119         stdarg.h)
13120                 val="$define"; set i_stdarg; eval $setvar
13121                 val="$undef"; set i_varargs; eval $setvar
13122                 ;;
13123         varargs.h)
13124                 val="$undef"; set i_stdarg; eval $setvar
13125                 val="$define"; set i_varargs; eval $setvar
13126                 ;;
13127         esac
13128         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13129 esac
13130 $rm -f varargs*
13131
13132 : see if stddef is available
13133 set stddef.h i_stddef
13134 eval $inhdr
13135
13136 : see if sys/access.h is available
13137 set sys/access.h i_sysaccess
13138 eval $inhdr
13139
13140 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13141 set sys/filio.h i_sysfilio
13142 eval $inhdr
13143 echo " "
13144 if $test `./findhdr sys/ioctl.h`; then
13145         val="$define"
13146         echo '<sys/ioctl.h> found.' >&4
13147 else
13148         val="$undef"
13149         if $test $i_sysfilio = "$define"; then
13150             echo '<sys/ioctl.h> NOT found.' >&4
13151         else
13152                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13153                 $test $i_termio = "$define" && xxx="termio.h"
13154                 $test $i_termios = "$define" && xxx="termios.h"
13155 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13156         fi
13157 fi
13158 set i_sysioctl
13159 eval $setvar
13160
13161 : see if sys/resource.h has to be included
13162 set sys/resource.h i_sysresrc
13163 eval $inhdr
13164
13165 : see if sys/security.h is available
13166 set sys/security.h i_syssecrt
13167 eval $inhdr
13168
13169 : see if this is a sys/statvfs.h system
13170 set sys/statvfs.h i_sysstatvfs
13171 eval $inhdr
13172
13173 : see if this is a sys/un.h system
13174 set sys/un.h i_sysun
13175 eval $inhdr
13176
13177 : see if this is a syswait system
13178 set sys/wait.h i_syswait
13179 eval $inhdr
13180
13181 : see if this is a ustat.h system
13182 set ustat.h i_ustat
13183 eval $inhdr
13184
13185 : see if this is an utime system
13186 set utime.h i_utime
13187 eval $inhdr
13188
13189 : see if this is a values.h system
13190 set values.h i_values
13191 eval $inhdr
13192
13193 : see if this is a vfork system
13194 case "$d_vfork" in
13195 "$define")
13196         set vfork.h i_vfork
13197         eval $inhdr
13198         ;;
13199 *)
13200         i_vfork="$undef"
13201         ;;
13202 esac
13203
13204 : see if gdbm.h is available
13205 set gdbm.h t_gdbm
13206 eval $inhdr
13207 case "$t_gdbm" in
13208 $define)
13209         : see if gdbm_open exists
13210         set gdbm_open d_gdbm_open
13211         eval $inlibc
13212         case "$d_gdbm_open" in
13213         $undef)
13214                 t_gdbm="$undef"
13215                 echo "We won't be including <gdbm.h>"
13216                 ;;
13217         esac
13218         ;;
13219 esac
13220 val="$t_gdbm"
13221 set i_gdbm
13222 eval $setvar
13223
13224 echo " "
13225 echo "Looking for extensions..." >&4
13226 : If we are using the old config.sh, known_extensions may contain
13227 : old or inaccurate or duplicate values.
13228 known_extensions=''
13229 nonxs_extensions=''
13230 : We do not use find because it might not be available.
13231 : We do not just use MANIFEST because the user may have dropped
13232 : some additional extensions into the source tree and expect them
13233 : to be built.
13234
13235 : Function to recursively find available extensions, ignoring DynaLoader
13236 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13237 find_extensions='
13238     for xxx in *; do
13239        case "$xxx" in
13240            DynaLoader|dynaload) ;;
13241            *)
13242            if $test -f $xxx/$xxx.xs; then
13243                known_extensions="$known_extensions $1$xxx";
13244            elif $test -f $xxx/Makefile.PL; then
13245                nonxs_extensions="$nonxs_extensions $1$xxx";
13246            else
13247                if $test -d $xxx -a $# -lt 10; then
13248                    set $1$xxx/ $*;
13249                    cd $xxx;
13250                    eval $find_extensions;
13251                    cd ..;
13252                    shift;
13253                fi;
13254            fi
13255            ;;
13256        esac;
13257     done'
13258 tdir=`pwd`
13259 cd $rsrc/ext
13260 set X
13261 shift
13262 eval $find_extensions
13263 set X $nonxs_extensions
13264 shift
13265 nonxs_extensions="$*"
13266 set X $known_extensions
13267 shift
13268 known_extensions="$*"
13269 cd $tdir
13270
13271 : Now see which are supported on this system.
13272 avail_ext=''
13273 for xxx in $known_extensions ; do
13274         case "$xxx" in
13275         DB_File|db_file)
13276                 case "$i_db" in
13277                 $define) avail_ext="$avail_ext $xxx" ;;
13278                 esac
13279                 ;;
13280         GDBM_File|gdbm_fil)
13281                 case "$i_gdbm" in 
13282                 $define) avail_ext="$avail_ext $xxx" ;;
13283                 esac
13284                 ;;
13285         NDBM_File|ndbm_fil)
13286                 case "$i_ndbm" in
13287                 $define) avail_ext="$avail_ext $xxx" ;;
13288                 esac
13289                 ;;
13290         ODBM_File|odbm_fil) 
13291                 case "${i_dbm}${i_rpcsvcdbm}" in
13292                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13293                 esac
13294                 ;;
13295         POSIX|posix)
13296                 case "$useposix" in
13297                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13298                 esac
13299                 ;;
13300         Opcode|opcode)
13301                 case "$useopcode" in
13302                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13303                 esac
13304                 ;;
13305         Socket|socket)
13306                 case "$d_socket" in 
13307                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13308                 esac
13309                 ;;
13310         Thread|thread)
13311                 case "$usethreads" in 
13312                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13313                 esac
13314                 ;;
13315         IPC/SysV|ipc/sysv)
13316                 : XXX Do we need a useipcsysv variable here
13317                 case "${d_msg}${d_sem}${d_shm}" in 
13318                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13319                 esac
13320                 ;;
13321         *)      avail_ext="$avail_ext $xxx"
13322                 ;;
13323         esac
13324 done
13325
13326 set X $avail_ext
13327 shift
13328 avail_ext="$*"
13329
13330 : Now see which nonxs extensions are supported on this system.
13331 : For now assume all are.
13332 nonxs_ext=''
13333 for xxx in $nonxs_extensions ; do
13334         case "$xxx" in
13335         *)      nonxs_ext="$nonxs_ext $xxx"
13336                 ;;
13337         esac
13338 done
13339
13340 set X $nonxs_ext
13341 shift
13342 nonxs_ext="$*"
13343
13344 case $usedl in
13345 $define)
13346         $cat <<EOM
13347 A number of extensions are supplied with $package.  You may choose to
13348 compile these extensions for dynamic loading (the default), compile
13349 them into the $package executable (static loading), or not include
13350 them at all.  Answer "none" to include no extensions.
13351 Note that DynaLoader is always built and need not be mentioned here.
13352
13353 EOM
13354         case "$dynamic_ext" in
13355         '') dflt="$avail_ext" ;;
13356         *)      dflt="$dynamic_ext"
13357                 # Perhaps we are reusing an old out-of-date config.sh.
13358                 case "$hint" in
13359                 previous)
13360                         if test X"$dynamic_ext" != X"$avail_ext"; then
13361                                 $cat <<EOM
13362 NOTICE:  Your previous config.sh list may be incorrect. 
13363 The extensions now available to you are 
13364         ${avail_ext}
13365 but the default list from your previous config.sh is
13366         ${dynamic_ext} 
13367
13368 EOM
13369                         fi
13370                         ;;
13371                 esac
13372                 ;;
13373         esac
13374         case "$dflt" in
13375         '')     dflt=none;;
13376         esac
13377         rp="What extensions do you wish to load dynamically?"
13378         . ./myread
13379         case "$ans" in
13380         none) dynamic_ext=' ' ;;
13381         *) dynamic_ext="$ans" ;;
13382         esac
13383
13384         case "$static_ext" in
13385         '')
13386                 : Exclude those already listed in dynamic linking
13387                 dflt=''
13388                 for xxx in $avail_ext; do
13389                         case " $dynamic_ext " in
13390                         *" $xxx "*) ;;
13391                         *) dflt="$dflt $xxx" ;;
13392                         esac
13393                 done
13394                 set X $dflt
13395                 shift
13396                 dflt="$*"
13397                 ;;
13398         *)  dflt="$static_ext" 
13399                 ;;
13400         esac
13401
13402         case "$dflt" in
13403         '')     dflt=none;;
13404         esac
13405         rp="What extensions do you wish to load statically?"
13406         . ./myread
13407         case "$ans" in
13408         none) static_ext=' ' ;;
13409         *) static_ext="$ans" ;;
13410         esac
13411         ;;
13412 *)
13413         $cat <<EOM
13414 A number of extensions are supplied with $package.  Answer "none" 
13415 to include no extensions. 
13416 Note that DynaLoader is always built and need not be mentioned here.
13417
13418 EOM
13419         case "$static_ext" in
13420         '') dflt="$avail_ext" ;;
13421         *)      dflt="$static_ext"
13422                 # Perhaps we are reusing an old out-of-date config.sh.
13423                 case "$hint" in
13424                 previous)
13425                         if test X"$static_ext" != X"$avail_ext"; then
13426                                 $cat <<EOM
13427 NOTICE:  Your previous config.sh list may be incorrect. 
13428 The extensions now available to you are 
13429         ${avail_ext}
13430 but the default list from your previous config.sh is
13431         ${static_ext} 
13432
13433 EOM
13434                         fi
13435                         ;;
13436                 esac
13437                 ;;
13438         esac
13439         : Exclude those that are not xs extensions
13440         case "$dflt" in
13441         '')     dflt=none;;
13442         esac
13443         rp="What extensions do you wish to include?"
13444         . ./myread
13445         case "$ans" in
13446         none) static_ext=' ' ;;
13447         *) static_ext="$ans" ;;
13448         esac
13449         ;;
13450 esac
13451
13452 set X $dynamic_ext $static_ext $nonxs_ext
13453 shift
13454 extensions="$*"
13455
13456 : Remove build directory name from cppstdin so it can be used from
13457 : either the present location or the final installed location.
13458 echo " "
13459 : Get out of the UU directory to get correct path name.
13460 cd ..
13461 case "$cppstdin" in
13462 `pwd`/cppstdin)
13463         echo "Stripping down cppstdin path name"
13464         cppstdin=cppstdin
13465         ;;
13466 esac
13467 cd UU
13468
13469 : end of configuration questions
13470 echo " "
13471 echo "End of configuration questions."
13472 echo " "
13473
13474 : back to where it started
13475 if test -d ../UU; then
13476         cd ..
13477 fi
13478
13479 : configuration may be patched via a 'config.over' file
13480 if $test -f config.over; then
13481         echo " "
13482         dflt=y
13483         rp='I see a config.over file.  Do you wish to load it?'
13484         . UU/myread
13485         case "$ans" in
13486         n*) echo "OK, I'll ignore it.";;
13487         *)      . ./config.over
13488                 echo "Configuration override changes have been loaded."
13489                 ;;
13490         esac
13491 fi
13492
13493 : in case they want portability, strip down executable paths
13494 case "$d_portable" in
13495 "$define")
13496         echo " "
13497         echo "Stripping down executable paths..." >&4
13498         for file in $loclist $trylist; do
13499                 eval temp=\$$file
13500                 eval $file=`basename $temp`
13501         done
13502         ;;
13503 esac
13504
13505 : create config.sh file
13506 echo " "
13507 echo "Creating config.sh..." >&4
13508 $spitshell <<EOT >config.sh
13509 $startsh
13510 #
13511 # This file was produced by running the Configure script. It holds all the
13512 # definitions figured out by Configure. Should you modify one of these values,
13513 # do not forget to propagate your changes by running "Configure -der". You may
13514 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13515 #
13516
13517 # Package name      : $package
13518 # Source directory  : $src
13519 # Configuration time: $cf_time
13520 # Configured by     : $cf_by
13521 # Target system     : $myuname
13522
13523 Author='$Author'
13524 Date='$Date'
13525 Header='$Header'
13526 Id='$Id'
13527 Locker='$Locker'
13528 Log='$Log'
13529 Mcc='$Mcc'
13530 RCSfile='$RCSfile'
13531 Revision='$Revision'
13532 Source='$Source'
13533 State='$State'
13534 _a='$_a'
13535 _exe='$_exe'
13536 _o='$_o'
13537 afs='$afs'
13538 alignbytes='$alignbytes'
13539 ansi2knr='$ansi2knr'
13540 aphostname='$aphostname'
13541 apiversion='$apiversion'
13542 ar='$ar'
13543 archlib='$archlib'
13544 archlibexp='$archlibexp'
13545 archname64='$archname64'
13546 archname='$archname'
13547 archobjs='$archobjs'
13548 awk='$awk'
13549 baserev='$baserev'
13550 bash='$bash'
13551 bin='$bin'
13552 bincompat5005='$bincompat5005'
13553 binexp='$binexp'
13554 bison='$bison'
13555 byacc='$byacc'
13556 byteorder='$byteorder'
13557 c='$c'
13558 castflags='$castflags'
13559 cat='$cat'
13560 cc='$cc'
13561 cccdlflags='$cccdlflags'
13562 ccdlflags='$ccdlflags'
13563 ccflags='$ccflags'
13564 ccsymbols='$ccsymbols'
13565 cf_by='$cf_by'
13566 cf_email='$cf_email'
13567 cf_time='$cf_time'
13568 chgrp='$chgrp'
13569 chmod='$chmod'
13570 chown='$chown'
13571 clocktype='$clocktype'
13572 comm='$comm'
13573 compress='$compress'
13574 contains='$contains'
13575 cp='$cp'
13576 cpio='$cpio'
13577 cpp='$cpp'
13578 cpp_stuff='$cpp_stuff'
13579 cppccsymbols='$cppccsymbols'
13580 cppflags='$cppflags'
13581 cpplast='$cpplast'
13582 cppminus='$cppminus'
13583 cpprun='$cpprun'
13584 cppstdin='$cppstdin'
13585 cppsymbols='$cppsymbols'
13586 crosscompile='$crosscompile'
13587 cryptlib='$cryptlib'
13588 csh='$csh'
13589 d_Gconvert='$d_Gconvert'
13590 d_PRIEldbl='$d_PRIEldbl'
13591 d_PRIFldbl='$d_PRIFldbl'
13592 d_PRIGldbl='$d_PRIGldbl'
13593 d_PRIX64='$d_PRIX64'
13594 d_PRId64='$d_PRId64'
13595 d_PRIeldbl='$d_PRIeldbl'
13596 d_PRIfldbl='$d_PRIfldbl'
13597 d_PRIgldbl='$d_PRIgldbl'
13598 d_PRIi64='$d_PRIi64'
13599 d_PRIo64='$d_PRIo64'
13600 d_PRIu64='$d_PRIu64'
13601 d_PRIx64='$d_PRIx64'
13602 d_access='$d_access'
13603 d_accessx='$d_accessx'
13604 d_alarm='$d_alarm'
13605 d_archlib='$d_archlib'
13606 d_atolf='$d_atolf'
13607 d_atoll='$d_atoll'
13608 d_attribut='$d_attribut'
13609 d_bcmp='$d_bcmp'
13610 d_bcopy='$d_bcopy'
13611 d_bincompat5005='$d_bincompat5005'
13612 d_bsd='$d_bsd'
13613 d_bsdgetpgrp='$d_bsdgetpgrp'
13614 d_bsdsetpgrp='$d_bsdsetpgrp'
13615 d_bzero='$d_bzero'
13616 d_casti32='$d_casti32'
13617 d_castneg='$d_castneg'
13618 d_charvspr='$d_charvspr'
13619 d_chown='$d_chown'
13620 d_chroot='$d_chroot'
13621 d_chsize='$d_chsize'
13622 d_closedir='$d_closedir'
13623 d_cmsghdr_s='$d_cmsghdr_s'
13624 d_const='$d_const'
13625 d_crypt='$d_crypt'
13626 d_csh='$d_csh'
13627 d_cuserid='$d_cuserid'
13628 d_dbl_dig='$d_dbl_dig'
13629 d_difftime='$d_difftime'
13630 d_dirnamlen='$d_dirnamlen'
13631 d_dlerror='$d_dlerror'
13632 d_dlopen='$d_dlopen'
13633 d_dlsymun='$d_dlsymun'
13634 d_dosuid='$d_dosuid'
13635 d_drand48proto='$d_drand48proto'
13636 d_dup2='$d_dup2'
13637 d_eaccess='$d_eaccess'
13638 d_endgrent='$d_endgrent'
13639 d_endhent='$d_endhent'
13640 d_endnent='$d_endnent'
13641 d_endpent='$d_endpent'
13642 d_endpwent='$d_endpwent'
13643 d_endsent='$d_endsent'
13644 d_endspent='$d_endspent'
13645 d_eofnblk='$d_eofnblk'
13646 d_eunice='$d_eunice'
13647 d_fchmod='$d_fchmod'
13648 d_fchown='$d_fchown'
13649 d_fcntl='$d_fcntl'
13650 d_fd_macros='$d_fd_macros'
13651 d_fd_set='$d_fd_set'
13652 d_fds_bits='$d_fds_bits'
13653 d_fgetpos='$d_fgetpos'
13654 d_flexfnam='$d_flexfnam'
13655 d_flock='$d_flock'
13656 d_fork='$d_fork'
13657 d_fpathconf='$d_fpathconf'
13658 d_fpos64_t='$d_fpos64_t'
13659 d_fs_data_s='$d_fs_data_s'
13660 d_fseeko='$d_fseeko'
13661 d_fsetpos='$d_fsetpos'
13662 d_fstatfs='$d_fstatfs'
13663 d_fstatvfs='$d_fstatvfs'
13664 d_ftello='$d_ftello'
13665 d_ftime='$d_ftime'
13666 d_getgrent='$d_getgrent'
13667 d_getgrps='$d_getgrps'
13668 d_gethbyaddr='$d_gethbyaddr'
13669 d_gethbyname='$d_gethbyname'
13670 d_gethent='$d_gethent'
13671 d_gethname='$d_gethname'
13672 d_gethostprotos='$d_gethostprotos'
13673 d_getlogin='$d_getlogin'
13674 d_getmnt='$d_getmnt'
13675 d_getmntent='$d_getmntent'
13676 d_getnbyaddr='$d_getnbyaddr'
13677 d_getnbyname='$d_getnbyname'
13678 d_getnent='$d_getnent'
13679 d_getnetprotos='$d_getnetprotos'
13680 d_getpbyname='$d_getpbyname'
13681 d_getpbynumber='$d_getpbynumber'
13682 d_getpent='$d_getpent'
13683 d_getpgid='$d_getpgid'
13684 d_getpgrp2='$d_getpgrp2'
13685 d_getpgrp='$d_getpgrp'
13686 d_getppid='$d_getppid'
13687 d_getprior='$d_getprior'
13688 d_getprotoprotos='$d_getprotoprotos'
13689 d_getpwent='$d_getpwent'
13690 d_getsbyname='$d_getsbyname'
13691 d_getsbyport='$d_getsbyport'
13692 d_getsent='$d_getsent'
13693 d_getservprotos='$d_getservprotos'
13694 d_getspent='$d_getspent'
13695 d_getspnam='$d_getspnam'
13696 d_gettimeod='$d_gettimeod'
13697 d_gnulibc='$d_gnulibc'
13698 d_grpasswd='$d_grpasswd'
13699 d_hasmntopt='$d_hasmntopt'
13700 d_htonl='$d_htonl'
13701 d_index='$d_index'
13702 d_inetaton='$d_inetaton'
13703 d_int64t='$d_int64t'
13704 d_iovec_s='$d_iovec_s'
13705 d_isascii='$d_isascii'
13706 d_killpg='$d_killpg'
13707 d_lchown='$d_lchown'
13708 d_ldbl_dig='$d_ldbl_dig'
13709 d_link='$d_link'
13710 d_llseek='$d_llseek'
13711 d_locconv='$d_locconv'
13712 d_lockf='$d_lockf'
13713 d_longdbl='$d_longdbl'
13714 d_longlong='$d_longlong'
13715 d_lstat='$d_lstat'
13716 d_madvise='$d_madvise'
13717 d_mblen='$d_mblen'
13718 d_mbstowcs='$d_mbstowcs'
13719 d_mbtowc='$d_mbtowc'
13720 d_memchr='$d_memchr'
13721 d_memcmp='$d_memcmp'
13722 d_memcpy='$d_memcpy'
13723 d_memmove='$d_memmove'
13724 d_memset='$d_memset'
13725 d_mkdir='$d_mkdir'
13726 d_mkfifo='$d_mkfifo'
13727 d_mktime='$d_mktime'
13728 d_mmap='$d_mmap'
13729 d_mprotect='$d_mprotect'
13730 d_msg='$d_msg'
13731 d_msg_ctrunc='$d_msg_ctrunc'
13732 d_msg_dontroute='$d_msg_dontroute'
13733 d_msg_oob='$d_msg_oob'
13734 d_msg_peek='$d_msg_peek'
13735 d_msg_proxy='$d_msg_proxy'
13736 d_msgctl='$d_msgctl'
13737 d_msgget='$d_msgget'
13738 d_msghdr_s='$d_msghdr_s'
13739 d_msgrcv='$d_msgrcv'
13740 d_msgsnd='$d_msgsnd'
13741 d_msync='$d_msync'
13742 d_munmap='$d_munmap'
13743 d_mymalloc='$d_mymalloc'
13744 d_nice='$d_nice'
13745 d_off64_t='$d_off64_t'
13746 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13747 d_oldpthreads='$d_oldpthreads'
13748 d_oldsock='$d_oldsock'
13749 d_open3='$d_open3'
13750 d_pathconf='$d_pathconf'
13751 d_pause='$d_pause'
13752 d_phostname='$d_phostname'
13753 d_pipe='$d_pipe'
13754 d_poll='$d_poll'
13755 d_portable='$d_portable'
13756 d_pthread_yield='$d_pthread_yield'
13757 d_pwage='$d_pwage'
13758 d_pwchange='$d_pwchange'
13759 d_pwclass='$d_pwclass'
13760 d_pwcomment='$d_pwcomment'
13761 d_pwexpire='$d_pwexpire'
13762 d_pwgecos='$d_pwgecos'
13763 d_pwpasswd='$d_pwpasswd'
13764 d_pwquota='$d_pwquota'
13765 d_readdir='$d_readdir'
13766 d_readlink='$d_readlink'
13767 d_readv='$d_readv'
13768 d_recvmsg='$d_recvmsg'
13769 d_rename='$d_rename'
13770 d_rewinddir='$d_rewinddir'
13771 d_rmdir='$d_rmdir'
13772 d_safebcpy='$d_safebcpy'
13773 d_safemcpy='$d_safemcpy'
13774 d_sanemcmp='$d_sanemcmp'
13775 d_sched_yield='$d_sched_yield'
13776 d_scm_rights='$d_scm_rights'
13777 d_seekdir='$d_seekdir'
13778 d_select='$d_select'
13779 d_sem='$d_sem'
13780 d_semctl='$d_semctl'
13781 d_semctl_semid_ds='$d_semctl_semid_ds'
13782 d_semctl_semun='$d_semctl_semun'
13783 d_semget='$d_semget'
13784 d_semop='$d_semop'
13785 d_sendmsg='$d_sendmsg'
13786 d_setegid='$d_setegid'
13787 d_seteuid='$d_seteuid'
13788 d_setgrent='$d_setgrent'
13789 d_setgrps='$d_setgrps'
13790 d_sethent='$d_sethent'
13791 d_setlinebuf='$d_setlinebuf'
13792 d_setlocale='$d_setlocale'
13793 d_setnent='$d_setnent'
13794 d_setpent='$d_setpent'
13795 d_setpgid='$d_setpgid'
13796 d_setpgrp2='$d_setpgrp2'
13797 d_setpgrp='$d_setpgrp'
13798 d_setprior='$d_setprior'
13799 d_setpwent='$d_setpwent'
13800 d_setregid='$d_setregid'
13801 d_setresgid='$d_setresgid'
13802 d_setresuid='$d_setresuid'
13803 d_setreuid='$d_setreuid'
13804 d_setrgid='$d_setrgid'
13805 d_setruid='$d_setruid'
13806 d_setsent='$d_setsent'
13807 d_setsid='$d_setsid'
13808 d_setspent='$d_setspent'
13809 d_setvbuf='$d_setvbuf'
13810 d_sfio='$d_sfio'
13811 d_shm='$d_shm'
13812 d_shmat='$d_shmat'
13813 d_shmatprototype='$d_shmatprototype'
13814 d_shmctl='$d_shmctl'
13815 d_shmdt='$d_shmdt'
13816 d_shmget='$d_shmget'
13817 d_sigaction='$d_sigaction'
13818 d_sigsetjmp='$d_sigsetjmp'
13819 d_socket='$d_socket'
13820 d_sockpair='$d_sockpair'
13821 d_sqrtl='$d_sqrtl'
13822 d_statblks='$d_statblks'
13823 d_statfs_f_flags='$d_statfs_f_flags'
13824 d_statfs_s='$d_statfs_s'
13825 d_statvfs='$d_statvfs'
13826 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13827 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13828 d_stdio_stream_array='$d_stdio_stream_array'
13829 d_stdiobase='$d_stdiobase'
13830 d_stdstdio='$d_stdstdio'
13831 d_strchr='$d_strchr'
13832 d_strcoll='$d_strcoll'
13833 d_strctcpy='$d_strctcpy'
13834 d_strerrm='$d_strerrm'
13835 d_strerror='$d_strerror'
13836 d_strtod='$d_strtod'
13837 d_strtol='$d_strtol'
13838 d_strtoul='$d_strtoul'
13839 d_strtoull='$d_strtoull'
13840 d_strxfrm='$d_strxfrm'
13841 d_suidsafe='$d_suidsafe'
13842 d_symlink='$d_symlink'
13843 d_syscall='$d_syscall'
13844 d_sysconf='$d_sysconf'
13845 d_sysernlst='$d_sysernlst'
13846 d_syserrlst='$d_syserrlst'
13847 d_system='$d_system'
13848 d_tcgetpgrp='$d_tcgetpgrp'
13849 d_tcsetpgrp='$d_tcsetpgrp'
13850 d_telldir='$d_telldir'
13851 d_telldirproto='$d_telldirproto'
13852 d_time='$d_time'
13853 d_times='$d_times'
13854 d_truncate='$d_truncate'
13855 d_tzname='$d_tzname'
13856 d_umask='$d_umask'
13857 d_uname='$d_uname'
13858 d_union_semun='$d_union_semun'
13859 d_ustat='$d_ustat'
13860 d_vendorbin='$d_vendorbin'
13861 d_vendorlib='$d_vendorlib'
13862 d_vfork='$d_vfork'
13863 d_void_closedir='$d_void_closedir'
13864 d_voidsig='$d_voidsig'
13865 d_voidtty='$d_voidtty'
13866 d_volatile='$d_volatile'
13867 d_vprintf='$d_vprintf'
13868 d_wait4='$d_wait4'
13869 d_waitpid='$d_waitpid'
13870 d_wcstombs='$d_wcstombs'
13871 d_wctomb='$d_wctomb'
13872 d_writev='$d_writev'
13873 d_xenix='$d_xenix'
13874 date='$date'
13875 db_hashtype='$db_hashtype'
13876 db_prefixtype='$db_prefixtype'
13877 defvoidused='$defvoidused'
13878 direntrytype='$direntrytype'
13879 dlext='$dlext'
13880 dlsrc='$dlsrc'
13881 doublesize='$doublesize'
13882 drand01='$drand01'
13883 dynamic_ext='$dynamic_ext'
13884 eagain='$eagain'
13885 ebcdic='$ebcdic'
13886 echo='$echo'
13887 egrep='$egrep'
13888 emacs='$emacs'
13889 eunicefix='$eunicefix'
13890 exe_ext='$exe_ext'
13891 expr='$expr'
13892 extensions='$extensions'
13893 fflushNULL='$fflushNULL'
13894 fflushall='$fflushall'
13895 find='$find'
13896 firstmakefile='$firstmakefile'
13897 flex='$flex'
13898 fpostype='$fpostype'
13899 freetype='$freetype'
13900 full_ar='$full_ar'
13901 full_csh='$full_csh'
13902 full_sed='$full_sed'
13903 gccversion='$gccversion'
13904 gidtype='$gidtype'
13905 glibpth='$glibpth'
13906 grep='$grep'
13907 groupcat='$groupcat'
13908 groupstype='$groupstype'
13909 gzip='$gzip'
13910 h_fcntl='$h_fcntl'
13911 h_sysfile='$h_sysfile'
13912 hint='$hint'
13913 hostcat='$hostcat'
13914 huge='$huge'
13915 i_arpainet='$i_arpainet'
13916 i_bsdioctl='$i_bsdioctl'
13917 i_db='$i_db'
13918 i_dbm='$i_dbm'
13919 i_dirent='$i_dirent'
13920 i_dld='$i_dld'
13921 i_dlfcn='$i_dlfcn'
13922 i_fcntl='$i_fcntl'
13923 i_float='$i_float'
13924 i_gdbm='$i_gdbm'
13925 i_grp='$i_grp'
13926 i_inttypes='$i_inttypes'
13927 i_limits='$i_limits'
13928 i_locale='$i_locale'
13929 i_machcthr='$i_machcthr'
13930 i_malloc='$i_malloc'
13931 i_math='$i_math'
13932 i_memory='$i_memory'
13933 i_mntent='$i_mntent'
13934 i_ndbm='$i_ndbm'
13935 i_netdb='$i_netdb'
13936 i_neterrno='$i_neterrno'
13937 i_netinettcp='$i_netinettcp'
13938 i_niin='$i_niin'
13939 i_poll='$i_poll'
13940 i_pthread='$i_pthread'
13941 i_pwd='$i_pwd'
13942 i_rpcsvcdbm='$i_rpcsvcdbm'
13943 i_sfio='$i_sfio'
13944 i_sgtty='$i_sgtty'
13945 i_shadow='$i_shadow'
13946 i_socks='$i_socks'
13947 i_stdarg='$i_stdarg'
13948 i_stddef='$i_stddef'
13949 i_stdlib='$i_stdlib'
13950 i_string='$i_string'
13951 i_sysaccess='$i_sysaccess'
13952 i_sysdir='$i_sysdir'
13953 i_sysfile='$i_sysfile'
13954 i_sysfilio='$i_sysfilio'
13955 i_sysin='$i_sysin'
13956 i_sysioctl='$i_sysioctl'
13957 i_sysmman='$i_sysmman'
13958 i_sysmount='$i_sysmount'
13959 i_sysndir='$i_sysndir'
13960 i_sysparam='$i_sysparam'
13961 i_sysresrc='$i_sysresrc'
13962 i_syssecrt='$i_syssecrt'
13963 i_sysselct='$i_sysselct'
13964 i_syssockio='$i_syssockio'
13965 i_sysstat='$i_sysstat'
13966 i_sysstatfs='$i_sysstatfs'
13967 i_sysstatvfs='$i_sysstatvfs'
13968 i_systime='$i_systime'
13969 i_systimek='$i_systimek'
13970 i_systimes='$i_systimes'
13971 i_systypes='$i_systypes'
13972 i_sysuio='$i_sysuio'
13973 i_sysun='$i_sysun'
13974 i_sysvfs='$i_sysvfs'
13975 i_syswait='$i_syswait'
13976 i_termio='$i_termio'
13977 i_termios='$i_termios'
13978 i_time='$i_time'
13979 i_unistd='$i_unistd'
13980 i_ustat='$i_ustat'
13981 i_utime='$i_utime'
13982 i_values='$i_values'
13983 i_varargs='$i_varargs'
13984 i_varhdr='$i_varhdr'
13985 i_vfork='$i_vfork'
13986 ignore_versioned_solibs='$ignore_versioned_solibs'
13987 incpath='$incpath'
13988 inews='$inews'
13989 installarchlib='$installarchlib'
13990 installbin='$installbin'
13991 installman1dir='$installman1dir'
13992 installman3dir='$installman3dir'
13993 installprefix='$installprefix'
13994 installprefixexp='$installprefixexp'
13995 installprivlib='$installprivlib'
13996 installscript='$installscript'
13997 installsitearch='$installsitearch'
13998 installsitebin='$installsitebin'
13999 installsitelib='$installsitelib'
14000 installstyle='$installstyle'
14001 installusrbinperl='$installusrbinperl'
14002 installvendorbin='$installvendorbin'
14003 installvendorlib='$installvendorlib'
14004 intsize='$intsize'
14005 known_extensions='$known_extensions'
14006 ksh='$ksh'
14007 large='$large'
14008 ld='$ld'
14009 lddlflags='$lddlflags'
14010 ldflags='$ldflags'
14011 ldlibpthname='$ldlibpthname'
14012 less='$less'
14013 lib_ext='$lib_ext'
14014 libc='$libc'
14015 libperl='$libperl'
14016 libpth='$libpth'
14017 libs='$libs'
14018 libswanted='$libswanted'
14019 line='$line'
14020 lint='$lint'
14021 lkflags='$lkflags'
14022 ln='$ln'
14023 lns='$lns'
14024 locincpth='$locincpth'
14025 loclibpth='$loclibpth'
14026 longdblsize='$longdblsize'
14027 longlongsize='$longlongsize'
14028 longsize='$longsize'
14029 lp='$lp'
14030 lpr='$lpr'
14031 ls='$ls'
14032 lseeksize='$lseeksize'
14033 lseektype='$lseektype'
14034 mail='$mail'
14035 mailx='$mailx'
14036 make='$make'
14037 make_set_make='$make_set_make'
14038 mallocobj='$mallocobj'
14039 mallocsrc='$mallocsrc'
14040 malloctype='$malloctype'
14041 man1dir='$man1dir'
14042 man1direxp='$man1direxp'
14043 man1ext='$man1ext'
14044 man3dir='$man3dir'
14045 man3direxp='$man3direxp'
14046 man3ext='$man3ext'
14047 medium='$medium'
14048 mips_type='$mips_type'
14049 mkdir='$mkdir'
14050 mmaptype='$mmaptype'
14051 models='$models'
14052 modetype='$modetype'
14053 more='$more'
14054 multiarch='$multiarch'
14055 mv='$mv'
14056 myarchname='$myarchname'
14057 mydomain='$mydomain'
14058 myhostname='$myhostname'
14059 myuname='$myuname'
14060 n='$n'
14061 netdb_hlen_type='$netdb_hlen_type'
14062 netdb_host_type='$netdb_host_type'
14063 netdb_name_type='$netdb_name_type'
14064 netdb_net_type='$netdb_net_type'
14065 nm='$nm'
14066 nm_opt='$nm_opt'
14067 nm_so_opt='$nm_so_opt'
14068 nonxs_ext='$nonxs_ext'
14069 nroff='$nroff'
14070 o_nonblock='$o_nonblock'
14071 obj_ext='$obj_ext'
14072 old_pthread_create_joinable='$old_pthread_create_joinable'
14073 optimize='$optimize'
14074 orderlib='$orderlib'
14075 osname='$osname'
14076 osvers='$osvers'
14077 package='$package'
14078 pager='$pager'
14079 passcat='$passcat'
14080 patchlevel='$patchlevel'
14081 path_sep='$path_sep'
14082 perl='$perl'
14083 perladmin='$perladmin'
14084 perlpath='$perlpath'
14085 pg='$pg'
14086 phostname='$phostname'
14087 pidtype='$pidtype'
14088 plibpth='$plibpth'
14089 pm_apiversion='$pm_apiversion'
14090 pmake='$pmake'
14091 pr='$pr'
14092 prefix='$prefix'
14093 prefixexp='$prefixexp'
14094 privlib='$privlib'
14095 privlibexp='$privlibexp'
14096 prototype='$prototype'
14097 ptrsize='$ptrsize'
14098 randbits='$randbits'
14099 randfunc='$randfunc'
14100 randseedtype='$randseedtype'
14101 ranlib='$ranlib'
14102 rd_nodata='$rd_nodata'
14103 rm='$rm'
14104 rmail='$rmail'
14105 runnm='$runnm'
14106 sPRIEldbl='$sPRIEldbl'
14107 sPRIFldbl='$sPRIFldbl'
14108 sPRIGldbl='$sPRIGldbl'
14109 sPRIX64='$sPRIX64'
14110 sPRId64='$sPRId64'
14111 sPRIeldbl='$sPRIeldbl'
14112 sPRIfldbl='$sPRIfldbl'
14113 sPRIgldbl='$sPRIgldbl'
14114 sPRIi64='$sPRIi64'
14115 sPRIo64='$sPRIo64'
14116 sPRIu64='$sPRIu64'
14117 sPRIx64='$sPRIx64'
14118 sched_yield='$sched_yield'
14119 scriptdir='$scriptdir'
14120 scriptdirexp='$scriptdirexp'
14121 sed='$sed'
14122 seedfunc='$seedfunc'
14123 selectminbits='$selectminbits'
14124 selecttype='$selecttype'
14125 sendmail='$sendmail'
14126 sh='$sh'
14127 shar='$shar'
14128 sharpbang='$sharpbang'
14129 shmattype='$shmattype'
14130 shortsize='$shortsize'
14131 shrpenv='$shrpenv'
14132 shsharp='$shsharp'
14133 sig_count='$sig_count'
14134 sig_name='$sig_name'
14135 sig_name_init='$sig_name_init'
14136 sig_num='$sig_num'
14137 sig_num_init='$sig_num_init'
14138 signal_t='$signal_t'
14139 sitearch='$sitearch'
14140 sitearchexp='$sitearchexp'
14141 sitebin='$sitebin'
14142 sitebinexp='$sitebinexp'
14143 sitelib='$sitelib'
14144 sitelibexp='$sitelibexp'
14145 siteprefix='$siteprefix'
14146 siteprefixexp='$siteprefixexp'
14147 sizetype='$sizetype'
14148 sleep='$sleep'
14149 smail='$smail'
14150 small='$small'
14151 so='$so'
14152 sockethdr='$sockethdr'
14153 socketlib='$socketlib'
14154 sort='$sort'
14155 spackage='$spackage'
14156 spitshell='$spitshell'
14157 split='$split'
14158 src='$src'
14159 ssizetype='$ssizetype'
14160 startperl='$startperl'
14161 startsh='$startsh'
14162 static_ext='$static_ext'
14163 stdchar='$stdchar'
14164 stdio_base='$stdio_base'
14165 stdio_bufsiz='$stdio_bufsiz'
14166 stdio_cnt='$stdio_cnt'
14167 stdio_filbuf='$stdio_filbuf'
14168 stdio_ptr='$stdio_ptr'
14169 stdio_stream_array='$stdio_stream_array'
14170 strings='$strings'
14171 submit='$submit'
14172 subversion='$subversion'
14173 sysman='$sysman'
14174 tail='$tail'
14175 tar='$tar'
14176 tbl='$tbl'
14177 tee='$tee'
14178 test='$test'
14179 timeincl='$timeincl'
14180 timetype='$timetype'
14181 touch='$touch'
14182 tr='$tr'
14183 trnl='$trnl'
14184 troff='$troff'
14185 uidsign='$uidsign'
14186 uidtype='$uidtype'
14187 uname='$uname'
14188 uniq='$uniq'
14189 use64bits='$use64bits'
14190 usedl='$usedl'
14191 uselargefiles='$uselargefiles'
14192 uselongdouble='$uselongdouble'
14193 usemorebits='$usemorebits'
14194 usemultiplicity='$usemultiplicity'
14195 usemymalloc='$usemymalloc'
14196 usenm='$usenm'
14197 useopcode='$useopcode'
14198 useperlio='$useperlio'
14199 useposix='$useposix'
14200 usesfio='$usesfio'
14201 useshrplib='$useshrplib'
14202 usesocks='$usesocks'
14203 usethreads='$usethreads'
14204 usevendorprefix='$usevendorprefix'
14205 usevfork='$usevfork'
14206 usrinc='$usrinc'
14207 uuname='$uuname'
14208 vendorbin='$vendorbin'
14209 vendorbinexp='$vendorbinexp'
14210 vendorlib='$vendorlib'
14211 vendorlibexp='$vendorlibexp'
14212 vendorprefix='$vendorprefix'
14213 vendorprefixexp='$vendorprefixexp'
14214 version='$version'
14215 vi='$vi'
14216 voidflags='$voidflags'
14217 xlibpth='$xlibpth'
14218 xs_apiversion='$xs_apiversion'
14219 zcat='$zcat'
14220 zip='$zip'
14221 EOT
14222
14223 : Add in command line options if available
14224 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14225
14226 : add special variables
14227 $test -f $src/patchlevel.h && \
14228 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14229 echo "CONFIGDOTSH=true" >>config.sh
14230
14231 : propagate old symbols
14232 if $test -f UU/config.sh; then
14233         <UU/config.sh sort | uniq >UU/oldconfig.sh
14234         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14235         sort | uniq -u >UU/oldsyms
14236         set X `cat UU/oldsyms`
14237         shift
14238         case $# in
14239         0) ;;
14240         *)
14241                 cat <<EOM
14242 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14243 EOM
14244                 echo "# Variables propagated from previous config.sh file." >>config.sh
14245                 for sym in `cat UU/oldsyms`; do
14246                         echo "    Propagating $hint variable "'$'"$sym..."
14247                         eval 'tmp="$'"${sym}"'"'
14248                         echo "$tmp" | \
14249                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14250                 done
14251                 ;;
14252         esac
14253 fi
14254
14255 : Finish up by extracting the .SH files
14256 case "$alldone" in
14257 exit)
14258         $rm -rf UU
14259         echo "Done."
14260         exit 0
14261         ;;
14262 cont)
14263         ;;
14264 '')
14265         dflt=''
14266         nostick=true
14267         $cat <<EOM
14268
14269 If you'd like to make any changes to the config.sh file before I begin
14270 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14271
14272 EOM
14273         rp="Press return or use a shell escape to edit config.sh:"
14274         . UU/myread
14275         nostick=''
14276         case "$ans" in
14277         '') ;;
14278         *) : in case they cannot read
14279                 sh 1>&4 -c "$ans";;
14280         esac
14281         ;;
14282 esac
14283
14284 : if this fails, just run all the .SH files by hand
14285 . ./config.sh
14286
14287 echo " "
14288 exec 1>&4
14289 . ./UU/extract
14290
14291 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14292         dflt=y
14293         case "$silent" in
14294         true) ;;
14295         *)
14296                 $cat <<EOM
14297
14298 Now you need to generate make dependencies by running "$make depend".
14299 You might prefer to run it in background: "$make depend > makedepend.out &"
14300 It can take a while, so you might not want to run it right now.
14301
14302 EOM
14303                 ;;
14304         esac
14305         rp="Run $make depend now?"
14306         . UU/myread
14307         case "$ans" in
14308         y*)
14309                 $make depend && echo "Now you must run a $make."
14310                 ;;
14311         *)
14312                 echo "You must run '$make depend' then '$make'."
14313                 ;;
14314         esac
14315 elif test -f [Mm]akefile; then
14316         echo " "
14317         echo "Now you must run a $make."
14318 else
14319         echo "Done."
14320 fi
14321
14322 if $test -f Policy.sh; then
14323     $cat <<EOM
14324
14325 If you compile $package on a different machine or from a different object
14326 directory, copy the Policy.sh file from this object directory to the
14327 new one before you run Configure -- this will help you with most of
14328 the policy defaults.
14329
14330 EOM
14331 fi
14332 if $test -f config.msg; then
14333     echo "Hmm.  I also noted the following information while running:"
14334     echo " "
14335     $cat config.msg >&4
14336     $rm -f config.msg
14337 fi
14338 $rm -f kit*isdone ark*isdone
14339 $rm -rf UU
14340
14341 : End of Configure
14342